@@ -670,6 +670,76 @@ ble_error_t Gap::set_extended_advertising_parameters(
670
670
bool scan_request_notification
671
671
)
672
672
{
673
+ uint8_t adv_type;
674
+
675
+ if (event_properties.use_legacy_pdu ) {
676
+ if (event_properties.directed == false ) {
677
+ if (event_properties.high_duty_cycle ) {
678
+ return BLE_ERROR_INVALID_PARAM;
679
+ }
680
+
681
+ if (event_properties.connectable && event_properties.scannable == false ) {
682
+ return BLE_ERROR_INVALID_PARAM;
683
+ }
684
+
685
+ if (event_properties.connectable && event_properties.scannable ) {
686
+ adv_type = DM_ADV_CONN_UNDIRECT;
687
+ } else if (event_properties.scannable ) {
688
+ adv_type = DM_ADV_SCAN_UNDIRECT;
689
+ } else {
690
+ adv_type = DM_ADV_NONCONN_UNDIRECT;
691
+ }
692
+ } else {
693
+ if (event_properties.scannable ) {
694
+ return BLE_ERROR_INVALID_PARAM;
695
+ }
696
+
697
+ if (event_properties.connectable == false ) {
698
+ return BLE_ERROR_INVALID_PARAM;
699
+ }
700
+
701
+ if (event_properties.high_duty_cycle ) {
702
+ adv_type = DM_ADV_CONN_DIRECT;
703
+ } else {
704
+ adv_type = DM_ADV_CONN_DIRECT_LO_DUTY;
705
+ }
706
+ }
707
+ } else {
708
+ if (event_properties.directed == false ) {
709
+ if (event_properties.high_duty_cycle ) {
710
+ return BLE_ERROR_INVALID_PARAM;
711
+ }
712
+
713
+ if (event_properties.connectable && event_properties.scannable ) {
714
+ adv_type = DM_ADV_CONN_UNDIRECT;
715
+ } else if (event_properties.scannable ) {
716
+ adv_type = DM_ADV_SCAN_UNDIRECT;
717
+ } else if (event_properties.connectable ) {
718
+ adv_type = DM_EXT_ADV_CONN_UNDIRECT;
719
+ } else {
720
+ adv_type = DM_ADV_NONCONN_UNDIRECT;
721
+ }
722
+ } else {
723
+ // note: not sure how to act with the high duty cycle in scannable
724
+ // and non connectable mode. These cases looks correct from a Bluetooth
725
+ // standpoint
726
+
727
+ if (event_properties.connectable && event_properties.scannable ) {
728
+ return BLE_ERROR_INVALID_PARAM;
729
+ } else if (event_properties.connectable ) {
730
+ if (event_properties.high_duty_cycle ) {
731
+ adv_type = DM_ADV_CONN_DIRECT;
732
+ } else {
733
+ adv_type = DM_ADV_CONN_DIRECT_LO_DUTY;
734
+ }
735
+ } else if (event_properties.scannable ) {
736
+ adv_type = DM_EXT_ADV_SCAN_DIRECT;
737
+ } else {
738
+ adv_type = DM_EXT_ADV_NONCONN_DIRECT;
739
+ }
740
+ }
741
+ }
742
+
673
743
DmAdvSetInterval (
674
744
advertising_handle,
675
745
primary_advertising_interval_min,
@@ -709,7 +779,7 @@ ble_error_t Gap::set_extended_advertising_parameters(
709
779
710
780
DmAdvConfig (
711
781
advertising_handle,
712
- event_properties. value (), // TODO: use the raw value here ???
782
+ adv_type,
713
783
peer_address_type.value (),
714
784
const_cast <uint8_t *>(peer_address.data ())
715
785
);
0 commit comments