diff --git a/common/include/dm_constants.h b/common/include/dm_constants.h index 1206f3909740ac8325d19fdcb5f1a940afb2e817..f740600be92627aaf066c3a83ebfb2afdaa00f90 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 b17b597b186a7fcf4c7105f14860de42683ebb63..bf37c5ab5d459c8613df9abd31c431e2785af8d1 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 be759e55e1057e56de3f5f2561f2fa21f8947279..bcb3fe5a9b3cc037bc0d41b91b658fa41f35668b 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 4137339229c406342a6e13d77446dd981972f045..5162e037c05d545ef479ab1aa994948e770fc9c1 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; }