From 22f14190b5df174e7dbdcede0c08ba83c169fa41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E4=B8=8D=E5=87=BA=E5=88=AB=E5=90=8D?= Date: Wed, 15 Sep 2021 20:30:39 +0800 Subject: [PATCH 1/4] codex MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 想不出别名 --- .../src/ipc/lite/ipc_client_stub.cpp | 8 +++++-- .../src/ipc/lite/ipc_cmd_parser.cpp | 11 ---------- .../src/ipc/lite/ipc_cmd_parser.cpp | 6 +++-- .../src/ipc/lite/ipc_server_stub.cpp | 22 ++++++------------- 4 files changed, 17 insertions(+), 30 deletions(-) diff --git a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp index 9ae99e19a..c24231546 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp @@ -36,8 +36,12 @@ static int32_t ClientIpcInterfaceMsgHandle(const IpcContext *ctx, void *ipcMsg, uint32_t code = 0; GetCode(ipcMsg, &code); - DMLOG(DM_LOG_INFO, "receive ipc transact code(%u)", code); - return IpcCmdRegister::GetInstance().OnIpcCmd(code, *io, *ctx, ipcMsg); + int32_t errCode = DEVICEMANAGER_OK; + + errCode = IpcCmdRegister::GetInstance().OnIpcCmd(code, *io, *ctx, ipcMsg); + DMLOG(DM_LOG_INFO, "receive ipc transact code:%u, retCode=%d", code, errCode); + FreeBuffer(ctx, ipcMsg); + return errCode; } int32_t IpcClientStub::Init() diff --git a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp index 2178b0644..f17317b7e 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp @@ -195,7 +195,6 @@ ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, IpcIo &reply, const IpcContext &ctx, void const DmDeviceInfo *deviceInfo = (const DmDeviceInfo*)IpcIoPopFlatObj(&reply, &size); if (pkgName == "" || len == 0 || deviceInfo == NULL) { DMLOG(DM_LOG_ERROR, "OnDeviceOnline, get para failed"); - FreeBuffer(&ctx, ipcMsg); return; } switch (deviceState) { @@ -212,7 +211,6 @@ ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, IpcIo &reply, const IpcContext &ctx, void DMLOG(DM_LOG_ERROR, "unknown device state:%d", deviceState); break; } - FreeBuffer(&ctx, ipcMsg); } ON_IPC_CMD(SERVER_DEVICE_FOUND, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) @@ -224,11 +222,9 @@ ON_IPC_CMD(SERVER_DEVICE_FOUND, IpcIo &reply, const IpcContext &ctx, void *ipcMs const DmDeviceInfo *deviceInfo = (const DmDeviceInfo*)IpcIoPopFlatObj(&reply, &size); if (pkgName == "" || len == 0 || deviceInfo == NULL) { DMLOG(DM_LOG_ERROR, "OnDeviceChanged, get para failed"); - FreeBuffer(&ctx, ipcMsg); return; } DeviceManagerNotify::GetInstance().OnDeviceFound(pkgName, subscribeId, *deviceInfo); - FreeBuffer(&ctx, ipcMsg); } ON_IPC_CMD(SERVER_DISCOVER_FINISH, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) @@ -240,7 +236,6 @@ ON_IPC_CMD(SERVER_DISCOVER_FINISH, IpcIo &reply, const IpcContext &ctx, void *ip if (pkgName == "" || len == 0) { DMLOG(DM_LOG_ERROR, "OnDiscoverySuccess, get para failed"); - FreeBuffer(&ctx, ipcMsg); return; } if (failedReason == DEVICEMANAGER_OK) { @@ -248,7 +243,6 @@ ON_IPC_CMD(SERVER_DISCOVER_FINISH, IpcIo &reply, const IpcContext &ctx, void *ip } else { DeviceManagerNotify::GetInstance().OnDiscoverFailed(pkgName, subscribeId, failedReason); } - FreeBuffer(&ctx, ipcMsg); } ON_IPC_CMD(SERVER_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) @@ -263,11 +257,9 @@ ON_IPC_CMD(SERVER_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void *ipcMsg if (pkgName == "" || len == 0 || deviceId == "" || devIdLen == 0) { DMLOG(DM_LOG_ERROR, "OnAuthResult, get para failed"); - FreeBuffer(&ctx, ipcMsg); return; } DeviceManagerNotify::GetInstance().OnAuthResult(pkgName, deviceId, pinToken, status, reason); - FreeBuffer(&ctx, ipcMsg); } ON_IPC_CMD(SERVER_CHECK_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) @@ -281,11 +273,9 @@ ON_IPC_CMD(SERVER_CHECK_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void * if (pkgName == "" || len == 0 || deviceId == "" || devIdLen == 0) { DMLOG(DM_LOG_ERROR, "OnAuthResult, get para failed"); - FreeBuffer(&ctx, ipcMsg); return; } DeviceManagerNotify::GetInstance().OnCheckAuthResult(pkgName, deviceId, resultCode, flag); - FreeBuffer(&ctx, ipcMsg); } ON_IPC_SET_REQUEST(SERVER_GET_AUTHENTCATION_INFO, std::shared_ptr pBaseReq, IpcIo& request, @@ -363,7 +353,6 @@ ON_IPC_CMD(SERVER_DEVICEMANAGER_FA_NOTIFY, IpcIo &reply, const IpcContext &ctx, std::string paramJson = (const char *)IpcIoPopString(&reply, &jsonLen); DeviceManagerNotify::GetInstance().OnFaCall(packagename, paramJson); IpcIoPushInt32(&reply, DEVICEMANAGER_OK); - FreeBuffer(&ctx, ipcMsg); } } // namespace DistributedHardware } // namespace OHOS diff --git a/services/devicemanagerservice/src/ipc/lite/ipc_cmd_parser.cpp b/services/devicemanagerservice/src/ipc/lite/ipc_cmd_parser.cpp index 45dc5a862..b71b3edfd 100644 --- a/services/devicemanagerservice/src/ipc/lite/ipc_cmd_parser.cpp +++ b/services/devicemanagerservice/src/ipc/lite/ipc_cmd_parser.cpp @@ -161,12 +161,14 @@ ON_IPC_SERVER_CMD(GET_TRUST_DEVICE_LIST, IpcIo &req, IpcIo &reply) ON_IPC_SERVER_CMD(REGISTER_DEVICE_MANAGER_LISTENER, IpcIo &req, IpcIo &reply) { - RegisterDeviceManagerListener(&req, &reply); + int32_t errCode = RegisterDeviceManagerListener(&req, &reply); + IpcIoPushInt32(&reply, errCode); } ON_IPC_SERVER_CMD(UNREGISTER_DEVICE_MANAGER_LISTENER, IpcIo &req, IpcIo &reply) { - UnRegisterDeviceManagerListener(&req, &reply); + int32_t errCode = UnRegisterDeviceManagerListener(&req, &reply); + IpcIoPushInt32(&reply, errCode); } ON_IPC_SERVER_CMD(START_DEVICE_DISCOVER, IpcIo &req, IpcIo &reply) diff --git a/services/devicemanagerservice/src/ipc/lite/ipc_server_stub.cpp b/services/devicemanagerservice/src/ipc/lite/ipc_server_stub.cpp index 775245f59..24bfb9bba 100644 --- a/services/devicemanagerservice/src/ipc/lite/ipc_server_stub.cpp +++ b/services/devicemanagerservice/src/ipc/lite/ipc_server_stub.cpp @@ -77,7 +77,6 @@ static int32_t DeathCb(const IpcContext *context, void *ipcMsg, IpcIo *data, voi sid.token = svcId.token; sid.cookie = svcId.cookie; UnregisterDeathCallback(sid, svcId.cbId); - return DEVICEMANAGER_OK; } @@ -85,13 +84,11 @@ int32_t RegisterDeviceManagerListener(IpcIo *req, IpcIo *reply) { DMLOG(DM_LOG_INFO, "register service listener."); size_t len = 0; - int32_t ret = DEVICEMANAGER_OK; uint8_t *name = IpcIoPopString(req, &len); SvcIdentity *svc = IpcIoPopSvc(req); if (name == NULL || svc == NULL || len == 0) { DMLOG(DM_LOG_ERROR, "get para failed"); - IpcIoPushInt32(reply, ret); - return DEVICEMANAGER_OK; + return DEVICEMANAGER_INVALID_PARAM; } CommonSvcId svcId = {0}; @@ -110,22 +107,18 @@ int32_t RegisterDeviceManagerListener(IpcIo *req, IpcIo *reply) char *pkgName = (char *)malloc(len + 1); if (pkgName == NULL) { DMLOG(DM_LOG_ERROR, "malloc failed!"); - IpcIoPushInt32(reply, DEVICEMANAGER_FAILED); - return DEVICEMANAGER_FAILED; + return DEVICEMANAGER_MALLOC_ERROR; } if (strcpy_s(pkgName, len + 1, (const char *)name) != DEVICEMANAGER_OK) { DMLOG(DM_LOG_ERROR, "strcpy_s failed!"); free(pkgName); - IpcIoPushInt32(reply, DEVICEMANAGER_FAILED); - return DEVICEMANAGER_FAILED; + return DEVICEMANAGER_COPY_FAILED; } uint32_t cbId = 0; RegisterDeathCallback(NULL, sid, DeathCb, pkgName, &cbId); svcId.cbId = cbId; std::string strPkgName = (const char *)name; - ret = IpcServerListenermgr::GetInstance().RegisterListener(strPkgName, &svcId); - IpcIoPushInt32(reply, ret); - return DEVICEMANAGER_OK; + return IpcServerListenermgr::GetInstance().RegisterListener(strPkgName, &svcId); } int32_t UnRegisterDeviceManagerListener(IpcIo *req, IpcIo *reply) @@ -138,7 +131,7 @@ int32_t UnRegisterDeviceManagerListener(IpcIo *req, IpcIo *reply) return DEVICEMANAGER_FAILED; } - CommonSvcId svcId = {0}; + CommonSvcId svcId; if (IpcServerListenermgr::GetInstance().GetListenerByPkgName(pkgName, &svcId) != DEVICEMANAGER_OK) { DMLOG(DM_LOG_ERROR, "not found listener by package name."); return DEVICEMANAGER_FAILED; @@ -148,14 +141,13 @@ int32_t UnRegisterDeviceManagerListener(IpcIo *req, IpcIo *reply) #ifdef __LINUX__ BinderRelease(svcId.ipcCtx, svcId.handle); #endif - SvcIdentity sid = {0}; + SvcIdentity sid; sid.handle = svcId.handle; sid.token = svcId.token; sid.cookie = svcId.cookie; ret = UnregisterDeathCallback(sid, svcId.cbId); } - IpcIoPushInt32(reply, ret); - return DEVICEMANAGER_OK; + return ret; } static const char *GetName(Service *service) -- Gitee From 82796e186a8b2bff4e4b9dd1ba3553cdcbc1f6c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E4=B8=8D=E5=87=BA=E5=88=AB=E5=90=8D?= Date: Thu, 16 Sep 2021 14:59:26 +0800 Subject: [PATCH 2/4] L1 do not support js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 想不出别名 --- BUILD.gn | 1 - .../src/ipc/lite/ipc_client_stub.cpp | 2 +- .../src/ipc/lite/ipc_cmd_parser.cpp | 12 +- interfaces/kits/js/BUILD.gn | 147 ++++++------------ utils/include/ipc/lite/ipc_cmd_register.h | 10 +- utils/src/ipc/lite/ipc_cmd_register.cpp | 4 +- 6 files changed, 59 insertions(+), 117 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index 8029a02d0..103ee5a70 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -18,7 +18,6 @@ if (defined(ohos_lite)) { "utils:devicemanagerutils", "services/devicemanagerservice:devicemanagerservice", "interfaces/inner_kits/native_cpp:devicemanagersdk", - "interfaces/kits/js:devicemanager", ] } } diff --git a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp index c24231546..b500aebb2 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_client_stub.cpp @@ -38,7 +38,7 @@ static int32_t ClientIpcInterfaceMsgHandle(const IpcContext *ctx, void *ipcMsg, GetCode(ipcMsg, &code); int32_t errCode = DEVICEMANAGER_OK; - errCode = IpcCmdRegister::GetInstance().OnIpcCmd(code, *io, *ctx, ipcMsg); + errCode = IpcCmdRegister::GetInstance().OnIpcCmd(code, *io); DMLOG(DM_LOG_INFO, "receive ipc transact code:%u, retCode=%d", code, errCode); FreeBuffer(ctx, ipcMsg); return errCode; diff --git a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp index f17317b7e..679d36e36 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp @@ -186,7 +186,7 @@ ON_IPC_READ_RESPONSE(CHECK_AUTHENTICATION, IpcIo &reply, std::shared_ptr return DEVICEMANAGER_OK; } -ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, IpcIo &reply) { size_t len = 0; std::string pkgName = (const char *)IpcIoPopString(&reply, &len); @@ -213,7 +213,7 @@ ON_IPC_CMD(SERVER_DEVICE_STATE_NOTIFY, IpcIo &reply, const IpcContext &ctx, void } } -ON_IPC_CMD(SERVER_DEVICE_FOUND, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +ON_IPC_CMD(SERVER_DEVICE_FOUND, IpcIo &reply) { size_t len = 0; std::string pkgName = (const char *)IpcIoPopString(&reply, &len); @@ -227,7 +227,7 @@ ON_IPC_CMD(SERVER_DEVICE_FOUND, IpcIo &reply, const IpcContext &ctx, void *ipcMs DeviceManagerNotify::GetInstance().OnDeviceFound(pkgName, subscribeId, *deviceInfo); } -ON_IPC_CMD(SERVER_DISCOVER_FINISH, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +ON_IPC_CMD(SERVER_DISCOVER_FINISH, IpcIo &reply) { size_t len = 0; std::string pkgName = (const char *)IpcIoPopString(&reply, &len); @@ -245,7 +245,7 @@ ON_IPC_CMD(SERVER_DISCOVER_FINISH, IpcIo &reply, const IpcContext &ctx, void *ip } } -ON_IPC_CMD(SERVER_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +ON_IPC_CMD(SERVER_AUTH_RESULT, IpcIo &reply) { size_t len = 0; std::string pkgName = (const char *)IpcIoPopString(&reply, &len); @@ -262,7 +262,7 @@ ON_IPC_CMD(SERVER_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void *ipcMsg DeviceManagerNotify::GetInstance().OnAuthResult(pkgName, deviceId, pinToken, status, reason); } -ON_IPC_CMD(SERVER_CHECK_AUTH_RESULT, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +ON_IPC_CMD(SERVER_CHECK_AUTH_RESULT, IpcIo &reply) { size_t len = 0; std::string pkgName = (const char *)IpcIoPopString(&reply, &len); @@ -345,7 +345,7 @@ ON_IPC_READ_RESPONSE(SERVER_USER_AUTHORIZATION_OPERATION, IpcIo& reply, std::sha return DEVICEMANAGER_OK; } -ON_IPC_CMD(SERVER_DEVICEMANAGER_FA_NOTIFY, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +ON_IPC_CMD(SERVER_DEVICEMANAGER_FA_NOTIFY, IpcIo &reply) { size_t len = 0; std::string packagename = (const char *)IpcIoPopString(&reply, &len); diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index b82cf50ab..5c6777207 100644 --- a/interfaces/kits/js/BUILD.gn +++ b/interfaces/kits/js/BUILD.gn @@ -11,115 +11,58 @@ # See the License for the specific language governing permissions and # limitations under the License. -if (defined(ohos_lite)) { - import("//build/lite/config/component/lite_component.gni") -} else { - import("//build/ohos.gni") -} +import("//build/ohos.gni") import("//foundation/distributedhardware/devicemanager/devicemanager.gni") -if (defined(ohos_lite)) { - shared_library("devicemanager") { - include_dirs = [ - "//third_party/node/src", - "//third_party/json/include", - "${common_path}/include", - "//foundation/ace/napi/native_engine", - "//foundation/ace/napi/interfaces/kits", - "//utils/native/base/include", - "include", - "${utils_path}/include/log", - "${common_path}/include/ipc", - "${common_path}/include/ipc/model", - "${common_path}/include/ipc/lite", - "${innerkits_path}/native_cpp/include", - ] - include_dirs += [ - "//utils/native/lite/include", - "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits/hilog", - "//third_party/bounds_checking_function/include", - "//foundation/communication/ipc_lite/interfaces/kits", - "//foundation/distributedschedule/samgr_lite/interfaces/kits/samgr", - ] - - sources = [ - "src/dm_native_event.cpp", - "src/native_devicemanager_js.cpp", - ] - - deps = [ - "${utils_path}:devicemanagerutils", - "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared", - "//foundation/communication/ipc_lite:liteipc_adapter", - "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk", - "//foundation/distributedschedule/samgr_lite/samgr:samgr", - "//third_party/bounds_checking_function:libsec_shared", - "//utils/native/lite:utils", - ] +ohos_shared_library("devicemanager") { + include_dirs = [ + "//third_party/node/src", + "//third_party/json/include", + "${common_path}/include", + "//foundation/ace/napi/native_engine", + "//foundation/ace/napi/interfaces/kits", + "//utils/native/base/include", + "include", + "${utils_path}/include/log", + "${common_path}/include/ipc", + "${innerkits_path}/native_cpp/include", + "${innerkits_path}/native_cpp/include/standard", + ] - cflags_cc = build_flags + sources = [ + "src/dm_native_event.cpp", + "src/native_devicemanager_js.cpp", + ] - defines = [ - "LITE_DEVICE", - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"devicemanagerkit_js\"", - "LOG_DOMAIN=0xD004100", - ] - } - group("devicemanager_native_js") { - deps = [ ":devicemanager" ] - } -} else { - ohos_shared_library("devicemanager") { - include_dirs = [ - "//third_party/node/src", - "//third_party/json/include", - "${common_path}/include", - "//foundation/ace/napi/native_engine", - "//foundation/ace/napi/interfaces/kits", - "//utils/native/base/include", - "include", - "${utils_path}/include/log", - "${common_path}/include/ipc", - "${innerkits_path}/native_cpp/include", - "${innerkits_path}/native_cpp/include/standard", - ] + deps = [ + "${utils_path}:devicemanagerutils", + "//foundation/ace/napi:ace_napi", + "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk", + "//utils/native/base:utils", + ] - sources = [ - "src/dm_native_event.cpp", - "src/native_devicemanager_js.cpp", - ] + cflags_cc = build_flags - deps = [ - "${utils_path}:devicemanagerutils", - "//foundation/ace/napi:ace_napi", - "//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk", - "//utils/native/base:utils", - ] + defines = [ + "HI_LOG_ENABLE", + "DH_LOG_TAG=\"devicemanagerkit_js\"", + "LOG_DOMAIN=0xD004100", + ] - cflags_cc = build_flags + external_deps = [ + "appexecfwk_standard:appexecfwk_base", + "appexecfwk_standard:appexecfwk_core", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_core", + "safwk:system_ability_fwk", + "samgr_L2:samgr_proxy", + ] - defines = [ - "HI_LOG_ENABLE", - "DH_LOG_TAG=\"devicemanagerkit_js\"", - "LOG_DOMAIN=0xD004100", - ] - - external_deps = [ - "appexecfwk_standard:appexecfwk_base", - "appexecfwk_standard:appexecfwk_core", - "hiviewdfx_hilog_native:libhilog", - "ipc:ipc_core", - "safwk:system_ability_fwk", - "samgr_L2:samgr_proxy", - ] - - subsystem_name = "distributedhardware" - relative_install_dir = "module/distributedhardware" - part_name = "device_manager_base" - } + subsystem_name = "distributedhardware" + relative_install_dir = "module/distributedhardware" + part_name = "device_manager_base" +} - group("devicemanager_native_js") { - deps = [ ":devicemanager" ] - } +group("devicemanager_native_js") { + deps = [ ":devicemanager" ] } diff --git a/utils/include/ipc/lite/ipc_cmd_register.h b/utils/include/ipc/lite/ipc_cmd_register.h index 6b52515aa..36c20961f 100644 --- a/utils/include/ipc/lite/ipc_cmd_register.h +++ b/utils/include/ipc/lite/ipc_cmd_register.h @@ -49,8 +49,8 @@ namespace DistributedHardware { IpcRegisterReadResponseFunc##cmdCode g_IpcRegisterReadResponseFunc##cmdCode; \ static int32_t IpcReadResponse##cmdCode(paraA, paraB) \ -#define ON_IPC_CMD(cmdCode, paraA, paraB, paraC) \ - static void IpcCmdProcess##cmdCode(paraA, paraB, paraC); \ +#define ON_IPC_CMD(cmdCode, paraA) \ + static void IpcCmdProcess##cmdCode(paraA); \ struct IpcRegisterCmdProcessFunc##cmdCode { \ IpcRegisterCmdProcessFunc##cmdCode() \ { \ @@ -58,7 +58,7 @@ namespace DistributedHardware { } \ }; \ IpcRegisterCmdProcessFunc##cmdCode g_IpcRegisterCmdProcessFunc##cmdCode; \ - static void IpcCmdProcess##cmdCode(paraA, paraB, paraC) \ + static void IpcCmdProcess##cmdCode(paraA) \ #define ON_IPC_SERVER_CMD(cmdCode, paraA, paraB) \ static void IpcServerCmdProcess##cmdCode(paraA, paraB); \ @@ -75,7 +75,7 @@ namespace DistributedHardware { using SetIpcRequestFunc = int32_t (*)(std::shared_ptr pBaseReq, IpcIo &request, uint8_t *buffer, size_t bufferLen); using ReadResponseFunc = int32_t (*)(IpcIo &reply, std::shared_ptr pBaseRsp); -using OnIpcCmdFunc = void (*)(IpcIo &reply, const IpcContext &ctx, void *ipcMsg); +using OnIpcCmdFunc = void (*)(IpcIo &reply); using OnIpcServerCmdFunc = void (*)(IpcIo &req, IpcIo &reply); class IpcCmdRegister { @@ -100,7 +100,7 @@ public: int32_t SetRequest(int32_t cmdCode, std::shared_ptr pBaseReq, IpcIo &request, uint8_t *buffer, size_t buffLen); int32_t ReadResponse(int32_t cmdCode, IpcIo &reply, std::shared_ptr pBaseRsp); - int32_t OnIpcCmd(int32_t cmdCode, IpcIo &reply, const IpcContext &ctx, void *ipcMsg); + int32_t OnIpcCmd(int32_t cmdCode, IpcIo &reply); int32_t OnIpcServerCmd(int32_t cmdCode, IpcIo &req, IpcIo &reply); private: std::unordered_map setIpcRequestFuncMap_; diff --git a/utils/src/ipc/lite/ipc_cmd_register.cpp b/utils/src/ipc/lite/ipc_cmd_register.cpp index 8faa2a22b..4fbab5a16 100644 --- a/utils/src/ipc/lite/ipc_cmd_register.cpp +++ b/utils/src/ipc/lite/ipc_cmd_register.cpp @@ -43,14 +43,14 @@ int32_t IpcCmdRegister::ReadResponse(int32_t cmdCode, IpcIo &reply, std::shared_ return (readResponseMapIter->second)(reply, pBaseRsp); } -int32_t IpcCmdRegister::OnIpcCmd(int32_t cmdCode, IpcIo &reply, const IpcContext &ctx, void *ipcMsg) +int32_t IpcCmdRegister::OnIpcCmd(int32_t cmdCode, IpcIo &reply) { auto onIpcCmdMapIter = onIpcCmdFuncMap_.find(cmdCode); if (onIpcCmdMapIter == onIpcCmdFuncMap_.end()) { DMLOG(DM_LOG_ERROR, "cmdCode:%d not register OnIpcCmdFunc", cmdCode); return DEVICEMANAGER_IPC_NOT_REGISTER_FUNC; } - (onIpcCmdMapIter->second)(reply, ctx, ipcMsg); + (onIpcCmdMapIter->second)(reply); return DEVICEMANAGER_OK; } -- Gitee From 759c650bf1d14ff17647ea184a2398887503dbf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E4=B8=8D=E5=87=BA=E5=88=AB=E5=90=8D?= Date: Thu, 16 Sep 2021 15:08:58 +0800 Subject: [PATCH 3/4] L1 do not support js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 想不出别名 --- interfaces/inner_kits/native_cpp/include/dm_device_info.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/include/dm_device_info.h b/interfaces/inner_kits/native_cpp/include/dm_device_info.h index 45ccf822c..076a2c007 100644 --- a/interfaces/inner_kits/native_cpp/include/dm_device_info.h +++ b/interfaces/inner_kits/native_cpp/include/dm_device_info.h @@ -21,7 +21,7 @@ #include "dm_app_image_info.h" #define DM_MAX_DEVICE_ID_LEN (96) -#define DM_MAX_DEVICE_NAME_LEN (65) +#define DM_MAX_DEVICE_NAME_LEN (128) namespace OHOS { namespace DistributedHardware { -- Gitee From e15b6ca516de7ed7a27edd3100856e344abfa64f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=83=B3=E4=B8=8D=E5=87=BA=E5=88=AB=E5=90=8D?= Date: Thu, 16 Sep 2021 15:20:36 +0800 Subject: [PATCH 4/4] L1 do not support js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 想不出别名 --- interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp index 679d36e36..bd67cd215 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/lite/ipc_cmd_parser.cpp @@ -352,7 +352,6 @@ ON_IPC_CMD(SERVER_DEVICEMANAGER_FA_NOTIFY, IpcIo &reply) size_t jsonLen = 0; std::string paramJson = (const char *)IpcIoPopString(&reply, &jsonLen); DeviceManagerNotify::GetInstance().OnFaCall(packagename, paramJson); - IpcIoPushInt32(&reply, DEVICEMANAGER_OK); } } // namespace DistributedHardware } // namespace OHOS -- Gitee