sync code

Signed-off-by: zhangqin88 <zhangqin88@huawei.com>
This commit is contained in:
zhangqin88 2024-11-20 15:25:15 +08:00
parent 0164f0f35f
commit c68d9ce68d
41 changed files with 201 additions and 248 deletions

View File

@ -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--) {

View File

@ -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",

View File

@ -70,11 +70,11 @@ std::map<std::string, std::int32_t> 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;

View File

@ -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;
};

View File

@ -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;

View File

@ -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);
}

View File

@ -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;

View File

@ -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<WifiDeviceConfig> &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<IWifiDeviceCallBack> &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<IWifiDeviceCallBack> &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<int> &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<int> 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,8 +2108,7 @@ 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__);
@ -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;
}

View File

@ -149,7 +149,7 @@ public:
ErrCode GetDeviceConfigs(std::vector<WifiDeviceConfig> &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

View File

@ -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;

View File

@ -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;
};

View File

@ -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;

View File

@ -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!");

View File

@ -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) {

View File

@ -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;

View File

@ -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);
};

View File

@ -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,

View File

@ -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",

View File

@ -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()";

View File

@ -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",

View File

@ -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<OHOS::Wifi::IWifiHotspotCallback> const&, int)";
"OHOS::Wifi::WifiInternalEventDispatcher::GetSingleHotspotCallback(int) const";
"OHOS::Wifi::WifiInternalEventDispatcher::RemoveHotspotCallback(OHOS::sptr<OHOS::IRemoteObject> const&, int)";
"OHOS::Wifi::WifiInternalEventDispatcher::HasHotspotRemote(OHOS::sptr<OHOS::IRemoteObject> const&, int)";
"OHOS::Wifi::WifiInternalEventDispatcher::AddP2pCallback(OHOS::sptr<OHOS::IRemoteObject> const&, OHOS::sptr<OHOS::Wifi::IWifiP2pCallback> const&, int, std::__h::basic_string<char, std::__h::char_traits<char>, std::__h::allocator<char>> const&, int)";
"OHOS::Wifi::WifiInternalEventDispatcher::SetSingleP2pCallback(OHOS::sptr<OHOS::Wifi::IWifiP2pCallback> const&)";
"OHOS::Wifi::WifiInternalEventDispatcher::RemoveP2pCallback(OHOS::sptr<OHOS::IRemoteObject> const&)";
"OHOS::Wifi::WifiInternalEventDispatcher::HasP2pRemote(OHOS::sptr<OHOS::IRemoteObject> const&)";
"OHOS::Wifi::WifiInternalEventDispatcher::InvokeScanCallbacks(const WifiEventCallbackMsg &)";
"OHOS::Wifi::WifiInternalEventDispatcher::InvokeDeviceCallbacks(const WifiEventCallbackMsg &)";
"OHOS::Wifi::WifiInternalEventDispatcher::InvokeHotspotCallbacks(const WifiEventCallbackMsg &)";

View File

@ -28,7 +28,8 @@ namespace OHOS {
namespace Wifi {
struct WifiAppStateAwareCallbacks {
std::function<void(const AppExecFwk::AppStateData &appStateData, const int mInstId)> OnForegroundAppChanged;
std::function<void(const AppExecFwk::AppStateData &appStateData,
const int mInstId)> OnForegroundAppChanged;
};
class AppStateObserver;
@ -37,8 +38,8 @@ public:
explicit WifiAppStateAware(int instId = 0);
~WifiAppStateAware();
static WifiAppStateAware &GetInstance();
ErrCode InitAppStateAware(const WifiAppStateAwareCallbacks &wifiAppStateAwareCallbacks);
sptr<AppExecFwk::IAppMgr> 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_ {};

View File

@ -1,5 +1,5 @@
/*
* 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

View File

@ -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 importentThe 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

View File

@ -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) {

View File

@ -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<IWifiP2pCallback> &cal
#ifdef SUPPORT_RANDOM_MAC_ADDR
if ((pid != 0) && (uid != 0)) {
std::vector<WifiP2pDevice> 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);

View File

@ -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<NetManagerStandard::NetLinkInfo> &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<NetManagerStandard::NetLinkInfo> &netL
wifiProxyConfig.manualProxyConfig.GetExclusionObjectList(exclusionList);
std::list<std::string> 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);

View File

@ -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

View File

@ -70,7 +70,7 @@ void NetStateObserver::StopNetStateObserver(sptr<NetStateObserver> &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);

View File

@ -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();
}

View File

@ -64,10 +64,10 @@ void WifiServiceScheduler::ClearStaIfaceNameMap(int instId)
{
WIFI_LOGI("ClearStaIfaceNameMap");
std::lock_guard<std::mutex> 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<std::mutex> 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 {

View File

@ -78,8 +78,8 @@ private:
void SoftApIfaceDestoryCallback(std::string &destoryIfaceName, int createIfaceType);
void OnRssiReportCallback(int index, int antRssi);
#endif
std::map<int, std::string> g_staIfaceNameMap;
std::map<int, std::string> g_softApIfaceNameMap;
std::map<int, std::string> staIfaceNameMap;
std::map<int, std::string> softApIfaceNameMap;
std::mutex mutex;
};
}

View File

@ -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 {

View File

@ -13,6 +13,13 @@
* limitations under the License.
*/
#include <unistd.h>
#include <net/if.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <pthread.h>
#include "securec.h"
#include "wifi_hdi_common.h"
@ -638,12 +645,14 @@ int HdiParseIe(const uint8_t *hdiIe, size_t wpaIeLen,
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;

View File

@ -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
}

View File

@ -746,7 +746,8 @@ static int HdiCheckBssExtCap(const uint8_t *ies, size_t len, unsigned int 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;

View File

@ -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;
}

View File

@ -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;

View File

@ -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<int>(WifiOperateType::STA_AUTH),
static_cast<int>(WifiOperateState::STA_AUTHING));
}

View File

@ -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",

View File

@ -175,7 +175,6 @@ struct WifiEventCallbackMsg {
WifiP2pDevice p2pDevice;
P2pActionCallback p2pAction;
CfgInfo* cfgInfo;
GcInfo gcInfo;
std::string privateWfdInfo;
WifiEventCallbackMsg()
{