![]() |
gclib 2.1.20
Galil Communications Library
|
Receive messages, interrupts, and data records More...
Functions | |
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. | |
GCLIB_DLL_EXPORTED GReturn GCALL | GMessage (GCon g, GCStringOut buffer, GSize buffer_len) |
Provides access to unsolicited messages from the controller. | |
GCLIB_DLL_EXPORTED GReturn GCALL | GInterrupt (GCon g, GStatus *status_byte) |
Provides access to PCI and UDP interrupts from the controller. | |
GCLIB_DLL_EXPORTED GReturn GCALL | GRecordRate (GCon g, double period_ms) |
Sets the asynchronous data record to a user-specified period via DR . | |
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.
g | Connection's handle. |
record | A pointer to the user's DataRecord union to hold the copy. |
method | Determines the method for acquiring the data.
|
When using G_DR
, the asynchronous data record must already be set up.
-s DR
must be used in the GOpen() address
string to subscribe to records. The driver will automatically set the second argument of DR
, where applicable.GRecordRate()
should be issued to set DR
to an appropriate interval, n. The interval must be no faster than the rate at which GRecord() is called.GRecord()
is called more slowly than the data record rate, stale data will be returned until GRecord()
has been called once for each record sent by the controller.GRecord() will block until the data record is received, or the transaction times out.
See x_grecord.cpp for an example. See x_nonblocking.cpp for an example of non-blocking usage.
GCLIB_DLL_EXPORTED GReturn GCALL GMessage | ( | GCon | g, |
GCStringOut | buffer, | ||
GSize | buffer_len ) |
Provides access to unsolicited messages from the controller.
To use this function, -s MG
must be used in the GOpen() address
string to subscribe to messages. Unsolicited bytes must be flagged by the high-bit setting, CW 1
. The driver will automatically set this when subscribing to messages. The user should not overwrite this setting.
Unsolicited messages are data generated by the controller that are not in response to a command, a data record, or an interrupt. Examples follow.
MG
command from embedded code. MG
sent from the host is solicited.TP
, RP
, var=?
?55 i=var
GMessage()
, they will all be placed in the buffer, separated by newline characters.g | Connection's handle. |
buffer | The buffer to write the message data. The buffer will be null terminated. |
buffer_len | The length of the user's buffer. |
GMessage() will block until a message is received, or the function times out.
$00-$07
and $10-$17
. These bytes may be routed to a third party device such as am HMI or display panel. See MG and CF.See x_gmessage.cpp for an example. See x_nonblocking.cpp for an example of non-blocking usage.
Provides access to PCI and UDP interrupts from the controller.
Interrupts can be generated automatically by the firmware on important events via EI
(Enable Interrupt) or by the user in embedded DMC code via UI
(User Interrupt). To use this function, -s EI
must be used in the GOpen() address string to subscribe to interrupts.
g | Connection's handle. |
status_byte | A pointer to a GStatus to receive the status byte. |
GInterrupt() will block until an interrupt is received, or the function times out.
See x_ginterrupt.cpp for an example. See x_nonblocking.cpp for an example of non-blocking usage.
Sets the asynchronous data record to a user-specified period via DR
.
Takes TM and product type into account and sets the DR
period to the period requested by the user, if possible.
g | Connection's handle. |
period_ms | Period, in milliseconds, to set up for the asynchronous data record. |
See x_grecord.cpp for an example.