JCam DLL API Reference
Sending Parameter Files to the Scanner

Functions

int jsBeginSendParameterFileToScanner (JCONNECTION const jc, char const *const filename)
 Starts sending a parameter file to the scanhead. Must be followed with a called to jsEndSendParameterFileToScanner(). More...
 
int jsEndSendParametersToScanner (JCONNECTION const jc)
 Completes the sending of parameters. Should always and only be called after a call to jsBeginSendParameterFileToScanner() or jsBeginSendParametersToScanner(). More...
 
int jsSendParameterFileToScanner (JCONNECTION const jc, char const *const filename)
 Sends a parameter file to the scanhead. More...
 
int jsSendParametersToScanner (JCONNECTION const jc, char const *const parameters)
 Sends parameters to the scanhead. More...
 
int jsBeginSendParametersToScanner (JCONNECTION const jc, char const *const parameters)
 Starts sending a parameter string to the scanhead. Must be followed with a called to jsEndSendParametersToScanner(). More...
 
int jsGetParameterFileFromScanner (JCONNECTION const jc, char const *const filename)
 Reads the current parameter file from the scanhead and writes them to the specified file. May not be called while the scanner is in Synchronized Scanning Mode.
More...
 
size_t jsGetNumberOfErrorMessages (JCONNECTION const jc)
 Returns the number of error messages after a jsSendParameterFileToScanner() call returned OPERATION_FAILURE. More...
 
char const *const jsGetErrorMessage (JCONNECTION const jc, size_t i)
 Returns the specified error message. More...
 

Detailed Description

These functions are for sending, reading, and checking correctness of parameter files sent to the scanner.

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;
if((jc = jsOpenConnection("192.168.1.105")) == NULL)
{
printf("Couldn't open connection.\n");
goto CLEANUP;
}
switch(jsSendParameterFileToScanner(jc, "param.dat"))
{
printf("Lost connection.\n");
goto CLEANUP;
for(i = 0; i < jsGetNumberOfErrorMessages(jc); i++)
printf("%s\n", jsGetErrorMessage(jc, i));
break;
default:
printf("Sent parameters successfully.\n");
}
CLEANUP:
jc = NULL;
return 0;
}

Function Documentation

◆ jsBeginSendParameterFileToScanner()

int jsBeginSendParameterFileToScanner ( JCONNECTION const  jc,
char const *const  filename 
)

Starts sending a parameter file to the scanhead. Must be followed with a called to jsEndSendParameterFileToScanner().

When connecting to large group of scanners, it is much faster to call this for all the scanners first, and then a second loop call the jsEndSendParameterFileToScanner() function. May not be called while the scanner is in Synchronized Scanning Mode.

See also
jsGetErrorMessage()
#jsEndSendParameterFileToScanner()
jsGetNumberOfErrorMessages()
jsGetParameterFileFromScanner()
Parameters
jcThe connection to the scanner.
filenameThe name of the file to send to the scanner.
Returns
0 on success.
SCANNER_FAILURE on all connection failures.
INVALID_PARAMETER if jc or filename is NULL.

◆ jsBeginSendParametersToScanner()

int jsBeginSendParametersToScanner ( JCONNECTION const  jc,
char const *const  parameters 
)

Starts sending a parameter string to the scanhead. Must be followed with a called to jsEndSendParametersToScanner().

When connecting to large group of scanners, it is must faster to call this for all the scanners first, and then a second loop call the jsEndSendParametersToScanner() function. May not be called while the scanner is in Synchronized Scanning Mode.

See also
jsGetErrorMessage()
jsEndSendParametersToScanner()
jsGetNumberOfErrorMessages()
jsGetParameterFileFromScanner()
Parameters
jcThe connection to the scanner.
filenameThe name of the file to send to the scanner.
Returns
0 on success.
SCANNER_FAILURE on all connection failures.
INVALID_PARAMETER if jc or filename is NULL.

◆ jsEndSendParametersToScanner()

int jsEndSendParametersToScanner ( JCONNECTION const  jc)

Completes the sending of parameters. Should always and only be called after a call to jsBeginSendParameterFileToScanner() or jsBeginSendParametersToScanner().

If OPERATION_FAILURE is returned, the error messages should be checked using jsGetNumberOfErrorMessages() and jsGetErrorMessage(). The error messages are stored inside the opaque JCONNECTION. May not be called while the scanner is in Synchronized Scanning Mode.

See also
jsGetErrorMessage()
jsBeginSendParameterFileToScanner()
jsBeginSendParametersToScanner()
jsGetNumberOfErrorMessages()
jsGetParameterFileFromScanner()
Parameters
jcThe connection to the scanner.
Returns
0 on success.
SCANNER_FAILURE on all connection failures.
INVALID_PARAMETER if jc or filename is NULL.
OPERATION_FAILURE on all other failures, including parse and file I/O errors.

◆ jsGetErrorMessage()

char const* const jsGetErrorMessage ( JCONNECTION const  jc,
size_t  i 
)

Returns the specified error message.

Do not modify the returned string.

See also
jsSendParametersToScanner()
jsGetNumberOfErrorMessages()
jsSendParameterFileToScanner()
Parameters
jcThe connection to the scanner.
iThe index of the error message to retrieve.
Returns
A C string of the error message.
NULL if i is out of range or jc is NULL.

◆ jsGetNumberOfErrorMessages()

size_t jsGetNumberOfErrorMessages ( JCONNECTION const  jc)

Returns the number of error messages after a jsSendParameterFileToScanner() call returned OPERATION_FAILURE.

See also
jsGetErrorMessage()
jsSendParametersToScanner()
jsSendParameterFileToScanner()
Parameters
jcThe connection to the scanner.
Returns
The number of error messages.
0 if jc is NULL.

◆ jsGetParameterFileFromScanner()

int jsGetParameterFileFromScanner ( JCONNECTION const  jc,
char const *const  filename 
)

Reads the current parameter file from the scanhead and writes them to the specified file. May not be called while the scanner is in Synchronized Scanning Mode.

See also
jsSendParametersToScanner()
jsSendParameterFileToScanner()
Parameters
jcthe connection to the scanner.
filenameThe name of the file to save the parameters in. The file will be created if it doesn't exist.
Returns
0 on success.
SCANNER_FAILURE on all connection failures.
INVALID_PARAMETER if jc or filename is NULL.
OPERATION_FAILURE on all other failures.

◆ jsSendParameterFileToScanner()

int jsSendParameterFileToScanner ( JCONNECTION const  jc,
char const *const  filename 
)

Sends a parameter file to the scanhead.

If OPERATION_FAILURE is returned, the error messages should be checked using jsGetNumberOfErrorMessages() and jsGetErrorMessage(). The error messages are stored inside the opaque JCONNECTION. May not be called while the scanner is in Synchronized Scanning Mode.

See also
jsGetErrorMessage()
jsSendParametersToScanner()
jsGetNumberOfErrorMessages()
jsGetParameterFileFromScanner()
Parameters
jcThe connection to the scanner.
filenameThe name of the file to send to the scanner.
Returns
0 on success.
SCANNER_FAILURE on all connection failures.
INVALID_PARAMETER if jc or filename is NULL.
OPERATION_FAILURE on all other failures, including parse and file I/O errors.

◆ jsSendParametersToScanner()

int jsSendParametersToScanner ( JCONNECTION const  jc,
char const *const  parameters 
)

Sends parameters to the scanhead.

If OPERATION_FAILURE is returned, the error messages should be checked using jsGetNumberOfErrorMessages() and jsGetErrorMessage(). The error messages are stored inside the opaque JCONNECTION. May not be called while the scanner is in Synchronized Scanning Mode.

See also
jsGetErrorMessage()
jsGetNumberOfErrorMessages()
jsSendParameterFileToScanner()
jsGetParameterFileFromScanner()
Parameters
jcThe connection to the scanner.
parametersA NULL-terminated string with the parameters to send to the scanner.
Returns
0 on success.
SCANNER_FAILURE on all connection failures.
INVALID_PARAMETER if jc or parameters is NULL.
OPERATION_FAILURE on all other failures, including parse and file I/O errors.