From 2e859cdab49a2db257081de01af60c8fc81792e7 Mon Sep 17 00:00:00 2001 From: Vincent Coubard Date: Fri, 23 Oct 2020 12:17:31 +0100 Subject: [PATCH] BLE: Conditionally compile PAL depending on the feature selected. Previously (most) of the code was not pulled in because the pal interface was not virtual. --- .../cordio/source/BLEInstanceBaseImpl.cpp | 2 + .../source/cordio/source/PalGapImpl.cpp | 75 +++++++++++++------ .../source/cordio/source/PalGapImpl.h | 37 ++++++++- .../FEATURE_BLE/source/generic/GapImpl.cpp | 31 ++++++-- .../FEATURE_BLE/source/generic/GapImpl.h | 4 + connectivity/FEATURE_BLE/source/pal/PalGap.h | 41 +++++++++- 6 files changed, 157 insertions(+), 33 deletions(-) diff --git a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp index 3b024567a3..85e1ebd9a9 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/BLEInstanceBaseImpl.cpp @@ -414,6 +414,7 @@ void BLEInstanceBase::stack_handler(wsfEventMask_t event, wsfMsgHdr_t *msg) void BLEInstanceBase::device_manager_cb(dmEvt_t *dm_event) { +#if BLE_FEATURE_CONNECTABLE if (dm_event->hdr.status == HCI_SUCCESS && dm_event->hdr.event == DM_CONN_DATA_LEN_CHANGE_IND) { // this event can only happen after a connection has been established therefore gap is present ble::PalGapEventHandler *handler; @@ -427,6 +428,7 @@ void BLEInstanceBase::device_manager_cb(dmEvt_t *dm_event) } return; } +#endif BLEInstanceBase::deviceInstance().stack_handler(0, &dm_event->hdr); } diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp index 0c6b963012..c1e9e2af0c 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.cpp @@ -104,7 +104,7 @@ ble_error_t PalGap::set_random_address(const address_t &address) return BLE_ERROR_NONE; } - +#if BLE_ROLE_BROADCASTER ble_error_t PalGap::set_advertising_parameters( uint16_t advertising_interval_min, uint16_t advertising_interval_max, @@ -233,8 +233,9 @@ ble_error_t PalGap::advertising_enable(bool enable) return BLE_ERROR_NONE; } +#endif // BLE_ROLE_BROADCASTER - +#if BLE_ROLE_OBSERVER ble_error_t PalGap::set_scan_parameters( bool active_scanning, uint16_t scan_interval, @@ -276,8 +277,9 @@ ble_error_t PalGap::scan_enable( } return BLE_ERROR_NONE; } +#endif // BLE_ROLE_OBSERVER - +#if BLE_ROLE_CENTRAL ble_error_t PalGap::create_connection( uint16_t scan_interval, uint16_t scan_window, @@ -342,8 +344,9 @@ ble_error_t PalGap::cancel_connection_creation() return error; } +#endif // BLE_ROLE_CENTRAL - +#if BLE_FEATURE_WHITELIST uint8_t PalGap::read_white_list_capacity() { return HciGetWhiteListSize(); @@ -381,8 +384,9 @@ ble_error_t PalGap::remove_device_from_whitelist( ); return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_WHITELIST - +#if BLE_FEATURE_CONNECTABLE ble_error_t PalGap::connection_parameters_update( connection_handle_t connection, uint16_t connection_interval_min, @@ -463,6 +467,9 @@ ble_error_t PalGap::disconnect( return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_CONNECTABLE + +#if BLE_FEATURE_PHY_MANAGEMENT ble_error_t PalGap::read_phy(connection_handle_t connection) { if (is_feature_supported(controller_supported_features_t::LE_2M_PHY) @@ -514,6 +521,7 @@ ble_error_t PalGap::set_phy( return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_PHY_MANAGEMENT // singleton of the ARM Cordio client @@ -766,6 +774,7 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg) } break; +#if BLE_ROLE_PERIPHERAL case DM_CONN_CLOSE_IND: { // Intercept connection close indication received when direct advertising timeout. // Leave the rest of the processing to the event handlers bellow. @@ -775,16 +784,21 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg) get_gap().get_running_conn_direct_adv_cb(evt->hdr.param); if (adv_cb) { adv_cb->state = direct_adv_cb_t::free; -#if BLE_ROLE_BROADCASTER if (handler) { - handler->on_advertising_set_terminated( - hci_error_code_t(evt->status), - adv_cb->advertising_handle, - DM_CONN_ID_NONE, - 0 - ); +#if BLE_FEATURE_EXTENDED_ADVERTISING + if (get_gap().is_feature_supported(controller_supported_features_t::LE_EXTENDED_ADVERTISING)) { + handler->on_advertising_set_terminated( + hci_error_code_t(evt->status), + adv_cb->advertising_handle, + DM_CONN_ID_NONE, + 0 + ); + } else +#endif + { + handler->on_legacy_advertising_stopped(); + } } -#endif // BLE_ROLE_BROADCASTER } } } @@ -801,6 +815,7 @@ void PalGap::gap_handler(const wsfMsgHdr_t *msg) } } break; +#endif // BLE_ROLE_PERIPHERAL #endif // BLE_FEATURE_CONNECTABLE } @@ -843,7 +858,8 @@ bool PalGap::event_handler(const wsfMsgHdr_t *msg) return false; } - +#if BLE_ROLE_BROADCASTER +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::set_advertising_set_random_address( advertising_handle_t advertising_handle, const address_t &address @@ -853,7 +869,6 @@ ble_error_t PalGap::set_advertising_set_random_address( return BLE_ERROR_NONE; } -#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::set_extended_advertising_parameters( advertising_handle_t advertising_handle, advertising_event_properties_t event_properties, @@ -995,6 +1010,7 @@ ble_error_t PalGap::set_extended_advertising_parameters( } #endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t PalGap::set_periodic_advertising_parameters( advertising_handle_t advertising_handle, periodic_advertising_interval_t periodic_advertising_min, @@ -1012,8 +1028,9 @@ ble_error_t PalGap::set_periodic_advertising_parameters( return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_PERIODIC_ADVERTISING - +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::set_extended_advertising_data( advertising_handle_t advertising_handle, advertising_fragment_description_t operation, @@ -1037,8 +1054,9 @@ ble_error_t PalGap::set_extended_advertising_data( ); return BLE_ERROR_NONE; } +#endif // #if BLE_FEATURE_EXTENDED_ADVERTISING - +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t PalGap::set_periodic_advertising_data( advertising_handle_t advertising_handle, advertising_fragment_description_t fragment_description, @@ -1054,8 +1072,9 @@ ble_error_t PalGap::set_periodic_advertising_data( ); return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_PERIODIC_ADVERTISING - +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::set_extended_scan_response_data( advertising_handle_t advertising_handle, advertising_fragment_description_t operation, @@ -1170,8 +1189,9 @@ ble_error_t PalGap::extended_advertising_enable( return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_EXTENDED_ADVERTISING - +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t PalGap::periodic_advertising_enable( bool enable, advertising_handle_t advertising_handle @@ -1185,7 +1205,7 @@ ble_error_t PalGap::periodic_advertising_enable( return BLE_ERROR_NONE; } - +#endif uint16_t PalGap::get_maximum_advertising_data_length() { @@ -1210,7 +1230,7 @@ uint8_t PalGap::get_max_number_of_advertising_sets() return std::min(HciGetNumSupAdvSets(), (uint8_t) DM_NUM_ADV_SETS); } - +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::remove_advertising_set(advertising_handle_t advertising_handle) { DmAdvRemoveAdvSet(advertising_handle); @@ -1223,8 +1243,11 @@ ble_error_t PalGap::clear_advertising_sets() DmAdvClearAdvSets(); return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#endif // BLE_ROLE_BROADCASTER - +#if BLE_ROLE_OBSERVER +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::set_extended_scan_parameters( own_address_type_t own_address_type, scanning_filter_policy_t filter_policy, @@ -1287,8 +1310,9 @@ ble_error_t PalGap::extended_scan_enable( return BLE_ERROR_NONE; } +#endif // BLE_FEATURE_EXTENDED_ADVERTISING - +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t PalGap::periodic_advertising_create_sync( bool use_periodic_advertiser_list, uint8_t advertising_sid, @@ -1376,8 +1400,10 @@ uint8_t PalGap::read_periodic_advertiser_list_size() { return HciGetPerAdvListSize(); } +#endif // BLE_FEATURE_PERIODIC_ADVERTISING +#endif // BLE_ROLE_OBSERVER - +#if BLE_ROLE_CENTRAL && BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::extended_create_connection( initiator_policy_t initiator_policy, own_address_type_t own_address_type, @@ -1430,6 +1456,7 @@ ble_error_t PalGap::extended_create_connection( return BLE_ERROR_NONE; } +#endif // BLE_ROLE_CENTRAL && BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t PalGap::update_direct_advertising_parameters( diff --git a/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h index 8518580737..c361ac4d5f 100644 --- a/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h +++ b/connectivity/FEATURE_BLE/source/cordio/source/PalGapImpl.h @@ -50,6 +50,7 @@ public: ble_error_t set_random_address(const address_t &address) final; +#if BLE_ROLE_BROADCASTER ble_error_t set_advertising_parameters( uint16_t advertising_interval_min, uint16_t advertising_interval_max, @@ -72,7 +73,9 @@ public: ) final; ble_error_t advertising_enable(bool enable) final; +#endif // BLE_ROLE_BROADCASTER +#if BLE_ROLE_OBSERVER ble_error_t set_scan_parameters( bool active_scanning, uint16_t scan_interval, @@ -85,7 +88,9 @@ public: bool enable, bool filter_duplicates ) final; +#endif // BLE_ROLE_OBSERVER +#if BLE_ROLE_CENTRAL ble_error_t create_connection( uint16_t scan_interval, uint16_t scan_window, @@ -102,7 +107,9 @@ public: ) final; ble_error_t cancel_connection_creation(); +#endif +#if BLE_FEATURE_WHITELIST uint8_t read_white_list_capacity() final; ble_error_t clear_whitelist() final; @@ -116,7 +123,9 @@ public: whitelist_address_type_t address_type, address_t address ) final; +#endif // BLE_FEATURE_WHITELIST +#if BLE_FEATURE_CONNECTABLE ble_error_t connection_parameters_update( connection_handle_t connection, uint16_t connection_interval_min, @@ -146,7 +155,9 @@ public: connection_handle_t connection, local_disconnection_reason_t disconnection_reason ) final; +#endif // BLE_FEATURE_CONNECTABLE +#if BLE_FEATURE_PHY_MANAGEMENT ble_error_t read_phy(connection_handle_t connection) final; ble_error_t set_preferred_phys( @@ -160,6 +171,7 @@ public: const phy_set_t &rx_phys, coded_symbol_per_bit_t coded_symbol ) final; +#endif // BLE_FEATURE_PHY_MANAGEMENT // singleton of the ARM Cordio client static PalGap &get_gap(); @@ -169,12 +181,13 @@ public: */ static void gap_handler(const wsfMsgHdr_t *msg); +#if BLE_ROLE_BROADCASTER +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t set_advertising_set_random_address( advertising_handle_t advertising_handle, const address_t &address ) final; -#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t set_extended_advertising_parameters( advertising_handle_t advertising_handle, advertising_event_properties_t event_properties, @@ -194,13 +207,17 @@ public: ) final; #endif // BLE_FEATURE_EXTENDED_ADVERTISING + +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t set_periodic_advertising_parameters( advertising_handle_t advertising_handle, periodic_advertising_interval_t periodic_advertising_min, periodic_advertising_interval_t periodic_advertising_max, bool advertise_power ) final; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t set_extended_advertising_data( advertising_handle_t advertising_handle, advertising_fragment_description_t operation, @@ -208,14 +225,18 @@ public: uint8_t advertising_data_size, const uint8_t *advertising_data ) final; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t set_periodic_advertising_data( advertising_handle_t advertising_handle, advertising_fragment_description_t fragment_description, uint8_t advertising_data_size, const uint8_t *advertising_data ) final; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t set_extended_scan_response_data( advertising_handle_t advertising_handle, advertising_fragment_description_t operation, @@ -231,11 +252,14 @@ public: const uint16_t *durations, const uint8_t *max_extended_advertising_events ) final; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t periodic_advertising_enable( bool enable, advertising_handle_t advertising_handle ) final; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING uint16_t get_maximum_advertising_data_length() final; @@ -245,12 +269,17 @@ public: uint8_t get_max_number_of_advertising_sets() final; +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t remove_advertising_set( advertising_handle_t advertising_handle ) final; ble_error_t clear_advertising_sets() final; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#endif // BLE_ROLE_BROADCASTER +#if BLE_ROLE_OBSERVER +#if BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t set_extended_scan_parameters( own_address_type_t own_address_type, scanning_filter_policy_t filter_policy, @@ -266,7 +295,9 @@ public: uint16_t duration, uint16_t period ) final; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING ble_error_t periodic_advertising_create_sync( bool use_periodic_advertiser_list, uint8_t advertising_sid, @@ -297,7 +328,10 @@ public: ble_error_t clear_periodic_advertiser_list() final; uint8_t read_periodic_advertiser_list_size() final; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING +#endif // BLE_ROLE_OBSERVER +#if BLE_ROLE_CENTRAL && BLE_FEATURE_EXTENDED_ADVERTISING ble_error_t extended_create_connection( initiator_policy_t initiator_policy, own_address_type_t own_address_type, @@ -313,6 +347,7 @@ public: const uint16_t *minimum_connection_event_lengths, const uint16_t *maximum_connection_event_lengths ) final; +#endif // BLE_ROLE_CENTRAL && BLE_FEATURE_EXTENDED_ADVERTISING void when_gap_event_received(mbed::Callback cb) final; diff --git a/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp b/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp index 0bdb3bdf4c..b7f5e25c76 100644 --- a/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp +++ b/connectivity/FEATURE_BLE/source/generic/GapImpl.cpp @@ -494,9 +494,12 @@ ble_error_t Gap::stopScan() _scan_requested = false; if (_scan_state == ScanState::scan) { +#if BLE_FEATURE_EXTENDED_ADVERTISING if (is_extended_advertising_available()) { err = _pal_gap.extended_scan_enable(false, duplicates_filter_t::DISABLE, 0, 0); - } else { + } else +#endif + { err = _pal_gap.scan_enable(false, false); } @@ -616,7 +619,9 @@ ble_error_t Gap::connect( connectionParams.getMaxConnectionIntervalArray()[0] ); } - } else { + } +#if BLE_FEATURE_EXTENDED_ADVERTISING + else { // set the correct mac address before starting scanning. if (_scan_state == ScanState::idle) { _pal_gap.set_random_address(*address); @@ -659,6 +664,7 @@ ble_error_t Gap::connect( ); } } +#endif if (ret == BLE_ERROR_NONE) { _initiating = true; @@ -808,6 +814,7 @@ void Gap::on_read_phy( } #endif // BLE_FEATURE_PHY_MANAGEMENT +#if BLE_FEATURE_CONNECTABLE void Gap::on_data_length_change( connection_handle_t connection_handle, uint16_t tx_size, @@ -818,6 +825,7 @@ void Gap::on_data_length_change( _event_handler->onDataLengthChange(connection_handle, tx_size, rx_size); } } +#endif // BLE_FEATURE_CONNECTABLE #if BLE_FEATURE_PHY_MANAGEMENT void Gap::on_phy_update_complete( @@ -1083,13 +1091,12 @@ ble_error_t Gap::reset() #endif // BLE_GAP_HOST_BASED_PRIVATE_ADDRESS_RESOLUTION #endif // BLE_FEATURE_PRIVACY -#if BLE_ROLE_BROADCASTER - _advertising_timeout.detach(); -#endif #if BLE_ROLE_OBSERVER _scan_timeout.detach(); #endif +#if BLE_ROLE_BROADCASTER + _advertising_timeout.detach(); #if BLE_FEATURE_EXTENDED_ADVERTISING if (is_extended_advertising_available()) { /* stop all advertising sets */ @@ -1120,6 +1127,7 @@ ble_error_t Gap::reset() _active_periodic_sets.clear(); #endif if (_active_sets.get(LEGACY_ADVERTISING_HANDLE)) { +#if BLE_FEATURE_EXTENDED_ADVERTISING _pal_gap.extended_advertising_enable( /* enable */ false, /* number of advertising sets */ 1, @@ -1127,6 +1135,9 @@ ble_error_t Gap::reset() nullptr, nullptr ); +#else + _pal_gap.advertising_enable(false); +#endif } _active_sets.clear(); _pending_sets.clear(); @@ -1135,11 +1146,12 @@ ble_error_t Gap::reset() _connectable_payload_size_exceeded.clear(); _set_is_connectable.clear(); +#if BLE_FEATURE_EXTENDED_ADVERTISING /* clear advertising set data on the controller */ _pal_gap.clear_advertising_sets(); -#if BLE_FEATURE_EXTENDED_ADVERTISING } #endif // BLE_FEATURE_EXTENDED_ADVERTISING +#endif // #BLE_ROLE_BROADCASTER return BLE_ERROR_NONE; } @@ -2854,6 +2866,7 @@ void Gap::on_legacy_advertising_stopped() } } +#if BLE_FEATURE_EXTENDED_ADVERTISING void Gap::on_advertising_set_started(const mbed::Span& handles) { for (const auto &handle : handles) { @@ -2919,6 +2932,7 @@ void Gap::on_scan_request_received( ) ); } +#endif // BLE_FEATURE_EXTENDED_ADVERTISING #endif // BLE_ROLE_BROADCASTER #if BLE_FEATURE_CONNECTABLE @@ -2985,6 +2999,7 @@ ble_error_t Gap::setScanParameters(const ScanParameters ¶ms) return BLE_ERROR_INVALID_PARAM; } +#if BLE_FEATURE_EXTENDED_ADVERTISING if (is_extended_advertising_available()) { bool active_scanning[] = { params.get1mPhyConfiguration().isActiveScanningSet(), @@ -3009,7 +3024,9 @@ ble_error_t Gap::setScanParameters(const ScanParameters ¶ms) scan_interval, scan_window ); - } else { + } else +#endif + { if (params.getPhys().get_coded()) { return BLE_ERROR_INVALID_PARAM; } diff --git a/connectivity/FEATURE_BLE/source/generic/GapImpl.h b/connectivity/FEATURE_BLE/source/generic/GapImpl.h index a0b3cd9177..b0cf8b2fc6 100644 --- a/connectivity/FEATURE_BLE/source/generic/GapImpl.h +++ b/connectivity/FEATURE_BLE/source/generic/GapImpl.h @@ -702,11 +702,13 @@ private: ) override; #endif // BLE_FEATURE_PHY_MANAGEMENT +#if BLE_FEATURE_CONNECTABLE void on_data_length_change( connection_handle_t connection_handle, uint16_t tx_size, uint16_t rx_size ) override; +#endif #if BLE_FEATURE_PHY_MANAGEMENT void on_phy_update_complete( @@ -766,6 +768,7 @@ private: void on_legacy_advertising_stopped() override; +#if BLE_FEATURE_EXTENDED_ADVERTISING void on_advertising_set_started(const mbed::Span& handles) override; void on_advertising_set_terminated( @@ -780,6 +783,7 @@ private: connection_peer_address_type_t scanner_address_type, const ble::address_t &address ) override; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING #endif // BLE_ROLE_BROADCASTER #if BLE_FEATURE_CONNECTABLE diff --git a/connectivity/FEATURE_BLE/source/pal/PalGap.h b/connectivity/FEATURE_BLE/source/pal/PalGap.h index e0caee3050..f3dacc496d 100644 --- a/connectivity/FEATURE_BLE/source/pal/PalGap.h +++ b/connectivity/FEATURE_BLE/source/pal/PalGap.h @@ -43,6 +43,7 @@ public: ) = 0; #endif // BLE_FEATURE_PHY_MANAGEMENT +#if BLE_FEATURE_CONNECTABLE /** * @copydoc PalGap::EventHandler::onDataLengthChange */ @@ -51,6 +52,7 @@ public: uint16_t tx_size, uint16_t rx_size ) = 0; +#endif #if BLE_FEATURE_PHY_MANAGEMENT /** @@ -183,6 +185,7 @@ public: */ virtual void on_legacy_advertising_stopped() = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Called when extended advertising has been started. */ @@ -213,6 +216,7 @@ public: connection_peer_address_type_t scanner_address_type, const address_t &address ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING #endif // BLE_ROLE_BROADCASTER #if BLE_FEATURE_CONNECTABLE @@ -302,6 +306,8 @@ public: */ virtual ble_error_t set_random_address(const address_t &address) = 0; +#if BLE_ROLE_BROADCASTER +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Set the random device address used by an advertising set. * @@ -326,6 +332,7 @@ public: advertising_handle_t advertising_handle, const address_t &address ) = 0; +#endif /** * Set the advertising parameters which will be used during the advertising @@ -474,6 +481,7 @@ public: ) = 0; #endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING /** * Configure periodic advertising parameters of an advertising set. * @@ -506,6 +514,7 @@ public: periodic_advertising_interval_t periodic_advertising_max, bool advertise_power ) = 0; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING /** * Set the data sends in advertising packet. If the advertising is @@ -529,6 +538,7 @@ public: const advertising_data_t &advertising_data ) = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Set data in advertising PDUs. * @@ -567,7 +577,9 @@ public: uint8_t advertising_data_size, const uint8_t *advertising_data ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING /** * Set the data used in periodic advertising PDUs. * @@ -599,6 +611,7 @@ public: uint8_t advertising_data_size, const uint8_t *advertising_data ) = 0; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING /** * Set the data sends in scan response packets. If the advertising is @@ -622,6 +635,7 @@ public: const advertising_data_t &scan_response_data ) = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Set the data sends in extended scan response packets. If the advertising * is currently enabled, the data shall be used when a new extended scan @@ -654,6 +668,7 @@ public: uint8_t scan_response_data_size, const uint8_t *scan_response_data ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING /** * Start or stop advertising. @@ -697,6 +712,7 @@ public: */ virtual ble_error_t advertising_enable(bool enable) = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Start of stop advertising of extended advertising sets. * @@ -739,7 +755,9 @@ public: const uint16_t *durations, const uint8_t *max_extended_advertising_events ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING /** * Enable or disable periodic advertising of an advertising set. * @@ -759,6 +777,7 @@ public: bool enable, advertising_handle_t advertising_handle ) = 0; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING /** * Query the maximum data length the controller supports in an advertising @@ -801,6 +820,7 @@ public: */ virtual uint8_t get_max_number_of_advertising_sets() = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Remove an advertising set from the controller. * @@ -835,8 +855,10 @@ public: * command. */ virtual ble_error_t clear_advertising_sets() = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#endif // BLE_ROLE_BROADCASTER - +#if BLE_ROLE_OBSERVER /** * Set the parameter of the scan process. * @@ -872,6 +894,7 @@ public: scanning_filter_policy_t filter_policy ) = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Set extended scan parameters to be used on advertising channels. * @@ -908,6 +931,7 @@ public: const uint16_t *scan_interval, const uint16_t *scan_window ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING /** * Start/stop scanning process. @@ -935,6 +959,7 @@ public: bool filter_duplicates ) = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Enable or disable extended scanning. * @@ -962,7 +987,9 @@ public: uint16_t duration, uint16_t period ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING +#if BLE_FEATURE_PERIODIC_ADVERTISING /** * Synchronize an observer with a periodic advertising broadcaster. * @@ -1107,7 +1134,10 @@ public: * @note We (wrongfully) assume that value doesn't change over time. */ virtual uint8_t read_periodic_advertiser_list_size() = 0; +#endif // BLE_FEATURE_PERIODIC_ADVERTISING +#endif // BLE_ROLE_OBSERVER +#if BLE_ROLE_CENTRAL /** * Create a new le connection to a connectable advertiser. * @@ -1194,6 +1224,7 @@ public: uint16_t maximum_connection_event_length ) = 0; +#if BLE_FEATURE_EXTENDED_ADVERTISING /** * Create a new le connection to a connectable advertiser. * @@ -1286,6 +1317,7 @@ public: const uint16_t *minimum_connection_event_lengths, const uint16_t *maximum_connection_event_lengths ) = 0; +#endif // BLE_FEATURE_EXTENDED_ADVERTISING /** * Cancel the ongoing connection creation process. @@ -1297,7 +1329,9 @@ public: * command. */ virtual ble_error_t cancel_connection_creation() = 0; +#endif // BLE_ROLE_CENTRAL +#if BLE_FEATURE_WHITELIST /** * Return the number of total whitelist entries that can be stored in the * le subsystem. @@ -1368,7 +1402,9 @@ public: whitelist_address_type_t address_type, address_t address ) = 0; +#endif // BLE_FEATURE_WHITELIST +#if BLE_FEATURE_CONNECTABLE /** * Start a connection update procedure. * @@ -1543,6 +1579,7 @@ public: connection_handle_t connection, local_disconnection_reason_t disconnection_reason ) = 0; +#endif /** * Checked support for a feature in the link controller. @@ -1554,6 +1591,7 @@ public: controller_supported_features_t feature ) = 0; +#if BLE_FEATURE_PHY_MANAGEMENT /** * @see PalGap::readPhy */ @@ -1576,6 +1614,7 @@ public: const phy_set_t &rx_phys, coded_symbol_per_bit_t coded_symbol ) = 0; +#endif // BLE_FEATURE_PHY_MANAGEMENT /** * Register a callback which will handle PalGap events.