diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_manager.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_manager.cpp index cc4db5308d5447e97857f4202ac064cb09ac5c17..06ae13b7536292ed57d5b153f0d25f17203086ba 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_manager.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_manager.cpp @@ -18,6 +18,7 @@ #include "device_manager_notify.h" #include "dm_constants.h" #include "dm_log.h" +#include "ipc_client_server_proxy.h" #include "ipc_client_stub.h" #include "ipc_register_listener_req.h" #include "ipc_remote_broker.h" diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp index 748da1c824852c5731e764bbe74e1cdd5d5993a9..1325fc3c12da67695fa054f5af0185d382f8f27c 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_client_stub.cpp @@ -35,7 +35,22 @@ int32_t IpcClientStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messa int32_t IpcClientStub::SendCmd(int32_t cmdCode, std::shared_ptr req, std::shared_ptr rsp) { - LOGE("error"); + LOGI("SendCmd cmdCode: %d", cmdCode); + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (IpcCmdRegister::GetInstance().SetRequest(cmdCode, req, data) != DM_OK) { + LOGE("set request cmd failed"); + return DM_IPC_FAILED; + } + + LOGI("code = %d, flags= %d.", code, option.GetFlags()); + if (IpcCmdRegister::GetInstance().OnIpcCmd(code, data, reply) == DM_OK) { + return DM_OK; + } + return IpcCmdRegister::GetInstance().ReadResponse(cmdCode, reply, rsp); + + return DM_OK; } } // namespace DistributedHardware diff --git a/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp b/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp index d1b55df74d7923ce86f2fc4f292da7ab7dfd1e2a..76c51b66668634f8024e2561d92d278052a4587c 100644 --- a/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp +++ b/services/devicemanagerservice/src/ipc/standard/ipc_server_stub.cpp @@ -93,7 +93,20 @@ int32_t IpcServerStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Messa int32_t IpcServerStub::SendCmd(int32_t cmdCode, std::shared_ptr req, std::shared_ptr rsp) { LOGI("SendCmd cmdCode: %d", cmdCode); - return DM_OK; + MessageParcel data; + MessageParcel reply; + MessageOption option; + if (IpcCmdRegister::GetInstance().SetRequest(cmdCode, req, data) != DM_OK) { + LOGE("set request cmd failed"); + return DM_IPC_FAILED; + } + + int32_t ret = IpcCmdRegister::GetInstance().OnIpcCmd(cmdCode, data, reply); + if (ret == DM_IPC_NOT_REGISTER_FUNC) { + LOGW("unsupport code: %d", cmdCode); + return IpcCmdRegister::GetInstance().ReadResponse(cmdCode, reply, rsp); + } + return ret; } ServiceRunningState IpcServerStub::QueryServiceState() const