idcer_impl.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. #ifndef LIBFRAMEWORK_IDCER_IMPL_H
  2. #define LIBFRAMEWORK_IDCER_IMPL_H
  3. #include "IDCerClass.h"
  4. #include <string>
  5. class IDCerClassImpl : public IDCerClass
  6. {
  7. public:
  8. IDCerClassImpl();
  9. ~IDCerClassImpl();
  10. //DeviceBaseClass
  11. //
  12. // Get category infomation about device.
  13. //
  14. ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
  15. // Reset device.
  16. // Do the cleaning work and initialize device again in order to return to
  17. // the normal condition.
  18. ErrorCodeEnum Reset();
  19. //
  20. // Close device and do the cleaning work.
  21. // ex. close connection,close port,release memery and so on
  22. ErrorCodeEnum DevClose();
  23. // Get last error the device issued.
  24. // Error message must include explanatory memorandum ,the original error
  25. // code and anything in favour of location problem.
  26. ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
  27. //IDCerClass
  28. //
  29. // Open device.
  30. // if usb device,set dwPort=0
  31. //
  32. ErrorCodeEnum DevOpen(DWORD dwPort);
  33. //
  34. // Optional.
  35. // Open or close RF.
  36. // Arguments:
  37. // - bControl:true:open RF,false close RF
  38. // - 对于吸入式,为true接收身份证插入,为false时弹出身份证并关闭接收身份证插入
  39. //
  40. ErrorCodeEnum IDCerRFControl(bool bControl);
  41. //
  42. // Optional.
  43. // Certificate authentication.
  44. //
  45. ErrorCodeEnum IDCerAuthenticate();
  46. // 即将废弃,请使用IDCerGetDataEx
  47. // Get Identity Card info.
  48. //
  49. ErrorCodeEnum IDCerGetData(IDCerInfo &idCerInfo);
  50. // 获取证件信息,包括二代身份证、外国人永久居留证
  51. // Get Identity Card info.
  52. //
  53. ErrorCodeEnum IDCerGetDataEx(IDCerInfoEx &idCerInfoEx);
  54. //新增身份证信息获取接口,用于获取身份证中存储的原始文字UCS2编码信息
  55. ErrorCodeEnum IDCerGetDataEx2(IDCerInfoEx2 &idCerInfoEx);
  56. // 强制弹出身份证等证件
  57. // Force ID Card to eject。
  58. //
  59. ErrorCodeEnum ForceIDEject();
  60. // 扫描证件并保留扫描文件到默认路径(dep目录下),证件正面使用“idfront.bmp”,证件反面使用“idback.bmp”
  61. // Scan ID Card and save the image to the position(dep/),using default name "idfront.bmp" and "idback.bmp"。
  62. //
  63. ErrorCodeEnum ScanIDAndSaveImage();
  64. // 获取卡片是否插入或者取走
  65. // Query if ID Card have been inserted or fetched。
  66. // pos:
  67. // -- 0,未检测到任何证件;1,证件在读卡器内部;2,证件在进卡口
  68. //
  69. ErrorCodeEnum QueryCardPos(int &pos);
  70. private:
  71. DWORD m_DeviceID;
  72. DevErrorInfo m_DevErrorInfo;
  73. std::string m_sSoPath;
  74. std::string m_sHeadImageName;
  75. std::string m_sFrontPath;
  76. std::string m_sBackPath;
  77. private:
  78. void ZeroDevErrorInfo(void);
  79. void FormatDevErrorInfo(const char* funcname,int line);
  80. std::string ForDataFormat(std::string str, std::string frm);
  81. std::string GetForeignTimeLimit(std::string time_, std::string format_);
  82. std::string GeSoFilePath(void* Fun);
  83. int GbkToUtf8(char *str_str, size_t src_len, char *dst_str, size_t dst_len);
  84. };
  85. extern ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&baseObj);
  86. extern ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj);
  87. #endif //LIBFRAMEWORK_IDCER_IMPL_H