JCam DLL API Reference
Scanners with Multiple Lasers

Functions

int jsSendProfileRequestN (JCONNECTION const jc, jsLaserIndex const laserIndex)
 Sends a request for a profile from the specified laser. More...
 
int jsReadProfileN (JCONNECTION const jc, jsProfile *const profile)
 Reads a profile from the connection. More...
 
int jsGetProfileN (JCONNECTION const jc, jsLaserIndex const laserIndex, jsProfile *const profile)
 Requests and reads a profile from the specified laser. More...
 
int jsGetProfileFromAllLasers (JCONNECTION const jc, jsProfile *const profiles, size_t const cProfiles)
 Requests and reads a profile from each laser the scanner has. More...
 
int jsGetImageN (JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage *const image)
 Requests and reads an image with the specified laser on. More...
 
int jsGetScanN (JCONNECTION const jc, jsLaserIndex const laserIndex, jsScan *const scan)
 Requests and reads a scan with the specified laser on. More...
 
int jsGetImageScanN (JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage *const image, jsScan *const scan)
 Requests and reads an image and scan with the specified laser on. More...
 
int jsGetDiagnosticScan (JCONNECTION const jc, int const cameraExposure, int const laserExposure, const jsLaserIndex laserIndex, jsScan *const scan)
 Requests and reads a scan with the specified laser and camera timings. This function requires firmware revision 13817 and higher. More...
 
int jsGetDiagnosticImageScan (JCONNECTION const jc, int const cameraExposure, int const laserExposure, const jsLaserIndex laserIndex, jsImage *const image, jsScan *const scan)
 Requests and reads an image and scan with the specified laser and camera timings. This function requires firmware revision 13817 and higher. More...
 

Detailed Description

These functions allow you to choose which laser to use. While only the JS20-DL has more than one laser, you can use these functions with any JS20 so long as you specify the valid laser, LASER0.

If you attempt to access an invalid laser, like LASER1 on a single-laser JS20, the connection will close. This is fail-fast behavior. If an empty jsProfile were returned, people would spend all day trying to figure out why the profile had no data. Now, they'll simply spend all day trying to figure out why the connection died.

You may be thinking to yourself, “Why an enum instead of an int?” Good question. The answer is type safety. This way, you can't index an inappropriate laser like -3 - it simply won't compile. You'll have to actively work to index an inappropriate laser instead of having it accidentally happen.

If you still want to use an int, put the enum values into an array like this and pass in the value from the array:

jsLaserIndex laserIndexArray[] = {LASER0, LASER1};
for(int i = 0; i < 2; i++)
jsGetProfileN(jc, laserIndexArray[i], &profile);

Function Documentation

◆ jsGetDiagnosticImageScan()

int jsGetDiagnosticImageScan ( JCONNECTION const  jc,
int const  cameraExposure,
int const  laserExposure,
const jsLaserIndex  laserIndex,
jsImage *const  image,
jsScan *const  scan 
)

Requests and reads an image and scan with the specified laser and camera timings. This function requires firmware revision 13817 and higher.

Parameters
jcThe connection to read the image and scan from.
cameraExposureThe time in microseconds to expose the camera.
laserExposureThe time in microseconds to expose the laser.
laserIndexWhich laser to use for the image and scan.
imageWhere the image is stored.
scanWhere the scan is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or scan is NULL.
SCANNER_FAILURE on all connection failures.

May not be called while the scanner is in Synchronized Scanning Mode.

◆ jsGetDiagnosticScan()

int jsGetDiagnosticScan ( JCONNECTION const  jc,
int const  cameraExposure,
int const  laserExposure,
const jsLaserIndex  laserIndex,
jsScan *const  scan 
)

Requests and reads a scan with the specified laser and camera timings. This function requires firmware revision 13817 and higher.

Parameters
jcThe connection to read the scan from.
cameraExposureThe time in microseconds to expose the camera.
laserExposureThe time in microseconds to expose the laser.
laserIndexWhich laser to use for the scan.
scanWhere the scan is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or scan is NULL.
SCANNER_FAILURE on all connection failures.

May not be called while the scanner is in Synchronized Scanning Mode.

◆ jsGetImageN()

int jsGetImageN ( JCONNECTION const  jc,
jsLaserIndex const  laserIndex,
jsImage *const  image 
)

Requests and reads an image with the specified laser on.

Parameters
jcThe connection to read the image from.
laserIndexWhich laser to use for the image.
imageWhere the image is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or image is NULL.
SCANNER_FAILURE on all connection failures.

May not be called while the scanner is in Synchronized Scanning Mode.

◆ jsGetImageScanN()

int jsGetImageScanN ( JCONNECTION const  jc,
jsLaserIndex const  laserIndex,
jsImage *const  image,
jsScan *const  scan 
)

Requests and reads an image and scan with the specified laser on.

Parameters
jcThe connection to read the image and scan from.
laserIndexWhich laser to use for the image and scan.
imageWhere the image is stored.
scanWhere the scan is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or scan is NULL.
SCANNER_FAILURE on all connection failures.

May not be called while the scanner is in Synchronized Scanning Mode.

◆ jsGetProfileFromAllLasers()

int jsGetProfileFromAllLasers ( JCONNECTION const  jc,
jsProfile *const  profiles,
size_t const  cProfiles 
)

Requests and reads a profile from each laser the scanner has.

May not be called while the scanner is in Synchronized Scanning Mode.

If cProfiles indicates profiles doesn't have enough space, then extra profiles are discarded. Really, profiles should point to an array with enough space for a profile from every laser.

Parameters
jcThe connection to read the profiles from.
profilesPointer to an array of jsProfile's.
cProfilesThe number of jsProfile's that profiles points to.
Returns
0 on success.
INVALID_PARAMETER if jc or profile is NULL.
SCANNER_FAILURE on all connection failures.
SOCKET_TIMEOUT if the read took longer than 5 seconds.

◆ jsGetProfileN()

int jsGetProfileN ( JCONNECTION const  jc,
jsLaserIndex const  laserIndex,
jsProfile *const  profile 
)

Requests and reads a profile from the specified laser.

May not be called while the scanner is in Synchronized Scanning Mode.

Parameters
jcThe connection to read a profile from.
laserIndexWhich laser to use for the scan.
profileWhere the profile is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or profile is NULL.
SCANNER_FAILURE on all connection failures.
SOCKET_TIMEOUT if the read took longer than 5 seconds.

◆ jsGetScanN()

int jsGetScanN ( JCONNECTION const  jc,
jsLaserIndex const  laserIndex,
jsScan *const  scan 
)

Requests and reads a scan with the specified laser on.

Parameters
jcThe connection to read the scan from.
laserIndexWhich laser to use for the scan.
scanWhere the scan is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or scan is NULL.
SCANNER_FAILURE on all connection failures.

May not be called while the scanner is in Synchronized Scanning Mode.

◆ jsReadProfileN()

int jsReadProfileN ( JCONNECTION const  jc,
jsProfile *const  profile 
)

Reads a profile from the connection.

May not be called while the scanner is in Synchronized Scanning Mode.

A call to jsSendProfileRequestN() must have been made to the specified JCONNECTION before this function is called. Otherwise the call will block and eventually time out waiting for a profile that isn't coming.

Decrements the number of outstanding requests for this connection by one.

See also
jsSendProfileRequestN()
jsGetNumberOfOutstandingRequests()
jsCleanUpOutstandingRequests()
Parameters
jcThe connection to read the profile from.
profileWhere the profile is stored.
Returns
0 on success.
INVALID_PARAMETER if jc or profile is NULL.
SCANNER_FAILURE on all connection failures.
SOCKET_TIMEOUT if the read took longer than 5 seconds.

◆ jsSendProfileRequestN()

int jsSendProfileRequestN ( JCONNECTION const  jc,
jsLaserIndex const  laserIndex 
)

Sends a request for a profile from the specified laser.

May not be called while the scanner is in Synchronized Scanning Mode.

Nothing is read from the connection during this call. Increments the number of outstanding requests for this connection by one.

Parameters
jcThe connection to send the request to.
laserIndexWhich laser to use for the scan.
See also
jsReadProfileN()
jsGetNumberOfOutstandingRequests()
jsCleanUpOutstandingRequests()
Returns
0 on success.
INVALID_PARAMETER if jc is NULL.
SCANNER_FAILURE on all connection failures.