Skip to content

Commit

Permalink
[Silabs] Adding Queue for the ble events and removing the semaphore (#…
Browse files Browse the repository at this point in the history
…35522)

* adding queue logic to the semaphore

* removing the extern keyword for the queue

* cleanup of ble defines and variables

* Restyled by whitespace

* restyling the PR

* removing the temp change

* restyling the PR

* reverting BLEManagerImpl.h to fix

* fixing the build for the 91x ncp

* addressing review comments

* Restyled by whitespace

* Restyled by clang-format

* modifying the file to have classes

* restyling the PR

* Restyled by whitespace

* cleanup the unused from the .h file and fixing build

* Addressing review comments

---------

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
chirag-silabs and restyled-commits authored Sep 25, 2024
1 parent 6f93ec2 commit e8554de
Show file tree
Hide file tree
Showing 7 changed files with 301 additions and 391 deletions.
28 changes: 18 additions & 10 deletions src/platform/silabs/BLEManagerImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
#include <rsi_ble.h>
#include <rsi_ble_apis.h>
#include <rsi_bt_common.h>
#include "wfx_sl_ble_init.h"
#ifdef __cplusplus
}
#endif // __cplusplus
Expand All @@ -58,12 +56,14 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
void HandleBootEvent(void);

#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
void HandleConnectEvent(void);
void HandleConnectionCloseEvent(uint16_t reason);
void HandleWriteEvent(rsi_ble_event_write_t evt);
void UpdateMtu(rsi_ble_event_mtu_t evt);
// Used for posting the event in the BLE queue
void BlePostEvent(SilabsBleWrapper::BleEvent_t * event);
void HandleConnectEvent(SilabsBleWrapper::sl_wfx_msg_t * evt);
void HandleConnectionCloseEvent(SilabsBleWrapper::sl_wfx_msg_t * evt);
void HandleWriteEvent(SilabsBleWrapper::sl_wfx_msg_t * evt);
void UpdateMtu(SilabsBleWrapper::sl_wfx_msg_t * evt);
void HandleTxConfirmationEvent(BLE_CONNECTION_OBJECT conId);
void HandleTXCharCCCDWrite(rsi_ble_event_write_t * evt);
void HandleTXCharCCCDWrite(SilabsBleWrapper::sl_wfx_msg_t * evt);
void HandleSoftTimerEvent(void);
int32_t SendBLEAdvertisementCommand(void);
#else
Expand All @@ -80,7 +80,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla

#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
static void HandleC3ReadRequest(rsi_ble_read_req_t * rsi_ble_read_req);
static void HandleC3ReadRequest(SilabsBleWrapper::sl_wfx_msg_t * rsi_ble_read_req);
#else
#if CHIP_ENABLE_ADDITIONAL_DATA_ADVERTISING
static void HandleC3ReadRequest(volatile sl_bt_msg_t * evt);
Expand All @@ -93,6 +93,14 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
// the implementation methods provided by this class.
friend BLEManager;

#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
// rs91x BLE task handling
osMessageQueueId_t sBleEventQueue = NULL;
static void sl_ble_event_handling_task(void * args);
void sl_ble_init();
void ProcessEvent(SilabsBleWrapper::BleEvent_t inEvent);
#endif

// ===== Members that implement the BLEManager internal interface.

CHIP_ERROR _Init(void);
Expand Down Expand Up @@ -186,7 +194,7 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
#endif

#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
void HandleRXCharWrite(rsi_ble_event_write_t * evt);
void HandleRXCharWrite(SilabsBleWrapper::sl_wfx_msg_t * evt);
#else
void HandleRXCharWrite(volatile sl_bt_msg_t * evt);
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/SiWx917/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static_library("SiWx917") {
"../../SingletonConfigurationManager.cpp",
"../rs911x/BLEManagerImpl.cpp",
"../rs911x/rsi_ble_config.h",
"../rs911x/wfx_sl_ble_init.c",
"../rs911x/wfx_sl_ble_init.cpp",
"../rs911x/wfx_sl_ble_init.h",
]

Expand Down
2 changes: 1 addition & 1 deletion src/platform/silabs/efr32/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static_library("efr32") {
sources += [
"../rs911x/BLEManagerImpl.cpp",
"../rs911x/rsi_ble_config.h",
"../rs911x/wfx_sl_ble_init.c",
"../rs911x/wfx_sl_ble_init.cpp",
"../rs911x/wfx_sl_ble_init.h",
]
} else {
Expand Down
Loading

0 comments on commit e8554de

Please sign in to comment.