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
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,
00107 };
00108 
00114 typedef enum jsLaserIndexTag
00115 {
00117     LASER0 = 0,
00119     LASER1 = 1,
00121     LASER2 = 2,
00122 } jsLaserIndex;
00123 
00130 typedef void* JCONNECTION;
00131 
00132 #pragma pack(1) //Tells compiler to use one-byte boundaries for packing structs.
00133 
00135 typedef struct tagProfileDataPoint
00136 {
00138     INT32 x;
00140     INT32 y;
00148     INT32 brightness;
00149 } ProfileDataPoint;
00150 
00154 typedef struct tagScanDataPoint
00155 {
00161     INT32 data;
00170     INT32 status;
00179     INT32 brightness;
00180 } ScanDataPoint;
00181 
00185 typedef struct tagProfile
00186 {
00193     INT32 sequenceNumber;
00195     INT32 location;
00197     INT32 sendLocation;
00199     INT32 laserOnTime;
00204     INT32 timeInHead;
00210     INT32 inputs;
00217     INT32 flags;
00219     INT32 reserved1;
00221     INT32 reserved2;
00223     INT32 numberPoints;
00229     ProfileDataPoint data[MAX_VERTICAL];
00230 } jsProfile;
00231 
00235 typedef struct tagImage
00236 {
00238     INT32 exposureTime;
00240     INT32 reserved1;
00242     INT32 reserved2;
00244     INT32 numberHorizontal;
00246     INT32 numberVertical;
00252     UINT8 image[MAX_HORIZONTAL * MAX_VERTICAL];
00253 } jsImage;
00254 
00258 typedef struct tagScan
00259 {
00261     INT32 location;
00263     INT32 sendLocation;
00265     INT32 laserOnTime;
00271     INT32 timeInHead;
00277     INT32 inputs;
00284     INT32 flags;
00286     INT32 reserved1;
00288     INT32 reserved2;
00290     INT32 numberPoints;
00296     ScanDataPoint data[MAX_VERTICAL];
00297 } jsScan;
00298 
00302 typedef struct tagResponsePacket
00303 {
00305     UINT8  macAddress[6];
00313     UINT8  currentIpSetup;
00315     UINT32 ipAddress;
00317     UINT32 serialNumber;
00319     UINT8  cableId;
00321     UINT8  status;
00323     UINT32 build;
00329     INT8   options[OPTIONS_SIZE];
00330 } jsResponsePacket;
00331 
00332 #pragma pack() //Use compiler default packing after this.
00333 
00338 JCAM_DLL_API int STDCALL jsGetJcamDllMajorVersionNumber();
00343 JCAM_DLL_API int STDCALL jsGetJcamDllMinorVersionNumber();
00357 JCAM_DLL_API JCONNECTION STDCALL jsOpenConnection(char const * const host);
00371 JCAM_DLL_API JCONNECTION STDCALL jsOpenConnectionInt(int const host);
00386 JCAM_DLL_API JCONNECTION STDCALL jsOpenConnectionBase(char const * const host, UINT32 const cableID);
00407 JCAM_DLL_API int STDCALL jsCloseConnection(JCONNECTION const jc);
00428 JCAM_DLL_API int STDCALL jsSendProfileRequestN(JCONNECTION const jc, jsLaserIndex const laserIndex);
00453 JCAM_DLL_API int STDCALL jsReadProfileN(JCONNECTION const jc, jsProfile * const profile);
00469 JCAM_DLL_API int STDCALL jsGetProfileN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsProfile * const profile);
00488 JCAM_DLL_API int STDCALL jsGetProfileFromAllLasers(JCONNECTION const jc, jsProfile * const profiles, size_t const cProfiles);
00500 JCAM_DLL_API int STDCALL jsGetImage(JCONNECTION const jc, jsImage * const image);
00513 JCAM_DLL_API int STDCALL jsGetImageN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage * const image);
00525 JCAM_DLL_API int STDCALL jsGetScan(JCONNECTION const jc, jsScan * const scan);
00538 JCAM_DLL_API int STDCALL jsGetScanN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsScan * const scan);
00551 JCAM_DLL_API int STDCALL jsGetImageScan(JCONNECTION const jc, jsImage * const image, jsScan * const scan);
00565 JCAM_DLL_API int STDCALL jsGetImageScanN(JCONNECTION const jc, jsLaserIndex const laserIndex, jsImage * const image, jsScan * const scan);
00582 JCAM_DLL_API int STDCALL jsEnterStartScanTriggeredMode(JCONNECTION const jc);
00597 JCAM_DLL_API int STDCALL jsEnterEncoderSyncMode(JCONNECTION const jc);
00612 JCAM_DLL_API int STDCALL jsEnterTimeSyncMode(JCONNECTION const jc);
00633 JCAM_DLL_API int STDCALL jsHaltSyncMode(JCONNECTION const jc);
00655 JCAM_DLL_API int STDCALL jsExitSyncMode(JCONNECTION const jc);
00681 JCAM_DLL_API int STDCALL jsSendMultipleProfileRequest(JCONNECTION const jc, UINT32 const nProfiles);
00712 JCAM_DLL_API int STDCALL jsReadMultipleProfiles(JCONNECTION const jc, jsProfile * const profiles, UINT32 nProfiles);
00733 JCAM_DLL_API int STDCALL jsReadMultipleProfilesTimeout(JCONNECTION const jc, jsProfile * const profiles, UINT32 cProfiles, long timeoutMilliseconds);
00753 JCAM_DLL_API int STDCALL jsGetMultipleProfiles(JCONNECTION const jc, jsProfile * const profiles, UINT32 const cProfiles);
00769 JCAM_DLL_API int STDCALL jsGetProfile(JCONNECTION const jc, jsProfile * const profile);
00791 JCAM_DLL_API size_t STDCALL jsGetNumberOfOutstandingRequests(JCONNECTION const jc);
00810 JCAM_DLL_API int STDCALL jsCleanUpOutstandingRequests(JCONNECTION const jc);
00824 JCAM_DLL_API int STDCALL jsSetEncoderValue(JCONNECTION const jc, UINT16 newEncoderValue);
00838 JCAM_DLL_API int STDCALL jsSetEncoderValue32(JCONNECTION const jc, UINT32 newEncoderValue);
00860 JCAM_DLL_API int STDCALL jsSendParameterFileToScanner(JCONNECTION const jc, char const * const filename);
00882 JCAM_DLL_API int STDCALL jsSendParametersToScanner(JCONNECTION const jc, char const * const parameters);
00898 JCAM_DLL_API int STDCALL jsGetParameterFileFromScanner(JCONNECTION const jc, char const * const filename);
00913 JCAM_DLL_API size_t STDCALL jsGetNumberOfErrorMessages(JCONNECTION const jc);
00930 JCAM_DLL_API char const * const STDCALL jsGetErrorMessage(JCONNECTION const jc, size_t i);
00947 JCAM_DLL_API int STDCALL jsReadPositionCalibrationN(JCONNECTION const jc, jsLaserIndex const laserIndex, double *xOffset, double *yOffset, double *roll);
00964 JCAM_DLL_API int STDCALL jsSendPositionCalibrationN(JCONNECTION const jc, jsLaserIndex const laserIndex, double const xOffset, double const yOffset, double const roll);
00978 JCAM_DLL_API int STDCALL jsGetScannerStatusFromScanner(JCONNECTION const jc);
00993 JCAM_DLL_API int STDCALL jsGetScannerStatusValue(JCONNECTION const jc, size_t i, int *value);
01017 JCAM_DLL_API int STDCALL jsGetStatusDescriptionFromScanner(JCONNECTION const jc, UINT32 i, char * const description, UINT32 description_length);
01034 JCAM_DLL_API int STDCALL jsGetImagePixel(jsImage const * const image, size_t const x, size_t const y);
01048 JCAM_DLL_API int STDCALL jsFindAllScanners(jsResponsePacket responses[], const size_t nResponses);
01064 JCAM_DLL_API int STDCALL jsFindScannerByCableId(int const cableId, jsResponsePacket responses[], const size_t nResponses);
01080 JCAM_DLL_API int STDCALL jsFindScannerBySerialNumber(int const serialNumber, jsResponsePacket responses[], const size_t nResponses);
01095 JCAM_DLL_API int STDCALL jsSetStaticIpInt(UINT32 const serialNumber, UINT32 const staticIpAddress, UINT32 const netmask);
01111 JCAM_DLL_API int STDCALL jsSetStaticIpChar(UINT32 const serialNumber, char const * const staticIpAddress, char const * const netmask);
01125 JCAM_DLL_API int STDCALL jsSetBaseIpInt(UINT32 const serialNumber, UINT32 const baseIpAddress, UINT32 const netmask);
01140 JCAM_DLL_API int STDCALL jsSetBaseIpChar(UINT32 const serialNumber, char const * const baseIpAddress, char const * const netmask);
01158 JCAM_DLL_API int STDCALL jsSetCableId(UINT32 const serialNumber, UINT32 const cableId);
01173 JCAM_DLL_API int STDCALL jsClearCableId(UINT32 const serialNumber);
01174 
01175 #ifdef __cplusplus
01176     } //namespace joescan {
01177 #endif //__cplusplus
01178 
01179 #if (defined JCAM_STATIC_LIB && defined WIN32)
01180 #   include <windef.h>
01181 
01202     BOOL jsInitialize();
01203 
01204 
01216     void jsCleanup();
01217 #endif // (defined JCAM_STATIC_LIB && defined WIN32)
01218 
01219 #ifdef __cplusplus
01220     } //extern "C" {
01221 #endif //__cplusplus
01222 
01223 #endif //JCAM_DLL
Click here to leave feedback
Your e-mail:

Your comments: