gclib  2.0.8
Communications API for Galil controllers and PLCs
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 
23 using namespace std;
24 
26 
30 inline void x_e(GReturn rc)
31 {
32  if (rc != G_NO_ERROR)
33  throw rc;
34 }
35 
37 
40 int x_gcommand(GCon g);
41 
43 
46 int x_gmotioncomplete(GCon g);
47 
49 
52 int x_gread_gwrite(GCon g);
53 
55 
58 int x_programs(GCon g);
59 
61 
64 int x_arrays(GCon g);
65 
67 
73 int x_grecord(GCon g);
74 
76 
83 
85 
88 int x_gmessage(GCon g);
89 
91 
96 int x_ginterrupt(GCon g);
97 
99 
105 int x_ei_motioncomplete(GCon g, GCStringIn axes);
106 
108 
115 int 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.
Definition: gclib_errors.h:13
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
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.
Definition: x_ginterrupt.cpp:9
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