MCPcopy Create free account
hub / github.com/Tencent/Hardcoder / getParameters

Method getParameters

libapp2sys/src/main/cpp/protocol.h:1280–1310  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1278 }
1279
1280 int64_t getParameters(const char *data, int tid, int64_t timestamp) {
1281 IClientEngine *pEngine = engine();
1282 if (!pEngine) {
1283 return -3;
1284 }
1285 int64_t requestid = 0L;
1286 if (HEADER_VERSION >= HEADER_JSON_VERSION) {//json
1287 cJSON *jsonRequest;
1288 jsonRequest = cJSON_Parse(data);
1289 cJSON_AddNumberToObject(jsonRequest, "jsonVersion", JSON_VERSION);
1290 cJSON_AddNumberToObject(jsonRequest, "funcid", FUNC_GET_PARAMETERS);
1291
1292 char *body = cJSON_Print(jsonRequest);
1293 std::string str(body);
1294 pdbg("getParameters:%s", body);
1295 uint32_t len = str.length();
1296 cJSON_Delete(jsonRequest);
1297 requestid = pEngine ->sendReq(FUNC_GET_PARAMETERS, (uint8_t *)body, len, tid, timestamp);
1298 free(body);
1299 } else {
1300 amc::GetParameters request;
1301 request.set_data(data);
1302 uint32_t len = request.ByteSize();
1303 uint8_t body[len];
1304 request.SerializeToArray(body, len);
1305 requestid = pEngine->sendReq(FUNC_GET_PARAMETERS, body, len, tid, timestamp);
1306
1307 pdbg("getParameters requestid:%lld, request size:%d", requestid, request.ByteSize());
1308 }
1309 return requestid;
1310 }
1311
1312 int onCallback(int uid, int funcid, uint64_t requestid, int bodyFormat, uint64_t timestamp, int retCode, uint8_t *data, int len) {
1313 UNUSED(uid);

Callers

nothing calls this directly

Calls 6

cJSON_ParseFunction · 0.85
cJSON_AddNumberToObjectFunction · 0.85
cJSON_PrintFunction · 0.85
cJSON_DeleteFunction · 0.85
ByteSizeMethod · 0.80
sendReqMethod · 0.45

Tested by

no test coverage detected