# posnet.h

Idź do dokumentacji tego pliku.

    00001 #ifndef _posnetH_
    00002 #define _posnetH_
    00003
    00004 /*
    00005
    00006         Nagłówek w wersji: 1.0
    00007
    00008 */
    00009
    00010
    00230 /* Patch dla Borland C++ Builder'a */
    00231 #ifdef __WIN32__
    00232 #define WIN32
    00233 #endif
    00234
    00235 #ifdef WIN32
    00236 #ifdef POSNET_EXPORTS
    00237 #define POSNET_API  __declspec(dllexport)
    00238 #else
    00239 #define POSNET_API  __declspec(dllimport)
    00240 #endif
    00241 #else
    00242 #define POSNET_API
    00243 #define __stdcall
    00244 #define __cdecl
    00245 #endif
    00246
    00247 extern "C"
    00248 {
    00249
    00258         typedef  void*                                  POSNET_HANDLE;
    00262         typedef  unsigned long                  POSNET_STATUS;
    00266         typedef  unsigned long                  POSNET_STATE;
    00270         #define POSNET_NAMELENGTH_MAX   16
    00271
    00279         POSNET_API unsigned long __stdcall POS_GetLibraryVersion();
    00280
    00281
    00291         #define POSNET_DEBUG_NONE                               0x00000000
    00292         #define POSNET_DEBUG_ALL                                0xFFFFFFFF
    00293         #define POSNET_SUBSYSTEM_DEVICE                 0x00001000
    00294         #define POSNET_SUBSYSTEM_DEVICERS232    0x00002000
    00295         #define POSNET_SUBSYSTEM_DEVICEUSB              0x00008000
    00296
    00297         #define POSNET_SUBSYSTEM_FRAME                  0x00010000
    00298
    00299         #define POSNET_DEBUG_EXTRA                              0x00800000
    00300
    00329         POSNET_API      void    __stdcall POS_SetDebugLevel(POSNET_HANDLE hGlobalDevice, unsigned long debugLevel);
    00330
    00337         POSNET_API  void        __stdcall POS_SetDebugFileName(POSNET_HANDLE hGlobalDevice, const char *fileName);
    00338
    00355         #define POSNET_INTERFACE_RS232  0x0001
    00356
    00367         #define POSNET_INTERFACE_USB    0x0002
    00368
    00389         #define POSNET_DEV_PARAM_COMSETTINGS    0x00020001
    00390
    00398         #define POSNET_DEV_PARAM_SENDTIMEOUT            0x00020004
    00399
    00400
    00409         #define POSNET_DEV_PARAM_USBSERIAL                      0x00020007
    00410
    00424         #define POSNET_DEV_PARAM_LISTUSBSERIALS         0x00020008
    00425
    00436         #define POSNET_DEV_PARAM_OUTQUEUELENGTH         0x00020009
    00437
    00444         #define POSNET_DEV_PARAM_STATUSPOLLINGINTERVAL          0x0002000A
    00445
    00446
    00455         #define POSNET_DEV_PARAM_FILEHANDLE             0x0002000E
    00456
    00457
    00478         POSNET_API POSNET_HANDLE        __stdcall POS_CreateDeviceHandle(unsigned long deviceType);
    00479
    00487         POSNET_API POSNET_HANDLE        __stdcall POS_OpenDevice(POSNET_HANDLE hGlobalDevice);
    00496         POSNET_API POSNET_STATUS        __stdcall POS_CloseDevice(POSNET_HANDLE hLocalDevice);
    00505         POSNET_API POSNET_STATUS        __stdcall POS_DestroyDeviceHandle(POSNET_HANDLE hGlobalDevice);
    00514         POSNET_API POSNET_STATUS        __stdcall POS_SetDeviceParam(POSNET_HANDLE hDevice, unsigned long paramCode,void *paramValue);
    00523         POSNET_API POSNET_STATUS        __stdcall POS_GetDeviceParam(POSNET_HANDLE hDevice, unsigned long paramCode,void *paramValue);
    00524
    00525
    00526
    00540         #define POSNET_STATUS_OK                                                0x00000000
    00541         #define POSNET_STATUS_OUTOFMEMORY                               0x00000001
    00542         #define POSNET_STATUS_FRAMETOOSHORT                             0x00000002
    00543         #define POSNET_STATUS_FRAMINGERROR                              0x00000003
    00544         #define POSNET_STATUS_COULDNOTOPEN                              0x00000005
    00545         #define POSNET_STATUS_CRCERROR                                  0x00000006
    00546         #define POSNET_STATUS_IPCERROR                                  0x00000007
    00547         #define POSNET_STATUS_COMMERROR                                 0x00000008
    00548         #define POSNET_STATUS_USBERROR                                  0x00000009
    00549         #define POSNET_STATUS_FTLIBIMPORTFAIL                   0x0000000A
    00550         #define POSNET_STATUS_COULDNOTSETUPPORT                 0x0000000B
    00551         #define POSNET_STATUS_COULDNOTOPEN_ACCESSDENIED 0x0000000C
    00552         #define POSNET_STATUS_COULDNOTOPEN_FILENOTFOUND 0x0000000D
    00553         #define POSNET_STATUS_SETUP_INVALIDBAUD                 0x0000000E
    00554         #define POSNET_STATUS_SETUP_INVALIDDATA                 0x0000000F
    00555         #define POSNET_STATUS_SETUP_INVALIDPARITY               0x00000010
    00556         #define POSNET_STATUS_SETUP_INVALIDSTOP                 0x00000011
    00557         #define POSNET_STATUS_SETUP_INVALIDHANDSHAKE    0x00000012
    00558         #define POSNET_STATUS_INVALIDSTATE                              0x00000013
    00559         #define POSNET_STATUS_DEVICE_BUSY                               0x00000014
    00560
    00561         #define POSNET_STATUS_BUSY                                      0x00000020
    00562
    00563         #define POSNET_STATUS_ALREADY_COMPLETED         0x00010000
    00564         #define POSNET_STATUS_EMPTY                                     0x00010001
    00565         #define POSNET_STATUS_INVALIDVALUE                      0x00010002
    00566         #define POSNET_STATUS_TIMEOUT                           0x00010003
    00567         #define POSNET_STATUS_PENDING                           0x00010004
    00568         #define POSNET_STATUS_INVALIDCOMMAND            0x00010005
    00569         #define POSNET_STATUS_INVALIDHANDLE                     0x00010006
    00570         #define POSNET_STATUS_BUFFERTOOSHORT            0x00010007
    00571         #define POSNET_STATUS_OUTOFRANGE                        0x00010008
    00572         #define POSNET_STATUS_INVALIDSPOOLMODE          0x00010009
    00573         #define POSNET_STATUS_CANCELLED                         0x0001000A
    00574
    00575         #define POSNET_STATUS_INVALID_PARAM1            0x00010101
    00576         #define POSNET_STATUS_INVALID_PARAM2            0x00010102
    00577         #define POSNET_STATUS_INVALID_PARAM3            0x00010103
    00578         #define POSNET_STATUS_INVALID_PARAM4            0x00010104
    00579         #define POSNET_STATUS_INVALID_PARAM5            0x00010105
    00580         #define POSNET_STATUS_INVALID_PARAM6            0x00010106
    00581
    00582         #define POSNET_STATUS_CASHREGBASE                       0x00430000
    00583         #define POSNET_STATUS_CASHREGCOMMBASE           0x00440000
    00584
    00603         POSNET_API POSNET_STATUS        __stdcall POS_GetError(POSNET_HANDLE hLocalDevice);
    00604
    00624         POSNET_API const char *                 __stdcall POS_GetErrorString(POSNET_STATUS code, char *lang);
    00642         POSNET_API      POSNET_STATUS   __stdcall POS_GetRequestStatus(POSNET_HANDLE hRequest);
    00643
    00654         POSNET_API      POSNET_STATUS   __stdcall POS_GetPrnDeviceStatus(POSNET_HANDLE hLocalDevice,const char statusMode,long *globalStatus,long *printerStatus);
    00655
    00662         // --------------------------------------------------------------------------------------------------------
    00672         #define POSNET_EVENT_DISABLE    0x0000
    00673 #ifdef _WIN32
    00674
    00682         #define POSNET_EVENT_EVENT              0x0001
    00683
    00691         #define POSNET_EVENT_MESSAGE    0x0002
    00692 #else
    00693
    00698         #define POSNET_EVENT_SEMAPHORE  0x0005
    00699
    00700 #endif
    00701
    00705         #define POSNET_EVENT_CALLBACK   0x0004
    00706
    00731         POSNET_API POSNET_STATUS        __stdcall POS_SetEventHandlingMode(POSNET_HANDLE hLocalDevice, unsigned long eventMode);
    00732 #ifdef _WIN32
    00733
    00744         POSNET_API POSNET_STATUS        __stdcall POS_SetMessageParams(POSNET_HANDLE hLocalDevice, UINT messageCode, HANDLE hWnd);
    00755         POSNET_API HANDLE                       __stdcall POS_GetEvent(POSNET_HANDLE hLocalDevice);
    00756 #else
    00757
    00765         POSNET_API void * __stdcall POS_GetSemaphore(POSNET_HANDLE hLocalDevice);
    00766
    00767 #endif
    00768
    00772         typedef void (POSNET_CALLBACK_T)(unsigned long status);
    00773
    00780         POSNET_API POSNET_STATUS        __stdcall POS_SetCallback(POSNET_HANDLE hLocalDevice, POSNET_CALLBACK_T *callback);
    00781
    00785         // --------------------------------------------------------------------------------------------------------
    00786
    00787
    00788         /* MAIN COMMAND API */
    00789
    00796         #define POSNET_REQMODE_SPOOL    0x00
    00797
    00798
    00799
    00800         #define POSNET_REQMODE_IMMEDIATE 0x01
    00801
    00802
    00803
    00804         #define POSNET_REQMODE_SPOOLSPECIAL     0x02
    00805
    00806
    00807
    00808
    00809
    00810
    00811
    00812         #define POSNET_REQMODE_AUTOCLEAR 0x03
    00813
    00814
    00815
    00816
    00826         #define POSNET_RSTATE_NEW                       0x00019000
    00827         #define POSNET_RSTATE_PENDING           0x00019001
    00828         #define POSNET_RSTATE_SENT                      0x00019002
    00829         #define POSNET_RSTATE_COMPLETED         0x00019004
    00830         #define POSNET_RSTATE_ERRCOMPLETED      0x00019005
    00831
    00836         // --------------------------------------------------------------------------------------------------------
    00837
    00838
    00859         POSNET_API      POSNET_HANDLE    __stdcall POS_CreateRequest(POSNET_HANDLE hLocalDevice, const char *command);
    00877         POSNET_API      POSNET_HANDLE  __stdcall POS_CreateRequestEx(POSNET_HANDLE hLocalDevice, const char* command,const char *parameters);
    00884         POSNET_API POSNET_HANDLE        __stdcall POS_RequestDevice(POSNET_HANDLE hRequest);
    00885
    00905         POSNET_API      POSNET_STATUS   __stdcall POS_PostRequest(POSNET_HANDLE hRequest,unsigned char mode);
    00920         POSNET_API      POSNET_STATUS   __stdcall POS_CancelRequest(POSNET_HANDLE hRequest);
    00930         POSNET_API      POSNET_STATUS   __stdcall POS_DestroyRequest(POSNET_HANDLE hRequest);
    00931
    00940         POSNET_API      unsigned long   __stdcall POS_GetRequestAge(POSNET_HANDLE hRequest);
    00948         POSNET_API      POSNET_STATUS   __stdcall POS_GetRequestCommandID(POSNET_HANDLE hRequest,char *retCommand);
    00955         POSNET_API      unsigned long   __stdcall POS_GetRequestCommandSerial(POSNET_HANDLE hRequest);
    00964         POSNET_API      POSNET_STATE    __stdcall POS_GetRequestState(POSNET_HANDLE hRequest);
    00978         POSNET_API      POSNET_STATUS   __stdcall POS_WaitForRequestCompleted(POSNET_HANDLE hRequest,unsigned long timeout);
    00979
    00984         // --------------------------------------------------------------------------------------------------------
    00985
    01003         POSNET_API      POSNET_STATUS   __stdcall POS_PushRequestParam(POSNET_HANDLE hRequest,const char *param_name,const char *param_value);
    01004
    01008         // --------------------------------------------------------------------------------------------------------
    01009
    01025         POSNET_API      long                    __stdcall POS_GetResponseValueCount(POSNET_HANDLE hRequest);
    01026
    01038         POSNET_API      POSNET_STATUS   __stdcall POS_PopResponseValue(POSNET_HANDLE hRequest,char *retName, char * retVal, unsigned long retValLen);
    01049         POSNET_API      POSNET_STATUS   __stdcall POS_GetResponseValue(POSNET_HANDLE hRequest,const char *paramName, char * retVal, unsigned long retValLen);
    01057         POSNET_API      POSNET_STATUS   __stdcall POS_ResponseRewind(POSNET_HANDLE hRequest);
    01058
    01108         POSNET_API      POSNET_HANDLE   __stdcall POS_GetNextResponse(POSNET_HANDLE hLocalDevice);
    01115         POSNET_API      unsigned long   __stdcall POS_GetResponseCount(POSNET_HANDLE hLocalDevice);
    01124         POSNET_API      unsigned long   __stdcall POS_GetRequestCount(POSNET_HANDLE hLocalDevice,unsigned char globalnie=0);
    01125
    01134         POSNET_API      POSNET_STATUS   __stdcall POS_RequestQueueStats(POSNET_HANDLE hLocalDevice, unsigned long *sent, unsigned long *completed);
    01135
    01136
    01148         POSNET_API      POSNET_STATUS   __stdcall POS_RequestQueueCancelPending(POSNET_HANDLE hLocalDevice,unsigned char globalnie=0);
    01161         POSNET_API  POSNET_STATUS       __stdcall POS_RequestQueueCancelAll(POSNET_HANDLE hLocalDevice,unsigned char globalnie=0);
    01162
    01176         POSNET_API      POSNET_STATUS  __stdcall POS_RepeatRequest(POSNET_HANDLE hRequest);
    01177
    01182         // --------------------------------------------------------------------------------------------------------
    01188         // PLACEHOLDER
    01189
    01193         // --------------------------------------------------------------------------------------------------------
    01194
    01195 }
    01196
    01197
    01198 #endif
    01199