From e81f948116aeb3ded9392a1571126fad379ba4a4 Mon Sep 17 00:00:00 2001 From: wangyb0625 Date: Mon, 14 Feb 2022 16:04:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0networkId?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/include/dm_constants.h | 2 ++ .../inner_kits/native_cpp/include/dm_device_info.h | 1 + .../native_cpp/src/ipc/standard/ipc_cmd_parser.cpp | 10 ++++++++++ .../src/dependency/softbus/softbus_connector.cpp | 1 + 4 files changed, 14 insertions(+) diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 1206f3909..f740600be 100644 --- a/common/include/dm_constants.h +++ b/common/include/dm_constants.h @@ -101,6 +101,8 @@ const std::string TAG_GROUP_NAME = "GROUPNAME"; const std::string TAG_REQUEST_ID = "REQUESTID"; const std::string TAG_DEVICE_ID = "DEVICEID"; const std::string TAG_LOCAL_DEVICE_ID = "LOCALDEVICEID"; +const std::string TAG_NETWORK_ID = "NETWORKID"; +const std::string TAG_LOCAL_NETWORK_ID = "LOCALNETWORKID"; const std::string TAG_DEVICE_TYPE = "DEVICETYPE"; const std::string TAG_APP_NAME = "APPNAME"; const std::string TAG_APP_DESCRIPTION = "APPDESC"; 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 b17b597b1..bf37c5ab5 100644 --- a/interfaces/inner_kits/native_cpp/include/dm_device_info.h +++ b/interfaces/inner_kits/native_cpp/include/dm_device_info.h @@ -49,6 +49,7 @@ typedef struct DmDeviceInfo { char deviceId[DM_MAX_DEVICE_ID_LEN]; char deviceName[DM_MAX_DEVICE_NAME_LEN]; uint16_t deviceTypeId; + std::string networkId; } DmDeviceInfo; typedef struct DmAuthParam { diff --git a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp index be759e55e..bcb3fe5a9 100644 --- a/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp +++ b/interfaces/inner_kits/native_cpp/src/ipc/standard/ipc_cmd_parser.cpp @@ -233,6 +233,7 @@ ON_IPC_SET_REQUEST(AUTHENTICATE_DEVICE, std::shared_ptr pBaseReq, Messag int32_t authType = pReq->GetAuthType(); DmDeviceInfo deviceInfo = pReq->GetDeviceInfo(); std::string deviceId = deviceInfo.deviceId; + std::string networkId = deviceInfo.networkId; if (!data.WriteString(pkgName)) { LOGE("write pkgName failed"); @@ -246,6 +247,10 @@ ON_IPC_SET_REQUEST(AUTHENTICATE_DEVICE, std::shared_ptr pBaseReq, Messag LOGE("write extra failed"); return DM_IPC_FLATTEN_OBJECT; } + if (!data.WriteString(networkId)) { + LOGE("write extra failed"); + return DM_IPC_FLATTEN_OBJECT; + } if (!data.WriteInt32(authType)) { LOGE("write pkgName failed"); return DM_IPC_FLATTEN_OBJECT; @@ -265,6 +270,7 @@ ON_IPC_SET_REQUEST(UNAUTHENTICATE_DEVICE, std::shared_ptr pBaseReq, Mess std::string pkgName = pReq->GetPkgName(); DmDeviceInfo deviceInfo = pReq->GetDeviceInfo(); std::string deviceId = deviceInfo.deviceId; + std::string networkId = deviceInfo.networkId; if (!data.WriteString(pkgName)) { LOGE("write pkgName failed"); return DM_IPC_FLATTEN_OBJECT; @@ -273,6 +279,10 @@ ON_IPC_SET_REQUEST(UNAUTHENTICATE_DEVICE, std::shared_ptr pBaseReq, Mess LOGE("write extra failed"); return DM_IPC_FLATTEN_OBJECT; } + if (!data.WriteString(networkId)) { + LOGE("write extra failed"); + return DM_IPC_FLATTEN_OBJECT; + } return DM_OK; } diff --git a/services/devicemanagerservice/src/dependency/softbus/softbus_connector.cpp b/services/devicemanagerservice/src/dependency/softbus/softbus_connector.cpp index 413733922..5162e037c 100644 --- a/services/devicemanagerservice/src/dependency/softbus/softbus_connector.cpp +++ b/services/devicemanagerservice/src/dependency/softbus/softbus_connector.cpp @@ -407,6 +407,7 @@ int32_t SoftbusConnector::CovertNodeBasicInfoToDmDevice(const NodeBasicInfo &nod std::min(sizeof(dmDeviceInfo.deviceName), sizeof(nodeBasicInfo.deviceName))) != DM_OK) { LOGE("copy data failed"); } + dmDeviceInfo.networkId = nodeBasicInfo.networkId; dmDeviceInfo.deviceTypeId = nodeBasicInfo.deviceTypeId; return DM_OK; } -- Gitee