mirror of
https://gitee.com/openharmony/communication_wifi.git
synced 2024-11-27 01:01:03 +00:00
!3196 concrete state bugfix
Merge pull request !3196 from xiaosi/master
This commit is contained in:
commit
1641fd7b17
@ -152,6 +152,16 @@ bool ConcreteMangerMachine::DefaultState::ExecuteStateMsg(InternalMessagePtr msg
|
||||
return false;
|
||||
}
|
||||
WIFI_LOGE("DefaultState-msgCode=%{public}d is received.\n", msg->GetMessageName());
|
||||
switch (msg->GetMessageName()) {
|
||||
case CONCRETE_CMD_STOP:
|
||||
pConcreteMangerMachine->CheckAndContinueToStopWifi(msg);
|
||||
break;
|
||||
case CONCRETE_CMD_STA_STOP:
|
||||
pConcreteMangerMachine->HandleStaStop();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -462,7 +472,8 @@ bool ConcreteMangerMachine::HandleCommonMessage(InternalMessagePtr msg)
|
||||
HandleStaStart();
|
||||
return true;
|
||||
case CONCRETE_CMD_STOP:
|
||||
checkAndContinueToStopWifi(msg);
|
||||
DelayMessage(msg);
|
||||
SwitchState(pDefaultState);
|
||||
return true;
|
||||
case CONCRETE_CMD_STA_SEMI_ACTIVE:
|
||||
HandleStaSemiActive();
|
||||
@ -652,17 +663,17 @@ ErrCode ConcreteMangerMachine::SwitchEnableFromSemi()
|
||||
return WIFI_OPT_SUCCESS;
|
||||
}
|
||||
|
||||
void ConcreteMangerMachine::checkAndContinueToStopWifi(InternalMessagePtr msg)
|
||||
void ConcreteMangerMachine::CheckAndContinueToStopWifi(InternalMessagePtr msg)
|
||||
{
|
||||
if (WifiConfigCenter::GetInstance().GetWifiStopState()) {
|
||||
WIFI_LOGE("checkAndContinueToStopWifi: wifi is stoping");
|
||||
WIFI_LOGE("CheckAndContinueToStopWifi: wifi is stoping");
|
||||
return;
|
||||
}
|
||||
|
||||
mTargetRole = static_cast<int>(ConcreteManagerRole::ROLE_UNKNOW);
|
||||
WifiOprMidState staState = WifiConfigCenter::GetInstance().GetWifiMidState(mid);
|
||||
auto detailState = WifiConfigCenter::GetInstance().GetWifiDetailState(mid);
|
||||
WIFI_LOGI("checkAndContinueToStopWifi: current sta state: %{public}d detailState:%{public}d", staState,
|
||||
WIFI_LOGI("CheckAndContinueToStopWifi: current sta state: %{public}d detailState:%{public}d", staState,
|
||||
detailState);
|
||||
if (detailState != WifiDetailState::STATE_SEMI_ACTIVE && detailState != WifiDetailState::STATE_SEMI_ACTIVATING &&
|
||||
(staState == WifiOprMidState::CLOSING || staState == WifiOprMidState::OPENING)) {
|
||||
|
@ -132,7 +132,7 @@ private:
|
||||
ErrCode InitConcreteMangerStates();
|
||||
|
||||
bool HandleCommonMessage(InternalMessagePtr msg);
|
||||
void checkAndContinueToStopWifi(InternalMessagePtr msg);
|
||||
void CheckAndContinueToStopWifi(InternalMessagePtr msg);
|
||||
void HandleStaStop();
|
||||
void HandleStaStart();
|
||||
void HandleStaSemiActive();
|
||||
|
@ -94,7 +94,7 @@ ErrCode WifiServiceScheduler::AutoStartStaService(int instId, std::string &staIf
|
||||
WIFI_LOGI("AutoStartStaService, current sta state:%{public}d", staState);
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (staState == WifiOprMidState::RUNNING) {
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGI("AutoStartStaService, cur sta state is running.");
|
||||
}
|
||||
if (PreStartWifi(instId, staIfName) != WIFI_OPT_SUCCESS) {
|
||||
return WIFI_OPT_FAILED;
|
||||
@ -131,7 +131,7 @@ ErrCode WifiServiceScheduler::AutoStartWifi2Service(int instId, std::string &sta
|
||||
WIFI_LOGI("AutoStartWifi2Service, current sta state:%{public}d", staState);
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (staState == WifiOprMidState::RUNNING) {
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGI("AutoStartWifi2Service, cur sta2 state is running.");
|
||||
}
|
||||
if (PreStartWifi(instId, staIfName) != WIFI_OPT_SUCCESS) {
|
||||
return WIFI_OPT_FAILED;
|
||||
@ -159,7 +159,7 @@ ErrCode WifiServiceScheduler::AutoStopStaService(int instId)
|
||||
WIFI_LOGI("AutoStopStaService, current sta state:%{public}d", staStateBefore);
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (staStateBefore == WifiOprMidState::CLOSED) {
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGI("AutoStopStaService, cur sta state is closed.");
|
||||
}
|
||||
ErrCode ret = WIFI_OPT_FAILED;
|
||||
#ifdef FEATURE_P2P_SUPPORT
|
||||
@ -211,7 +211,7 @@ ErrCode WifiServiceScheduler::AutoStopWifi2Service(int instId)
|
||||
staStateBefore, instId);
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (staStateBefore == WifiOprMidState::CLOSED) {
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGI("AutoStopWifi2Service, cur sta2 state is closed.");
|
||||
}
|
||||
ErrCode ret = WIFI_OPT_FAILED;
|
||||
|
||||
@ -266,8 +266,7 @@ ErrCode WifiServiceScheduler::AutoStartScanOnly(int instId, std::string &staIfNa
|
||||
static_cast<int>(curState), instId);
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (curState != WifiOprMidState::CLOSED && instId == 0) {
|
||||
WIFI_LOGE("ScanOnly State is not closed, return\n");
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGE("ScanOnly State is not closed.");
|
||||
}
|
||||
|
||||
if (WifiOprMidState::RUNNING == WifiConfigCenter::GetInstance().GetWifiMidState(instId) ||
|
||||
@ -307,7 +306,7 @@ ErrCode WifiServiceScheduler::AutoStopScanOnly(int instId, bool setIfaceDown)
|
||||
WIFI_LOGI("AutoStopScanOnly, current wifi scan only state is %{public}d", static_cast<int>(curState));
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (curState != WifiOprMidState::RUNNING) {
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGI("AutoStopScanOnly, cur scan only state is not running.");
|
||||
}
|
||||
|
||||
if (WifiOprMidState::RUNNING == WifiConfigCenter::GetInstance().GetWifiMidState(instId) ||
|
||||
@ -338,7 +337,7 @@ ErrCode WifiServiceScheduler::AutoStartSemiStaService(int instId, std::string &s
|
||||
WIFI_LOGI("AutoStartSemiStaService, current sta state:%{public}d", staState);
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
if (staState == WifiOprMidState::SEMI_ACTIVE) {
|
||||
return WIFI_OPT_SUCCESS;
|
||||
WIFI_LOGI("AutoStartSemiStaService, cur sta state is semi active.");
|
||||
}
|
||||
if (PreStartWifi(instId, staIfName) != WIFI_OPT_SUCCESS) {
|
||||
return WIFI_OPT_FAILED;
|
||||
|
Loading…
Reference in New Issue
Block a user