diff --git a/BUILD.gn b/BUILD.gn index 8029a02d09bb9c83c5be29f81b9bf9efc6e23fc1..103ee5a70e69c1309143f9098d8f0df71bab2161 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 c24231546ac2c9e70a85d6dead2751dcdec04a64..b500aebb246b669759422f50635686075bcd00ef 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 f17317b7eeec6f58abec3042965708aceddf9c84..bd67cd215b5b3f1849ed7d7ff4f6c11f99a055bd 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,14 +345,13 @@ 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); 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 diff --git a/interfaces/kits/js/BUILD.gn b/interfaces/kits/js/BUILD.gn index b82cf50ab0c1d97895fad10b1e26d8bcd3635dc4..5c67772074611715ef11ffe03784a1318d1b537c 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 6b52515aa332d2e63c2a66fe1f071b3cfd58a902..36c20961f2fa659fdcc9c6e403d199484f853803 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 8faa2a22bf2e70fcb9473c2235a9ad4ca12085a9..4fbab5a16f3cca12e26327734274f41df837f76d 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; }