gclib  2.0.8
Communications API for Galil controllers and PLCs
API

Description

Language Support C++ C# VB.NET Java Python
gclib Functions Yes Yes Yes Yes Yes
Data Records and Data Structures Yes Yes Yes No No
gclib Macros Yes No No No No
gclib Typedefs Yes No No No No

Files

file  gclib.h
 
file  gclibo.h
 
file  gclibo.c
 
file  gclib_record.h
 
file  gclib_errors.h
 

Data Structures

struct  GDataRecord4000
 Data record struct for DMC-4000 controllers, including 4000, 4200, 4103, and 500x0. More...
 
struct  GDataRecord52000
 Data record struct for DMC-52000 controller. Same as DMC-4000, with bank indicator added at byte 40. More...
 
struct  GDataRecord1806
 Data record struct for DMC-1806 controller. More...
 
struct  GDataRecord2103
 Data record struct for DMC-2103 controllers. More...
 
struct  GDataRecord1802
 
struct  GDataRecord30000
 Data record struct for DMC-30010 controllers. More...
 
struct  GDataRecord47000_ENC
 Data record struct for RIO-471xx and RIO-472xx PLCs. Includes encoder fields. More...
 
struct  GDataRecord47300_ENC
 Data record struct for RIO-47300. Includes encoder fields. More...
 
struct  GDataRecord47300_24EX
 Data record struct for RIO-47300 with 24EX I/O daughter board. More...
 
struct  GDataRecord47162
 Data record struct for RIO-47162. More...
 
union  GDataRecord
 Data record union, containing all structs and a generic byte array accessor. More...
 

Macros

#define GCLIB_DLL_EXPORTED
 
#define GCALL   __stdcall
 Specify calling convention for Windows.
 
#define G_DR   1
 Value for GRecord() method variable for acquiring a data record via DR mode.
 
#define G_QR   0
 Value for GRecord() method variable for acquiring a data record via QR mode.
 
#define G_BOUNDS   -1
 For functions that take range options, e.g. GArrayUpload(), use this value for full range.
 
#define G_CR   0
 For GArrayUpload(), use this value in the delim field to delimit with carriage returns.
 
#define G_COMMA   1
 For GArrayUpload(), use this value in the delim field to delimit with commas.
 
#define G_PUBLISH_SERVER   1
 For GPublishServer(), use this value to publish server to local network.
 
#define G_REMOVE_SERVER   0
 For GPublishServer(), use this value to remove server from local network.
 
#define G_UTIL_TIMEOUT   1
 GUtility(), Access to timeout.
 
#define G_UTIL_TIMEOUT_OVERRIDE   2
 GUtility(), read/write access to timeout override.
 
#define G_USE_INITIAL_TIMEOUT   -1
 GUtility(), for timeout override. Set G_UTIL_TIMEOUT_OVERRIDE to this value to use initial GOpen() timeout (--timeout).
 
#define G_UTIL_VERSION   128
 GUtility(), get a library version string.
 
#define G_UTIL_INFO   129
 GUtility(), get a connection info string.
 
#define G_UTIL_SLEEP   130
 GUtility(), specify an interval to sleep.
 
#define G_UTIL_ADDRESSES   131
 GUtility(), get a list of available connections.
 
#define G_UTIL_IPREQUEST   132
 GUtility(), get a list of hardware requesting IPs.
 
#define G_UTIL_ASSIGN   133
 GUtility(), assign IP addresses over the network.
 
#define G_UTIL_DEVICE_INITIALIZE   134
 GUtility(), sends CF, CW, EO etc. to initialize the connection. Useful after RS or other reset.
 
#define G_UTIL_PING   135
 GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned.
 
#define G_UTIL_ERROR_CONTEXT   136
 GUtility(), provides additional error context, where available.
 
#define G_UTIL_GCAPS_HOST   256
 
#define G_UTIL_GCAPS_VERSION   257
 GUtility(), get the version of the gcaps server.
 
#define G_UTIL_GCAPS_KEEPALIVE   258
 GUtility(), Deprecated 20210119. No longer functional.
 
#define G_UTIL_GCAPS_ADDRESSES   259
 GUtility(), get a list of available connections from the gcaps server.
 
#define G_UTIL_GCAPS_IPREQUEST   260
 GUtility(), get a list of hardware requesting IPs from the gcaps server.
 
#define G_UTIL_GCAPS_ASSIGN   261
 GUtility(), assign IP addresses over the network from the gcaps server.
 
#define G_UTIL_GCAPS_PING   262
 GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned. Ping sent from the gcaps server.
 
#define G_UTIL_GCAPS_LIST_SERVERS   263
 GUtility(), get a list of all available gcaps servers on the local network.
 
#define G_UTIL_GCAPS_PUBLISH_SERVER   264
 GUtility(), make local gcaps server discoverable by other gcaps servers on the local network.
 
#define G_UTIL_GCAPS_SET_SERVER   265
 GUtility(), set the new active gcaps server.
 
#define G_UTIL_GCAPS_SERVER_STATUS   266
 GUtility(), get information on the local server's name and if it is published to the local network.
 
#define G_UTIL_GCAPS_REMOTE_CONNECTIONS   267
 GUtility(), get a list of remote addresses connected to local server.
 
#define G_UTIL_GCAPS_SERVER_INFO   268
 
#define G_UTIL_GCAPS_ADDRESSES_GET_REMEMBERED   269
 GUtility(), returns true if gcaps is remembering ip assignments.
 
#define G_UTIL_GCAPS_ADDRESSES_SET_REMEMBERED   270
 GUtility(), sets if gcaps should remember ip assignments.
 
#define G_SMALL_BUFFER   1024
 Most reads from Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
 
#define G_HUGE_BUFFER   524288
 Most reads from Galil hardware are small. This value will hold the largest array or program upload/download possible.
 
#define G_LINE_BUFFER   80
 For writes, via command interpreter, to the Galil.
 
#define GCLIB_DLL_EXPORTED
 
#define GCALL   __stdcall
 
#define MALLOCBUF   G_HUGE_BUFFER
 Malloc used for large program and array uploads.
 
#define MAXPROG   MALLOCBUF
 Maximum size for a program.
 
#define MAXARRAY   MALLOCBUF
 Maximum size for an array table upload.
 
#define POLLINGINTERVAL   100
 Interval, in milliseconds, for polling commands, e.g. GWaitForBool().
 
#define G_USE_GCAPS
 Use the GCAPS server in GAddresses(), GAssign(), GIpRequests(), and GVersion(). To avoid GCAPS, comment out this line and recompile, http://galil.com/sw/pub/all/doc/gclib/html/gclibo.html.
 
#define _CRT_SECURE_NO_WARNINGS
 
#define GALILDATARECORDMAXLENGTH   512
 Max size for any Galil data record, equal to dual port ram size of PCI.
 
#define G_NO_ERROR   0
 Return value if function succeeded.
 
#define G_NO_ERROR_S   "no error"
 
#define G_GCLIB_ERROR   -1
 General library error. Indicates internal API caught an unexpected error. Contact Galil support if this error is returned, softw.nosp@m.ares.nosp@m.uppor.nosp@m.t@ga.nosp@m.lil.c.nosp@m.om.
 
#define G_GCLIB_ERROR_S   "gclib unexpected error"
 
#define G_GCLIB_UTILITY_ERROR   -2
 An invalid request value was specified to GUtility.
 
#define G_GCLIB_UTILITY_ERROR_S   "invalid request value or bad arguments were specified to GUtility()"
 
#define G_GCLIB_UTILITY_IP_TAKEN   -3
 The IP cannot be assigned because ping returned a reply.
 
#define G_GCLIB_UTILITY_IP_TAKEN_S   "ip address is already taken by a device on the network"
 
#define G_GCLIB_NON_BLOCKING_READ_EMPTY   -4
 GMessage, GInterrupt, and GRecord can be called with a zero timeout. If there wasn't data waiting in memory, this error is returned.
 
#define G_GCLIB_NON_BLOCKING_READ_EMPTY_S   "data was not waiting for a zero-timeout read"
 
#define G_GCLIB_POLLING_FAILED   -5
 GWaitForBool out of polling trials.
 
#define G_GCLIB_POLLING_FAILED_S   "exit condition not met in specified polling period"
 
#define G_TIMEOUT   -1100
 Operation timed out. Timeout is set by the –timeout option in GOpen() and can be overriden by GSetting().
 
#define G_TIMEOUT_S   "device timed out"
 
#define G_OPEN_ERROR   -1101
 Device could not be opened. E.G. Serial port or PCI device already open.
 
#define G_OPEN_ERROR_S   "device failed to open"
 
#define G_ALREADY_OPEN   -1111
 Serial or PCI file has a flock placed on it, presumably by another gclib connection.
 
#define G_ALREADY_OPEN_S   "Serial or PCI port already open"
 
#define G_READ_ERROR   -1103
 Device read failed. E.G. Socket was closed by remote host. See G_UTIL_GCAPS_KEEPALIVE.
 
#define G_READ_ERROR_S   "device read error"
 
#define G_WRITE_ERROR   -1104
 Device write failed. E.G. Socket was closed by remote host. See G_UTIL_GCAPS_KEEPALIVE.
 
#define G_WRITE_ERROR_S   "device write error"
 
#define G_INVALID_PREPROCESSOR_OPTIONS   -1204
 GProgramDownload was called with a bad preprocessor directive.
 
#define G_INVALID_PREPROCESSOR_OPTIONS_S   "preprocessor did not recognize options"
 
#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND   -1106
 GCommand() was called with an illegal command, e.g. ED, DL or QD.
 
#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND_S   "illegal command passed to command call"
 
#define G_DATA_RECORD_ERROR   -1107
 Data record error, e.g. DR attempted on serial connection.
 
#define G_DATA_RECORD_ERROR_S   "data record error"
 
#define G_UNSUPPORTED_FUNCTION   -1109
 Function cannot be called on this bus. E.G. GInterrupt() on serial.
 
#define G_UNSUPPORTED_FUNCTION_S   "function not supported on this communication bus"
 
#define G_FIRMWARE_LOAD_NOT_SUPPORTED   -1110
 Firmware is not supported on this bus, e.g. Ethernet for the DMC-21x3 series.
 
#define G_FIRMWARE_LOAD_NOT_SUPPORTED_S   "firmware cannot be loaded on this communication bus to this hardware"
 
#define G_ARRAY_NOT_DIMENSIONED   -1200
 Array operation was called on an array that was not in the controller's array table, see LA command.
 
#define G_ARRAY_NOT_DIMENSIONED_S   "array not dimensioned on controller or wrong size"
 
#define G_CONNECTION_NOT_ESTABLISHED   -1201
 Function was called with no connection.
 
#define G_CONNECTION_NOT_ESTABLISHED_S   "connection to hardware not established"
 
#define G_ILLEGAL_DATA_IN_PROGRAM   -1202
 Data to download not valid, e.g. \ in data.
 
#define G_ILLEGAL_DATA_IN_PROGRAM_S   "illegal ASCII character in program"
 
#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT   -1203
 Program preprocessor could not compress the program within the user's constraints.
 
#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT_S   "program cannot be compressed to fit on the controller"
 
#define G_BAD_RESPONSE_QUESTION_MARK   -10000
 Operation received a ?, indicating controller has a TC error.
 
#define G_BAD_RESPONSE_QUESTION_MARK_S   "question mark returned by controller"
 
#define G_BAD_VALUE_RANGE   -10002
 Bad value or range, e.g. GCon g variable passed to function was bad.
 
#define G_BAD_VALUE_RANGE_S   "value passed to function was bad or out of range"
 
#define G_BAD_FULL_MEMORY   -10003
 Not enough memory for an operation, e.g. all connections allowed for a process already taken.
 
#define G_BAD_FULL_MEMORY_S   "operation could not complete because of a memory error"
 
#define G_BAD_LOST_DATA   -10004
 Lost data, e.g. GCommand() response buffer was too small for the controller's response.
 
#define G_BAD_LOST_DATA_S   "data was lost due to buffer or fifo limitations"
 
#define G_BAD_FILE   -10005
 Bad file path, bad file contents, or bad write.
 
#define G_BAD_FILE_S   "file was not found, contents are invalid, or write failed"
 
#define G_BAD_ADDRESS   -10006
 Bad address.
 
#define G_BAD_ADDRESS_S   "a bad address was specified in open"
 
#define G_BAD_FIRMWARE_LOAD   -10008
 Bad firmware upgrade.
 
#define G_BAD_FIRMWARE_LOAD_S   "Firmware upgrade failed"
 
#define G_GCAPS_OPEN_ERROR   -20000
 gcaps connection couldn't open. Server is not running or is not reachable.
 
#define G_GCAPS_OPEN_ERROR_S   "gcaps connection could not be opened"
 
#define G_GCAPS_SUBSCRIPTION_ERROR   -20002
 GMessage(), GRecord(), GInterrupt() called on a connection without –subscribe switch.
 
#define G_GCAPS_SUBSCRIPTION_ERROR_S   "function requires subscription not specified in GOpen()"
 

Typedefs

typedef int GReturn
 Every function returns a value of type GReturn. See gclib_errors.h for possible values.
 
typedef void * GCon
 Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
 
typedef unsigned int GSize
 Size of buffers, etc.
 
typedef int GOption
 Option integer for various formatting, etc.
 
typedef char * GCStringOut
 C-string output from the library. Implies null-termination.
 
typedef const char * GCStringIn
 C-string input to the library. Implies null-termination.
 
typedef char * GBufOut
 Data output from the library. No null-termination implied. Returned values may be null-terminated, see function documentation for details.
 
typedef const char * GBufIn
 Data input to the library. No null-termination, function will have a GSize to indicate bytes to write .
 
typedef unsigned char GStatus
 Interrupt status byte.
 
typedef void * GMemory
 Pointer to untyped memory for use in GUtility().
 
typedef uint8_t UB
 
typedef uint16_t UW
 
typedef int16_t SW
 
typedef int32_t SL
 
typedef uint32_t UL
 

Functions

GCLIB_DLL_EXPORTED GReturn GCALL GOpen (GCStringIn address, GCon *g)
 Open a connection to a Galil Controller. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GClose (GCon g)
 Closes a connection to a Galil Controller. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GRead (GCon g, GBufOut buffer, GSize buffer_len, GSize *bytes_read)
 Performs a read on the connection. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GWrite (GCon g, GBufIn buffer, GSize buffer_len)
 Performs a write on the connection. More...
 
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. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownload (GCon g, GCStringIn program, GCStringIn preprocessor)
 Downloads a program to the controller's program buffer. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload (GCon g, GBufOut buffer, GSize buffer_len)
 Uploads a program from the controller's program buffer. More...
 
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. More...
 
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. More...
 
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. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GMessage (GCon g, GCStringOut buffer, GSize buffer_len)
 Provides access to unsolicited messages from the controller. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GInterrupt (GCon g, GStatus *status_byte)
 Provides access to PCI and UDP interrupts from the controller. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GFirmwareDownload (GCon g, GCStringIn filepath)
 Upgrade firmware. More...
 
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. More...
 
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-based chores. More...
 
GCLIB_DLL_EXPORTED 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 numbers. More...
 
GCLIB_DLL_EXPORTED 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 connection addresses. More...
 
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. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GTimeout (GCon g, short timeout_ms)
 Uses GUtility() and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GCmd (GCon g, GCStringIn command)
 Wrapper around GCommand for use when the return value is not desired. More...
 
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. More...
 
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. More...
 
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. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GWaitForBool (GCon g, GCStringIn predicate, int trials)
 Blocking call that returns when the controller evaluates the predicate as true. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete (GCon g, GCStringIn axes)
 Blocking call that returns once all axes specified have completed their motion. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate (GCon g, double period_ms)
 Sets the asynchronous data record to a user-specified period via DR. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile (GCon g, GCStringIn file_path, GCStringIn preprocessor)
 Program download from file. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile (GCon g, GCStringIn file_path)
 Program upload to file. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GArrayDownloadFile (GCon g, GCStringIn file_path)
 Array download from file. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GArrayUploadFile (GCon g, GCStringIn file_path, GCStringIn names)
 Array upload to file. More...
 
GCLIB_DLL_EXPORTED 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 controllers requesting IP addresses via BOOT-P or DHCP. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GSetServer (GCStringIn server_name)
 Uses GUtility(), G_UTIL_GCAPS_SET_SERVER to set the new active server. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GListServers (GCStringOut servers, GSize servers_len)
 Uses GUtility(), G_UTIL_GCAPS_LIST_SERVERS to provide a list of all available gcaps services on the local network. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GPublishServer (GCStringIn name, GOption publish, GOption save)
 Uses GUtility(), G_UTIL_GCAPS_PUBLISH_SERVER to publish local gcaps server to the local network. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GServerStatus (GCStringOut status, GSize status_len)
 Uses GUtility(), G_UTIL_GCAPS_SERVER_STATUS to get information on the local server name and if it is published to the local network. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GRemoteConnections (GCStringOut connections, GSize connections_length)
 Uses GUtility(), G_UTIL_GCAPS_REMOTE_CONNECTIONS to get a list of remote addresses connected to the local server. More...
 
GCLIB_DLL_EXPORTED 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 controller at a given MAC address. More...
 
GCLIB_DLL_EXPORTED void GCALL GError (GReturn rc, GCStringOut error, GSize error_len)
 Provides a human-readable description string for return codes. More...
 
GCLIB_DLL_EXPORTED GReturn GCALL GSetupDownloadFile (GCon g, GCStringIn file_path, GOption options, GCStringOut info, GSize info_len)
 Download a saved controller configuration from a file. More...