@@ -23,6 +23,13 @@ namespace pal {
23
23
namespace vendor {
24
24
namespace cordio {
25
25
26
+ namespace {
27
+ bool dummy_gap_event_handler (const wsfMsgHdr_t *msg)
28
+ {
29
+ return false ;
30
+ }
31
+ }
32
+
26
33
template <class EventHandler >
27
34
bool Gap<EventHandler>::is_feature_supported_(
28
35
ble::controller_supported_features_t feature
@@ -467,6 +474,7 @@ void Gap<EventHandler>::gap_handler(const wsfMsgHdr_t *msg)
467
474
468
475
469
476
switch (msg->event ) {
477
+ #if BLE_FEATURE_PHY_MANAGEMENT
470
478
case DM_PHY_READ_IND: {
471
479
if (!handler) {
472
480
break ;
@@ -497,7 +505,8 @@ void Gap<EventHandler>::gap_handler(const wsfMsgHdr_t *msg)
497
505
);
498
506
}
499
507
break ;
500
-
508
+ #endif // BLE_FEATURE_PHY_MANAGEMENT
509
+ #if BLE_FEATURE_PERIODIC_ADVERTISING
501
510
case DM_PER_ADV_SYNC_EST_IND: {
502
511
if (!handler) {
503
512
break ;
@@ -545,7 +554,9 @@ void Gap<EventHandler>::gap_handler(const wsfMsgHdr_t *msg)
545
554
handler->on_periodic_advertising_sync_loss (evt->syncHandle );
546
555
}
547
556
break ;
548
-
557
+ #endif BLE_FEATURE_PERIODIC_ADVERTISING
558
+
559
+ #if BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_BROADCASTER
549
560
case DM_SCAN_REQ_RCVD_IND: {
550
561
if (!handler) {
551
562
break ;
@@ -573,8 +584,10 @@ void Gap<EventHandler>::gap_handler(const wsfMsgHdr_t *msg)
573
584
evt->numComplEvts
574
585
);
575
586
}
576
- break ;
587
+ break ;
588
+ #endif // BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_BROADCASTER
577
589
590
+ #if BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_OBSERVER
578
591
case DM_EXT_SCAN_STOP_IND: {
579
592
if (!handler) {
580
593
break ;
@@ -611,7 +624,9 @@ void Gap<EventHandler>::gap_handler(const wsfMsgHdr_t *msg)
611
624
);
612
625
}
613
626
break ;
627
+ #endif // BLE_FEATURE_EXTENDED_ADVERTISING && BLE_ROLE_OBSERVER
614
628
629
+ #if BLE_ROLE_CENTRAL || BLE_ROLE_PERIPHERAL
615
630
case DM_CONN_UPDATE_IND: {
616
631
if (!handler) {
617
632
break ;
@@ -644,14 +659,20 @@ void Gap<EventHandler>::gap_handler(const wsfMsgHdr_t *msg)
644
659
}
645
660
break ;
646
661
}
662
+ #endif // BLE_ROLE_CENTRAL || BLE_ROLE_PERIPHERAL
647
663
648
664
// all handlers are stored in a static array
649
665
static const event_handler_t handlers[] = {
650
- &event_handler<ConnectionCompleteMessageConverter>,
666
+ # if BLE_ROLE_OBSERVER
651
667
&event_handler<GapAdvertisingReportMessageConverter>,
668
+ #endif // BLE_ROLE_OBSERVER
669
+ #if BLE_ROLE_CENTRAL || BLE_ROLE_PERIPHERAL
670
+ &event_handler<ConnectionCompleteMessageConverter>,
652
671
&event_handler<DisconnectionMessageConverter>,
653
672
&event_handler<ConnectionUpdateMessageConverter>,
654
- &event_handler<RemoteConnectionParameterRequestMessageConverter>
673
+ &event_handler<RemoteConnectionParameterRequestMessageConverter>,
674
+ #endif // BLE_ROLE_CENTRAL || BLE_ROLE_PERIPHERAL
675
+ &dummy_gap_event_handler
655
676
};
656
677
657
678
// event->hdr.param: connection handle
0 commit comments