11 cout <<
"\n************************************************************************\n";
12 cout <<
"Example GProgramDownload() and GProgramUpload() usage\n";
13 cout <<
"************************************************************************\n";
19 string program =
"#A;i=0;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;i=i+1;EN";
25 cout <<
"GProgramDownload() correctly errored. Can't fit with level 3 compression\n";
28 cout <<
"Unexpected GProgramDownload() behaviour\n";
29 return GALIL_EXAMPLE_ERROR;
36 cout <<
"Program Downloaded with compression level 4\n";
39 cout <<
"Unexpected GProgramDownload() behaviour\n";
40 return GALIL_EXAMPLE_ERROR;
47 cout <<
"Uploading program:\n";
65 GCmdI(g,
"i=?", &val);
67 cout <<
"\n\nProgram executed as expected";
70 cout <<
"\n\nUnexpected i value " << val <<
'\n';
71 return GALIL_EXAMPLE_ERROR;
74 return GALIL_EXAMPLE_OK;
GCLIB_DLL_EXPORTED GReturn GCALL GProgramDownloadFile(GCon g, GCStringIn file_path, GCStringIn preprocessor)
Program download from file.
GCLIB_DLL_EXPORTED void GCALL GSleep(unsigned int timeout_ms)
Uses GUtility() and G_UTIL_SLEEP to provide a blocking sleep call which can be useful for timing-base...
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUpload(GCon g, GBufOut buffer, GSize buffer_len)
Uploads a program from the controller's program buffer.
GCLIB_DLL_EXPORTED GReturn GCALL GProgramUploadFile(GCon g, GCStringIn file_path)
Program upload to file.
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 GProgramDownload(GCon g, GCStringIn program, GCStringIn preprocessor)
Downloads a program to the controller's program buffer.
GCLIB_DLL_EXPORTED GReturn GCALL GCmd(GCon g, GCStringIn command)
Wrapper around GCommand for use when the return value is not desired.
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.
void * GCon
Connection handle. Unique for each connection in process. Assigned a non-zero value in GOpen().
#define G_UNABLE_TO_COMPRESS_PROGRAM_TO_FIT
Program preprocessor could not compress the program within the user's constraints.
void x_e(GReturn rc)
A trivial, C++ style return code check used in Galil's examples and demos.
int x_programs(GCon g)
Example GProgramDownload() and GProgramUpload() usage.