00001 00005 /* @(#)00 1.10 src/include/pos/pos.h, apicode, ptux1.2.0, 20 4/28/03 14:39:00 */ 00006 00007 /********************************************************************/ 00008 /* <pos.h> header file */ 00009 /* */ 00010 /* Licensed Materials - Property of IBM */ 00011 /* */ 00012 /* IBM Point of Sale Subsystem */ 00013 /* 73G0950 (C) Copyright IBM Corporation 1992, 2000 */ 00014 /* All rights reserved */ 00015 /* */ 00016 /* US Government Users Restricted Rights - */ 00017 /* Use, duplication, or disclosure restricted */ 00018 /* by GSA ADP Schedule Contract with IBM Corp. */ 00019 /* */ 00020 /* Note: The symbol __cplusplus should not be defined by non-C++ */ 00021 /* compilers. */ 00022 /* */ 00023 /********************************************************************/ 00024 00025 #ifndef _H_POS_POS 00026 #define _H_POS_POS 1 00027 00028 00029 /********************************************************************/ 00030 /* Device Class names used on PosOpen */ 00031 /********************************************************************/ 00032 00033 #define PosAlarm "PosAlarm" 00034 #define PosDrawer "PosDrawer" 00035 #define PosDisplay "PosDisplay" 00036 #define PosKeyboard "PosKeyboard" 00037 #define PosMsr "PosMsr" 00038 #define PosNvram "PosNvram" 00039 #define PosPower "PosPower" 00040 #define PosPrinter "PosPrinter" 00041 #define PosRs232 "PosRs232" 00042 #define PosScale "PosScale" 00043 #define PosScanner "PosScanner" 00044 #define PosTouch "PosTouch" 00045 #define PosInternal "PosInternal" 00046 00047 00048 /********************************************************************/ 00049 /* Request values used with PosIOCtl */ 00050 /********************************************************************/ 00051 /* Note: The values for each component use the same ranges as the */ 00052 /* error numbers. */ 00053 /********************************************************************/ 00054 00055 #define POS_TILL_OPEN_TILL (5400 + 1) 00056 #define POS_ALARM_SILENCE_ALARM (5400 + 2) 00057 #define POS_ALARM_SOUND_ALARM (5400 + 3) 00058 00059 #define POS_DSP_CLEAR_SCREEN (4400 + 1) 00060 #define POS_DSP_DEFINE_CHARACTERS (4400 + 2) 00061 00062 #define POS_KBD_DISABLE_POS_FUNCTIONS (4700 + 1) 00063 #define POS_KBD_ENABLE_POS_FUNCTIONS (4700 + 2) 00064 #define POS_KBD_SILENCE_TONE (4700 + 4) 00065 #define POS_KBD_SOUND_TONE (4700 + 5) 00066 #define POS_KBD_SET_TYPEMATIC_OFF (4700 + 6) 00067 #define POS_KBD_SET_TYPEMATIC_ON (4700 + 7) 00068 #define POS_KBD_DISABLE_HOT_KEYS (4700 + 8) 00069 #define POS_KBD_ENABLE_HOT_KEYS (4700 + 9) 00070 #define POS_KBD_DISABLE_NUM_LOCK (4700 + 10) 00071 #define POS_KBD_ENABLE_NUM_LOCK (4700 + 11) 00072 #define POS_KBD_DISABLE_SCROLL_LOCK (4700 + 12) 00073 #define POS_KBD_ENABLE_SCROLL_LOCK (4700 + 13) 00074 #define POS_KBD_SET_NUM_LOCK_OFF (4700 + 15) 00075 #define POS_KBD_SET_NUM_LOCK_ON (4700 + 16) 00076 #define POS_KBD_SET_SCROLL_LOCK_OFF (4700 + 17) 00077 #define POS_KBD_SET_SCROLL_LOCK_ON (4700 + 18) 00078 00079 #define POS_POWER_OFF (6400 + 1) 00080 #define POS_POWER_ON (6400 + 2) 00081 #define POS_POWER_SET_ALARM (6400 + 3) 00082 00083 #define POS_PRN_DISABLE_DI_PRINTING (4900 + 1) 00084 #define POS_PRN_ENABLE_DI_PRINTING (4900 + 2) 00085 #define POS_PRN_RESUME_PRINTING (4900 + 3) 00086 #define POS_PRN_RETRY_PRINTING (4900 + 4) 00087 #define POS_PRN_DISCARD_DATA (4900 + 5) 00088 #define POS_PRN_DISABLE_FISCAL_PRINTING (4900 + 6) 00089 #define POS_PRN_ENABLE_FISCAL_PRINTING (4900 + 7) 00090 #define POS_PRN_RESET_PRINTER (4900 + 8) 00091 #define POS_PRN_DEFINE_CHARACTERS (4900 + 9) 00092 #define POS_PRN_HOLD_PRINTING (4900 + 10) 00093 #define POS_PRN_RELEASE_PRINTING (4900 + 11) 00094 #define POS_PRN_DISABLE_EXCLUSIVE_DI_PRINTING (4900 + 12) 00095 #define POS_PRN_ENABLE_EXCLUSIVE_DI_PRINTING (4900 + 13) 00096 #define POS_PRN_SOUND_TONE (4900 + 14) 00097 #define POS_PRN_SILENCE_TONE (4900 + 15) 00098 #define POS_PRN_ENABLE_CASH_DRAWER (4900 + 16) 00099 #define POS_PRN_DISABLE_CASH_DRAWER (4900 + 17) 00100 #define POS_PRN_ERASE_EPROM_MEMORY (4900 + 18) 00101 00102 #define POS_SCAN_DISCARD_DATA (5700 + 1) 00103 00104 #define POS_RS232_SEND_BREAK (5900 + 1) 00105 00106 #define POS_SCALE_ZERO_SCALE (6100 + 1) 00107 #define POS_SCALE_CLEAR_SCREEN (6100 + 2) 00108 00109 #define POS_TOUCH_SILENCE_TONE (6700 + 1) 00110 #define POS_TOUCH_SOUND_TONE (6700 + 2) 00111 00112 #define POS_SYS_ACQUIRE_DEVICE ( 300 + 1) 00113 #define POS_SYS_GET_VALUES ( 300 + 2) 00114 #define POS_SYS_LOCK_DEVICE ( 300 + 3) 00115 #define POS_SYS_RELEASE_DEVICE ( 300 + 4) 00116 #define POS_SYS_SET_VALUES ( 300 + 5) 00117 #define POS_SYS_UNLOCK_DEVICE ( 300 + 6) 00118 00119 00120 /********************************************************************/ 00121 /* Event values used on the input queue */ 00122 /********************************************************************/ 00123 /* The IBM Point of Sale Subsystem reserves a range of 256 numbers */ 00124 /* (from 0x4200 to 0x42FF), most of which will be reserved for */ 00125 /* future use. */ 00126 /********************************************************************/ 00127 00128 #define POSM_MSG_BASE 0x4200 00129 00130 #define POSM_KBD_STATUS_CHANGE (POSM_MSG_BASE + 1) 00131 #define POSM_KBD_WM_CHAR (POSM_MSG_BASE + 2) 00132 #define POSM_MSR_DATA_AVAIL (POSM_MSG_BASE + 3) 00133 #define POSM_PRN_CHASE_COMPLETE (POSM_MSG_BASE + 4) 00134 #define POSM_PRN_PRINTER_ERROR (POSM_MSG_BASE + 5) 00135 #define POSM_PRN_STATUS_CHANGE (POSM_MSG_BASE + 6) 00136 #define POSM_RS232_BREAK_DETECTED (POSM_MSG_BASE + 7) 00137 #define POSM_RS232_DATA_AVAIL (POSM_MSG_BASE + 8) 00138 #define POSM_RS232_XMIT_ABORT (POSM_MSG_BASE + 9) 00139 #define POSM_RS232_XMIT_COMPLETE (POSM_MSG_BASE + 10) 00140 #define POSM_SCAN_DATA_AVAIL (POSM_MSG_BASE + 11) 00141 #define POSM_SYS_DEVICE_OFFLINE (POSM_MSG_BASE + 12) 00142 #define POSM_SYS_DEVICE_ONLINE (POSM_MSG_BASE + 13) 00143 #define POSM_TILL_CLOSED (POSM_MSG_BASE + 14) 00144 #define POSM_TILL_OPENED (POSM_MSG_BASE + 15) 00145 #define POSM_PRN_DATA_AVAIL (POSM_MSG_BASE + 16) 00146 #define POSM_PRN_FISCAL_ERROR (POSM_MSG_BASE + 17) 00147 #define POSM_PRN_FISCAL_STATUS (POSM_MSG_BASE + 18) 00148 #define POSM_SYS_DEVICE_RELEASED (POSM_MSG_BASE + 19) 00149 #define POSM_PRN_RAS_STATUS (POSM_MSG_BASE + 20) 00150 #define POSM_PRN_RAS_ERROR (POSM_MSG_BASE + 21) 00151 #define POSM_TOUCH_DATA (POSM_MSG_BASE + 22) 00152 #define POSM_PRN_RAW_STATUS (POSM_MSG_BASE + 23) 00153 #define POSM_MSR_WRITE_SUCCESS (POSM_MSG_BASE + 24) 00154 #define POSM_MSR_WRITE_FAILED (POSM_MSG_BASE + 25) 00155 #define POSM_DSP_RAS_STATUS (POSM_MSG_BASE + 26) 00156 00157 00158 /********************************************************************/ 00159 /* User defined types used in the POS calls */ 00160 /********************************************************************/ 00161 /* */ 00162 /* size_t MUST be 32 bits long to successfully interface with the */ 00163 /* DLL calls. If ssize_t and off_t are already defined, they must */ 00164 /* be defined the same way as here. */ 00165 /* */ 00166 /* The checks for __size_t and _SIZE_T and used to ensure that the */ 00167 /* typedef for size_t isn't done multiple times, thus avoiding */ 00168 /* an error. ssize_t and off_t are not protected and are defined */ 00169 /* the same on both systems. */ 00170 /********************************************************************/ 00171 00172 #if defined(__OS2__) 00173 00174 #ifndef __size_t /* Used by C Set/2 compiler */ 00175 #define __size_t 00176 typedef unsigned int size_t; 00177 #endif 00178 00179 #elif defined(_BORLANDC_) 00180 00181 #ifndef _SIZE_T /* Used by Borland C/C++ compilers */ 00182 #define _SIZE_T 00183 typedef unsigned int size_t; 00184 typedef int ssize_t; 00185 typedef long off_t; 00186 #endif 00187 00188 #elif defined(_WIN32) 00189 #ifndef _SIZE_T_DEFINED /* Used by Microsoft Visual C++ 32-bit */ 00190 #define _SIZE_T_DEFINED 00191 typedef unsigned int size_t; 00192 typedef int ssize_t; 00193 typedef long off_t; 00194 #endif 00195 00196 #elif defined(_WINDOWS) 00197 #ifndef _SIZE_T_DEFINED /* Used by Microsoft Visual C++ 1.x */ 00198 #define _SIZE_T_DEFINED 00199 typedef unsigned int size_t; 00200 typedef int ssize_t; 00201 typedef long off_t; 00202 #endif 00203 00204 #elif defined(__UNIX__) || defined(__unix__) 00205 00206 #include <unistd.h> 00207 #ifndef _SIZE_T /* Used by IBM XL C++ compilers */ 00208 #define _SIZE_T 00209 typedef unsigned long size_t; 00210 typedef int ssize_t; 00211 typedef long off_t; 00212 #endif 00213 00214 #else 00215 #error Unrecognized platform 00216 #endif 00217 00218 #if defined(__OS2__) 00219 #include <os2.h> 00220 #ifndef FAR 00221 #define FAR 00222 #endif 00223 #if defined(__BORLANDC__) 00224 #define _OPTLINK __stdcall 00225 #define _SYSTEM __syscall 00226 #else 00227 #define _OPTLINK _Optlink 00228 #define _SYSTEM _System 00229 #endif 00230 #if defined(POSDLLAPI) 00231 #define POSAPI APIENTRY 00232 #endif 00233 #elif defined(_WIN32) || defined(__WIN32__) 00234 #ifndef _X86_ 00235 #define _X86_ 00236 #endif 00237 #include <windef.h> 00238 #ifndef FAR 00239 #define FAR far 00240 #endif 00241 #define _OPTLINK __stdcall 00242 #define _SYSTEM 00243 #if defined(POSDLLAPI) 00244 #define POSAPI WINAPI 00245 #endif 00246 #elif defined(_WINDOWS) || defined(_Windows) 00247 #include <windows.h> 00248 #ifndef FAR 00249 #define FAR _far 00250 #endif 00251 #ifndef PASCAL 00252 #define PASCAL _pascal 00253 #endif 00254 #define _OPTLINK FAR PASCAL 00255 #define _SYSTEM 00256 #if defined(POSDLLAPI) 00257 #define POSAPI FAR PASCAL 00258 #endif 00259 #else 00260 #ifndef FAR 00261 #define FAR 00262 #endif 00263 #define _OPTLINK 00264 #define _SYSTEM 00265 #endif 00266 #if !defined(POSAPI) 00267 #define POSAPI _OPTLINK 00268 #endif 00269 00270 00271 /********************************************************************/ 00272 /* Structure Definitions */ 00273 /********************************************************************/ 00274 00275 /*************************************/ 00276 /* PosArg and PosArgPtr declarations */ 00277 /*************************************/ 00278 00279 typedef struct 00280 { 00281 char FAR *name; 00282 long value; 00283 } PosArg, FAR *PosArgPtr; 00284 00285 00286 /*********************/ 00287 /* POSQMSG structure */ 00288 /*********************/ 00289 00290 typedef struct _POSQMSG 00291 { 00292 long pid; /* Owning Processing id */ 00293 unsigned long msg; /* event message id */ 00294 unsigned long mp1; /* message parameter 1 */ 00295 unsigned long mp2; /* message parameter 2 */ 00296 } POSQMSG; 00297 00298 #define EVENT_MESSAGE_SIZE sizeof(POSQMSG) 00299 00300 /*************************************/ 00301 /* PosVPD and PosVPDPtr declarations */ 00302 /* (VPD = Vital Product Data) */ 00303 /*************************************/ 00304 00305 typedef struct 00306 { 00307 char MachineType[7]; 00308 char SerialNumber[7]; 00309 char BIOSLevel[5]; 00310 char reserved[5]; 00311 } PosVPD, FAR *PosVPDPtr; 00312 00313 00314 /********************************************************************/ 00315 /* Helper macros */ 00316 /********************************************************************/ 00317 00318 #define PosSetArg(arg, n, d) \ 00319 ((arg).name = (n), (arg).value = (long)(d)) 00320 00321 #define PosNumber(arr) \ 00322 ((unsigned int) (sizeof(arr) / sizeof(arr[0]))) 00323 00324 #define PosSetValues(device, args, nargs) \ 00325 PosIOCtl(device, POS_SYS_SET_VALUES, args, nargs) 00326 00327 #define PosGetValues(device, args, nargs) \ 00328 PosIOCtl(device, POS_SYS_GET_VALUES, args, nargs) 00329 00330 00331 /********************************************************************/ 00332 /* Interface calls into the POS library (C/C++ only) */ 00333 /********************************************************************/ 00334 00335 /*************************************************************/ 00336 /* The following prevents C++ compilers from using type-safe */ 00337 /* linkage and thus 'mangling' the names of the functions */ 00338 /* below. */ 00339 /*************************************************************/ 00340 00341 #ifdef __cplusplus 00342 extern "C" { 00343 #endif 00344 00345 int POSAPI PosClose(int devdes); 00346 00347 int POSAPI PosErrno(void); 00348 00349 int POSAPI PosInitialize(const char FAR *applname, const char FAR *file, 00350 int FAR *argc, char FAR * FAR *argv, 00351 PosArgPtr args, int nargs); 00352 00353 int POSAPI PosIOCtl(int devdes, int request, PosArgPtr args, int nargs); 00354 00355 int POSAPI PosOpen(const char FAR *devname, const char FAR *devclass, 00356 PosArgPtr args, int nargs); 00357 00358 ssize_t POSAPI PosRead(int devdes, void FAR *buf, size_t nbyte); 00359 00360 int POSAPI PosTerm(void); 00361 00362 int POSAPI PosVersion(int FAR *version, int FAR *release, 00363 int FAR *modification); 00364 00365 ssize_t POSAPI PosWrite(int devdes, const void FAR *buf, size_t nbyte); 00366 00367 00368 #ifdef __cplusplus 00369 } /* END extern "C" */ 00370 #endif 00371 00372 00373 #endif /* _H_POS_POS */ 00374 00375