![]() |
|
|||||||||||||||||||||||||||||||||||||||||||||
This sample code opens a connection and sends parameters to the scanner.
Please, please check your error codes from the function. If there is a syntax error in the parameters, the parameters will not be saved to the scanner. You should tell users what the errors are so they can fix them. There are line numbers and everything.
Yes, I realize there are goto statments in this code. It makes things cleaner in this case.
#define JCAM_STATIC_LIB #include "jcam_dll.h" #include <stdio.h> using namespace joescan; int main(int argc, char * argv[]) { if(jsInitialize() == FALSE) exit(0); size_t i = 0; JCONNECTION jc; if((jc = jsOpenConnection("192.168.1.105")) == NULL) { printf("Couldn't open connection.\n"); goto CLEANUP; } switch(jsSendParameterFileToScanner(jc, "param.dat")) { case SCANNER_FAILURE: printf("Lost connection.\n"); goto CLEANUP; case OPERATION_FAILURE: for(i = 0; i < jsGetNumberOfErrorMessages(jc); i++) printf("%s\n", jsGetErrorMessage(jc, i)); break; default: printf("Sent parameters successfully.\n"); } CLEANUP: jsCloseConnection(jc); jc = NULL; return 0; }
Functions | |
| JCAM_DLL_API int STDCALL | jsSendParameterFileToScanner (JCONNECTION const jc, char const *const filename) |
| Sends a parameter file to the scanhead. | |
| JCAM_DLL_API int STDCALL | jsSendParametersToScanner (JCONNECTION const jc, char const *const parameters) |
| Sends parameters to the scanhead. | |
| JCAM_DLL_API int STDCALL | jsGetParameterFileFromScanner (JCONNECTION const jc, char const *const filename) |
| Reads the current parameter file from the scanhead and writes them to the specified file. | |
| JCAM_DLL_API size_t STDCALL | jsGetNumberOfErrorMessages (JCONNECTION const jc) |
Returns the number of error messages after a jsSendParameterFileToScanner() call returned OPERATION_FAILURE. | |
| JCAM_DLL_API char const *const STDCALL | jsGetErrorMessage (JCONNECTION const jc, size_t i) |
| Returns the specified error message. | |
|
||||||||||||
|
Sends a parameter file to the scanhead.
If
|
|
||||||||||||
|
Sends parameters to the scanhead.
If
|
|
||||||||||||
|
Reads the current parameter file from the scanhead and writes them to the specified file.
|
|
|
Returns the number of error messages after a
|
|
||||||||||||
|
Returns the specified error message. Do not modify the returned string.
|