Skip to content
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

[Silabs] Adds fix for Wi-Fi task loop, BLE task priority, BLE indication soft timer expiry #34095

Merged
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
83637d2
Adds fix for WiFi task looping
rosahay-silabs Jun 27, 2024
2722546
Adds fix for BLE task priority and indication soft timer expiry
rosahay-silabs Jun 27, 2024
7beadcf
Adds fix for return check
rosahay-silabs Jun 27, 2024
0bfb03b
Remove unused cred and add length check
rosahay-silabs Jul 3, 2024
90a604a
aligned include
brosahay Jul 4, 2024
408b6b6
Replace `lx` with `x` for all sl_status_t logging
brosahay Jul 4, 2024
3fdacb5
Refactor posting of events to the end of the codeblock
brosahay Jul 4, 2024
f814e47
Adds `BLE_DRIVER_TASK_PRIORITY`
brosahay Jul 4, 2024
d2272b5
Adds static_cast for status in ChipLogging
rosahay-silabs Jul 4, 2024
04a575b
chore: Refactor show_scan_results function to improve readability and…
rosahay-silabs Jul 4, 2024
6774115
chore: Update WiFi join function to use strnlen for SSID length calcu…
rosahay-silabs Jul 4, 2024
a207694
chore: Update WiFi join function to use strnlen for SSID length calcu…
rosahay-silabs Jul 4, 2024
62a805d
chore: Update BSSID array size in WiFi scan result struct
rosahay-silabs Jul 4, 2024
c53d0dc
chore: Update SLAAC OK log message to use formatted IPv6 address
rosahay-silabs Jul 4, 2024
5497861
Refactor show_scan_results function for improved readability and main…
rosahay-silabs Jul 4, 2024
d74c69c
Refactor show_scan_results function to fix null termination bug
rosahay-silabs Jul 4, 2024
7f78bb0
Refactor show_scan_results function to fix null termination bug
rosahay-silabs Jul 4, 2024
b573460
Adds fix for NCP macros
rosahay-silabs Jul 4, 2024
19d1c1f
Revert BLE timer changes
rosahay-silabs Jul 4, 2024
5e86b90
Fix passkey length validation in sl_wifi_if.cpp
rosahay-silabs Jul 4, 2024
48a20c5
Refactor BLEManagerImpl::_OnPlatformEvent for improved code readabili…
rosahay-silabs Jul 4, 2024
9f1b180
Refactor BLEManagerImpl::_OnPlatformEvent for improved code readabili…
rosahay-silabs Jul 5, 2024
77eddc9
Revert "Refactor BLEManagerImpl::_OnPlatformEvent for improved code r…
rosahay-silabs Jul 5, 2024
d55fcc0
Added locks to avoid race conditions
rosahay-silabs Jul 5, 2024
3c861d4
Addressed comments
rosahay-silabs Jul 5, 2024
a3c6b4f
Refactor sl_wifi_if.cpp for improved code readability and maintainabi…
rosahay-silabs Jul 8, 2024
4d82d34
Fix passkey length validation in sl_wifi_if.cpp
rosahay-silabs Jul 8, 2024
b0cd461
Fix BSSID length in wfx_rsi_get_ap_info and wfx_rsi_save_ap_info
rosahay-silabs Jul 8, 2024
a4fb44b
Refactor log statement after length checks
rosahay-silabs Jul 8, 2024
8681fa9
Adds missing replace
rosahay-silabs Jul 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor BLEManagerImpl::_OnPlatformEvent for improved code readabili…
…ty and maintainability
  • Loading branch information
rosahay-silabs committed Jul 5, 2024
commit 9f1b1805ed9b3ce2e9b619c12b0f93f8f16ad335
2 changes: 1 addition & 1 deletion src/platform/silabs/BLEManagerImpl.h
Original file line number Diff line number Diff line change
@@ -201,7 +201,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla

#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
protected:
static void OnSendIndicationTimeout(System::Layer * aLayer, void * appState);
static void OnSendIndicationTimeout(TimerHandle_t xTimer);
#endif
};

30 changes: 21 additions & 9 deletions src/platform/silabs/rs911x/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
@@ -237,6 +237,7 @@ namespace {
#define BLE_CONFIG_MAX_CE_LENGTH (0xFFFF) // Leave to max value

TimerHandle_t sbleAdvTimeoutTimer; // FreeRTOS sw timer.
TimerHandle_t sbleIndicationTimeoutTimer;

const uint8_t UUID_CHIPoBLEService[] = { 0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
0x00, 0x10, 0x00, 0x00, 0xF6, 0xFF, 0x00, 0x00 };
@@ -270,11 +271,17 @@ CHIP_ERROR BLEManagerImpl::_Init()
mServiceMode = ConnectivityManager::kCHIPoBLEServiceMode_Enabled;

// Create FreeRTOS sw timer for BLE timeouts and interval change.
sbleAdvTimeoutTimer = xTimerCreate("BleAdvTimer", // Just a text name, not used by the RTOS kernel
pdMS_TO_TICKS(BLE_DEFAULT_TIMER_PERIOD_MS), // == default timer period
false, // no timer reload (==one-shot)
(void *) this, // init timer id = ble obj context
BleAdvTimeoutHandler // timer callback handler
sbleAdvTimeoutTimer = xTimerCreate("BleAdvTimer", // Just a text name, not used by the RTOS kernel
pdMS_TO_TICKS(BLE_DEFAULT_TIMER_PERIOD_MS), // == default timer period
false, // no timer reload (==one-shot)
(void *) this, // init timer id = ble obj context
BleAdvTimeoutHandler // timer callback handler
);
sbleIndicationTimeoutTimer = xTimerCreate("BleIndicationTimer", // Just a text name, not used by the RTOS kernel
pdMS_TO_TICKS(BLE_SEND_INDICATION_TIMER_PERIOD_MS), // == default timer period
false, // no timer reload (==one-shot)
(void *) this, // init timer id = ble obj context
OnSendIndicationTimeout // timer callback handler
);

mFlags.ClearAll().Set(Flags::kAdvertisingEnabled, CHIP_DEVICE_CONFIG_CHIPOBLE_ENABLE_ADVERTISING_AUTOSTART);
@@ -285,7 +292,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
return err;
}

void BLEManagerImpl::OnSendIndicationTimeout(System::Layer * aLayer, void * appState)
void BLEManagerImpl::OnSendIndicationTimeout(TimerHandle_t xTimer)
{
// TODO: change the connection handle with the ble device ID
uint8_t connHandle = 1;
@@ -475,8 +482,10 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
}

// start timer for the indication Confirmation Event
DeviceLayer::SystemLayer().StartTimer(chip::System::Clock::Milliseconds32(BLE_SEND_INDICATION_TIMER_PERIOD_MS),
OnSendIndicationTimeout, this);
if (xTimerStart(sbleIndicationTimeoutTimer, pdMS_TO_TICKS(0)) == pdFAIL)
{
ChipLogError(DeviceLayer, "Failed to start indication timer");
}
return true;
}

@@ -924,7 +933,10 @@ void BLEManagerImpl::HandleRXCharWrite(rsi_ble_event_write_t * evt)
void BLEManagerImpl::HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId)
{
// stop the indication confirmation timer
DeviceLayer::SystemLayer().CancelTimer(OnSendIndicationTimeout, this);
if (xTimerStop(sbleIndicationTimeoutTimer, pdMS_TO_TICKS(0)) == pdFAIL)
{
ChipLogError(DeviceLayer, "Failed to stop indication timer");
}
ChipDeviceEvent event;
event.Type = DeviceEventType::kCHIPoBLEIndicateConfirm;
event.CHIPoBLEIndicateConfirm.ConId = conId;
Loading