| 684 | } |
| 685 | |
| 686 | int64_t requestGpuHighFreq(int scene, int64_t action, int level, int timeoutms, int tid, int64_t timestamp) { |
| 687 | IClientEngine *pEngine = engine(); |
| 688 | if (!pEngine) { |
| 689 | return -3; |
| 690 | } |
| 691 | |
| 692 | int64_t requestid = 0L; |
| 693 | if (HEADER_VERSION >= HEADER_JSON_VERSION) {//json |
| 694 | cJSON *jsonRequest; |
| 695 | jsonRequest = cJSON_CreateObject(); |
| 696 | cJSON_AddNumberToObject(jsonRequest, "jsonVersion", JSON_VERSION); |
| 697 | cJSON_AddNumberToObject(jsonRequest, "funcid", FUNC_GPU_HIGH_FREQ); |
| 698 | cJSON_AddNumberToObject(jsonRequest, "status", STATUS_REQUEST); |
| 699 | cJSON_AddNumberToObject(jsonRequest, "scene", scene); |
| 700 | cJSON_AddNumberToObject(jsonRequest, "action", action); |
| 701 | cJSON_AddNumberToObject(jsonRequest, "gpulevel", level); |
| 702 | cJSON_AddNumberToObject(jsonRequest, "timeoutMs", timeoutms); |
| 703 | |
| 704 | char *body = cJSON_Print(jsonRequest); |
| 705 | std::string str(body); |
| 706 | uint32_t len = str.length(); |
| 707 | cJSON_Delete(jsonRequest); |
| 708 | requestid = pEngine ->sendReq(FUNC_GPU_HIGH_FREQ, (uint8_t *)body, len, tid, timestamp); |
| 709 | free(body); |
| 710 | } else { |
| 711 | amc::RequestGPUHighFreq request; |
| 712 | request.set_scene(scene); |
| 713 | request.set_level(level); |
| 714 | request.set_timeoutms(timeoutms); |
| 715 | request.set_action(action); |
| 716 | uint32_t len = request.ByteSize(); |
| 717 | uint8_t body[len]; |
| 718 | request.SerializeToArray(body, len); |
| 719 | |
| 720 | requestid = pEngine->sendReq(FUNC_GPU_HIGH_FREQ, body, len, tid, timestamp); |
| 721 | } |
| 722 | pdbg("requestGpuHighFreq requestid:%lld, scene:%d, action:%d, level:%d, timeoutms:%d, tid:%d, timestamp:%d" , |
| 723 | requestid, scene, TOINT(action), level, timeoutms, tid, TOINT(timestamp/1000000L)); |
| 724 | return requestid; |
| 725 | } |
| 726 | |
| 727 | |
| 728 | int64_t cancelGpuHighFreq(int tid, int64_t timestamp) { |
nothing calls this directly
no test coverage detected