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."); LOGD("Enter StateMachineHandler::PlaceDelayedMsgQueueTop.");
if (mDelayedMessages.size() == 0) { if (mDelayedMessages.size() == 0) {
LOGD("StateMachineHandler::PlaceDelayedMsgQueueTop mDelayedMessages.size() is 0.");
return; return;
} }
for (int i = mDelayedMessages.size() - 1; i >= 0; i--) { for (int i = mDelayedMessages.size() - 1; i >= 0; i--) {
@ -496,7 +495,6 @@ void StateMachineHandler::PlaceDelayedMsgQueueTop()
void StateMachineHandler::ReleaseDelayedMessages() void StateMachineHandler::ReleaseDelayedMessages()
{ {
if (mDelayedMessages.size() == 0) { if (mDelayedMessages.size() == 0) {
LOGD("StateMachineHandler::ReleaseDelayedMessages mDelayedMessages.size() is 0.");
return; return;
} }
for (int i = mDelayedMessages.size() - 1; i >= 0; i--) { for (int i = mDelayedMessages.size() - 1; i >= 0; i--) {

View File

@ -60,8 +60,8 @@
"wifi_feature_with_local_random_mac", "wifi_feature_with_local_random_mac",
"wifi_feature_sta_ap_exclusion", "wifi_feature_sta_ap_exclusion",
"wifi_feature_with_random_mac_addr", "wifi_feature_with_random_mac_addr",
"wifi_feature_with_hdi_wpa_supported",
"wifi_feature_with_scan_control", "wifi_feature_with_scan_control",
"wifi_feature_with_hdi_wpa_supported",
"wifi_feature_network_selection", "wifi_feature_network_selection",
"wifi_feature_with_hdi_chip_supported", "wifi_feature_with_hdi_chip_supported",
"wifi_feature_with_vap_manager", "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) void NapiEvent::EventNotify(AsyncEventData *asyncEvent)
{ {
WIFI_LOGI("Enter wifi event notify, eventType: %{public}s", asyncEvent->eventType.c_str());
if (asyncEvent == nullptr) { if (asyncEvent == nullptr) {
WIFI_LOGE("asyncEvent is null!"); WIFI_LOGE("asyncEvent is null!");
return; return;
} }
WIFI_LOGI("Enter wifi event notify, eventType: %{public}s", asyncEvent->eventType.c_str());
auto task = [asyncEvent]() { auto task = [asyncEvent]() {
napi_value handler = nullptr; napi_value handler = nullptr;

View File

@ -136,7 +136,7 @@ public:
virtual ErrCode RemoveAllDevice() = 0; virtual ErrCode RemoveAllDevice() = 0;
/** /**
* @Description Set tx power for sar. * @Description set tx power for sar
* *
* @param power - tx power * @param power - tx power
* @return ErrCode - operation result * @return ErrCode - operation result
@ -358,7 +358,6 @@ public:
* @Description Check if supported input feature * @Description Check if supported input feature
* *
* @param feature - input feature * @param feature - input feature
* @param isSupported - return true if supported, false if unsupported
* @return ErrCode - operation result * @return ErrCode - operation result
*/ */
virtual ErrCode IsFeatureSupported(long feature, bool &isSupported) = 0; virtual ErrCode IsFeatureSupported(long feature, bool &isSupported) = 0;
@ -511,7 +510,6 @@ public:
* @return ErrCode - operation result * @return ErrCode - operation result
*/ */
virtual ErrCode LimitSpeed(const int controlId, const int limitMode) = 0; virtual ErrCode LimitSpeed(const int controlId, const int limitMode) = 0;
/** /**
* @Description SetLowTxPower * @Description SetLowTxPower
* *
@ -566,7 +564,7 @@ public:
* *
* @param uid - target app uid * @param uid - target app uid
* @param protocol - target protocol type * @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; virtual ErrCode SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable) = 0;
}; };

View File

@ -123,14 +123,15 @@ struct HotspotConfig {
return band; return band;
} }
inline void SetBandWidth(int32_t bandWidth) inline void SetBandWidth(int32_t BandWidth)
{ {
apBandWidth = bandWidth; apBandWidth = BandWidth;
} }
inline int32_t GetBandWidth() const inline int32_t GetBandWidth() const
{ {
return apBandWidth; return apBandWidth;
} }
inline void SetChannel(int32_t newchannel) inline void SetChannel(int32_t newchannel)
{ {
channel = newchannel; channel = newchannel;

View File

@ -95,7 +95,7 @@ bool WifiDeviceCallBackStub::IsRemoteDied() const
void WifiDeviceCallBackStub::SetRemoteDied(bool val) void WifiDeviceCallBackStub::SetRemoteDied(bool val)
{ {
WIFI_LOGI("WifiDeviceCallBackStub::SetRemoteDied, state:%{public}d!", val); WIFI_LOGI("SetRemoteDied, state:%{public}d!", val);
mRemoteDied = val; mRemoteDied = val;
} }
@ -120,7 +120,7 @@ NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnWifiConnectionChanged(int stat
NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnWifiRssiChanged(int rssi) 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_) { if (callback_) {
callback_->OnWifiRssiChanged(rssi); callback_->OnWifiRssiChanged(rssi);
} }
@ -145,7 +145,7 @@ NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnStreamChanged(int direction)
NO_SANITIZE("cfi") void WifiDeviceCallBackStub::OnDeviceConfigChanged(ConfigChange value) 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_) { if (callback_) {
callback_->OnDeviceConfigChanged(value); callback_->OnDeviceConfigChanged(value);
} }

View File

@ -126,8 +126,7 @@ public:
/** /**
* @Description set tx power for sar. * @Description set tx power for sar.
* * @param power - 1001 1002 1003······
* @param power - 1001,1002,1003......
* @return ErrCode - operation result * @return ErrCode - operation result
*/ */
ErrCode SetWifiTxPower(int power) override; ErrCode SetWifiTxPower(int power) override;

View File

@ -111,8 +111,7 @@ ErrCode WifiDeviceProxy::DisableWifi()
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -139,8 +138,7 @@ ErrCode WifiDeviceProxy::InitWifiProtect(const WifiProtectType &protectType, con
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -174,8 +172,7 @@ ErrCode WifiDeviceProxy::GetWifiProtectRef(const WifiProtectMode &protectMode, c
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -209,8 +206,7 @@ ErrCode WifiDeviceProxy::PutWifiProtectRef(const std::string &protectName)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -244,8 +240,7 @@ ErrCode WifiDeviceProxy::IsHeldWifiProtectRef(
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -360,8 +355,7 @@ ErrCode WifiDeviceProxy::RemoveCandidateConfig(const WifiDeviceConfig &config)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -396,8 +390,7 @@ ErrCode WifiDeviceProxy::RemoveCandidateConfig(int networkId)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -427,8 +420,7 @@ ErrCode WifiDeviceProxy::AddDeviceConfig(const WifiDeviceConfig &config, int &re
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -465,8 +457,7 @@ ErrCode WifiDeviceProxy::UpdateDeviceConfig(const WifiDeviceConfig &config, int
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -499,8 +490,7 @@ ErrCode WifiDeviceProxy::RemoveDevice(int networkId)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -709,7 +699,7 @@ ErrCode WifiDeviceProxy::GetDeviceConfigs(std::vector<WifiDeviceConfig> &result,
ErrCode WifiDeviceProxy::SetTxPower(int power) ErrCode WifiDeviceProxy::SetTxPower(int power)
{ {
if (mRemoteDied) { 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; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
@ -742,8 +732,7 @@ ErrCode WifiDeviceProxy::EnableDeviceConfig(int networkId, bool attemptEnable)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -772,8 +761,7 @@ ErrCode WifiDeviceProxy::DisableDeviceConfig(int networkId)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -801,8 +789,7 @@ ErrCode WifiDeviceProxy::ConnectToNetwork(int networkId, bool isCandidate)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -832,8 +819,7 @@ ErrCode WifiDeviceProxy::ConnectToDevice(const WifiDeviceConfig &config)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -864,7 +850,7 @@ ErrCode WifiDeviceProxy::StartRoamToNetwork(const int networkId, const std::stri
MessageParcel data; MessageParcel data;
MessageParcel reply; MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { 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; return WIFI_OPT_FAILED;
} }
data.WriteInt32(0); data.WriteInt32(0);
@ -936,8 +922,7 @@ ErrCode WifiDeviceProxy::IsConnected(bool &isConnected)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -969,8 +954,7 @@ ErrCode WifiDeviceProxy::ReConnect()
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -997,8 +981,7 @@ ErrCode WifiDeviceProxy::ReAssociate(void)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1025,8 +1008,7 @@ ErrCode WifiDeviceProxy::Disconnect(void)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1053,8 +1035,7 @@ ErrCode WifiDeviceProxy::StartWps(const WpsConfig &config)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1084,8 +1065,7 @@ ErrCode WifiDeviceProxy::CancelWps(void)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1112,8 +1092,7 @@ ErrCode WifiDeviceProxy::IsWifiActive(bool &bActive)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1146,8 +1125,7 @@ ErrCode WifiDeviceProxy::GetWifiState(int &state)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1233,8 +1211,7 @@ ErrCode WifiDeviceProxy::GetDisconnectedReason(DisconnectedReason &reason)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1272,8 +1249,7 @@ ErrCode WifiDeviceProxy::IsMeteredHotspot(bool &bMeteredHotspot)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1306,8 +1282,7 @@ ErrCode WifiDeviceProxy::GetLinkedInfo(WifiLinkedInfo &info)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1341,8 +1316,7 @@ ErrCode WifiDeviceProxy::GetIpInfo(IpInfo &info)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1381,8 +1355,7 @@ ErrCode WifiDeviceProxy::GetIpv6Info(IpV6Info &info)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1422,8 +1395,7 @@ ErrCode WifiDeviceProxy::SetCountryCode(const std::string &countryCode)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1451,8 +1423,7 @@ ErrCode WifiDeviceProxy::GetCountryCode(std::string &countryCode)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; 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__); WIFI_LOGE("failed to `%{public}s`,remote service is died!", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
MessageOption option(MessageOption::TF_ASYNC); MessageOption option(MessageOption::TF_ASYNC);
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; 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) ErrCode WifiDeviceProxy::GetSignalLevel(const int &rssi, const int &band, int &level)
{ {
WIFI_LOGI("GetSignalLevel proxy start...");
if (mRemoteDied) { 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; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1565,7 +1534,6 @@ ErrCode WifiDeviceProxy::GetSignalLevel(const int &rssi, const int &band, int &l
} }
level = reply.ReadInt32(); level = reply.ReadInt32();
WIFI_LOGI("GetSignalLevel proxy end...");
return WIFI_OPT_SUCCESS; return WIFI_OPT_SUCCESS;
} }
@ -1576,8 +1544,7 @@ ErrCode WifiDeviceProxy::GetSupportedFeatures(long &features)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1732,8 +1699,7 @@ ErrCode WifiDeviceProxy::IsBandTypeSupported(int bandType, bool &supported)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1768,8 +1734,7 @@ ErrCode WifiDeviceProxy::Get5GHzChannelList(std::vector<int> &result)
} }
constexpr int MAX_CHANNEL_SIZE = 36; constexpr int MAX_CHANNEL_SIZE = 36;
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1809,8 +1774,7 @@ ErrCode WifiDeviceProxy::SetAppFrozen(std::set<int> pidList, bool isFrozen)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1845,7 +1809,7 @@ ErrCode WifiDeviceProxy::ResetAllFrozenApp()
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data;
MessageParcel reply; MessageParcel data, reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1872,8 +1836,7 @@ ErrCode WifiDeviceProxy::DisableAutoJoin(const std::string &conditionName)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1901,8 +1864,7 @@ ErrCode WifiDeviceProxy::EnableAutoJoin(const std::string &conditionName)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1964,8 +1926,7 @@ ErrCode WifiDeviceProxy::StartPortalCertification()
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -1998,8 +1959,7 @@ ErrCode WifiDeviceProxy::GetChangeDeviceConfig(ConfigChange &value, WifiDeviceCo
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
@ -2037,8 +1997,7 @@ ErrCode WifiDeviceProxy::FactoryReset()
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; return WIFI_OPT_FAILED;
} }
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
MessageOption option; MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error, func:%{public}s", __func__); 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 data;
MessageParcel reply; MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { 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; return WIFI_OPT_FAILED;
} }
data.WriteInt32(0); 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__); WIFI_LOGE("failed to `%{public}s`, remote service is died.", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
MessageOption option; MessageOption option;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error, func:%{public}s", __func__); WIFI_LOGE("Write interface token error, func:%{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
data.WriteInt32(0); data.WriteInt32(0);
data.WriteBool(uiFlag); data.WriteBool(uiFlag);
data.WriteString(bssid); data.WriteString(bssid);
WriteDeviceConfig(deviceConfig, data); WriteDeviceConfig(deviceConfig, data);
//Wirte device config //Wirte device config
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), data, int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), data,
reply, option); reply, option);
@ -2170,7 +2128,7 @@ ErrCode WifiDeviceProxy::EnableHiLinkHandshake(bool uiFlag, std::string &bssid,
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), error); static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), error);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
int exception = reply.ReadInt32(); int exception = reply.ReadInt32();
if (exception) { if (exception) {
WIFI_LOGE("Reply Read failed, exception:%{public}d", 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) { if (ret != WIFI_OPT_SUCCESS) {
return ErrCode(ret); return ErrCode(ret);
} }
return WIFI_OPT_SUCCESS; return WIFI_OPT_SUCCESS;
} }

View File

@ -149,7 +149,7 @@ public:
ErrCode GetDeviceConfigs(std::vector<WifiDeviceConfig> &result, bool isCandidate) override; 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 * @param power - txpower
* @return ErrCode - operation result * @return ErrCode - operation result
@ -566,7 +566,7 @@ public:
* *
* @param uid - target app uid * @param uid - target app uid
* @param protocol - target protocol type * @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; ErrCode SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable) override;
#ifdef OHOS_ARCH_LITE #ifdef OHOS_ARCH_LITE

View File

@ -687,8 +687,7 @@ ErrCode WifiHotspotProxy::GetSupportedFeatures(long &features)
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;
} }
MessageOption option; MessageOption option;
MessageParcel data; MessageParcel data, reply;
MessageParcel reply;
if (!data.WriteInterfaceToken(GetDescriptor())) { if (!data.WriteInterfaceToken(GetDescriptor())) {
WIFI_LOGE("Write interface token error: %{public}s", __func__); WIFI_LOGE("Write interface token error: %{public}s", __func__);
return WIFI_OPT_FAILED; return WIFI_OPT_FAILED;

View File

@ -293,9 +293,8 @@ public:
virtual ErrCode EnableDeviceConfig(int networkId, bool attemptEnable) = 0; virtual ErrCode EnableDeviceConfig(int networkId, bool attemptEnable) = 0;
/** /**
* @Description Set wifi tx power for sar. * @Description set tx power for sar
* * @param power - 1001 1002 1003······
* @param power - 1001,1002,1003......
* @return ErrCode - operation result * @return ErrCode - operation result
*/ */
virtual ErrCode SetWifiTxPower(int power) = 0; virtual ErrCode SetWifiTxPower(int power) = 0;
@ -554,7 +553,7 @@ public:
* *
* @param uid - target app uid * @param uid - target app uid
* @param protocol - target protocol type * @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; 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_hostapd_hal.h"
#include "wifi_log.h" #include "wifi_log.h"
#include "wifi_hal_module_manage.h" #include "wifi_hal_module_manage.h"
#undef LOG_TAG #undef LOG_TAG
#define LOG_TAG "WifiHalService" #define LOG_TAG "WifiHalService"
@ -73,8 +74,7 @@ pid_t GetPID(const char *pidFile)
void StopProcess(void) void StopProcess(void)
{ {
char pidFile[DIR_MAX_LENGTH] = {0, }; char pidFile[DIR_MAX_LENGTH] = {0, };
int n = snprintf_s(pidFile, DIR_MAX_LENGTH, DIR_MAX_LENGTH - 1, "%s/%s.pid", int n = snprintf_s(pidFile, DIR_MAX_LENGTH, DIR_MAX_LENGTH - 1, "%s/%s.pid", CONFIG_ROOR_DIR, WIFI_MANAGGER_PID_NAME);
CONFIG_ROOR_DIR, WIFI_MANAGGER_PID_NAME);
if (n < 0) { if (n < 0) {
LOGE("InitPidfile: construct pidFile name failed."); LOGE("InitPidfile: construct pidFile name failed.");
return; return;

View File

@ -482,8 +482,7 @@ void P2pHalCbGroupStarted(const P2pGroupInfo *info)
if (info == NULL) { if (info == NULL) {
return; return;
} }
LOGI("P2p group started event groupIfName: %{public}s, ssid len: %{public}zu", info->groupIfName, LOGI("P2p group started event groupIfName: %{public}s", info->groupIfName);
strlen(info->ssid));
WifiHalEventCallbackMsg *pCbkMsg = (WifiHalEventCallbackMsg *)calloc(1, sizeof(WifiHalEventCallbackMsg)); WifiHalEventCallbackMsg *pCbkMsg = (WifiHalEventCallbackMsg *)calloc(1, sizeof(WifiHalEventCallbackMsg));
if (pCbkMsg == NULL) { if (pCbkMsg == NULL) {
LOGE("create callback message failed!"); LOGE("create callback message failed!");

View File

@ -113,8 +113,7 @@ static WifiErrorNo AddChbaIface(void)
} }
AddInterfaceArgv argv; AddInterfaceArgv argv;
if (strcpy_s(argv.name, sizeof(argv.name), "chba0") != EOK || if (strcpy_s(argv.name, sizeof(argv.name), "chba0") != EOK ||
strcpy_s(argv.confName, sizeof(argv.confName), strcpy_s(argv.confName, sizeof(argv.confName), "/data/service/el1/public/wifi/wpa_supplicant/p2p_supplicant.conf") != EOK) {
"/data/service/el1/public/wifi/wpa_supplicant/p2p_supplicant.conf") != EOK) {
return WIFI_HAL_FAILED; return WIFI_HAL_FAILED;
} }
if (pWpaInterface->wpaCliAddIface(pWpaInterface, &argv, true) < 0) { 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) int WpaCliCmd(const char *cmd, char *buf, size_t bufLen)
{ {
if (cmd == NULL || buf == NULL || bufLen <= 0) { if (cmd == NULL || buf == NULL || bufLen <= 0) {
LOGE("WpaCliCmd, invalid parameters!");
return -1; return -1;
} }
WpaCtrl *ctrl = GetWpaCtrl(); WpaCtrl *ctrl = GetWpaCtrl();
if (ctrl == NULL || ctrl->pSend == NULL) { if (ctrl == NULL || ctrl->pSend == NULL) {
LOGE("WpaCliCmd, ctrl/ctrl->pSend is NULL!");
return -1; return -1;
} }
size_t len = bufLen - 1; size_t len = bufLen - 1;

View File

@ -34,8 +34,7 @@ struct stWifiWpaChbaInterface {
ChbaSupplicantErrCode (*wpaChbaCliCmdRemoveGroup)(WifiWpaChbaInterface *p, const char *ifname); ChbaSupplicantErrCode (*wpaChbaCliCmdRemoveGroup)(WifiWpaChbaInterface *p, const char *ifname);
ChbaSupplicantErrCode (*wpaChbaCliCmdConnect)(WifiWpaChbaInterface *p, const ChbaConnectInfo *connect); ChbaSupplicantErrCode (*wpaChbaCliCmdConnect)(WifiWpaChbaInterface *p, const ChbaConnectInfo *connect);
ChbaSupplicantErrCode (*wpaChbaCliCmdDisConnect)(WifiWpaChbaInterface *p, const char *ifname, const char *address); ChbaSupplicantErrCode (*wpaChbaCliCmdDisConnect)(WifiWpaChbaInterface *p, const char *ifname, const char *address);
ChbaSupplicantErrCode (*wpaChbaCliCmdConnectNotify)(WifiWpaChbaInterface *p, ChbaSupplicantErrCode (*wpaChbaCliCmdConnectNotify)(WifiWpaChbaInterface *p, const ChbaConnNotifyInfo *connectNotify);
const ChbaConnNotifyInfo *connectNotify);
}; };

View File

@ -753,7 +753,6 @@ static int WpaCliCmdBssFlush(WifiWpaStaInterface *this)
static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings) static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings)
{ {
if (this == NULL) { if (this == NULL) {
LOGE("WpaCliCmdScan, this is NULL!");
return -1; return -1;
} }
@ -769,7 +768,6 @@ static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings
} }
char *pcmd = (char *)calloc(len, sizeof(char)); char *pcmd = (char *)calloc(len, sizeof(char));
if (pcmd == NULL) { if (pcmd == NULL) {
LOGE("WpaCliCmdScan, pcmd is NULL!");
return -1; return -1;
} }
int pos = 0; int pos = 0;
@ -784,7 +782,7 @@ static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings
} }
} }
if (res < 0) { if (res < 0) {
LOGE("WpaCliCmdScan, snprintf_s error!"); LOGE("snprintf error!");
free(pcmd); free(pcmd);
pcmd = NULL; pcmd = NULL;
return -1; return -1;
@ -805,7 +803,6 @@ static int WpaCliCmdScan(WifiWpaStaInterface *this, const ScanSettings *settings
free(pcmd); free(pcmd);
pcmd = NULL; pcmd = NULL;
if (strncmp(buf, "FAIL-BUSY", strlen("FAIL-BUSY")) == 0) { if (strncmp(buf, "FAIL-BUSY", strlen("FAIL-BUSY")) == 0) {
LOGE("WpaCliCmdScan, WpaCliCmd return FAIL-BUSY!");
return FAIL_BUSY; return FAIL_BUSY;
} }
return 0; 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 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 is6GhzInfoExist = (content[COLUMN_INDEX_TWO] & GHZ_HE_INFO_EXIST_MASK_6) != 0;
bool coHostedBssPresent = (content[COLUMN_INDEX_ONE] & BSS_EXIST_MASK) != 0; bool coHostedBssPresent = (content[COLUMN_INDEX_ONE] & BSS_EXIST_MASK) != 0;
int expectedLen = HE_OPER_BASIC_LEN + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0) + int expectedLen = HE_OPER_BASIC_LEN + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0)
(coHostedBssPresent ? 1 : 0) + (is6GhzInfoExist ? COLUMN_INDEX_FIVE : 0); + (coHostedBssPresent ? 1 : 0) + (is6GhzInfoExist ? COLUMN_INDEX_FIVE : 0);
pcmd->isHeInfoExist = 1; pcmd->isHeInfoExist = 1;
if (infoElem->size < expectedLen) { if (infoElem->size < expectedLen) {
return false; return false;
} }
if (is6GhzInfoExist) { if (is6GhzInfoExist) {
int startIndx = VHT_OPER_INFO_BEGIN_INDEX + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0) + int startIndx = VHT_OPER_INFO_BEGIN_INDEX + (isVhtInfoExist ? COLUMN_INDEX_THREE : 0)
(coHostedBssPresent ? 1 : 0); + (coHostedBssPresent ? 1 : 0);
int heChannelWidth = content[startIndx + 1] & GHZ_HE_WIDTH_MASK_6; int heChannelWidth = content[startIndx + 1] & GHZ_HE_WIDTH_MASK_6;
int centerSegFreq0 = content[startIndx + COLUMN_INDEX_TWO] & UINT8_MASK; int centerSegFreq0 = content[startIndx + COLUMN_INDEX_TWO] & UINT8_MASK;
int centerSegFreq1 = content[startIndx + COLUMN_INDEX_THREE] & 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!"); LOGE("parse scan result line failed!");
break; break;
} }
LOGD("-->>%{public}2d %{private}s %{private}s %{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 %{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, j, pcmd[j].ssid, pcmd[j].bssid, pcmd[j].freq, pcmd[j].siglv,
pcmd[j].centerFrequency0, pcmd[j].centerFrequency1, pcmd[j].channelWidth, pcmd[j].centerFrequency0, pcmd[j].centerFrequency1, pcmd[j].channelWidth,
pcmd[j].isVhtInfoExist, pcmd[j].isHtInfoExist, pcmd[j].isHeInfoExist, pcmd[j].isErpExist, pcmd[j].isVhtInfoExist, pcmd[j].isHtInfoExist, pcmd[j].isHeInfoExist, pcmd[j].isErpExist,

View File

@ -32,10 +32,10 @@
"permission" : [ "permission" : [
"ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS", "ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS",
"ohos.permission.ACCESS_CERT_MANAGER", "ohos.permission.ACCESS_CERT_MANAGER",
"ohos.permission.ACTIVITY_MOTION",
"ohos.permission.GET_RUNNING_INFO", "ohos.permission.GET_RUNNING_INFO",
"ohos.permission.MANAGE_SECURE_SETTINGS",
"ohos.permission.START_ABILITIES_FROM_BACKGROUND", "ohos.permission.START_ABILITIES_FROM_BACKGROUND",
"ohos.permission.MANAGE_SECURE_SETTINGS",
"ohos.permission.ACTIVITY_MOTION",
"ohos.permission.MANAGE_VPN", "ohos.permission.MANAGE_VPN",
"ohos.permission.MANAGE_NET_STRATEGY", "ohos.permission.MANAGE_NET_STRATEGY",
"ohos.permission.INTERNET", "ohos.permission.INTERNET",

View File

@ -36,8 +36,6 @@
"OHOS::Wifi::WifiTogglerManager::HasAnyApRuning()"; "OHOS::Wifi::WifiTogglerManager::HasAnyApRuning()";
"OHOS::Wifi::WifiTogglerManager::StartWifiToggledTimer()"; "OHOS::Wifi::WifiTogglerManager::StartWifiToggledTimer()";
"OHOS::Wifi::WifiTogglerManager::StopWifiToggledTimer()"; "OHOS::Wifi::WifiTogglerManager::StopWifiToggledTimer()";
"OHOS::Wifi::WifiTogglerManager::StartSemiWifiToggledTimer()";
"OHOS::Wifi::WifiTogglerManager::StopSemiWifiToggledTimer()";
"OHOS::Wifi::WifiTogglerManager::GetControllerMachine()"; "OHOS::Wifi::WifiTogglerManager::GetControllerMachine()";
"OHOS::Wifi::WifiTogglerManager::ForceStopWifi()"; "OHOS::Wifi::WifiTogglerManager::ForceStopWifi()";
"OHOS::Wifi::WifiTogglerManager::SatelliteToggled(int)"; "OHOS::Wifi::WifiTogglerManager::SatelliteToggled(int)";
@ -45,6 +43,8 @@
"OHOS::Wifi::WifiTogglerManager::GetConcreteCallback()"; "OHOS::Wifi::WifiTogglerManager::GetConcreteCallback()";
"OHOS::Wifi::WifiTogglerManager::GetSoftApCallback()"; "OHOS::Wifi::WifiTogglerManager::GetSoftApCallback()";
"OHOS::Wifi::WifiTogglerManager::GetMultiStaCallback()"; "OHOS::Wifi::WifiTogglerManager::GetMultiStaCallback()";
"OHOS::Wifi::WifiTogglerManager::StartSemiWifiToggledTimer()";
"OHOS::Wifi::WifiTogglerManager::StopSemiWifiToggledTimer()";
"OHOS::Wifi::ConcreteClientModeManager:RegisterCallback(const ConcreteModeCallback&)"; "OHOS::Wifi::ConcreteClientModeManager:RegisterCallback(const ConcreteModeCallback&)";
"OHOS::Wifi::ConcreteClientModeManager::SetRole(ConcreteManagerRole role)"; "OHOS::Wifi::ConcreteClientModeManager::SetRole(ConcreteManagerRole role)";
"OHOS::Wifi::ConcreteClientModeManager::InitConcreteManager()"; "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/state_machine/include",
"$WIFI_ROOT_DIR/base/cRPC/include", "$WIFI_ROOT_DIR/base/cRPC/include",
"$WIFI_ROOT_DIR/base/utils", "$WIFI_ROOT_DIR/base/utils",
"$WIFI_ROOT_DIR/services/wifi_standard/ipc_framework/interfaces",
"$WIFI_ROOT_DIR/interfaces/inner_api", "$WIFI_ROOT_DIR/interfaces/inner_api",
"$WIFI_ROOT_DIR/frameworks/native/interfaces", "$WIFI_ROOT_DIR/frameworks/native/interfaces",
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include", "$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include",

View File

@ -11,6 +11,8 @@
"*DelInterfaceAddress*"; "*DelInterfaceAddress*";
"*NetworkStatusHistoryManager*"; "*NetworkStatusHistoryManager*";
"*WifiSysTimer*"; "*WifiSysTimer*";
"*HasHotspotRemote*";
"*HasP2pRemote*";
extern "C++" { extern "C++" {
"OHOS::Wifi::AppNetworkSpeedLimitService::GetInstance()"; "OHOS::Wifi::AppNetworkSpeedLimitService::GetInstance()";
"OHOS::Wifi::AppNetworkSpeedLimitService::GetStaCallback() const"; "OHOS::Wifi::AppNetworkSpeedLimitService::GetStaCallback() const";
@ -105,11 +107,9 @@
"OHOS::Wifi::WifiInternalEventDispatcher::SetSingleHotspotCallback(OHOS::sptr<OHOS::Wifi::IWifiHotspotCallback> const&, int)"; "OHOS::Wifi::WifiInternalEventDispatcher::SetSingleHotspotCallback(OHOS::sptr<OHOS::Wifi::IWifiHotspotCallback> const&, int)";
"OHOS::Wifi::WifiInternalEventDispatcher::GetSingleHotspotCallback(int) const"; "OHOS::Wifi::WifiInternalEventDispatcher::GetSingleHotspotCallback(int) const";
"OHOS::Wifi::WifiInternalEventDispatcher::RemoveHotspotCallback(OHOS::sptr<OHOS::IRemoteObject> const&, int)"; "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::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::SetSingleP2pCallback(OHOS::sptr<OHOS::Wifi::IWifiP2pCallback> const&)";
"OHOS::Wifi::WifiInternalEventDispatcher::RemoveP2pCallback(OHOS::sptr<OHOS::IRemoteObject> 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::InvokeScanCallbacks(const WifiEventCallbackMsg &)";
"OHOS::Wifi::WifiInternalEventDispatcher::InvokeDeviceCallbacks(const WifiEventCallbackMsg &)"; "OHOS::Wifi::WifiInternalEventDispatcher::InvokeDeviceCallbacks(const WifiEventCallbackMsg &)";
"OHOS::Wifi::WifiInternalEventDispatcher::InvokeHotspotCallbacks(const WifiEventCallbackMsg &)"; "OHOS::Wifi::WifiInternalEventDispatcher::InvokeHotspotCallbacks(const WifiEventCallbackMsg &)";

View File

@ -28,7 +28,8 @@ namespace OHOS {
namespace Wifi { namespace Wifi {
struct WifiAppStateAwareCallbacks { 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; class AppStateObserver;
@ -37,8 +38,8 @@ public:
explicit WifiAppStateAware(int instId = 0); explicit WifiAppStateAware(int instId = 0);
~WifiAppStateAware(); ~WifiAppStateAware();
static WifiAppStateAware &GetInstance(); static WifiAppStateAware &GetInstance();
ErrCode InitAppStateAware(const WifiAppStateAwareCallbacks &wifiAppStateAwareCallbacks);
sptr<AppExecFwk::IAppMgr> GetAppMgr(); sptr<AppExecFwk::IAppMgr> GetAppMgr();
ErrCode InitAppStateAware(const WifiAppStateAwareCallbacks &wifiAppStateAwareCallbacks);
void RegisterAppStateObserver(); void RegisterAppStateObserver();
void UnSubscribeAppState(); void UnSubscribeAppState();
void OnForegroundAppChanged(const AppExecFwk::AppStateData &appStateData, const int mInstId = 0); void OnForegroundAppChanged(const AppExecFwk::AppStateData &appStateData, const int mInstId = 0);
@ -46,7 +47,6 @@ public:
bool IsForegroundApp(int32_t uid); bool IsForegroundApp(int32_t uid);
bool IsForegroundApp(const std::string &bundleName); bool IsForegroundApp(const std::string &bundleName);
std::string GetRunningProcessNameByPid(const int uid, const int pid); std::string GetRunningProcessNameByPid(const int uid, const int pid);
private: private:
void RegisterAppStateChangedCallback(const int64_t delayTime = 0); void RegisterAppStateChangedCallback(const int64_t delayTime = 0);
std::mutex mutex_ {}; std::mutex mutex_ {};

View File

@ -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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * 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 * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,

View File

@ -76,7 +76,7 @@ struct MccEntry {
* 2) The ISO 3166 country codes list, available here: * 2) The ISO 3166 country codes list, available here:
* http://www.iso.org/iso/en/prods-services/iso3166ma/02iso-3166-code-lists/index.html * 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[] = { inline const MccEntry MCC_TABLE[] = {
// Fake country code, which is the default value, Scan only 2.4G channels and passively receive 5G beacons // 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 #ifdef FEATURE_AP_SUPPORT
void WifiCountryCodeManager::DealApStateChanged(ApState state, int id) 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) { if (state == ApState::AP_STATE_STARTED) {
WifiCountryCodeManager::GetInstance().UpdateWifiCountryCode(); WifiCountryCodeManager::GetInstance().UpdateWifiCountryCode();
} else if (state != ApState::AP_STATE_STARTING && state != ApState::AP_STATE_STARTED) { } 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 uid = mScanCallBackInfo[msg.id][remote].callingUid;
int pid = mScanCallBackInfo[msg.id][remote].callingPid; int pid = mScanCallBackInfo[msg.id][remote].callingPid;
isFrozen = IsAppFrozen(pid); isFrozen = IsAppFrozen(pid);
WIFI_LOGD("APP is hardwareProxied, uid: %{public}d, pid: %{public}d, hardwareProxied: WIFI_LOGD("APP is hardwareProxied, uid: %{public}d, pid: %{public}d, hardwareProxied: %{public}d",
%{public}d", uid, pid, isFrozen); uid, pid, isFrozen);
#endif #endif
if (mScanCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) { if (mScanCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) {
WIFI_LOGD("Not registered callback event! msg.msgCode: %{public}d," 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 uid = mStaCallBackInfo[msg.id][remote].callingUid;
int pid = mStaCallBackInfo[msg.id][remote].callingPid; int pid = mStaCallBackInfo[msg.id][remote].callingPid;
isFrozen = IsAppFrozen(pid); isFrozen = IsAppFrozen(pid);
WIFI_LOGD("Check calling APP is hardwareProxied, uid: %{public}d, pid: %{public}d, hardwareProxied: WIFI_LOGD("Check calling APP is hardwareProxied,"
%{public}d", uid, pid, isFrozen); "uid: %{public}d, pid: %{public}d, hardwareProxied: %{public}d", uid, pid, isFrozen);
#endif #endif
if (mStaCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) { if (mStaCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) {
WIFI_LOGD("InvokeDeviceCallbacks, Not registered callback event! msg.msgCode: %{public}d," 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 #ifdef SUPPORT_RANDOM_MAC_ADDR
if ((pid != 0) && (uid != 0)) { if ((pid != 0) && (uid != 0)) {
std::vector<WifiP2pDevice> deviceVec = msg.device; std::vector<WifiP2pDevice> deviceVec = msg.device;
if (WifiPermissionUtils::VerifyGetWifiPeersMacPermissionEx(pid, uid, tokenId) == if (WifiPermissionUtils::VerifyGetWifiPeersMacPermissionEx(pid, uid, tokenId) == PERMISSION_DENIED) {
PERMISSION_DENIED) {
WIFI_LOGD("%{public}s: GET_WIFI_PEERS_MAC PERMISSION_DENIED, pid: %{public}d, uid: %{public}d", WIFI_LOGD("%{public}s: GET_WIFI_PEERS_MAC PERMISSION_DENIED, pid: %{public}d, uid: %{public}d",
__func__, pid, uid); __func__, pid, uid);
updateP2pDeviceMacAddress(deviceVec); updateP2pDeviceMacAddress(deviceVec);

View File

@ -163,7 +163,7 @@ bool WifiNetAgent::AddRoute(const std::string interface, const std::string ipAdd
return true; 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); int32_t result = NetConnClient::GetInstance().DelInterfaceAddress(interface, ipAddress, prefixLength);
if (result == NETMANAGER_SUCCESS) { if (result == NETMANAGER_SUCCESS) {
@ -256,9 +256,9 @@ void WifiNetAgent::CreateNetLinkInfo(sptr<NetManagerStandard::NetLinkInfo> &netL
netLinkInfo->ifaceName_ = WifiConfigCenter::GetInstance().GetStaIfaceName(instId); netLinkInfo->ifaceName_ = WifiConfigCenter::GetInstance().GetStaIfaceName(instId);
SetNetLinkIPInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); SetNetLinkIPInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info);
SetNetLinkHostRouteInfo(netLinkInfo, wifiIpInfo);
SetNetLinkRouteInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); SetNetLinkRouteInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info);
SetNetLinkDnsInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); SetNetLinkDnsInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info);
SetNetLinkHostRouteInfo(netLinkInfo, wifiIpInfo);
SetNetLinkLocalRouteInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info); SetNetLinkLocalRouteInfo(netLinkInfo, wifiIpInfo, wifiIpV6Info);
if (wifiProxyConfig.configureMethod == ConfigureProxyMethod::AUTOCONFIGUE) { if (wifiProxyConfig.configureMethod == ConfigureProxyMethod::AUTOCONFIGUE) {
/* Automatic proxy is not supported */ /* Automatic proxy is not supported */
@ -267,7 +267,7 @@ void WifiNetAgent::CreateNetLinkInfo(sptr<NetManagerStandard::NetLinkInfo> &netL
wifiProxyConfig.manualProxyConfig.GetExclusionObjectList(exclusionList); wifiProxyConfig.manualProxyConfig.GetExclusionObjectList(exclusionList);
std::list<std::string> tmpExclusionList; std::list<std::string> tmpExclusionList;
std::copy_if(exclusionList.begin(), exclusionList.end(), std::back_inserter(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_.SetHost(std::move(wifiProxyConfig.manualProxyConfig.serverHostName));
netLinkInfo->httpProxy_.SetPort(wifiProxyConfig.manualProxyConfig.serverPort); netLinkInfo->httpProxy_.SetPort(wifiProxyConfig.manualProxyConfig.serverPort);
netLinkInfo->httpProxy_.SetExclusionList(tmpExclusionList); netLinkInfo->httpProxy_.SetExclusionList(tmpExclusionList);

View File

@ -73,8 +73,7 @@ public:
* @param wifiIpV6Info wifi network link IPV6 data information * @param wifiIpV6Info wifi network link IPV6 data information
* @param wifiProxyConfig wifi network link proxy information * @param wifiProxyConfig wifi network link proxy information
*/ */
void UpdateNetLinkInfo(IpInfo &wifiIpInfo, IpV6Info &wifiIpV6Info, WifiProxyConfig &wifiProxyConfig, void UpdateNetLinkInfo(IpInfo &wifiIpInfo, IpV6Info &wifiIpV6Info, WifiProxyConfig &wifiProxyConfig, int instId = 0);
int instId = 0);
/** /**
* Add route * Add route
@ -92,7 +91,7 @@ public:
* @param ipAddress IP address * @param ipAddress IP address
* @param prefixLength prefix length * @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 * Add OnStaMachineUpdateNetLinkInfo

View File

@ -70,7 +70,7 @@ void NetStateObserver::StopNetStateObserver(sptr<NetStateObserver> &netStateObse
int32_t NetStateObserver::OnNetDetectionResultChanged( int32_t NetStateObserver::OnNetDetectionResultChanged(
NetManagerStandard::NetDetectionResultCode detectionResult, const std::string &urlRedirect) 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) { switch (detectionResult) {
case NetManagerStandard::NET_DETECTION_CAPTIVE_PORTAL: { case NetManagerStandard::NET_DETECTION_CAPTIVE_PORTAL: {
m_callback(SystemNetWorkState::NETWORK_IS_PORTAL, urlRedirect); 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->MakeConcreteManager(roleStaWifi1, msg->GetParam2());
pWifiControllerMachine->SwitchState(pWifiControllerMachine->pEnableState); pWifiControllerMachine->SwitchState(pWifiControllerMachine->pEnableState);
} else {
WIFI_LOGE("DisableState, invalid instance id");
} }
break; break;
case CMD_AIRPLANE_TOGGLED: case CMD_AIRPLANE_TOGGLED:
@ -994,6 +992,7 @@ void WifiControllerMachine::ShutdownWifi(bool shutDownAp)
#endif #endif
#endif #endif
} }
multiStaManagers.StopAllManagers(); multiStaManagers.StopAllManagers();
concreteManagers.StopAllManagers(); concreteManagers.StopAllManagers();
} }

View File

@ -64,10 +64,10 @@ void WifiServiceScheduler::ClearStaIfaceNameMap(int instId)
{ {
WIFI_LOGI("ClearStaIfaceNameMap"); WIFI_LOGI("ClearStaIfaceNameMap");
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
auto iter = g_staIfaceNameMap.begin(); auto iter = staIfaceNameMap.begin();
while (iter != g_staIfaceNameMap.end()) { while (iter != staIfaceNameMap.end()) {
if (iter->first == instId) { if (iter->first == instId) {
g_staIfaceNameMap.erase(iter); staIfaceNameMap.erase(iter);
break; break;
} else { } else {
iter++; iter++;
@ -79,10 +79,10 @@ void WifiServiceScheduler::ClearSoftApIfaceNameMap(int instId)
{ {
WIFI_LOGI("ClearSoftApIfaceNameMap"); WIFI_LOGI("ClearSoftApIfaceNameMap");
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
auto iter = g_softApIfaceNameMap.begin(); auto iter = softApIfaceNameMap.begin();
while (iter != g_softApIfaceNameMap.end()) { while (iter != softApIfaceNameMap.end()) {
if (iter->first == instId) { if (iter->first == instId) {
g_softApIfaceNameMap.erase(iter); softApIfaceNameMap.erase(iter);
break; break;
} else { } else {
iter++; iter++;
@ -278,8 +278,8 @@ ErrCode WifiServiceScheduler::AutoStartScanOnly(int instId, std::string &staIfNa
} }
#ifdef HDI_CHIP_INTERFACE_SUPPORT #ifdef HDI_CHIP_INTERFACE_SUPPORT
std::string ifaceName = ""; std::string ifaceName = "";
if (g_staIfaceNameMap.count(instId) > 0) { if (staIfaceNameMap.count(instId) > 0) {
ifaceName = g_staIfaceNameMap[instId]; ifaceName = staIfaceNameMap[instId];
} }
if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateStaIface( if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateStaIface(
std::bind(&WifiServiceScheduler::StaIfaceDestoryCallback, this, std::placeholders::_1, std::placeholders::_2), 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); WIFI_LOGI("AutoStartScanOnly SetStaIfaceName:%{public}s, instId:%{public}d", ifaceName.c_str(), instId);
WifiConfigCenter::GetInstance().SetStaIfaceName(ifaceName); WifiConfigCenter::GetInstance().SetStaIfaceName(ifaceName);
staIfName = ifaceName; staIfName = ifaceName;
g_staIfaceNameMap.insert(std::make_pair(instId, ifaceName)); staIfaceNameMap.insert(std::make_pair(instId, ifaceName));
#endif #endif
WifiConfigCenter::GetInstance().SetWifiScanOnlyMidState(WifiOprMidState::OPENING, instId); WifiConfigCenter::GetInstance().SetWifiScanOnlyMidState(WifiOprMidState::OPENING, instId);
if (instId == INSTID_WLAN0) { if (instId == INSTID_WLAN0) {
@ -390,8 +390,8 @@ ErrCode WifiServiceScheduler::PreStartWifi(int instId, std::string &staIfName)
{ {
#ifdef HDI_CHIP_INTERFACE_SUPPORT #ifdef HDI_CHIP_INTERFACE_SUPPORT
std::string ifaceName = ""; std::string ifaceName = "";
if (g_staIfaceNameMap.count(instId) > 0) { if (staIfaceNameMap.count(instId) > 0) {
ifaceName = g_staIfaceNameMap[instId]; ifaceName = staIfaceNameMap[instId];
staIfName = ifaceName; staIfName = ifaceName;
} }
if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateStaIface( 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); WIFI_LOGI("PreStartWifi SetStaIfaceName:%{public}s, instId:%{public}d", ifaceName.c_str(), instId);
WifiConfigCenter::GetInstance().SetStaIfaceName(ifaceName, 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); staIfName = WifiConfigCenter::GetInstance().GetStaIfaceName(instId);
#endif #endif
WifiOprMidState staState = WifiConfigCenter::GetInstance().GetWifiMidState(instId); 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", WIFI_LOGI("IfaceDestoryCallback, ifaceName:%{public}s, ifaceType:%{public}d",
destoryIfaceName.c_str(), createIfaceType); destoryIfaceName.c_str(), createIfaceType);
auto iter = g_staIfaceNameMap.begin(); auto iter = staIfaceNameMap.begin();
while (iter != g_staIfaceNameMap.end()) { while (iter != staIfaceNameMap.end()) {
if (destoryIfaceName == iter->second) { if (destoryIfaceName == iter->second) {
auto &ins = WifiManager::GetInstance().GetWifiTogglerManager()->GetControllerMachine(); auto &ins = WifiManager::GetInstance().GetWifiTogglerManager()->GetControllerMachine();
ins->SendMessage(CMD_STA_REMOVED, createIfaceType, iter->first); ins->SendMessage(CMD_STA_REMOVED, createIfaceType, iter->first);
if (createIfaceType >= 0) { if (createIfaceType >= 0) {
WifiConfigCenter::GetInstance().SetStaIfaceName("", iter->first); WifiConfigCenter::GetInstance().SetStaIfaceName("", iter->first);
g_staIfaceNameMap.erase(iter); staIfaceNameMap.erase(iter);
} }
return; return;
} else { } else {
@ -799,8 +799,8 @@ ErrCode WifiServiceScheduler::AutoStartApService(int instId, std::string &softAp
} }
#ifdef HDI_CHIP_INTERFACE_SUPPORT #ifdef HDI_CHIP_INTERFACE_SUPPORT
std::string ifaceName = ""; std::string ifaceName = "";
if (g_softApIfaceNameMap.count(instId) > 0) { if (softApIfaceNameMap.count(instId) > 0) {
ifaceName = g_softApIfaceNameMap[instId]; ifaceName = softApIfaceNameMap[instId];
} }
if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateApIface( if (ifaceName.empty() && !HalDeviceManager::GetInstance().CreateApIface(
std::bind(&WifiServiceScheduler::SoftApIfaceDestoryCallback, std::bind(&WifiServiceScheduler::SoftApIfaceDestoryCallback,
@ -811,7 +811,7 @@ ErrCode WifiServiceScheduler::AutoStartApService(int instId, std::string &softAp
} }
WifiConfigCenter::GetInstance().SetApIfaceName(ifaceName); WifiConfigCenter::GetInstance().SetApIfaceName(ifaceName);
softApIfName = ifaceName; softApIfName = ifaceName;
g_softApIfaceNameMap.insert(std::make_pair(instId, ifaceName)); softApIfaceNameMap.insert(std::make_pair(instId, ifaceName));
#endif #endif
if (!WifiConfigCenter::GetInstance().SetApMidState(apState, WifiOprMidState::OPENING, 0)) { if (!WifiConfigCenter::GetInstance().SetApMidState(apState, WifiOprMidState::OPENING, 0)) {
WIFI_LOGE("AutoStartApService, set ap mid state opening failed!"); 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", WIFI_LOGI("IfaceDestoryCallback, ifaceName:%{public}s, ifaceType:%{public}d",
destoryIfaceName.c_str(), createIfaceType); destoryIfaceName.c_str(), createIfaceType);
auto iter = g_softApIfaceNameMap.begin(); auto iter = softApIfaceNameMap.begin();
while (iter != g_softApIfaceNameMap.end()) { while (iter != softApIfaceNameMap.end()) {
if (destoryIfaceName == iter->second) { if (destoryIfaceName == iter->second) {
WifiConfigCenter::GetInstance().SetSoftapToggledState(false); WifiConfigCenter::GetInstance().SetSoftapToggledState(false);
auto &ins = WifiManager::GetInstance().GetWifiTogglerManager()->GetControllerMachine(); auto &ins = WifiManager::GetInstance().GetWifiTogglerManager()->GetControllerMachine();
ins->SendMessage(CMD_AP_REMOVED, createIfaceType, iter->first); ins->SendMessage(CMD_AP_REMOVED, createIfaceType, iter->first);
if (createIfaceType >= 0) { if (createIfaceType >= 0) {
WifiConfigCenter::GetInstance().SetApIfaceName(""); WifiConfigCenter::GetInstance().SetApIfaceName("");
g_softApIfaceNameMap.erase(iter); softApIfaceNameMap.erase(iter);
} }
return; return;
} else { } else {

View File

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

View File

@ -48,6 +48,7 @@ config("wifi_fw_common_header") {
include_dirs += [ include_dirs += [
"//base/hiviewdfx/hilog_lite/interfaces/native/innerkits", "//base/hiviewdfx/hilog_lite/interfaces/native/innerkits",
"//third_party/bounds_checking_function/include", "//third_party/bounds_checking_function/include",
"//third_party/wpa_supplicant/wpa_supplicant-2.9/src",
] ]
} }
} }
@ -144,6 +145,7 @@ if (defined(ohos_lite)) {
ldflags += [ ldflags += [
"-fPIC", "-fPIC",
"-Wl,-E", "-Wl,-E",
"-lwpa_client",
] ]
} }
} else { } else {

View File

@ -13,6 +13,13 @@
* limitations under the License. * 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 "securec.h"
#include "wifi_hdi_common.h" #include "wifi_hdi_common.h"
@ -557,7 +564,7 @@ int HdiConvertIeRsn(const uint8_t *rsnIe, size_t rsnIeLen,
data->hasGroup = 1; data->hasGroup = 1;
if (!HdiCheckValidGroup(data->groupCipher)) { if (!HdiCheckValidGroup(data->groupCipher)) {
LOGI("invalid group cipher 0x%{public}x (%08x)", data->groupCipher, LOGI("invalid group cipher 0x%{public}x (%08x)", data->groupCipher,
HdiGetBe32(pos)); HdiGetBe32(pos));
return -1; return -1;
} }
pos += HDI_SELECTOR_LEN; 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) { if (wpaIeLen >= HDI_POS_FIRST && hdiIe[0] == HDI_EID_RSN) {
return HdiConvertIeRsn(hdiIe, wpaIeLen, data); return HdiConvertIeRsn(hdiIe, wpaIeLen, data);
} }
if (wpaIeLen >= HDI_POS_SIX && hdiIe[0] == HDI_EID_VENDOR_SPECIFIC && 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) { hdiIe[1] >= HDI_POS_FOURTH && HdiGetBe32(&hdiIe[HDI_POS_SECOND]) == HDI_OSEN_IE_VENDOR_TYPE) {
return HdiConvertIeRsn(hdiIe, wpaIeLen, data); return HdiConvertIeRsn(hdiIe, wpaIeLen, data);
} else { }
else {
return HdiConvertIe(hdiIe, wpaIeLen, data); 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; struct HdiIeData data;
char *start; char *start;

View File

@ -304,18 +304,18 @@ typedef enum HdiPortType {
} HdiPortType; } HdiPortType;
typedef enum { typedef enum {
PROTOCOL_80211_IFTYPE_UNSPECIFIED, /**< Unspecified type */ PROTOCOL_80211_IFTYPE_UNSPECIFIED,
PROTOCOL_80211_IFTYPE_ADHOC, /**< Ad hoc network */ PROTOCOL_80211_IFTYPE_ADHOC,
PROTOCOL_80211_IFTYPE_STATION, /**< Station */ PROTOCOL_80211_IFTYPE_STATION,
PROTOCOL_80211_IFTYPE_AP, /**< Access point (AP) */ PROTOCOL_80211_IFTYPE_AP,
PROTOCOL_80211_IFTYPE_AP_VLAN, /**< Virtual AP */ PROTOCOL_80211_IFTYPE_AP_VLAN,
PROTOCOL_80211_IFTYPE_WDS, /**< Wireless distributed system */ PROTOCOL_80211_IFTYPE_WDS,
PROTOCOL_80211_IFTYPE_MONITOR, /**< Listening */ PROTOCOL_80211_IFTYPE_MONITOR,
PROTOCOL_80211_IFTYPE_MESH_POINT, /**< Mesh network */ PROTOCOL_80211_IFTYPE_MESH_POINT,
PROTOCOL_80211_IFTYPE_P2P_CLIENT, /**< P2P client */ PROTOCOL_80211_IFTYPE_P2P_CLIENT,
PROTOCOL_80211_IFTYPE_P2P_GO, /**< P2P group owner */ PROTOCOL_80211_IFTYPE_P2P_GO,
PROTOCOL_80211_IFTYPE_P2P_DEVICE, /**< P2P device */ PROTOCOL_80211_IFTYPE_P2P_DEVICE,
PROTOCOL_80211_IFTYPE_NUM, /**< Number of network ports */ PROTOCOL_80211_IFTYPE_NUM,
} FeatureType; } FeatureType;
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -473,8 +473,8 @@ static void GetInfoElems(int length, int end, char *srcBuf, ScanInfo *pcmd)
#endif #endif
static int HdiParseExtensionInfo(const uint8_t *pos, size_t elen, static int HdiParseExtensionInfo(const uint8_t *pos, size_t elen,
struct HdiElems *elems, struct HdiElems *elems,
int show_errors) int show_errors)
{ {
uint8_t ext_id; 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, static int HdiParseVendorSpec(const uint8_t *pos, size_t elen,
struct HdiElems *elems, struct HdiElems *elems,
int show_errors) int show_errors)
{ {
unsigned int oui; unsigned int oui;
@ -596,7 +596,7 @@ static int HdiParseVendorSpec(const uint8_t *pos, size_t elen,
if (show_errors) { if (show_errors) {
LOGI("short vendor specific " LOGI("short vendor specific "
"information HdiElem ignored (len=%{public}lu)", "information HdiElem ignored (len=%{public}lu)",
(unsigned long) elen); (unsigned long) elen);
} }
return -1; 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) static int HdiCheckBssExtCap(const uint8_t *ies, size_t len, unsigned int capab)
{ {
return HdiCheckExtCap(HdiBssGetIe(ies, len, HDI_EID_EXT_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; const uint8_t *end;
size_t flen, i; 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) static bool HdiGetRsnCapab(const uint8_t *rsnxe, unsigned int capab)
{ {
return HdiGetRsnCapabLen(rsnxe ? rsnxe + HDI_POS_SECOND : NULL, 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) 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 (!HdiCheckCompleted(elem, start, len)) {
if (show) { if (show) {
LOGI("IEEE 802.11 HdiElem parse failed @%{public}d", 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; return -1;
} }
@ -1048,7 +1049,7 @@ int GetScanResultText(const struct WifiScanResultExt *scanResult,
if (!p2p) if (!p2p)
p2p = HdiBssGetVendorBeacon(scanResult->ie, scanResult->ieLen, p2p = HdiBssGetVendorBeacon(scanResult->ie, scanResult->ieLen,
scanResult->beaconIeLen, HDI_P2P_IE_VENDOR_TYPE); 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) { memcmp(elems->ssid, HDI_P2P_CARD_SSID, HDI_P2P_CARD_SSID_LEN) == 0) {
return 0; return 0;
} }

View File

@ -59,8 +59,8 @@
#define AP_IFNAME_COEX "wlan1" #define AP_IFNAME_COEX "wlan1"
#define WIFI_DEFAULT_CFG "hostapd.conf" #define WIFI_DEFAULT_CFG "hostapd.conf"
#define WIFI_COEX_CFG "hostapd_coex.conf" #define WIFI_COEX_CFG "hostapd_coex.conf"
#define HOSTAPD_DEFAULT_CFG CONFIG_ROOR_DIR"wap_supplicant"WIFI_DEFAULT_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 #define HOSTAPD_DEFAULT_CFG_COEX CONFIG_ROOR_DIR"/wap_supplicant/"WIFI_COEX_CFG
#endif #endif
const char *HDI_WPA_SERVICE_NAME = "wpa_interface_service"; const char *HDI_WPA_SERVICE_NAME = "wpa_interface_service";
@ -95,13 +95,13 @@ static bool FindifaceName(const char* ifName)
LOGI("%{public}s err1", __func__); LOGI("%{public}s err1", __func__);
return true; return true;
} }
struct IfaceNameInfo* current = g_IfaceNameInfoHead; struct IfaceNameInfo* currernt = g_IfaceNameInfoHead;
while (current != NULL) { while (currernt != NULL) {
if (strncmp(current->ifName, ifName, strlen(ifName)) == 0) { if (strncmp(currernt->ifName, ifName, strlen(ifName)) == 0) {
LOGI("%{public}s out1", __func__); LOGI("%{public}s out1", __func__);
return true; return true;
} }
current = current->next; currernt = currernt->next;
} }
LOGI("%{public}s out", __func__); LOGI("%{public}s out", __func__);
return false; return false;
@ -115,33 +115,33 @@ static void AddIfaceName(const char* ifName)
return; return;
} }
struct IfaceNameInfo* pre = NULL; struct IfaceNameInfo* pre = NULL;
struct IfaceNameInfo* current = g_IfaceNameInfoHead; struct IfaceNameInfo* currernt = g_IfaceNameInfoHead;
while (current != NULL) { while (currernt != NULL) {
pre = current; pre = currernt;
current = current->next; currernt = currernt->next;
} }
current =(struct IfaceNameInfo*) malloc(sizeof(struct IfaceNameInfo)); currernt =(struct IfaceNameInfo*) malloc(sizeof(struct IfaceNameInfo));
if (current == NULL) { if (currernt == NULL) {
LOGI("%{public}s err2", __func__); LOGI("%{public}s err2", __func__);
return; return;
} }
if (memset_s(current->ifName, BUFF_SIZE, 0, strlen(ifName)) != EOK) { if (memset_s(currernt->ifName, BUFF_SIZE, 0, strlen(ifName)) != EOK) {
free(current); free(currernt);
current = NULL; currernt = NULL;
LOGI("%{public}s err4", __func__); LOGI("%{public}s err4", __func__);
return; return;
} }
current->next = NULL; currernt->next = NULL;
if (strncpy_s(current->ifName, BUFF_SIZE, ifName, strlen(ifName)) != EOK) { if (strncpy_s(currernt->ifName, BUFF_SIZE, ifName, strlen(ifName)) != EOK) {
free(current); free(currernt);
current = NULL; currernt = NULL;
LOGI("%{public}s err3", __func__); LOGI("%{public}s err3", __func__);
return; return;
} }
if (pre != NULL) { if (pre != NULL) {
pre->next = current; pre->next = currernt;
} else { } else {
g_IfaceNameInfoHead = current; g_IfaceNameInfoHead = currernt;
} }
LOGI("%{public}s out", __func__); LOGI("%{public}s out", __func__);
return; return;
@ -154,20 +154,20 @@ static void RemoveIfaceName(const char* ifName)
return; return;
} }
struct IfaceNameInfo* pre = NULL; struct IfaceNameInfo* pre = NULL;
struct IfaceNameInfo* current = g_IfaceNameInfoHead; struct IfaceNameInfo* currernt = g_IfaceNameInfoHead;
while (current != NULL) { while (currernt != NULL) {
if (strncmp(current->ifName, ifName, BUFF_SIZE) != 0) { if (strncmp(currernt->ifName, ifName, BUFF_SIZE) != 0) {
pre = current; pre = currernt;
current = current->next; currernt = currernt->next;
continue; continue;
} }
if (pre == NULL) { if (pre == NULL) {
g_IfaceNameInfoHead = current->next; g_IfaceNameInfoHead = currernt->next;
} else { } else {
pre->next = current->next; pre->next = currernt->next;
} }
free(current); free(currernt);
current = NULL; currernt = NULL;
} }
LOGI("%{public}s out", __func__); LOGI("%{public}s out", __func__);
return; return;
@ -738,7 +738,7 @@ WifiErrorNo HdiApStop(int id)
int32_t ret; int32_t ret;
if (g_apObj == NULL) { 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); pthread_mutex_unlock(&g_apObjMutex);
return WIFI_HAL_OPT_OK; return WIFI_HAL_OPT_OK;
} }
@ -831,7 +831,7 @@ void SetExecDisable(int execDisable)
{ {
g_execDisable = execDisable; g_execDisable = execDisable;
} }
int GetExecDisable() int GetExecDisable()
{ {
return g_execDisable; return g_execDisable;

View File

@ -619,8 +619,8 @@ int32_t OnEventGroupStarted(struct IWpaCallback *self,
if (groupStartedParam == nullptr) { if (groupStartedParam == nullptr) {
return 1; return 1;
} }
const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst();
char tempSsid[WIFI_SSID_LENGTH] = {0}; char tempSsid[WIFI_SSID_LENGTH] = {0};
const OHOS::Wifi::P2pHalCallback &cbk = OHOS::Wifi::WifiP2PHalInterface::GetInstance().GetP2pCallbackInst();
if (cbk.onGroupStarted) { if (cbk.onGroupStarted) {
OHOS::Wifi::HalP2pGroupInfo cbInfo; OHOS::Wifi::HalP2pGroupInfo cbInfo;
cbInfo.isGo = groupStartedParam->isGo; cbInfo.isGo = groupStartedParam->isGo;

View File

@ -237,7 +237,8 @@ void WifiStaManager::DealStaConnChanged(OperateResState state, const WifiLinkedI
} }
NotifyScanForStaConnChanged(state, instId); NotifyScanForStaConnChanged(state, instId);
PublishWifiOperateStateHiSysEvent(state); PublishWifiOperateStateHiSysEvent(state);
if (info.connState == ConnState::AUTHENTICATING) { if (info.connState == ConnState::AUTHENTICATING)
{
WriteWifiOperateStateHiSysEvent(static_cast<int>(WifiOperateType::STA_AUTH), WriteWifiOperateStateHiSysEvent(static_cast<int>(WifiOperateType::STA_AUTH),
static_cast<int>(WifiOperateState::STA_AUTHING)); static_cast<int>(WifiOperateState::STA_AUTHING));
} }

View File

@ -116,6 +116,7 @@ if (defined(ohos_lite)) {
include_dirs = local_base_include_dirs include_dirs = local_base_include_dirs
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_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/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta",
"$WIFI_ROOT_DIR/utils/inc", "$WIFI_ROOT_DIR/utils/inc",
] ]
@ -160,7 +161,6 @@ if (defined(ohos_lite)) {
"dhcp:dhcp_utils", "dhcp:dhcp_utils",
"eventhandler:libeventhandler", "eventhandler:libeventhandler",
"hilog:libhilog", "hilog:libhilog",
"icu:shared_icuuc",
"ipc:ipc_single", "ipc:ipc_single",
"jsoncpp:jsoncpp", "jsoncpp:jsoncpp",
"libxml2:libxml2", "libxml2:libxml2",

View File

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