gclib 2.0.9
Communications API for Galil controllers and PLCs
 
Loading...
Searching...
No Matches
x_examples.h
Go to the documentation of this file.
1
7#ifndef I_7B02A40E_869B_4650_A5A8_859F0A6E3325
8#define I_7B02A40E_869B_4650_A5A8_859F0A6E3325
9
10#define _CRT_SECURE_NO_WARNINGS //use traditional C calls like sprintf()
11
12#include <iostream> //std::cout
13#include <string> //to_string, string, etc.
14#include <cstdio> //sprintf, etc.
15#include <cstring> //strlen, etc.
16
17#include "gclib.h"
18#include "gclibo.h"
19
20#define GALIL_EXAMPLE_OK G_NO_ERROR //return code for correct code execution
21#define GALIL_EXAMPLE_ERROR -100 //return code for error in example code
22
23using namespace std;
24
26
30inline void x_e(GReturn rc)
31{
32 if (rc != G_NO_ERROR)
33 throw rc;
34}
35
37
40int x_gcommand(GCon g);
41
43
47
49
52int x_gread_gwrite(GCon g);
53
55
58int x_programs(GCon g);
59
61
64int x_arrays(GCon g);
65
67
73int x_grecord(GCon g);
74
76
83
85
88int x_gmessage(GCon g);
89
91
96int x_ginterrupt(GCon g);
97
99
106
108
115int x_nonblocking(GCon g);
116
117
118#endif //I_7B02A40E_869B_4650_A5A8_859F0A6E3325
119
120
int GReturn
Every function returns a value of type GReturn. See gclib_errors.h for possible values.
Definition gclib.h:93
#define G_NO_ERROR
Return value if function succeeded.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
Definition gclib.h:94
const char * GCStringIn
C-string input to the library. Implies null-termination.
Definition gclib.h:98
GReturn vector(GCon g, char *file)
Puts controller into Vector Mode and accepts a file defining vector points.
Definition vector.cpp:36
int x_grecord(GCon g)
Example GRecord() usage.
Definition x_grecord.cpp:10
int x_arrays(GCon g)
Example GArrayDownload() and GArrayUpload() usage.
Definition x_arrays.cpp:9
int x_gcommand(GCon g)
Example GCommand() usage.
Definition x_gcommand.cpp:9
int x_gread_gwrite(GCon g)
Example GRead() and GWrite() usage.
int x_ginterrupt(GCon g)
Example GInterrupt() usage.
int x_ei_motioncomplete(GCon g, GCStringIn axes)
Example of MotionComplete with interrupts.
void x_e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
Definition x_examples.h:30
int x_nonblocking(GCon g)
Examples of using non-blocking operation of GRecord(), GInterrupt(), and GMessage().
int x_gmotioncomplete(GCon g)
Example GMotionComplete() usage.
int x_programs(GCon g)
Example GProgramDownload() and GProgramUpload() usage.
Definition x_programs.cpp:9
int x_gmessage(GCon g)
Example GMessage() usage.
Definition x_gmessage.cpp:9
int x_dr_motioncomplete(GCon g, GCStringIn axes)
Example of MotionComplete with data records.
Definition x_grecord.cpp:92