Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

577 lines
23 KiB

  1. /*
  2. * OPOSCTRL.H
  3. *
  4. *
  5. *
  6. *
  7. *
  8. *
  9. */
  10. /*
  11. * Generic OPOS control class.
  12. * Implements common methods for all OPOS controls.
  13. * Control classes for specific OPOS controls inherit from this.
  14. */
  15. class COPOSControl : public IOPOSControl
  16. {
  17. protected:
  18. DWORD m_refCount;
  19. DWORD m_serverLockCount;
  20. /*
  21. * Control properties
  22. * (from Chapter 1 of OPOS APG spec)
  23. *
  24. * BUGBUG - are these to be kept in the registry ?
  25. *
  26. */
  27. BOOL AutoDisable;
  28. LONG BinaryConversion;
  29. LONG CapPowerReporting;
  30. PCHAR CheckHealthText;
  31. BOOL Claimed;
  32. LONG DataCount;
  33. BOOL DataEventEnabled;
  34. BOOL DeviceEnabled;
  35. BOOL FreezeEvents;
  36. LONG OutputID;
  37. LONG PowerNotify;
  38. LONG PowerState;
  39. LONG ResultCode;
  40. LONG ResultCodeExtended;
  41. LONG State;
  42. PCHAR ControlObjectDescription;
  43. LONG ControlObjectVersion;
  44. PCHAR ServiceObjectDescription;
  45. LONG ServiceObjectVersion;
  46. PCHAR DeviceDescription;
  47. PCHAR DeviceName;
  48. public:
  49. COPOSControl();
  50. ~COPOSControl();
  51. /*
  52. * IUnknown methods
  53. */
  54. STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj);
  55. STDMETHODIMP_(ULONG) AddRef(void);
  56. STDMETHODIMP_(ULONG) Release(void);
  57. /*
  58. * IClassFactory methods
  59. */
  60. STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObj);
  61. STDMETHODIMP LockServer(int lock);
  62. /*
  63. * IOPOSControl methods
  64. */
  65. STDMETHODIMP_(LONG) Open(BSTR DeviceName);
  66. STDMETHODIMP_(LONG) Close();
  67. STDMETHODIMP_(LONG) CheckHealth(LONG Level);
  68. STDMETHODIMP_(LONG) Claim(LONG Timeout);
  69. STDMETHODIMP_(LONG) ClearInput();
  70. STDMETHODIMP_(LONG) ClearOutput();
  71. STDMETHODIMP_(LONG) DirectIO(LONG Command, LONG* pData, BSTR* pString);
  72. // STDMETHODIMP_(LONG) Release(); // BUGBUG overrides IUnknown ?
  73. STDMETHODIMP_(void) SOData(LONG Status);
  74. STDMETHODIMP_(void) SODirectIO(LONG EventNumber, LONG* pData, BSTR* pString);
  75. STDMETHODIMP_(void) DirectIOEvent(LONG EventNumber, LONG* pData, BSTR* pString);
  76. STDMETHODIMP_(void) SOError(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  77. // BUGBUG - moved to sub-ifaces STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  78. STDMETHODIMP_(void) SOOutputComplete(LONG OutputID);
  79. STDMETHODIMP_(void) OutputCompleteEvent(LONG OutputID);
  80. STDMETHODIMP_(void) SOStatusUpdate(LONG Data);
  81. // BUGBUG - moved to sub-ifaces STDMETHODIMP_(void) StatusUpdateEvent(LONG Data);
  82. STDMETHODIMP_(LONG) SOProcessID();
  83. };
  84. /*
  85. * This macro will define a set of interfaces for each
  86. * specific control type to define function headers
  87. * for the generic control's methods.
  88. */
  89. #define DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES() \
  90. STDMETHODIMP QueryInterface(REFIID riid, LPVOID FAR* ppvObj); \
  91. STDMETHODIMP_(ULONG) AddRef(void); \
  92. STDMETHODIMP_(ULONG) Release(void); \
  93. \
  94. STDMETHODIMP CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObj); \
  95. STDMETHODIMP LockServer(int lock); \
  96. \
  97. STDMETHODIMP_(LONG) Open(BSTR DeviceName); \
  98. STDMETHODIMP_(LONG) Close(); \
  99. STDMETHODIMP_(LONG) CheckHealth(LONG Level); \
  100. STDMETHODIMP_(LONG) Claim(LONG Timeout); \
  101. STDMETHODIMP_(LONG) ClearInput(); \
  102. STDMETHODIMP_(LONG) ClearOutput(); \
  103. STDMETHODIMP_(LONG) DirectIO(LONG Command, LONG* pData, BSTR* pString); \
  104. STDMETHODIMP_(void) SOData(LONG Status); \
  105. STDMETHODIMP_(void) SODirectIO(LONG EventNumber, LONG* pData, BSTR* pString); \
  106. STDMETHODIMP_(void) DirectIOEvent(LONG EventNumber, LONG* pData, BSTR* pString); \
  107. STDMETHODIMP_(void) SOError(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse); \
  108. STDMETHODIMP_(void) SOOutputComplete(LONG OutputID); \
  109. STDMETHODIMP_(void) OutputCompleteEvent(LONG OutputID); \
  110. STDMETHODIMP_(void) SOStatusUpdate(LONG Data); \
  111. STDMETHODIMP_(LONG) SOProcessID();
  112. /*
  113. * This macro will define a set of wrapper functions for each
  114. * control type which relay generic control method calls
  115. * to the generic control object contained in each specific
  116. * control instance.
  117. *
  118. * For example, when a bumpBar instance gets called with
  119. * ClearInput(), we relay this to m_genericControl->ClearInput().
  120. *
  121. */
  122. #define DEFINE_GENERIC_CONTROL_FUNCTIONS(specificControl) \
  123. STDMETHODIMP specificControl::QueryInterface(REFIID riid, LPVOID FAR* ppvObj){ return m_genericControl->QueryInterface(riid, ppvObj); } \
  124. STDMETHODIMP_(ULONG) specificControl::AddRef(void){ return m_genericControl->AddRef(); } \
  125. STDMETHODIMP_(ULONG) specificControl::Release(void){ return m_genericControl->Release(); } \
  126. \
  127. STDMETHODIMP specificControl::CreateInstance(LPUNKNOWN pUnkOuter, REFIID riid, LPVOID FAR* ppvObj){ return m_genericControl->CreateInstance(pUnkOuter, riid, ppvObj); } \
  128. STDMETHODIMP specificControl::LockServer(int lock){ return m_genericControl->LockServer(lock); } \
  129. \
  130. STDMETHODIMP_(LONG) specificControl::Open(BSTR DeviceName){ return m_genericControl->Open(DeviceName); } \
  131. STDMETHODIMP_(LONG) specificControl::Close(){ return m_genericControl->Close(); } \
  132. STDMETHODIMP_(LONG) specificControl::CheckHealth(LONG Level){ return m_genericControl->CheckHealth(Level); } \
  133. STDMETHODIMP_(LONG) specificControl::Claim(LONG Timeout){ return m_genericControl->Claim(Timeout); } \
  134. STDMETHODIMP_(LONG) specificControl::ClearInput(){ return m_genericControl->ClearInput(); } \
  135. STDMETHODIMP_(LONG) specificControl::ClearOutput(){ return m_genericControl->ClearOutput(); } \
  136. STDMETHODIMP_(LONG) specificControl::DirectIO(LONG Command, LONG* pData, BSTR* pString){ return m_genericControl->DirectIO(Command, pData, pString); } \
  137. STDMETHODIMP_(void) specificControl::SOData(LONG Status){ m_genericControl->SOData(Status); } \
  138. STDMETHODIMP_(void) specificControl::SODirectIO(LONG EventNumber, LONG* pData, BSTR* pString){ m_genericControl->SODirectIO(EventNumber, pData, pString); } \
  139. STDMETHODIMP_(void) specificControl::DirectIOEvent(LONG EventNumber, LONG* pData, BSTR* pString){ m_genericControl->DirectIOEvent(EventNumber, pData, pString); } \
  140. STDMETHODIMP_(void) specificControl::SOError(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse){ m_genericControl->SOError(ResultCode, ResultCodeExtended, ErrorLocus, pErrorResponse); } \
  141. STDMETHODIMP_(void) specificControl::SOOutputComplete(LONG OutputID){ m_genericControl->SOOutputComplete(OutputID); } \
  142. STDMETHODIMP_(void) specificControl::OutputCompleteEvent(LONG OutputID){ m_genericControl->OutputCompleteEvent(OutputID); } \
  143. STDMETHODIMP_(void) specificControl::SOStatusUpdate(LONG Data){ m_genericControl->SOStatusUpdate(Data); } \
  144. STDMETHODIMP_(LONG) specificControl::SOProcessID(){ return m_genericControl->SOProcessID(); }
  145. /*
  146. * This macro will define default constructor and deconstructor
  147. * for each specific control class which just allocates
  148. * and frees the m_genericControl member.
  149. */
  150. #define DEFINE_DEFAULT_CONTROL_CONSTRUCTOR(specificControl) \
  151. specificControl::specificControl(){ \
  152. m_genericControl = new COPOSControl; \
  153. if (m_genericControl) m_genericControl->AddRef(); \
  154. } \
  155. specificControl::~specificControl(){ \
  156. m_genericControl->Release(); \
  157. m_genericControl = NULL; \
  158. }
  159. /*
  160. * Implementing class for specific control classes.
  161. * Each inherits from it's specific interface.
  162. */
  163. class COPOSBumpBar : public IOPOSBumpBar
  164. {
  165. protected:
  166. COPOSControl *m_genericControl;
  167. public:
  168. // methods
  169. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  170. STDMETHODIMP_(LONG) BumpBarSound(LONG Units, LONG Frequency, LONG Duration, LONG NumberOfCycles, LONG InterSoundWait);
  171. STDMETHODIMP_(LONG) SetKeyTranslation(LONG Units, LONG ScanCode, LONG LogicalKey);
  172. };
  173. class COPOSCashChanger : public IOPOSCashChanger
  174. {
  175. protected:
  176. COPOSControl *m_genericControl;
  177. public:
  178. // methods
  179. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  180. STDMETHODIMP_(LONG) DispenseCash(BSTR CashCounts);
  181. STDMETHODIMP_(LONG) DispenseChange(LONG Amount);
  182. STDMETHODIMP_(LONG) ReadCashCounts(BSTR* pCashCounts, BOOL* pDiscrepancy);
  183. // events
  184. STDMETHODIMP_(void) StatusUpdateEvent(LONG Status);
  185. };
  186. class COPOSCashDrawer : public IOPOSCashDrawer
  187. {
  188. protected:
  189. COPOSControl *m_genericControl;
  190. public:
  191. // methods
  192. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  193. STDMETHODIMP_(LONG) OpenDrawer();
  194. STDMETHODIMP_(LONG) WaitForDrawerClose(LONG BeepTimeout, LONG BeepFrequency, LONG BeepDuration, LONG BeepDelay);
  195. // events
  196. STDMETHODIMP_(void) StatusUpdateEvent(LONG Status);
  197. };
  198. class COPOSCoinDispenser : public IOPOSCoinDispenser
  199. {
  200. protected:
  201. COPOSControl *m_genericControl;
  202. public:
  203. // methods
  204. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  205. STDMETHODIMP_(LONG) DispenseChange(LONG Amount);
  206. // events
  207. STDMETHODIMP_(void) StatusUpdateEvent(LONG Status);
  208. };
  209. class COPOSFiscalPrinter : public IOPOSFiscalPrinter
  210. {
  211. protected:
  212. COPOSControl *m_genericControl;
  213. public:
  214. // methods
  215. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  216. STDMETHODIMP_(LONG) BeginFiscalDocument(LONG DocumentAmount);
  217. STDMETHODIMP_(LONG) BeginFiscalReceipt(BOOL PrintHeader);
  218. STDMETHODIMP_(LONG) BeginFixedOutput(LONG Station, LONG DocumentType);
  219. STDMETHODIMP_(LONG) BeginInsertion(LONG Timeout);
  220. STDMETHODIMP_(LONG) BeginItemList(LONG VatID);
  221. STDMETHODIMP_(LONG) BeginNonFiscal();
  222. STDMETHODIMP_(LONG) BeginRemoval(LONG Timeout);
  223. STDMETHODIMP_(LONG) BeginTraining();
  224. STDMETHODIMP_(LONG) ClearError();
  225. STDMETHODIMP_(LONG) EndFiscalDocument();
  226. STDMETHODIMP_(LONG) EndFiscalReceipt(BOOL PrintHeader);
  227. STDMETHODIMP_(LONG) EndFixedOutput();
  228. STDMETHODIMP_(LONG) EndInsertion();
  229. STDMETHODIMP_(LONG) EndItemList();
  230. STDMETHODIMP_(LONG) EndNonFiscal();
  231. STDMETHODIMP_(LONG) EndRemoval();
  232. STDMETHODIMP_(LONG) EndTraining();
  233. STDMETHODIMP_(LONG) GetData(LONG DataItem, LONG* OptArgs, BSTR* Data);
  234. STDMETHODIMP_(LONG) GetDate(BSTR* Date);
  235. STDMETHODIMP_(LONG) GetTotalizer(LONG VatID, LONG OptArgs, BSTR* Data);
  236. STDMETHODIMP_(LONG) GetVatEntry(LONG VatID, LONG OptArgs, LONG* VatRate);
  237. STDMETHODIMP_(LONG) PrintDuplicateReceipt();
  238. STDMETHODIMP_(LONG) PrintFiscalDocumentLine(BSTR DocumentLine);
  239. STDMETHODIMP_(LONG) PrintFixedOutput(LONG DocumentType, LONG LineNumber, BSTR Data);
  240. STDMETHODIMP_(LONG) PrintNormal(LONG Station, BSTR Data);
  241. STDMETHODIMP_(LONG) PrintPeriodicTotalsReport(BSTR Date1, BSTR Date2);
  242. STDMETHODIMP_(LONG) PrintPowerLossReport();
  243. STDMETHODIMP_(LONG) PrintRecItem(BSTR Description, CURRENCY Price, LONG Quantity, LONG VatInfo, CURRENCY OptUnitPrice, BSTR UnitName);
  244. STDMETHODIMP_(LONG) PrintRecItemAdjustment(LONG AdjustmentType, BSTR Description, CURRENCY Amount, LONG VatInfo);
  245. STDMETHODIMP_(LONG) PrintRecMessage(BSTR Message);
  246. STDMETHODIMP_(LONG) PrintRecNotPaid(BSTR Description, CURRENCY Amount);
  247. STDMETHODIMP_(LONG) PrintRecRefund(BSTR Description, CURRENCY Amount, LONG VatInfo);
  248. STDMETHODIMP_(LONG) PrintRecSubtotal(CURRENCY Amount);
  249. STDMETHODIMP_(LONG) PrintRecSubtotalAdjustment(LONG AdjustmentType, BSTR Description, CURRENCY Amount);
  250. STDMETHODIMP_(LONG) PrintRecTotal(CURRENCY Total, CURRENCY Payment, BSTR Description);
  251. STDMETHODIMP_(LONG) PrintRecVoid(BSTR Description);
  252. STDMETHODIMP_(LONG) PrintRecVoidItem(BSTR Description, CURRENCY Amount, LONG Quantity, LONG AdjustmentType, CURRENCY Adjustment, LONG VatInfo);
  253. STDMETHODIMP_(LONG) PrintReport(LONG ReportType, BSTR StartNum, BSTR EndNum);
  254. STDMETHODIMP_(LONG) PrintXReport();
  255. STDMETHODIMP_(LONG) PrintZReport();
  256. STDMETHODIMP_(LONG) ResetPrinter();
  257. STDMETHODIMP_(LONG) SetDate(BSTR Date);
  258. STDMETHODIMP_(LONG) SetHeaderLine(LONG LineNumber, BSTR Text, BOOL DoubleWidth);
  259. STDMETHODIMP_(LONG) SetPOSID(BSTR POSID, BSTR CashierID);
  260. STDMETHODIMP_(LONG) SetStoreFiscalID(BSTR ID);
  261. STDMETHODIMP_(LONG) SetTrailerLine(LONG LineNumber, BSTR Text, BOOL DoubleWidth);
  262. STDMETHODIMP_(LONG) SetVatTable();
  263. STDMETHODIMP_(LONG) SetVatValue(LONG VatID, BSTR VatValue);
  264. STDMETHODIMP_(LONG) VerifyItem(BSTR ItemName, LONG VatID);
  265. // events
  266. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  267. STDMETHODIMP_(void) StatusUpdateEvent(LONG Data);
  268. };
  269. class COPOSHardTotals : public IOPOSHardTotals
  270. {
  271. protected:
  272. COPOSControl *m_genericControl;
  273. public:
  274. // methods
  275. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  276. STDMETHODIMP_(LONG) BeginTrans();
  277. STDMETHODIMP_(LONG) ClaimFile(LONG HTotalsFile, LONG Timeout);
  278. STDMETHODIMP_(LONG) CommitTrans();
  279. STDMETHODIMP_(LONG) Create(BSTR FileName, LONG* pHTotalsFile, LONG Size, BOOL ErrorDetection);
  280. STDMETHODIMP_(LONG) Delete(BSTR FileName);
  281. STDMETHODIMP_(LONG) Find(BSTR FileName, LONG* pHTotalsFile, LONG* pSize);
  282. STDMETHODIMP_(LONG) FindByIndex(LONG Index, BSTR* pFileName);
  283. STDMETHODIMP_(LONG) Read(LONG HTotalsFile, BSTR* pData, LONG Offset, LONG Count);
  284. STDMETHODIMP_(LONG) RecalculateValidationData(LONG HTotalsFile);
  285. STDMETHODIMP_(LONG) ReleaseFile(LONG HTotalsFile);
  286. STDMETHODIMP_(LONG) Rename(LONG HTotalsFile, BSTR FileName);
  287. STDMETHODIMP_(LONG) Rollback();
  288. STDMETHODIMP_(LONG) SetAll(LONG HTotalsFile, LONG Value);
  289. STDMETHODIMP_(LONG) ValidateData(LONG HTotalsFile);
  290. STDMETHODIMP_(LONG) Write(LONG HTotalsFile, BSTR Data, LONG Offset, LONG Count);
  291. };
  292. class COPOSKeyLock : public IOPOSKeyLock
  293. {
  294. protected:
  295. COPOSControl *m_genericControl;
  296. public:
  297. // methods
  298. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  299. STDMETHODIMP_(LONG) WaitForKeylockChange(LONG KeyPosition, LONG Timeout);
  300. // events
  301. STDMETHODIMP_(void) StatusUpdateEvent(LONG Status);
  302. };
  303. class COPOSLineDisplay : public IOPOSLineDisplay
  304. {
  305. protected:
  306. COPOSControl *m_genericControl;
  307. public:
  308. // methods
  309. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  310. STDMETHODIMP_(LONG) ClearDescriptors();
  311. STDMETHODIMP_(LONG) ClearText();
  312. // BUGBUG conflict ??? STDMETHODIMP_(LONG) CreateWindow(LONG ViewportRow, LONG ViewportColumn, LONG ViewportHeight, LONG ViewportWidth, LONG WindowHeight, LONG WindowWidth);
  313. STDMETHODIMP_(LONG) DestroyWindow();
  314. STDMETHODIMP_(LONG) DisplayText(BSTR Data, LONG Attribute);
  315. STDMETHODIMP_(LONG) DisplayTextAt(LONG Row, LONG Column, BSTR Data, LONG Attribute);
  316. STDMETHODIMP_(LONG) RefreshWindow(LONG Window);
  317. STDMETHODIMP_(LONG) ScrollText(LONG Direction, LONG Units);
  318. STDMETHODIMP_(LONG) SetDescriptor(LONG Descriptor, LONG Attribute);
  319. };
  320. class COPOSMICR : public IOPOSMICR
  321. {
  322. protected:
  323. COPOSControl *m_genericControl;
  324. public:
  325. // methods
  326. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  327. STDMETHODIMP_(LONG) BeginInsertion(LONG Timeout);
  328. STDMETHODIMP_(LONG) BeginRemoval(LONG Timeout);
  329. STDMETHODIMP_(LONG) EndInsertion();
  330. STDMETHODIMP_(LONG) EndRemoval();
  331. // events
  332. STDMETHODIMP_(void) DataEvent(LONG Status);
  333. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  334. };
  335. class COPOSMSR : public IOPOSMSR
  336. {
  337. protected:
  338. COPOSControl *m_genericControl;
  339. public:
  340. // methods
  341. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  342. // events
  343. STDMETHODIMP_(void) DataEvent(LONG Status);
  344. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  345. };
  346. class COPOSPinPad : public IOPOSPinPad
  347. {
  348. protected:
  349. COPOSControl *m_genericControl;
  350. public:
  351. // methods
  352. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  353. STDMETHODIMP_(LONG) BeginEFTTransaction(BSTR PINPadSystem, LONG TransactionHost);
  354. STDMETHODIMP_(LONG) ComputeMAC(BSTR InMsg, BSTR* pOutMsg);
  355. STDMETHODIMP_(LONG) EnablePINEntry();
  356. STDMETHODIMP_(LONG) EndEFTTransaction(LONG CompletionCode);
  357. STDMETHODIMP_(LONG) UpdateKey(LONG KeyNum, BSTR Key);
  358. STDMETHODIMP_(BOOL) VerifyMAC(BSTR Message);
  359. // events
  360. STDMETHODIMP_(void) DataEvent(LONG Status);
  361. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  362. };
  363. class COPOSKeyboard : public IOPOSKeyboard
  364. {
  365. protected:
  366. COPOSControl *m_genericControl;
  367. public:
  368. // methods
  369. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  370. // events
  371. STDMETHODIMP_(void) DataEvent(LONG Status);
  372. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  373. };
  374. class COPOSPrinter : public IOPOSPrinter
  375. {
  376. protected:
  377. COPOSControl *m_genericControl;
  378. public:
  379. // methods
  380. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  381. STDMETHODIMP_(LONG) BeginInsertion(LONG Timeout);
  382. STDMETHODIMP_(LONG) BeginRemoval(LONG Timeout);
  383. STDMETHODIMP_(LONG) CutPaper(LONG Percentage);
  384. STDMETHODIMP_(LONG) EndInsertion();
  385. STDMETHODIMP_(LONG) EndRemoval();
  386. STDMETHODIMP_(LONG) PrintBarCode(LONG Station, BSTR Data, LONG Symbology, LONG Height, LONG Width, LONG Alignment, LONG TextPosition);
  387. STDMETHODIMP_(LONG) PrintBitmap(LONG Station, BSTR FileName, LONG Width, LONG Alignment);
  388. STDMETHODIMP_(LONG) PrintImmediate(LONG Station, BSTR Data);
  389. STDMETHODIMP_(LONG) PrintNormal(LONG Station, BSTR Data);
  390. STDMETHODIMP_(LONG) PrintTwoNormal(LONG Stations, BSTR Data1, BSTR Data2);
  391. STDMETHODIMP_(LONG) RotatePrint(LONG Station, LONG Rotation);
  392. STDMETHODIMP_(LONG) SetBitmap(LONG BitmapNumber, LONG Station, BSTR FileName, LONG Width, LONG Alignment);
  393. STDMETHODIMP_(LONG) SetLogo(LONG Location, BSTR Data);
  394. STDMETHODIMP_(LONG) TransactionPrint(LONG Station, LONG Control);
  395. STDMETHODIMP_(LONG) ValidateData(LONG Station, BSTR Data);
  396. // events
  397. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  398. STDMETHODIMP_(void) StatusUpdateEvent(LONG Status);
  399. };
  400. class COPOSRemoteOrderDisplay : public IOPOSRemoteOrderDisplay
  401. {
  402. protected:
  403. COPOSControl *m_genericControl;
  404. public:
  405. // methods
  406. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  407. STDMETHODIMP_(LONG) ClearVideo(LONG Units, LONG Attribute);
  408. STDMETHODIMP_(LONG) ClearVideoRegion(LONG Units, LONG Row, LONG Column, LONG Height, LONG Width, LONG Attribute);
  409. STDMETHODIMP_(LONG) ControlClock(LONG Units, LONG Function, LONG ClockId, LONG Hour, LONG Min, LONG Sec, LONG Row, LONG Column, LONG Attribute, LONG Mode);
  410. STDMETHODIMP_(LONG) ControlCursor(LONG Units, LONG Function);
  411. STDMETHODIMP_(LONG) CopyVideoRegion(LONG Units, LONG Row, LONG Column, LONG Height, LONG Width, LONG TargetRow, LONG TargetColumn);
  412. STDMETHODIMP_(LONG) DisplayData(LONG Units, LONG Row, LONG Column, LONG Attribute, BSTR Data);
  413. STDMETHODIMP_(LONG) DrawBox(LONG Units, LONG Row, LONG Column, LONG Height, LONG Width, LONG Attribute, LONG BorderType);
  414. STDMETHODIMP_(LONG) FreeVideoRegion(LONG Units, LONG BufferId);
  415. STDMETHODIMP_(LONG) ResetVideo(LONG Units);
  416. STDMETHODIMP_(LONG) RestoreVideoRegion(LONG Units, LONG TargetRow, LONG TargetColumn, LONG BufferId);
  417. STDMETHODIMP_(LONG) SaveVideoRegion(LONG Units, LONG Row, LONG Column, LONG Height, LONG Width, LONG BufferId);
  418. STDMETHODIMP_(LONG) SelectChararacterSet(LONG Units, LONG CharacterSet);
  419. STDMETHODIMP_(LONG) SetCursor(LONG Units, LONG Row, LONG Column);
  420. STDMETHODIMP_(LONG) TransactionDisplay(LONG Units, LONG Function);
  421. STDMETHODIMP_(LONG) UpdateVideoRegionAttribute(LONG Units, LONG Function, LONG Row, LONG Column, LONG Height, LONG Width, LONG Attribute);
  422. STDMETHODIMP_(LONG) VideoSound(LONG Units, LONG Frequency, LONG Duration, LONG NumberOfCycles, LONG InterSoundWait);
  423. // events
  424. STDMETHODIMP_(void) DataEvent(LONG Status);
  425. // BUGBUG - override ? STDMETHODIMP_(void) OutputCompleteEvent(LONG OutputID);
  426. STDMETHODIMP_(void) StatusUpdateEvent(LONG Status);
  427. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  428. };
  429. class COPOSScale : public IOPOSScale
  430. {
  431. protected:
  432. COPOSControl *m_genericControl;
  433. public:
  434. // methods
  435. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  436. STDMETHODIMP_(LONG) DisplayText(BSTR Data);
  437. STDMETHODIMP_(LONG) ReadWeight(LONG* pWeightData, LONG Timeout);
  438. STDMETHODIMP_(LONG) ZeroScale();
  439. // events
  440. STDMETHODIMP_(void) DataEvent(LONG Status);
  441. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  442. };
  443. class COPOSScanner : public IOPOSScanner
  444. {
  445. protected:
  446. COPOSControl *m_genericControl;
  447. public:
  448. // methods
  449. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  450. // events
  451. STDMETHODIMP_(void) DataEvent(LONG Status);
  452. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  453. };
  454. class COPOSSignatureCapture : public IOPOSSignatureCapture
  455. {
  456. protected:
  457. COPOSControl *m_genericControl;
  458. public:
  459. // methods
  460. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  461. STDMETHODIMP_(LONG) BeginCapture(BSTR FormName);
  462. STDMETHODIMP_(LONG) EndCapture();
  463. // events
  464. STDMETHODIMP_(void) DataEvent(LONG Status);
  465. STDMETHODIMP_(void) ErrorEvent(LONG ResultCode, LONG ResultCodeExtended, LONG ErrorLocus, LONG* pErrorResponse);
  466. };
  467. class COPOSToneIndicator : public IOPOSToneIndicator
  468. {
  469. protected:
  470. COPOSControl *m_genericControl;
  471. public:
  472. // methods
  473. DEFINE_GENERIC_CONTROL_FUNCTION_PROTOTYPES()
  474. STDMETHODIMP_(LONG) Sound(LONG NumberOfCycles, LONG InterSoundWait);
  475. STDMETHODIMP_(LONG) SoundImmediate();
  476. };
  477. #define ASSERT(fact) if (!(fact)){ \
  478. Report("Assertion '" #fact "' failed in file " __FILE__ " line ", __LINE__); \
  479. }
  480. enum controlClass {
  481. CONTROL_BUMP_BAR,
  482. CONTROL_CASH_CHANGER,
  483. CONTROL_CASH_DRAWER,
  484. CONTROL_COIN_DISPENSER,
  485. CONTROL_FISCAL_PRINTER,
  486. CONTROL_HARD_TOTALS,
  487. CONTROL_KEYLOCK,
  488. CONTROL_LINE_DISPLAY,
  489. CONTROL_MICR, // MAGNETIC INK CHARACTER RECOGNITION READER
  490. CONTROL_MSR, // MAGNETIC STRIPE READER
  491. CONTROL_PIN_PAD,
  492. CONTROL_POS_KEYBOARD,
  493. CONTROL_POS_PRINTER,
  494. CONTROL_REMOTE_ORDER_DISPLAY,
  495. CONTROL_SCALE,
  496. CONTROL_SCANNER, // (BAR CODE READER)
  497. CONTROL_SIGNATURE_CAPTURE,
  498. CONTROL_TONE_INDICATOR,
  499. CONTROL_LAST // marker, must be last
  500. };
  501. struct controlType {
  502. enum controlClass type;
  503. PCHAR deviceName; // BUGBUG ? BSTR deviceName;
  504. };
  505. /*
  506. * Function prototypes
  507. */
  508. void OpenServer();
  509. VOID Report(LPSTR szMsg, DWORD num);
  510. LPSTR DbgHresultStr(DWORD hres);
  511. VOID ReportHresultErr(LPSTR szMsg, DWORD hres);
  512. void Test(); // BUGBUG REMOVE