| gclib 450 Communications API for Galil controllers and PLCs |

gclibo.c
Go to the documentation of this file.
1
7 #include "gclibo.h"
8
9 #ifndef _CRT_SECURE_NO_WARNINGS
10 #define _CRT_SECURE_NO_WARNINGS //use traditional C calls like strncpy()
11 #endif
12
13 #include <stdlib.h> //atoi, atof
14 #include <string.h> //strcpy
15 #include <stdio.h> //fopen
16 #include <math.h> //log()
17
18
19
20 void GCALL GSleep(unsigned int timeout_ms)
21 {
22 GUtility(0, G_UTIL_SLEEP, &timeout_ms, 0);
23 }
24
25 GReturn GCALL GVersion(GCStringOut ver, GSize ver_len)
26 {
27 int str_len;
28 GReturn rc;
29 if ((rc = GUtility(0, G_UTIL_VERSION, ver, &ver_len)) != G_NO_ERROR)
30 return rc;
31
32 #ifdef G_USE_GCAPS
33 str_len = strlen(ver) + 1;
34 ver_len -= str_len;
35 if (ver_len > 0
36 && GUtility(0, G_UTIL_GCAPS_VERSION, ver + str_len, &ver_len) == G_NO_ERROR)
37 {
38 ver[str_len - 1] = ' '; //add a delimiter
39 }
40 #endif
41
42 return rc;
43 }
44
45 GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
46 {
47 return GUtility(g, G_UTIL_INFO, info, &info_len);
48 }
49
50 GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len)
51 {
52 #ifdef G_USE_GCAPS
53 GReturn rc;
54 if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_ADDRESSES, addresses, &addresses_len)))
55 return rc;
56 #endif
57
58 return GUtility(0, G_UTIL_ADDRESSES, addresses, &addresses_len);
59 }
60
61 GReturn GCALL GTimeout(GCon g, short timeout_ms)
62 {
63 return GUtility(g, G_UTIL_TIMEOUT_OVERRIDE, &timeout_ms, 0);
64 }
65
66 GReturn GCALL GAssign(GCStringIn ip, GCStringIn mac)
67 {
68 /*
69 * On Linux and Apple, the IP address is pinged prior to assigning.
70 * On Windows, pinging first can make the arp table stale, and the
71 * IP address unreachable for several seconds. We skip ping so that
72 * we can immediately connect.
73 */
74
75 GReturn rc;
76 int reply = 0; //ping reply is nonzero
77
78 #ifdef G_USE_GCAPS
79
80 #if defined(__linux__) || defined(__APPLE__)
81 GUtility(0, G_UTIL_GCAPS_PING, (void*)ip, &reply); //ping to see if IP address is already taken
82 if (reply)
83 return G_GCLIB_UTILITY_IP_TAKEN;
84 #endif
85
86 if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_ASSIGN, (void*)ip, (void*)mac)))
87 return rc;
88 #endif
89
90 #if defined(__linux__) || defined(__APPLE__)
91 GUtility(0, G_UTIL_PING, (void*)ip, &reply); //ping to see if IP address is already taken
92 if (reply)
93 return G_GCLIB_UTILITY_IP_TAKEN;
94 #endif
95
96 return GUtility(0, G_UTIL_ASSIGN, (void*)ip, (void*)mac);
97 }
98
99 GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len)
100 {
101 #ifdef G_USE_GCAPS
102 GReturn rc;
103 if (G_NO_ERROR == (rc = GUtility(0, G_UTIL_GCAPS_IPREQUEST, requests, &requests_len)))
104 return rc;
105 #endif
106
107 return GUtility(0, G_UTIL_IPREQUEST, requests, &requests_len);
108 }
109
110 GReturn GCALL GCmd(GCon g, GCStringIn command)
111 {
112 char buf[G_SMALL_BUFFER]; //response usually brief, e.g. :
113 return GCommand(g, command, buf, G_SMALL_BUFFER, 0);
114 }
115
116 GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut* front)
117 {
118 GSize read;
119 GReturn rc;
120 int i;
121 char c;
122 if ((rc = GCommand(g, command, trimmed_response, response_len, &read)) != G_NO_ERROR)
123 return rc;
124 //if here, the data is already null-terminated, just trim.
125 for (i = read - 1; i >= 0; i--) //read does NOT include null terminator.
126 {
127 c = trimmed_response[i];
128 if ((c == ':') || (c == '\n') || (c == '\r'))
129 trimmed_response[i] = 0; //trim it
130 else
131 break; //we hit non-trimmable data, bail out.
132 }
133
134 if (front) //null to skip "trim" on front.
135 {
136 *front = trimmed_response;
137 i = 0;
138 do
139 {
140 c = trimmed_response[i++];
141 if (c == ' ')
142 (*front)++;
143 else
144 break;
145 } while (1); //exit will be any non-space, including null terminator
146 }
147
148 return G_NO_ERROR;
149 }
150
151 GReturn GCALL GCmdI(GCon g, GCStringIn command, int* value)
152 {
153 char buf[G_SMALL_BUFFER]; //response should be ~19 chars
154 GSize read;
155 GReturn rc;
156 if ((rc = GCommand(g, command, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
157 return rc;
158 *value = atoi(buf);
159 return G_NO_ERROR;
160 }
161
162 GReturn GCALL GCmdD(GCon g, GCStringIn command, double* value)
163 {
164 char buf[G_SMALL_BUFFER]; //response should be ~19 chars
165 GSize read;
166 GReturn rc;
167 if ((rc = GCommand(g, command, buf, G_SMALL_BUFFER, &read)) != G_NO_ERROR)
168 return rc;
169 *value = atof(buf);
170 return G_NO_ERROR;
171 }
172
173 GReturn GCALL GMotionComplete(GCon g, GCStringIn axes)
174 {
175 char pred[] = "_BGm=0"; //predicate for polling the axis' motion status, m is a place holder replaced below.
176 GReturn rc;
177 GSize i = 0; //C, not C++
178 GSize len = strlen(axes);
179
180 for (i = 0; i < len; i++) //iterate through all chars in axes
181 {
182 pred[3] = axes[i]; //set the axis
183 rc = GWaitForBool(g, pred, -1); //poll forever. Change this if a premature exit is desired.
184 if (rc != G_NO_ERROR)
185 return rc;
186 }//axes
187
188 return G_NO_ERROR;
189 }
190
191 GReturn GCALL GWaitForBool(GCon g, GCStringIn predicate, int trials)
192 {
193 char cmd[G_LINE_BUFFER];
194 char buf[G_LINE_BUFFER];
195 int rc;
196 strcpy(cmd, "MG (");
197 strcat(cmd, predicate);
198 strcat(cmd, ")"); //enclose in parenthesis
199
200 for (; trials != 0; --trials) //negative value will poll "forever"
201 {
202 rc = GCommand(g, cmd, buf, G_SMALL_BUFFER, 0); //check the predicate
203 if (rc != G_NO_ERROR)
204 return rc;
205
206 if (atoi(buf)) //nonzero is true, bad atoi returns 0
207 return G_NO_ERROR;
208 else
209 GSleep(POLLINGINTERVAL);
210 }
211 //if we're here, the trials ran out
212 return G_GCLIB_POLLING_FAILED;
213 }
214
215 GReturn GCALL GRecordRate(GCon g, double period_ms)
216 {
217 char buf[G_SMALL_BUFFER];
218 double dt;
219 double period_arg;
220
221 if (period_ms == 0) //turn off
222 return GCmd(g, "DR 0");
223
224 if (GCmdD(g, "TM?", &dt) == G_NO_ERROR)
225 {
226 dt /= 1024.0; //ms per controller sample
227 if (!dt) dt = 1; //don't want to divide by zero below
228 }
229 else
230 {
231 dt = 0.9765625; //RIO doesn't have TM
232 }
233
234 period_arg = period_ms / dt; //data record specified in samples between records
235
236 if (GCmdT(g, "\x12\x16", buf, sizeof(buf), 0) == G_NO_ERROR) //Revision string, ^R^V
237 {
238 if (strstr(buf, "DMC18")) //PCI controller
239 period_arg = log(period_arg) / log(2.0); //PCI DR arg is 2^n.
240 else if ((strstr(buf, "DMC40") != NULL) //4000
241 || (strstr(buf, "DMC500") != NULL) //50000
242 || (strstr(buf, "RIO") != NULL)) // RIO
243 {
244 if (period_arg < 2) period_arg = 2; //lowest non-zero DR
245 }
246 else if ((strstr(buf, "DMC41") != NULL) || (strstr(buf, "DMC21") != NULL)) //4103, 2103
247 {
248 if (period_arg < 8) period_arg = 8; //lowest non-zero DR
249 }
250 else if ((strstr(buf, "DMC3") != NULL)) //30010, 31010
251 {
252 if (period_arg < 4) period_arg = 4; //lowest non-zero DR
253 }
254 }
255
256 sprintf(buf, "DR %d", (int)period_arg);
257 return GCmd(g, buf);
258 }
259
260 GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
261 {
262 FILE *file;
263 long file_size;
264 char* program_buffer;
265 GReturn rc = G_NO_ERROR;
266
267 if (!(file = fopen(file_path, "rb"))) //open file for reading, binary mode
268 return G_BAD_FILE;
269
270 fseek(file, 0, SEEK_END); //find end of file
271 file_size = ftell(file); //add one to null terminate below
272 rewind(file);
273
274 if (file_size) //don't malloc 0.
275 {
276
277 if (!(program_buffer = malloc(file_size + 1))) //allocate memory for the data, +1 for null termination below
278 {
279 fclose(file);
280 return G_BAD_FULL_MEMORY;
281 }
282
283 if (file_size != fread(program_buffer, 1, file_size, file))
284 {
285 fclose(file);
286 free(program_buffer); //free memory
287 return G_BAD_FILE;
288 }
289 program_buffer[file_size] = 0; //null terminate, malloc was one byte larger for this
290 }
291 else
292 {
293 program_buffer = ""; //nullstring
294 }
295
296 fclose(file); //done with file, close it
297
298 rc = GProgramDownload(g, program_buffer, preprocessor); //call the gclib downloader
299 if (file_size) free(program_buffer); //free memory
300 return rc;
301 }
302
303 GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
304 {
305 FILE *file;
306 GReturn rc = G_NO_ERROR;
307 char* program_buffer;
308 long file_size;
309
310 if (!(file = fopen(file_path, "wb"))) //open file for writing, binary mode
311 return G_BAD_FILE;
312
313 if (!(program_buffer = malloc(MAXPROG))) //allocate memory for the data
314 {
315 fclose(file);
316 return G_BAD_FULL_MEMORY;
317 }
318
319 if ((rc = GProgramUpload(g, program_buffer, MAXPROG)) == G_NO_ERROR)
320 {
321 file_size = strlen(program_buffer);
322 if (file_size != fwrite(program_buffer, 1, file_size, file))
323 rc = G_BAD_FILE;
324 }
325
326 fclose(file);
327 free(program_buffer);
328 return rc;
329 }
330
331
332 void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
333 {
334 char* error_message;
335
336 switch (rc)
337 {
338 case G_NO_ERROR:
339 error_message = G_NO_ERROR_S;
340 break;
341
342 case G_GCLIB_ERROR:
343 error_message = G_GCLIB_ERROR_S;
344 break;
345
346 case G_GCLIB_UTILITY_ERROR:
347 error_message = G_GCLIB_UTILITY_ERROR_S;
348 break;
349
350 case G_GCLIB_UTILITY_IP_TAKEN:
351 error_message = G_GCLIB_UTILITY_IP_TAKEN_S;
352 break;
353
354 case G_GCLIB_NON_BLOCKING_READ_EMPTY:
355 error_message = G_GCLIB_NON_BLOCKING_READ_EMPTY_S;
356 break;
357
358 case G_TIMEOUT:
359 error_message = G_TIMEOUT_S;
360 break;
361
362 case G_OPEN_ERROR:
363 error_message = G_OPEN_ERROR_S;
364 break;
365
366 case G_READ_ERROR:
367 error_message = G_READ_ERROR_S;
368 break;
369
370 case G_WRITE_ERROR:
371 error_message = G_WRITE_ERROR_S;
372 break;
373
374 case G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND:
375 error_message = G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S;
376 break;
377
378 case G_DATA_RECORD_ERROR:
379 error_message = G_DATA_RECORD_ERROR_S;
380 break;
381
382 case G_UNSUPPORTED_FUNCTION:
383 error_message = G_UNSUPPORTED_FUNCTION_S;
384 break;
385
386 case G_BAD_ADDRESS:
387 error_message = G_BAD_ADDRESS_S;
388 break;
389
390 case G_BAD_FIRMWARE_LOAD:
391 error_message = G_BAD_FIRMWARE_LOAD_S;
392 break;
393
394 case G_FIRMWARE_LOAD_NOT_SUPPORTED:
395 error_message = G_FIRMWARE_LOAD_NOT_SUPPORTED_S;
396 break;
397
398 case G_ARRAY_NOT_DIMENSIONED:
399 error_message = G_ARRAY_NOT_DIMENSIONED_S;
400 break;
401
402 case G_CONNECTION_NOT_ESTABLISHED:
403 error_message = G_CONNECTION_NOT_ESTABLISHED_S;
404 break;
405
406 case G_ILLEGAL_DATA_IN_PROGRAM:
407 error_message = G_ILLEGAL_DATA_IN_PROGRAM_S;
408 break;
409
410 case G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT:
411 error_message = G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT_S;
412 break;
413
414 case G_INVALID_PREPROCESSOR_OPTIONS:
415 error_message = G_INVALID_PREPROCESSOR_OPTIONS_S;
416 break;
417
418 case G_BAD_RESPONSE_QUESTION_MARK:
419 error_message = G_BAD_RESPONSE_QUESTION_MARK_S;
420 break;
421
422 case G_BAD_VALUE_RANGE:
423 error_message = G_BAD_VALUE_RANGE_S;
424 break;
425
426 case G_BAD_FULL_MEMORY:
427 error_message = G_BAD_FULL_MEMORY_S;
428 break;
429
430 case G_BAD_LOST_DATA:
431 error_message = G_BAD_LOST_DATA_S;
432 break;
433
434 case G_BAD_FILE:
435 error_message = G_BAD_FILE_S;
436 break;
437
438 case G_GCAPS_OPEN_ERROR:
439 error_message = G_GCAPS_OPEN_ERROR_S;
440 break;
441
442 case G_GCAPS_SUBSCRIPTION_ERROR:
443 error_message = G_GCAPS_SUBSCRIPTION_ERROR_S;
444 break;
445
446 default:
447 error_message = "internal error";
448 break;
449 }
450
451 strncpy(error, error_message, error_len);
452 error[error_len - 1] = 0; //ensure null termination
453 }
GSleep
void GCALL GSleep(unsigned int timeout_ms)
Uses GUtility() and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing-base...
Definition: gclibo.c:20
G_CONNECTION_NOT_ESTABLISHED
#define G_CONNECTION_NOT_ESTABLISHED
Function was called with no connection.
Definition: gclib_errors.h:57
G_SMALL_BUFFER
#define G_SMALL_BUFFER
Most reads from Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
Definition: gclib.h:66
GInfo
GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len)
Uses GUtility() and G_UTIL_INFO to provide a useful connection string.
Definition: gclibo.c:45
GSize
unsigned int GSize
Size of buffers, etc.
Definition: gclib.h:72
G_UTIL_IPREQUEST
#define G_UTIL_IPREQUEST
GUtility(), get a list of hardware requesting IPs.
Definition: gclib.h:50
G_UTIL_GCAPS_IPREQUEST
#define G_UTIL_GCAPS_IPREQUEST
GUtility(), get a list of hardware requesting IPs from the gcaps server.
Definition: gclib.h:60
G_UTIL_PING
#define G_UTIL_PING
GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned.
Definition: gclib.h:53
G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT
#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT
Program preprocessor could not compress the program within the user's constraints.
Definition: gclib_errors.h:63
GCmdT
GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut *front)
Wrapper around GCommand that trims the response.
Definition: gclibo.c:116
MAXPROG
#define MAXPROG
Maximum size for a program.
Definition: gclibo.h:34
G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND
#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND
GCommand() was called with an illegal command, e.g. ED, DL or QD.
Definition: gclib_errors.h:42
G_DATA_RECORD_ERROR
#define G_DATA_RECORD_ERROR
Data record error, e.g. DR attempted on serial connection.
Definition: gclib_errors.h:45
G_OPEN_ERROR
#define G_OPEN_ERROR
Device could not be opened. E.G. Serial port or PCI device already open.
Definition: gclib_errors.h:30
G_ILLEGAL_DATA_IN_PROGRAM
#define G_ILLEGAL_DATA_IN_PROGRAM
Data to download not valid, e.g. \ in data.
Definition: gclib_errors.h:60
GProgramUploadFile
GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
Program upload to file.
Definition: gclibo.c:303
G_BAD_RESPONSE_QUESTION_MARK
#define G_BAD_RESPONSE_QUESTION_MARK
Operation received a ?, indicating controller has a TC error.
Definition: gclib_errors.h:66
GUtility
GCLIB_DLL_EXPORTED GReturn GCALL GUtility(GCon g, GOption request, GMemory memory1, GMemory memory2)
Provides read/write access to driver settings and convenience features based on the request variable.
G_ARRAY_NOT_DIMENSIONED
#define G_ARRAY_NOT_DIMENSIONED
Array operation was called on an array that was not in the controller's array table,...
Definition: gclib_errors.h:54
G_TIMEOUT
#define G_TIMEOUT
Operation timed out. Timeout is set by the –timeout option in GOpen() and can be overriden by GSettin...
Definition: gclib_errors.h:27
G_GCAPS_SUBSCRIPTION_ERROR
#define G_GCAPS_SUBSCRIPTION_ERROR
GMessage(), GRecord(), GInterrupt() called on a connection without –subscribe switch.
Definition: gclib_errors.h:90
POLLINGINTERVAL
#define POLLINGINTERVAL
Interval, in milliseconds, for polling commands, e.g. GWaitForBool().
Definition: gclibo.h:36
GCmdI
GReturn GCALL GCmdI(GCon g, GCStringIn command, int *value)
Wrapper around GCommand that provides the return value of a command parsed into an int.
Definition: gclibo.c:151
G_GCLIB_UTILITY_ERROR
#define G_GCLIB_UTILITY_ERROR
An invalid request value was specified to GUtility.
Definition: gclib_errors.h:15
GMotionComplete
GReturn GCALL GMotionComplete(GCon g, GCStringIn axes)
Blocking call that returns once all axes specified have completed their motion.
Definition: gclibo.c:173
G_UTIL_SLEEP
#define G_UTIL_SLEEP
GUtility(), specify an interval to sleep.
Definition: gclib.h:48
G_GCAPS_OPEN_ERROR
#define G_GCAPS_OPEN_ERROR
gcaps connection couldn't open. Server is not running or is not reachable.
Definition: gclib_errors.h:87
G_UNSUPPORTED_FUNCTION
#define G_UNSUPPORTED_FUNCTION
Function cannot be called on this bus. E.G. GInterrupt() on serial.
Definition: gclib_errors.h:48
GCmd
GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
Definition: gclibo.c:110
G_GCLIB_ERROR
#define G_GCLIB_ERROR
General library error. Indicates internal API caught an unexpected error. Contact Galil support if th...
Definition: gclib_errors.h:12
G_UTIL_ADDRESSES
#define G_UTIL_ADDRESSES
GUtility(), get a list of available connections.
Definition: gclib.h:49
GVersion
GReturn GCALL GVersion(GCStringOut ver, GSize ver_len)
Uses GUtility(), G_UTIL_VERSION and G_UTIL_GCAPS_VERSION to provide the library and gcaps version num...
Definition: gclibo.c:25
G_UTIL_INFO
#define G_UTIL_INFO
GUtility(), get a connection info string.
Definition: gclib.h:47
G_LINE_BUFFER
#define G_LINE_BUFFER
For writes, via command interpreter, to the Galil.
Definition: gclib.h:68
GCon
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
Definition: gclib.h:71
G_UTIL_TIMEOUT_OVERRIDE
#define G_UTIL_TIMEOUT_OVERRIDE
GUtility(), read/write access to timeout override.
Definition: gclib.h:44
GWaitForBool
GReturn GCALL GWaitForBool(GCon g, GCStringIn predicate, int trials)
Blocking call that returns when the controller evaluates the predicate as true.
Definition: gclibo.c:191
G_UTIL_GCAPS_VERSION
#define G_UTIL_GCAPS_VERSION
GUtility(), get the version of the gcaps server.
Definition: gclib.h:57
GError
void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
Provides a human-readable description string for return codes.
Definition: gclibo.c:332
GProgramDownload
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor)
Downloads a program to the controller's program buffer.
G_READ_ERROR
#define G_READ_ERROR
Device read failed. E.G. Socket was closed by remote host. See G_UTIL_GCAPS_KEEPALIVE.
Definition: gclib_errors.h:33
GCommand
GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize *bytes_returned)
Performs a command-and-response transaction on the connection.
G_BAD_FIRMWARE_LOAD
#define G_BAD_FIRMWARE_LOAD
Bad firmware upgrade.
Definition: gclib_errors.h:84
GProgramUpload
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len)
Uploads a program from the controller's program buffer.
GTimeout
GReturn GCALL GTimeout(GCon g, short timeout_ms)
Uses GUtility() and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
Definition: gclibo.c:61
GReturn
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition: gclib.h:70
G_GCLIB_UTILITY_IP_TAKEN
#define G_GCLIB_UTILITY_IP_TAKEN
The IP cannot be assigned because ping returned a reply.
Definition: gclib_errors.h:18
GIpRequests
GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len)
Uses GUtility(), G_UTIL_GCAPS_IPREQUEST or G_UTIL_IPREQUEST to provide a list of all Galil controller...
Definition: gclibo.c:99
G_GCLIB_POLLING_FAILED
#define G_GCLIB_POLLING_FAILED
GWaitForBool out of polling trials.
Definition: gclib_errors.h:24
G_INVALID_PREPROCESSOR_OPTIONS
#define G_INVALID_PREPROCESSOR_OPTIONS
GProgramDownload was called with a bad preprocessor directive.
Definition: gclib_errors.h:39
G_BAD_LOST_DATA
#define G_BAD_LOST_DATA
Lost data, e.g. GCommand() response buffer was too small for the controller's response.
Definition: gclib_errors.h:75
G_UTIL_VERSION
#define G_UTIL_VERSION
GUtility(), get a library version string.
Definition: gclib.h:46
G_BAD_FULL_MEMORY
#define G_BAD_FULL_MEMORY
Not enough memory for an operation, e.g. all connections allowed for a process already taken.
Definition: gclib_errors.h:72
G_BAD_VALUE_RANGE
#define G_BAD_VALUE_RANGE
Bad value or range, e.g. GCon g variable passed to function was bad.
Definition: gclib_errors.h:69
G_WRITE_ERROR
#define G_WRITE_ERROR
Device write failed. E.G. Socket was closed by remote host. See G_UTIL_GCAPS_KEEPALIVE.
Definition: gclib_errors.h:36
GCStringIn
const char * GCStringIn
C-string input to the library. Implies null-termination.
Definition: gclib.h:75
G_UTIL_GCAPS_PING
#define G_UTIL_GCAPS_PING
GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned....
Definition: gclib.h:62
G_NO_ERROR
#define G_NO_ERROR
Return value if function succeeded.
Definition: gclib_errors.h:9
G_GCLIB_NON_BLOCKING_READ_EMPTY
#define G_GCLIB_NON_BLOCKING_READ_EMPTY
GMessage, GInterrupt, and GRecord can be called with a zero timeout. If there wasn't data waiting in ...
Definition: gclib_errors.h:21
GAssign
GReturn GCALL GAssign(GCStringIn ip, GCStringIn mac)
Uses GUtility(), G_UTIL_GCAPS_ASSIGN or G_UTIL_ASSIGN to assign an IP address over the Ethernet to a ...
Definition: gclibo.c:66
G_FIRMWARE_LOAD_NOT_SUPPORTED
#define G_FIRMWARE_LOAD_NOT_SUPPORTED
Firmware is not supported on this bus, e.g. Ethernet for the DMC-21x3 series.
Definition: gclib_errors.h:51
GCStringOut
char * GCStringOut
C-string output from the library. Implies null-termination.
Definition: gclib.h:74
GAddresses
GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len)
Uses GUtility(), G_UTIL_GCAPS_ADDRESSES or G_UTIL_ADDRESSES to provide a listing of all available con...
Definition: gclibo.c:50
GCmdD
GReturn GCALL GCmdD(GCon g, GCStringIn command, double *value)
Wrapper around GCommand that provides the return value of a command parsed into a double.
Definition: gclibo.c:162
GCALL
#define GCALL
Specify calling convention for Windows.
Definition: gclib.h:24
G_UTIL_GCAPS_ADDRESSES
#define G_UTIL_GCAPS_ADDRESSES
GUtility(), get a list of available connections from the gcaps server.
Definition: gclib.h:59
G_BAD_ADDRESS
#define G_BAD_ADDRESS
Bad address.
Definition: gclib_errors.h:81
GProgramDownloadFile
GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
Program download from file.
Definition: gclibo.c:260
GRecordRate
GReturn GCALL GRecordRate(GCon g, double period_ms)
Sets the asynchronous data record to a user-specified period via DR.
Definition: gclibo.c:215
G_BAD_FILE
#define G_BAD_FILE
Bad file path, bad file contents, or bad write.
Definition: gclib_errors.h:78
gclibo.h
G_UTIL_ASSIGN
#define G_UTIL_ASSIGN
GUtility(), assign IP addresses via Boot-P reply.
Definition: gclib.h:51
G_UTIL_GCAPS_ASSIGN
#define G_UTIL_GCAPS_ASSIGN
GUtility(), assign IP addresses via Boot-P reply from the gcaps server.
Definition: gclib.h:61