diff kk-data-provider.c @ 239:ec81395bf08d

Solve name collisions and other problems caused by including Windows headers
author Daniele Nicolodi <daniele.nicolodi@obspm.fr>
date Thu, 12 Feb 2015 19:13:55 +0100
parents d7f91b9fb515
children 9b35a2b2c759
line wrap: on
line diff
--- a/kk-data-provider.c	Thu Jan 29 18:40:07 2015 +0100
+++ b/kk-data-provider.c	Thu Feb 12 19:13:55 2015 +0100
@@ -46,7 +46,7 @@
 
 int CVICALLBACK KKDataProvider (void *functionData)
 {
-	int mainThreadId;
+	int main_thread_id;
 	int rv;
 	char *resp;
 	struct event event;
@@ -54,7 +54,7 @@
 	char port[256];
 	
 	/* get main thread id to post messages to it */
-	mainThreadId = CmtGetMainThreadID();
+	main_thread_id = CmtGetMainThreadID();
 	
 	/* configuration file path */ 
 	char path[MAX_PATHNAME_LEN];
@@ -83,50 +83,50 @@
 	/* connect to KK FX80E counter */
 	rv = FX_Open(port);
 	if (! rv) {
-		SendMessage(mainThreadId, FX_Error());
+		send_message(main_thread_id, FX_Error());
 		goto error;
 	}
 
 	/* get counter hardware version string */
 	resp = FX_Command(0x81, 0xFFFF, 0x7001);
 	if (! resp) {
-		SendMessage(mainThreadId, FX_Error());
+		send_message(main_thread_id, FX_Error());
 		goto error;
 	}
-	SendMessage(mainThreadId, "KK Counter version: %s", resp + 4);
+	send_message(main_thread_id, "KK Counter version: %s", resp + 4);
 	
 	/* set report interval 1sec */
 	resp = FX_Command(0x29, 0x0F00, 0x0900);
 	if (! resp) {
-		SendMessage(mainThreadId, FX_Error());
+		send_message(main_thread_id, FX_Error());
 		goto error;
 	}
 	
 	/* set mode to instantaneous frequency measurement */
 	resp = FX_Command(0x42, 0x6F00, 0x2900);
 	if (! resp) {
-		SendMessage(mainThreadId, FX_Error());
+		send_message(main_thread_id, FX_Error());
 		goto error;
 	}
 
 	/* disable scrambler */
 	resp = FX_Command(0x50, 0x6FFF, 0x2900);
 	if (! resp) {
- 		SendMessage(mainThreadId, FX_Error());
+ 		send_message(main_thread_id, FX_Error());
  		goto error;
  	}
 	
 	/* read nchan channels */
 	resp = FX_Command(0x30 + nchan, 0x6FFF, 0x2900);
 	if (! resp) {
-		SendMessage(mainThreadId, FX_Error());
+		send_message(main_thread_id, FX_Error());
 		goto error;
 	}
 
 	/* enable synchronization */
 	resp = FX_Command(0x0F, 0x00, 0x00);
 	if (! resp) {
-		SendMessage(mainThreadId, FX_Error());
+		send_message(main_thread_id, FX_Error());
 		goto error;
 	}
 	
@@ -134,7 +134,7 @@
 		/* receive data from counter */
 		FX_Recv(&resp, TIMEOUT);
 		if (! resp) {
-			SendMessage(mainThreadId, FX_Error());
+			send_message(main_thread_id, FX_Error());
 			break;
 		}
 		
@@ -149,7 +149,7 @@
 				&event.data[0], &event.data[1], &event.data[2], &event.data[3],
 				&event.data[4], &event.data[5], &event.data[6], &event.data[7]);
 			if (rv != nchan) {
-				SendMessage(mainThreadId, "KK Counter: data conversion error: %d != %d", rv, nchan);
+				send_message(main_thread_id, "KK Counter: data conversion error: %d != %d", rv, nchan);
 				goto error;
 			}
 			
@@ -169,13 +169,13 @@
 		} else if (strneq(resp, "7020", 4)) {
 			/* undocumented packet. it probably reports the header for
 			   subsequent data packets */
-			SendMessage(mainThreadId, "KK Counter packet header: %s", resp + 7);
+			send_message(main_thread_id, "KK Counter packet header: %s", resp + 7);
 		} else if (strneq(resp, "7F51", 4)) {
 			/* measurement interval synchronized */
-			SendMessage(mainThreadId, "KK Counter measurement interval synchronized");
+			send_message(main_thread_id, "KK Counter measurement interval synchronized");
 		} else {
 			/* send message to the main thread */
-			SendMessage(mainThreadId, "KK Counter: %s", resp);
+			send_message(main_thread_id, "KK Counter: %s", resp);
 		}
 	}