JCam DLL API Reference
Checking the Scanner Status

Functions

int jsGetScannerStatusFromScanner (JCONNECTION const jc)
 Reads status from the scanner into a data structure inside the opaque JCONNECTION. More...
 
int jsGetScannerStatusValue (JCONNECTION const jc, size_t i, int *value)
 Gets the specified status value from the data structure inside the JCONNECTION. More...
 
int jsGetStatusDescriptionFromScanner (JCONNECTION const jc, UINT32 i, char *const description, UINT32 description_length)
 Reads a descriptive text string from the scanner for the particular status index. More...
 

Detailed Description

The order of operations here is important.

  1. jsGetScannerStatusFromScanner()
  2. jsGetScannerStatusValue()

Here are the valid indexes:

  1. DSP Version Code
  2. Mode: 0-Init, 1-Idle, 2-Expose, 3-Scan
  3. Host Request: 0-None, 1-Scan Cam, 2-Laser Scan
  4. Current Camera Exposure Time
  5. Current Laser On Time
  6. Current Encoder Count
  7. Optically Isolated Inputs
  8. Results of Last Host Interface Communication
  9. Dark Pixel Value
  10. Current Bias (offset)
  11. End Code
  12. Scan Server Version
  13. Serial Number
#include "jcam_dll.h"
#include <stdio.h>
using namespace joescan;
int main(int argc, char * argv[])
{
if((jc = jsOpenConnection("192.168.1.205")) == NULL)
{
printf("Couldn't open connection.\n");
goto CLEANUP;
}
{
printf("Invalid Parameter.\n");
goto CLEANUP;
printf("Scanner Failure in jsGetScannerStatusFromScanner ().\n");
goto CLEANUP;
default:
printf("Got status from scanner.\n");
break;
}
size_t i = 0;
int value;
char statusDescription[128];
bool finished = false;
while(finished == false)
{
switch(jsGetStatusDescriptionFromScanner(jc, i, statusDescription, 128))
{
printf("Invalid Parameter.\n");
break;
printf("Scanner Failure in jsGetStatusDescriptionFromScanner().\n");
goto CLEANUP;
default:
break;
}
switch(jsGetScannerStatusValue (jc, i, &value))
{
printf("%2d Invalid parameter -- Out of bounds index.\n", i);
finished = true;
break;
default:
printf("%2d %s %d\n", i, statusDescription, value);
break;
}
++i;
}
CLEANUP:
jc = NULL;
return 0;
}

Function Documentation

◆ jsGetScannerStatusFromScanner()

int jsGetScannerStatusFromScanner ( JCONNECTION const  jc)

Reads status from the scanner into a data structure inside the opaque JCONNECTION.

See also
jsGetScannerStatusValue()
jsGetStatusDescriptionFromScanner()
Parameters
jcThe connection to the scanner.
Returns
0 on success.
INVALID_PARAMETER if jc is NULL.
SCANNER_FAILURE if the connection closes.

◆ jsGetScannerStatusValue()

int jsGetScannerStatusValue ( JCONNECTION const  jc,
size_t  i,
int *  value 
)

Gets the specified status value from the data structure inside the JCONNECTION.

See also
jsGetScannerStatusFromScanner()
jsGetStatusDescriptionFromScanner()
Parameters
jcThe connection to the scanner.
iThe index of the status value to retrieve.
valuePointer to an int that will hold the value.
Returns
0 on success.
INVALID_PARAMETER if jc or value is NULL, or if i is out of range.

◆ jsGetStatusDescriptionFromScanner()

int jsGetStatusDescriptionFromScanner ( JCONNECTION const  jc,
UINT32  i,
char *const  description,
UINT32  description_length 
)

Reads a descriptive text string from the scanner for the particular status index.

The description length should be a minimum of 128 characters. After this call, description will be properly null-terminated. If description isn't long enough, the result will be truncated, but still properly null-terminated. The first valid index is 0, the last valid index is 12.

Invalid indexes will return the string "ERROR unsuported status type".

See also
jsGetScannerStatusValue()
jsGetScannerStatusFromScanner()
Parameters
jcThe connection to the scanner.
iThe index of the status name to retrieve.
descriptionThe character buffer that will contain the status name.
description_lengthThe number of characters that description points to.
Returns
0 on success.
INVALID_PARAMETER if jc or description is NULL, or if i is out of range.
SCANNER_FAILURE if the connection closes.