mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2025-01-17 13:15:48 +00:00
!1191 拆分sta和scan启停控制
Merge pull request !1191 from huxiaominlenho/master
This commit is contained in:
commit
dd363b7e6f
wifi/services/wifi_standard/wifi_framework/wifi_manage
@ -699,8 +699,6 @@ std::mutex WifiManager::unloadStaSaTimerMutex{};
|
||||
void WifiManager::UnloadStaSaTimerCallback()
|
||||
{
|
||||
WifiSaLoadManager::GetInstance().UnloadWifiSa(WIFI_DEVICE_ABILITY_ID);
|
||||
WifiSaLoadManager::GetInstance().UnloadWifiSa(WIFI_SCAN_ABILITY_ID);
|
||||
WifiSaLoadManager::GetInstance().UnloadWifiSa(WIFI_P2P_ABILITY_ID);
|
||||
if (static_cast<int>(ApState::AP_STATE_CLOSED) == WifiConfigCenter::GetInstance().GetHotspotState(0)) {
|
||||
WifiSaLoadManager::GetInstance().UnloadWifiSa(WIFI_HOTSPOT_ABILITY_ID);
|
||||
}
|
||||
@ -1092,6 +1090,37 @@ void WifiManager::DealRssiChanged(int rssi)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
uint32_t WifiManager::unloadScanSaTimerId{0};
|
||||
std::mutex WifiManager::unloadScanSaTimerMutex{};
|
||||
void WifiManager::UnloadScanSaTimerCallback()
|
||||
{
|
||||
WifiSaLoadManager::GetInstance().UnloadWifiSa(WIFI_SCAN_ABILITY_ID);
|
||||
WifiManager::GetInstance().StopUnloadScanSaTimer();
|
||||
}
|
||||
|
||||
void WifiManager::StopUnloadScanSaTimer(void)
|
||||
{
|
||||
WIFI_LOGI("StopUnloadScanSaTimer! unloadScanSaTimerId:%{public}u", unloadScanSaTimerId);
|
||||
std::unique_lock<std::mutex> lock(unloadScanSaTimerMutex);
|
||||
WifiTimer::GetInstance()->UnRegister(unloadScanSaTimerId);
|
||||
unloadScanSaTimerId = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
void WifiManager::StartUnloadScanSaTimer(void)
|
||||
{
|
||||
WIFI_LOGI("StartUnloadScanSaTimer! unloadScanSaTimerId:%{public}u", unloadScanSaTimerId);
|
||||
std::unique_lock<std::mutex> lock(unloadScanSaTimerMutex);
|
||||
if (unloadScanSaTimerId == 0) {
|
||||
TimeOutCallback timeoutCallback = std::bind(WifiManager::UnloadScanSaTimerCallback);
|
||||
WifiTimer::GetInstance()->Register(timeoutCallback, unloadScanSaTimerId, TIMEOUT_UNLOAD_WIFI_SA);
|
||||
WIFI_LOGI("StartUnloadScanSaTimer success! unloadScanSaTimerId:%{public}u", unloadScanSaTimerId);
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
void WifiManager::CheckAndStartScanService(void)
|
||||
{
|
||||
WifiOprMidState scanState = WifiConfigCenter::GetInstance().GetScanMidState();
|
||||
|
@ -153,6 +153,8 @@ public:
|
||||
ErrCode AutoStopStaService(AutoStartOrStopServiceReason reason);
|
||||
void StopUnloadStaSaTimer(void);
|
||||
void StartUnloadStaSaTimer(void);
|
||||
void StopUnloadScanSaTimer(void);
|
||||
void StartUnloadScanSaTimer(void);
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
/**
|
||||
* @Description Get the ap callback object.
|
||||
@ -219,6 +221,7 @@ private:
|
||||
static void DealCloseServiceMsg(WifiManager &manager);
|
||||
static void CloseStaService(void);
|
||||
static void UnloadStaSaTimerCallback();
|
||||
static void UnloadScanSaTimerCallback();
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
static void CloseApService(int id = 0);
|
||||
static void UnloadHotspotSaTimerCallback();
|
||||
@ -279,6 +282,8 @@ private:
|
||||
#ifndef OHOS_ARCH_LITE
|
||||
static uint32_t unloadStaSaTimerId;
|
||||
static std::mutex unloadStaSaTimerMutex;
|
||||
static uint32_t unloadScanSaTimerId;
|
||||
static std::mutex unloadScanSaTimerMutex;
|
||||
#endif
|
||||
#ifdef FEATURE_AP_SUPPORT
|
||||
IApServiceCallbacks mApCallback;
|
||||
|
@ -88,7 +88,7 @@ void WifiScanServiceImpl::OnStart()
|
||||
mState = ServiceRunningState::STATE_RUNNING;
|
||||
WIFI_LOGI("Start scan service!");
|
||||
WifiManager::GetInstance();
|
||||
WifiManager::GetInstance().StartUnloadStaSaTimer();
|
||||
WifiManager::GetInstance().StartUnloadScanSaTimer();
|
||||
}
|
||||
|
||||
void WifiScanServiceImpl::OnStop()
|
||||
|
@ -149,7 +149,7 @@ int WifiServiceManager::LoadScanService(const std::string &dlname, bool bCreate)
|
||||
if (bCreate) {
|
||||
mScanServiceHandle.pService = mScanServiceHandle.create();
|
||||
}
|
||||
WifiManager::GetInstance().StopUnloadStaSaTimer();
|
||||
WifiManager::GetInstance().StopUnloadScanSaTimer();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user