mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-12-28 01:47:18 +00:00
update wifi/services/wifi_standard/wifi_framework/wifi_manage/wifi_scan/scan_service.cpp.
Signed-off-by: huxiaominlenho <huxiaomin2@huawei.com>
This commit is contained in:
parent
c41d5a8e5c
commit
dd9b1411e8
@ -56,8 +56,7 @@
|
||||
"wifi_feature_with_app_frozen",
|
||||
"wifi_feature_non_seperate_p2p",
|
||||
"wifi_feature_non_hdf_driver",
|
||||
"wifi_feature_is_random_mac_supported",
|
||||
"wifi_feature_with_sched_scan_control_enable"
|
||||
"wifi_feature_is_random_mac_supported"
|
||||
],
|
||||
"adapted_system_type": [
|
||||
"standard"
|
||||
|
@ -205,7 +205,7 @@
|
||||
#define WIFI_SERVICE_P2P "P2pService" /* P2P */
|
||||
#define WIFI_SERVICE_SCAN "ScanService" /* SCAN */
|
||||
#define WIFI_SERVICE_AWARE "AwareService" /* AWARE */
|
||||
|
||||
#define WIFI_SERVICE_ENHANCE "EnhanceService" /* ENHANCE */
|
||||
/* ---------Feature service ability id */
|
||||
#ifdef OHOS_ARCH_LITE
|
||||
#define WIFI_DEVICE_ABILITY_ID 1120
|
||||
|
@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef OHOS_IENHANCE_SERVICE_H
|
||||
#define OHOS_IENHANCE_SERVICE_H
|
||||
|
||||
#include "wifi_errcode.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
class IEnhanceService {
|
||||
public:
|
||||
virtual ~IEnhanceService() = default;
|
||||
/**
|
||||
* @Description Enhance service initialization function.
|
||||
*
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
virtual ErrCode Init() = 0;
|
||||
/**
|
||||
* @Description Stopping the Enhance Service.
|
||||
*
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
virtual ErrCode UnInit() = 0;
|
||||
/**
|
||||
* @Description check Scan is allowed.
|
||||
*
|
||||
* @return true: allowed, false: not allowed
|
||||
*/
|
||||
virtual bool AllowScanBySchedStrategy() = 0;
|
||||
/**
|
||||
* @Description Set EnhanceService Param.
|
||||
*
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
virtual ErrCode SetEnhanceParam(int64_t availableTime) = 0;
|
||||
};
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
#endif
|
@ -288,6 +288,7 @@ int WifiManager::Init()
|
||||
* The sta service automatically starts upon startup. After the sta
|
||||
* service is started, the scanning is directly started.
|
||||
*/
|
||||
AutoStartEnhanceService();
|
||||
AutoStartScanService();
|
||||
}
|
||||
|
||||
@ -629,6 +630,16 @@ void WifiManager::CheckAndStartScanService(void)
|
||||
WIFI_LOGE("init scan service failed, ret %{public}d!", static_cast<int>(errCode));
|
||||
break;
|
||||
}
|
||||
IEnhanceService *pEnhanceService = WifiServiceManager::GetInstance().GetEnhanceServiceInst();
|
||||
if (pEnhanceService == nullptr) {
|
||||
WIFI_LOGE("Create %{public}s service failed!", WIFI_SERVICE_ENHANCE);
|
||||
break;
|
||||
}
|
||||
errCode = pService->SetEnhanceService(pEnhanceService);
|
||||
if (errCode != WIFI_OPT_SUCCESS) {
|
||||
WIFI_LOGE("SetEnhanceService failed, ret %{public}d!", static_cast<int>(errCode));
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
if (errCode != WIFI_OPT_SUCCESS) {
|
||||
WifiConfigCenter::GetInstance().SetScanMidState(WifiOprMidState::OPENING, WifiOprMidState::CLOSED);
|
||||
@ -637,6 +648,29 @@ void WifiManager::CheckAndStartScanService(void)
|
||||
return;
|
||||
}
|
||||
|
||||
void WifiManager::AutoStartEnhanceService(void)
|
||||
{
|
||||
WIFI_LOGI("AutoStartEnhanceService start");
|
||||
ErrCode errCode = WIFI_OPT_FAILED;
|
||||
do {
|
||||
if (WifiServiceManager::GetInstance().CheckAndEnforceService(WIFI_SERVICE_ENHANCE) < 0) {
|
||||
WIFI_LOGE("Load %{public}s service failed!", WIFI_SERVICE_ENHANCE);
|
||||
break;
|
||||
}
|
||||
IEnhanceService *pEnhanceService = WifiServiceManager::GetInstance().GetEnhanceServiceInst();
|
||||
if (pEnhanceService == nullptr) {
|
||||
WIFI_LOGE("Create %{public}s service failed!", WIFI_SERVICE_ENHANCE);
|
||||
break;
|
||||
}
|
||||
errCode = pEnhanceService->Init();
|
||||
if (errCode != WIFI_OPT_SUCCESS) {
|
||||
WIFI_LOGE("init Enhance service failed, ret %{public}d!", static_cast<int>(errCode));
|
||||
break;
|
||||
}
|
||||
} while (0);
|
||||
return;
|
||||
}
|
||||
|
||||
void WifiManager::CheckAndStopScanService(void)
|
||||
{
|
||||
/**
|
||||
|
@ -207,6 +207,7 @@ private:
|
||||
static void AutoStartP2pService(void);
|
||||
#endif
|
||||
static void AutoStartScanService(void);
|
||||
static void AutoStartEnhanceService(void);
|
||||
static void CheckAndStartSta(void);
|
||||
static void AutoStartServiceThread(void);
|
||||
|
||||
|
@ -111,13 +111,6 @@ if (defined(ohos_lite)) {
|
||||
"hiviewdfx_hilog_native:libhilog",
|
||||
]
|
||||
|
||||
defines = []
|
||||
if (wifi_feature_with_sched_scan_control_enable) {
|
||||
include_dirs += [ "//foundation/resourceschedule/efficiency_manager/interfaces/innerkits/component_scheduler/client/include" ]
|
||||
external_deps += [ "efficiency_manager:component_sched_client" ]
|
||||
defines += [ "WIFI_SCHED_SCAN_CONTROL_ENALE" ]
|
||||
}
|
||||
|
||||
cflags_cc = [
|
||||
"-std=c++17",
|
||||
"-fno-rtti",
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "wifi_errcode.h"
|
||||
#include "wifi_msg.h"
|
||||
#include "iscan_service_callbacks.h"
|
||||
#include "ienhance_service.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
@ -112,6 +113,13 @@ public:
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
virtual ErrCode RegisterScanCallbacks(const IScanSerivceCallbacks &scanSerivceCallbacks) = 0;
|
||||
/**
|
||||
* @Description Set EnhanceService to Scan Service.
|
||||
*
|
||||
* @param enhanceService IEnhanceService object
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
virtual ErrCode SetEnhanceService(IEnhanceService *enhanceService) = 0;
|
||||
};
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
|
@ -162,5 +162,13 @@ ErrCode ScanInterface::RegisterScanCallbacks(const IScanSerivceCallbacks &scanSe
|
||||
mScanSerivceCallbacks = scanSerivceCallbacks;
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
ErrCode ScanInterface::SetEnhanceService(IEnhanceService *enhanceService)
|
||||
{
|
||||
WIFI_LOGI("Enter ScanInterface::SetEnhanceService\n");
|
||||
CHECK_NULL_AND_RETURN(pScanService, WIFI_OPT_FAILED);
|
||||
pScanService->SetEnhanceService(enhanceService);
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
@ -117,7 +117,13 @@ public:
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
ErrCode RegisterScanCallbacks(const IScanSerivceCallbacks &scanSerivceCallbacks);
|
||||
|
||||
/**
|
||||
* @Description Set EnhanceService to Scan Service.
|
||||
*
|
||||
* @param enhanceService IEnhanceService object
|
||||
* @return success: WIFI_OPT_SUCCESS, failed: WIFI_OPT_FAILED
|
||||
*/
|
||||
ErrCode SetEnhanceService(IEnhanceService* enhanceService);
|
||||
private:
|
||||
ScanService *pScanService;
|
||||
IScanSerivceCallbacks mScanSerivceCallbacks;
|
||||
|
@ -49,8 +49,7 @@ ScanService::ScanService()
|
||||
scanTrustMode(false),
|
||||
isAbsFreezeState(false),
|
||||
isAbsFreezeScaned(false),
|
||||
scanResultBackup(-1),
|
||||
lastScanResultsAvailableTime(0)
|
||||
scanResultBackup(-1)
|
||||
{}
|
||||
|
||||
ScanService::~ScanService()
|
||||
@ -163,6 +162,11 @@ void ScanService::RegisterScanCallbacks(const IScanSerivceCallbacks &iScanSerivc
|
||||
mScanSerivceCallbacks = iScanSerivceCallbacks;
|
||||
}
|
||||
|
||||
void ScanService::SetEnhanceService(IEnhanceService* enhanceService)
|
||||
{
|
||||
mEnhanceService = enhanceService;
|
||||
}
|
||||
|
||||
void ScanService::HandleScanStatusReport(ScanStatusReport &scanStatusReport)
|
||||
{
|
||||
WIFI_LOGI("Enter ScanService::HandleScanStatusReport.\n");
|
||||
@ -601,8 +605,11 @@ void ScanService::HandleCommonScanInfo(
|
||||
}
|
||||
struct timespec times = {0, 0};
|
||||
clock_gettime(CLOCK_MONOTONIC, ×);
|
||||
lastScanResultsAvailableTime = static_cast<int64_t>(times.tv_sec) * SECOND_TO_MICRO_SECOND +
|
||||
int64_t availableTime = static_cast<int64_t>(times.tv_sec) * SECOND_TO_MICRO_SECOND +
|
||||
times.tv_nsec / SECOND_TO_MILLI_SECOND;
|
||||
if (mEnhanceService != nullptr) {
|
||||
mEnhanceService->SetEnhanceParam(availableTime);
|
||||
}
|
||||
/* Send the scanning result to the module registered for listening. */
|
||||
ScanInfoHandlerMap::iterator handleIter = scanInfoHandlerMap.begin();
|
||||
for (; handleIter != scanInfoHandlerMap.end(); ++handleIter) {
|
||||
@ -1183,10 +1190,13 @@ ErrCode ScanService::AllowExternScan()
|
||||
WIFI_LOGW("extern scan not allow by disable scan control.");
|
||||
return WIFI_OPT_FAILED;
|
||||
}
|
||||
if (!AllowScanBySchedStrategy()) {
|
||||
WIFI_LOGW("extern scan not allow by sched strategy.");
|
||||
return WIFI_OPT_FAILED;
|
||||
if (mEnhanceService != nullptr) {
|
||||
if (!mEnhanceService->AllowScanBySchedStrategy()) {
|
||||
WIFI_LOGW("extern scan not allow by sched strategy.");
|
||||
return WIFI_OPT_FAILED;
|
||||
}
|
||||
}
|
||||
|
||||
WIFI_LOGI("extern scan has allowed");
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
@ -2247,45 +2257,6 @@ bool ScanService::AllowScanByDisableScanCtrl()
|
||||
return !disableScanFlag;
|
||||
}
|
||||
|
||||
bool ScanService::AllowScanBySchedStrategy()
|
||||
{
|
||||
WIFI_LOGI("Enter ScanService::AllowScanBySchedStrategy.");
|
||||
#ifdef WIFI_SCHED_SCAN_CONTROL_ENALE
|
||||
sptr<ComponentScheduler::ScanStrategy> strategy = nullptr;
|
||||
int ret = OHOS::ComponentScheduler::ComponentSchedClient::GetInstance().GetScanStrategy(GetBundleName(),
|
||||
GetCallingUid(), ComponentScheduler::ScanStrategy::ScanType::SCAN_TYPE_WIFI, strategy);
|
||||
if (ret != 0 || strategy == nullptr) {
|
||||
WIFI_LOGW("GetScanStrategy fail: %{public}d.", ret);
|
||||
return true;
|
||||
}
|
||||
|
||||
WIFI_LOGI("GetScanStrategy return mode: %{public}d.", strategy->GetMode());
|
||||
if (strategy->GetMode() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (strategy->GetMode() < 0) {
|
||||
WIFI_LOGE("ComponentSchedClient don't allow scan.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (strategy->GetTimeStamp() < lastScanResultsAvailableTime) {
|
||||
struct timespec times = {0, 0};
|
||||
clock_gettime(CLOCK_MONOTONIC, ×);
|
||||
int64_t currTime =
|
||||
static_cast<int64_t>(times.tv_sec) * SECOND_TO_MICRO_SECOND + times.tv_nsec / SECOND_TO_MILLI_SECOND;
|
||||
int64_t sinceLastScanTime = currTime - lastScanResultsAvailableTime;
|
||||
if (sinceLastScanTime > strategy->GetMode()) {
|
||||
return true;
|
||||
}
|
||||
WIFI_LOGE("sinceLastScanTime:%{public}llu is less than GetMode:%{public}d, don't allow scan.",
|
||||
sinceLastScanTime, strategy->GetMode());
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ScanService::AllowScanByMovingFreeze()
|
||||
{
|
||||
LOGI("Enter ScanService::AllowScanByMovingFreeze.\n");
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "scan_monitor.h"
|
||||
#include "scan_state_machine.h"
|
||||
#include "scan_standby_listerner.h"
|
||||
#include "ienhance_service.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
@ -229,7 +230,13 @@ public:
|
||||
*
|
||||
*/
|
||||
virtual void SetStaCurrentTime();
|
||||
|
||||
/**
|
||||
* @Description Set EnhanceService to Scan Service.
|
||||
*
|
||||
* @param enhanceService IEnhanceService object
|
||||
* @return void
|
||||
*/
|
||||
virtual void SetEnhanceService(IEnhanceService* enhanceService);
|
||||
private:
|
||||
using ScanConfigMap = std::map<int, StoreScanConfig>;
|
||||
using ScanInfoHandlerMap = std::map<std::string, ScanInfoHandler>;
|
||||
@ -281,7 +288,7 @@ private:
|
||||
bool isAbsFreezeState; /* absolute freeze state. */
|
||||
bool isAbsFreezeScaned; /* scanned in freeze state. */
|
||||
int scanResultBackup; /* scan result backup. */
|
||||
int64_t lastScanResultsAvailableTime; /* scan results available time */
|
||||
IEnhanceService *mEnhanceService; /* EnhanceService handle */
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
StandByListerner standByListerner; /* standby Listerner*/
|
||||
#endif
|
||||
@ -755,12 +762,6 @@ private:
|
||||
* @return true: allow, false: not allowed.
|
||||
*/
|
||||
bool AllowScanByDisableScanCtrl();
|
||||
/**
|
||||
* @Description Determines whether scanning is allowed by sched strategy scan control.
|
||||
*
|
||||
* @return true: allow, false: not allowed.
|
||||
*/
|
||||
bool AllowScanBySchedStrategy();
|
||||
/**
|
||||
* @Description Determines whether scanning is allowed in movingfreeze mode.
|
||||
*
|
||||
|
@ -45,9 +45,11 @@ int WifiServiceManager::Init()
|
||||
#endif
|
||||
mStaServiceHandle.Clear();
|
||||
mScanServiceHandle.Clear();
|
||||
mEnhanceServiceHandle.Clear();
|
||||
#ifdef OHOS_ARCH_LITE
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_STA, "libwifi_sta_service.so"));
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_SCAN, "libwifi_scan_service.so"));
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_ENHANCE, "libwifi_enhance_service.z.so"));
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_AP, "libwifi_ap_service.so"));
|
||||
#endif
|
||||
@ -58,6 +60,7 @@ int WifiServiceManager::Init()
|
||||
#else
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_STA, "libwifi_sta_service.z.so"));
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_SCAN, "libwifi_scan_service.z.so"));
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_ENHANCE, "libwifi_enhance_service.z.so"));
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
mServiceDllMap.insert(std::make_pair(WIFI_SERVICE_AP, "libwifi_ap_service.z.so"));
|
||||
#endif
|
||||
@ -209,6 +212,33 @@ int WifiServiceManager::LoadP2pService(const std::string &dlname, bool bCreate)
|
||||
}
|
||||
#endif
|
||||
|
||||
int WifiServiceManager::LoadEnhanceService(const std::string &dlname, bool bCreate)
|
||||
{
|
||||
WIFI_LOGI("WifiServiceManager::LoadEnhanceService");
|
||||
std::unique_lock<std::mutex> lock(mEnhanceMutex);
|
||||
if (mEnhanceServiceHandle.handle != nullptr) {
|
||||
WIFI_LOGE("WifiServiceManager::handle is not null: %{public}s", dlname.c_str());
|
||||
return 0;
|
||||
}
|
||||
mEnhanceServiceHandle.handle = dlopen(dlname.c_str(), RTLD_LAZY);
|
||||
if (mEnhanceServiceHandle.handle == nullptr) {
|
||||
WIFI_LOGE("dlopen %{public}s failed: %{public}s!", dlname.c_str(), dlerror());
|
||||
return -1;
|
||||
}
|
||||
mEnhanceServiceHandle.create = (IEnhanceService *(*)()) dlsym(mEnhanceServiceHandle.handle, "Create");
|
||||
mEnhanceServiceHandle.destroy = (void *(*)(IEnhanceService *))dlsym(mEnhanceServiceHandle.handle, "Destroy");
|
||||
if (mEnhanceServiceHandle.create == nullptr || mEnhanceServiceHandle.destroy == nullptr) {
|
||||
WIFI_LOGE("%{public}s dlsym Create or Destroy failed!", dlname.c_str());
|
||||
dlclose(mEnhanceServiceHandle.handle);
|
||||
mEnhanceServiceHandle.Clear();
|
||||
return -1;
|
||||
}
|
||||
if (bCreate) {
|
||||
mEnhanceServiceHandle.pService = mEnhanceServiceHandle.create();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WifiServiceManager::CheckAndEnforceService(const std::string &name, bool bCreate)
|
||||
{
|
||||
WIFI_LOGD("WifiServiceManager::CheckAndEnforceService name: %{public}s", name.c_str());
|
||||
@ -234,6 +264,9 @@ int WifiServiceManager::CheckAndEnforceService(const std::string &name, bool bCr
|
||||
return LoadP2pService(dlname, bCreate);
|
||||
}
|
||||
#endif
|
||||
if (name == WIFI_SERVICE_ENHANCE) {
|
||||
return LoadEnhanceService(dlname, bCreate);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -308,6 +341,20 @@ IP2pService *WifiServiceManager::GetP2pServiceInst()
|
||||
}
|
||||
#endif
|
||||
|
||||
IEnhanceService *WifiServiceManager::GetEnhanceServiceInst()
|
||||
{
|
||||
WIFI_LOGI("WifiServiceManager::GetEnhanceServiceInst");
|
||||
std::unique_lock<std::mutex> lock(mEnhanceMutex);
|
||||
if (mEnhanceServiceHandle.handle == nullptr) {
|
||||
WIFI_LOGE("WifiServiceManager, Enhance handle is null");
|
||||
return nullptr;
|
||||
}
|
||||
if (mEnhanceServiceHandle.pService == nullptr) {
|
||||
mEnhanceServiceHandle.pService = mEnhanceServiceHandle.create();
|
||||
}
|
||||
return mEnhanceServiceHandle.pService;
|
||||
}
|
||||
|
||||
NO_SANITIZE("cfi") int WifiServiceManager::UnloadStaService(bool bPreLoad)
|
||||
{
|
||||
WIFI_LOGI("WifiServiceManager::UnloadStaService");
|
||||
@ -403,6 +450,25 @@ NO_SANITIZE("cfi") int WifiServiceManager::UnloadP2pService(bool bPreLoad)
|
||||
}
|
||||
#endif
|
||||
|
||||
NO_SANITIZE("cfi") int WifiServiceManager::UnloadEnhanceService(bool bPreLoad)
|
||||
{
|
||||
WIFI_LOGI("WifiServiceManager::UnloadEnhanceService");
|
||||
std::unique_lock<std::mutex> lock(mEnhanceMutex);
|
||||
if (mEnhanceServiceHandle.handle == nullptr) {
|
||||
WIFI_LOGE("WifiServiceManager::UnloadEnhanceService handle is null");
|
||||
return 0;
|
||||
}
|
||||
if (mEnhanceServiceHandle.pService != nullptr) {
|
||||
mEnhanceServiceHandle.destroy(mEnhanceServiceHandle.pService);
|
||||
mEnhanceServiceHandle.pService = nullptr;
|
||||
}
|
||||
if (!bPreLoad) {
|
||||
dlclose(mEnhanceServiceHandle.handle);
|
||||
mEnhanceServiceHandle.Clear();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int WifiServiceManager::UnloadService(const std::string &name, int id)
|
||||
{
|
||||
bool bPreLoad = WifiSettings::GetInstance().IsModulePreLoad(name);
|
||||
@ -423,6 +489,9 @@ int WifiServiceManager::UnloadService(const std::string &name, int id)
|
||||
return UnloadP2pService(bPreLoad);
|
||||
}
|
||||
#endif
|
||||
if (name == WIFI_SERVICE_ENHANCE) {
|
||||
return UnloadEnhanceService(bPreLoad);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,7 @@
|
||||
#ifdef FEATURE_P2P_SUPPORT
|
||||
#include "ip2p_service.h"
|
||||
#endif
|
||||
#include "ienhance_service.h"
|
||||
|
||||
namespace OHOS {
|
||||
namespace Wifi {
|
||||
@ -107,7 +108,23 @@ struct P2pServiceHandle {
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
struct EnhanceServiceHandle {
|
||||
void *handle;
|
||||
IEnhanceService *(*create)();
|
||||
void *(*destroy)(IEnhanceService *);
|
||||
IEnhanceService *pService;
|
||||
EnhanceServiceHandle() : handle(nullptr), create(nullptr), destroy(nullptr), pService(nullptr)
|
||||
{}
|
||||
~EnhanceServiceHandle()
|
||||
{}
|
||||
void Clear()
|
||||
{
|
||||
handle = nullptr;
|
||||
create = nullptr;
|
||||
destroy = nullptr;
|
||||
pService = nullptr;
|
||||
}
|
||||
};
|
||||
class WifiServiceManager {
|
||||
public:
|
||||
WifiServiceManager();
|
||||
@ -167,7 +184,12 @@ public:
|
||||
*/
|
||||
IP2pService *GetP2pServiceInst(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @Description Get the Enhance Service Inst object
|
||||
*
|
||||
* @return IEnhanceService* - Enhance service pointer, if Enhance not supported, nullptr is returned
|
||||
*/
|
||||
IEnhanceService *GetEnhanceServiceInst(void);
|
||||
/**
|
||||
* @Description unload a feature service
|
||||
*
|
||||
@ -197,12 +219,14 @@ private:
|
||||
int LoadP2pService(const std::string &dlname, bool bCreate);
|
||||
int UnloadP2pService(bool bPreLoad);
|
||||
#endif
|
||||
|
||||
int LoadEnhanceService(const std::string &dlname, bool bCreate);
|
||||
int UnloadEnhanceService(bool bPreLoad);
|
||||
private:
|
||||
std::mutex mStaMutex;
|
||||
std::mutex mScanMutex;
|
||||
std::mutex mP2pMutex;
|
||||
std::mutex mApMutex;
|
||||
std::mutex mEnhanceMutex;
|
||||
std::unordered_map<std::string, std::string> mServiceDllMap;
|
||||
StaServiceHandle mStaServiceHandle;
|
||||
ScanServiceHandle mScanServiceHandle;
|
||||
@ -212,6 +236,7 @@ private:
|
||||
#ifdef FEATURE_P2P_SUPPORT
|
||||
P2pServiceHandle mP2pServiceHandle;
|
||||
#endif
|
||||
EnhanceServiceHandle mEnhanceServiceHandle;
|
||||
};
|
||||
} // namespace Wifi
|
||||
} // namespace OHOS
|
||||
|
@ -867,6 +867,8 @@ static int SetWifiConfigValueSecond(WifiConfig &item, const std::string &key, co
|
||||
item.preLoadP2p = (std::stoi(value) != 0); /* 0 -> false 1 -> true */
|
||||
} else if (key == "preLoadAware") {
|
||||
item.preLoadAware = (std::stoi(value) != 0); /* 0 -> false 1 -> true */
|
||||
} else if (key == "preLoadEnhance") {
|
||||
item.preLoadEnhance = (std::stoi(value) != 0); /* 0 -> false 1 -> true */
|
||||
} else if (key == "supportHwPnoFlag") {
|
||||
item.supportHwPnoFlag = std::stoi(value);
|
||||
} else if (key == "minRssi2Dot4Ghz") {
|
||||
|
@ -1485,6 +1485,8 @@ bool WifiSettings::IsModulePreLoad(const std::string &name)
|
||||
return mWifiConfig.preLoadP2p;
|
||||
} else if (name == WIFI_SERVICE_AWARE) {
|
||||
return mWifiConfig.preLoadAware;
|
||||
} else if (name == WIFI_SERVICE_ENHANCE) {
|
||||
return mWifiConfig.preLoadEnhance;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
@ -311,6 +311,7 @@ struct WifiConfig {
|
||||
bool preLoadAp;
|
||||
bool preLoadP2p;
|
||||
bool preLoadAware;
|
||||
bool preLoadEnhance;
|
||||
bool supportHwPnoFlag;
|
||||
int minRssi2Dot4Ghz;
|
||||
int minRssi5Ghz;
|
||||
|
@ -29,7 +29,6 @@ declare_args() {
|
||||
wifi_feature_non_seperate_p2p = false
|
||||
wifi_feature_non_hdf_driver = false
|
||||
wifi_feature_is_random_mac_supported = false
|
||||
wifi_feature_with_sched_scan_control_enable = false
|
||||
if (defined(global_parts_info) &&
|
||||
defined(global_parts_info.resourceschedule_efficiency_manager)) {
|
||||
wifi_feature_with_app_frozen = true
|
||||
|
@ -26,5 +26,4 @@ declare_args() {
|
||||
wifi_feature_with_auth_disable = false
|
||||
wifi_feature_with_dhcp_disable = false
|
||||
wifi_feature_is_hdi_supported = false
|
||||
wifi_feature_with_sched_scan_control_enable = false
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user