MachineMgrBase.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef __MACHINEMGRBASE_H_
  2. #define __MACHINEMGRBASE_H_
  3. #include "Global.h"
  4. //=============== Error code ===============//
  5. // ************************************************ 错误码 ************************************************************ //
  6. const int RUN_SUCCESS = 1; // 表示指令成功;
  7. const int RUNERR_NOSUPPORT = 0; // 表示机器不支持对应指令的错误代码;
  8. const int RUNERR_UNKNOWERROR = -1; // 表示不明错误代码;
  9. const int RUNERR_NO_OPEN_COMM = -2; // 表示机器没有连接的错误代码;
  10. const int RUNERR_WRITE_FAIL = -3; // 表示机器上不能传送数据的错误代码;
  11. const int RUNERR_READ_FAIL = -4; // 表示从机器上不能读数据;
  12. const int RUNERR_INVALID_PARAM = -5; // 表示读的参数不正确;
  13. const int RUNERR_NON_CARRYOUT = -6; // 表示指令失败;
  14. const int RUNERR_DATAARRAY_END = -7; // 表示读完数据的通知;
  15. const int RUNERR_DATAARRAY_NONE = -8; // 表示数据不存在;
  16. const int RUNERR_MEMORY = -9; // 表示PC的内存不足;
  17. const int RUNERR_MIS_PASSWORD = -10; // 表示连接机器许可号码是不正确;
  18. const int RUNERR_MEMORYOVER = -11; // 表示指纹机内存不足;
  19. const int RUNERR_DATADOUBLE = -12; // 表示要登记的号码已经在机器数据里存在;
  20. const int RUNERR_MANAGEROVER = -14; // 表示机器里没有内存空间,未能登记管理者数据;
  21. const int RUNERR_FPDATAVERSION = -15; // 表示要用的指纹数据的版本不正确;
  22. // ************************************************ 错误码 ************************************************************ //
  23. //设备配置数据
  24. typedef struct DeviceCfg
  25. {
  26. int nMachineType;
  27. int nType; //通信类型
  28. long lMachineNumber; //指纹机ID
  29. long lLicense;
  30. long lComPort; //通讯串口号
  31. long lBaudRate; //波特率
  32. WCHAR szTelNumber[MAX_PATH];
  33. long lWaitDialTime;
  34. WCHAR szIpAddress[MAX_PATH];
  35. long lPort;
  36. long lTimeOut;
  37. long lProtocolType;
  38. long lNetPassword;
  39. }DEVICECFG,*LPDEVICECFG;
  40. class CMachineMgrBase
  41. {
  42. public:
  43. CMachineMgrBase();
  44. CMachineMgrBase(CWnd* pOcx);
  45. virtual ~CMachineMgrBase();
  46. virtual int InitMgrCfg(LPDEVICECFG lpCfg);
  47. //打开终端
  48. virtual int OpenDevice();
  49. virtual int CloseDevice();
  50. virtual void SetReadMark(BOOL propVal);
  51. virtual int IsOpenDevice(){return m_bOpenDevice;}
  52. //读取数据
  53. virtual int ReadGeneralLogData(std::vector<STGeneralLogData>* pVData);
  54. virtual int ReadAllGlLogData(std::vector<STGeneralLogData>* pVData);
  55. virtual int USBReadSuperLogData(LPWSTR LPSZFileName);
  56. //错误输出
  57. virtual BOOL SolveError(CONST LONG& nErroCode);
  58. //设置指纹机可用/不可用
  59. virtual BOOL SetMachineEnable(BOOL bEnable = TRUE);
  60. virtual BOOL DelLogData();
  61. virtual int BenumbAllManager();
  62. virtual LPDEVICECFG GetDeviceData(){return m_lpCfg;}
  63. protected:
  64. CWnd* m_pOcxCtrl; //ocx控件
  65. int m_bOpenDevice;
  66. LPDEVICECFG m_lpCfg;
  67. };
  68. #endif //#ifndef __MACHINEMGRBASE_H_
  69. extern CMachineMgrBase* g_pCMachineMgrBase;