mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2025-02-21 09:33:16 +00:00
代码同步
Signed-off-by: zhangqin88 <zhangqin88@huawei.com>
This commit is contained in:
parent
542e8fa9f7
commit
b9cd239564
4
OAT.xml
4
OAT.xml
@ -27,7 +27,6 @@
|
||||
</policylist>
|
||||
<filefilterlist>
|
||||
<filefilter name="defaultFilter" desc="Files not to check">
|
||||
<filteritem type="filename" name="hvigorfile.ts" desc="Build Files"/>
|
||||
</filefilter>
|
||||
<filefilter name="defaultPolicyFilter" desc="Filters for compatibility, license header policies">
|
||||
<filteritem type="filename" name="*.cfg" desc="The JSON format does not support comments."/>
|
||||
@ -45,9 +44,6 @@
|
||||
</filefilter>
|
||||
<filefilter name="binaryFileTypePolicyFilter" desc="Filters for binary file policies">
|
||||
<filteritem type="filename" name="*.png" desc="Image for markdown doc"/>
|
||||
<filteritem type="filename" name="*.gif" desc="Image for markdown doc"/>
|
||||
<filteritem type="filename" name="*.jpg" desc="Image for markdown doc"/>
|
||||
<filteritem type="filename" name="*.ico" desc="Image for markdown doc"/>
|
||||
</filefilter>
|
||||
</filefilterlist>
|
||||
<licensematcherlist>
|
||||
|
@ -155,13 +155,12 @@ if (defined(ohos_lite)) {
|
||||
}
|
||||
cflags = memory_optimization_cflags
|
||||
cflags_cc = memory_optimization_cflags_cc
|
||||
ldflags = memory_optimization_ldflags
|
||||
cflags_cc += [
|
||||
"-std=c++17",
|
||||
"-fno-rtti",
|
||||
]
|
||||
|
||||
ldflags += [
|
||||
ldflags = [
|
||||
"-fPIC",
|
||||
"-Wl,-E",
|
||||
]
|
||||
|
@ -52,14 +52,6 @@ const std::unordered_map<std::string, AppType> appTypeMap = {
|
||||
AppParser::AppParser()
|
||||
{
|
||||
WIFI_LOGI("%{public}s enter", __FUNCTION__);
|
||||
if (IsReadCloudConfig()) {
|
||||
ReadPackageCloudFilterConfig();
|
||||
}
|
||||
if (InitAppParser(WIFI_MONITOR_APP_FILE_PATH)) {
|
||||
WIFI_LOGD("%{public}s InitAppParser successful", __FUNCTION__);
|
||||
} else {
|
||||
WIFI_LOGE("%{public}s InitAppParser fail", __FUNCTION__);
|
||||
};
|
||||
}
|
||||
|
||||
AppParser::~AppParser()
|
||||
@ -69,15 +61,24 @@ AppParser::~AppParser()
|
||||
|
||||
AppParser &AppParser::GetInstance()
|
||||
{
|
||||
static std::mutex xmlMutex;
|
||||
static AppParser *instance;
|
||||
if (instance == nullptr) {
|
||||
std::unique_lock<std::mutex> lock(xmlMutex);
|
||||
if (instance == nullptr) {
|
||||
instance = new (std::nothrow) AppParser();
|
||||
static AppParser instance;
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool AppParser::Init()
|
||||
{
|
||||
if (!initFlag_) {
|
||||
if (IsReadCloudConfig()) {
|
||||
ReadPackageCloudFilterConfig();
|
||||
}
|
||||
if (InitAppParser(WIFI_MONITOR_APP_FILE_PATH)) {
|
||||
initFlag_ = true;
|
||||
WIFI_LOGD("%{public}s InitAppParser successful", __FUNCTION__);
|
||||
} else {
|
||||
WIFI_LOGE("%{public}s InitAppParser fail", __FUNCTION__);
|
||||
};
|
||||
}
|
||||
return *instance;
|
||||
return initFlag_;
|
||||
}
|
||||
|
||||
bool AppParser::IsLowLatencyApp(const std::string &bundleName) const
|
||||
|
@ -51,6 +51,7 @@ public:
|
||||
bool IsBlackListApp(const std::string &bundleName) const;
|
||||
bool IsChariotApp(const std::string &bundleName) const;
|
||||
bool IsHighTempLimitSpeedApp(const std::string &bundleName) const;
|
||||
bool Init();
|
||||
|
||||
private:
|
||||
bool InitAppParser(const char *appXmlFilePath);
|
||||
@ -76,6 +77,7 @@ private:
|
||||
std::vector<HighTempLimitSpeedAppInfo> m_highTempLimitSpeedAppVec {};
|
||||
std::vector<HighTempLimitSpeedAppInfo> m_highTempLimitSpeedAppVecCloudPush {};
|
||||
bool mIshighTempLimitSpeedReadCloudPush = false;
|
||||
bool initFlag_ = false;
|
||||
};
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
|
@ -1702,6 +1702,5 @@ NO_SANITIZE("cfi") napi_value GetWifiDetailState(napi_env env, napi_callback_inf
|
||||
napi_create_int32(env, static_cast<int>(state), &value);
|
||||
return value;
|
||||
}
|
||||
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
|
@ -149,8 +149,8 @@ static bool GetHotspotconfigFromJs(const napi_env& env, const napi_value& object
|
||||
value = 0;
|
||||
JsObjectToInt(env, object, "leaseTime", value);
|
||||
ClearJsLastException(env);
|
||||
if (value < static_cast<int>(DHCP_LEASE_TIME_MIN)) {
|
||||
value = static_cast<int>(DHCP_LEASE_TIME);
|
||||
if (value < (int)(DHCP_LEASE_TIME_MIN)) {
|
||||
value = (int)(DHCP_LEASE_TIME);
|
||||
}
|
||||
config.SetLeaseTime(value);
|
||||
return true;
|
||||
|
@ -219,7 +219,6 @@ if (defined(ohos_lite)) {
|
||||
|
||||
ohos_source_set("wifi_p2p_proxy_impl") {
|
||||
branch_protector_ret = "pac_ret"
|
||||
|
||||
sanitize = {
|
||||
cfi = true # Enable/disable control flow integrity detection
|
||||
boundary_sanitize = true # Enable boundary san detection
|
||||
|
@ -119,7 +119,6 @@ struct HotspotConfig {
|
||||
{
|
||||
return band;
|
||||
}
|
||||
|
||||
inline void SetBandWidth(int32_t bandWidth)
|
||||
{
|
||||
apBandWidth = bandWidth;
|
||||
@ -128,6 +127,7 @@ struct HotspotConfig {
|
||||
{
|
||||
return apBandWidth;
|
||||
}
|
||||
|
||||
inline void SetChannel(int32_t newchannel)
|
||||
{
|
||||
channel = newchannel;
|
||||
|
@ -125,9 +125,8 @@ public:
|
||||
ErrCode AddDeviceConfig(const WifiDeviceConfig &config, int &result, bool isCandidate) override;
|
||||
|
||||
/**
|
||||
* @Description set tx power for sar.
|
||||
*
|
||||
* @param power - 1001,1002,1003......
|
||||
* @Description set tx power for sar
|
||||
* @param power - 1001·1002·1003......
|
||||
* @return ErrCode - operation result
|
||||
*/
|
||||
ErrCode SetWifiTxPower(int power) override;
|
||||
|
@ -793,7 +793,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;
|
||||
@ -944,7 +944,7 @@ ErrCode WifiDeviceProxy::StartRoamToNetwork(const int networkId, const std::stri
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
WIFI_LOGE("%{public}s Write interface token error.", __func__);
|
||||
WIFI_LOGE("%{public}s write interface token error.", __func__);
|
||||
return WIFI_OPT_FAILED;
|
||||
}
|
||||
data.WriteInt32(0);
|
||||
@ -1973,8 +1973,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;
|
||||
@ -2161,10 +2160,12 @@ ErrCode WifiDeviceProxy::EnableHiLinkHandshake(bool uiFlag, std::string &bssid,
|
||||
WIFI_LOGE("Write interface token error, func:%{public}s", __func__);
|
||||
return WIFI_OPT_FAILED;
|
||||
}
|
||||
|
||||
data.WriteInt32(0);
|
||||
data.WriteBool(uiFlag);
|
||||
data.WriteString(bssid);
|
||||
WriteDeviceConfig(deviceConfig, data);
|
||||
|
||||
//Wirte device config
|
||||
int error = Remote()->SendRequest(static_cast<uint32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), data,
|
||||
reply, option);
|
||||
@ -2173,6 +2174,7 @@ ErrCode WifiDeviceProxy::EnableHiLinkHandshake(bool uiFlag, std::string &bssid,
|
||||
static_cast<int32_t>(DevInterfaceCode::WIFI_SVR_CMD_IS_HILINK_CONNECT), error);
|
||||
return WIFI_OPT_FAILED;
|
||||
}
|
||||
|
||||
int exception = reply.ReadInt32();
|
||||
if (exception) {
|
||||
WIFI_LOGE("Reply Read failed, exception:%{public}d", exception);
|
||||
|
@ -1734,6 +1734,5 @@ ErrCode WifiDeviceProxy::GetWifiDetailState(WifiDetailState &state)
|
||||
}
|
||||
return ErrCode(owner.retCode);
|
||||
}
|
||||
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
|
@ -43,6 +43,7 @@ private:
|
||||
|
||||
private:
|
||||
sptr<IWifiHotspotCallback> userCallback_;
|
||||
|
||||
bool mRemoteDied;
|
||||
};
|
||||
} // namespace Wifi
|
||||
|
@ -138,7 +138,7 @@ P2P_CHR_EVENT:
|
||||
__BASE: {type: STATISTIC, level: MINOR, desc: P2P chr event}
|
||||
EVENT_NAME: {type: STRING, desc: event name}
|
||||
EVENT_VALUE: {type: STRING, desc: event value}
|
||||
|
||||
|
||||
P2P_CONNECT_STATICS:
|
||||
__BASE: {type: STATISTIC, level: MINOR, desc: P2P KPI}
|
||||
CONN_CNT: {type: INT32, desc: P2P connect count}
|
||||
@ -150,7 +150,7 @@ P2P_CONNECT_FAIL:
|
||||
__BASE: {type: FAULT, level: MINOR, desc: P2P conect fail}
|
||||
ERR_CODE: {type: INT32, desc: fail error code}
|
||||
SUB_ERR_CODE: {type: INT32, desc: fail reason}
|
||||
|
||||
|
||||
P2P_ABNORMAL_DISCONNECT:
|
||||
__BASE: {type: FAULT, level: MINOR, desc: P2P abnormal disconect}
|
||||
ERR_CODE: {type: INT32, desc: fail error code}
|
||||
|
@ -12,7 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
interface=wlan1
|
||||
ctrl_interface=/data/service/ell/public/wifi/sockets/wpa
|
||||
ctrl_interface=/data/service/el1/public/wifi/sockets/wpa
|
||||
ssid=testap
|
||||
hw_mode=g
|
||||
channel=1
|
||||
|
@ -12,7 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
interface=wlan1
|
||||
ctrl_interface=/data/service/ell/public/wifi/sockets/wpa
|
||||
ctrl_interface=/data/service/el1/public/wifi/sockets/wpa
|
||||
ssid=testap
|
||||
hw_mode=g
|
||||
channel=1
|
||||
|
@ -12,7 +12,7 @@
|
||||
# limitations under the License.
|
||||
|
||||
interface=wlan1
|
||||
ctrl_interface=/data/service/ell/public/wifi/sockets/wpa
|
||||
ctrl_interface=/data/service/el1/public/wifi/sockets/wpa
|
||||
ssid=testap
|
||||
hw_mode=g
|
||||
channel=1
|
||||
|
@ -67,7 +67,7 @@ WifiErrorNo StartHostapd(void)
|
||||
int onceMove = 0;
|
||||
int sumMove = 0;
|
||||
onceMove = snprintf_s(p, WIFI_MULTI_CMD_MAX_LEN - sumMove,
|
||||
WIFI_MULTI_CMD_MAX_LEN - sumMove - 1, "%s", WPA_HOSTAPD_NAME);
|
||||
WIFI_MULTI_CMD_MAX_LEN - sumMove -1, "%s", WPA_HOSTAPD_NAME);
|
||||
if (onceMove < 0) {
|
||||
return WIFI_HAL_FAILED;
|
||||
}
|
||||
|
@ -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!");
|
||||
|
@ -239,7 +239,7 @@ int RpcGetSupportedComboModes(RpcServer *server, Context *context)
|
||||
return HAL_FAILURE;
|
||||
}
|
||||
int maxSize = 0;
|
||||
if (ReadInt(context, &maxSize) < 0 || maxSize <= 0 || maxSize > WIFI_IDL_INTERFACE_SUPPORT_COMBINATIONS) {
|
||||
if (ReadInt(context, &maxSize) < 0 || maxSize <= 0 || maxSize > WIFI_IDL_INTERFACE_SUPPORT_COMBINATIONS) {
|
||||
return HAL_FAILURE;
|
||||
}
|
||||
int *modes = (int *)calloc(maxSize, sizeof(int));
|
||||
|
@ -629,9 +629,9 @@ static int WpaP2pCallBackFunc(char *p)
|
||||
} else if (strncmp(p, P2P_EVENT_PROV_DISC_FAILURE, strlen(P2P_EVENT_PROV_DISC_FAILURE)) == 0) {
|
||||
P2pHalCbProvisionDiscoveryFailure();
|
||||
} else if (strncmp(p, AP_STA_DISCONNECTED, strlen(AP_STA_DISCONNECTED)) == 0) {
|
||||
DealP2pConnectChanged(p + strlen(AP_STA_DISCONNECTED), 0);
|
||||
DealP2pConnectChanged(p, 0);
|
||||
} else if (strncmp(p, AP_STA_CONNECTED, strlen(AP_STA_CONNECTED)) == 0) {
|
||||
DealP2pConnectChanged(p + strlen(AP_STA_CONNECTED), 1);
|
||||
DealP2pConnectChanged(p, 1);
|
||||
} else if (strncmp(p, P2P_EVENT_SERV_DISC_REQ, strlen(P2P_EVENT_SERV_DISC_REQ)) == 0) {
|
||||
DealP2pServDiscReqEvent(p);
|
||||
} else {
|
||||
|
@ -104,7 +104,7 @@ int HalCallbackNotify(const char* event)
|
||||
|
||||
WifiWpaChbaInterface *GetWifiWpaChbaInterface()
|
||||
{
|
||||
if (g_wpaChbaInterface != NULL) {
|
||||
if(g_wpaChbaInterface != NULL) {
|
||||
return g_wpaChbaInterface;
|
||||
}
|
||||
g_wpaChbaInterface = (WifiWpaChbaInterface *)calloc(1, sizeof(WifiWpaChbaInterface));
|
||||
|
@ -207,15 +207,14 @@ static int StopModuleInternalSendTerminate(void)
|
||||
return (ret == 0 ? HAL_SUCCESS : HAL_FAILURE);
|
||||
}
|
||||
|
||||
static int StopModuleInternalSoftAp(void) __attribute__((no_sanitize("cfi")))
|
||||
static int StopModuleInternalSoftAp(void)
|
||||
{
|
||||
int id = 0;
|
||||
WifiHostapdHalDevice *hostapdHalDevice = GetWifiHostapdDev(id);
|
||||
WifiHostapdHalDevice *hostapdHalDevice = GetWifiHostapdDev(0);
|
||||
if (hostapdHalDevice == NULL) {
|
||||
LOGE("Get hostap dev interface failed!");
|
||||
return WIFI_HAL_FAILED;
|
||||
}
|
||||
if (hostapdHalDevice->terminateAp(id) != 0) {
|
||||
if (hostapdHalDevice->terminateAp(0) != 0) {
|
||||
LOGE("terminateAp failed!");
|
||||
return WIFI_HAL_FAILED;
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ static WifiErrorNo AddP2pRandomMacFlag()
|
||||
LOGE("%{public}s: failed to open the file", __func__);
|
||||
return WIFI_HAL_FAILED;
|
||||
}
|
||||
while (fgets(str, BUFF_SIZE, fp)) {
|
||||
while (fgets(str, BUFF_SIZE, fp) != NULL) {
|
||||
if (strstr(str, P2P_RANDOM_MAC_FLAG) != NULL) {
|
||||
indicate = 1;
|
||||
break;
|
||||
|
@ -535,7 +535,7 @@ WifiErrorNo GetSupportFeature(long *feature)
|
||||
|
||||
WifiErrorNo RunCmd(const char *ifname, int32_t cmdid, const unsigned char *buf, int32_t bufSize)
|
||||
{
|
||||
if (ifname == NULL || buf == NULL) {
|
||||
if (ifname == NULL|| buf == NULL) {
|
||||
LOGE("RunCmd() ifname or buf is NULL");
|
||||
return WIFI_HAL_FAILED;
|
||||
}
|
||||
|
@ -30,11 +30,12 @@
|
||||
},
|
||||
"apl" : "system_basic",
|
||||
"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",
|
||||
|
@ -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/interface",
|
||||
"$WIFI_ROOT_DIR/interfaces/inner_api",
|
||||
"$WIFI_ROOT_DIR/frameworks/native/interfaces",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/include",
|
||||
|
@ -92,6 +92,7 @@ int ApConfigUse::GetBestChannelFor5G(HotspotConfig &apConfig) const
|
||||
WIFI_LOGI("GetBestChannelFor5G BandWidth is 160M");
|
||||
return AP_CHANNEL_5G_160M_DEFAULT;
|
||||
}
|
||||
|
||||
if (channels.empty()) {
|
||||
WIFI_LOGI("GetBestChannelFor5G is empty");
|
||||
return AP_CHANNEL_INVALID;
|
||||
|
@ -87,6 +87,7 @@ void ApStartedState::GoInState()
|
||||
m_ApStateMachine.SwitchState(&m_ApStateMachine.m_ApIdleState);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_ApStateMachine.m_ApStationsManager.EnableAllBlockList()) {
|
||||
WIFI_LOGE("Set Blocklist failed.");
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ void ApStateMachine::Init()
|
||||
StatePlus(&m_ApIdleState, &m_ApRootState);
|
||||
StatePlus(&m_ApStartedState, &m_ApRootState);
|
||||
SetFirstState(&m_ApIdleState);
|
||||
m_iface = WifiConfigCenter::GetInstance().GetApIfaceName();
|
||||
m_iface = WifiConfigCenter::GetInstance().GetApIfaceName();
|
||||
StartStateMachine();
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,7 @@ ErrCode WifiAppStateAware::InitAppStateAware(const WifiAppStateAwareCallbacks &w
|
||||
mWifiAppStateAwareCallbacks = wifiAppStateAwareCallbacks;
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
bool WifiAppStateAware::Connect()
|
||||
{
|
||||
if (appMgrProxy_ != nullptr) {
|
||||
|
@ -4,7 +4,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -47,31 +47,23 @@ ErrCode WifiCountryCodeManager::Init()
|
||||
{
|
||||
WIFI_LOGI("init");
|
||||
m_wifiCountryCodePolicy = std::make_shared<WifiCountryCodePolicy>();
|
||||
#ifdef FEATURE_STA_SUPPORT
|
||||
|
||||
m_staCallback.callbackModuleName = CLASS_NAME;
|
||||
m_staCallback.OnStaConnChanged = DealStaConnChanged;
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
m_apCallback.callbackModuleName = CLASS_NAME;
|
||||
m_apCallback.OnApStateChangedEvent = DealApStateChanged;
|
||||
#endif
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef FEATURE_STA_SUPPORT
|
||||
StaServiceCallback WifiCountryCodeManager::GetStaCallback() const
|
||||
{
|
||||
return m_staCallback;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
IApServiceCallbacks WifiCountryCodeManager::GetApCallback() const
|
||||
{
|
||||
return m_apCallback;
|
||||
}
|
||||
#endif
|
||||
|
||||
void WifiCountryCodeManager::GetWifiCountryCode(std::string &wifiCountryCode) const
|
||||
{
|
||||
@ -190,7 +182,6 @@ void WifiCountryCodeManager::DealStaStopped(int instId)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_STA_SUPPORT
|
||||
void WifiCountryCodeManager::DealStaConnChanged(OperateResState state, const WifiLinkedInfo &info, int instId)
|
||||
{
|
||||
WIFI_LOGD("wifi connection state change, state=%{public}d, id=%{public}d", state, instId);
|
||||
@ -199,9 +190,7 @@ void WifiCountryCodeManager::DealStaConnChanged(OperateResState state, const Wif
|
||||
WifiCountryCodeManager::GetInstance().UpdateWifiCountryCode();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
void WifiCountryCodeManager::DealApStateChanged(ApState state, int id)
|
||||
{
|
||||
WIFI_LOGI("ap state change, state=%{public}d, id=%{public}d", state, id);
|
||||
@ -212,7 +201,6 @@ void WifiCountryCodeManager::DealApStateChanged(ApState state, int id)
|
||||
WifiCountryCodeManager::GetInstance().UnregisterWifiCountryCodeChangeListener(moduleName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ErrCode WifiCountryCodeManager::UpdateWifiCountryCodeCache(const std::string &wifiCountryCode)
|
||||
{
|
||||
|
@ -653,7 +653,7 @@ void WifiInternalEventDispatcher::InvokeScanCallbacks(const WifiEventCallbackMsg
|
||||
uid, pid, isFrozen);
|
||||
#endif
|
||||
if (mScanCallBackInfo[msg.id][remote].regCallBackEventId.count(msg.msgCode) == 0) {
|
||||
WIFI_LOGI("Not registered callback event! msg.msgCode: %{public}d,"
|
||||
WIFI_LOGD("Not registered callback event! msg.msgCode: %{public}d,"
|
||||
"instId: %{public}d", msg.msgCode, msg.id);
|
||||
continue;
|
||||
}
|
||||
|
@ -251,17 +251,17 @@ void WifiNetAgent::SetNetLinkIPInfo(sptr<NetManagerStandard::NetLinkInfo> &netLi
|
||||
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
|
||||
netIpv6Addr->address_ = wifiIpV6Info.globalIpV6Address;
|
||||
}
|
||||
LOGD("SetNetLinkIPInfo randGlobalIpV6Address:%{public}s", wifiIpV6Info.randGlobalIpV6Address.c_str());
|
||||
|
||||
if (!wifiIpV6Info.randGlobalIpV6Address.empty()) {
|
||||
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
|
||||
netIpv6Addr->address_ = wifiIpV6Info.randGlobalIpV6Address;
|
||||
}
|
||||
LOGD("SetNetLinkIPInfo uniqueLocalAddress1:%{public}s", wifiIpV6Info.uniqueLocalAddress1.c_str());
|
||||
|
||||
if (!wifiIpV6Info.uniqueLocalAddress1.empty()) {
|
||||
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
|
||||
netIpv6Addr->address_ = wifiIpV6Info.uniqueLocalAddress1;
|
||||
}
|
||||
LOGD("SetNetLinkIPInfo uniqueLocalAddress2:%{public}s", wifiIpV6Info.uniqueLocalAddress2.c_str());
|
||||
|
||||
if (!wifiIpV6Info.uniqueLocalAddress2.empty()) {
|
||||
netIpv6Addr = (std::make_unique<NetManagerStandard::INetAddr>()).release();
|
||||
netIpv6Addr->address_ = wifiIpV6Info.uniqueLocalAddress2;
|
||||
|
@ -69,8 +69,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
|
||||
|
@ -67,7 +67,7 @@ void WifiNetStatsManager::StopNetStats()
|
||||
|
||||
void WifiNetStatsManager::PerformPollAndLog()
|
||||
{
|
||||
WIFI_LOGI("%{public}s, enter", __FUNCTION__);
|
||||
WIFI_LOGD("%{public}s, enter", __FUNCTION__);
|
||||
NetStats curNetStats;
|
||||
if (GetWifiNetStatsDetail(curNetStats) != WIFI_OPT_SUCCESS) {
|
||||
WIFI_LOGE("%{public}s, get network stats failed", __FUNCTION__);
|
||||
|
@ -214,7 +214,6 @@ bool WifiProtectManager::ChangeToPerfMode(bool isEnabled)
|
||||
}
|
||||
void WifiProtectManager::HandleScreenStateChanged(bool screenOn)
|
||||
{
|
||||
|
||||
std::unique_lock<std::mutex> lock(mMutex);
|
||||
mScreenOn = screenOn;
|
||||
LOGD("%{public}s screen is on: %{public}d", __func__, mScreenOn);
|
||||
|
@ -311,7 +311,7 @@ void ConcreteMangerMachine::ConnectState::SwitchSemiActiveInConnectState()
|
||||
{
|
||||
ErrCode ret = pConcreteMangerMachine->SwitchSemiFromEnable();
|
||||
if (ret != WIFI_OPT_SUCCESS) {
|
||||
WIFI_LOGE("switch semi wifi failed ret =%{public}d \n", ret);
|
||||
WIFI_LOGE("switch semi wifi failed ret = %{public}d \n", ret);
|
||||
}
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ ErrCode ConcreteMangerMachine::PostStartWifi(int instId)
|
||||
WIFI_LOGE("Service enable sta failed ,ret %{public}d!", static_cast<int>(errCode));
|
||||
break;
|
||||
}
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
IEnhanceService *pEnhanceService = WifiServiceManager::GetInstance().GetEnhanceServiceInst();
|
||||
if (pEnhanceService == nullptr) {
|
||||
WIFI_LOGE("get pEnhance service failed!");
|
||||
@ -586,7 +586,7 @@ ErrCode ConcreteMangerMachine::PostStartWifi(int instId)
|
||||
WIFI_LOGE("SetEnhanceService failed, ret %{public}d!", static_cast<int>(errCode));
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
} while (0);
|
||||
WifiManager::GetInstance().GetWifiStaManager()->StopUnloadStaSaTimer();
|
||||
#ifdef FEATURE_P2P_SUPPORT
|
||||
@ -721,6 +721,7 @@ ErrCode ConcreteMangerMachine::AutoStartScanOnly(int instId)
|
||||
WifiConfigCenter::GetInstance().SetWifiScanOnlyMidState(WifiOprMidState::RUNNING, instId);
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
#ifdef HDI_CHIP_INTERFACE_SUPPORT
|
||||
if (ifaceName.empty() && !DelayedSingleton<HalDeviceManager>::GetInstance()->CreateStaIface(
|
||||
std::bind(ConcreteMangerMachine::IfaceDestoryCallback, std::placeholders::_1, std::placeholders::_2),
|
||||
@ -731,6 +732,7 @@ ErrCode ConcreteMangerMachine::AutoStartScanOnly(int instId)
|
||||
}
|
||||
WifiConfigCenter::GetInstance().SetStaIfaceName(ifaceName);
|
||||
#endif
|
||||
|
||||
WifiConfigCenter::GetInstance().SetWifiScanOnlyMidState(WifiOprMidState::OPENING, instId);
|
||||
WifiManager::GetInstance().AutoStartEnhanceService();
|
||||
WifiManager::GetInstance().GetWifiScanManager()->CheckAndStartScanService(instId);
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
|
||||
DEFINE_WIFILOG_LABEL("WifiControllerMachine");
|
||||
int WifiControllerMachine::mWifiStartFailCount{0};
|
||||
int WifiControllerMachine::mSoftapStartFailCount{0};
|
||||
|
@ -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 {
|
||||
|
@ -13,6 +13,13 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
|
||||
#include "<unistd.h>"
|
||||
#include "<net/if.h>"
|
||||
#include "<sys/ioctl.h>"
|
||||
#include "<net/socket.h>"
|
||||
#include "<pthread.h>"
|
||||
|
||||
#include "securec.h"
|
||||
#include "wifi_hdi_common.h"
|
||||
|
||||
@ -539,7 +546,7 @@ int HdiConvertIeRsn(const uint8_t *rsnIe, size_t rsnIeLen,
|
||||
data->hasGroup = 1;
|
||||
if (!HdiCheckValidGroup(data->groupCipher)) {
|
||||
LOGI("invalid group cipher 0x%{public}x (%08x)", data->groupCipher,
|
||||
HdiGetBe32(pos));
|
||||
HdiGetBe32(pos));
|
||||
return -1;
|
||||
}
|
||||
pos += HDI_SELECTOR_LEN;
|
||||
@ -620,12 +627,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;
|
||||
|
@ -202,7 +202,7 @@ static int GetVhtCentFreq(int channelType, int centerFrequencyIndex)
|
||||
static int HexStringToString(const char *str, char *out)
|
||||
{
|
||||
unsigned len = strlen(str);
|
||||
if (((len & 1) != 0) || (len == 0)) {
|
||||
if ((len & 1) != 0) {
|
||||
return -1;
|
||||
}
|
||||
const int hexShiftNum = 4;
|
||||
|
@ -63,6 +63,9 @@
|
||||
#define HOSTAPD_DEFAULT_CFG_COEX CONFIG_ROOR_DIR"wap_supplicant"WIFI_COEX_CFG
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
const char *HDI_WPA_SERVICE_NAME = "wpa_interface_service";
|
||||
static pthread_mutex_t g_wpaObjMutex = PTHREAD_MUTEX_INITIALIZER;
|
||||
static bool g_wpaStartSucceed = false;
|
||||
|
@ -112,7 +112,7 @@ const char *GetHdiP2pIfaceName();
|
||||
* @return WifiErrorNo - operation result
|
||||
*/
|
||||
struct IWpaInterface* GetWpaInterface();
|
||||
|
||||
pthread_mutex_t* GetWpaObjMutex();
|
||||
/**
|
||||
* @Description copy file.
|
||||
*
|
||||
@ -161,10 +161,8 @@ WifiErrorNo SetNativeProcessCallback(void (*callback)(int));
|
||||
* @return WifiErrorNo - operation result
|
||||
*/
|
||||
struct IHostapdInterface* GetApInterface();
|
||||
|
||||
WifiErrorNo SetHdiApIfaceName(const char *ifaceName);
|
||||
const char *GetHdiApIfaceName();
|
||||
|
||||
void SetExecDisable(int execDisable);
|
||||
int GetExecDisable();
|
||||
|
||||
|
@ -31,6 +31,11 @@
|
||||
#define REPLY_BUF_LENGTH (4096 * 10)
|
||||
#define ETH_ADDR_LEN 6
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
const int QUOTATION_MARKS_FLAG_YES = 0;
|
||||
const int QUOTATION_MARKS_FLAG_NO = 1;
|
||||
|
||||
|
@ -543,8 +543,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;
|
||||
|
@ -41,6 +41,8 @@ int32_t OnEventWpsTimeout(struct IWpaCallback *self, const char *ifName);
|
||||
int32_t OnEventAuthTimeout(struct IWpaCallback *self, const char *ifName);
|
||||
int32_t OnEventScanResult(struct IWpaCallback *self,
|
||||
const struct HdiWpaRecvScanResultParam *recvScanResultParam, const char* ifName);
|
||||
int32_t onEventStaJoin(struct IHostapdCallback *self, const struct HdiApCbParm *apCbParm, const char* ifName);
|
||||
int32_t onEventApState(struct IHostapdCallback *self, const struct HdiApCbParm *apCbParm, const char* ifName);
|
||||
int32_t OnEventP2pStateChanged(int status);
|
||||
int32_t OnEventDeviceFound(struct IWpaCallback *self,
|
||||
const struct HdiP2pDeviceInfoParam *deviceInfoParam, const char* ifName);
|
||||
@ -73,8 +75,6 @@ int32_t OnEventStaConnectState(struct IWpaCallback *self,
|
||||
const struct HdiP2pStaConnectStateParam *staConnectStateParam, const char* ifName);
|
||||
int32_t OnEventIfaceCreated(struct IWpaCallback *self,
|
||||
const struct HdiP2pIfaceCreatedParam *ifaceCreatedParam, const char* ifName);
|
||||
int32_t onEventStaJoin(struct IHostapdCallback *self, const struct HdiApCbParm *apCbParm, const char* ifName);
|
||||
int32_t onEventApState(struct IHostapdCallback *self, const struct HdiApCbParm *apCbParm, const char* ifName);
|
||||
void OnNativeProcessDeath(int status);
|
||||
size_t PrintfDecode(u8 *buf, size_t maxlen, const char *str);
|
||||
#ifdef __cplusplus
|
||||
|
@ -490,7 +490,7 @@ WifiErrorNo WifiHdiWpaClient::ReqWpaShellCmd(const std::string &ifName, const st
|
||||
LOGE("%{public}s: failed to copy", __func__);
|
||||
return WIFI_HAL_OPT_FAILED;
|
||||
}
|
||||
|
||||
|
||||
char cmdBuf[MAX_CMD_BUFFER_SIZE];
|
||||
if (strncpy_s(cmdBuf, sizeof(cmdBuf), cmd.c_str(), cmd.length()) != EOK) {
|
||||
LOGE("%{public}s: failed to copy", __func__);
|
||||
|
@ -807,7 +807,7 @@ public:
|
||||
* @return WifiErrorNo
|
||||
*/
|
||||
WifiErrorNo DeliverP2pData(int32_t cmdType, int32_t dataType, const std::string& carryData) const;
|
||||
|
||||
|
||||
/**
|
||||
* @Description Enable Softap.
|
||||
*
|
||||
|
@ -349,6 +349,7 @@ public:
|
||||
* @param protocol - target protocol type
|
||||
* @param enable - enable/disable dpi mark
|
||||
*/
|
||||
|
||||
WifiErrorNo SetDpiMarkRule(const std::string &ifaceName, int uid, int protocol, int enable);
|
||||
|
||||
/**
|
||||
@ -368,7 +369,7 @@ public:
|
||||
* @return WifiErrorNo
|
||||
*/
|
||||
WifiErrorNo GetPskPassphrase(const std::string &ifName, std::string &psk);
|
||||
|
||||
|
||||
/**
|
||||
* @Description set background limit speed uid&pid list
|
||||
*
|
||||
|
@ -51,9 +51,11 @@ int WifiScanMgrStub::OnRemoteRequest(
|
||||
FuncHandleMap::iterator iter = funcHandleMap_.find(code);
|
||||
if (iter == funcHandleMap_.end()) {
|
||||
WIFI_LOGE("not find function to deal, code %{public}u", code);
|
||||
reply.WriteInt32(0);
|
||||
reply.WriteInt32(WIFI_OPT_NOT_SUPPORTED);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
} else {
|
||||
(this->*(iter->second))(code, data, reply, option);
|
||||
return (this->*(iter->second))(code, data, reply, option);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -81,15 +81,16 @@ int WifiScanStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessagePar
|
||||
HandleFuncMap::iterator iter = handleFuncMap.find(code);
|
||||
if (iter == handleFuncMap.end()) {
|
||||
WIFI_LOGI("not find function to deal, code %{public}u", code);
|
||||
reply.WriteInt32(0);
|
||||
reply.WriteInt32(WIFI_OPT_NOT_SUPPORTED);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
} else {
|
||||
int exception = data.ReadInt32();
|
||||
if (exception) {
|
||||
return WIFI_OPT_FAILED;
|
||||
}
|
||||
(this->*(iter->second))(code, data, reply, option);
|
||||
return (this->*(iter->second))(code, data, reply, option);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WifiScanStub::OnSetScanControlInfo(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option)
|
||||
|
@ -254,7 +254,6 @@ IStaService *WifiServiceManager::GetStaServiceInst(int instId)
|
||||
WIFI_LOGD("find a new sta service instance, instId: %{public}d", instId);
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -269,7 +268,6 @@ ISelfCureService *WifiServiceManager::GetSelfCureServiceInst(int instId)
|
||||
WIFI_LOGD("find a new self cure service instance, instId: %{public}d", instId);
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
#endif
|
||||
@ -284,7 +282,6 @@ IScanService *WifiServiceManager::GetScanServiceInst(int instId)
|
||||
WIFI_LOGD("find a new scan service instance, instId: %{public}d", instId);
|
||||
return iter->second;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -333,7 +333,7 @@ public:
|
||||
*/
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
virtual ErrCode HandleForegroundAppChangedAction(const AppExecFwk::AppStateData &appStateData) = 0;
|
||||
|
||||
|
||||
/**
|
||||
* @Description Set EnhanceService to sta Service.
|
||||
*
|
||||
|
@ -325,7 +325,7 @@ public:
|
||||
*/
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
virtual ErrCode HandleForegroundAppChangedAction(const AppExecFwk::AppStateData &appStateData) override;
|
||||
|
||||
|
||||
/**
|
||||
* @Description Set EnhanceService to sta Service.
|
||||
*
|
||||
|
@ -94,8 +94,6 @@ public:
|
||||
|
||||
/**
|
||||
* @Description : Callback of the Wpa ssid wrong key event.
|
||||
*
|
||||
* @param status - status codes [in]
|
||||
*/
|
||||
void OnWpaSsidWrongKeyCallBack(int status);
|
||||
|
||||
|
@ -248,11 +248,10 @@ public:
|
||||
virtual ErrCode SetPowerMode(bool mode) const;
|
||||
|
||||
/**
|
||||
* @Description Set tx power to reduce sar.
|
||||
* @Description Set tx power to reduce sar
|
||||
*
|
||||
* @param power - 1001,1002,1003......
|
||||
*
|
||||
* @Return WifiErrorNo
|
||||
* @param power: 1001,1002,1003········
|
||||
* @return WifiErrorNo
|
||||
*/
|
||||
virtual ErrCode SetTxPower(int power) const;
|
||||
|
||||
@ -339,7 +338,7 @@ public:
|
||||
*/
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
virtual ErrCode HandleForegroundAppChangedAction(const AppExecFwk::AppStateData &appStateData);
|
||||
|
||||
|
||||
/**
|
||||
* @Description Set EnhanceService
|
||||
*
|
||||
@ -354,7 +353,7 @@ public:
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
virtual ErrCode EnableHiLinkHandshake(const WifiDeviceConfig &config, const std::string &cmd);
|
||||
|
||||
|
||||
/**
|
||||
* @Description deliver mac
|
||||
*
|
||||
|
@ -907,6 +907,7 @@ int StaStateMachine::InitStaSMHandleMap()
|
||||
staSmHandleFuncMap[WIFI_SVR_COM_STA_ENABLE_HILINK] = &StaStateMachine::DealHiLinkDataToWpa;
|
||||
staSmHandleFuncMap[WIFI_SVR_COM_STA_HILINK_DELIVER_MAC] = &StaStateMachine::DealHiLinkDataToWpa;
|
||||
staSmHandleFuncMap[WIFI_SVR_COM_STA_HILINK_TRIGGER_WPS] = &StaStateMachine::DealHiLinkDataToWpa;
|
||||
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
@ -947,6 +948,7 @@ void StaStateMachine::DealSignalPollResult()
|
||||
LOGE("GetConnectSignalInfo return fail: %{public}d.", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
if (signalInfo.frequency > 0) {
|
||||
linkedInfo.frequency = signalInfo.frequency;
|
||||
}
|
||||
@ -1246,7 +1248,6 @@ void StaStateMachine::DealConnectionEvent(InternalMessagePtr msg)
|
||||
#endif
|
||||
/* Callback result to InterfaceService. */
|
||||
InvokeOnStaConnChanged(OperateResState::CONNECT_OBTAINING_IP, linkedInfo);
|
||||
|
||||
mConnectFailedCnt = 0;
|
||||
/* The current state of StaStateMachine transfers to GetIpState. */
|
||||
SwitchState(pGetIpState);
|
||||
|
@ -543,6 +543,7 @@ public:
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
void SetEnhanceService(IEnhanceService* enhanceService);
|
||||
#endif
|
||||
|
||||
private:
|
||||
/**
|
||||
* @Description Destruct state.
|
||||
|
@ -51,9 +51,11 @@ int WifiDeviceMgrStub::OnRemoteRequest(
|
||||
FuncHandleMap::iterator iter = funcHandleMap_.find(code);
|
||||
if (iter == funcHandleMap_.end()) {
|
||||
WIFI_LOGE("not find function to deal, code %{public}u", code);
|
||||
reply.WriteInt32(0);
|
||||
reply.WriteInt32(WIFI_OPT_NOT_SUPPORTED);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
} else {
|
||||
(this->*(iter->second))(code, data, reply, option);
|
||||
return (this->*(iter->second))(code, data, reply, option);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -177,7 +177,6 @@ public:
|
||||
ErrCode GetWifiDetailState(WifiDetailState &state) override;
|
||||
|
||||
ErrCode SetSatelliteState(const int state) override;
|
||||
|
||||
private:
|
||||
bool Init();
|
||||
ErrCode CheckCanEnableWifi(void);
|
||||
|
@ -177,6 +177,8 @@ int WifiDeviceStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageP
|
||||
HandleFuncMap::iterator iter = handleFuncMap.find(code);
|
||||
if (iter == handleFuncMap.end()) {
|
||||
WIFI_LOGI("not find function to deal, code %{public}u", code);
|
||||
reply.WriteInt32(0);
|
||||
reply.WriteInt32(WIFI_OPT_NOT_SUPPORTED);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
} else {
|
||||
int exception = data.ReadInt32();
|
||||
@ -675,6 +677,7 @@ void WifiDeviceStub::OnGetChangeDeviceConfig(uint32_t code, MessageParcel &data,
|
||||
reply.WriteString(config.bssid);
|
||||
reply.WriteString(config.callProcessName);
|
||||
reply.WriteString(config.ancoCallProcessName);
|
||||
reply.WriteString(config.keyMgmt);
|
||||
reply.WriteInt32(ret);
|
||||
return;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#else
|
||||
#include "wifi_internal_event_dispatcher.h"
|
||||
#include "wifi_country_code_manager.h"
|
||||
#include "wifi_app_parser.h"
|
||||
#endif
|
||||
#include "wifi_common_def.h"
|
||||
#include "wifi_common_util.h"
|
||||
@ -68,6 +69,9 @@ InitStatus WifiCommonServiceManager::Init()
|
||||
if (WifiAppStateAware::GetInstance().InitAppStateAware(mWifiAppStateAwareCallbacks) < 0) {
|
||||
WIFI_LOGE("WifiAppStateAware Init failed!");
|
||||
}
|
||||
if (!AppParser::GetInstance().Init()) {
|
||||
WIFI_LOGE("AppParser Init failed!");
|
||||
}
|
||||
#endif
|
||||
#ifdef FEATURE_SELF_CURE_SUPPORT
|
||||
mWifiNetLinkCallbacks.OnTcpReportMsgComplete =
|
||||
|
@ -58,7 +58,6 @@ public:
|
||||
*
|
||||
*/
|
||||
void Exit();
|
||||
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
void OnForegroundAppChanged(const AppExecFwk::AppStateData &appStateData, const int mInstId = 0);
|
||||
#endif
|
||||
|
@ -231,7 +231,7 @@ void WifiScanManager::DealScanFinished(int state, int instId)
|
||||
cbMsg.msgData = state;
|
||||
cbMsg.id = instId;
|
||||
WifiInternalEventDispatcher::GetInstance().AddBroadCastMsg(cbMsg);
|
||||
WifiCommonEventHelper::PublishScanFinishedEvent(state, "OnScanFinished");
|
||||
WifiCommonEventHelper::PublishScanFinishedEvent(state,"OnScanFinished");
|
||||
}
|
||||
|
||||
void WifiScanManager::DealScanInfoNotify(std::vector<InterScanInfo> &results, int instId)
|
||||
|
@ -156,7 +156,7 @@ void IsValidHotspotConfigFuzzTest(const uint8_t* data, size_t size)
|
||||
/* Fuzzer entry point */
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
|
||||
{
|
||||
if ((data == NULL) || (size < DATA_SIZE_MIN)) {
|
||||
if ((data == nullptr) || (size < DATA_SIZE_MIN)) {
|
||||
return 0;
|
||||
}
|
||||
OHOS::Wifi::TransRandomToRealMacFuzzTest(data, size);
|
||||
|
@ -26,8 +26,8 @@
|
||||
#include "wifi_log.h"
|
||||
#include "sta_interface.h"
|
||||
#include "sta_auto_connect_service.h"
|
||||
#include "wifi_config_center.h"
|
||||
#include "wifi_settings.h"
|
||||
#include "wifi_config_center.h"
|
||||
#include "sta_service.h"
|
||||
#include "wifi_internal_msg.h"
|
||||
#include <mutex>
|
||||
|
@ -469,39 +469,6 @@ HWTEST_F(ApStartedState_test, UpdateChannelChangedTest, TestSize.Level1)
|
||||
pApStartedState->ProcessCmdHotspotChannelChanged(msg);
|
||||
}
|
||||
|
||||
HWTEST_F(ApStartedState_test, AssociatedStaEmptyTest, TestSize.Level1)
|
||||
{
|
||||
InternalMessagePtr msg = std::make_shared<InternalMessage>();
|
||||
StationInfo staInfo;
|
||||
msg->SetMessageName(static_cast<int>(ApStatemachineEvent::CMD_ASSOCIATED_STATIONS_CHANGED));
|
||||
msg->SetParam1(HAL_CBK_CMD_STA_JOIN);
|
||||
msg->SetMessageObj(staInfo);
|
||||
pApStartedState->ProcessCmdAssociatedStaChanged(msg);
|
||||
}
|
||||
|
||||
HWTEST_F(ApStartedState_test, AssociatedStaJoinTest, TestSize.Level1)
|
||||
{
|
||||
InternalMessagePtr msg = std::make_shared<InternalMessage>();
|
||||
StationInfo staInfo;
|
||||
staInfo.bssid = "AA:BB:CC:DD:EE:FF";
|
||||
msg->SetMessageName(static_cast<int>(ApStatemachineEvent::CMD_ASSOCIATED_STATIONS_CHANGED));
|
||||
msg->SetParam1(HAL_CBK_CMD_STA_JOIN);
|
||||
msg->SetMessageObj(staInfo);
|
||||
pApStartedState->ProcessCmdAssociatedStaChanged(msg);
|
||||
}
|
||||
|
||||
HWTEST_F(ApStartedState_test, AssociatedStaLeaveTest, TestSize.Level1)
|
||||
{
|
||||
InternalMessagePtr msg = std::make_shared<InternalMessage>();
|
||||
StationInfo staInfo;
|
||||
staInfo.bssid = "AA:BB:CC:DD:EE:FF";
|
||||
msg->SetMessageName(static_cast<int>(ApStatemachineEvent::CMD_ASSOCIATED_STATIONS_CHANGED));
|
||||
msg->SetParam1(HAL_CBK_CMD_STA_LEAVE);
|
||||
msg->SetMessageObj(staInfo);
|
||||
pApStartedState->ProcessCmdAssociatedStaChanged(msg);
|
||||
}
|
||||
|
||||
|
||||
HWTEST_F(ApStartedState_test, StopAp_001, TestSize.Level1)
|
||||
{
|
||||
EXPECT_CALL(WifiApHalInterface::GetInstance(), StopAp(_))
|
||||
|
@ -258,12 +258,6 @@ ErrCode StaInterface::DeliverStaIfaceData(const std::string ¤tMac)
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
ErrCode StaInterface::SetEnhanceService(IEnhanceService* enhanceService)
|
||||
{
|
||||
WIFI_LOGI("Enter DeliverStaIfaceData");
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
bool StaInterface::InitStaServiceLocked()
|
||||
{
|
||||
return true;
|
||||
|
@ -53,6 +53,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_encryption_util.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_global_func.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/utils/wifi_randommac_helper.cpp",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/wifi_asset/wifi_asset_manager.cpp",
|
||||
"../../wifi_manage/wifi_sta/Mock/mock_dhcp_service.cpp",
|
||||
"arp_checker_test.cpp",
|
||||
"base_address_test.cpp",
|
||||
@ -66,6 +67,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
"raw_socket_test.cpp",
|
||||
"softap_parser_test.cpp",
|
||||
"wifi_app_parser_test.cpp",
|
||||
"wifi_asset_manager_test.cpp",
|
||||
"wifi_code_convert_test.cpp",
|
||||
"wifi_config_center_test.cpp",
|
||||
"wifi_config_file_test.cpp",
|
||||
@ -87,6 +89,7 @@ ohos_unittest("toolkit_unittest") {
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/log",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/config",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_manage/wifi_sta",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/wifi_framework/wifi_toolkit/wifi_asset",
|
||||
"$WIFI_ROOT_DIR/interfaces/inner_api",
|
||||
"$WIFI_ROOT_DIR/frameworks/native/interfaces",
|
||||
"$WIFI_ROOT_DIR/services/wifi_standard/include",
|
||||
@ -135,6 +138,10 @@ ohos_unittest("toolkit_unittest") {
|
||||
"libxml2:libxml2",
|
||||
"netstack:http_client",
|
||||
]
|
||||
if (wifi_feature_with_sta_asset) {
|
||||
defines += [ "SUPPORT_ClOUD_WIFI_ASSET" ]
|
||||
external_deps += [ "asset:asset_sdk" ]
|
||||
}
|
||||
if (wifi_feature_with_encryption || wifi_feature_with_local_random_mac) {
|
||||
external_deps += [ "huks:libhukssdk" ]
|
||||
}
|
||||
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2024 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include <gtest/gtest.h>
|
||||
#include "wifi_asset_manager.h"
|
||||
|
||||
using namespace testing::ext;
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
#ifdef SUPPORT_ClOUD_WIFI_ASSET
|
||||
class WifiAssetManagerTest : public testing::Test {
|
||||
protected:
|
||||
void SetUp() override {
|
||||
// Set up code here
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
// Tear down code here
|
||||
}
|
||||
};
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetUpdate, testing::ext::TestSize.Level1)
|
||||
{
|
||||
WifiDeviceConfig config;
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
WifiAssetManager::GetInstance().WifiAssetUpdate(config, userId);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetAdd, testing::ext::TestSize.Level1)
|
||||
{
|
||||
WifiDeviceConfig config;
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
bool flagSync = true;
|
||||
WifiAssetManager::GetInstance().WifiAssetAdd(config, userId, flagSync);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetQuery, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
WifiAssetManager::GetInstance().WifiAssetQuery(userId);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetRemove, testing::ext::TestSize.Level1)
|
||||
{
|
||||
WifiDeviceConfig config;
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
bool flagSync = true;
|
||||
WifiAssetManager::GetInstance().WifiAssetRemove(config, userId, flagSync);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetAddPack, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<WifiDeviceConfig> mWifiDeviceConfig;
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
bool flagSync = true;
|
||||
WifiAssetManager::GetInstance().WifiAssetAddPack(mWifiDeviceConfig, userId, flagSync);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetRemovePack, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<WifiDeviceConfig> mWifiDeviceConfig;
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
bool flagSync = true;
|
||||
WifiAssetManager::GetInstance().WifiAssetRemovePack(mWifiDeviceConfig, userId, flagSync);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetRemoveAll, testing::ext::TestSize.Level1)
|
||||
{
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
bool flagSync = true;
|
||||
WifiAssetManager::GetInstance().WifiAssetRemoveAll(userId, flagSync);
|
||||
}
|
||||
|
||||
HWTEST_F(WifiAssetManagerTest, TestWifiAssetUpdatePack, testing::ext::TestSize.Level1)
|
||||
{
|
||||
std::vector<WifiDeviceConfig> mWifiDeviceConfig;
|
||||
int32_t userId = USER_ID_DEFAULT;
|
||||
WifiAssetManager::GetInstance().WifiAssetUpdatePack(mWifiDeviceConfig, userId);
|
||||
}
|
||||
#endif
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
@ -579,5 +579,44 @@ HWTEST_F(WifiSettingsTest, DecryptionWapiConfigTest, TestSize.Level1)
|
||||
config.wifiWapiConfig.wapiUserCertData = "12345678";
|
||||
WifiSettings::GetInstance().DecryptionDeviceConfig(config);
|
||||
}
|
||||
HWTEST_F(WifiSettingsTest, GetConfigValueByName, TestSize.Level1)
|
||||
{
|
||||
WIFI_LOGI("GetConfigValueByName enter");
|
||||
std::string ancoValue = "";
|
||||
WifiSettings::GetInstance().Init();
|
||||
bool sucess = WifiSettings::GetInstance().GetConfigValueByName("anco_broker_name", ancoValue);
|
||||
EXPECT_TRUE(sucess);
|
||||
std::string ancoNoValue = "";
|
||||
bool fail = WifiSettings::GetInstance().GetConfigValueByName("Novalue", ancoNoValue);
|
||||
EXPECT_FALSE(fail);
|
||||
EXPECT_EQ(ancoNoValue, "");
|
||||
}
|
||||
#ifdef SUPPORT_ClOUD_WIFI_ASSET
|
||||
HWTEST_F(WifiSettingsTest, UpdateWifiConfigFormCloudTest, TestSize.Level1)
|
||||
{
|
||||
WIFI_LOGE("UpdateWifiConfigFormCloudTest enter!");
|
||||
WifiDeviceConfig config;
|
||||
config.networkId = 0;
|
||||
config.ssid = "test1";
|
||||
config.keyMgmt = "WPA-PSK";
|
||||
config.preSharedKey = "123456789";
|
||||
WifiSettings::GetInstance().AddDeviceConfig(config);
|
||||
std::vector<WifiDeviceConfig> newWifiDeviceConfigs;
|
||||
// Add new WifiDeviceConfig objects to newWifiDeviceConfigs vector
|
||||
WifiDeviceConfig config1;
|
||||
config1.ssid = "test1";
|
||||
config1.keyMgmt = "WPA-PSK";
|
||||
config1.preSharedKey = "12345678";
|
||||
newWifiDeviceConfigs.push_back(config1);
|
||||
WifiSettings::GetInstance().UpdateWifiConfigFromCloud(newWifiDeviceConfigs);
|
||||
// Assert the updated WifiDeviceConfig objects in mWifiDeviceConfig map
|
||||
// based on the newWifiDeviceConfigs vector
|
||||
WifiDeviceConfig updatedConfig;
|
||||
WifiSettings::GetInstance().GetDeviceConfig(0, updatedConfig);
|
||||
EXPECT_EQ(updatedConfig.ssid, "test1");
|
||||
EXPECT_EQ(updatedConfig.keyMgmt, "WPA-PSK");
|
||||
EXPECT_EQ(updatedConfig.preSharedKey, "12345678");
|
||||
}
|
||||
#endif
|
||||
} // namespace Wifi
|
||||
} // namespace OHO
|
@ -25,7 +25,6 @@
|
||||
#include <openssl/evp.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/x509.h>
|
||||
#include "app_mgr_client.h"
|
||||
#include "bundle_mgr_interface.h"
|
||||
#include "if_system_ability_manager.h"
|
||||
#include "ipc_skeleton.h"
|
||||
|
Loading…
x
Reference in New Issue
Block a user