|
@@ -104,10 +104,15 @@ FingerPrintImpl::~FingerPrintImpl()
|
|
|
|
|
|
ErrorCodeEnum FingerPrintImpl::GetDevCategory(DevCategoryInfo& devCategory)
|
|
|
{
|
|
|
- strcpy(devCategory.szModel, "szModel");
|
|
|
- strcpy(devCategory.szType, "szType");
|
|
|
- strcpy(devCategory.szVendor, "szVendor=cmbszSimulator");
|
|
|
- return Error_Succeed;
|
|
|
+ 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 FingerPrintImpl::Reset()
|
|
@@ -330,6 +335,80 @@ bool FingerPrintImpl::Image2TemplateHttp(LPBYTE lpbTemplate, int& iLength)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+bool FingerPrintImpl::GetDevCategoryHttp(DevCategoryInfo& devCategory)
|
|
|
+{
|
|
|
+ LOG4VTM(INFO, "GetDevCategoryHttp");
|
|
|
+ return commonSimpleHttp("GetDevCategory");
|
|
|
+}
|
|
|
+
|
|
|
+bool FingerPrintImpl::commonSimpleHttp(string adapterInterName)
|
|
|
+{
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+string FingerPrintImpl::getUrl()
|
|
|
+{
|
|
|
+ string urlStr = iniRead.ReadString("server", "url", "");
|
|
|
+ if (urlStr.empty()) {
|
|
|
+ LOG4VTM(INFO, "url is empty, use default url");
|
|
|
+ return "http://localhost:8080/avs/imitate/simulateDataN";
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return urlStr;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
#ifdef NEWER_COMPILER_WORKAROUNDS
|
|
|
|
|
|
DEVICEBASE_API ErrorCodeEnum GetDevAdapterVersion(DevSoftVersion& retVesion)
|