diff --git a/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h b/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h new file mode 100644 index 0000000000000000000000000000000000000000..2ec5618c68adb2cdf66aaacf408a11d9099224c2 --- /dev/null +++ b/frameworks/concurrent_task_client/include/concurrent_task_service_ipc_interface_code.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CONCURRENT_TASK_SERVICES_IPC_INTERFACE_CODE_H +#define CONCURRENT_TASK_SERVICES_IPC_INTERFACE_CODE_H + +#include "iremote_broker.h" +#include "json/json.h" +#include "concurrent_task_type.h" + +/* SAID:1912 */ +namespace OHOS { +namespace ConcurrentTask { + enum class ConcurrentTaskInterfaceCode { + REPORT_DATA = 1, + QUERY_INTERVAL = 2, + }; +} // namespace ConcurrentTask +} // namespace OHOS + +#endif // CONCURRENT_TASK_SERVICES_IPC_INTERFACE_CODE_H diff --git a/frameworks/concurrent_task_client/include/concurrent_task_service_proxy.h b/frameworks/concurrent_task_client/include/concurrent_task_service_proxy.h index bd07586d87523eea52e558574957dd93d846f9a9..82bf98598b2bda64be741b5b042efc95c1813b05 100644 --- a/frameworks/concurrent_task_client/include/concurrent_task_service_proxy.h +++ b/frameworks/concurrent_task_client/include/concurrent_task_service_proxy.h @@ -19,6 +19,7 @@ #include "iremote_proxy.h" #include "iremote_object.h" #include "iconcurrent_task_service.h" +#include "concurrent_task_service_ipc_interface_code.h" namespace OHOS { namespace ConcurrentTask { diff --git a/frameworks/concurrent_task_client/include/iconcurrent_task_service.h b/frameworks/concurrent_task_client/include/iconcurrent_task_service.h index 126f892abe650e8142063deaad276a98be23ac43..79ecefa8a73404c95baea1e46e5c50ca535755b1 100644 --- a/frameworks/concurrent_task_client/include/iconcurrent_task_service.h +++ b/frameworks/concurrent_task_client/include/iconcurrent_task_service.h @@ -13,22 +13,18 @@ * limitations under the License. */ -#ifndef CONCURRENT_TASK_SEVICES_INTERFACES_INNERAPI_CONCURRENT_TASK_CLIENT_INCLUDE_ICONCURRENT_TASK_SERVICE_H -#define CONCURRENT_TASK_SEVICES_INTERFACES_INNERAPI_CONCURRENT_TASK_CLIENT_INCLUDE_ICONCURRENT_TASK_SERVICE_H +#ifndef CONCURRENT_TASK_SERVICES_INTERFACES_INNERKITS_CONCURRENT_TASK_CLIENT_INCLUDE_ICONCURRENT_TASK_SERVICE_H +#define CONCURRENT_TASK_SERVICES_INTERFACES_INNERKITS_CONCURRENT_TASK_CLIENT_INCLUDE_ICONCURRENT_TASK_SERVICE_H #include "iremote_broker.h" #include "json/json.h" #include "concurrent_task_type.h" +/* SAID:1912 */ namespace OHOS { namespace ConcurrentTask { class IConcurrentTaskService : public IRemoteBroker { public: - enum : uint32_t { - REPORT_DATA = 1, - QUERY_INTERVAL = 2, - }; - DECLARE_INTERFACE_DESCRIPTOR(u"OHOS.ResourceSchedule.ConcurrentTaskService"); virtual void ReportData(uint32_t resType, int64_t value, const Json::Value& payload) = 0; @@ -37,4 +33,4 @@ public: } // namespace ConcurrentTask } // namespace OHOS -#endif // CONCURRENT_TASK_SEVICES_INTERFACES_INNERAPI_CONCURRENT_TASK_CLIENT_INCLUDE_ICONCURRENT_TASK_SERVICE_H +#endif // CONCURRENT_TASK_SERVICES_INTERFACES_INNERKITS_CONCURRENT_TASK_CLIENT_INCLUDE_ICONCURRENT_TASK_SERVICE_H diff --git a/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp b/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp index a417ee8dfa1fc652b998524ea424e826679ce171..4ae78b93647d1f8ce9a92c7e9661557696666132 100644 --- a/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp +++ b/frameworks/concurrent_task_client/src/concurrent_task_service_proxy.cpp @@ -37,7 +37,8 @@ void ConcurrentTaskServiceProxy::ReportData(uint32_t resType, int64_t value, con if (!data.WriteString(payload.toStyledString())) { return; } - error = Remote()->SendRequest(IConcurrentTaskService::REPORT_DATA, data, reply, option); + uint32_t code = static_cast(ConcurrentTaskInterfaceCode::REPORT_DATA); + error = Remote()->SendRequest(code, data, reply, option); if (error != NO_ERROR) { CONCUR_LOGE("Send request error: %{public}d", error); return; @@ -61,7 +62,9 @@ void ConcurrentTaskServiceProxy::QueryInterval(int queryItem, IntervalReply& que if (!data.WriteInt64(queryItem)) { return; } - error = Remote()->SendRequest(IConcurrentTaskService::QUERY_INTERVAL, data, reply, option); + + uint32_t code = static_cast(ConcurrentTaskInterfaceCode::QUERY_INTERVAL); + error = Remote()->SendRequest(code, data, reply, option); if (error != NO_ERROR) { CONCUR_LOGE("QueryInterval error: %{public}d", error); return; diff --git a/interfaces/inner_api/concurrent_task_client.h b/interfaces/inner_api/concurrent_task_client.h index f6a631370c0645a58609c02a1eed58ebbc751442..9a76377b77d97113228d3a95a98b8b56d0d3b64c 100644 --- a/interfaces/inner_api/concurrent_task_client.h +++ b/interfaces/inner_api/concurrent_task_client.h @@ -19,6 +19,7 @@ #include #include "iremote_object.h" #include "iconcurrent_task_service.h" +#include "concurrent_task_service_ipc_interface_code.h" namespace OHOS { namespace ConcurrentTask { diff --git a/services/include/concurrent_task_service_stub.h b/services/include/concurrent_task_service_stub.h index 9b4a62c5a9b00c83b48610ad685bbbb45c2b9a96..022d5d8d39e5f3f9c3153797b70cffb104aa3d17 100644 --- a/services/include/concurrent_task_service_stub.h +++ b/services/include/concurrent_task_service_stub.h @@ -19,6 +19,7 @@ #include #include "iremote_stub.h" #include "iconcurrent_task_service.h" +#include "concurrent_task_service_ipc_interface_code.h" namespace OHOS { namespace ConcurrentTask { diff --git a/services/src/concurrent_task_service_stub.cpp b/services/src/concurrent_task_service_stub.cpp index 24f6cfc7521f133b1d07c13bc6432e588883c18c..1cc9427dcd016fdf49b669ae8e3031d42b0afc62 100644 --- a/services/src/concurrent_task_service_stub.cpp +++ b/services/src/concurrent_task_service_stub.cpp @@ -140,9 +140,9 @@ Json::Value ConcurrentTaskServiceStub::StringToJson(const std::string& payload) void ConcurrentTaskServiceStub::Init() { funcMap_ = { - { REPORT_DATA, + { static_cast(ConcurrentTaskInterfaceCode::REPORT_DATA), [this](auto& data, auto& reply) {return ReportDataInner(data, reply); } }, - { QUERY_INTERVAL, + { static_cast(ConcurrentTaskInterfaceCode::QUERY_INTERVAL), [this](auto& data, auto& reply) {return QueryIntervalInner(data, reply); } }, }; }