|
|
@@ -1,43 +1,9 @@
|
|
|
-#include "stdafx.h"
|
|
|
#include "FingerPrint_impl.h"
|
|
|
-#include "log4vendor.h"
|
|
|
-#include "path.h"
|
|
|
-
|
|
|
-#ifdef _MSC_VER
|
|
|
-#include <direct.h>
|
|
|
-#else
|
|
|
-#include <unistd.h>
|
|
|
-#include<cstring>
|
|
|
+#include "FingerPrint_httpans.h"
|
|
|
+#include <cstring>
|
|
|
#include <cstdio>
|
|
|
-#include <netdb.h> //gethostbyname
|
|
|
-#include <arpa/inet.h> //ntohl
|
|
|
-#include <unistd.h> // Linux系统中
|
|
|
-#include <netdb.h>
|
|
|
-#include <net/if.h>
|
|
|
-#include <arpa/inet.h>
|
|
|
-#include <sys/ioctl.h>
|
|
|
-#include <sys/types.h>
|
|
|
-#include <sys/socket.h>
|
|
|
-#include <netinet/in.h>
|
|
|
-#endif
|
|
|
-
|
|
|
-#ifdef _MSC_VER
|
|
|
-BOOL APIENTRY DllMain( HMODULE hModule,
|
|
|
- DWORD ul_reason_for_call,
|
|
|
- LPVOID lpReserved
|
|
|
- )
|
|
|
-{
|
|
|
- switch (ul_reason_for_call)
|
|
|
- {
|
|
|
- case DLL_PROCESS_ATTACH:
|
|
|
- case DLL_THREAD_ATTACH:
|
|
|
- case DLL_THREAD_DETACH:
|
|
|
- case DLL_PROCESS_DETACH:
|
|
|
- break;
|
|
|
- }
|
|
|
- return TRUE;
|
|
|
-}
|
|
|
-#endif
|
|
|
+#include "log4vendor.h"
|
|
|
+#include <path.h>
|
|
|
|
|
|
void writeFile(const char* filename)
|
|
|
{
|
|
|
@@ -48,39 +14,6 @@ void writeFile(const char* filename)
|
|
|
fclose(fp);
|
|
|
}
|
|
|
|
|
|
-DEVICEBASE_API ErrorCodeEnum CreateDevComponent(DeviceBaseClass*& pBaseObj)
|
|
|
-{
|
|
|
- pBaseObj = new FingerPrintImpl();
|
|
|
- if (pBaseObj == NULL) {
|
|
|
- return Error_Resource;
|
|
|
- }
|
|
|
- cmb::log_init_config config;
|
|
|
- config.dev_name = "FingerPrint";
|
|
|
-#ifdef _MSC_VER
|
|
|
- config.log_dir = ("C:\\rvc\\dbg\\");
|
|
|
-#else
|
|
|
- config.log_dir = ("/opt/rvc/dbg/");
|
|
|
-#endif
|
|
|
- std::string str;
|
|
|
- cmb::log4vendor::init(config, str);
|
|
|
- printf("init after: %s\n", str.c_str());
|
|
|
-
|
|
|
- return Error_Succeed;
|
|
|
-}
|
|
|
-DEVICEBASE_API ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass*& pBaseObj)
|
|
|
-{
|
|
|
- if (pBaseObj == NULL) {
|
|
|
- return Error_Param;
|
|
|
- }
|
|
|
- if (FingerPrintImpl* pTmp = dynamic_cast<FingerPrintImpl*>(pBaseObj))
|
|
|
- {
|
|
|
- delete pTmp;
|
|
|
- pTmp = NULL;
|
|
|
- return Error_Succeed;
|
|
|
- }
|
|
|
- return Error_Param;
|
|
|
-}
|
|
|
-
|
|
|
FingerPrintImpl::FingerPrintImpl()
|
|
|
{
|
|
|
|
|
|
@@ -93,63 +26,97 @@ FingerPrintImpl::~FingerPrintImpl()
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::GetDevCategory(DevCategoryInfo& devCategory)
|
|
|
{
|
|
|
- if (GetDevCategoryHttp(devCategory)) {
|
|
|
- strcpy(devCategory.szModel, "CM=2.0#CID=00000000");
|
|
|
- strcpy(devCategory.szType, "PVER=ACT#MID=ACT-F5-5540-0SH");
|
|
|
- strcpy(devCategory.szVendor, "cmbszSimulator");
|
|
|
- return Error_Succeed;
|
|
|
- }
|
|
|
- else {
|
|
|
- return Error_Exception;
|
|
|
- }
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ SimulatorDevCategoryAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "GetDevCategory", ans);
|
|
|
+ LOG4VTM(INFO, "GetDevCategory err = " << err);
|
|
|
+
|
|
|
+ strcpy(devCategory.szType, ans.szType.c_str());
|
|
|
+ strcpy(devCategory.szModel, ans.szModel.c_str());
|
|
|
+ strcpy(devCategory.szVendor, ans.szVendor.c_str());
|
|
|
+ devCategory.eState = (DevStateEnum)ans.eState;
|
|
|
+ devCategory.version.wMajor = ans.version.wMajor;
|
|
|
+ devCategory.version.wMinor = ans.version.wMinor;
|
|
|
+ devCategory.version.wRevision = ans.version.wRevision;
|
|
|
+ devCategory.version.wBuild = ans.version.wBuild;
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::Reset()
|
|
|
{
|
|
|
- return Error_Succeed;
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ SimulatorCommonAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "Reset", ans);
|
|
|
+ LOG4VTM(INFO, "Reset err = " << err);
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::DevClose()
|
|
|
{
|
|
|
- return Error_Succeed;
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ SimulatorCommonAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "DevClose", ans);
|
|
|
+ LOG4VTM(INFO, "DevClose err = " << err);
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::GetLastErr(DevErrorInfo& devErrInfo)
|
|
|
{
|
|
|
- static int times = 0;
|
|
|
- char szMessage[1024];
|
|
|
- sprintf(szMessage, "这是第 %d 条错误信息", ++times);
|
|
|
- strcpy(devErrInfo.szErrMsg, szMessage);
|
|
|
- devErrInfo.dwErrMsgLen = strlen(szMessage);
|
|
|
- return Error_Succeed;
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ SimulatorDevErrInfoAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "GetLastErr", ans);
|
|
|
+ LOG4VTM(INFO, "GetLastErr err = " << err);
|
|
|
+
|
|
|
+ devErrInfo.dwErrMsgLen = ans.dwErrMsgLen;
|
|
|
+ strcpy(devErrInfo.szErrMsg, ans.szErrMsg.c_str());
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::DevOpen(DWORD dwPort, DWORD dwBaudRate)
|
|
|
{
|
|
|
- LOG4VTM(INFO, "当前目录:" << GetCurrentDirectory());
|
|
|
- depCfgPath = GetCurrentDirectory() + SPLIT_SLASH_STR + "cmbsz.ini";
|
|
|
- bool ret = iniRead.ReadConfig(depCfgPath);
|
|
|
- if (ret == false)
|
|
|
- {
|
|
|
- LOG4VTM(INFO, "dep ReadConfig is Error,cfg=" << depCfgPath);
|
|
|
- }
|
|
|
- return Error_Succeed;
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ SimulatorCommonAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "DevOpen", ans);
|
|
|
+ LOG4VTM(INFO, "DevOpen err = " << err);
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::Image2Feature(const char* imageName, LPBYTE lpbFeature, int& iLength)
|
|
|
{
|
|
|
- //imageName写入的文件,lpbFeature 特征码,iLength特征码长度
|
|
|
- string imgName(imageName);
|
|
|
- string imgPath = GetCurrentDirectory() + SPLIT_SLASH_STR + imgName;
|
|
|
- writeFile(imgPath.c_str());
|
|
|
- //获取特征码
|
|
|
- if (Image2FeatureHttp(lpbFeature, iLength)) {
|
|
|
- return Error_Succeed;
|
|
|
- }
|
|
|
- else {
|
|
|
- return Error_Exception;
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ Image2FeatureAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "Image2Feature", ans);
|
|
|
+ LOG4VTM(INFO, "Image2Feature err = " << err);
|
|
|
+
|
|
|
+ if (err == Error_Succeed)
|
|
|
+ {
|
|
|
+ //imageName写入的文件,lpbFeature 特征码,iLength特征码长度
|
|
|
+ string imgName(imageName);
|
|
|
+ string imgPath = GetCurrentDirectory() + SPLIT_SLASH_STR + imgName;
|
|
|
+ writeFile(imgPath.c_str());
|
|
|
+
|
|
|
+#ifdef _MSC_VER
|
|
|
+ strcpy_s((char*)lpbFeature, 1024, ans.lpbFeature.c_str());
|
|
|
+#else
|
|
|
+ strncpy((char*)lpbFeature, ans.lpbFeature.c_str(), 1024);
|
|
|
+#endif
|
|
|
+
|
|
|
+ iLength = ans.iLength;
|
|
|
}
|
|
|
|
|
|
+ return err;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::Image2Template(const char* imagePath1, const char* imagePath2, const char* imagePath3, LPBYTE lpbTemplate, int& iLength)
|
|
|
@@ -158,244 +125,109 @@ ErrorCodeEnum FingerPrintImpl::Image2Template(const char* imagePath1, const char
|
|
|
LOG4VTM(INFO, "imagePath1 path = " << imagePath1);
|
|
|
LOG4VTM(INFO, "imagePath2 path = " << imagePath2);
|
|
|
LOG4VTM(INFO, "imagePath3 path = " << imagePath3);
|
|
|
- if (Image2TemplateHttp(lpbTemplate, iLength)) {
|
|
|
- return Error_Succeed;
|
|
|
- }
|
|
|
- else {
|
|
|
- return Error_Exception;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-ErrorCodeEnum FingerPrintImpl::Match(LPBYTE lpbTemplate[], int iTemplateLen[], int templateNum, LPBYTE lbpFeature, int& iFeatureLen, int level /*= 3*/)
|
|
|
-{
|
|
|
- return Error_NotImpl;
|
|
|
-}
|
|
|
+
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ Image2TemplateAns ans;
|
|
|
|
|
|
-ErrorCodeEnum FingerPrintImpl::Cancel()
|
|
|
-{
|
|
|
- return Error_NotImpl;
|
|
|
-}
|
|
|
+ err = SimulatorHttpFunction(EntityName, "Image2Template", ans);
|
|
|
+ LOG4VTM(INFO, "Image2Template err = " << err);
|
|
|
|
|
|
-bool FingerPrintImpl::Image2FeatureHttp(LPBYTE lpbFeature, int& iLength)
|
|
|
-{
|
|
|
- Image2FeatureReq fReq;
|
|
|
- Image2FeatureRet fRet;
|
|
|
- IHttpFunc* client;
|
|
|
- client = create_http(HttpsLogCallBack);
|
|
|
-
|
|
|
- Json::Value rootReq;
|
|
|
- Json::FastWriter writer;
|
|
|
-
|
|
|
- rootReq["ip"] = GetLocalIP();
|
|
|
- rootReq["entityName"] = "FingerPrint";
|
|
|
- rootReq["method"] = "getFingerPrint";//实体对外接口名
|
|
|
- rootReq["adapterInterName"] = "Image2Feature";//适配器接口名
|
|
|
-
|
|
|
- //fReq.m_url = "http://localhost:8080/avs/imitate/simulateData";
|
|
|
- string urlStr = iniRead.ReadString("server", "url", "");
|
|
|
- if (urlStr.empty()) {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp req fail,url is empty, use default url");
|
|
|
- fReq.m_url = "http://localhost:8080/avs/imitate/simulateData";
|
|
|
- }
|
|
|
- else {
|
|
|
- fReq.m_url = urlStr;
|
|
|
- }
|
|
|
- fReq.m_timeOut = 10;
|
|
|
- string jsonReq = writer.write(rootReq);
|
|
|
- fReq.m_reqStr = jsonReq;//请求参数
|
|
|
-
|
|
|
- bool ret = client->Post(fReq, fRet);
|
|
|
- if (ret) {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp fRet.m_retStr = " << fRet.m_retStr);
|
|
|
- Json::Reader reader;
|
|
|
- Json::Value rootRet;
|
|
|
- if (!reader.parse(fRet.m_retStr, rootRet, false))
|
|
|
- {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp parse resp is fail,url=" << fReq.m_url.c_str());
|
|
|
- return false;//失败
|
|
|
- }
|
|
|
- bool isSucc = rootRet["success"].asBool();
|
|
|
- if (isSucc) {
|
|
|
- //解析数据
|
|
|
- if (rootRet.isMember("data")) {
|
|
|
- string strFeature = rootRet["data"]["feature"].asString();
|
|
|
- if (strFeature.length() != 684) {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp return feature length is not right,len = " << strFeature.length());
|
|
|
- return false;
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp return feature len = " << strFeature.length() << " feature = " << strFeature.c_str());
|
|
|
- }
|
|
|
+ if (err == Error_Succeed)
|
|
|
+ {
|
|
|
#ifdef _MSC_VER
|
|
|
- strcpy_s((char*)lpbFeature, 1024, strFeature.c_str());
|
|
|
+ strcpy_s((char*)lpbTemplate, 1024, ans.lpbTemplate.c_str());
|
|
|
#else
|
|
|
- strncpy((char*)lpbFeature, strFeature.c_str(), 684);
|
|
|
+ strncpy((char*)lpbTemplate, ans.lpbTemplate.c_str(), 1024);
|
|
|
#endif
|
|
|
- iLength = strFeature.length();
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp return feature len =" << strFeature.length() << ", lpbFeature = " << lpbFeature);
|
|
|
- return true;
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp return [data] is null");
|
|
|
- return false;//查询失败
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp [success] is false,url= " << fReq.m_url.c_str());
|
|
|
- return false;//查询失败
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp req fail,err=%s" << fRet.m_errMsg.c_str());
|
|
|
- return false;
|
|
|
+
|
|
|
+ iLength = ans.iLength;
|
|
|
}
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
-bool FingerPrintImpl::Image2TemplateHttp(LPBYTE lpbTemplate, int& iLength)
|
|
|
+ErrorCodeEnum FingerPrintImpl::Match(LPBYTE lpbTemplate[], int iTemplateLen[], int templateNum, LPBYTE lbpFeature, int& iFeatureLen, int level /*= 3*/)
|
|
|
{
|
|
|
- Image2TemplateReq fReq;
|
|
|
- Image2TemplateRet fRet;
|
|
|
- IHttpFunc* client;
|
|
|
- client = create_http(HttpsLogCallBack);
|
|
|
-
|
|
|
- Json::Value rootReq;
|
|
|
- Json::FastWriter writer;
|
|
|
-
|
|
|
- rootReq["ip"] = GetLocalIP();
|
|
|
- rootReq["entityName"] = "FingerPrint";
|
|
|
- rootReq["method"] = "generateTemplate";
|
|
|
- rootReq["adapterInterName"] = "Image2Template";//???
|
|
|
-
|
|
|
- string urlStr = iniRead.ReadString("server", "url", "");
|
|
|
- if (urlStr.empty()) {
|
|
|
- LOG4VTM(INFO, "Image2FeatureHttp req fail,url is empty, use default url");
|
|
|
- fReq.m_url = "http://localhost:8080/avs/imitate/simulateData";
|
|
|
- }
|
|
|
- else {
|
|
|
- fReq.m_url = urlStr;
|
|
|
- }
|
|
|
- fReq.m_timeOut = 10;
|
|
|
- string jsonReq = writer.write(rootReq);
|
|
|
- fReq.m_reqStr = jsonReq;//请求参数
|
|
|
-
|
|
|
- bool ret = client->Post(fReq, fRet);
|
|
|
- if (ret) {
|
|
|
- Json::Reader reader;
|
|
|
- Json::Value rootRet;
|
|
|
- if (!reader.parse(fRet.m_retStr, rootRet, false))
|
|
|
- {
|
|
|
- LOG4VTM(INFO, "Image2TemplateHttp parse resp is fail,url=" << fReq.m_url.c_str());
|
|
|
- return false;//失败
|
|
|
- }
|
|
|
- bool isSucc = rootRet["success"].asBool();
|
|
|
- if (isSucc) {
|
|
|
- //解析数据
|
|
|
- if (rootRet.isMember("data")) {
|
|
|
- string strFeature = rootRet["data"]["template"].asString();
|
|
|
- if (strFeature.length() != 684) {
|
|
|
- LOG4VTM(INFO, "Image2TemplateHttp return feature length is not right,len = " << strFeature.length());
|
|
|
- return false;
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2TemplateHttp return feature len = " << strFeature.length() << " feature = " << strFeature.c_str());
|
|
|
- }
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ MatchAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "Match", ans);
|
|
|
+ LOG4VTM(INFO, "Match err = " << err);
|
|
|
+
|
|
|
+ if (err == Error_Succeed)
|
|
|
+ {
|
|
|
#ifdef _MSC_VER
|
|
|
- strcpy_s((char*)lpbTemplate, 1024, strFeature.c_str());
|
|
|
+ strcpy_s((char*)lbpFeature, 1024, ans.lbpFeature.c_str());
|
|
|
#else
|
|
|
- strncpy((char*)lpbTemplate, strFeature.c_str(), 684);
|
|
|
+ strncpy((char*)lbpFeature, ans.lbpFeature.c_str(), 1024);
|
|
|
#endif
|
|
|
- iLength = strFeature.length();
|
|
|
- LOG4VTM(INFO, "Image2TemplateHttp return feature len =" << strFeature.length() << ", lpbFeature = " << lpbTemplate);
|
|
|
- return true;
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, ("Image2TemplateHttp return [data] is null"));
|
|
|
- return false;//查询失败
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2TemplateHttp [success] is false,url= " << fReq.m_url.c_str());
|
|
|
- return false;//查询失败
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, "Image2TemplateHttp req fail,err=%s" << fRet.m_errMsg.c_str());
|
|
|
- return false;
|
|
|
+
|
|
|
+ iFeatureLen = ans.iFeatureLen;
|
|
|
}
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
-bool FingerPrintImpl::GetDevCategoryHttp(DevCategoryInfo& devCategory)
|
|
|
+ErrorCodeEnum FingerPrintImpl::Cancel()
|
|
|
{
|
|
|
- LOG4VTM(INFO, "GetDevCategoryHttp");
|
|
|
- return commonSimpleHttp("GetDevCategory");
|
|
|
+ ErrorCodeEnum err = Error_Succeed;
|
|
|
+ SimulatorCommonAns ans;
|
|
|
+
|
|
|
+ err = SimulatorHttpFunction(EntityName, "Cancel", ans);
|
|
|
+ LOG4VTM(INFO, "Cancel err = " << err);
|
|
|
+
|
|
|
+ return err;
|
|
|
}
|
|
|
|
|
|
-bool FingerPrintImpl::commonSimpleHttp(string adapterInterName)
|
|
|
+#ifdef _MSC_VER
|
|
|
+BOOL APIENTRY DllMain(HMODULE hModule,
|
|
|
+ DWORD ul_reason_for_call,
|
|
|
+ LPVOID lpReserved
|
|
|
+)
|
|
|
{
|
|
|
- CommonReq cReq;
|
|
|
- CommonRet cRet;
|
|
|
- IHttpFunc* client;
|
|
|
- client = create_http(HttpsLogCallBack);
|
|
|
-
|
|
|
- Json::Value rootReq;
|
|
|
- Json::FastWriter writer;
|
|
|
-
|
|
|
- rootReq["ip"] = GetLocalIP();
|
|
|
- rootReq["entityName"] = "FingerPrint";
|
|
|
- rootReq["adapterInterName"] = adapterInterName;//适配器接口名
|
|
|
- string strErrPrefix = adapterInterName + "http";
|
|
|
- cReq.m_url = getUrl();
|
|
|
- cReq.m_timeOut = 30;
|
|
|
- string jsonReq = writer.write(rootReq);
|
|
|
- cReq.m_reqStr = jsonReq;//请求参数
|
|
|
-
|
|
|
- bool ret = client->Post(cReq, cRet);
|
|
|
- if (ret) {
|
|
|
- Json::Reader reader;
|
|
|
- Json::Value rootRet;
|
|
|
- if (!reader.parse(cRet.m_retStr, rootRet, false))
|
|
|
- {
|
|
|
- LOG4VTM(INFO, strErrPrefix << " parse resp is fail,url=" << cReq.m_url.c_str());
|
|
|
- return false;//失败
|
|
|
- }
|
|
|
- bool isSucc = rootRet["success"].asBool();
|
|
|
- if (isSucc) {
|
|
|
- //解析数据
|
|
|
- if (rootRet.isMember("data")) {
|
|
|
- bool isResult = rootRet["data"]["result"].asBool();
|
|
|
- if (isResult) {
|
|
|
- return true;
|
|
|
- }
|
|
|
- else {
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, strErrPrefix << " return [data] is null");
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, strErrPrefix << " [success] is false,");
|
|
|
- return false;
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- LOG4VTM(INFO, strErrPrefix << " req fail,err=%s" << cRet.m_errMsg.c_str());
|
|
|
- return false;
|
|
|
+ switch (ul_reason_for_call)
|
|
|
+ {
|
|
|
+ case DLL_PROCESS_ATTACH:
|
|
|
+ case DLL_THREAD_ATTACH:
|
|
|
+ case DLL_THREAD_DETACH:
|
|
|
+ case DLL_PROCESS_DETACH:
|
|
|
+ break;
|
|
|
}
|
|
|
+ return TRUE;
|
|
|
}
|
|
|
+#endif
|
|
|
|
|
|
-string FingerPrintImpl::getUrl()
|
|
|
+DEVICEBASE_API ErrorCodeEnum CreateDevComponent(DeviceBaseClass*& pBaseObj)
|
|
|
{
|
|
|
- string urlStr = iniRead.ReadString("server", "url", "");
|
|
|
- if (urlStr.empty()) {
|
|
|
- LOG4VTM(INFO, "url is empty, use default url");
|
|
|
- return "http://localhost:8080/avs/imitate/simulateDataN";
|
|
|
+ pBaseObj = new FingerPrintImpl();
|
|
|
+ if (pBaseObj == NULL) {
|
|
|
+ return Error_Resource;
|
|
|
}
|
|
|
- else {
|
|
|
- return urlStr;
|
|
|
+ cmb::log_init_config config;
|
|
|
+ config.dev_name = "vendor_FingerPrint";
|
|
|
+#ifdef _MSC_VER
|
|
|
+ config.log_dir = ("C:\\rvc\\dbg\\");
|
|
|
+#else
|
|
|
+ config.log_dir = ("/opt/rvc/dbg/");
|
|
|
+#endif
|
|
|
+ std::string str;
|
|
|
+ cmb::log4vendor::init(config, str);
|
|
|
+ printf("init after: %s\n", str.c_str());
|
|
|
+
|
|
|
+ return Error_Succeed;
|
|
|
+}
|
|
|
+DEVICEBASE_API ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass*& pBaseObj)
|
|
|
+{
|
|
|
+ if (pBaseObj == NULL) {
|
|
|
+ return Error_Param;
|
|
|
+ }
|
|
|
+ if (FingerPrintImpl* pTmp = dynamic_cast<FingerPrintImpl*>(pBaseObj))
|
|
|
+ {
|
|
|
+ delete pTmp;
|
|
|
+ pTmp = NULL;
|
|
|
+ return Error_Succeed;
|
|
|
}
|
|
|
+ return Error_Param;
|
|
|
}
|
|
|
|
|
|
#ifdef NEWER_COMPILER_WORKAROUNDS
|