gclib  396
Communications API for Galil controllers and PLCs
 All Data Structures Files Functions Variables Typedefs Macros Pages
GCLIB_DLL_EXPORTED GReturn GCALL GOpen ( GCStringIn  address,
GCon g 

Open a connection to a Galil Controller.

addressNull-terminated address string. See table below.
gPointer to user's GCon variable. On success, the library will fill the user's variable with the handle to use for the rest of the connection. A valid g value is nonzero.
The success status or error code of the function. See gclib_errors.h for possible values.
address switch Meaning Arguments (default), other options Examples
--address Simple address to hardware IP address, PCI, COM port --address COM1
-a shorthand for --address See Address Ranges below -a GALILPCI1
{no switch} --address is implicit for any lone token
--baud Baud rate (115200), valid baud... COM2 --baud 19200
-b shorthand for --baud COM3 -b 38400
--command Command-and-response socket protocol (TCP), UDP --command TCP
-c shorthand for --command -c UDP
--direct Connect directly to hardware instead of via gcaps -a GALILPCI2 --direct
-d shorthand for --direct GALILPCI2 -d
--handshake Serial Handshake mode (HARDWARE), NONE COM1 --handshake NONE
--p1 Primary port for command-and-response traffic (23), valid port number --p1 5000
--p2 Secondary port for unsolicited traffic (60007), valid port number --p2 5000
--subscribe Subscribe to messages, data records, and/or interrupts (NONE), MG, DR, EI, ALL --subscribe MG
-s shorthand for --subscribe -s DR -s EI
--timeout timeout in ms (5000), 0-65535 --timeout 5000
-t shorthand for --timeout GALILPCI2 -t 500
--unsolicited Unsolicited socket protocol (UDP), TCP, NONE --unsolicited TCP
-u shorthand for --unsolicited -u NONE
Operating System Address Range Notes
Windows COM1 - COM256 RS232 and USB-to-serial
Linux /dev/ttyS0 - /dev/ttyS255 RS232
Linux /dev/ttyUSB0 - /dev/ttyUSB255 USB-to-serial, e.g. DMC-4103
Linux /dev/galilpci0 - /dev/galilpci7PCI

See x_examples.cpp for an example.

When connecting to a network device, if the command-and-response socket is opened successfully but the unsolicited socket fails, GOpen() will still complete successfully. This allows connection to a Galil controller when only one Ethernet handle is available. Unsolicited traffic will not be accessible in this case.