Explorar el Código

Z991239-1017 #comment fea 解决当前指纹仪数据异常的问题

陈良瑜80374463 hace 5 años
padre
commit
fa7d121227
Se han modificado 2 ficheros con 24 adiciones y 2 borrados
  1. 1 1
      Module/mod_chromium/CMessage.h
  2. 23 1
      Module/mod_chromium/CWSCodec.cpp

+ 1 - 1
Module/mod_chromium/CMessage.h

@@ -3,7 +3,7 @@
 #include <string>
 #include <iostream>
 
-#define MAX_TRANSFER_LEN	(10*1024*1024)
+#define MAX_TRANSFER_LEN	(1024*1024)
 
 namespace Chromium {
 	std::string UtfToGbk(const char* utf8);

+ 23 - 1
Module/mod_chromium/CWSCodec.cpp

@@ -237,13 +237,35 @@ void CWSCodec::DeserializeBase(CMessage& msg, CTransStruct& ts, int& rpos, cJSON
 					cJSON_AddStringToObject(extendJs.get(), i->mName.c_str(), "");
 				}
 			}
+			else if (i->mType == "array_blob")
+			{
+				int array_size = 0;
+				ReadT(msg.getPayload(), array_size, &rpos);//array size
+				cJSON* tmpArray = cJSON_CreateArray(), * tmpArray2 = cJSON_CreateArray();
+				for (int c = 0; c < array_size; ++c) {
+					int tmpSize = 0;
+					ReadT(msg.getPayload(), tmpSize, &rpos);
+					if (0 != tmpSize)
+					{
+						void* binData = (char*)malloc(sizeof(char) * tmpSize);
+						ReadT(msg.getPayload(), binData, tmpSize, &rpos);
+						int base64Len = modp_b64_encode_len(tmpSize);
+						char* base64Data = (char*)malloc(sizeof(char) * base64Len);
+						modp_b64_encode(base64Data, (const char*)binData, tmpSize);
+						cJSON_AddItemToArray(tmpArray, cJSON_CreateString(base64Data));
+						cJSON_AddItemToArray(tmpArray2, cJSON_CreateString(base64Data));
+					}
+				}
+				if (!t_isRepeat)	cJSON_AddItemToObject(ret, i->mName.c_str(), tmpArray);
+				cJSON_AddItemToObject(extendJs.get(), i->mName.c_str(), tmpArray2);
+			}
 			++i;
 		}
 	}
 	catch(...)
 	{
 		if (i != ts.mParamList.end())
-			DbgEx("DeserializeBase error:%s, %s", i->mName, i->mType);
+			DbgEx("DeserializeBase error:%s, %s", i->mName.c_str(), i->mType.c_str());
 	}
 	cJSON_AddStringToObject(ret, PARAMLIST_HEAD, cJSON_PrintUnformatted(extendJs.get()));
 	//cJSON_AddItemToObject(ret, PARAMLIST_HEAD, extendJs.get());