gclib 2.1.20
Galil Communications Library
All Classes Files Functions Variables Typedefs Macros Modules Pages
Controller

Manage a Galil controller More...

Topics

 Communication
 Send commands
 
 Memory
 Manage controller memory, such as program and arrays
 
 Unsolicited Data
 Receive messages, interrupts, and data records
 

Functions

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 GWaitForBool (GCon g, GCStringIn predicate, int trials)
 Blocking call that returns when the controller evaluates the predicate as true.
 
GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete (GCon g, GCStringIn axes)
 Blocking call that returns once all axes specified have completed their motion.
 

Function Documentation

◆ GUtility()

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.

Deprecated
This function will be removed in a future gclib version. Contact Galil for needs not met by the other gclib functions.
Note
The open source library, gclibo.h, has wrappers for most of these utilities.
Parameters
gConnection's handle.
requestDefines the request. Input/Output and type of memory are implicit in the value of request. The following lists the supported request values.
  • G_UTIL_TIMEOUT Read initial timeout value, as specified in GOpen() via --timeout switch.
    • memory1 is output and must be an unsigned short*.
    • memory2 is ignored, use null.
  • G_UTIL_TIMEOUT_OVERRIDE See GTimeout(). Write/Read override timeout value.
    • memory1 is input. If nonnull, value must be a short* holding the override, in milliseconds, for the timeout. Write G_USE_INITIAL_TIMEOUT to use initial timeout. If null, no write occurs.
    • memory2 is output. If nonnul, value must be a short* which will be filled with the current override. G_USE_INITIAL_TIMEOUT indicates initial timeout used. If null, no read occurs. memory2 is processed before 'memory1`.
  • G_UTIL_VERSION See GVersion(). Returns the library version. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is output, and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_INFO See GInfo(). Returns information about the connection.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_SLEEP See GSleep(). Platform-independent, non-busy, sleep. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is input and must be an unsigned int*, units are milliseconds.
    • memory2 is ignored, use null.
  • G_UTIL_ADDRESSES see GAddresses(). Provides a \n delimited listing of all available IP addresses, PCI addresses, and COM ports. A valid connection (g) is not necessary, i.e. g may be null. The suffix -d will be appended to each address to indicate these addresses are available via direct connection. See G_UTIL_GCAPS_ADDRESSES for addresses through gcaps.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_IPREQUEST see GIpRequests(). Listens and returns a \n delimited listing of Galil MAC addresses sending BOOT-P or DHCP requests. The function will listen, and block, for roughly 5 seconds. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_ASSIGN see GAssign(). Provides a method to assign an IP address given a Galil MAC address. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is input and must be a char* containing the null terminated address that is to be assigned. e.g. "192.168.0.43".
    • memory2 is input and must be a char* containing the null terminated controller MAC address. e.g. "00:50:4C:20:01:23".
  • G_UTIL_DEVICE_INITIALIZE Provides a method to reinitialize a connection after a reset, e.g. an RS command. Depending on the device type, the appropriate commands will be sent to configure the communication bus for optimal performance.
    • memory1 is ignored, use null.
    • memory2 is ignored, use null.
  • G_UTIL_PING Uses ICMP ping to determine if an IP address is reachable and assigned. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is input and must be a char* containing the null terminated address that is to be pinged. e.g. "192.168.0.43".
    • memory2 is output and must be an int*. The value will be set to zero if the ping times out, and nonzero if a ping reply is returned.
  • G_UTIL_ERROR_CONTEXT More error detail for the last error on GCon, where available. The internal error message is cleared upon read.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.

The following request values are for use with a gcaps server.

  • G_UTIL_GCAPS_VERSION see GVersion(). Returns the gcaps server version. A valid connection (g) is not necessary, i.e. g may be null. This operation will connect to the server to determine the version.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_GCAPS_ADDRESSES see GAddresses(). Provides a \n delimited listing of all available IP addresses, PCI addresses, and COM ports as available from the gcaps server. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_GCAPS_IPREQUEST see GIpRequests(). Connects to gcaps and returns a \n delimited listing of Galil MAC addresses sending BOOT-P or DHCP requests. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is output and must be a char*. Data will be null terminated, even if the data must be truncated to do so.
    • memory2 is input and must be an unsigned int* holding the length of the buffer in memory1.
  • G_UTIL_GCAPS_ASSIGN see GAssign(). Provides a method to assign an IP address through gcaps given a Galil MAC address. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is input and must be a char* containing the null terminated address that is to be assigned. e.g. "192.168.0.43".
    • memory2 is input and must be a char* containing the null terminated controller MAC address. e.g. "00:50:4C:20:01:23".
  • G_UTIL_GCAPS_PING Uses ICMP ping to determine if an IP address is reachable and assigned. Ping sent from the gcaps server. A valid connection (g) is not necessary, i.e. g may be null.
    • memory1 is input and must be a char* containing the null terminated address that is to be pinged. e.g. "192.168.0.43".
    • memory2 is output and must be an int*. The value will be set to zero if the ping times out, and nonzero if a ping reply is returned.
Parameters
memory1An untyped pointer to data required for request. The data type is defined by the request variable.
memory2An untyped pointer to data required for request. The data type is defined by the request variable.
Returns
The success status or error code of the function. See gclib_errors.h for possible values.

See the following functions from gclibo, the open source portion, for implementation of several GUtility() requests.:

◆ GWaitForBool()

GCLIB_DLL_EXPORTED GReturn GCALL GWaitForBool ( GCon g,
GCStringIn predicate,
int trials )

Blocking call that returns when the controller evaluates the predicate as true.

Polls the message command (MG) to check the value of predicate. Polling will continue until the controller responds with a nonzero value or the number of polling trials is reached.

The amount of time until the function fails with G_GCLIB_POLLING_FAILED is roughly (trials * POLLINGINTERVAL) milliseconds.

Parameters
gConnection's handle.
predicateA null-terminated string containing the predicate to be polled. The predicate will be enclosed in parentheses and used in the command MG (predicate) to return the value.
trialsThe number of polling cycles to perform looking for a nonzero value. Use -1 to poll indefinitely.
Returns
The success status or error code of the function. See gclib_errors.h for possible values.

See GMotionComplete() for an example.

◆ GMotionComplete()

GCLIB_DLL_EXPORTED GReturn GCALL GMotionComplete ( GCon g,
GCStringIn axes )

Blocking call that returns once all axes specified have completed their motion.

Note
This function uses a profiled motion indicator, not the position of the encoder. E.G. see the difference between AM (profiled) and MC (encoder-based).

Although using the _BGm operand is the most generally compatible method, there are higher-performance ways to check for motion complete by using the data record, or interrupts. See examples x_dr_motioncomplete() and x_ei_motioncomplete().

Parameters
gConnection's handle.
axesA null-terminated string containing a multiple-axes mask. Every character in the string should be a valid argument to MG_BGm, i.e. XYZWABCDEFGHST.
Returns
The success status or error code of the function. See gclib_errors.h for possible values.

See x_gmotioncomplete.cpp for an example.