13#ifndef _CRT_SECURE_NO_WARNINGS
14#define _CRT_SECURE_NO_WARNINGS
84#if defined(__linux__) || defined(__APPLE__)
97#if defined(__linux__) || defined(__APPLE__)
252 for (
i = read - 1;
i >= 0;
i--)
255 if ((
c ==
':') || (
c ==
'\n') || (
c ==
'\r'))
302 char pred[] =
"_BGm=0";
307 for (
i = 0;
i < len;
i++)
349 return GCmd(g,
"DR 0");
597 const char*
filename =
"C:/ProgramData/Galil/gcaps/gclib_mdns_log.txt";
599 const char*
filename =
"/var/tmp/gclib_mdns_log.txt";
GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete(GCon g, GCStringIn axes)
Blocking call that returns once all axes specified have completed their motion.
#define G_BAD_RESPONSE_QUESTION_MARK
Operation received a ?, indicating controller has a TC error.
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.
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.
#define G_WRITE_ERROR
Device write failed. E.G. Socket was closed by remote host. See G_UTIL_GCAPS_KEEPALIVE.
#define G_DATA_RECORD_ERROR
Data record error, e.g. DR attempted on serial connection.
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.
#define G_COMMAND_CALLED_WITH_ILLEGAL_COMMAND
GCommand() was called with an illegal command, e.g. ED, DL or QD.
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
#define G_BAD_VALUE_RANGE
Bad value or range, e.g. GCon g variable passed to function was bad.
#define G_UTIL_INFO
GUtility(), get a connection info string.
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 ...
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
Program download from file.
int GOption
Option integer for various formatting, etc.
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 controller...
#define G_BAD_FIRMWARE_LOAD
Bad firmware upgrade.
#define POLLINGINTERVAL
Interval, in milliseconds, for polling commands, e.g. GWaitForBool().
#define G_SMALL_BUFFER
Most reads from Galil are small. This value will easily hold most, e.g. TH, TZ, etc.
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...
#define G_ALREADY_OPEN
Serial or PCI file has a flock placed on it, presumably by another gclib connection.
GCLIB_DLL_EXPORTED GReturn GCALL GTimeout(GCon g, short timeout_ms)
Uses GUtility() and G_UTIL_TIMEOUT_OVERRIDE to set the library timeout.
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 l...
#define G_GCLIB_ERROR
General library error. Indicates internal API caught an unexpected error. Contact Galil support if th...
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 num...
#define G_GCAPS_OPEN_ERROR
gcaps connection couldn't open. Server is not running or is not reachable.
#define G_OPEN_ERROR
Device could not be opened. E.G. Serial port or PCI device already open.
#define G_NO_ERROR
Return value if function succeeded.
#define G_INVALID_PREPROCESSOR_OPTIONS
GProgramDownload was called with a bad preprocessor directive.
#define G_UTIL_GCAPS_IPREQUEST
GUtility(), get a list of hardware requesting IPs from the gcaps server.
#define G_UTIL_GCAPS_PUBLISH_SERVER
GUtility(), make local gcaps server discoverable by other gcaps servers on the local network.
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.
#define G_BAD_FULL_MEMORY
Not enough memory for an operation, e.g. all connections allowed for a process already taken.
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 l...
unsigned int GSize
Size of buffers, etc.
#define GCALL
Specify calling convention for Windows.
#define G_UTIL_PING
GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned.
#define G_UTIL_VERSION
GUtility(), get a library version string.
#define G_UTIL_GCAPS_PING
GUtility(), uses ICMP ping to determine if an IP address is reachable and assigned....
#define G_UTIL_IPREQUEST
GUtility(), get a list of hardware requesting IPs.
#define G_ARRAY_NOT_DIMENSIONED
Array operation was called on an array that was not in the controller's array table,...
#define MAXPROG
Maximum size for a program.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len)
Uploads a program from the controller's program buffer.
#define G_UTIL_GCAPS_SERVER_STATUS
GUtility(), get information on the local server's name and if it is published to the local network.
#define G_UTIL_ASSIGN
GUtility(), assign IP addresses over the network.
#define G_UTIL_TIMEOUT_OVERRIDE
GUtility(), read/write access to timeout override.
#define G_FIRMWARE_LOAD_NOT_SUPPORTED
Firmware is not supported on this bus, e.g. Ethernet for the DMC-21x3 series.
#define G_UTIL_GCAPS_ADDRESSES
GUtility(), get a list of available connections from the gcaps server.
#define G_UTIL_ADDRESSES
GUtility(), get a list of available connections.
#define G_BAD_ADDRESS
Bad address.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
#define G_GCAPS_SUBSCRIPTION_ERROR
GMessage(), GRecord(), GInterrupt() called on a connection without –subscribe switch.
GCLIB_DLL_EXPORTED void GCALL GError(GReturn rc, GCStringOut error, GSize error_len)
Provides a human-readable description string for return codes.
#define G_UTIL_GCAPS_ASSIGN
GUtility(), assign IP addresses over the network from the gcaps server.
#define G_CONNECTION_NOT_ESTABLISHED
Function was called with no connection.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
Program upload to file.
#define G_GCLIB_UTILITY_ERROR
An invalid request value was specified to GUtility.
#define G_UTIL_SLEEP
GUtility(), specify an interval to sleep.
GCLIB_DLL_EXPORTED GReturn GCALL GRecordRate(GCon g, double period_ms)
Sets the asynchronous data record to a user-specified period via DR.
#define G_UNSUPPORTED_FUNCTION
Function cannot be called on this bus. E.G. GInterrupt() on serial.
#define G_UTIL_GCAPS_SET_SERVER
GUtility(), set the new active gcaps server.
#define G_BAD_FILE
Bad file path, bad file contents, or bad write.
#define G_GCLIB_POLLING_FAILED
GWaitForBool out of polling trials.
#define G_READ_ERROR
Device read failed. E.G. Socket was closed by remote host. See G_UTIL_GCAPS_KEEPALIVE.
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.
#define G_BAD_LOST_DATA
Lost data, e.g. GCommand() response buffer was too small for the controller's response.
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 ...
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 GWaitForBool(GCon g, GCStringIn predicate, int trials)
Blocking call that returns when the controller evaluates the predicate as true.
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.
#define G_UTIL_GCAPS_LIST_SERVERS
GUtility(), get a list of all available gcaps servers on the local network.
GCLIB_DLL_EXPORTED GReturn GCALL GSetServer(GCStringIn server_name)
Uses GUtility(), G_UTIL_GCAPS_SET_SERVER to set the new active server.
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.
#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 ...
char * GCStringOut
C-string output from the library. Implies null-termination.
const char * GCStringIn
C-string input to the library. Implies null-termination.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT
Program preprocessor could not compress the program within the user's constraints.
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 con...
#define G_GCLIB_UTILITY_IP_TAKEN
The IP cannot be assigned because ping returned a reply.
#define G_UTIL_GCAPS_VERSION
GUtility(), get the version of the gcaps server.
#define G_TIMEOUT
Operation timed out. Timeout is set by the –timeout option in GOpen() and can be overriden by GSettin...
#define G_UTIL_GCAPS_REMOTE_CONNECTIONS
GUtility(), get a list of remote addresses connected to local server.
#define G_ILLEGAL_DATA_IN_PROGRAM
Data to download not valid, e.g. \ in data.
#define G_LINE_BUFFER
For writes, via command interpreter, to the Galil.
void error(GCon g, GReturn rc)
An example of error handling and debugging information.
GReturn vector(GCon g, char *file)
Puts controller into Vector Mode and accepts a file defining vector points.