-
Notifications
You must be signed in to change notification settings - Fork 30
Spliting the join, scan and disconnect #876
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
chirag-silabs
wants to merge
7
commits into
main
Choose a base branch
from
feature/wifi_lit_sleep
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+193
−171
Draft
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
0088643
Spliting the join, scan and disconnect
chirag-silabs 5590061
Updating the retry connect
chirag-silabs bc2c238
Removing the doc file
chirag-silabs 9f884d5
Addressing and modifying the code
chirag-silabs 15ec311
Printing the disconnection
chirag-silabs 83828cf
Reverting the priority for ble and wlan task
chirag-silabs db0acc0
Correcting the ble and wlan tasks priority
chirag-silabs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,7 +98,7 @@ constexpr osThreadAttr_t kWlanTaskAttr = { .name = "wlan_rsi", | |
| .cb_size = osThreadCbSize, | ||
| .stack_mem = wlanStack, | ||
| .stack_size = kWlanTaskSize, | ||
| .priority = osPriorityAboveNormal7 }; | ||
| .priority = osPriorityHigh }; | ||
chirag-silabs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| #if CHIP_CONFIG_ENABLE_ICD_SERVER | ||
| constexpr uint32_t kTimeToFullBeaconReception = 5000; // 5 seconds | ||
|
|
@@ -645,7 +645,7 @@ void WifiInterfaceImpl::ProcessEvent(WifiPlatformEvent event) | |
|
|
||
| case WifiPlatformEvent::kStationDisconnect: { | ||
| ChipLogDetail(DeviceLayer, "WifiPlatformEvent::kStationDisconnect"); | ||
| // TODO: This event is not being posted anywhere, seems to be a dead code or we are missing something | ||
| TEMPORARY_RETURN_IGNORED TriggerPlatformWifiDisconnection(); | ||
chirag-silabs marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| wfx_rsi.dev_state.Clear(WifiInterface::WifiState::kStationReady) | ||
| .Clear(WifiInterface::WifiState::kStationConnecting) | ||
|
|
@@ -664,15 +664,18 @@ void WifiInterfaceImpl::ProcessEvent(WifiPlatformEvent event) | |
| // TODO: Currently unimplemented | ||
| break; | ||
|
|
||
| case WifiPlatformEvent::kStationStartJoin: | ||
| ChipLogDetail(DeviceLayer, "WifiPlatformEvent::kStationStartJoin"); | ||
|
|
||
| // To avoid IOP issues, it is recommended to enable high-performance mode before joining the network. | ||
| // TODO: Remove this once the IOP issue related to power save mode switching is fixed in the Wi-Fi SDK. | ||
| case WifiPlatformEvent::kStationStartScan: | ||
| ChipLogDetail(DeviceLayer, "WifiPlatformEvent::kStationStartScan"); | ||
| // To avoid IOP issues, enable high-performance mode before scan/join. TODO: Remove once IOP fix is in Wi-Fi SDK. | ||
| #if CHIP_CONFIG_ENABLE_ICD_SERVER | ||
| TEMPORARY_RETURN_IGNORED chip::DeviceLayer::Silabs::WifiSleepManager::GetInstance().RequestHighPerformanceWithTransition(); | ||
| #endif // CHIP_CONFIG_ENABLE_ICD_SERVER | ||
| InitiateScan(); | ||
| PostWifiPlatformEvent(WifiPlatformEvent::kStationStartJoin); | ||
| break; | ||
|
|
||
| case WifiPlatformEvent::kStationStartJoin: | ||
| ChipLogDetail(DeviceLayer, "WifiPlatformEvent::kStationStartJoin"); | ||
| JoinWifiNetwork(); | ||
| break; | ||
|
|
||
|
|
@@ -748,7 +751,14 @@ sl_status_t WifiInterfaceImpl::JoinWifiNetwork(void) | |
| ChipLogError(DeviceLayer, "sl_net_up failed: 0x%lx", static_cast<uint32_t>(status)); | ||
|
|
||
| wfx_rsi.dev_state.Clear(WifiInterface::WifiState::kStationConnecting).Clear(WifiInterface::WifiState::kStationConnected); | ||
| ScheduleConnectionAttempt(); | ||
| if (status == SL_STATUS_SI91X_NO_AP_FOUND) | ||
| { | ||
| ScheduleConnectionAttempt(false); // Scan and join | ||
| } | ||
| else | ||
| { | ||
| ScheduleConnectionAttempt(true); // Quick join | ||
| } | ||
|
|
||
| return status; | ||
| } | ||
|
|
@@ -776,7 +786,14 @@ sl_status_t WifiInterfaceImpl::JoinCallback(sl_wifi_event_t event, char * result | |
| ChipLogError(DeviceLayer, "JoinCallback: failed: 0x%lx", status); | ||
| wfx_rsi.dev_state.Clear(WifiInterface::WifiState::kStationConnected); | ||
|
|
||
| mInstance.ScheduleConnectionAttempt(); | ||
| if (status == SL_STATUS_SI91X_NO_AP_FOUND) | ||
| { | ||
| mInstance.ScheduleConnectionAttempt(false); // Scan and join | ||
| } | ||
| else | ||
| { | ||
| mInstance.ScheduleConnectionAttempt(true); // Quick join | ||
| } | ||
| } | ||
|
|
||
| return status; | ||
|
|
@@ -1048,9 +1065,7 @@ bool WifiInterfaceImpl::IsStationReady() | |
|
|
||
| CHIP_ERROR WifiInterfaceImpl::TriggerDisconnection() | ||
| { | ||
| VerifyOrReturnError(TriggerPlatformWifiDisconnection() == SL_STATUS_OK, CHIP_ERROR_INTERNAL); | ||
| wfx_rsi.dev_state.Clear(WifiState::kStationConnected); | ||
|
|
||
| PostWifiPlatformEvent(WifiPlatformEvent::kStationDisconnect); | ||
| return CHIP_NO_ERROR; | ||
| } | ||
|
|
||
|
|
@@ -1110,25 +1125,32 @@ bool WifiInterfaceImpl::IsWifiProvisioned() | |
| return wfx_rsi.dev_state.Has(WifiState::kStationProvisioned); | ||
| } | ||
|
|
||
| void WifiInterfaceImpl::SetWifiCredentials(const WifiCredentials & credentials) | ||
| CHIP_ERROR WifiInterfaceImpl::SetWifiCredentials(const WifiCredentials & credentials) | ||
| { | ||
| VerifyOrReturnError(credentials.ssidLength, CHIP_ERROR_INVALID_ARGUMENT); | ||
| VerifyOrReturnError(credentials.ssidLength <= WFX_MAX_SSID_LENGTH, CHIP_ERROR_INVALID_ARGUMENT); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| wfx_rsi.credentials = credentials; | ||
| wfx_rsi.dev_state.Set(WifiState::kStationProvisioned); | ||
| return CHIP_NO_ERROR; | ||
| } | ||
|
|
||
| CHIP_ERROR WifiInterfaceImpl::ConnectToAccessPoint() | ||
| { | ||
| VerifyOrReturnError(IsWifiProvisioned(), CHIP_ERROR_INCORRECT_STATE); | ||
| VerifyOrReturnError(wfx_rsi.credentials.ssidLength, CHIP_ERROR_INCORRECT_STATE); | ||
|
|
||
| // TODO: We should move this validation to where we set the credentials. It is too late here. | ||
| VerifyOrReturnError(wfx_rsi.credentials.ssidLength <= WFX_MAX_SSID_LENGTH, CHIP_ERROR_INVALID_ARGUMENT); | ||
|
|
||
| ChipLogProgress(DeviceLayer, "connect to access point: %s", wfx_rsi.credentials.ssid); | ||
|
|
||
| WifiPlatformEvent event = WifiPlatformEvent::kStationStartJoin; | ||
| PostWifiPlatformEvent(event); | ||
| PostWifiPlatformEvent(WifiPlatformEvent::kStationStartScan); | ||
| return CHIP_NO_ERROR; | ||
| } | ||
|
|
||
| CHIP_ERROR WifiInterfaceImpl::QuickJoinToAccessPoint() | ||
| { | ||
| VerifyOrReturnError(IsWifiProvisioned(), CHIP_ERROR_INCORRECT_STATE); | ||
|
|
||
| ChipLogProgress(DeviceLayer, "quick join to access point: %s", wfx_rsi.credentials.ssid); | ||
|
|
||
| PostWifiPlatformEvent(WifiPlatformEvent::kStationStartJoin); | ||
| return CHIP_NO_ERROR; | ||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.