gclib 2.0.10
Galil Communications Library
Loading...
Searching...
No Matches
gclib.h
Go to the documentation of this file.
1
26#ifndef I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
27#define I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
28
29//set library visibility for gcc and msvc
30#if BUILDING_GCLIB && HAVE_VISIBILITY
31#define GCLIB_DLL_EXPORTED __attribute__((__visibility__("default")))
32#elif BUILDING_GCLIB && defined _MSC_VER
33#define GCLIB_DLL_EXPORTED __declspec(dllexport)
34#elif defined _MSC_VER
35#define GCLIB_DLL_EXPORTED __declspec(dllimport)
36#else
37#define GCLIB_DLL_EXPORTED
38#endif
39
40#ifdef _MSC_VER
41#define GCLIB_DEPRECATED __declspec(deprecated)
42#elif defined(__GNUC__) | defined(__clang__)
43#define GCLIB_DEPRECATED __attribute__((__deprecated__))
44#else
45#define GCLIB_DEPRECATED
46#endif
47
48#include "gclib_record.h" // Galil data record structs and unions.
49#include "gclib_errors.h" // GReturn error code values and strings.
50
51#ifdef _WIN32
52#define GCALL __stdcall
53#else
54#define GCALL
55#endif
56
57//#define G_USE_GCOMPOUND //!< GCompound() is not part of the standard gclib release. Contact Galil Applications for a special build, http://galil.com/contact.
58
59#ifdef __cplusplus
60extern "C" {
61#endif
62
63 //Constants for function arguments
64#define G_DR 1
65#define G_QR 0
66#define G_BOUNDS -1
67#define G_CR 0
68#define G_COMMA 1
69#define G_PUBLISH_SERVER 1
70#define G_REMOVE_SERVER 0
71
72 //Constants for GUtility()
73#define G_UTIL_TIMEOUT 1
74#define G_UTIL_TIMEOUT_OVERRIDE 2
75#define G_USE_INITIAL_TIMEOUT -1
76#define G_UTIL_VERSION 128
77#define G_UTIL_INFO 129
78#define G_UTIL_SLEEP 130
79#define G_UTIL_ADDRESSES 131
80#define G_UTIL_IPREQUEST 132
81#define G_UTIL_ASSIGN 133
82#define G_UTIL_DEVICE_INITIALIZE 134
83#define G_UTIL_PING 135
84#define G_UTIL_ERROR_CONTEXT 136
85
86#define G_UTIL_GCAPS_HOST 256
87#define G_UTIL_GCAPS_VERSION 257
88#define G_UTIL_GCAPS_KEEPALIVE 258
89#define G_UTIL_GCAPS_ADDRESSES 259
90#define G_UTIL_GCAPS_IPREQUEST 260
91#define G_UTIL_GCAPS_ASSIGN 261
92#define G_UTIL_GCAPS_PING 262
93#define G_UTIL_GCAPS_LIST_SERVERS 263
94#define G_UTIL_GCAPS_PUBLISH_SERVER 264
95#define G_UTIL_GCAPS_SET_SERVER 265
96#define G_UTIL_GCAPS_SERVER_STATUS 266
97#define G_UTIL_GCAPS_REMOTE_CONNECTIONS 267
98#define G_UTIL_GCAPS_SERVER_INFO 268
99#define G_UTIL_GCAPS_ADDRESSES_GET_REMEMBERED 269
100#define G_UTIL_GCAPS_ADDRESSES_SET_REMEMBERED 270
101
102 //Convenience constants
103#define G_SMALL_BUFFER 1024
104#define G_HUGE_BUFFER 524288
105#define G_LINE_BUFFER 80
106
107 typedef int GReturn;
108 typedef void* GCon;
109 typedef unsigned int GSize;
110 typedef int GOption;
111 typedef char* GCStringOut;
112 typedef const char* GCStringIn;
113 typedef char* GBufOut;
114 typedef const char* GBufIn;
115 typedef unsigned char GStatus;
116 typedef void* GMemory;
117
119 GCLIB_DLL_EXPORTED GReturn GCALL GOpen(GCStringIn address, GCon* g);
164 GCLIB_DLL_EXPORTED GReturn GCALL GClose(GCon g);
184 GCLIB_DLL_EXPORTED GCLIB_DEPRECATED GReturn GCALL GRead(GCon g, GBufOut buffer, GSize buffer_len, GSize* bytes_read);
204 GCLIB_DLL_EXPORTED GCLIB_DEPRECATED GReturn GCALL GWrite(GCon g, GBufIn buffer, GSize buffer_len);
223 GCLIB_DLL_EXPORTED GReturn GCALL GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize* bytes_returned);
241 GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor);
258 GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len);
272 GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload(GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer);
290 GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len);
308 GCLIB_DLL_EXPORTED GReturn GCALL GRecord(GCon g, union GDataRecord* record, GOption method);
337 GCLIB_DLL_EXPORTED GReturn GCALL GMessage(GCon g, GCStringOut buffer, GSize buffer_len);
372 GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt(GCon g, GStatus* status_byte);
395 GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload(GCon g, GCStringIn filepath);
417 GCLIB_DLL_EXPORTED GCLIB_DEPRECATED GReturn GCALL GUtility(GCon g, GOption request, GMemory memory1, GMemory memory2);
525#ifdef G_USE_GCOMPOUND
527 GCLIB_DLL_EXPORTED GReturn GCALL GCompound(GCon g, GCStringIn buffer);
572#endif
573
574#ifdef __cplusplus
575} //extern "C"
576#endif
577
578#endif //I_D48432D9_1FA3_4C7D_B44C_05F8B9000ADF
const char * GBufIn
Data input to the library. No null-termination, function will have a GSize to indicate bytes to write...
Definition gclib.h:114
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition gclib.h:107
int GOption
Option integer for various formatting, etc.
Definition gclib.h:110
unsigned char GStatus
Interrupt status byte.
Definition gclib.h:115
unsigned int GSize
Size of buffers, etc.
Definition gclib.h:109
char * GBufOut
Data output from the library. No null-termination implied. Returned values may be null-terminated,...
Definition gclib.h:113
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
Definition gclib.h:108
void * GMemory
Pointer to untyped memory for use in GUtility().
Definition gclib.h:116
char * GCStringOut
C-string output from the library. Implies null-termination.
Definition gclib.h:111
const char * GCStringIn
C-string input to the library. Implies null-termination.
Definition gclib.h:112
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.
GCLIB_DLL_EXPORTED GCLIB_DEPRECATED GReturn GCALL GWrite(GCon g, GBufIn buffer, GSize buffer_len)
Performs a write on the connection.
GCLIB_DLL_EXPORTED GCLIB_DEPRECATED GReturn GCALL GRead(GCon g, GBufOut buffer, GSize buffer_len, GSize *bytes_read)
Performs a read on the connection.
GCLIB_DLL_EXPORTED GReturn GCALL GClose(GCon g)
Closes a connection to a Galil Controller.
GCLIB_DLL_EXPORTED GReturn GCALL GOpen(GCStringIn address, GCon *g)
Open a connection to a Galil Controller.
GCLIB_DLL_EXPORTED GCLIB_DEPRECATED 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.
GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload(GCon g, GCStringIn filepath)
Upgrade firmware.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownload(GCon g, const GCStringIn array_name, GOption first, GOption last, GCStringIn buffer)
Downloads array data to a pre-dimensioned array in the controller's array table.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len)
Uploads a program from the controller's program buffer.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor)
Downloads a program to the controller's program buffer.
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUpload(GCon g, const GCStringIn array_name, GOption first, GOption last, GOption delim, GBufOut buffer, GSize buffer_len)
Uploads array data from the controller's array table.
GCLIB_DLL_EXPORTED GReturn GCALL GRecord(GCon g, union GDataRecord *record, GOption method)
Provides a fresh copy of the controller's data record. Data is cast into a union, GDataRecord.
GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt(GCon g, GStatus *status_byte)
Provides access to PCI and UDP interrupts from the controller.
GCLIB_DLL_EXPORTED GReturn GCALL GMessage(GCon g, GCStringOut buffer, GSize buffer_len)
Provides access to unsolicited messages from the controller.
Data record union, containing all structs and a generic byte array accessor.