in nlsCppSdk/transport/connectNode.cpp [4194:4254]
std::string ConnectNode::replenishNodeProcess(const char *error) {
if (error == NULL) {
return "";
}
try {
Json::Reader reader;
Json::Value root(Json::objectValue);
if (!reader.parse(error, root)) {
return "";
} else {
Json::Value request_process(Json::objectValue);
Json::Value timestamp(Json::objectValue);
Json::Value last(Json::objectValue);
Json::Value data(Json::objectValue);
Json::Value callback(Json::objectValue);
Json::Value block(Json::objectValue);
Json::StreamWriterBuilder writerBuilder;
writerBuilder["indentation"] = "";
timestamp = updateNodeProcess4Timestamp();
last = updateNodeProcess4Last();
data = updateNodeProcess4Data();
callback = updateNodeProcess4Callback();
block = updateNodeProcess4Block();
if (!timestamp.isNull()) {
root["timestamp"] = timestamp;
}
if (!last.isNull()) {
root["last"] = last;
}
if (!data.isNull()) {
root["data"] = data;
}
if (!callback.isNull()) {
root["callback"] = callback;
}
if (!block.isNull() && block.isObject() && !block.empty()) {
root["block"] = block;
}
root["sdkversion"] = NLS_SDK_VERSION_STR;
#ifdef ENABLE_CONTINUED
Json::Value reconnection(Json::objectValue);
reconnection = updateNodeReconnection();
if (!reconnection.isNull() && reconnection.isObject() &&
!reconnection.empty()) {
root["reconnection"] = reconnection;
}
#endif
root["connect_type"] = getConnectTypeStr();
return Json::writeString(writerBuilder, root);
}
} catch (const std::exception &e) {
LOG_ERROR("Json failed: %s", e.what());
return "";
}
}