Skip to content

Commit 18e59b5

Browse files
sondrepasilz
andcommitted
bluetooth: services: hrs role fix
Only run ble evt when peripheral role is connected. Signed-off-by: Sondre Pettersen <sondre.pettersen@nordicsemi.no> Co-authored-by: Asil Zogby <asil.zogby@nordicsemi.no>
1 parent 13a9ef5 commit 18e59b5

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

  • subsys/bluetooth/services/ble_hrs

subsys/bluetooth/services/ble_hrs/hrs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,12 @@ void ble_hrs_on_ble_evt(const ble_evt_t *ble_evt, void *hrs_instance)
193193
__ASSERT(ble_evt, "BLE event is NULL");
194194
__ASSERT(hrs_instance, "BLE instance is NULL");
195195

196+
if (ble_evt->header.evt_id >= BLE_GAP_EVT_BASE &&
197+
ble_evt->header.evt_id <= BLE_GAP_EVT_LAST &&
198+
ble_evt->evt.gap_evt.params.connected.role != BLE_GAP_ROLE_PERIPH) {
199+
return;
200+
}
201+
196202
switch (ble_evt->header.evt_id) {
197203
case BLE_GAP_EVT_CONNECTED:
198204
on_connect(hrs_instance, &ble_evt->evt.gap_evt);

0 commit comments

Comments
 (0)