Skip to content

Commit 59eecfb

Browse files
committed
Added changes for the timer
1 parent 10699cf commit 59eecfb

File tree

2 files changed

+14
-27
lines changed

2 files changed

+14
-27
lines changed

src/platform/silabs/BLEManagerImpl.h

-9
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,6 @@
2525
#pragma once
2626
#if CHIP_DEVICE_CONFIG_ENABLE_CHIPOBLE
2727

28-
#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
29-
#define BLE_MIN_CONNECTION_INTERVAL_MS 45 // 45 msec
30-
#define BLE_MAX_CONNECTION_INTERVAL_MS 45 // 45 msec
31-
#define BLE_SLAVE_LATENCY_MS 0
32-
#define BLE_TIMEOUT_MS 400
33-
#define BLE_DEFAULT_TIMER_PERIOD_MS (1)
34-
#define BLE_SEND_INDICATION_TIMER_PERIOD_MS (5000) // Time kept to support all WiFi chips BLE (RS9116/ SiWx917 NCP/SOC)
35-
#endif // (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
3628
#include "FreeRTOS.h"
3729
#include "timers.h"
3830
#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
@@ -199,7 +191,6 @@ class BLEManagerImpl final : public BLEManager, private BleLayer, private BlePla
199191

200192
#if (SLI_SI91X_ENABLE_BLE || RSI_BLE_ENABLE)
201193
void HandleRXCharWrite(rsi_ble_event_write_t * evt);
202-
void StartBleSendIndicationTimeoutTimer(uint32_t aTimeoutInMs);
203194
void CancelBleSendIndicationTimeoutTimer(void);
204195
static void BleSendIndicationTimeoutHandler(TimerHandle_t xTimer);
205196
#else

src/platform/silabs/rs911x/BLEManagerImpl.cpp

+14-18
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,13 @@ extern "C" {
6868
#include <setup_payload/AdditionalDataPayloadGenerator.h>
6969
#endif
7070

71+
#define BLE_MIN_CONNECTION_INTERVAL_MS 45 // 45 msec
72+
#define BLE_MAX_CONNECTION_INTERVAL_MS 45 // 45 msec
73+
#define BLE_SLAVE_LATENCY_MS 0
74+
#define BLE_TIMEOUT_MS 400
75+
#define BLE_DEFAULT_TIMER_PERIOD_MS (1)
76+
#define BLE_SEND_INDICATION_TIMER_PERIOD_MS (5000) // Time kept to support all WiFi chips BLE (RS9116/ SiWx917 NCP/SOC)
77+
7178
extern sl_wfx_msg_t event_msg;
7279

7380
StaticTask_t rsiBLETaskStruct;
@@ -292,7 +299,7 @@ CHIP_ERROR BLEManagerImpl::_Init()
292299
BleAdvTimeoutHandler // timer callback handler
293300
);
294301

295-
sbleSendIndicationTimeoutTimer = xTimerCreate("SendIndicationTimer", // Just a text name, not used by the RTOS kernel
302+
sbleSendIndicationTimeoutTimer = xTimerCreate("SendIndicationTimeoutTimer", // Just a text name, not used by the RTOS kernel
296303
pdMS_TO_TICKS(BLE_SEND_INDICATION_TIMER_PERIOD_MS), // == default timer period
297304
false, // no timer reload (==one-shot)
298305
(void *) this, // init timer id = ble obj context
@@ -478,7 +485,12 @@ bool BLEManagerImpl::SendIndication(BLE_CONNECTION_OBJECT conId, const ChipBleUU
478485
status = rsi_ble_indicate_value(event_msg.resp_enh_conn.dev_addr, event_msg.rsi_ble_measurement_hndl, (data->DataLength()),
479486
data->Start());
480487

481-
StartBleSendIndicationTimeoutTimer(BLE_SEND_INDICATION_TIMER_PERIOD_MS);
488+
if (xTimerStart(sbleSendIndicationTimeoutTimer, 0) != pdPASS)
489+
{
490+
/* The timer could not be set into the Active
491+
state. */
492+
ChipLogError(DeviceLayer, "Failed to start send Indication timeout timer");
493+
}
482494

483495
if (status != RSI_SUCCESS)
484496
{
@@ -1126,22 +1138,6 @@ void BLEManagerImpl::CancelBleSendIndicationTimeoutTimer(void)
11261138
}
11271139
}
11281140

1129-
void BLEManagerImpl::StartBleSendIndicationTimeoutTimer(uint32_t aTimeoutInMs)
1130-
{
1131-
if (xTimerIsTimerActive(sbleSendIndicationTimeoutTimer))
1132-
{
1133-
CancelBleAdvTimeoutTimer();
1134-
}
1135-
1136-
// timer is not active, change its period to required value (== restart).
1137-
// FreeRTOS- Block for a maximum of 100 ticks if the change period command
1138-
// cannot immediately be sent to the timer command queue.
1139-
if (xTimerChangePeriod(sbleSendIndicationTimeoutTimer, pdMS_TO_TICKS(aTimeoutInMs), pdMS_TO_TICKS(BLE_CONFIG_TIMEOUT)) != pdPASS)
1140-
{
1141-
ChipLogError(DeviceLayer, "Failed to start BledAdv timeout timer");
1142-
}
1143-
}
1144-
11451141
void BLEManagerImpl::DriveBLEState(intptr_t arg)
11461142
{
11471143
sInstance.DriveBLEState();

0 commit comments

Comments
 (0)