|
|
@@ -257,6 +257,22 @@ namespace Chromium {
|
|
|
if (!t_isRepeat && writeToOldParam) cJSON_AddItemToObject(ret, i->mName.c_str(), tmpArray);
|
|
|
cJSON_AddItemToObject(extendJs.get(), i->mName.c_str(), tmpArray2);
|
|
|
}
|
|
|
+ else if (i->mType == "array_double")
|
|
|
+ {
|
|
|
+ int len = 0;
|
|
|
+ double d = 0;
|
|
|
+ ReadT(msg.getPayload(), len, &rpos);
|
|
|
+
|
|
|
+ cJSON* tmpArray = cJSON_CreateArray(), * tmpArray2 = cJSON_CreateArray();
|
|
|
+ for (int c = 0; c < len; ++c) {
|
|
|
+ ReadT(msg.getPayload(), d, &rpos);
|
|
|
+ cJSON_AddItemToArray(tmpArray, cJSON_CreateNumber(d));
|
|
|
+ cJSON_AddItemToArray(tmpArray2, cJSON_CreateNumber(d));
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!t_isRepeat && writeToOldParam) cJSON_AddItemToObject(ret, i->mName.c_str(), tmpArray);
|
|
|
+ cJSON_AddItemToObject(extendJs.get(), i->mName.c_str(), tmpArray2);
|
|
|
+ }
|
|
|
else if (i->mType == "array_bool")
|
|
|
{
|
|
|
int len = 0;
|
|
|
@@ -1380,6 +1396,25 @@ namespace Chromium {
|
|
|
WriteT(data, len, wpos, capacity);
|
|
|
}
|
|
|
}
|
|
|
+ else if (it->mType == "array_double")
|
|
|
+ {
|
|
|
+ //DbgEx("array int -> ");
|
|
|
+ int len = 0;
|
|
|
+ if (GetCJsonArraySize(js, it->mName.c_str(), len, errmsg)) {
|
|
|
+ //DbgEx("array int -> true len = %d", len);
|
|
|
+ WriteT(data, len, wpos, capacity);
|
|
|
+ double d = 0;
|
|
|
+ for (int i = 0; i < len; ++i) {
|
|
|
+ if (!GetCJsonObjectValue(cJSON_GetArrayItem(cJSON_GetObjectItem(js, it->mName.c_str()), i), d, errmsg))
|
|
|
+ break;
|
|
|
+ WriteT(data, d, wpos, capacity);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("array int -> false len = %d", len);
|
|
|
+ WriteT(data, len, wpos, capacity);
|
|
|
+ }
|
|
|
+ }
|
|
|
else if (it->mType == "array_bool")
|
|
|
{
|
|
|
int len = 0;
|
|
|
@@ -1719,6 +1754,17 @@ namespace Chromium {
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+ bool CWSCodec::GetCJsonObjectValue(cJSON* obj, double& dstValue, char* errmsg) {
|
|
|
+ if (cJSON_Number == obj->type)
|
|
|
+ {
|
|
|
+ dstValue = obj->valuedouble;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ strcat(errmsg, "array member ");
|
|
|
+ dstValue = 0.0;
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
bool CWSCodec::GetCJsonObjectValue(cJSON * obj, CSimpleStringA & dstValue, char* errmsg) {
|
|
|
if (cJSON_String == obj->type) {
|
|
|
//DbgEx("GetCJsonObjectValue CSimpleStringA = %s", obj->valuestring);
|