| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- #ifndef FINGERPRINT_H
- #define FINGERPRINT_H
- #pragma once
- #include "stdafx.h"
- #include "FingerPrintClass.h"
- #include "JZT998APBDevCtrl.h"
- #include "log4vendor.h"
- #include <algorithm>
- #define FINGERPRINT_ADAPTER_MUTEX
- #pragma commen"FingerPrintAdapterMutex"
- //#ifndef min
- //#define min(a,b) (((a) < (b)) ? (a) : (b))
- //#endif
- enum COMMFUNC_RLT : int
- {
- RLT_SUCCESS = 0,
- RLT_ERROR
- };
- class FingerPrintClassImpl : public FingerPrintClass
- {
- public:
- FingerPrintClassImpl();
- virtual ~FingerPrintClassImpl();
- //DeviceBaseClass
- //
- // Get category infomation about device.
- //
- virtual ErrorCodeEnum GetDevCategory(DevCategoryInfo &devCategory);
- // Reset device.
- // Do the cleaning work and initialize device again in order to return to
- // the normal condition.
- virtual ErrorCodeEnum Reset();
- //
- // Close device and do the cleaning work.
- // ex. close connection,close port,release memery and so on
- virtual ErrorCodeEnum DevClose();
- // Get last error the device issued.
- // Error message must include explanatory memorandum ,the original error
- // code and anything in favour of location problem.
- virtual ErrorCodeEnum GetLastErr(DevErrorInfo &devErrInfo);
- //
- // Open Device
- // if usb device, set dwPort = 0
- virtual ErrorCodeEnum DevOpen(DWORD dwPort, DWORD dwBaudRate);
- //计算特征值,iLength:输入代表buf最大长度,输出为特征实际长度
- //Compute features
- virtual ErrorCodeEnum Image2Feature(const char* imagePath, LPBYTE lpbFeature, int &iLength);
- //生成特征模板(注册时使用)
- //Convert image to template
- virtual ErrorCodeEnum Image2Template(const char* imagePath1, const char* imagePath2, const char* imagePath3, LPBYTE lpbTemplate, int &iLength);
- //比对校验
- //Match the feature
- /*virtual ErrorCodeEnum Match(LPBYTE lpbTemplate, int iTemplateLen, LPBYTE lbpFeature, int iFeatureLen, int level=3) ;*/
- //lpbTemplate和iTemplateLen分别表示输入的一组特征模板及其对应的长度,templateNum为数组长度(即模板个数)
- //lbpFeature表示待校验的指纹特征,iFeatureLen表示其长度,level表示校验等级,默认取3
- virtual ErrorCodeEnum Match(LPBYTE lpbTemplate[], int iTemplateLen[] ,int templateNum, LPBYTE lbpFeature, int &iFeatureLen ,int level = 3);
- //取消采集指纹图片
- virtual ErrorCodeEnum Cancel() ;
- private:
- //扫描指纹并保存指纹图片到默认路径下(dep目录下)
- //Scan FingerPrint and save the image default path(dep/)
- ErrorCodeEnum ScanFingerAndSaveImage(const char* imageName);
- int string_format(std::string &str, const std::string fmt, ...);
- //int GetDllPathLocal(std::string &dllPath);
- CDevDllLoad *m_pDll;
- bool m_bDevOpen;
- int m_nPort;
- CHAR m_szErrMsg[MAX_DEV_ERROR_MSG_LEN];
- void SaveErrorInfo(CHAR* errMsg, int errCode=95555);
- void SaveErrorInfo(DevErrorInfo devErrorInfo);
- void SaveErrorInfo(int nErrorCode);
- std::string m_LogFileNamePath;
- int m_nLogLevel;
- std::string m_strIniPath;
- std::string m_strDllPath;
- short m_shErrCode;
- char m_strModulePath[256];
- };
- ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&pBaseObj);
- ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj);
- #endif // FINGERPRINT_H
|