12 cout <<
"\n************************************************************************\n";
13 cout <<
"Example GRecord() usage\n";
14 cout <<
"************************************************************************\n";
21 cout <<
"\nQR-based data record\n";
29 bool dr_support =
true;
32 dr_support = (strstr(buf,
"IH") != 0);
41 cout <<
"\nDR-based data record\n";
42 unsigned short time = 0;
43 unsigned short deadline = 1000;
45 x_e(
GCmdI(g,
"MG_DR", &original_dr));
47 for (
size_t i = 0; deadline > time; i++)
53 if (!i) deadline = time + deadline;
56 sprintf(buf,
"DR %d", original_dr);
62 cout <<
"\nQR-based data record with offsets\n";
65 cout << *((
unsigned short*)(r.
byte_array + 4)) <<
'\n';
73 x_e(
GCmdT(g,
"RP", buf,
sizeof(buf), &trimmed));
74 cout <<
"\nPosition: " << trimmed <<
'\n';
80 cout <<
"Beginning independent motion... ";
83 cout <<
"Motion Complete on A\n";
84 x_e(
GCmdT(g,
"RP", buf,
sizeof(buf), &trimmed));
85 cout <<
"Position: " << trimmed <<
'\n';;
88 return GALIL_EXAMPLE_OK;
100 x_e(
GCmdI(g,
"MG_DR", &original_dr));
103 int len = strlen(axes);
105 for (
int i = 0; i < len; )
140 if (!(*axis_status & 0x8000))
145 sprintf(buf,
"DR %d", original_dr);
148 return GALIL_EXAMPLE_OK;
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.
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 GCommand(GCon g, GCStringIn command, GBufOut buffer, GSize buffer_len, GSize *bytes_returned)
Performs a command-and-response transaction on the connection.
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 GCmdI(GCon g, GCStringIn command, int *value)
Wrapper around GCommand that provides the return value of a command parsed into an int.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
#define G_DR
Value for GRecord() method variable for acquiring a data record via DR mode.
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
#define G_NO_ERROR
Return value if function succeeded.
unsigned int GSize
Size of buffers, etc.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
#define G_QR
Value for GRecord() method variable for acquiring a data record via QR mode.
const char * GCStringIn
C-string input to the library. Implies null-termination.
UW axis_e_status
E axis status.
UW axis_h_status
H axis status.
UW sample_number
sample number.
UW axis_f_status
F axis status.
UW axis_g_status
G axis status.
UW axis_d_status
D axis status.
UW axis_a_status
A axis status.
SL axis_a_reference_position
A axis reference position.
UW axis_b_status
B axis status.
UW axis_c_status
C axis status.
Data record union, containing all structs and a generic byte array accessor.
unsigned char byte_array[GALILDATARECORDMAXLENGTH]
Generic byte array for offsets.
struct GDataRecord4000 dmc4000
The DMC-4000 data record.
void x_e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
int x_grecord(GCon g)
Example GRecord() usage.
int x_dr_motioncomplete(GCon g, GCStringIn axes)
Example of MotionComplete with data records.