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