From 33dc8b075f28433735f679227b125a3251a662b9 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 06:33:33 +0000 Subject: [PATCH 01/20] tsy Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/IWifiService.idl | 49 +++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 wifi/frameworks/native/IWifiService.idl diff --git a/wifi/frameworks/native/IWifiService.idl b/wifi/frameworks/native/IWifiService.idl new file mode 100644 index 000000000..8bff0bad7 --- /dev/null +++ b/wifi/frameworks/native/IWifiService.idl @@ -0,0 +1,49 @@ +# Copyright (C) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +import OHOS.Wifi.IWifiScanCallback; +sequenceable OHOS.Wifi.ScanControlInfo; +sequenceable OHOS.Wifi.WifiScanParams; +sequenceable OHOS.Wifi.WifiScanInfo; +sequenceable OHOS.Wifi.WifiInfoElem; + +interface OHOS.Wifi.IWifiService { + void SetScanControlInfo([in] ScanControlInfo info); + void Scan([in] boolean compatible, [in] String bundleName); + void AdvanceScan([in] WifiScanParams params, [in] String bundleName); + void IsWifiClosedScan([out] boolean bOpen); + + void GetScanInfoList( + [in] boolean compatible, + [out] int retCode, + [out] unsigned int[] allSize, + [out] Ashmem scanInfoAshmem + ); + + void RegisterCallBack( + [in] IWifiScanCallback callback, + [in] int pid, + [in] int tokenId, + [in] String[] event + ); + + void GetSupportedFeatures([out] long features); + void SetScanOnlyAvailable([in] boolean bScanOnlyAvailable); + void GetScanOnlyAvailable([out] boolean bScanOnlyAvailable); + void StartWifiPnoScan( + [in] boolean isStartAction, + [in] int periodMs, + [in] int suspendReason + ); +} -- Gitee From 8ddb0a06200dad34ceda42cbb9c98ec5e298d375 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 06:51:27 +0000 Subject: [PATCH 02/20] tsy Signed-off-by: chen yi wen <15068825070@163.com> --- .../native/scan_control_info_parcel.cpp | 68 +++++++++++ .../native/scan_control_info_parcel.h | 22 ++++ .../native/wifi_info_elem_parcel.cpp | 52 ++++++++ .../frameworks/native/wifi_info_elem_parcel.h | 19 +++ .../native/wifi_scan_info_parcel.cpp | 112 ++++++++++++++++++ .../frameworks/native/wifi_scan_info_parcel.h | 52 ++++++++ .../native/wifi_scan_params_parcel.cpp | 53 +++++++++ .../native/wifi_scan_params_parcel.h | 22 ++++ 8 files changed, 400 insertions(+) create mode 100644 wifi/frameworks/native/scan_control_info_parcel.cpp create mode 100644 wifi/frameworks/native/scan_control_info_parcel.h create mode 100644 wifi/frameworks/native/wifi_info_elem_parcel.cpp create mode 100644 wifi/frameworks/native/wifi_info_elem_parcel.h create mode 100644 wifi/frameworks/native/wifi_scan_info_parcel.cpp create mode 100644 wifi/frameworks/native/wifi_scan_info_parcel.h create mode 100644 wifi/frameworks/native/wifi_scan_params_parcel.cpp create mode 100644 wifi/frameworks/native/wifi_scan_params_parcel.h diff --git a/wifi/frameworks/native/scan_control_info_parcel.cpp b/wifi/frameworks/native/scan_control_info_parcel.cpp new file mode 100644 index 000000000..7a2bd3f30 --- /dev/null +++ b/wifi/frameworks/native/scan_control_info_parcel.cpp @@ -0,0 +1,68 @@ +#include "scan_control_info_parcel.h" + +namespace OHOS { +namespace Wifi { +bool ScanControlInfo::Marshalling(Parcel &parcel) const +{ + // 序列化scanForbidList + if (!parcel.WriteUint32(scanForbidList.size())) + return false; + for (const auto &item : scanForbidList) { + if (!parcel.WriteInt32(item.scanScene) || !parcel.WriteInt32(item.scanMode) || + !parcel.WriteInt32(item.forbidTime) || !parcel.WriteInt32(item.forbidCount)) { + return false; + } + } + + // 序列化scanIntervalList + if (!parcel.WriteUint32(scanIntervalList.size())) + return false; + for (const auto &item : scanIntervalList) { + if (!parcel.WriteInt32(item.scanScene) || !parcel.WriteInt32(item.scanMode) || + !parcel.WriteBool(item.isSingle) || !parcel.WriteInt32(item.intervalMode) || + !parcel.WriteInt32(item.interval) || !parcel.WriteInt32(item.count)) { + return false; + } + } + return true; +} + +ScanControlInfo *ScanControlInfo::Unmarshalling(Parcel &parcel) +{ + std::unique_ptr info(new ScanControlInfo()); + uint32_t size = 0; + + // 反序列化 scanForbidList + if (!parcel.ReadUint32(size)) + return nullptr; + info->scanForbidList.reserve(size); // 预分配内存提高性能 + + for (uint32_t i = 0; i < size; i++) { + ScanForbidMode forbid; + if (!parcel.ReadInt32(forbid.scanScene) || !parcel.ReadInt32(forbid.scanMode) || + !parcel.ReadInt32(forbid.forbidTime) || !parcel.ReadInt32(forbid.forbidCount)) { + return nullptr; // 自动释放内存 + } + info->scanForbidList.push_back(forbid); + } + + // 反序列化 scanIntervalList + if (!parcel.ReadUint32(size)) + return nullptr; + info->scanIntervalList.reserve(size); // 预分配内存提高性能 + + for (uint32_t i = 0; i < size; i++) { + ScanInterval interval; + if (!parcel.ReadInt32(interval.scanScene) || !parcel.ReadInt32(interval.scanMode) || + !parcel.ReadBool(interval.isSingle) || !parcel.ReadInt32(interval.intervalMode) || + !parcel.ReadInt32(interval.interval) || !parcel.ReadInt32(interval.count)) { + return nullptr; // 自动释放内存 + } + info->scanIntervalList.push_back(interval); + } + + // 转移所有权给调用者 + return info.release(); +} +} // namespace Wifi +} // namespace OHOS \ No newline at end of file diff --git a/wifi/frameworks/native/scan_control_info_parcel.h b/wifi/frameworks/native/scan_control_info_parcel.h new file mode 100644 index 000000000..04018dc1c --- /dev/null +++ b/wifi/frameworks/native/scan_control_info_parcel.h @@ -0,0 +1,22 @@ +#ifndef SCAN_CONTROL_INFO_PARCEL_H +#define SCAN_CONTROL_INFO_PARCEL_H + +#include "parcel.h" +#include +#include "wifi_scan_msg.h" + +namespace OHOS { +namespace Wifi { + +class ScanControlInfo : public Parcelable { +public: + std::vector scanForbidList; + std::vector scanIntervalList; + + bool Marshalling(Parcel &parcel) const override; + static ScanControlInfo *Unmarshalling(Parcel &parcel); +}; +} // namespace Wifi +} // namespace OHOS + +#endif // SCAN_CONTROL_INFO_PARCEL_H diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp new file mode 100644 index 000000000..12664eef0 --- /dev/null +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -0,0 +1,52 @@ +#include "wifi_info_elem_parcel.h" + +namespace OHOS { +namespace Wifi { +bool WifiInfoElem::Marshalling(Parcel &parcel) const +{ + if (!parcel.WriteUint32(id)) + return false; + + // 序列化内容 + if (!parcel.WriteUint32(content.size())) + return false; + for (char c : content) { + if (!parcel.WriteInt8(c)) + return false; + } + return true; +} + +WifiInfoElem *WifiInfoElem::Unmarshalling(Parcel &parcel) +{ + // 使用 unique_ptr 自动管理内存 + std::unique_ptr elem(new WifiInfoElem()); + + // 读取 id + if (!parcel.ReadUint32(elem->id)) { + return nullptr; // 自动释放内存 + } + + // 读取内容大小 + uint32_t size = 0; + if (!parcel.ReadUint32(size)) { + return nullptr; // 自动释放内存 + } + + // 预分配内存提高性能 + elem->content.reserve(size); + + // 读取每个字节内容 + for (uint32_t i = 0; i < size; i++) { + int8_t c = 0; + if (!parcel.ReadInt8(c)) { + return nullptr; // 自动释放内存 + } + elem->content.push_back(static_cast(c)); + } + + // 转移所有权给调用者 + return elem.release(); +} +} // namespace Wifi +} // namespace OHOS \ No newline at end of file diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.h b/wifi/frameworks/native/wifi_info_elem_parcel.h new file mode 100644 index 000000000..bc9ec9c2f --- /dev/null +++ b/wifi/frameworks/native/wifi_info_elem_parcel.h @@ -0,0 +1,19 @@ +#ifndef WIFI_INFO_ELEM_PARCEL_H +#define WIFI_INFO_ELEM_PARCEL_H + +#include "parcel.h" +#include + +namespace OHOS { +namespace Wifi { +struct WifiInfoElem : public Parcelable { + uint32_t id; + std::vector content; + + bool Marshalling(Parcel &parcel) const override; + static WifiInfoElem *Unmarshalling(Parcel &parcel); +}; +} // namespace Wifi +} // namespace OHOS + +#endif // WIFI_INFO_ELEM_PARCEL_H \ No newline at end of file diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.cpp b/wifi/frameworks/native/wifi_scan_info_parcel.cpp new file mode 100644 index 000000000..a11831dde --- /dev/null +++ b/wifi/frameworks/native/wifi_scan_info_parcel.cpp @@ -0,0 +1,112 @@ +# Copyright (C) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#include "wifi_scan_info_parcel.h" + +namespace OHOS { +namespace Wifi { +bool WifiScanInfo::Marshalling(Parcel &parcel) const +{ + // 序列化基本字段 + if (!parcel.WriteString(bssid) || + !parcel.WriteString(ssid) || + !parcel.WriteInt32(bssidType) || + !parcel.WriteString(capabilities) || + !parcel.WriteInt32(frequency) || + !parcel.WriteInt32(band) || + !parcel.WriteInt32(channelWidth) || + !parcel.WriteInt32(centerFrequency0) || + !parcel.WriteInt32(centerFrequency1) || + !parcel.WriteInt32(rssi) || + !parcel.WriteInt32(securityType)) { + return false; + } + + // 序列化信息元素向量 + if (!parcel.WriteUint32(infoElems.size())) return false; + for (const auto& elem : infoElems) { + if (!elem.Marshalling(parcel)) return false; + } + + // 序列化剩余字段 + if (!parcel.WriteInt64(features) || + !parcel.WriteInt64(timestamp) || + !parcel.WriteInt32(wifiStandard) || + !parcel.WriteInt32(maxSupportedRxLinkSpeed) || + !parcel.WriteInt32(maxSupportedTxLinkSpeed) || + !parcel.WriteInt32(disappearCount) || + !parcel.WriteInt32(isHiLinkNetwork) || + !parcel.WriteInt32(supportedWifiCategory)) { + return false; + } + + return true; +} + +WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) +{ + // 使用 unique_ptr 自动管理内存 + std::unique_ptr info(new WifiScanInfo()); + + // 反序列化基本字符串字段 + info->bssid = parcel.ReadString(); + info->ssid = parcel.ReadString(); + + // 反序列化整型字段 + if (!parcel.ReadInt32(info->bssidType) || + !parcel.ReadString(info->capabilities) || + !parcel.ReadInt32(info->frequency) || + !parcel.ReadInt32(info->band) || + !parcel.ReadInt32(info->channelWidth) || + !parcel.ReadInt32(info->centerFrequency0) || + !parcel.ReadInt32(info->centerFrequency1) || + !parcel.ReadInt32(info->rssi) || + !parcel.ReadInt32(info->securityType)) { + return nullptr; + } + + // 反序列化信息元素向量 + uint32_t elemCount = 0; + if (!parcel.ReadUint32(elemCount)) return nullptr; + + info->infoElems.reserve(elemCount); // 预分配内存提高性能 + + for (uint32_t i = 0; i < elemCount; i++) { + // 使用 unique_ptr 管理临时元素 + std::unique_ptr elem( + WifiInfoElem::Unmarshalling(parcel) + ); + + if (!elem) return nullptr; // 反序列化失败 + + // 移动元素到 vector 中 + info->infoElems.push_back(std::move(*elem)); + // elem 自动释放 + } + + // 反序列化剩余字段 + if (!parcel.ReadInt64(info->features) || + !parcel.ReadInt64(info->timestamp) || + !parcel.ReadInt32(info->wifiStandard) || + !parcel.ReadInt32(info->maxSupportedRxLinkSpeed) || + !parcel.ReadInt32(info->maxSupportedTxLinkSpeed) || + !parcel.ReadInt32(info->disappearCount) || + !parcel.ReadInt32(info->isHiLinkNetwork) || + !parcel.ReadInt32(info->supportedWifiCategory)) { + return nullptr; + } + + // 转移所有权给调用者 + return info.release(); +} +} // namespace Wifi +} // namespace OHOS \ No newline at end of file diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.h b/wifi/frameworks/native/wifi_scan_info_parcel.h new file mode 100644 index 000000000..6647b33dd --- /dev/null +++ b/wifi/frameworks/native/wifi_scan_info_parcel.h @@ -0,0 +1,52 @@ +# Copyright (C) 2025 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#ifndef WIFI_SCAN_INFO_PARCEL_H +#define WIFI_SCAN_INFO_PARCEL_H + +#include "parcel.h" +#include "wifi_scan_msg.h" +#include "wifi_info_elem_parcel.h" +#include +#include + +namespace OHOS { +namespace Wifi { +struct WifiScanInfo : public Parcelable { + std::string bssid; + std::string ssid; + int bssidType; + std::string capabilities; + int frequency; + int band; + int channelWidth; // 枚举类型 + int centerFrequency0; + int centerFrequency1; + int rssi; + int securityType; // 枚举类型 + std::vector infoElems; + int64_t features; + int64_t timestamp; + int wifiStandard; + int maxSupportedRxLinkSpeed; + int maxSupportedTxLinkSpeed; + int disappearCount; + int isHiLinkNetwork; + int supportedWifiCategory; // 枚举类型 + + bool Marshalling(Parcel &parcel) const override; + static WifiScanInfo *Unmarshalling(Parcel &parcel); +}; +} // namespace Wifi +} // namespace OHOS + +#endif // WIFI_SCAN_INFO_PARCEL_H \ No newline at end of file diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp new file mode 100644 index 000000000..93cc80be7 --- /dev/null +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -0,0 +1,53 @@ +#include "wifi_scan_params_parcel.h" + +namespace OHOS { +namespace Wifi { +bool WifiScanParams::Marshalling(Parcel &parcel) const +{ + if (!parcel.WriteString(ssid)) return false; + if (!parcel.WriteString(bssid)) return false; + if (!parcel.WriteInt32(band)) return false; + + // 序列化频率列表 + if (!parcel.WriteUint32(freqs.size())) return false; + for (int freq : freqs) { + if (!parcel.WriteInt32(freq)) return false; + } + return true; +} + +WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) +{ + // 使用 unique_ptr 自动管理内存 + std::unique_ptr params(new WifiScanParams()); + + // 反序列化字符串字段 + params->ssid = parcel.ReadString(); + params->bssid = parcel.ReadString(); + + // 反序列化 band 字段 + if (!parcel.ReadInt32(params->band)) { + return nullptr; + } + + // 反序列化频率向量 + uint32_t size = 0; + if (!parcel.ReadUint32(size)) { + return nullptr; + } + + params->freqs.reserve(size); // 预分配内存提高性能 + + for (uint32_t i = 0; i < size; i++) { + int freq = 0; + if (!parcel.ReadInt32(freq)) { + return nullptr; + } + params->freqs.push_back(freq); + } + + // 转移所有权给调用者 + return params.release(); +} +} // namespace Wifi +} // namespace OHOS \ No newline at end of file diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.h b/wifi/frameworks/native/wifi_scan_params_parcel.h new file mode 100644 index 000000000..99ddb8bb5 --- /dev/null +++ b/wifi/frameworks/native/wifi_scan_params_parcel.h @@ -0,0 +1,22 @@ +#ifndef WIFI_SCAN_PARAMS_PARCEL_H +#define WIFI_SCAN_PARAMS_PARCEL_H + +#include "parcel.h" +#include +#include + +namespace OHOS { +namespace Wifi { +struct WifiScanParams : public Parcelable { + std::string ssid; + std::string bssid; + int band; + std::vector freqs; + + bool Marshalling(Parcel &parcel) const override; + static WifiScanParams *Unmarshalling(Parcel &parcel); +}; +} // namespace Wifi +} // namespace OHOS + +#endif // WIFI_SCAN_PARAMS_PARCEL_H -- Gitee From 1fc38969ee90497f6f55366cca73bd9b52cbff29 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 07:02:00 +0000 Subject: [PATCH 03/20] update wifi/frameworks/native/scan_control_info_parcel.cpp. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/scan_control_info_parcel.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/wifi/frameworks/native/scan_control_info_parcel.cpp b/wifi/frameworks/native/scan_control_info_parcel.cpp index 7a2bd3f30..d5403f431 100644 --- a/wifi/frameworks/native/scan_control_info_parcel.cpp +++ b/wifi/frameworks/native/scan_control_info_parcel.cpp @@ -4,7 +4,6 @@ namespace OHOS { namespace Wifi { bool ScanControlInfo::Marshalling(Parcel &parcel) const { - // 序列化scanForbidList if (!parcel.WriteUint32(scanForbidList.size())) return false; for (const auto &item : scanForbidList) { @@ -14,7 +13,6 @@ bool ScanControlInfo::Marshalling(Parcel &parcel) const } } - // 序列化scanIntervalList if (!parcel.WriteUint32(scanIntervalList.size())) return false; for (const auto &item : scanIntervalList) { @@ -32,36 +30,33 @@ ScanControlInfo *ScanControlInfo::Unmarshalling(Parcel &parcel) std::unique_ptr info(new ScanControlInfo()); uint32_t size = 0; - // 反序列化 scanForbidList if (!parcel.ReadUint32(size)) return nullptr; - info->scanForbidList.reserve(size); // 预分配内存提高性能 + info->scanForbidList.reserve(size); for (uint32_t i = 0; i < size; i++) { ScanForbidMode forbid; if (!parcel.ReadInt32(forbid.scanScene) || !parcel.ReadInt32(forbid.scanMode) || !parcel.ReadInt32(forbid.forbidTime) || !parcel.ReadInt32(forbid.forbidCount)) { - return nullptr; // 自动释放内存 + return nullptr; } info->scanForbidList.push_back(forbid); } - // 反序列化 scanIntervalList if (!parcel.ReadUint32(size)) return nullptr; - info->scanIntervalList.reserve(size); // 预分配内存提高性能 + info->scanIntervalList.reserve(size); for (uint32_t i = 0; i < size; i++) { ScanInterval interval; if (!parcel.ReadInt32(interval.scanScene) || !parcel.ReadInt32(interval.scanMode) || !parcel.ReadBool(interval.isSingle) || !parcel.ReadInt32(interval.intervalMode) || !parcel.ReadInt32(interval.interval) || !parcel.ReadInt32(interval.count)) { - return nullptr; // 自动释放内存 + return nullptr; } info->scanIntervalList.push_back(interval); } - // 转移所有权给调用者 return info.release(); } } // namespace Wifi -- Gitee From 9d8eeab0ce8527a5fb8bd965b75b0a963c47d3b0 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 07:03:47 +0000 Subject: [PATCH 04/20] update wifi/frameworks/native/wifi_info_elem_parcel.cpp. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_info_elem_parcel.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp index 12664eef0..929546a74 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.cpp +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -7,7 +7,6 @@ bool WifiInfoElem::Marshalling(Parcel &parcel) const if (!parcel.WriteUint32(id)) return false; - // 序列化内容 if (!parcel.WriteUint32(content.size())) return false; for (char c : content) { @@ -19,33 +18,28 @@ bool WifiInfoElem::Marshalling(Parcel &parcel) const WifiInfoElem *WifiInfoElem::Unmarshalling(Parcel &parcel) { - // 使用 unique_ptr 自动管理内存 std::unique_ptr elem(new WifiInfoElem()); - // 读取 id if (!parcel.ReadUint32(elem->id)) { - return nullptr; // 自动释放内存 + return nullptr; } // 读取内容大小 uint32_t size = 0; if (!parcel.ReadUint32(size)) { - return nullptr; // 自动释放内存 + return nullptr; } - // 预分配内存提高性能 elem->content.reserve(size); - // 读取每个字节内容 for (uint32_t i = 0; i < size; i++) { int8_t c = 0; if (!parcel.ReadInt8(c)) { - return nullptr; // 自动释放内存 + return nullptr; } elem->content.push_back(static_cast(c)); } - // 转移所有权给调用者 return elem.release(); } } // namespace Wifi -- Gitee From 7ce5b033aacf3b170cd4e89dba12f47f014b9f54 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 07:04:46 +0000 Subject: [PATCH 05/20] update wifi/frameworks/native/wifi_scan_info_parcel.cpp. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_info_parcel.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.cpp b/wifi/frameworks/native/wifi_scan_info_parcel.cpp index a11831dde..f3df08996 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_info_parcel.cpp @@ -16,7 +16,6 @@ namespace OHOS { namespace Wifi { bool WifiScanInfo::Marshalling(Parcel &parcel) const { - // 序列化基本字段 if (!parcel.WriteString(bssid) || !parcel.WriteString(ssid) || !parcel.WriteInt32(bssidType) || @@ -31,13 +30,11 @@ bool WifiScanInfo::Marshalling(Parcel &parcel) const return false; } - // 序列化信息元素向量 if (!parcel.WriteUint32(infoElems.size())) return false; for (const auto& elem : infoElems) { if (!elem.Marshalling(parcel)) return false; } - // 序列化剩余字段 if (!parcel.WriteInt64(features) || !parcel.WriteInt64(timestamp) || !parcel.WriteInt32(wifiStandard) || @@ -54,14 +51,11 @@ bool WifiScanInfo::Marshalling(Parcel &parcel) const WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) { - // 使用 unique_ptr 自动管理内存 std::unique_ptr info(new WifiScanInfo()); - // 反序列化基本字符串字段 info->bssid = parcel.ReadString(); info->ssid = parcel.ReadString(); - // 反序列化整型字段 if (!parcel.ReadInt32(info->bssidType) || !parcel.ReadString(info->capabilities) || !parcel.ReadInt32(info->frequency) || @@ -74,26 +68,21 @@ WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) return nullptr; } - // 反序列化信息元素向量 uint32_t elemCount = 0; if (!parcel.ReadUint32(elemCount)) return nullptr; - info->infoElems.reserve(elemCount); // 预分配内存提高性能 + info->infoElems.reserve(elemCount); for (uint32_t i = 0; i < elemCount; i++) { - // 使用 unique_ptr 管理临时元素 std::unique_ptr elem( WifiInfoElem::Unmarshalling(parcel) ); - if (!elem) return nullptr; // 反序列化失败 + if (!elem) return nullptr; - // 移动元素到 vector 中 info->infoElems.push_back(std::move(*elem)); - // elem 自动释放 } - // 反序列化剩余字段 if (!parcel.ReadInt64(info->features) || !parcel.ReadInt64(info->timestamp) || !parcel.ReadInt32(info->wifiStandard) || @@ -105,7 +94,6 @@ WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) return nullptr; } - // 转移所有权给调用者 return info.release(); } } // namespace Wifi -- Gitee From 7d3acfb628114b5b048b70dd7ca62317542c4be4 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 07:05:29 +0000 Subject: [PATCH 06/20] update wifi/frameworks/native/wifi_scan_info_parcel.h. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_info_parcel.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.h b/wifi/frameworks/native/wifi_scan_info_parcel.h index 6647b33dd..716d4f974 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.h +++ b/wifi/frameworks/native/wifi_scan_info_parcel.h @@ -28,11 +28,11 @@ struct WifiScanInfo : public Parcelable { std::string capabilities; int frequency; int band; - int channelWidth; // 枚举类型 + int channelWidth; int centerFrequency0; int centerFrequency1; int rssi; - int securityType; // 枚举类型 + int securityType; std::vector infoElems; int64_t features; int64_t timestamp; @@ -41,7 +41,7 @@ struct WifiScanInfo : public Parcelable { int maxSupportedTxLinkSpeed; int disappearCount; int isHiLinkNetwork; - int supportedWifiCategory; // 枚举类型 + int supportedWifiCategory; bool Marshalling(Parcel &parcel) const override; static WifiScanInfo *Unmarshalling(Parcel &parcel); -- Gitee From 9d3630a19b747e1aef1a39689137ca7ef99b867e Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Sat, 19 Jul 2025 07:06:18 +0000 Subject: [PATCH 07/20] update wifi/frameworks/native/wifi_scan_params_parcel.cpp. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_params_parcel.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index 93cc80be7..8be2d9cc8 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -18,25 +18,21 @@ bool WifiScanParams::Marshalling(Parcel &parcel) const WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) { - // 使用 unique_ptr 自动管理内存 std::unique_ptr params(new WifiScanParams()); - // 反序列化字符串字段 params->ssid = parcel.ReadString(); params->bssid = parcel.ReadString(); - // 反序列化 band 字段 if (!parcel.ReadInt32(params->band)) { return nullptr; } - // 反序列化频率向量 uint32_t size = 0; if (!parcel.ReadUint32(size)) { return nullptr; } - params->freqs.reserve(size); // 预分配内存提高性能 + params->freqs.reserve(size); for (uint32_t i = 0; i < size; i++) { int freq = 0; @@ -46,7 +42,6 @@ WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) params->freqs.push_back(freq); } - // 转移所有权给调用者 return params.release(); } } // namespace Wifi -- Gitee From 3eda4d4f0caefbe70f729c9c5c15d95a7b1a4e53 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 02:00:06 +0000 Subject: [PATCH 08/20] update wifi/frameworks/native/wifi_scan_params_parcel.cpp. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_params_parcel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index 8be2d9cc8..9c41c05b2 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -8,7 +8,6 @@ bool WifiScanParams::Marshalling(Parcel &parcel) const if (!parcel.WriteString(bssid)) return false; if (!parcel.WriteInt32(band)) return false; - // 序列化频率列表 if (!parcel.WriteUint32(freqs.size())) return false; for (int freq : freqs) { if (!parcel.WriteInt32(freq)) return false; -- Gitee From fa291c027cb84bc6ea2b6334ae42886bc75bfdf7 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 02:00:44 +0000 Subject: [PATCH 09/20] update wifi/frameworks/native/wifi_info_elem_parcel.cpp. Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_info_elem_parcel.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp index 929546a74..20b347d80 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.cpp +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -24,7 +24,6 @@ WifiInfoElem *WifiInfoElem::Unmarshalling(Parcel &parcel) return nullptr; } - // 读取内容大小 uint32_t size = 0; if (!parcel.ReadUint32(size)) { return nullptr; -- Gitee From bea782692fb6ec12b8f55075c00e5529a2d00345 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 03:50:20 +0000 Subject: [PATCH 10/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- .../native/scan_control_info_parcel.cpp | 15 +++++++++++++++ wifi/frameworks/native/scan_control_info_parcel.h | 15 +++++++++++++++ wifi/frameworks/native/wifi_info_elem_parcel.cpp | 15 +++++++++++++++ wifi/frameworks/native/wifi_info_elem_parcel.h | 15 +++++++++++++++ .../frameworks/native/wifi_scan_params_parcel.cpp | 15 +++++++++++++++ wifi/frameworks/native/wifi_scan_params_parcel.h | 15 +++++++++++++++ 6 files changed, 90 insertions(+) diff --git a/wifi/frameworks/native/scan_control_info_parcel.cpp b/wifi/frameworks/native/scan_control_info_parcel.cpp index d5403f431..3432a0996 100644 --- a/wifi/frameworks/native/scan_control_info_parcel.cpp +++ b/wifi/frameworks/native/scan_control_info_parcel.cpp @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "scan_control_info_parcel.h" namespace OHOS { diff --git a/wifi/frameworks/native/scan_control_info_parcel.h b/wifi/frameworks/native/scan_control_info_parcel.h index 04018dc1c..4737eb612 100644 --- a/wifi/frameworks/native/scan_control_info_parcel.h +++ b/wifi/frameworks/native/scan_control_info_parcel.h @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef SCAN_CONTROL_INFO_PARCEL_H #define SCAN_CONTROL_INFO_PARCEL_H diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp index 20b347d80..9a506bd86 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.cpp +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "wifi_info_elem_parcel.h" namespace OHOS { diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.h b/wifi/frameworks/native/wifi_info_elem_parcel.h index bc9ec9c2f..6bd61d66e 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.h +++ b/wifi/frameworks/native/wifi_info_elem_parcel.h @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef WIFI_INFO_ELEM_PARCEL_H #define WIFI_INFO_ELEM_PARCEL_H diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index 9c41c05b2..0a1d8de97 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "wifi_scan_params_parcel.h" namespace OHOS { diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.h b/wifi/frameworks/native/wifi_scan_params_parcel.h index 99ddb8bb5..26df62e73 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.h +++ b/wifi/frameworks/native/wifi_scan_params_parcel.h @@ -1,3 +1,18 @@ +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef WIFI_SCAN_PARAMS_PARCEL_H #define WIFI_SCAN_PARAMS_PARCEL_H -- Gitee From f2a1a9c7d2839b9745cd853cc93aea9bf26ed053 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 03:51:56 +0000 Subject: [PATCH 11/20] 2 Signed-off-by: chen yi wen <15068825070@163.com> --- .../frameworks/native/wifi_scan_info_parcel.h | 27 ++++++++++--------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.h b/wifi/frameworks/native/wifi_scan_info_parcel.h index 716d4f974..fd2a3462d 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.h +++ b/wifi/frameworks/native/wifi_scan_info_parcel.h @@ -1,15 +1,18 @@ -# Copyright (C) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #ifndef WIFI_SCAN_INFO_PARCEL_H #define WIFI_SCAN_INFO_PARCEL_H -- Gitee From 3faa176b41943848cce6d36f05ef78a6ee682efb Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 03:52:02 +0000 Subject: [PATCH 12/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_info_parcel.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.h b/wifi/frameworks/native/wifi_scan_info_parcel.h index fd2a3462d..31651a254 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.h +++ b/wifi/frameworks/native/wifi_scan_info_parcel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 0bca45f84f45edddf9a618e4a77fd166cb4b15fc Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 03:54:09 +0000 Subject: [PATCH 13/20] 3 Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_info_elem_parcel.cpp | 2 +- wifi/frameworks/native/wifi_info_elem_parcel.h | 2 +- wifi/frameworks/native/wifi_scan_params_parcel.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp index 9a506bd86..9dd95dabd 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.cpp +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.h b/wifi/frameworks/native/wifi_info_elem_parcel.h index 6bd61d66e..e795c4558 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.h +++ b/wifi/frameworks/native/wifi_info_elem_parcel.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index 0a1d8de97..ccddd0574 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023 Huawei Device Co., Ltd. + * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at -- Gitee From 4c6179f2c2a6e02332eb81ba842202cef37edc62 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 04:00:21 +0000 Subject: [PATCH 14/20] =?UTF-8?q?=E4=B8=A5=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chen yi wen <15068825070@163.com> --- .../native/scan_control_info_parcel.cpp | 2 +- .../native/wifi_info_elem_parcel.cpp | 2 +- .../native/wifi_scan_info_parcel.cpp | 29 ++++++++++--------- .../native/wifi_scan_params_parcel.cpp | 2 +- 4 files changed, 19 insertions(+), 16 deletions(-) diff --git a/wifi/frameworks/native/scan_control_info_parcel.cpp b/wifi/frameworks/native/scan_control_info_parcel.cpp index 3432a0996..ed279ac72 100644 --- a/wifi/frameworks/native/scan_control_info_parcel.cpp +++ b/wifi/frameworks/native/scan_control_info_parcel.cpp @@ -42,7 +42,7 @@ bool ScanControlInfo::Marshalling(Parcel &parcel) const ScanControlInfo *ScanControlInfo::Unmarshalling(Parcel &parcel) { - std::unique_ptr info(new ScanControlInfo()); + std::unique_ptr info = std::make_unique(); uint32_t size = 0; if (!parcel.ReadUint32(size)) diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp index 9dd95dabd..ba1ec4deb 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.cpp +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -33,7 +33,7 @@ bool WifiInfoElem::Marshalling(Parcel &parcel) const WifiInfoElem *WifiInfoElem::Unmarshalling(Parcel &parcel) { - std::unique_ptr elem(new WifiInfoElem()); + std::unique_ptr elem = std::make_unique(); if (!parcel.ReadUint32(elem->id)) { return nullptr; diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.cpp b/wifi/frameworks/native/wifi_scan_info_parcel.cpp index f3df08996..8a192bd7f 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_info_parcel.cpp @@ -1,15 +1,18 @@ -# Copyright (C) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + #include "wifi_scan_info_parcel.h" namespace OHOS { @@ -51,7 +54,7 @@ bool WifiScanInfo::Marshalling(Parcel &parcel) const WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) { - std::unique_ptr info(new WifiScanInfo()); + std::unique_ptr info = std::make_unique(); info->bssid = parcel.ReadString(); info->ssid = parcel.ReadString(); diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index ccddd0574..591b191f5 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -32,7 +32,7 @@ bool WifiScanParams::Marshalling(Parcel &parcel) const WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) { - std::unique_ptr params(new WifiScanParams()); + std::unique_ptr params = std::make_unique(); params->ssid = parcel.ReadString(); params->bssid = parcel.ReadString(); -- Gitee From ca9573b7e3b9930002ba55665e94077d78ce1d13 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 06:21:53 +0000 Subject: [PATCH 15/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- .../native/scan_control_info_parcel.cpp | 14 +++++++++----- .../native/wifi_info_elem_parcel.cpp | 12 ++++++++---- .../native/wifi_scan_info_parcel.cpp | 6 +++--- .../native/wifi_scan_params_parcel.cpp | 18 +++++++++++++----- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/wifi/frameworks/native/scan_control_info_parcel.cpp b/wifi/frameworks/native/scan_control_info_parcel.cpp index ed279ac72..5f12ee0e2 100644 --- a/wifi/frameworks/native/scan_control_info_parcel.cpp +++ b/wifi/frameworks/native/scan_control_info_parcel.cpp @@ -19,8 +19,9 @@ namespace OHOS { namespace Wifi { bool ScanControlInfo::Marshalling(Parcel &parcel) const { - if (!parcel.WriteUint32(scanForbidList.size())) + if (!parcel.WriteUint32(scanForbidList.size())) { return false; + } for (const auto &item : scanForbidList) { if (!parcel.WriteInt32(item.scanScene) || !parcel.WriteInt32(item.scanMode) || !parcel.WriteInt32(item.forbidTime) || !parcel.WriteInt32(item.forbidCount)) { @@ -28,8 +29,9 @@ bool ScanControlInfo::Marshalling(Parcel &parcel) const } } - if (!parcel.WriteUint32(scanIntervalList.size())) + if (!parcel.WriteUint32(scanIntervalList.size())) { return false; + } for (const auto &item : scanIntervalList) { if (!parcel.WriteInt32(item.scanScene) || !parcel.WriteInt32(item.scanMode) || !parcel.WriteBool(item.isSingle) || !parcel.WriteInt32(item.intervalMode) || @@ -45,8 +47,9 @@ ScanControlInfo *ScanControlInfo::Unmarshalling(Parcel &parcel) std::unique_ptr info = std::make_unique(); uint32_t size = 0; - if (!parcel.ReadUint32(size)) + if (!parcel.ReadUint32(size)) { return nullptr; + } info->scanForbidList.reserve(size); for (uint32_t i = 0; i < size; i++) { @@ -58,8 +61,9 @@ ScanControlInfo *ScanControlInfo::Unmarshalling(Parcel &parcel) info->scanForbidList.push_back(forbid); } - if (!parcel.ReadUint32(size)) + if (!parcel.ReadUint32(size)) { return nullptr; + } info->scanIntervalList.reserve(size); for (uint32_t i = 0; i < size; i++) { @@ -71,7 +75,7 @@ ScanControlInfo *ScanControlInfo::Unmarshalling(Parcel &parcel) } info->scanIntervalList.push_back(interval); } - + return info.release(); } } // namespace Wifi diff --git a/wifi/frameworks/native/wifi_info_elem_parcel.cpp b/wifi/frameworks/native/wifi_info_elem_parcel.cpp index ba1ec4deb..6a423d45f 100644 --- a/wifi/frameworks/native/wifi_info_elem_parcel.cpp +++ b/wifi/frameworks/native/wifi_info_elem_parcel.cpp @@ -19,14 +19,18 @@ namespace OHOS { namespace Wifi { bool WifiInfoElem::Marshalling(Parcel &parcel) const { - if (!parcel.WriteUint32(id)) + if (!parcel.WriteUint32(id)) { return false; - - if (!parcel.WriteUint32(content.size())) + } + + if (!parcel.WriteUint32(content.size())) { return false; + } + for (char c : content) { - if (!parcel.WriteInt8(c)) + if (!parcel.WriteInt8(c)) { return false; + } } return true; } diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.cpp b/wifi/frameworks/native/wifi_scan_info_parcel.cpp index 8a192bd7f..dfffb6a19 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_info_parcel.cpp @@ -33,9 +33,9 @@ bool WifiScanInfo::Marshalling(Parcel &parcel) const return false; } - if (!parcel.WriteUint32(infoElems.size())) return false; + if (!parcel.WriteUint32(infoElems.size())) {return false;} for (const auto& elem : infoElems) { - if (!elem.Marshalling(parcel)) return false; + if (!elem.Marshalling(parcel)) {return false;} } if (!parcel.WriteInt64(features) || @@ -52,7 +52,7 @@ bool WifiScanInfo::Marshalling(Parcel &parcel) const return true; } -WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) +WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) { std::unique_ptr info = std::make_unique(); diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index 591b191f5..c84f3dd3d 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -19,17 +19,25 @@ namespace OHOS { namespace Wifi { bool WifiScanParams::Marshalling(Parcel &parcel) const { - if (!parcel.WriteString(ssid)) return false; - if (!parcel.WriteString(bssid)) return false; - if (!parcel.WriteInt32(band)) return false; + if (!parcel.WriteString(ssid)) { + return false; + } + if (!parcel.WriteString(bssid)) { + return false; + } + if (!parcel.WriteInt32(band)) { + return false; + } - if (!parcel.WriteUint32(freqs.size())) return false; + if (!parcel.WriteUint32(freqs.size())) { + return false; + } for (int freq : freqs) { if (!parcel.WriteInt32(freq)) return false; } return true; } - + WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) { std::unique_ptr params = std::make_unique(); -- Gitee From 3713e37c05fe34967e365591ec77f3cb55649c31 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 06:23:27 +0000 Subject: [PATCH 16/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/IWifiService.idl | 28 +++++++++++++------------ 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/wifi/frameworks/native/IWifiService.idl b/wifi/frameworks/native/IWifiService.idl index 8bff0bad7..250725bda 100644 --- a/wifi/frameworks/native/IWifiService.idl +++ b/wifi/frameworks/native/IWifiService.idl @@ -1,16 +1,18 @@ -# Copyright (C) 2025 Huawei Device Co., Ltd. -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - +/* + * Copyright (C) 2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + import OHOS.Wifi.IWifiScanCallback; sequenceable OHOS.Wifi.ScanControlInfo; -- Gitee From 6301af89216533955d573efcd27b021c166eac52 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 07:36:16 +0000 Subject: [PATCH 17/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_info_parcel.cpp | 10 +++++++--- wifi/frameworks/native/wifi_scan_params_parcel.cpp | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.cpp b/wifi/frameworks/native/wifi_scan_info_parcel.cpp index dfffb6a19..e5a2e7e8b 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_info_parcel.cpp @@ -17,7 +17,7 @@ namespace OHOS { namespace Wifi { -bool WifiScanInfo::Marshalling(Parcel &parcel) const +bool WifiScanInfo::Marshalling(Parcel &parcel) const { if (!parcel.WriteString(bssid) || !parcel.WriteString(ssid) || @@ -72,7 +72,9 @@ WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) } uint32_t elemCount = 0; - if (!parcel.ReadUint32(elemCount)) return nullptr; + if (!parcel.ReadUint32(elemCount)) { + return nullptr; + } info->infoElems.reserve(elemCount); @@ -81,7 +83,9 @@ WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) WifiInfoElem::Unmarshalling(parcel) ); - if (!elem) return nullptr; + if (!elem) { + return nullptr; + } info->infoElems.push_back(std::move(*elem)); } diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index c84f3dd3d..5c16c1d1c 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -14,7 +14,7 @@ */ #include "wifi_scan_params_parcel.h" - + namespace OHOS { namespace Wifi { bool WifiScanParams::Marshalling(Parcel &parcel) const -- Gitee From bc10d0ba3997e7c42902b50883592765c0e76e79 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 08:19:21 +0000 Subject: [PATCH 18/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_params_parcel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_params_parcel.cpp b/wifi/frameworks/native/wifi_scan_params_parcel.cpp index 5c16c1d1c..975f36f4f 100644 --- a/wifi/frameworks/native/wifi_scan_params_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_params_parcel.cpp @@ -17,7 +17,7 @@ namespace OHOS { namespace Wifi { -bool WifiScanParams::Marshalling(Parcel &parcel) const +bool WifiScanParams::Marshalling(Parcel &parcel) const { if (!parcel.WriteString(ssid)) { return false; @@ -38,7 +38,7 @@ bool WifiScanParams::Marshalling(Parcel &parcel) const return true; } -WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) +WifiScanParams *WifiScanParams::Unmarshalling(Parcel &parcel) { std::unique_ptr params = std::make_unique(); -- Gitee From 906f3e6faca8c057b4aa49a3b5c47d348683c682 Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 08:41:03 +0000 Subject: [PATCH 19/20] 1 Signed-off-by: chen yi wen <15068825070@163.com> --- .../native/wifi_scan_info_parcel.cpp | 156 ++++++++++-------- .../frameworks/native/wifi_scan_info_parcel.h | 7 +- 2 files changed, 90 insertions(+), 73 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.cpp b/wifi/frameworks/native/wifi_scan_info_parcel.cpp index e5a2e7e8b..256516842 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.cpp +++ b/wifi/frameworks/native/wifi_scan_info_parcel.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 Huawei Device Co., Ltd. + * Copyright (C) 2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -14,94 +14,106 @@ */ #include "wifi_scan_info_parcel.h" - + namespace OHOS { namespace Wifi { + +bool WifiScanInfo::WriteBasicFields(Parcel &parcel, const WifiScanInfo &scanInfo) +{ + return parcel.WriteString(scanInfo.bssid) && parcel.WriteString(scanInfo.ssid) && + parcel.WriteInt32(scanInfo.bssidType) && parcel.WriteString(scanInfo.capabilities) && + parcel.WriteInt32(scanInfo.frequency) && parcel.WriteInt32(scanInfo.band) && + parcel.WriteInt32(scanInfo.channelWidth) && parcel.WriteInt32(scanInfo.centerFrequency0) && + parcel.WriteInt32(scanInfo.centerFrequency1) && parcel.WriteInt32(scanInfo.rssi) && + parcel.WriteInt32(scanInfo.securityType); +} + +bool WifiScanInfo::WriteExtendedFields(Parcel &parcel, const WifiScanInfo &scanInfo) +{ + return parcel.WriteInt64(scanInfo.features) && parcel.WriteInt64(scanInfo.timestamp) && + parcel.WriteInt32(scanInfo.wifiStandard) && parcel.WriteInt32(scanInfo.maxSupportedRxLinkSpeed) && + parcel.WriteInt32(scanInfo.maxSupportedTxLinkSpeed) && parcel.WriteInt32(scanInfo.disappearCount) && + parcel.WriteInt32(scanInfo.isHiLinkNetwork) && parcel.WriteInt32(scanInfo.supportedWifiCategory); +} + +bool WifiScanInfo::WriteInfoElems(Parcel &parcel, const std::vector &infoElems) +{ + if (!parcel.WriteUint32(infoElems.size())) { + return false; + } + for (const auto &elem : infoElems) { + if (!elem.Marshalling(parcel)) { + return false; + } + } + return true; +} + +bool WifiScanInfo::ReadBasicFields(Parcel &parcel, WifiScanInfo &scanInfo) +{ + scanInfo.bssid = parcel.ReadString(); + scanInfo.ssid = parcel.ReadString(); + return parcel.ReadInt32(scanInfo.bssidType) && parcel.ReadString(scanInfo.capabilities) && + parcel.ReadInt32(scanInfo.frequency) && parcel.ReadInt32(scanInfo.band) && + parcel.ReadInt32(scanInfo.channelWidth) && parcel.ReadInt32(scanInfo.centerFrequency0) && + parcel.ReadInt32(scanInfo.centerFrequency1) && parcel.ReadInt32(scanInfo.rssi) && + parcel.ReadInt32(scanInfo.securityType); +} + +bool WifiScanInfo::ReadExtendedFields(Parcel &parcel, WifiScanInfo &scanInfo) +{ + return parcel.ReadInt64(scanInfo.features) && parcel.ReadInt64(scanInfo.timestamp) && + parcel.ReadInt32(scanInfo.wifiStandard) && parcel.ReadInt32(scanInfo.maxSupportedRxLinkSpeed) && + parcel.ReadInt32(scanInfo.maxSupportedTxLinkSpeed) && parcel.ReadInt32(scanInfo.disappearCount) && + parcel.ReadInt32(scanInfo.isHiLinkNetwork) && parcel.ReadInt32(scanInfo.supportedWifiCategory); +} + +bool WifiScanInfo::ReadInfoElems(Parcel &parcel, std::vector &infoElems) +{ + uint32_t elemCount = 0; + if (!parcel.ReadUint32(elemCount)) { + return false; + } + infoElems.reserve(elemCount); + for (uint32_t i = 0; i < elemCount; ++i) { + std::unique_ptr elem(WifiInfoElem::Unmarshalling(parcel)); + if (!elem) { + return false; + } + infoElems.push_back(std::move(*elem)); + } + return true; +} +} // namespace + bool WifiScanInfo::Marshalling(Parcel &parcel) const { - if (!parcel.WriteString(bssid) || - !parcel.WriteString(ssid) || - !parcel.WriteInt32(bssidType) || - !parcel.WriteString(capabilities) || - !parcel.WriteInt32(frequency) || - !parcel.WriteInt32(band) || - !parcel.WriteInt32(channelWidth) || - !parcel.WriteInt32(centerFrequency0) || - !parcel.WriteInt32(centerFrequency1) || - !parcel.WriteInt32(rssi) || - !parcel.WriteInt32(securityType)) { + if (!WriteBasicFields(parcel, *this)) { return false; } - - if (!parcel.WriteUint32(infoElems.size())) {return false;} - for (const auto& elem : infoElems) { - if (!elem.Marshalling(parcel)) {return false;} + if (!WriteInfoElems(parcel, infoElems)) { + return false; } - - if (!parcel.WriteInt64(features) || - !parcel.WriteInt64(timestamp) || - !parcel.WriteInt32(wifiStandard) || - !parcel.WriteInt32(maxSupportedRxLinkSpeed) || - !parcel.WriteInt32(maxSupportedTxLinkSpeed) || - !parcel.WriteInt32(disappearCount) || - !parcel.WriteInt32(isHiLinkNetwork) || - !parcel.WriteInt32(supportedWifiCategory)) { + if (!WriteExtendedFields(parcel, *this)) { return false; } - return true; } - + WifiScanInfo *WifiScanInfo::Unmarshalling(Parcel &parcel) { - std::unique_ptr info = std::make_unique(); - - info->bssid = parcel.ReadString(); - info->ssid = parcel.ReadString(); - - if (!parcel.ReadInt32(info->bssidType) || - !parcel.ReadString(info->capabilities) || - !parcel.ReadInt32(info->frequency) || - !parcel.ReadInt32(info->band) || - !parcel.ReadInt32(info->channelWidth) || - !parcel.ReadInt32(info->centerFrequency0) || - !parcel.ReadInt32(info->centerFrequency1) || - !parcel.ReadInt32(info->rssi) || - !parcel.ReadInt32(info->securityType)) { + auto scanInfo = std::make_unique(); + if (!ReadBasicFields(parcel, *scanInfo)) { return nullptr; } - - uint32_t elemCount = 0; - if (!parcel.ReadUint32(elemCount)) { + if (!ReadInfoElems(parcel, scanInfo->infoElems)) { return nullptr; } - - info->infoElems.reserve(elemCount); - - for (uint32_t i = 0; i < elemCount; i++) { - std::unique_ptr elem( - WifiInfoElem::Unmarshalling(parcel) - ); - - if (!elem) { - return nullptr; - } - - info->infoElems.push_back(std::move(*elem)); - } - - if (!parcel.ReadInt64(info->features) || - !parcel.ReadInt64(info->timestamp) || - !parcel.ReadInt32(info->wifiStandard) || - !parcel.ReadInt32(info->maxSupportedRxLinkSpeed) || - !parcel.ReadInt32(info->maxSupportedTxLinkSpeed) || - !parcel.ReadInt32(info->disappearCount) || - !parcel.ReadInt32(info->isHiLinkNetwork) || - !parcel.ReadInt32(info->supportedWifiCategory)) { + if (!ReadExtendedFields(parcel, *scanInfo)) { return nullptr; } - - return info.release(); + return scanInfo.release(); } -} // namespace Wifi -} // namespace OHOS \ No newline at end of file + +} // namespace Wifi +} // namespace OHOS \ No newline at end of file diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.h b/wifi/frameworks/native/wifi_scan_info_parcel.h index 31651a254..01daaac5f 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.h +++ b/wifi/frameworks/native/wifi_scan_info_parcel.h @@ -48,7 +48,12 @@ struct WifiScanInfo : public Parcelable { bool Marshalling(Parcel &parcel) const override; static WifiScanInfo *Unmarshalling(Parcel &parcel); -}; + bool WriteBasicFields(Parcel &parcel, const WifiScanInfo &scanInfo) + bool WriteExtendedFields(Parcel &parcel, const WifiScanInfo &scanInfo) + bool WriteInfoElems(Parcel &parcel, const std::vector &infoElems) + bool ReadBasicFields(Parcel &parcel, WifiScanInfo &scanInfo) + bool ReadExtendedFields(Parcel &parcel, WifiScanInfo &scanInfo) + bool ReadInfoElems(Parcel &parcel, std::vector &infoElems) } // namespace Wifi } // namespace OHOS -- Gitee From 5ee0b3f3f9007332f8491ebe00192508ac37281f Mon Sep 17 00:00:00 2001 From: chen yi wen <15068825070@163.com> Date: Mon, 21 Jul 2025 08:42:52 +0000 Subject: [PATCH 20/20] 5 Signed-off-by: chen yi wen <15068825070@163.com> --- wifi/frameworks/native/wifi_scan_info_parcel.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wifi/frameworks/native/wifi_scan_info_parcel.h b/wifi/frameworks/native/wifi_scan_info_parcel.h index 01daaac5f..e040631fb 100644 --- a/wifi/frameworks/native/wifi_scan_info_parcel.h +++ b/wifi/frameworks/native/wifi_scan_info_parcel.h @@ -48,12 +48,12 @@ struct WifiScanInfo : public Parcelable { bool Marshalling(Parcel &parcel) const override; static WifiScanInfo *Unmarshalling(Parcel &parcel); - bool WriteBasicFields(Parcel &parcel, const WifiScanInfo &scanInfo) - bool WriteExtendedFields(Parcel &parcel, const WifiScanInfo &scanInfo) - bool WriteInfoElems(Parcel &parcel, const std::vector &infoElems) - bool ReadBasicFields(Parcel &parcel, WifiScanInfo &scanInfo) - bool ReadExtendedFields(Parcel &parcel, WifiScanInfo &scanInfo) - bool ReadInfoElems(Parcel &parcel, std::vector &infoElems) + bool WriteBasicFields(Parcel &parcel, const WifiScanInfo &scanInfo); + bool WriteExtendedFields(Parcel &parcel, const WifiScanInfo &scanInfo); + bool WriteInfoElems(Parcel &parcel, const std::vector &infoElems); + bool ReadBasicFields(Parcel &parcel, WifiScanInfo &scanInfo); + bool ReadExtendedFields(Parcel &parcel, WifiScanInfo &scanInfo); + bool ReadInfoElems(Parcel &parcel, std::vector &infoElems); } // namespace Wifi } // namespace OHOS -- Gitee