| gclib 329 Communications API for Galil controllers and PLCs |

All Data Structures Files Functions Variables Typedefs Macros Pages
gclibo.h
Go to the documentation of this file.
1
7 #ifndef I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
8 #define I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
9
10 //set library visibility for gcc and msvc
11 #if BUILDING_GCLIB && HAVE_VISIBILITY
12 #define GCLIB_DLL_EXPORTED __attribute__((__visibility__("default")))
13 #elif BUILDING_GCLIB && defined _MSC_VER
14 #define GCLIB_DLL_EXPORTED __declspec(dllexport)
15 #elif defined _MSC_VER
16 #define GCLIB_DLL_EXPORTED __declspec(dllimport)
17 #else
18 #define GCLIB_DLL_EXPORTED
19 #endif
20
21 #define _CRT_SECURE_NO_WARNINGS //use traditional C calls like strncpy()
22
23 #include "gclib.h" //Galil's C Library
24
25 #ifdef _WIN32
26 #define GCALL __stdcall
27 #else
28 #define GCALL /* nothing */
29 #endif
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34
35 #define MALLOCBUF G_HUGE_BUFFER //malloc used for large program and array uploads.
36 #define MAXPROG MALLOCBUF //maximum size for a program.
37 #define MAXARRAY MALLOCBUF //maximum size for an array table upload.
38 #define POLLINGINTERVAL 100 //interval for polling commands, in miliseconds.
39
41 GCLIB_DLL_EXPORTED void GCALL GSleep(unsigned int timeout_ms);
49 GCLIB_DLL_EXPORTED GReturn GCALL GVersion(GCStringOut ver, GSize ver_len);
60 GCLIB_DLL_EXPORTED GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len);
81 GCLIB_DLL_EXPORTED GReturn GCALL GInfo(GCon g, GCStringOut info, GSize info_len);
94 GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms);
106 GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command);
120 GCLIB_DLL_EXPORTED GReturn GCALL GCmdT(GCon g, GCStringIn command, GCStringOut trimmed_response, GSize response_len, GCStringOut* front);
138 GCLIB_DLL_EXPORTED GReturn GCALL GCmdI(GCon g, GCStringIn command, int* value);
153 GCLIB_DLL_EXPORTED GReturn GCALL GCmdD(GCon g, GCStringIn command, double* value);
169 GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete(GCon g, GCStringIn axes);
187 GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate(GCon g, double period_ms);
201 GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor);
214 GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path);
226 GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path);
240 GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names);
255 GCLIB_DLL_EXPORTED GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len);
282 GCLIB_DLL_EXPORTED GReturn GCALL GAssign(char* ip, char* mac);
300 GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error, GSize error_len);
310 #ifdef __cplusplus
311 } //extern "C"
312 #endif
313
314 #endif //I_007AD0AF_C956_4B96_ADE2_AD04FAFFEE99
GMotionComplete
GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete(GCon g, GCStringIn axes)
Blocking call that returns once all axes specified have completed their motion.
Definition: gclibo.c:113
GSize
unsigned int GSize
Size of buffers, etc.
Definition: gclib.h:60
GIpRequests
GCLIB_DLL_EXPORTED GReturn GCALL GIpRequests(GCStringOut requests, GSize requests_len)
Provides a list of all Galil controllers requesting IP addresses via BOOT-P or DHCP.
Definition: gclibo.c:44
GCmdT
GCLIB_DLL_EXPORTED 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:56
GRecordRate
GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate(GCon g, double period_ms)
Sets the asynchronous data record to a user-specified period via DR.
Definition: gclibo.c:139
GArrayUploadFile
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile(GCon g, GCStringIn file_path, GCStringIn names)
Array upload to file.
Definition: arrays.c:331
GAddresses
GCLIB_DLL_EXPORTED GReturn GCALL GAddresses(GCStringOut addresses, GSize addresses_len)
Uses GUtility() and G_UTIL_ADDRESSES to provide a listing of all available connection addresses...
Definition: gclibo.c:29
GCon
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen()...
Definition: gclib.h:59
GProgramDownloadFile
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
Program download from file.
Definition: gclibo.c:184
GTimeout
GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms)
Uses GUtility() and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
Definition: gclibo.c:34
GArrayDownloadFile
GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile(GCon g, GCStringIn file_path)
Array download from file.
Definition: arrays.c:256
GVersion
GCLIB_DLL_EXPORTED GReturn GCALL GVersion(GCStringOut ver, GSize ver_len)
Uses GUtility() and G_UTIL_VERSION to provide the library version number.
Definition: gclibo.c:19
GAssign
GCLIB_DLL_EXPORTED GReturn GCALL GAssign(char *ip, char *mac)
Assigns IP address over the Ethernet to a controller at a given MAC address.
Definition: gclibo.c:39
GReturn
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition: gclib.h:58
GInfo
GCLIB_DLL_EXPORTED 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:24
GError
GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
Provides a human-readable description string for return codes.
Definition: gclibo.c:256
GCStringIn
const char * GCStringIn
C-string input to the library. Implies null-termination.
Definition: gclib.h:63
GSleep
GCLIB_DLL_EXPORTED 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:14
GCmdD
GCLIB_DLL_EXPORTED 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:102
GCStringOut
char * GCStringOut
C-string output from the library. Implies null-termination.
Definition: gclib.h:62
GCALL
#define GCALL
Specify calling convention for Windows.
Definition: gclib.h:24
gclib.h
GCmdI
GCLIB_DLL_EXPORTED 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:91
GProgramUploadFile
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
Program upload to file.
Definition: gclibo.c:227
GCmd
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
Definition: gclibo.c:49