idcertificate.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #pragma once
  2. #ifndef IDCERTIFICATE_H
  3. #define IDCERTIFICATE_H
  4. //#pragma pack(push,1)
  5. #include "IDCerClass.h"
  6. #include "stdafx.h"
  7. #pragma pack(push,1)
  8. class IDCerClassImpl : public IDCerClass
  9. {
  10. public:
  11. IDCerClassImpl();
  12. ~IDCerClassImpl();
  13. //
  14. // Open device.
  15. // if usb device,set dwPort=0
  16. //
  17. virtual ErrorCodeEnum DevOpen(DWORD dwPort);
  18. //
  19. // Optional.
  20. // Open or close RF.
  21. // Arguments:
  22. // - bControl:true:open RF,false close RF
  23. // - 对于吸入式,为true接收身份证插入,为false时弹出身份证
  24. //
  25. virtual ErrorCodeEnum IDCerRFControl(bool bControl);
  26. //
  27. // Optional.
  28. // Certificate authentication.
  29. //
  30. virtual ErrorCodeEnum IDCerAuthenticate();
  31. // 即将废弃,请使用IDCerGetDataEx
  32. // Get Identity Card info.
  33. //
  34. virtual ErrorCodeEnum IDCerGetData(IDCerInfo &idCerInfo);
  35. // 获取证件信息,包括二代身份证、外国人永久居留证
  36. // Get Identity Card info.
  37. //
  38. virtual ErrorCodeEnum IDCerGetDataEx(IDCerInfoEx &idCerInfoEx);
  39. // 强制弹出身份证等证件
  40. // Force ID Card to eject。
  41. //
  42. virtual ErrorCodeEnum ForceIDEject();
  43. // 扫描证件并保留扫描文件到默认路径(dep目录下),证件正面使用“idfront.bmp”,证件反面使用“idback.bmp”
  44. // Scan ID Card and save the image to the position(dep/),using default name "idfront.bmp" and "idback.bmp"。
  45. //
  46. virtual ErrorCodeEnum ScanIDAndSaveImage();
  47. // 获取卡片是否插入或者取走
  48. // Query if ID Card have been inserted or fetched。
  49. // pos:
  50. // -- 0,未检测到任何证件;1,证件在读卡器内部;2,证件在进卡口
  51. //
  52. virtual ErrorCodeEnum QueryCardPos(int &pos);
  53. //
  54. // Get category infomation about device.
  55. //
  56. virtual ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
  57. // Reset device.
  58. // Do the cleaning work and initialize device again in order to return to
  59. // the normal condition.
  60. virtual ErrorCodeEnum Reset();
  61. //
  62. // Close device and do the cleaning work.
  63. // ex. close connection,close port,release memery and so on
  64. virtual ErrorCodeEnum DevClose();
  65. // Get last error the device issued.
  66. // Error message must include explanatory memorandum ,the original error
  67. // code and anything in favour of location problem.
  68. virtual ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
  69. private:
  70. bool m_bDevOpen;
  71. WORD m_wDevStatus;
  72. CHAR m_szErrMsg[MAX_DEV_ERROR_MSG_LEN];
  73. void SaveErrorInfo(CHAR* errMsg, int errCode=95555);
  74. bool SH_DeleteFileOrDirectory(char *strFileName);
  75. public:
  76. ErrorCodeEnum OnCheckCard();
  77. /*std::string m_LogFileNamePath;
  78. int m_nLogLevel;*/
  79. bool m_bAuthed; // true:认证成功;
  80. int m_iCardType; // 认证成功后,卡的类型;
  81. protected:
  82. BS_ID81IDCLibImpl m_cBS_ID81IDCImpl;
  83. unsigned SecDeviceNum;
  84. DEVSTATUS Devstatus;
  85. IDInfo m_IDInfo; //二代证身份证信息
  86. IDInfoForeign m_IDForeignInfo; //外国人证件信息
  87. IDInfoEx m_IDInfoEx;
  88. //---------2019-07-16---广电库,增加支持港澳台;---------
  89. IDInfoGAT m_IDInfoGAT; //港澳台
  90. /*
  91. std::string m_LogFileNamePath;
  92. int m_nLogLevel;
  93. ILog* m_pLog;
  94. ILevelLog* m_pLevelLog;
  95. IIniFile* m_pIniFile;
  96. */
  97. private:
  98. int string_format(std::string &str, const std::string fmt, ...);
  99. std::string& trim(std::string &s, std::string patten = " \n\r\t");
  100. };
  101. ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&pBaseObj);
  102. ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj);
  103. #endif // IDCERTIFICATE_H
  104. #pragma pack(pop)