| 1246 | } |
| 1247 | |
| 1248 | int64_t configure(const char *data, int tid, int64_t timestamp) { |
| 1249 | IClientEngine *pEngine = engine(); |
| 1250 | if (!pEngine) { |
| 1251 | return -3; |
| 1252 | } |
| 1253 | int64_t requestid = 0L; |
| 1254 | if (HEADER_VERSION >= HEADER_JSON_VERSION) {//json |
| 1255 | cJSON *jsonRequest; |
| 1256 | jsonRequest = cJSON_Parse(data); |
| 1257 | cJSON_AddNumberToObject(jsonRequest, "jsonVersion", JSON_VERSION); |
| 1258 | cJSON_AddNumberToObject(jsonRequest, "funcid", FUNC_CONFIGURE); |
| 1259 | |
| 1260 | char *body = cJSON_Print(jsonRequest); |
| 1261 | std::string str(body); |
| 1262 | pdbg("configure:%s", body); |
| 1263 | uint32_t len = str.length(); |
| 1264 | cJSON_Delete(jsonRequest); |
| 1265 | requestid = pEngine ->sendReq(FUNC_CONFIGURE, (uint8_t *)body, len, tid, timestamp); |
| 1266 | free(body); |
| 1267 | } else { |
| 1268 | amc::Configuration request; |
| 1269 | request.set_data(data); |
| 1270 | uint32_t len = request.ByteSize(); |
| 1271 | uint8_t body[len]; |
| 1272 | request.SerializeToArray(body, len); |
| 1273 | requestid = pEngine->sendReq(FUNC_CONFIGURE, body, len, tid, timestamp); |
| 1274 | |
| 1275 | pdbg("configure requestid:%lld, request size:%d", requestid, request.ByteSize()); |
| 1276 | } |
| 1277 | return requestid; |
| 1278 | } |
| 1279 | |
| 1280 | int64_t getParameters(const char *data, int tid, int64_t timestamp) { |
| 1281 | IClientEngine *pEngine = engine(); |
nothing calls this directly
no test coverage detected