JoeScan
  home
our story
news  and events
contact us
    our products
how it works
applications support service

jcam_dll.h

Go to the documentation of this file.
00001 //Ensures that this file isn't included twice within a translation unit.
00002 #ifndef JCAM_DLL
00003 #define JCAM_DLL
00004 
00005 #include <stddef.h>
00006 
00007 #if defined WIN32
00008 
00009     #if (defined JCAM_DYNAMIC_LIB && ! defined JCAM_STATIC_LIB) 
00010         // The following ifdef block is the standard way of creating macros which make exporting
00011         // from a DLL simpler. All files within this DLL are compiled with the JCAM_DLL_EXPORTS
00012         // symbol defined on the command line. This symbol should not be defined on any project
00013         // that uses this DLL. This way any other project whose source files include this file see
00014         // JCAM_DLL_API functions as being imported from a DLL, whereas this DLL sees symbols
00015         // defined with this macro as being exported.
00016 
00017         #if defined JCAM_DLL_EXPORTS
00018             #define JCAM_DLL_API extern "C" __declspec(dllexport)
00019         #else
00020             #define JCAM_DLL_API __declspec(dllimport)
00021         #endif
00022 
00023         #define STDCALL __stdcall    // Declare our calling convention.
00024     #elif (! defined JCAM_DYNAMIC_LIB && defined JCAM_STATIC_LIB)
00025         #define JCAM_DLL_API
00026         #define STDCALL __stdcall
00027     #else
00028         #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."
00029     #endif
00030 
00031 #else //WIN32
00032 
00033     #define JCAM_DLL_API
00034     #define STDCALL
00035 
00036 #endif //WIN32
00037 
00038 #ifdef __cplusplus
00039     //Tells the compiler to use C symbol naming conventions
00040     extern "C" {
00041 
00042     //Put things in a separate namespace so that there's no chance of collisions
00043     namespace joescan {
00044 #endif //__cplusplus
00045 
00046 #ifndef SWIG
00047 #define CHECK_ELEMENT_SIZE(element, size) \
00048     extern char element ## size[static_cast<int>((sizeof(element) == (size)))]
00049 
00050 CHECK_ELEMENT_SIZE(char, 1);
00051 CHECK_ELEMENT_SIZE(short, 2);
00052 CHECK_ELEMENT_SIZE(int, 4);
00053 CHECK_ELEMENT_SIZE(size_t, 4);
00054 #endif
00055 
00056 #ifndef INT8
00057 
00058 typedef signed char         INT8;
00060 typedef signed short        INT16;
00062 typedef signed int          INT32;
00064 typedef unsigned char       UINT8;
00066 typedef unsigned short      UINT16;
00068 typedef unsigned int        UINT32;
00069 #endif
00070 
00074 enum jsConstants
00075 {
00077     OPERATION_FAILURE   = 21,
00079     SCANNER_FAILURE     = -1,
00081     INVALID_PARAMETER   = -2,
00083     PROFILE_UNAVAILABLE = -3,
00085     SOCKET_TIMEOUT      = -4,
00086 
00088     SYNC_MODE_OVERRUN = 0x00000001,
00089 
00091     MAX_HORIZONTAL = 324,
00093     MAX_VERTICAL   = 243,
00094 
00096     IPS_STATIC    = 0,
00098     IPS_BY_ID     = 1,
00100     IPS_BY_DHCP   = 2,
00102     STATUS_NORMAL = 0,
00104     STATUS_ACTIVE = 1,
00106     OPTIONS_SIZE  = 512,
00108     DATE_LENGTH = 32,
00109 };
00110 
00116 typedef enum jsLaserIndexTag
00117 {
00119     LASER0 = 0,
00121     LASER1 = 1,
00123     LASER2 = 2,
00124 } jsLaserIndex;
00125 
00132 typedef void* JCONNECTION;
00133 
00134 #pragma pack(1) //Tells compiler to use one-byte boundaries for packing structs.
00135 
00137 typedef struct tagProfileDataPoint
00138 {
00140     INT32 x;
00142     INT32 y;
00150     INT32 brightness;
00151 } ProfileDataPoint;
00152 
00156 typedef struct tagScanDataPoint
00157 {
00163     INT32 data;
00172     INT32 status;
00181     INT32 brightness;
00182 } ScanDataPoint;
00183 
00187 typedef struct tagProfile
00188 {
00195     INT32 sequenceNumber;
00197     INT32 location;
00199     INT32 sendLocation;
00201     INT32 laserOnTime;
00206     INT32 timeInHead;
00212     INT32 inputs;
00222     INT32 flags;
00224     INT32 reserved1;
00226     INT32 reserved2;
00228     INT32 numberPoints;
00234     ProfileDataPoint data[MAX_VERTICAL];
00235 } jsProfile;
00236 
00240 typedef struct tagImage
00241 {
00243     INT32 exposureTime;
00245     INT32 reserved1;
00247     INT32 reserved2;
00249     INT32 numberHorizontal;
00251     INT32 numberVertical;
00257     UINT8 image[MAX_HORIZONTAL * MAX_VERTICAL];
00258 } jsImage;
00259 
00263 typedef struct tagScan
00264 {
00266     INT32 location;
00268     INT32 sendLocation;
00270     INT32 laserOnTime;
00276     INT32 timeInHead;
00282     INT32 inputs;
00289     INT32 flags;
00291     INT32 reserved1;
00293     INT32 reserved2;
00295     INT32 numberPoints;
00301     ScanDataPoint data[MAX_VERTICAL];
00302 } jsScan;
00303 
00307 typedef struct tagResponsePacket
00308 {
00310     UINT8  macAddress[6];
00318     UINT8  currentIpSetup;
00320     UINT32 ipAddress;
00322     UINT32 serialNumber;
00324     UINT8  cableId;
00326     UINT8  status;
00328     UINT32 build;
00334     INT8   options[OPTIONS_SIZE];
00335 } jsResponsePacket;
00336 
00340 typedef struct tagOldCalibrationValue
00341 {
00343     double x;
00345     double y;
00347     double roll;
00349     char date[DATE_LENGTH];
00350 } jsOldCalibrationValue;
00351 
00352 #pragma pack() //Use compiler default packing after this.
00353 
00358 JCAM_DLL_API int STDCALL jsGetJcamDllMajorVersionNumber();
00363 JCAM_DLL_API int STDCALL jsGetJcamDllMinorVersionNumber();
00377 JCAM_DLL_API JCONNECTION STDCALL jsOpenConnection(char const * const host);
00391 JCAM_DLL_API JCONNECTION STDCALL jsOpenConnectionInt(int const host);
00406 JCAM_DLL_API JCONNECTION STDCALL jsOpenConnectionBase(char const * const host, UINT32 const cableID);
00427 JCAM_DLL_API int STDCALL jsCloseConnection(JCONNECTION const jc);
00448 JCAM_DLL_API int STDCALL jsSendProfileRequestN(JCONNECTION const jc, jsLaserIndex const laserIndex);
00473 JCAM_DLL_API int STDCALL jsReadProfileN(JCONNECTION const jc, jsProfile * const profile);
00489 JCAM_DLL_API int STDCALL jsGetProfileN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsProfile * const profile);
00508 JCAM_DLL_API int STDCALL jsGetProfileFromAllLasers(JCONNECTION const jc, jsProfile * const profiles, size_t const cProfiles);
00520 JCAM_DLL_API int STDCALL jsGetImage(JCONNECTION const jc, jsImage * const image);
00533 JCAM_DLL_API int STDCALL jsGetImageN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage * const image);
00545 JCAM_DLL_API int STDCALL jsGetScan(JCONNECTION const jc, jsScan * const scan);
00558 JCAM_DLL_API int STDCALL jsGetScanN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsScan * const scan);
00571 JCAM_DLL_API int STDCALL jsGetImageScan(JCONNECTION const jc, jsImage * const image, jsScan * const scan);
00585 JCAM_DLL_API int STDCALL jsGetImageScanN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage * const image, jsScan * const scan);
00602 JCAM_DLL_API int STDCALL jsEnterStartScanTriggeredMode(JCONNECTION const jc);
00617 JCAM_DLL_API int STDCALL jsEnterEncoderSyncMode(JCONNECTION const jc);
00632 JCAM_DLL_API int STDCALL jsEnterTimeSyncMode(JCONNECTION const jc);
00653 JCAM_DLL_API int STDCALL jsHaltSyncMode(JCONNECTION const jc);
00675 JCAM_DLL_API int STDCALL jsExitSyncMode(JCONNECTION const jc);
00701 JCAM_DLL_API int STDCALL jsSendMultipleProfileRequest(JCONNECTION const jc, UINT32 const nProfiles);
00732 JCAM_DLL_API int STDCALL jsReadMultipleProfiles(JCONNECTION const jc, jsProfile * const profiles, UINT32 nProfiles);
00753 JCAM_DLL_API int STDCALL jsReadMultipleProfilesTimeout(JCONNECTION const jc, jsProfile * const profiles, UINT32 cProfiles, long timeoutMilliseconds);
00773 JCAM_DLL_API int STDCALL jsGetMultipleProfiles(JCONNECTION const jc, jsProfile * const profiles, UINT32 const cProfiles);
00789 JCAM_DLL_API int STDCALL jsGetProfile(JCONNECTION const jc, jsProfile * const profile);
00811 JCAM_DLL_API size_t STDCALL jsGetNumberOfOutstandingRequests(JCONNECTION const jc);
00830 JCAM_DLL_API int STDCALL jsCleanUpOutstandingRequests(JCONNECTION const jc);
00844 JCAM_DLL_API int STDCALL jsSetEncoderValue(JCONNECTION const jc, UINT16 newEncoderValue);
00858 JCAM_DLL_API int STDCALL jsSetEncoderValue32(JCONNECTION const jc, UINT32 newEncoderValue);
00880 JCAM_DLL_API int STDCALL jsSendParameterFileToScanner(JCONNECTION const jc, char const * const filename);
00902 JCAM_DLL_API int STDCALL jsSendParametersToScanner(JCONNECTION const jc, char const * const parameters);
00918 JCAM_DLL_API int STDCALL jsGetParameterFileFromScanner(JCONNECTION const jc, char const * const filename);
00933 JCAM_DLL_API size_t STDCALL jsGetNumberOfErrorMessages(JCONNECTION const jc);
00950 JCAM_DLL_API char const * const STDCALL jsGetErrorMessage(JCONNECTION const jc, size_t i);
00968 JCAM_DLL_API int STDCALL jsReadOldPositionCalibrationsN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsOldCalibrationValue oldCalibrations[], UINT32 nCalibrations);
00988 JCAM_DLL_API int STDCALL jsReadPositionCalibrationN(JCONNECTION const jc, jsLaserIndex const laserIndex, double *xOffset, double *yOffset, double *roll);
01006 JCAM_DLL_API int STDCALL jsSendPositionCalibrationN(JCONNECTION const jc, jsLaserIndex const laserIndex, double const xOffset, double const yOffset, double const roll);
01020 JCAM_DLL_API int STDCALL jsGetScannerStatusFromScanner(JCONNECTION const jc);
01035 JCAM_DLL_API int STDCALL jsGetScannerStatusValue(JCONNECTION const jc, size_t i, int *value);
01059 JCAM_DLL_API int STDCALL jsGetStatusDescriptionFromScanner(JCONNECTION const jc, UINT32 i, char * const description, UINT32 description_length);
01076 JCAM_DLL_API int STDCALL jsGetImagePixel(jsImage const * const image, size_t const x, size_t const y);
01090 JCAM_DLL_API int STDCALL jsFindAllScanners(jsResponsePacket responses[], const size_t nResponses);
01106 JCAM_DLL_API int STDCALL jsFindScannerByCableId(int const cableId, jsResponsePacket responses[], const size_t nResponses);
01122 JCAM_DLL_API int STDCALL jsFindScannerBySerialNumber(int const serialNumber, jsResponsePacket responses[], const size_t nResponses);
01137 JCAM_DLL_API int STDCALL jsSetStaticIpInt(UINT32 const serialNumber, UINT32 const staticIpAddress, UINT32 const netmask);
01153 JCAM_DLL_API int STDCALL jsSetStaticIpChar(UINT32 const serialNumber, char const * const staticIpAddress, char const * const netmask);
01167 JCAM_DLL_API int STDCALL jsSetBaseIpInt(UINT32 const serialNumber, UINT32 const baseIpAddress, UINT32 const netmask);
01182 JCAM_DLL_API int STDCALL jsSetBaseIpChar(UINT32 const serialNumber, char const * const baseIpAddress, char const * const netmask);
01200 JCAM_DLL_API int STDCALL jsSetCableId(UINT32 const serialNumber, UINT32 const cableId);
01215 JCAM_DLL_API int STDCALL jsClearCableId(UINT32 const serialNumber);
01216 
01217 #ifdef __cplusplus
01218     } //namespace joescan {
01219 #endif //__cplusplus
01220 
01221 #if (defined JCAM_STATIC_LIB && defined WIN32)
01222 #   include <windef.h>
01223 
01244     BOOL jsInitialize();
01245 
01246 
01258     void jsCleanup();
01259 #endif // (defined JCAM_STATIC_LIB && defined WIN32)
01260 
01261 #ifdef __cplusplus
01262     } //extern "C" {
01263 #endif //__cplusplus
01264 
01265 #endif //JCAM_DLL