![]() |
gclib 2.4.0
Galil Communications Library
|
A core feature of gclib is the ability to connect to a controller over ethernet, serial, or PCI, using a single connection API.
C/C++ Use gclib_addresses() to see the different addresses that are available.
If using an ethernet controller that doesn't have an IP address yet, it will show up in gclib_ip_requests(). Use gclib_assign_ip() to give the controller an IP. If successful, the controller will begin showing up in gclib_addresses() under the new address.
Python
Use gclib.py.GAddresses() to see the different addresses that are available.
If using an ethernet controller that doesn't have an IP address yet, it will show up in gclib.py.GIpRequests(). Use gclib.py.GAssign() to give the controller an IP. If successful, the controller will begin showing up in gclib.py.GAddresses() under the new address.
Java Use gclibjava.GclibJava.GAddresses() to see the different addresses that are available.
If using an ethernet controller that doesn't have an IP address yet, it will show up in gclibjava.GclibJava.GIpRequests(). Use gclibjava.GclibJava.GAssign() to give the controller an IP. If successful, the controller will begin showing up in gclibjava.GclibJava.GAddresses() under the new address.
C# Use gclib.GAddresses() to see the different addresses that are available.
If using an ethernet controller that doesn't have an IP address yet, it will show up in gclib.GIpRequests(). Use gclib.GAssign() to give the controller an IP. If successful, the controller will begin showing up in gclib.GAddresses() under the new address.
VB Use Gclib.GAddresses() to see the different addresses that are available.
If using an ethernet controller that doesn't have an IP address yet, it will show up in Gclib.GIpRequests(). Use Gclib.GAssign() to give the controller an IP. If successful, the controller will begin showing up in Gclib.GAddresses() under the new address.
LabVIEW Use G Addresses to see the different addresses that are available.
If using an ethernet controller that doesn't have an IP address yet, it will show up in G Ip Requests. Use G Assign to give the controller an IP. If successful, the controller will begin showing up in G Addresses under the new address.
> .\connection.exe 192.168.0.40 Address: 192.168.0.40 Revision: DMC4040 Rev 1.3i Serial: 10601
Java To use a controller with gclib, first create a gclibjava.GclibJava() object, then pass an address to gclibjava.GclibJava.GOpen(). After you are done, close the connection with gclibjava.GclibJava.GClose().
> java Connection 192.168.0.40 192.168.0.40, DMC4040 Rev 1.3i, 10601
C# To use a controller with gclib, first create a gclib() object, then pass an address to gclib.GOpen(). After you are done, close the connection with gclib.GClose().
VB To use a controller with gclib, first create a Gclib() object, then pass an address to Gclib.GOpen(). After you are done, close the connection with Gclib.GClose().
LabVIEW To use a controller with gclib, first pass the address to G Open to receive a handle to the connection. This handle will be used in future library calls such as G Info, which we use to display some information about the open connection. After you are done, close the connection with G Close.
C/C++ To issue commands, use gclib_command() with an open connection. The following example uses gclib_command() to implement a basic terminal.
Java To issue commands, use gclibjava.GclibJava.GCommand() with an open connection. The following example uses gclibjava.GclibJava.GCommand() to implement a basic terminal.
C# To issue commands, use gclib.GCommand() with an open connection. The following example uses gclib.GCommand() to implement a basic terminal.
VB To issue commands, use Gclib.GCommand() with an open connection. The following example uses Gclib.GCommand() to implement a basic terminal.
LabVIEW To issue commands, use G Command with an open connection.
C/C++ All gclib functions provide a gclib_result value to indicate the error, with zero (GCLIB_SUCCESS) indicating success. Use gclib_error() to get a string description of the error.
C/C++ Use gclib_program() to get the controller's program, and use gclib_set_program() to set it.
Use gclib_array() to get an array from the controller, and use gclib_set_array() to set it. Use the start and end arguments to transfer only a subset of the array.
Python Use gclib.py.GProgramUpload() to get the controller's program, and use gclib.py.GProgramDownload() to set it.
Use gclib.py.GArrayUpload() and gclib.py.GArrayDownload() similarly for arrays. Use the first and last arguments to transfer only part of the array.
Java Use gclibjava.GclibJava.GProgramUpload() to get the controller's program, and use gclibjava.GclibJava.GProgramDownload() to set it. See the gclib Program Preprocessor for advanced usage.
Use gclibjava.GclibJava.GArrayUpload() to get an array from the controller, and use gclibjava.GclibJava.GArrayDownload() to set it.
C# Use gclib.GProgramUpload() to get the controller's program, and use gclib.GProgramDownload() to set it. See the gclib Program Preprocessor for advanced usage.
Use gclib.GArrayUpload() to get an array from the controller, and use gclib.GArrayDownload() to set it.
VB Use Gclib.GProgramUpload() to get the controller's program, and use Gclib.GProgramDownload() to set it. See the gclib Program Preprocessor for advanced usage.
Use Gclib.GArrayUpload() to get an array from the controller, and use Gclib.GArrayDownload() to set it.
LabVIEW Use G Program Upload to get the controller's program, and use G Program Download to set it. See the gclib Program Preprocessor for advanced usage.
Use G Array Upload to get an array from the controller, and use G Array Download to set it.
C/C++ The unsolicited data API can be used in blocking mode or callback mode.
Blocking mode is simpler to use, but has tradeoffs. If you want unsolicited data as soon as it arrives, you must block the thread to wait for it, which may not be ideal. If you want to keep the thread running, then you must periodically check for queued unsolicited data, which can add unwanted latency.
Callback mode allows your thread to stay running while enabling immediate response to unsolicited data. When data arrives, your callback function will be invoked on a separate, dedicated thread. Due to this, callback mode can be more complicated to use if you are not familiar with thread synchronization.
For a full list of data record fields, see the Data Record API.
Python
Use gclib.py.GMessage() to get unsolicited messages from the controller, and gclib.py.GInterrupt() to get event interrupts. If there is no data available, these methods will block up to five seconds before timing out.
Java Use gclibjava.GclibJava.GMessage() to get unsolicited messages from the controller, gclibjava.GclibJava.GInterrupt() to get event interrupts, and gclibjava.GclibJava.GRecord() to get data records. If there is no data available, these methods will block up to five seconds before timing out.
C# Use gclib.GMessage() to get unsolicited messages from the controller, gclib.GInterrupt() to get event interrupts, and gclib.GRecord() to get data records. If there is no data available, these methods will block up to five seconds before timing out.
VB Use Gclib.GMessage() to get unsolicited messages from the controller, Gclib.GInterrupt() to get event interrupts, and Gclib.GRecord() to get data records. If there is no data available, these methods will block up to five seconds before timing out.
LabVIEW Use G Message to get unsolicited messages from the controller, G Interrupt to get event interrupts, and G Record to get data records. If there is no data available, these methods will block up to five seconds before timing out.
For G Record, note that memory must be allocated using the 'Initialize Array' node to store the data record packet. This memory space is filled with the information in the data record packet and then parsed using the 'Index Array' and 'Join Numbers' nodes.
Galil Connect allows gclib to issue commands through a remote gcaps server. This makes debugging closed or distant systems much easier.
C/C++ On the device hosting the remote gcaps server, use gclib_set_published().
On the client, use gclib_list_servers() to view all available gcaps servers. Pass a server name to gclib_set_server() for future gclib calls to be routed through that gcaps server. When done, pass NULL to gclib_set_server() to disconnect from the remote gcaps server.
Python
On the device hosting the remote gcaps server (in this example a Raspberry Pi), use gclib.py.GPublishServer().
On the client, use gclib.py.GListServers() to view all available gcaps servers. Pass a server name to gclib.py.GSetServer() for future gclib calls to be routed through that gcaps server. When done, pass the special string "Local" to gclib.py.GSetServer() to disconnect from the remote gcaps server.
Java On the device hosting the remote gcaps server (in this example a Raspberry Pi), use gclibjava.GclibJava.GPublishServer().
On the client, use gclibjava.GclibJava.GListServers() to view all available gcaps servers. Pass a server name to gclibjava.GclibJava.GSetServer() for future gclib calls to be routed through that gcaps server. When done, pass the special string "Local" to gclibjava.GclibJava.GSetServer() to disconnect from the remote gcaps server.
C# On the device hosting the remote gcaps server (in this example a Raspberry Pi), use gclib.GPublishServer().
On the client, use gclib.GListServers() to view all available gcaps servers. Pass a server name to gclib.GSetServer() for future gclib calls to be routed through that gcaps server.
VB On the device hosting the remote gcaps server (in this example a Raspberry Pi), use Gclib.GPublishServer().
On the client, use Gclib.GListServers() to view all available gcaps servers. Pass a server name to Gclib.GSetServer() for future gclib calls to be routed through that gcaps server.
LabVIEW On the device hosting the remote gcaps server (in this example a Raspberry Pi), use G Publish Server.
On the client, use G List Servers to view all available gcaps servers. Pass a server name to G Set Server for future gclib calls to be routed through that gcaps server. When done, pass the special string "Local" to G Set Server to disconnect from the remote gcaps server.
This project contains two example programs.
C/C++ The 'Record' example uses RA in continuous mode along with GArrayUpload() to allow recording movement for an arbitrary amount of time. It produces a file with the recorded positions of all axes.
The 'Replay' example uses the file produced by 'Record' along with CM to accurately reproduce the recorded movement. Note that all axes must be properly set up for motion.
Python The 'Record' example uses RA in continuous mode along with gclib.py.GProgramUpload() to allow recording movement for an arbitrary amount of time. It produces a file with the recorded positions of all axes.
The 'Replay' example uses the file produced by 'Record' along with CM to accurately reproduce the recorded movement. Note that all axes must be properly set up for motion.
Java The 'Record' example uses RA in continuous mode along with gclibjava.GclibJava.GProgramUpload() to allow recording movement for an arbitrary amount of time. It produces a file with the recorded positions of all axes.
The 'Replay' example uses the file produced by 'Record' along with CM to accurately reproduce the recorded movement. Note that all axes must be properly set up for motion.
C# The 'Record' example uses RA in continuous mode along with Gclib.GProgramUpload() to allow recording movement for an arbitrary amount of time. It produces a file with the recorded positions of all axes.
The 'Replay' example uses the file produced by 'Record' along with CM to accurately reproduce the recorded movement. Note that all axes must be properly set up for motion.
VB The 'Record' example uses RA in continuous mode along with Gclib.GProgramUpload() to allow recording movement for an arbitrary amount of time. It produces a file with the recorded positions of all axes.
The 'Replay' example uses the file produced by 'Record' along with CM to accurately reproduce the recorded movement. Note that all axes must be properly set up for motion.