From c68d9ce68ddef40b1e7d9c2ac1fecc0d393bf6f2 Mon Sep 17 00:00:00 2001 From: zhangqin88 Date: Wed, 20 Nov 2024 15:25:15 +0800 Subject: [PATCH 1/5] sync code Signed-off-by: zhangqin88 --- wifi/base/state_machine/src/state_machine.cpp | 2 - wifi/bundle.json | 2 +- .../js/napi/src/wifi_napi_event.cpp | 2 +- .../native/interfaces/i_wifi_device.h | 6 +- .../native/interfaces/wifi_ap_msg.h | 5 +- .../native/src/wifi_device_callback_stub.cpp | 6 +- wifi/frameworks/native/src/wifi_device_impl.h | 3 +- .../native/src/wifi_device_proxy.cpp | 141 ++++++------------ .../frameworks/native/src/wifi_device_proxy.h | 4 +- .../native/src/wifi_hotspot_proxy.cpp | 3 +- wifi/interfaces/inner_api/wifi_device.h | 7 +- .../relation_services/wifi_hal_service/main.c | 4 +- .../wifi_hal_service/wifi_hal_callback.c | 3 +- .../wifi_hal_chba_interface.c | 3 +- .../wpa_supplicant_hal/wifi_wpa_common.c | 2 - .../wpa_sta_hal/wifi_common_hal.h | 3 +- .../wpa_sta_hal/wifi_supplicant_hal.c | 17 +-- .../wifi_standard/etc/init/wifi_standard.cfg | 4 +- .../wifi_manage/libwifi_manager.map | 4 +- .../wifi_manage/wifi_ap/BUILD.gn | 1 + .../wifi_common/libwifi_common_service.map | 4 +- .../wifi_common/wifi_app_state_aware.h | 6 +- .../wifi_common/wifi_cmd_client.cpp | 4 +- .../wifi_country_code_define.h | 2 +- .../wifi_country_code_manager.cpp | 2 +- .../wifi_internal_event_dispatcher.cpp | 11 +- .../wifi_common/wifi_net_agent.cpp | 6 +- .../wifi_manage/wifi_common/wifi_net_agent.h | 5 +- .../wifi_common/wifi_net_observer.cpp | 2 +- .../wifi_controller_state_machine.cpp | 3 +- .../wifi_service_scheduler.cpp | 42 +++--- .../wifi_controller/wifi_service_scheduler.h | 4 +- .../wifi_manage/wifi_native/BUILD.gn | 2 + .../hdi_interface/wifi_hdi_common.c | 17 ++- .../hdi_interface/wifi_hdi_define.h | 24 +-- .../hdi_client/hdi_interface/wifi_hdi_util.c | 21 +-- .../hdi_interface/wifi_hdi_wpa_proxy.c | 64 ++++---- .../hdi_client/wifi_hdi_wpa_callback.cpp | 2 +- .../wifi_sub_manage/wifi_sta_manager.cpp | 3 +- .../wifi_framework/wifi_toolkit/BUILD.gn | 2 +- .../wifi_toolkit/include/wifi_internal_msg.h | 1 - 41 files changed, 201 insertions(+), 248 deletions(-) diff --git a/wifi/base/state_machine/src/state_machine.cpp b/wifi/base/state_machine/src/state_machine.cpp index 48b7a8178..d759b8084 100644 --- a/wifi/base/state_machine/src/state_machine.cpp +++ b/wifi/base/state_machine/src/state_machine.cpp @@ -477,7 +477,6 @@ void StateMachineHandler::PlaceDelayedMsgQueueTop() { LOGD("Enter StateMachineHandler::PlaceDelayedMsgQueueTop."); if (mDelayedMessages.size() == 0) { - LOGD("StateMachineHandler::PlaceDelayedMsgQueueTop mDelayedMessages.size() is 0."); return; } for (int i = mDelayedMessages.size() - 1; i >= 0; i--) { @@ -496,7 +495,6 @@ void StateMachineHandler::PlaceDelayedMsgQueueTop() void StateMachineHandler::ReleaseDelayedMessages() { if (mDelayedMessages.size() == 0) { - LOGD("StateMachineHandler::ReleaseDelayedMessages mDelayedMessages.size() is 0."); return; } for (int i = mDelayedMessages.size() - 1; i >= 0; i--) { diff --git a/wifi/bundle.json b/wifi/bundle.json index 92d3b7ff7..8c97dee24 100644 --- a/wifi/bundle.json +++ b/wifi/bundle.json @@ -60,8 +60,8 @@ "wifi_feature_with_local_random_mac", "wifi_feature_sta_ap_exclusion", "wifi_feature_with_random_mac_addr", - "wifi_feature_with_hdi_wpa_supported", "wifi_feature_with_scan_control", + "wifi_feature_with_hdi_wpa_supported", "wifi_feature_network_selection", "wifi_feature_with_hdi_chip_supported", "wifi_feature_with_vap_manager", diff --git a/wifi/frameworks/js/napi/src/wifi_napi_event.cpp b/wifi/frameworks/js/napi/src/wifi_napi_event.cpp index c2753f58a..842354bee 100644 --- a/wifi/frameworks/js/napi/src/wifi_napi_event.cpp +++ b/wifi/frameworks/js/napi/src/wifi_napi_event.cpp @@ -70,11 +70,11 @@ std::map g_EventSysCapMap = { void NapiEvent::EventNotify(AsyncEventData *asyncEvent) { + WIFI_LOGI("Enter wifi event notify, eventType: %{public}s", asyncEvent->eventType.c_str()); if (asyncEvent == nullptr) { WIFI_LOGE("asyncEvent is null!"); return; } - WIFI_LOGI("Enter wifi event notify, eventType: %{public}s", asyncEvent->eventType.c_str()); auto task = [asyncEvent]() { napi_value handler = nullptr; diff --git a/wifi/frameworks/native/interfaces/i_wifi_device.h b/wifi/frameworks/native/interfaces/i_wifi_device.h index 82c8876dc..9302abc6c 100644 --- a/wifi/frameworks/native/interfaces/i_wifi_device.h +++ b/wifi/frameworks/native/interfaces/i_wifi_device.h @@ -136,7 +136,7 @@ public: virtual ErrCode RemoveAllDevice() = 0; /** - * @Description Set tx power for sar. + * @Description set tx power for sar * * @param power - tx power * @return ErrCode - operation result @@ -358,7 +358,6 @@ public: * @Description Check if supported input feature * * @param feature - input feature - * @param isSupported - return true if supported, false if unsupported * @return ErrCode - operation result */ virtual ErrCode IsFeatureSupported(long feature, bool &isSupported) = 0; @@ -511,7 +510,6 @@ public: * @return ErrCode - operation result */ virtual ErrCode LimitSpeed(const int controlId, const int limitMode) = 0; - /** * @Description SetLowTxPower * @@ -566,7 +564,7 @@ public: * * @param uid - target app uid * @param protocol - target protocol type - * @return enable - enable/disable dpi mark + * @param enable - enable/disable dpi mark */ virtual ErrCode SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable) = 0; }; diff --git a/wifi/frameworks/native/interfaces/wifi_ap_msg.h b/wifi/frameworks/native/interfaces/wifi_ap_msg.h index bccdd777d..4dcadafd2 100644 --- a/wifi/frameworks/native/interfaces/wifi_ap_msg.h +++ b/wifi/frameworks/native/interfaces/wifi_ap_msg.h @@ -123,14 +123,15 @@ struct HotspotConfig { return band; } - inline void SetBandWidth(int32_t bandWidth) + inline void SetBandWidth(int32_t BandWidth) { - apBandWidth = bandWidth; + apBandWidth = BandWidth; } inline int32_t GetBandWidth() const { return apBandWidth; } + inline void SetChannel(int32_t newchannel) { channel = newchannel; diff --git a/wifi/frameworks/native/src/wifi_device_callback_stub.cpp b/wifi/frameworks/native/src/wifi_device_callback_stub.cpp index 403ae21f2..f91e4c391 100644 --- a/wifi/frameworks/native/src/wifi_device_callback_stub.cpp +++ b/wifi/frameworks/native/src/wifi_device_callback_stub.cpp @@ -95,7 +95,7 @@ bool WifiDeviceCallBackStub::IsRemoteDied() const void WifiDeviceCallBackStub::SetRemoteDied(bool val) { - WIFI_LOGI("WifiDeviceCallBackStub::SetRemoteDied, state:%{public}d!", val); + WIFI_LOGI("SetRemoteDied, state:%{public}d!", val); mRemoteDied = val; } @@ -120,7 +120,7 @@ NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnWifiConnectionChanged(int stat NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnWifiRssiChanged(int rssi) { - WIFI_LOGI("WifiDeviceCallBackStub::OnWifiRssiChanged, rssi:%{public}d!", rssi); + WIFI_LOGI("OnWifiRssiChanged, rssi:%{public}d!", rssi); if (callback_) { callback_->OnWifiRssiChanged(rssi); } @@ -145,7 +145,7 @@ NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnStreamChanged(int direction) NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnDeviceConfigChanged(ConfigChange value) { - WIFI_LOGI("WifiDeviceCallBackStub::OnDeviceConfigChanged, value:%{public}d!", value); + WIFI_LOGI("OnDeviceConfigChanged, value:%{public}d!", value); if (callback_) { callback_->OnDeviceConfigChanged(value); } diff --git a/wifi/frameworks/native/src/wifi_device_impl.h b/wifi/frameworks/native/src/wifi_device_impl.h index fd8fb1ff0..b434e6420 100644 --- a/wifi/frameworks/native/src/wifi_device_impl.h +++ b/wifi/frameworks/native/src/wifi_device_impl.h @@ -126,8 +126,7 @@ public: /** * @Description set tx power for sar. - * - * @param power - 1001,1002,1003...... + * @param power - 1001 1002 1003······ * @return ErrCode - operation result */ ErrCode SetWifiTxPower(int power) override; diff --git a/wifi/frameworks/native/src/wifi_device_proxy.cpp b/wifi/frameworks/native/src/wifi_device_proxy.cpp index 780dc3152..f20d453d4 100644 --- a/wifi/frameworks/native/src/wifi_device_proxy.cpp +++ b/wifi/frameworks/native/src/wifi_device_proxy.cpp @@ -111,8 +111,7 @@ ErrCode WifiDeviceProxy::DisableWifi() return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -139,8 +138,7 @@ ErrCode WifiDeviceProxy::InitWifiProtect(const WifiProtectType &protectType, con return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -174,8 +172,7 @@ ErrCode WifiDeviceProxy::GetWifiProtectRef(const WifiProtectMode &protectMode, c return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -209,8 +206,7 @@ ErrCode WifiDeviceProxy::PutWifiProtectRef(const std::string &protectName) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -244,8 +240,7 @@ ErrCode WifiDeviceProxy::IsHeldWifiProtectRef( return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -360,8 +355,7 @@ ErrCode WifiDeviceProxy::RemoveCandidateConfig(const WifiDeviceConfig &config) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -396,8 +390,7 @@ ErrCode WifiDeviceProxy::RemoveCandidateConfig(int networkId) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -427,8 +420,7 @@ ErrCode WifiDeviceProxy::AddDeviceConfig(const WifiDeviceConfig &config, int &re return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -465,8 +457,7 @@ ErrCode WifiDeviceProxy::UpdateDeviceConfig(const WifiDeviceConfig &config, int } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -499,8 +490,7 @@ ErrCode WifiDeviceProxy::RemoveDevice(int networkId) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -709,7 +699,7 @@ ErrCode WifiDeviceProxy::GetDeviceConfigs(std::vector &result, ErrCode WifiDeviceProxy::SetTxPower(int power) { if (mRemoteDied) { - WIFI_LOGE("Failed to `%{public}s`, remote service is died!", __func__); + WIFI_LOGE("failed to `%{public}s`,remote service is died!", __func__); return WIFI_OPT_FAILED; } MessageOption option; @@ -742,8 +732,7 @@ ErrCode WifiDeviceProxy::EnableDeviceConfig(int networkId, bool attemptEnable) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -772,8 +761,7 @@ ErrCode WifiDeviceProxy::DisableDeviceConfig(int networkId) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -801,8 +789,7 @@ ErrCode WifiDeviceProxy::ConnectToNetwork(int networkId, bool isCandidate) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -832,8 +819,7 @@ ErrCode WifiDeviceProxy::ConnectToDevice(const WifiDeviceConfig &config) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -864,7 +850,7 @@ ErrCode WifiDeviceProxy::StartRoamToNetwork(const int networkId, const std::stri MessageParcel data; MessageParcel reply; if (!data.WriteInterfaceToken(GetDescriptor())) { - WIFI_LOGE("Write interface token error: %{public}s", __func__); + WIFI_LOGE("%{public}s write interface token error.", __func__); return WIFI_OPT_FAILED; } data.WriteInt32(0); @@ -936,8 +922,7 @@ ErrCode WifiDeviceProxy::IsConnected(bool &isConnected) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -969,8 +954,7 @@ ErrCode WifiDeviceProxy::ReConnect() return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -997,8 +981,7 @@ ErrCode WifiDeviceProxy::ReAssociate(void) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1025,8 +1008,7 @@ ErrCode WifiDeviceProxy::Disconnect(void) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1053,8 +1035,7 @@ ErrCode WifiDeviceProxy::StartWps(const WpsConfig &config) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1084,8 +1065,7 @@ ErrCode WifiDeviceProxy::CancelWps(void) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1112,8 +1092,7 @@ ErrCode WifiDeviceProxy::IsWifiActive(bool &bActive) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1146,8 +1125,7 @@ ErrCode WifiDeviceProxy::GetWifiState(int &state) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1233,8 +1211,7 @@ ErrCode WifiDeviceProxy::GetDisconnectedReason(DisconnectedReason &reason) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1272,8 +1249,7 @@ ErrCode WifiDeviceProxy::IsMeteredHotspot(bool &bMeteredHotspot) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1306,8 +1282,7 @@ ErrCode WifiDeviceProxy::GetLinkedInfo(WifiLinkedInfo &info) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1341,8 +1316,7 @@ ErrCode WifiDeviceProxy::GetIpInfo(IpInfo &info) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1381,8 +1355,7 @@ ErrCode WifiDeviceProxy::GetIpv6Info(IpV6Info &info) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1422,8 +1395,7 @@ ErrCode WifiDeviceProxy::SetCountryCode(const std::string &countryCode) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1451,8 +1423,7 @@ ErrCode WifiDeviceProxy::GetCountryCode(std::string &countryCode) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1484,9 +1455,9 @@ ErrCode WifiDeviceProxy::RegisterCallBack(const sptr &callb WIFI_LOGE("failed to `%{public}s`,remote service is died!", __func__); return WIFI_OPT_FAILED; } - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; MessageOption option(MessageOption::TF_ASYNC); + if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1533,14 +1504,12 @@ ErrCode WifiDeviceProxy::RegisterCallBack(const sptr &callb ErrCode WifiDeviceProxy::GetSignalLevel(const int &rssi, const int &band, int &level) { - WIFI_LOGI("GetSignalLevel proxy start..."); if (mRemoteDied) { WIFI_LOGE("failed to `%{public}s`,remote service is died!", __func__); return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1565,7 +1534,6 @@ ErrCode WifiDeviceProxy::GetSignalLevel(const int &rssi, const int &band, int &l } level = reply.ReadInt32(); - WIFI_LOGI("GetSignalLevel proxy end..."); return WIFI_OPT_SUCCESS; } @@ -1576,8 +1544,7 @@ ErrCode WifiDeviceProxy::GetSupportedFeatures(long &features) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1732,8 +1699,7 @@ ErrCode WifiDeviceProxy::IsBandTypeSupported(int bandType, bool &supported) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1768,8 +1734,7 @@ ErrCode WifiDeviceProxy::Get5GHzChannelList(std::vector &result) } constexpr int MAX_CHANNEL_SIZE = 36; MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1809,8 +1774,7 @@ ErrCode WifiDeviceProxy::SetAppFrozen(std::set pidList, bool isFrozen) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1845,7 +1809,7 @@ ErrCode WifiDeviceProxy::ResetAllFrozenApp() } MessageOption option; MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1872,8 +1836,7 @@ ErrCode WifiDeviceProxy::DisableAutoJoin(const std::string &conditionName) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1901,8 +1864,7 @@ ErrCode WifiDeviceProxy::EnableAutoJoin(const std::string &conditionName) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1964,8 +1926,7 @@ ErrCode WifiDeviceProxy::StartPortalCertification() return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -1998,8 +1959,7 @@ ErrCode WifiDeviceProxy::GetChangeDeviceConfig(ConfigChange &value, WifiDeviceCo return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; @@ -2037,8 +1997,7 @@ ErrCode WifiDeviceProxy::FactoryReset() WIFI_LOGE("failed to `%{public}s`, remote service is died.", __func__); return WIFI_OPT_FAILED; } - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error, func:%{public}s", __func__); @@ -2077,7 +2036,7 @@ ErrCode WifiDeviceProxy::LimitSpeed(const int controlId, const int limitMode) MessageParcel data; MessageParcel reply; if (!data.WriteInterfaceToken(GetDescriptor())) { - WIFI_LOGE("Write interface token error: %{public}s", __func__); + WIFI_LOGE("Write interface token has error: %{public}s", __func__); return WIFI_OPT_FAILED; } data.WriteInt32(0); @@ -2149,19 +2108,18 @@ ErrCode WifiDeviceProxy::EnableHiLinkHandshake(bool uiFlag, std::string &bssid, WIFI_LOGE("failed to `%{public}s`, remote service is died.", __func__); return WIFI_OPT_FAILED; } - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; MessageOption option; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error, func:%{public}s", __func__); return WIFI_OPT_FAILED; } - + data.WriteInt32(0); data.WriteBool(uiFlag); data.WriteString(bssid); WriteDeviceConfig(deviceConfig, data); - + //Wirte device config int error = Remote()->SendRequest(static_cast(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), data, reply, option); @@ -2170,7 +2128,7 @@ ErrCode WifiDeviceProxy::EnableHiLinkHandshake(bool uiFlag, std::string &bssid, static_cast(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), error); return WIFI_OPT_FAILED; } - + int exception = reply.ReadInt32(); if (exception) { WIFI_LOGE("Reply Read failed, exception:%{public}d", exception); @@ -2398,7 +2356,6 @@ ErrCode WifiDeviceProxy::SetDpiMarkRule(const std::string &ifaceName, int uid, i if (ret != WIFI_OPT_SUCCESS) { return ErrCode(ret); } - return WIFI_OPT_SUCCESS; } diff --git a/wifi/frameworks/native/src/wifi_device_proxy.h b/wifi/frameworks/native/src/wifi_device_proxy.h index 844d0fdb1..0640432bd 100644 --- a/wifi/frameworks/native/src/wifi_device_proxy.h +++ b/wifi/frameworks/native/src/wifi_device_proxy.h @@ -149,7 +149,7 @@ public: ErrCode GetDeviceConfigs(std::vector &result, bool isCandidate) override; /** - * @Description set wifi tx power for sar + * @Description set tx power for sar * * @param power - txpower * @return ErrCode - operation result @@ -566,7 +566,7 @@ public: * * @param uid - target app uid * @param protocol - target protocol type - * @return enable - enable/disable dpi mark + * @param enable - enable/disable dpi mark */ ErrCode SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable) override; #ifdef OHOS_ARCH_LITE diff --git a/wifi/frameworks/native/src/wifi_hotspot_proxy.cpp b/wifi/frameworks/native/src/wifi_hotspot_proxy.cpp index de6373175..3fdac2089 100644 --- a/wifi/frameworks/native/src/wifi_hotspot_proxy.cpp +++ b/wifi/frameworks/native/src/wifi_hotspot_proxy.cpp @@ -687,8 +687,7 @@ ErrCode WifiHotspotProxy::GetSupportedFeatures(long &features) return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; - MessageParcel reply; + MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); return WIFI_OPT_FAILED; diff --git a/wifi/interfaces/inner_api/wifi_device.h b/wifi/interfaces/inner_api/wifi_device.h index 729d5eeb2..3551a1032 100644 --- a/wifi/interfaces/inner_api/wifi_device.h +++ b/wifi/interfaces/inner_api/wifi_device.h @@ -293,9 +293,8 @@ public: virtual ErrCode EnableDeviceConfig(int networkId, bool attemptEnable) = 0; /** - * @Description Set wifi tx power for sar. - * - * @param power - 1001,1002,1003...... + * @Description set tx power for sar + * @param power - 1001 1002 1003······ * @return ErrCode - operation result */ virtual ErrCode SetWifiTxPower(int power) = 0; @@ -554,7 +553,7 @@ public: * * @param uid - target app uid * @param protocol - target protocol type - * @return enable - enable/disable dpi mark + * @param enable - enable/disable dpi mark */ virtual ErrCode SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable) = 0; }; diff --git a/wifi/relation_services/wifi_hal_service/main.c b/wifi/relation_services/wifi_hal_service/main.c index 1a38fba6f..ad9f41345 100644 --- a/wifi/relation_services/wifi_hal_service/main.c +++ b/wifi/relation_services/wifi_hal_service/main.c @@ -29,6 +29,7 @@ #include "wifi_hostapd_hal.h" #include "wifi_log.h" #include "wifi_hal_module_manage.h" + #undef LOG_TAG #define LOG_TAG "WifiHalService" @@ -73,8 +74,7 @@ pid_t GetPID(const char *pidFile) void StopProcess(void) { char pidFile[DIR_MAX_LENGTH] = {0, }; - int n = snprintf_s(pidFile, DIR_MAX_LENGTH, DIR_MAX_LENGTH - 1, "%s/%s.pid", - CONFIG_ROOR_DIR, WIFI_MANAGGER_PID_NAME); + int n = snprintf_s(pidFile, DIR_MAX_LENGTH, DIR_MAX_LENGTH - 1, "%s/%s.pid", CONFIG_ROOR_DIR, WIFI_MANAGGER_PID_NAME); if (n < 0) { LOGE("InitPidfile: construct pidFile name failed."); return; diff --git a/wifi/relation_services/wifi_hal_service/wifi_hal_callback.c b/wifi/relation_services/wifi_hal_service/wifi_hal_callback.c index cc40832a3..df78ec2e8 100644 --- a/wifi/relation_services/wifi_hal_service/wifi_hal_callback.c +++ b/wifi/relation_services/wifi_hal_service/wifi_hal_callback.c @@ -482,8 +482,7 @@ void P2pHalCbGroupStarted(const P2pGroupInfo *info) if (info == NULL) { return; } - LOGI("P2p group started event groupIfName: %{public}s, ssid len: %{public}zu", info->groupIfName, - strlen(info->ssid)); + LOGI("P2p group started event groupIfName: %{public}s", info->groupIfName); WifiHalEventCallbackMsg *pCbkMsg = (WifiHalEventCallbackMsg *)calloc(1, sizeof(WifiHalEventCallbackMsg)); if (pCbkMsg == NULL) { LOGE("create callback message failed!"); diff --git a/wifi/relation_services/wifi_hal_service/wifi_hal_chba_interface.c b/wifi/relation_services/wifi_hal_service/wifi_hal_chba_interface.c index c22a0ffb4..d8c9fb958 100644 --- a/wifi/relation_services/wifi_hal_service/wifi_hal_chba_interface.c +++ b/wifi/relation_services/wifi_hal_service/wifi_hal_chba_interface.c @@ -113,8 +113,7 @@ static WifiErrorNo AddChbaIface(void) } AddInterfaceArgv argv; if (strcpy_s(argv.name, sizeof(argv.name), "chba0") != EOK || - strcpy_s(argv.confName, sizeof(argv.confName), - "/data/service/el1/public/wifi/wpa_supplicant/p2p_supplicant.conf") != EOK) { + strcpy_s(argv.confName, sizeof(argv.confName), "/data/service/el1/public/wifi/wpa_supplicant/p2p_supplicant.conf") != EOK) { return WIFI_HAL_FAILED; } if (pWpaInterface->wpaCliAddIface(pWpaInterface, &argv, true) < 0) { diff --git a/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wifi_wpa_common.c b/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wifi_wpa_common.c index 133014a99..4483b2331 100644 --- a/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wifi_wpa_common.c +++ b/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wifi_wpa_common.c @@ -160,12 +160,10 @@ int InitWpaCtrl(WpaCtrl *pCtrl, const char *ifname) int WpaCliCmd(const char *cmd, char *buf, size_t bufLen) { if (cmd == NULL || buf == NULL || bufLen <= 0) { - LOGE("WpaCliCmd, invalid parameters!"); return -1; } WpaCtrl *ctrl = GetWpaCtrl(); if (ctrl == NULL || ctrl->pSend == NULL) { - LOGE("WpaCliCmd, ctrl/ctrl->pSend is NULL!"); return -1; } size_t len = bufLen - 1; diff --git a/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_common_hal.h b/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_common_hal.h index 53205e15e..8077f6d22 100644 --- a/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_common_hal.h +++ b/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_common_hal.h @@ -34,8 +34,7 @@ struct stWifiWpaChbaInterface { ChbaSupplicantErrCode (*wpaChbaCliCmdRemoveGroup)(WifiWpaChbaInterface *p, const char *ifname); ChbaSupplicantErrCode (*wpaChbaCliCmdConnect)(WifiWpaChbaInterface *p, const ChbaConnectInfo *connect); ChbaSupplicantErrCode (*wpaChbaCliCmdDisConnect)(WifiWpaChbaInterface *p, const char *ifname, const char *address); - ChbaSupplicantErrCode (*wpaChbaCliCmdConnectNotify)(WifiWpaChbaInterface *p, - const ChbaConnNotifyInfo *connectNotify); + ChbaSupplicantErrCode (*wpaChbaCliCmdConnectNotify)(WifiWpaChbaInterface *p, const ChbaConnNotifyInfo *connectNotify); }; diff --git a/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_supplicant_hal.c b/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_supplicant_hal.c index c8b3c3271..3f7d8bd25 100644 --- a/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_supplicant_hal.c +++ b/wifi/relation_services/wifi_hal_service/wifi_hal_module/wpa_supplicant_hal/wpa_sta_hal/wifi_supplicant_hal.c @@ -753,7 +753,6 @@ static int WpaCliCmdBssFlush(WifiWpaStaInterface *this) static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings) { if (this == NULL) { - LOGE("WpaCliCmdScan, this is NULL!"); return -1; } @@ -769,7 +768,6 @@ static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings } char *pcmd = (char *)calloc(len, sizeof(char)); if (pcmd == NULL) { - LOGE("WpaCliCmdScan, pcmd is NULL!"); return -1; } int pos = 0; @@ -784,7 +782,7 @@ static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings } } if (res < 0) { - LOGE("WpaCliCmdScan, snprintf_s error!"); + LOGE("snprintf error!"); free(pcmd); pcmd = NULL; return -1; @@ -805,7 +803,6 @@ static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings free(pcmd); pcmd = NULL; if (strncmp(buf, "FAIL-BUSY", strlen("FAIL-BUSY")) == 0) { - LOGE("WpaCliCmdScan, WpaCliCmd return FAIL-BUSY!"); return FAIL_BUSY; } return 0; @@ -1006,15 +1003,15 @@ static bool GetChanWidthCenterFreqHe(ScanInfo *pcmd, ScanInfoElem* infoElem) bool isVhtInfoExist = (content[COLUMN_INDEX_ONE] & VHT_OPER_INFO_EXTST_MASK) != 0; bool is6GhzInfoExist = (content[COLUMN_INDEX_TWO] & GHZ_HE_INFO_EXIST_MASK_6) != 0; bool coHostedBssPresent = (content[COLUMN_INDEX_ONE] & BSS_EXIST_MASK) != 0; - int expectedLen = HE_OPER_BASIC_LEN + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0) + - (coHostedBssPresent ? 1 : 0) + (is6GhzInfoExist ? COLUMN_INDEX_FIVE : 0); + int expectedLen = HE_OPER_BASIC_LEN + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0) + + (coHostedBssPresent ? 1 : 0) + (is6GhzInfoExist ? COLUMN_INDEX_FIVE : 0); pcmd->isHeInfoExist = 1; if (infoElem->size < expectedLen) { return false; } if (is6GhzInfoExist) { - int startIndx = VHT_OPER_INFO_BEGIN_INDEX + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0) + - (coHostedBssPresent ? 1 : 0); + int startIndx = VHT_OPER_INFO_BEGIN_INDEX + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0) + + (coHostedBssPresent ? 1 : 0); int heChannelWidth = content[startIndx + 1] & GHZ_HE_WIDTH_MASK_6; int centerSegFreq0 = content[startIndx + COLUMN_INDEX_TWO] & UINT8_MASK; int centerSegFreq1 = content[startIndx + COLUMN_INDEX_THREE] & UINT8_MASK; @@ -1302,8 +1299,8 @@ static int WpaCliCmdScanInfo(WifiWpaStaInterface *this, ScanInfo *pcmd, int *siz LOGE("parse scan result line failed!"); break; } - LOGD("-->>%{public}2d %{private}s %{private}s %{public}d %{public}d %{public}d %{public}d %{public}d \ - %{public}d %{public}d %{public}d %{public}d %{public}d %{public}d", + LOGD("-->>%{public}2d %{private}s %{private}s %{public}d %{public}d %{public}d %{public}d %{public}d %{public}d \ + %{public}d %{public}d %{public}d %{public}d %{public}d", j, pcmd[j].ssid, pcmd[j].bssid, pcmd[j].freq, pcmd[j].siglv, pcmd[j].centerFrequency0, pcmd[j].centerFrequency1, pcmd[j].channelWidth, pcmd[j].isVhtInfoExist, pcmd[j].isHtInfoExist, pcmd[j].isHeInfoExist, pcmd[j].isErpExist, diff --git a/wifi/services/wifi_standard/etc/init/wifi_standard.cfg b/wifi/services/wifi_standard/etc/init/wifi_standard.cfg index 131bd419f..6506eb5f6 100644 --- a/wifi/services/wifi_standard/etc/init/wifi_standard.cfg +++ b/wifi/services/wifi_standard/etc/init/wifi_standard.cfg @@ -32,10 +32,10 @@ "permission" : [ "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", "ohos.permission.ACCESS_CERT_MANAGER", - "ohos.permission.ACTIVITY_MOTION", "ohos.permission.GET_RUNNING_INFO", - "ohos.permission.MANAGE_SECURE_SETTINGS", "ohos.permission.START_ABILITIES_FROM_BACKGROUND", + "ohos.permission.MANAGE_SECURE_SETTINGS", + "ohos.permission.ACTIVITY_MOTION", "ohos.permission.MANAGE_VPN", "ohos.permission.MANAGE_NET_STRATEGY", "ohos.permission.INTERNET", diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/libwifi_manager.map b/wifi/services/wifi_standard/wifi_framework/wifi_manage/libwifi_manager.map index 6bfeb4504..90df9a0fa 100755 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/libwifi_manager.map +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/libwifi_manager.map @@ -36,8 +36,6 @@ "OHOS::Wifi::WifiTogglerManager::HasAnyApRuning()"; "OHOS::Wifi::WifiTogglerManager::StartWifiToggledTimer()"; "OHOS::Wifi::WifiTogglerManager::StopWifiToggledTimer()"; - "OHOS::Wifi::WifiTogglerManager::StartSemiWifiToggledTimer()"; - "OHOS::Wifi::WifiTogglerManager::StopSemiWifiToggledTimer()"; "OHOS::Wifi::WifiTogglerManager::GetControllerMachine()"; "OHOS::Wifi::WifiTogglerManager::ForceStopWifi()"; "OHOS::Wifi::WifiTogglerManager::SatelliteToggled(int)"; @@ -45,6 +43,8 @@ "OHOS::Wifi::WifiTogglerManager::GetConcreteCallback()"; "OHOS::Wifi::WifiTogglerManager::GetSoftApCallback()"; "OHOS::Wifi::WifiTogglerManager::GetMultiStaCallback()"; + "OHOS::Wifi::WifiTogglerManager::StartSemiWifiToggledTimer()"; + "OHOS::Wifi::WifiTogglerManager::StopSemiWifiToggledTimer()"; "OHOS::Wifi::ConcreteClientModeManager:RegisterCallback(const ConcreteModeCallback&)"; "OHOS::Wifi::ConcreteClientModeManager::SetRole(ConcreteManagerRole role)"; "OHOS::Wifi::ConcreteClientModeManager::InitConcreteManager()"; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/BUILD.gn b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/BUILD.gn index a68e082d6..fcec0b6df 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/BUILD.gn +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_ap/BUILD.gn @@ -43,6 +43,7 @@ ohos_shared_library("wifi_ap_service") { "$WIFI_ROOT_DIR/base/state_machine/include", "$WIFI_ROOT_DIR/base/cRPC/include", "$WIFI_ROOT_DIR/base/utils", + "$WIFI_ROOT_DIR/services/wifi_standard/ipc_framework/interfaces", "$WIFI_ROOT_DIR/interfaces/inner_api", "$WIFI_ROOT_DIR/frameworks/native/interfaces", "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include", diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/libwifi_common_service.map b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/libwifi_common_service.map index 84be3deee..ed31202dc 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/libwifi_common_service.map +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/libwifi_common_service.map @@ -11,6 +11,8 @@ "*DelInterfaceAddress*"; "*NetworkStatusHistoryManager*"; "*WifiSysTimer*"; + "*HasHotspotRemote*"; + "*HasP2pRemote*"; extern "C++" { "OHOS::Wifi::AppNetworkSpeedLimitService::GetInstance()"; "OHOS::Wifi::AppNetworkSpeedLimitService::GetStaCallback() const"; @@ -105,11 +107,9 @@ "OHOS::Wifi::WifiInternalEventDispatcher::SetSingleHotspotCallback(OHOS::sptr const&, int)"; "OHOS::Wifi::WifiInternalEventDispatcher::GetSingleHotspotCallback(int) const"; "OHOS::Wifi::WifiInternalEventDispatcher::RemoveHotspotCallback(OHOS::sptr const&, int)"; - "OHOS::Wifi::WifiInternalEventDispatcher::HasHotspotRemote(OHOS::sptr const&, int)"; "OHOS::Wifi::WifiInternalEventDispatcher::AddP2pCallback(OHOS::sptr const&, OHOS::sptr const&, int, std::__h::basic_string, std::__h::allocator> const&, int)"; "OHOS::Wifi::WifiInternalEventDispatcher::SetSingleP2pCallback(OHOS::sptr const&)"; "OHOS::Wifi::WifiInternalEventDispatcher::RemoveP2pCallback(OHOS::sptr const&)"; - "OHOS::Wifi::WifiInternalEventDispatcher::HasP2pRemote(OHOS::sptr const&)"; "OHOS::Wifi::WifiInternalEventDispatcher::InvokeScanCallbacks(const WifiEventCallbackMsg &)"; "OHOS::Wifi::WifiInternalEventDispatcher::InvokeDeviceCallbacks(const WifiEventCallbackMsg &)"; "OHOS::Wifi::WifiInternalEventDispatcher::InvokeHotspotCallbacks(const WifiEventCallbackMsg &)"; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_app_state_aware.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_app_state_aware.h index dca39d4aa..09d6bf593 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_app_state_aware.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_app_state_aware.h @@ -28,7 +28,8 @@ namespace OHOS { namespace Wifi { struct WifiAppStateAwareCallbacks { - std::function OnForegroundAppChanged; + std::function OnForegroundAppChanged; }; class AppStateObserver; @@ -37,8 +38,8 @@ public: explicit WifiAppStateAware(int instId = 0); ~WifiAppStateAware(); static WifiAppStateAware &GetInstance(); - ErrCode InitAppStateAware(const WifiAppStateAwareCallbacks &wifiAppStateAwareCallbacks); sptr GetAppMgr(); + ErrCode InitAppStateAware(const WifiAppStateAwareCallbacks &wifiAppStateAwareCallbacks); void RegisterAppStateObserver(); void UnSubscribeAppState(); void OnForegroundAppChanged(const AppExecFwk::AppStateData &appStateData, const int mInstId = 0); @@ -46,7 +47,6 @@ public: bool IsForegroundApp(int32_t uid); bool IsForegroundApp(const std::string &bundleName); std::string GetRunningProcessNameByPid(const int uid, const int pid); - private: void RegisterAppStateChangedCallback(const int64_t delayTime = 0); std::mutex mutex_ {}; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_cmd_client.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_cmd_client.cpp index dee290efb..ff042343e 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_cmd_client.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_cmd_client.cpp @@ -1,10 +1,10 @@ /* - * Copyright (C) 2023-2023 Huawei Device Co., Ltd. + * 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 + * 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, diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_define.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_define.h index 6b5982935..f1b3f7867 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_define.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_define.h @@ -76,7 +76,7 @@ struct MccEntry { * 2) The ISO 3166 country codes list, available here: * http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html * - * very importent:The order of mnc must be from small to large! + * very importent: The order of mnc must be from small to large! */ inline const MccEntry MCC_TABLE[] = { // Fake country code, which is the default value, Scan only 2.4G channels and passively receive 5G beacons diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_manager.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_manager.cpp index ace6cc59f..114187288 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_manager.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code/wifi_country_code_manager.cpp @@ -218,7 +218,7 @@ void WifiCountryCodeManager::DealStaConnChanged(OperateResState state, const Wif #ifdef FEATURE_AP_SUPPORT void WifiCountryCodeManager::DealApStateChanged(ApState state, int id) { - WIFI_LOGD("ap state change, state=%{public}d, id=%{public}d", state, id); + WIFI_LOGI("ap state change, state=%{public}d, id=%{public}d", state, id); if (state == ApState::AP_STATE_STARTED) { WifiCountryCodeManager::GetInstance().UpdateWifiCountryCode(); } else if (state != ApState::AP_STATE_STARTING && state != ApState::AP_STATE_STARTED) { diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_internal_event_dispatcher.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_internal_event_dispatcher.cpp index c76fccb51..81ebe25fd 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_internal_event_dispatcher.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_internal_event_dispatcher.cpp @@ -658,8 +658,8 @@ void WifiInternalEventDispatcher::InvokeScanCallbacks(const WifiEventCallbackMsg int uid = mScanCallBackInfo[msg.id][remote].callingUid; int pid = mScanCallBackInfo[msg.id][remote].callingPid; isFrozen = IsAppFrozen(pid); - WIFI_LOGD("APP is hardwareProxied, uid: %{public}d, pid: %{public}d, hardwareProxied: - %{public}d", uid, pid, isFrozen); + WIFI_LOGD("APP is hardwareProxied, uid: %{public}d, pid: %{public}d, hardwareProxied: %{public}d", + uid, pid, isFrozen); #endif if (mScanCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) { WIFI_LOGD("Not registered callback event! msg.msgCode: %{public}d," @@ -701,8 +701,8 @@ void WifiInternalEventDispatcher::InvokeDeviceCallbacks( int uid = mStaCallBackInfo[msg.id][remote].callingUid; int pid = mStaCallBackInfo[msg.id][remote].callingPid; isFrozen = IsAppFrozen(pid); - WIFI_LOGD("Check calling APP is hardwareProxied, uid: %{public}d, pid: %{public}d, hardwareProxied: - %{public}d", uid, pid, isFrozen); + WIFI_LOGD("Check calling APP is hardwareProxied," + "uid: %{public}d, pid: %{public}d, hardwareProxied: %{public}d", uid, pid, isFrozen); #endif if (mStaCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) { WIFI_LOGD("InvokeDeviceCallbacks, Not registered callback event! msg.msgCode: %{public}d," @@ -888,8 +888,7 @@ void WifiInternalEventDispatcher::SendP2pCallbackMsg(sptr &cal #ifdef SUPPORT_RANDOM_MAC_ADDR if ((pid != 0) && (uid != 0)) { std::vector deviceVec = msg.device; - if (WifiPermissionUtils::VerifyGetWifiPeersMacPermissionEx(pid, uid, tokenId) == - PERMISSION_DENIED) { + if (WifiPermissionUtils::VerifyGetWifiPeersMacPermissionEx(pid, uid, tokenId) == PERMISSION_DENIED) { WIFI_LOGD("%{public}s: GET_WIFI_PEERS_MAC PERMISSION_DENIED, pid: %{public}d, uid: %{public}d", __func__, pid, uid); updateP2pDeviceMacAddress(deviceVec); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.cpp index 7f3a066d1..e11e3631c 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.cpp @@ -163,7 +163,7 @@ bool WifiNetAgent::AddRoute(const std::string interface, const std::string ipAdd return true; } -bool WifiNetAgent::DelInterfaceAddress(const std::string interface, const std::string ipAddress, int prefixLength) +bool WifiNetAgent::DelInterfaceAddress(const std::string &interface, const std::string &ipAddress, int prefixLength) { int32_t result = NetConnClient::GetInstance().DelInterfaceAddress(interface, ipAddress, prefixLength); if (result == NETMANAGER_SUCCESS) { @@ -256,9 +256,9 @@ void WifiNetAgent::CreateNetLinkInfo(sptr &netL netLinkInfo->ifaceName_ = WifiConfigCenter::GetInstance().GetStaIfaceName(instId); SetNetLinkIPInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); + SetNetLinkHostRouteInfo(netLinkInfo, wifiIpInfo); SetNetLinkRouteInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); SetNetLinkDnsInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); - SetNetLinkHostRouteInfo(netLinkInfo, wifiIpInfo); SetNetLinkLocalRouteInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); if (wifiProxyConfig.configureMethod == ConfigureProxyMethod::AUTOCONFIGUE) { /* Automatic proxy is not supported */ @@ -267,7 +267,7 @@ void WifiNetAgent::CreateNetLinkInfo(sptr &netL wifiProxyConfig.manualProxyConfig.GetExclusionObjectList(exclusionList); std::list tmpExclusionList; std::copy_if(exclusionList.begin(), exclusionList.end(), std::back_inserter(tmpExclusionList), - [](const std::string &str) { return !str.empty(); }); + [](const std::string &str) { return !str.empty(); } ); netLinkInfo->httpProxy_.SetHost(std::move(wifiProxyConfig.manualProxyConfig.serverHostName)); netLinkInfo->httpProxy_.SetPort(wifiProxyConfig.manualProxyConfig.serverPort); netLinkInfo->httpProxy_.SetExclusionList(tmpExclusionList); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.h index e4491caa8..01c5805fa 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_agent.h @@ -73,8 +73,7 @@ public: * @param wifiIpV6Info wifi network link IPV6 data information * @param wifiProxyConfig wifi network link proxy information */ - void UpdateNetLinkInfo(IpInfo &wifiIpInfo, IpV6Info &wifiIpV6Info, WifiProxyConfig &wifiProxyConfig, - int instId = 0); + void UpdateNetLinkInfo(IpInfo &wifiIpInfo, IpV6Info &wifiIpV6Info, WifiProxyConfig &wifiProxyConfig, int instId = 0); /** * Add route @@ -92,7 +91,7 @@ public: * @param ipAddress IP address * @param prefixLength prefix length */ - bool DelInterfaceAddress(const std::string interface, const std::string ipAddress, int prefixLength); + bool DelInterfaceAddress(const std::string &interface, const std::string &ipAddress, int prefixLength); /** * Add OnStaMachineUpdateNetLinkInfo diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_observer.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_observer.cpp index f59f1a1ed..e95db6866 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_observer.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_net_observer.cpp @@ -70,7 +70,7 @@ void NetStateObserver::StopNetStateObserver(sptr &netStateObse int32_t NetStateObserver::OnNetDetectionResultChanged( NetManagerStandard::NetDetectionResultCode detectionResult, const std::string &urlRedirect) { - WIFI_LOGD("OnNetDetectionResultChanged nettype:%{public}d, url:%{private}s", detectionResult, urlRedirect.c_str()); + WIFI_LOGD("OnNetDetectionResultChanged nettype:%{private}d, url:%{private}s", detectionResult, urlRedirect.c_str()); switch (detectionResult) { case NetManagerStandard::NET_DETECTION_CAPTIVE_PORTAL: { m_callback(SystemNetWorkState::NETWORK_IS_PORTAL, urlRedirect); diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_controller_state_machine.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_controller_state_machine.cpp index e43b1dc44..31b489870 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_controller_state_machine.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_controller_state_machine.cpp @@ -150,8 +150,6 @@ bool WifiControllerMachine::DisableState::ExecuteStateMsg(InternalMessagePtr msg } pWifiControllerMachine->MakeConcreteManager(roleStaWifi1, msg->GetParam2()); pWifiControllerMachine->SwitchState(pWifiControllerMachine->pEnableState); - } else { - WIFI_LOGE("DisableState, invalid instance id"); } break; case CMD_AIRPLANE_TOGGLED: @@ -994,6 +992,7 @@ void WifiControllerMachine::ShutdownWifi(bool shutDownAp) #endif #endif } + multiStaManagers.StopAllManagers(); concreteManagers.StopAllManagers(); } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.cpp index 2921e6ff4..100fe5489 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.cpp @@ -64,10 +64,10 @@ void WifiServiceScheduler::ClearStaIfaceNameMap(int instId) { WIFI_LOGI("ClearStaIfaceNameMap"); std::lock_guard lock(mutex); - auto iter = g_staIfaceNameMap.begin(); - while (iter != g_staIfaceNameMap.end()) { + auto iter = staIfaceNameMap.begin(); + while (iter != staIfaceNameMap.end()) { if (iter->first == instId) { - g_staIfaceNameMap.erase(iter); + staIfaceNameMap.erase(iter); break; } else { iter++; @@ -79,10 +79,10 @@ void WifiServiceScheduler::ClearSoftApIfaceNameMap(int instId) { WIFI_LOGI("ClearSoftApIfaceNameMap"); std::lock_guard lock(mutex); - auto iter = g_softApIfaceNameMap.begin(); - while (iter != g_softApIfaceNameMap.end()) { + auto iter = softApIfaceNameMap.begin(); + while (iter != softApIfaceNameMap.end()) { if (iter->first == instId) { - g_softApIfaceNameMap.erase(iter); + softApIfaceNameMap.erase(iter); break; } else { iter++; @@ -278,8 +278,8 @@ ErrCode WifiServiceScheduler::AutoStartScanOnly(int instId, std::string &staIfNa } #ifdef HDI_CHIP_INTERFACE_SUPPORT std::string ifaceName = ""; - if (g_staIfaceNameMap.count(instId) > 0) { - ifaceName = g_staIfaceNameMap[instId]; + if (staIfaceNameMap.count(instId) > 0) { + ifaceName = staIfaceNameMap[instId]; } if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateStaIface( std::bind(&WifiServiceScheduler::StaIfaceDestoryCallback, this, std::placeholders::_1, std::placeholders::_2), @@ -291,7 +291,7 @@ ErrCode WifiServiceScheduler::AutoStartScanOnly(int instId, std::string &staIfNa WIFI_LOGI("AutoStartScanOnly SetStaIfaceName:%{public}s, instId:%{public}d", ifaceName.c_str(), instId); WifiConfigCenter::GetInstance().SetStaIfaceName(ifaceName); staIfName = ifaceName; - g_staIfaceNameMap.insert(std::make_pair(instId, ifaceName)); + staIfaceNameMap.insert(std::make_pair(instId, ifaceName)); #endif WifiConfigCenter::GetInstance().SetWifiScanOnlyMidState(WifiOprMidState::OPENING, instId); if (instId == INSTID_WLAN0) { @@ -390,8 +390,8 @@ ErrCode WifiServiceScheduler::PreStartWifi(int instId, std::string &staIfName) { #ifdef HDI_CHIP_INTERFACE_SUPPORT std::string ifaceName = ""; - if (g_staIfaceNameMap.count(instId) > 0) { - ifaceName = g_staIfaceNameMap[instId]; + if (staIfaceNameMap.count(instId) > 0) { + ifaceName = staIfaceNameMap[instId]; staIfName = ifaceName; } if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateStaIface( @@ -403,7 +403,7 @@ ErrCode WifiServiceScheduler::PreStartWifi(int instId, std::string &staIfName) } WIFI_LOGI("PreStartWifi SetStaIfaceName:%{public}s, instId:%{public}d", ifaceName.c_str(), instId); WifiConfigCenter::GetInstance().SetStaIfaceName(ifaceName, instId); - g_staIfaceNameMap.insert(std::make_pair(instId, ifaceName)); + staIfaceNameMap.insert(std::make_pair(instId, ifaceName)); staIfName = WifiConfigCenter::GetInstance().GetStaIfaceName(instId); #endif WifiOprMidState staState = WifiConfigCenter::GetInstance().GetWifiMidState(instId); @@ -638,14 +638,14 @@ void WifiServiceScheduler::StaIfaceDestoryCallback(std::string &destoryIfaceName { WIFI_LOGI("IfaceDestoryCallback, ifaceName:%{public}s, ifaceType:%{public}d", destoryIfaceName.c_str(), createIfaceType); - auto iter = g_staIfaceNameMap.begin(); - while (iter != g_staIfaceNameMap.end()) { + auto iter = staIfaceNameMap.begin(); + while (iter != staIfaceNameMap.end()) { if (destoryIfaceName == iter->second) { auto &ins = WifiManager::GetInstance().GetWifiTogglerManager()->GetControllerMachine(); ins->SendMessage(CMD_STA_REMOVED, createIfaceType, iter->first); if (createIfaceType >= 0) { WifiConfigCenter::GetInstance().SetStaIfaceName("", iter->first); - g_staIfaceNameMap.erase(iter); + staIfaceNameMap.erase(iter); } return; } else { @@ -799,8 +799,8 @@ ErrCode WifiServiceScheduler::AutoStartApService(int instId, std::string &softAp } #ifdef HDI_CHIP_INTERFACE_SUPPORT std::string ifaceName = ""; - if (g_softApIfaceNameMap.count(instId) > 0) { - ifaceName = g_softApIfaceNameMap[instId]; + if (softApIfaceNameMap.count(instId) > 0) { + ifaceName = softApIfaceNameMap[instId]; } if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateApIface( std::bind(&WifiServiceScheduler::SoftApIfaceDestoryCallback, @@ -811,7 +811,7 @@ ErrCode WifiServiceScheduler::AutoStartApService(int instId, std::string &softAp } WifiConfigCenter::GetInstance().SetApIfaceName(ifaceName); softApIfName = ifaceName; - g_softApIfaceNameMap.insert(std::make_pair(instId, ifaceName)); + softApIfaceNameMap.insert(std::make_pair(instId, ifaceName)); #endif if (!WifiConfigCenter::GetInstance().SetApMidState(apState, WifiOprMidState::OPENING, 0)) { WIFI_LOGE("AutoStartApService, set ap mid state opening failed!"); @@ -901,15 +901,15 @@ void WifiServiceScheduler::SoftApIfaceDestoryCallback(std::string &destoryIfaceN { WIFI_LOGI("IfaceDestoryCallback, ifaceName:%{public}s, ifaceType:%{public}d", destoryIfaceName.c_str(), createIfaceType); - auto iter = g_softApIfaceNameMap.begin(); - while (iter != g_softApIfaceNameMap.end()) { + auto iter = softApIfaceNameMap.begin(); + while (iter != softApIfaceNameMap.end()) { if (destoryIfaceName == iter->second) { WifiConfigCenter::GetInstance().SetSoftapToggledState(false); auto &ins = WifiManager::GetInstance().GetWifiTogglerManager()->GetControllerMachine(); ins->SendMessage(CMD_AP_REMOVED, createIfaceType, iter->first); if (createIfaceType >= 0) { WifiConfigCenter::GetInstance().SetApIfaceName(""); - g_softApIfaceNameMap.erase(iter); + softApIfaceNameMap.erase(iter); } return; } else { diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.h index a0d908522..7a0c6ec0a 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_controller/wifi_service_scheduler.h @@ -78,8 +78,8 @@ private: void SoftApIfaceDestoryCallback(std::string &destoryIfaceName, int createIfaceType); void OnRssiReportCallback(int index, int antRssi); #endif - std::map g_staIfaceNameMap; - std::map g_softApIfaceNameMap; + std::map staIfaceNameMap; + std::map softApIfaceNameMap; std::mutex mutex; }; } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/BUILD.gn b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/BUILD.gn index 6896e053d..57939c5e5 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/BUILD.gn +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/BUILD.gn @@ -48,6 +48,7 @@ config("wifi_fw_common_header") { include_dirs += [ "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", "//third_party/bounds_checking_function/include", + "//third_party/wpa_supplicant/wpa_supplicant-2.9/src", ] } } @@ -144,6 +145,7 @@ if (defined(ohos_lite)) { ldflags += [ "-fPIC", "-Wl,-E", + "-lwpa_client", ] } } else { diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_common.c b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_common.c index ce6ff370b..70dcdc1fc 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_common.c +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_common.c @@ -13,6 +13,13 @@ * limitations under the License. */ + +#include +#include +#include +#include +#include + #include "securec.h" #include "wifi_hdi_common.h" @@ -557,7 +564,7 @@ int HdiConvertIeRsn(const uint8_t *rsnIe, size_t rsnIeLen, data->hasGroup = 1; if (!HdiCheckValidGroup(data->groupCipher)) { LOGI("invalid group cipher 0x%{public}x (%08x)", data->groupCipher, - HdiGetBe32(pos)); + HdiGetBe32(pos)); return -1; } pos += HDI_SELECTOR_LEN; @@ -634,16 +641,18 @@ int HdiParseIe(const uint8_t *hdiIe, size_t wpaIeLen, { if (wpaIeLen >= HDI_POS_FIRST && hdiIe[0] == HDI_EID_RSN) { return HdiConvertIeRsn(hdiIe, wpaIeLen, data); - } + } if (wpaIeLen >= HDI_POS_SIX && hdiIe[0] == HDI_EID_VENDOR_SPECIFIC && hdiIe[1] >= HDI_POS_FOURTH && HdiGetBe32(&hdiIe[HDI_POS_SECOND]) == HDI_OSEN_IE_VENDOR_TYPE) { return HdiConvertIeRsn(hdiIe, wpaIeLen, data); - } else { + } + else { return HdiConvertIe(hdiIe, wpaIeLen, data); } } -char* HdiGetIeTxt(char *pos, char *end, const char *proto, const uint8_t *ie, size_t ieLen) +char* HdiGetIeTxt(char *pos, char *end, const char *proto, + const uint8_t *ie, size_t ieLen) { struct HdiIeData data; char *start; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_define.h b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_define.h index ace8acf08..01c3e17fa 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_define.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_define.h @@ -304,18 +304,18 @@ typedef enum HdiPortType { } HdiPortType; typedef enum { - PROTOCOL_80211_IFTYPE_UNSPECIFIED, /**< Unspecified type */ - PROTOCOL_80211_IFTYPE_ADHOC, /**< Ad hoc network */ - PROTOCOL_80211_IFTYPE_STATION, /**< Station */ - PROTOCOL_80211_IFTYPE_AP, /**< Access point (AP) */ - PROTOCOL_80211_IFTYPE_AP_VLAN, /**< Virtual AP */ - PROTOCOL_80211_IFTYPE_WDS, /**< Wireless distributed system */ - PROTOCOL_80211_IFTYPE_MONITOR, /**< Listening */ - PROTOCOL_80211_IFTYPE_MESH_POINT, /**< Mesh network */ - PROTOCOL_80211_IFTYPE_P2P_CLIENT, /**< P2P client */ - PROTOCOL_80211_IFTYPE_P2P_GO, /**< P2P group owner */ - PROTOCOL_80211_IFTYPE_P2P_DEVICE, /**< P2P device */ - PROTOCOL_80211_IFTYPE_NUM, /**< Number of network ports */ + PROTOCOL_80211_IFTYPE_UNSPECIFIED, + PROTOCOL_80211_IFTYPE_ADHOC, + PROTOCOL_80211_IFTYPE_STATION, + PROTOCOL_80211_IFTYPE_AP, + PROTOCOL_80211_IFTYPE_AP_VLAN, + PROTOCOL_80211_IFTYPE_WDS, + PROTOCOL_80211_IFTYPE_MONITOR, + PROTOCOL_80211_IFTYPE_MESH_POINT, + PROTOCOL_80211_IFTYPE_P2P_CLIENT, + PROTOCOL_80211_IFTYPE_P2P_GO, + PROTOCOL_80211_IFTYPE_P2P_DEVICE, + PROTOCOL_80211_IFTYPE_NUM, } FeatureType; #ifdef __cplusplus } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_util.c b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_util.c index 91d76935c..5abdf9427 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_util.c +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_util.c @@ -473,8 +473,8 @@ static void GetInfoElems(int length, int end, char *srcBuf, ScanInfo *pcmd) #endif static int HdiParseExtensionInfo(const uint8_t *pos, size_t elen, - struct HdiElems *elems, - int show_errors) + struct HdiElems *elems, + int show_errors) { uint8_t ext_id; @@ -584,8 +584,8 @@ static int HdiParseExtensionInfo(const uint8_t *pos, size_t elen, } static int HdiParseVendorSpec(const uint8_t *pos, size_t elen, - struct HdiElems *elems, - int show_errors) + struct HdiElems *elems, + int show_errors) { unsigned int oui; @@ -596,7 +596,7 @@ static int HdiParseVendorSpec(const uint8_t *pos, size_t elen, if (show_errors) { LOGI("short vendor specific " "information HdiElem ignored (len=%{public}lu)", - (unsigned long) elen); + (unsigned long) elen); } return -1; } @@ -743,10 +743,11 @@ static int HdiCheckExtCap(const uint8_t *ie, unsigned int capab) static int HdiCheckBssExtCap(const uint8_t *ies, size_t len, unsigned int capab) { return HdiCheckExtCap(HdiBssGetIe(ies, len, HDI_EID_EXT_CAPAB), - capab); + capab); } -static bool HdiGetRsnCapabLen(const uint8_t *rsnxe, size_t rsnxe_len, unsigned int capab) +static bool HdiGetRsnCapabLen(const uint8_t *rsnxe, size_t rsnxe_len, + unsigned int capab) { const uint8_t *end; size_t flen, i; @@ -773,7 +774,7 @@ static bool HdiGetRsnCapabLen(const uint8_t *rsnxe, size_t rsnxe_len, unsigned i static bool HdiGetRsnCapab(const uint8_t *rsnxe, unsigned int capab) { return HdiGetRsnCapabLen(rsnxe ? rsnxe + HDI_POS_SECOND : NULL, - rsnxe ? rsnxe[1] : 0, capab); + rsnxe ? rsnxe[1] : 0, capab); } static inline int HdiCheckIsDmg(const int freq) @@ -1025,7 +1026,7 @@ int Get80211ElemsFromIE(const uint8_t *start, size_t len, struct HdiElems *elems if (!HdiCheckCompleted(elem, start, len)) { if (show) { LOGI("IEEE 802.11 HdiElem parse failed @%{public}d", - (int) (start + len - (const uint8_t *) elem)); + (int) (start + len - (const uint8_t *) elem)); } return -1; } @@ -1048,7 +1049,7 @@ int GetScanResultText(const struct WifiScanResultExt *scanResult, if (!p2p) p2p = HdiBssGetVendorBeacon(scanResult->ie, scanResult->ieLen, scanResult->beaconIeLen, HDI_P2P_IE_VENDOR_TYPE); - if (p2p && elems->ssidLen == HDI_P2P_CARD_SSID_LEN && + if (p2p && elems->ssidLen == HDI_P2P_CARD_SSID_LEN && memcmp(elems->ssid, HDI_P2P_CARD_SSID, HDI_P2P_CARD_SSID_LEN) == 0) { return 0; } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c index ec3696d67..c38b0200f 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/hdi_interface/wifi_hdi_wpa_proxy.c @@ -59,8 +59,8 @@ #define AP_IFNAME_COEX "wlan1" #define WIFI_DEFAULT_CFG "hostapd.conf" #define WIFI_COEX_CFG "hostapd_coex.conf" -#define HOSTAPD_DEFAULT_CFG CONFIG_ROOR_DIR"wap_supplicant"WIFI_DEFAULT_CFG -#define HOSTAPD_DEFAULT_CFG_COEX CONFIG_ROOR_DIR"wap_supplicant"WIFI_COEX_CFG +#define HOSTAPD_DEFAULT_CFG CONFIG_ROOR_DIR"/wap_supplicant/"WIFI_DEFAULT_CFG +#define HOSTAPD_DEFAULT_CFG_COEX CONFIG_ROOR_DIR"/wap_supplicant/"WIFI_COEX_CFG #endif const char *HDI_WPA_SERVICE_NAME = "wpa_interface_service"; @@ -95,13 +95,13 @@ static bool FindifaceName(const char* ifName) LOGI("%{public}s err1", __func__); return true; } - struct IfaceNameInfo* current = g_IfaceNameInfoHead; - while (current != NULL) { - if (strncmp(current->ifName, ifName, strlen(ifName)) == 0) { + struct IfaceNameInfo* currernt = g_IfaceNameInfoHead; + while (currernt != NULL) { + if (strncmp(currernt->ifName, ifName, strlen(ifName)) == 0) { LOGI("%{public}s out1", __func__); return true; } - current = current->next; + currernt = currernt->next; } LOGI("%{public}s out", __func__); return false; @@ -115,33 +115,33 @@ static void AddIfaceName(const char* ifName) return; } struct IfaceNameInfo* pre = NULL; - struct IfaceNameInfo* current = g_IfaceNameInfoHead; - while (current != NULL) { - pre = current; - current = current->next; + struct IfaceNameInfo* currernt = g_IfaceNameInfoHead; + while (currernt != NULL) { + pre = currernt; + currernt = currernt->next; } - current =(struct IfaceNameInfo*) malloc(sizeof(struct IfaceNameInfo)); - if (current == NULL) { + currernt =(struct IfaceNameInfo*) malloc(sizeof(struct IfaceNameInfo)); + if (currernt == NULL) { LOGI("%{public}s err2", __func__); return; } - if (memset_s(current->ifName, BUFF_SIZE, 0, strlen(ifName)) != EOK) { - free(current); - current = NULL; + if (memset_s(currernt->ifName, BUFF_SIZE, 0, strlen(ifName)) != EOK) { + free(currernt); + currernt = NULL; LOGI("%{public}s err4", __func__); return; } - current->next = NULL; - if (strncpy_s(current->ifName, BUFF_SIZE, ifName, strlen(ifName)) != EOK) { - free(current); - current = NULL; + currernt->next = NULL; + if (strncpy_s(currernt->ifName, BUFF_SIZE, ifName, strlen(ifName)) != EOK) { + free(currernt); + currernt = NULL; LOGI("%{public}s err3", __func__); return; } if (pre != NULL) { - pre->next = current; + pre->next = currernt; } else { - g_IfaceNameInfoHead = current; + g_IfaceNameInfoHead = currernt; } LOGI("%{public}s out", __func__); return; @@ -154,20 +154,20 @@ static void RemoveIfaceName(const char* ifName) return; } struct IfaceNameInfo* pre = NULL; - struct IfaceNameInfo* current = g_IfaceNameInfoHead; - while (current != NULL) { - if (strncmp(current->ifName, ifName, BUFF_SIZE) != 0) { - pre = current; - current = current->next; + struct IfaceNameInfo* currernt = g_IfaceNameInfoHead; + while (currernt != NULL) { + if (strncmp(currernt->ifName, ifName, BUFF_SIZE) != 0) { + pre = currernt; + currernt = currernt->next; continue; } if (pre == NULL) { - g_IfaceNameInfoHead = current->next; + g_IfaceNameInfoHead = currernt->next; } else { - pre->next = current->next; + pre->next = currernt->next; } - free(current); - current = NULL; + free(currernt); + currernt = NULL; } LOGI("%{public}s out", __func__); return; @@ -738,7 +738,7 @@ WifiErrorNo HdiApStop(int id) int32_t ret; if (g_apObj == NULL) { - LOGI("%{public}s, g_apObj is NULL", __func__); + LOGE("%{public}s, g_apObj is NULL", __func__); pthread_mutex_unlock(&g_apObjMutex); return WIFI_HAL_OPT_OK; } @@ -831,7 +831,7 @@ void SetExecDisable(int execDisable) { g_execDisable = execDisable; } - + int GetExecDisable() { return g_execDisable; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp index 8726f37e3..0b680a0ea 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_native/client/hdi_client/wifi_hdi_wpa_callback.cpp @@ -619,8 +619,8 @@ int32_t OnEventGroupStarted(struct IWpaCallback *self, if (groupStartedParam == nullptr) { return 1; } - const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst(); char tempSsid[WIFI_SSID_LENGTH] = {0}; + const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst(); if (cbk.onGroupStarted) { OHOS::Wifi::HalP2pGroupInfo cbInfo; cbInfo.isGo = groupStartedParam->isGo; diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_sta_manager.cpp b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_sta_manager.cpp index 20afc6636..9881471dc 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_sta_manager.cpp +++ b/wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_sub_manage/wifi_sta_manager.cpp @@ -237,7 +237,8 @@ void WifiStaManager::DealStaConnChanged(OperateResState state, const WifiLinkedI } NotifyScanForStaConnChanged(state, instId); PublishWifiOperateStateHiSysEvent(state); - if (info.connState == ConnState::AUTHENTICATING) { + if (info.connState == ConnState::AUTHENTICATING) + { WriteWifiOperateStateHiSysEvent(static_cast(WifiOperateType::STA_AUTH), static_cast(WifiOperateState::STA_AUTHING)); } diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn index a39d4ba7e..fc751bad1 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn @@ -116,6 +116,7 @@ if (defined(ohos_lite)) { include_dirs = local_base_include_dirs include_dirs += [ "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_common/wifi_country_code", + "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_country_code", "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta", "$WIFI_ROOT_DIR/utils/inc", ] @@ -160,7 +161,6 @@ if (defined(ohos_lite)) { "dhcp:dhcp_utils", "eventhandler:libeventhandler", "hilog:libhilog", - "icu:shared_icuuc", "ipc:ipc_single", "jsoncpp:jsoncpp", "libxml2:libxml2", diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h index cbd1e7618..987b05794 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h @@ -175,7 +175,6 @@ struct WifiEventCallbackMsg { WifiP2pDevice p2pDevice; P2pActionCallback p2pAction; CfgInfo* cfgInfo; - GcInfo gcInfo; std::string privateWfdInfo; WifiEventCallbackMsg() { From 42581837d912ac5d76935dcf3f0c9c851be18f51 Mon Sep 17 00:00:00 2001 From: zhangqin88 Date: Wed, 20 Nov 2024 16:08:02 +0800 Subject: [PATCH 2/5] sync code Signed-off-by: zhangqin88 --- wifi/frameworks/native/src/wifi_device_proxy.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/wifi/frameworks/native/src/wifi_device_proxy.cpp b/wifi/frameworks/native/src/wifi_device_proxy.cpp index f20d453d4..ba69f0fa6 100644 --- a/wifi/frameworks/native/src/wifi_device_proxy.cpp +++ b/wifi/frameworks/native/src/wifi_device_proxy.cpp @@ -1808,7 +1808,6 @@ ErrCode WifiDeviceProxy::ResetAllFrozenApp() return WIFI_OPT_FAILED; } MessageOption option; - MessageParcel data; MessageParcel data, reply; if (!data.WriteInterfaceToken(GetDescriptor())) { WIFI_LOGE("Write interface token error: %{public}s", __func__); From 4aca833d1d1ea27991dc536da706d98b12cd2283 Mon Sep 17 00:00:00 2001 From: zhangqin88 Date: Wed, 20 Nov 2024 08:57:14 +0000 Subject: [PATCH 3/5] update wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h. Signed-off-by: zhangqin88 --- .../wifi_framework/wifi_toolkit/include/wifi_internal_msg.h | 1 + 1 file changed, 1 insertion(+) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h index 987b05794..cbd1e7618 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/include/wifi_internal_msg.h @@ -175,6 +175,7 @@ struct WifiEventCallbackMsg { WifiP2pDevice p2pDevice; P2pActionCallback p2pAction; CfgInfo* cfgInfo; + GcInfo gcInfo; std::string privateWfdInfo; WifiEventCallbackMsg() { From feaedf0e71f3266ec5c42c939ba519aca2505e91 Mon Sep 17 00:00:00 2001 From: zhangqin88 Date: Wed, 20 Nov 2024 09:27:09 +0000 Subject: [PATCH 4/5] update wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn. Signed-off-by: zhangqin88 --- wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn | 1 + 1 file changed, 1 insertion(+) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn index fc751bad1..569979325 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn @@ -160,6 +160,7 @@ if (defined(ohos_lite)) { "dhcp:dhcp_sdk", "dhcp:dhcp_utils", "eventhandler:libeventhandler", + "icu:shared_icuuc", "hilog:libhilog", "ipc:ipc_single", "jsoncpp:jsoncpp", From ab09ee3c0d9e3db0841b0fbfe3870091a367d4f6 Mon Sep 17 00:00:00 2001 From: zhangqin88 Date: Wed, 20 Nov 2024 09:27:50 +0000 Subject: [PATCH 5/5] update wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn. Signed-off-by: zhangqin88 --- .../services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn index 569979325..30c46da88 100644 --- a/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn +++ b/wifi/services/wifi_standard/wifi_framework/wifi_toolkit/BUILD.gn @@ -160,8 +160,8 @@ if (defined(ohos_lite)) { "dhcp:dhcp_sdk", "dhcp:dhcp_utils", "eventhandler:libeventhandler", - "icu:shared_icuuc", "hilog:libhilog", + "icu:shared_icuuc", "ipc:ipc_single", "jsoncpp:jsoncpp", "libxml2:libxml2",