L1 do not support js

Signed-off-by: 想不出别名 <zhengjianming1@huawei.com>
This commit is contained in:
想不出别名
2021-09-16 15:17:46 +08:00
parent e1aa0acd9f
commit a52dd02651
6 changed files with 60 additions and 119 deletions
-1
View File
@@ -18,7 +18,6 @@ if (defined(ohos_lite)) {
"utils:devicemanagerutils",
"services/devicemanagerservice:devicemanagerservice",
"interfaces/inner_kits/native_cpp:devicemanagersdk",
"interfaces/kits/js:devicemanager",
]
}
}
@@ -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;
@@ -186,7 +186,7 @@ ON_IPC_READ_RESPONSE(CHECK_AUTHENTICATION, IpcIo &reply, std::shared_ptr<IpcRsp>
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
+46 -103
View File
@@ -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",
]
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",
]
sources = [
"src/dm_native_event.cpp",
"src/native_devicemanager_js.cpp",
]
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",
]
deps = [
"${utils_path}:devicemanagerutils",
"//foundation/ace/napi:ace_napi",
"//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk",
"//utils/native/base:utils",
]
cflags_cc = build_flags
cflags_cc = build_flags
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",
]
defines = [
"HI_LOG_ENABLE",
"DH_LOG_TAG=\"devicemanagerkit_js\"",
"LOG_DOMAIN=0xD004100",
]
sources = [
"src/dm_native_event.cpp",
"src/native_devicemanager_js.cpp",
]
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",
]
deps = [
"${utils_path}:devicemanagerutils",
"//foundation/ace/napi:ace_napi",
"//foundation/distributedhardware/devicemanager/interfaces/inner_kits/native_cpp:devicemanagersdk",
"//utils/native/base:utils",
]
cflags_cc = build_flags
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"
}
group("devicemanager_native_js") {
deps = [ ":devicemanager" ]
}
subsystem_name = "distributedhardware"
relative_install_dir = "module/distributedhardware"
part_name = "device_manager_base"
}
group("devicemanager_native_js") {
deps = [ ":devicemanager" ]
}
+5 -5
View File
@@ -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<IpcReq> pBaseReq, IpcIo &request,
uint8_t *buffer, size_t bufferLen);
using ReadResponseFunc = int32_t (*)(IpcIo &reply, std::shared_ptr<IpcRsp> 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<IpcReq> pBaseReq, IpcIo &request,
uint8_t *buffer, size_t buffLen);
int32_t ReadResponse(int32_t cmdCode, IpcIo &reply, std::shared_ptr<IpcRsp> 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<int32_t, SetIpcRequestFunc> setIpcRequestFuncMap_;
+2 -2
View File
@@ -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;
}