10 #if (defined JCAM_DYNAMIC_LIB && ! defined JCAM_STATIC_LIB) 18 #if defined JCAM_DLL_EXPORTS 19 #define JCAM_DLL_API extern "C" __declspec(dllexport) 21 #define JCAM_DLL_API __declspec(dllimport) 24 #define STDCALL __stdcall // Declare our calling convention. 25 #elif (! defined JCAM_DYNAMIC_LIB && defined JCAM_STATIC_LIB) 27 #define STDCALL __stdcall 29 #error "You need to define either JCAM_DYNAMIC_LIB if you will distribute jcam_dll.dll with your software, or JCAM_STATIC_LIB if you're statically linking with jcam_dll.lib." 36 #include <sys/socket.h> 37 #include <netinet/in.h> 38 #include <netinet/tcp.h> 50 #define CHECK_ELEMENT_SIZE(element, size) \ 51 extern char element ## size[static_cast<int>((sizeof(element) == (size)))] 53 CHECK_ELEMENT_SIZE(
char, 1);
54 CHECK_ELEMENT_SIZE(
short, 2);
55 CHECK_ELEMENT_SIZE(
int, 4);
60 typedef signed char INT8;
141 #pragma pack(1) //Tells compiler to use one-byte boundaries for packing structs. 365 #pragma pack() //Use compiler default packing after this. 419 JCAM_DLL_API JCONNECTION STDCALL
jsOpenConnectionBase(
char const *
const host, UINT32
const cableID);
533 JCAM_DLL_API
int STDCALL
jsGetImage(JCONNECTION
const jc,
jsImage *
const image);
563 JCAM_DLL_API
int STDCALL
jsGetScan(JCONNECTION
const jc,
jsScan *
const scan);
709 JCAM_DLL_API
int STDCALL
jsStartPulseMaster(JCONNECTION
const jc,
int pulseInterval,
int pulseCount);
724 JCAM_DLL_API
int STDCALL
jsStopPulses(JCONNECTION
const jc);
740 JCAM_DLL_API
int STDCALL
jsSetAlternatingExposure(JCONNECTION
const jc,
bool const enable,
int const exposure1,
int const exposure2);
998 JCAM_DLL_API
int STDCALL
jsSetEncoderValue(JCONNECTION
const jc, UINT16 newEncoderValue);
1012 JCAM_DLL_API
int STDCALL
jsSetEncoderValue32(JCONNECTION
const jc, UINT32 newEncoderValue);
1173 JCAM_DLL_API
char const *
const STDCALL
jsGetErrorMessage(JCONNECTION
const jc,
size_t i);
1214 JCAM_DLL_API
int STDCALL
jsOverrideLaserAutoexposure(JCONNECTION
const jc,
double minLaserOn,
double maxLaserOn,
double defaultLaserOn,
1215 int staturatedIntensity,
int saturatedPercentage,
int laserThreshold,
bool autoexposeLaser);
1231 JCAM_DLL_API
int STDCALL
jsOverrideScanWindow(JCONNECTION
const jc,
double windowTop,
double windowBottom,
double windowLeft,
double windowRight);
1265 JCAM_DLL_API
int STDCALL
jsOverrideSyncSettings(JCONNECTION
const jc,
double timeScannedInterval,
double encoderPulseInterval,
1266 double encoderScanInterval,
int numberOfPhases,
bool timeStaggeredScanning,
1267 double laser0Phase,
double laser1Phase,
double laser2Phase,
double laser3Phase,
double laser4Phase,
1268 bool untriggeredSyncScanning,
bool startScanRisingEdgeTriggered);
1288 JCAM_DLL_API
int STDCALL
jsReadScanWindowN(JCONNECTION
const jc,
jsLaserIndex const laserIndex,
int *top,
int *bottom,
int *left,
int *right);
1413 JCAM_DLL_API
int STDCALL jsFindAllScannersVB(LPSAFEARRAY lpsaResponses);
1462 JCAM_DLL_API
int STDCALL
jsSetStaticIpInt(UINT32
const serialNumber, UINT32
const staticIpAddress, UINT32
const netmask);
1478 JCAM_DLL_API
int STDCALL
jsSetStaticIpChar(UINT32
const serialNumber,
char const *
const staticIpAddress,
char const *
const netmask);
1492 JCAM_DLL_API
int STDCALL
jsSetBaseIpInt(UINT32
const serialNumber, UINT32
const baseIpAddress, UINT32
const netmask);
1507 JCAM_DLL_API
int STDCALL
jsSetBaseIpChar(UINT32
const serialNumber,
char const *
const baseIpAddress,
char const *
const netmask);
1525 JCAM_DLL_API
int STDCALL
jsSetCableId(UINT32
const serialNumber, UINT32
const cableId);
1540 JCAM_DLL_API
int STDCALL
jsClearCableId(UINT32
const serialNumber);
1556 #endif //__cplusplus 1558 #if (defined JCAM_STATIC_LIB && defined WIN32) 1559 # include <windef.h> 1596 #endif // (defined JCAM_STATIC_LIB && defined WIN32) 1600 #endif //__cplusplus double y
The Y offset of the scanner's position.
Definition: jcam_dll.h:358
A parameter to a function was NULL or out of range.
Definition: jcam_dll.h:84
int jsStartPulseMaster(JCONNECTION const jc, int pulseInterval, int pulseCount)
Causes the scanner to output a pulse train on the Start Scan I/O. The period and number of pulses are...
int jsCleanUpOutstandingRequests(JCONNECTION const jc)
Reads and discards all the profiles in the TCP/IP stack generated by jsSendProfileRequestN() or jsSen...
int jsSetStaticIpChar(UINT32 const serialNumber, char const *const staticIpAddress, char const *const netmask)
Sets a scanner's static IP address.
int jsGetProfileN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsProfile *const profile)
Requests and reads a profile from the specified laser.
UINT8 currentIpSetup
The current addressing technique the scanner is using.
Definition: jcam_dll.h:331
double x
The X offset of the scanner's position.
Definition: jcam_dll.h:356
The maximum length of the date field in a jsOldCalibrationValue.
Definition: jcam_dll.h:111
int jsSendProfileRequest(JCONNECTION const jc)
Sends a request for a profile.
int jsEnterEncoderSyncMode(JCONNECTION const jc)
Causes the scanner to enter Encoder Synchronized Scanning Mode.
int jsEndSendParametersToScanner(JCONNECTION const jc)
Completes the sending of parameters. Should always and only be called after a call to jsBeginSendPara...
INT32 y
The y coordinate of the data point in 1000ths of an inch.
Definition: jcam_dll.h:149
INT32 numberHorizontal
The number of horizontal pixels.
Definition: jcam_dll.h:262
INT32 reserved2
Which laser this profile is from.
Definition: jcam_dll.h:238
char const *const jsGetErrorMessage(JCONNECTION const jc, size_t i)
Returns the specified error message.
JCONNECTION jsOpenConnectionInt(int const host)
Opens a connection to the specified host.
int jsSendMultipleProfileRequest(JCONNECTION const jc, UINT32 const nProfiles)
Sends a request for up to nProfiles profiles to the scanner while in Synchronized Scanning Mode...
size_t jsGetNumberOfOutstandingRequests(JCONNECTION const jc)
Returns the number of unread requests from either jsSendProfileRequestN() or jsSendMultipleProfileReq...
int jsGetProfileFromAllLasers(JCONNECTION const jc, jsProfile *const profiles, size_t const cProfiles)
Requests and reads a profile from each laser the scanner has.
int jsReadScanWindowN(JCONNECTION const jc, jsLaserIndex const laserIndex, int *top, int *bottom, int *left, int *right)
Reads the current scan window for the selected laser from the scanner.
BOOL jsInitialize()
Initializes TCP/IP communications.
int jsEnterPulseSyncMode(JCONNECTION const jc)
Causes the scanner to enter Start Scan Triggered Synchronized Scanning Mode.
jsConstants
Constants that avoid the traditional problems of #define constants.
Definition: jcam_dll.h:77
int jsReadProfile(JCONNECTION const jc, jsProfile *const profile)
Reads a profile from the connection.
int jsSendParametersToScanner(JCONNECTION const jc, char const *const parameters)
Sends parameters to the scanhead.
Represents a coordinate and its associated pixel brightness.
Definition: jcam_dll.h:144
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.
The scanner is fine.
Definition: jcam_dll.h:105
INT32 sendLocation
The encoder value when the scanner sent the profile.
Definition: jcam_dll.h:206
If this bit is set in a jsProfile's flags field, then Synchronized Scanning Mode is running the scann...
Definition: jcam_dll.h:91
int jsOverrideScanWindow(JCONNECTION const jc, double windowTop, double windowBottom, double windowLeft, double windowRight)
Override the Scan Window parameters set in param.dat. Values will be lost when a new param...
INT32 laserIndex
Currently unused.
Definition: jcam_dll.h:236
Responses from scanners on the network.
Definition: jcam_dll.h:320
Profile data from the scanner.
Definition: jcam_dll.h:194
INT32 laserOnTime
The number of 10 microsecond units the laser was on.
Definition: jcam_dll.h:208
int jsBeginSendParameterFileToScanner(JCONNECTION const jc, char const *const filename)
Starts sending a parameter file to the scanhead. Must be followed with a called to jsEndSendParameter...
int jsSetStaticIpInt(UINT32 const serialNumber, UINT32 const staticIpAddress, UINT32 const netmask)
Sets a scanner's static IP address.
struct tagResponsePacket jsResponsePacket
Responses from scanners on the network.
The scanner is scanning.
Definition: jcam_dll.h:107
INT32 inputs
The status of all cable inputs to the scanner.
Definition: jcam_dll.h:223
Closer to the camera than LASER3.
Definition: jcam_dll.h:130
UINT8 cableId
The cable ID of the responding scanner.
Definition: jcam_dll.h:337
void * JCONNECTION
An opaque handle for connections to scanners.
Definition: jcam_dll.h:139
Closer to the camera than LASER2.
Definition: jcam_dll.h:128
signed char INT8
Signed 8 bit integer.
Definition: jcam_dll.h:61
unsigned short UINT16
Unsigned 16 bit integer.
Definition: jcam_dll.h:69
INT32 x
The x coordinate of the data point in 1000ths of an inch.
Definition: jcam_dll.h:147
int jsReadMultipleProfilesTimeout(JCONNECTION const jc, jsProfile *const profiles, UINT32 cProfiles, long timeoutMilliseconds)
Requests and reads up to n profiles from the scanner while in either Synchronized Scanning Mode...
int jsSetBaseIpInt(UINT32 const serialNumber, UINT32 const baseIpAddress, UINT32 const netmask)
Sets a scanner's base IP address.
INT32 sequenceNumber
Sequence number from Synchronized Scanning Mode.
Definition: jcam_dll.h:202
int jsFindScannerByCableId(int const cableId, jsResponsePacket responses[], const size_t nResponses)
Attempts to discover the scanner(s) on the network with the specified Cable ID.
INT32 reserved1
Currently unused.
Definition: jcam_dll.h:258
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 firmwar...
int jsGetProfile(JCONNECTION const jc, jsProfile *const profile)
Requests and reads a profile from the default laser.
int jsGetImageN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage *const image)
Requests and reads an image with the specified laser on.
int jsHaltSyncMode(JCONNECTION const jc)
Causes the scanner to halt Time or Encoder Synchronized Scanning Mode.
int jsEnterTimeSyncMode(JCONNECTION const jc)
Causes the scanner to enter Time Synchronized Scanning Mode.
int jsClearCableId(UINT32 const serialNumber)
Reverts to the cable ID physically wired into a scanner.
int jsReadProfileN(JCONNECTION const jc, jsProfile *const profile)
Reads a profile from the connection.
struct tagProfileDataPoint ProfileDataPoint
Represents a coordinate and its associated pixel brightness.
struct tagOldCalibrationValue jsOldCalibrationValue
Old position calibration parameters sent to the scanner.
int jsIsInSyncMode(JCONNECTION const jc)
Returns if a scanner is in Synchronized Mode.
int jsReadPositionCalibrationN(JCONNECTION const jc, jsLaserIndex const laserIndex, double *xOffset, double *yOffset, double *roll)
Reads the current position calibration for the selected laser from the scanner.
INT32 numberPoints
The number of valid coordinate points in this profile.
Definition: jcam_dll.h:240
struct tagScan jsScan
Scan data from the scanner.
A scanner in Synchronized Scanning Mode has no available profiles.
Definition: jcam_dll.h:86
int jsSetEncoderValue(JCONNECTION const jc, UINT16 newEncoderValue)
Sets the scanner's internal encoder value.
int jsCloseConnection(JCONNECTION const jc)
Closes a JCONNECTION.
UINT32 serialNumber
The serial number of the responding scanner.
Definition: jcam_dll.h:335
INT32 timeInHead
The time since the scanner was turned on.
Definition: jcam_dll.h:213
int jsGetParameterFileFromScanner(JCONNECTION const jc, char const *const filename)
Reads the current parameter file from the scanhead and writes them to the specified file...
int jsGetJcamDllMajorVersionNumber()
Returns the major revision number of the DLL.
unsigned int UINT32
Unsigned 32 bit integer.
Definition: jcam_dll.h:71
INT32 exposureTime
How many 10 microsecond units the camera was exposed.
Definition: jcam_dll.h:256
The connection to the scanner is invalid.
Definition: jcam_dll.h:82
int jsStopPulses(JCONNECTION const jc)
Causes the scanner to stop generating a pulse train on the Start Scan I/O.
IP Address is determined by the cable ID.
Definition: jcam_dll.h:101
size_t jsGetNumberOfErrorMessages(JCONNECTION const jc)
Returns the number of error messages after a jsSendParameterFileToScanner() call returned OPERATION_F...
unsigned char UINT8
Unsigned 8 bit integer.
Definition: jcam_dll.h:67
int jsGetImageScan(JCONNECTION const jc, jsImage *const image, jsScan *const scan)
Requests and reads an image and scan.
struct tagImage jsImage
Image data from the scanner.
INT32 reserved2
Currently unused.
Definition: jcam_dll.h:260
int jsGetScannerStatusValue(JCONNECTION const jc, size_t i, int *value)
Gets the specified status value from the data structure inside the JCONNECTION.
int jsGetImagePixel(jsImage const *const image, size_t const x, size_t const y)
Returns a pixel value from an image.
Closer to the camera than LASER1.
Definition: jcam_dll.h:126
CCD sensor dimensions.
Definition: jcam_dll.h:96
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 requi...
int jsGetMultipleProfiles(JCONNECTION const jc, jsProfile *const profiles, UINT32 const cProfiles)
Requests and reads up to n profiles from the scanner while in either Synchronized Scanning Mode...
signed short INT16
Signed 16 bit integer.
Definition: jcam_dll.h:63
Furthest from the camera.
Definition: jcam_dll.h:122
int jsSendPositionCalibrationN(JCONNECTION const jc, jsLaserIndex const laserIndex, double const xOffset, double const yOffset, double const roll)
Sends a position calibration for the selected laser to the scanner.
Image data from the scanner.
Definition: jcam_dll.h:253
int jsGetScan(JCONNECTION const jc, jsScan *const scan)
Requests and reads a scan.
INT32 numberVertical
The number of vertical pixels.
Definition: jcam_dll.h:264
struct tagScanDataPoint ScanDataPoint
Represents a subpixel point from a scanner and its brightness.
The number of bytes in a jsResponsePacket's options field.
Definition: jcam_dll.h:109
int jsGetImage(JCONNECTION const jc, jsImage *const image)
Requests and reads an image.
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. ...
int jsSendProfileRequestN(JCONNECTION const jc, jsLaserIndex const laserIndex)
Sends a request for a profile from the specified laser.
signed int INT32
Signed 32 bit integer.
Definition: jcam_dll.h:65
int jsExitSyncMode(JCONNECTION const jc)
Causes the scanner to exit Time or Encoder Synchronized Scanning Mode.
Closer to the camera than LASER0.
Definition: jcam_dll.h:124
Old position calibration parameters sent to the scanner.
Definition: jcam_dll.h:353
int jsReadMultipleProfiles(JCONNECTION const jc, jsProfile *const profiles, UINT32 nProfiles)
Reads up to nProfiles profiles from jc after a jsSendMultipleProfileRequest() call in Synchronized Sc...
int jsFindScannerBySerialNumber(int const serialNumber, jsResponsePacket responses[], const size_t nResponses)
Attempts to discover the scanner on the network with the specified serial number. ...
int jsSetAlternatingExposure(JCONNECTION const jc, bool const enable, int const exposure1, int const exposure2)
Set the alternating exposure parameters. Only works in sync mode. Settings are lost when exiting sync...
int jsGetScanN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsScan *const scan)
Requests and reads a scan with the specified laser on.
JCONNECTION jsOpenConnection(char const *const host)
Opens a connection to the specified host.
int jsSetEncoderValue32(JCONNECTION const jc, UINT32 newEncoderValue)
Sets the scanner's internal encoder value.
int jsGetJcamDllMinorVersionNumber()
Returns the minor revision number of the DLL.
int jsGetScannerStatusFromScanner(JCONNECTION const jc)
Reads status from the scanner into a data structure inside the opaque JCONNECTION.
JCONNECTION jsOpenConnectionBase(char const *const host, UINT32 const cableID)
Opens a connection to the specified scanner using Base IP + Cable ID addressing.
A connection to a scanner timed out.
Definition: jcam_dll.h:88
An operation was unable to complete.
Definition: jcam_dll.h:80
int jsSetBaseIpChar(UINT32 const serialNumber, char const *const baseIpAddress, char const *const netmask)
Sets a scanner's base IP address.
INT32 flags
Information from the scanner.
Definition: jcam_dll.h:234
UINT32 ipAddress
The IP Address of the responding scanner, in network byte order.
Definition: jcam_dll.h:333
struct tagProfile jsProfile
Profile data from the scanner.
int jsReadOldPositionCalibrationsN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsOldCalibrationValue oldCalibrations[], UINT32 nCalibrations)
Reads the specified number of old position calibrations for the selected laser from the scanner...
Static IP Address for a scanner.
Definition: jcam_dll.h:99
int jsOverrideLaserAutoexposure(JCONNECTION const jc, double minLaserOn, double maxLaserOn, double defaultLaserOn, int staturatedIntensity, int saturatedPercentage, int laserThreshold, bool autoexposeLaser)
Override the Laser Autoexposure parameters set in param.dat. Values will be lost when a new param...
UINT8 status
The status of the responding scanner.
Definition: jcam_dll.h:339
double roll
The scanner's rotation.
Definition: jcam_dll.h:360
UINT32 build
The firmware revision number of the responding scanner.
Definition: jcam_dll.h:341
int jsBeginSendParametersToScanner(JCONNECTION const jc, char const *const parameters)
Starts sending a parameter string to the scanhead. Must be followed with a called to jsEndSendParamet...
jsLaserIndexTag
A type for specifying which laser to use.
Definition: jcam_dll.h:119
int jsOverrideSyncSettings(JCONNECTION const jc, double timeScannedInterval, double encoderPulseInterval, double encoderScanInterval, int numberOfPhases, bool timeStaggeredScanning, double laser0Phase, double laser1Phase, double laser2Phase, double laser3Phase, double laser4Phase, bool untriggeredSyncScanning, bool startScanRisingEdgeTriggered)
Override the Synchronized Scanning parameters set in param.dat. Values will be lost when a new param...
enum jsLaserIndexTag jsLaserIndex
A type for specifying which laser to use.
int jsFindAllScanners(jsResponsePacket responses[], const size_t nResponses)
Attempts to discover all scanners on the network.
int jsSendParameterFileToScanner(JCONNECTION const jc, char const *const filename)
Sends a parameter file to the scanhead.
CCD sensor dimensions.
Definition: jcam_dll.h:94
IP Address is assigned with DHCP.
Definition: jcam_dll.h:103
void jsCleanup()
Gracefully ends TCP/IP communications.
INT32 location
The encoder value when when the scanner created the profile.
Definition: jcam_dll.h:204
INT32 brightness
The intensity of the pixel where the laser was detected.
Definition: jcam_dll.h:157
int jsSetCableId(UINT32 const serialNumber, UINT32 const cableId)
Overrides the cable ID physically wired into a scanner.