fingerprint.h 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #ifndef FINGERPRINT_H
  2. #define FINGERPRINT_H
  3. #pragma once
  4. #include "stdafx.h"
  5. #include "FingerPrintClass.h"
  6. #include "JZT998APBDevCtrl.h"
  7. #include "log4vendor.h"
  8. #include <algorithm>
  9. #define FINGERPRINT_ADAPTER_MUTEX
  10. #pragma commen"FingerPrintAdapterMutex"
  11. //#ifndef min
  12. //#define min(a,b) (((a) < (b)) ? (a) : (b))
  13. //#endif
  14. enum COMMFUNC_RLT : int
  15. {
  16. RLT_SUCCESS = 0,
  17. RLT_ERROR
  18. };
  19. class FingerPrintClassImpl : public FingerPrintClass
  20. {
  21. public:
  22. FingerPrintClassImpl();
  23. virtual ~FingerPrintClassImpl();
  24. //DeviceBaseClass
  25. //
  26. // Get category infomation about device.
  27. //
  28. virtual ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
  29. // Reset device.
  30. // Do the cleaning work and initialize device again in order to return to
  31. // the normal condition.
  32. virtual ErrorCodeEnum Reset();
  33. //
  34. // Close device and do the cleaning work.
  35. // ex. close connection,close port,release memery and so on
  36. virtual ErrorCodeEnum DevClose();
  37. // Get last error the device issued.
  38. // Error message must include explanatory memorandum ,the original error
  39. // code and anything in favour of location problem.
  40. virtual ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
  41. //
  42. // Open Device
  43. // if usb device, set dwPort = 0
  44. virtual ErrorCodeEnum DevOpen(DWORD dwPort, DWORD dwBaudRate);
  45. //计算特征值,iLength:输入代表buf最大长度,输出为特征实际长度
  46. //Compute features
  47. virtual ErrorCodeEnum Image2Feature(const char* imagePath, LPBYTE lpbFeature, int &iLength);
  48. //生成特征模板(注册时使用)
  49. //Convert image to template
  50. virtual ErrorCodeEnum Image2Template(const char* imagePath1, const char* imagePath2, const char* imagePath3, LPBYTE lpbTemplate, int &iLength);
  51. //比对校验
  52. //Match the feature
  53. /*virtual ErrorCodeEnum Match(LPBYTE lpbTemplate, int iTemplateLen, LPBYTE lbpFeature, int iFeatureLen, int level=3) ;*/
  54. //lpbTemplate和iTemplateLen分别表示输入的一组特征模板及其对应的长度,templateNum为数组长度(即模板个数)
  55. //lbpFeature表示待校验的指纹特征,iFeatureLen表示其长度,level表示校验等级,默认取3
  56. virtual ErrorCodeEnum Match(LPBYTE lpbTemplate[], int iTemplateLen[] ,int templateNum, LPBYTE lbpFeature, int &iFeatureLen ,int level = 3);
  57. //取消采集指纹图片
  58. virtual ErrorCodeEnum Cancel() ;
  59. private:
  60. //扫描指纹并保存指纹图片到默认路径下(dep目录下)
  61. //Scan FingerPrint and save the image default path(dep/)
  62. ErrorCodeEnum ScanFingerAndSaveImage(const char* imageName);
  63. int string_format(std::string &str, const std::string fmt, ...);
  64. //int GetDllPathLocal(std::string &dllPath);
  65. CDevDllLoad *m_pDll;
  66. bool m_bDevOpen;
  67. int m_nPort;
  68. CHAR m_szErrMsg[MAX_DEV_ERROR_MSG_LEN];
  69. void SaveErrorInfo(CHAR* errMsg, int errCode=95555);
  70. void SaveErrorInfo(DevErrorInfo devErrorInfo);
  71. void SaveErrorInfo(int nErrorCode);
  72. std::string m_LogFileNamePath;
  73. int m_nLogLevel;
  74. std::string m_strIniPath;
  75. std::string m_strDllPath;
  76. short m_shErrCode;
  77. char m_strModulePath[256];
  78. };
  79. ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&pBaseObj);
  80. ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj);
  81. #endif // FINGERPRINT_H