Loading system/main/shim/btm.cc +100 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ #include <algorithm> #include <cstring> #include "stack/btm/btm_int_types.h" #include "main/shim/btm.h" #include "main/shim/entry.h" #include "main/shim/shim.h" #include "osi/include/log.h" bluetooth::shim::Btm::Btm() {} extern tBTM_CB btm_cb; static constexpr size_t kMaxInquiryResultSize = 4096; static uint8_t inquiry_result_buf[kMaxInquiryResultSize]; Loading @@ -37,12 +39,30 @@ static constexpr uint8_t kExtendedInquiryResultMode = 2; static constexpr size_t kRemoteDeviceNameLength = 248; static constexpr uint8_t kAdvDataInfoNotPresent = 0xff; static constexpr uint8_t kTxPowerInformationNotPresent = 0x7f; static constexpr uint8_t kNotPeriodicAdvertisement = 0x00; static constexpr bool kActiveScanning = true; static constexpr bool kPassiveScanning = true; extern void btm_process_cancel_complete(uint8_t status, uint8_t mode); extern void btm_process_inq_complete(uint8_t status, uint8_t result_type); extern void btm_process_inq_results(uint8_t* p, uint8_t result_mode); extern void btm_ble_process_adv_addr(RawAddress& raw_address, uint8_t* address_type); extern void btm_ble_process_adv_pkt_cont( uint16_t event_type, uint8_t address_type, const RawAddress& raw_address, uint8_t primary_phy, uint8_t secondary_phy, uint8_t advertising_sid, int8_t tx_power, int8_t rssi, uint16_t periodic_adv_int, uint8_t data_len, uint8_t* data); using BtmRemoteDeviceName = tBTM_REMOTE_DEV_NAME; bluetooth::shim::Btm::Btm() {} bluetooth::shim::Btm::~Btm() {} /** * */ Loading Loading @@ -430,3 +450,82 @@ bluetooth::shim::Btm::CancelAllReadRemoteDeviceName() { __func__); return bluetooth::shim::BTM_WRONG_MODE; } void bluetooth::shim::Btm::StartAdvertising() { bluetooth::shim::GetAdvertising()->StartAdvertising(); } void bluetooth::shim::Btm::StopAdvertising() { bluetooth::shim::GetAdvertising()->StopAdvertising(); } void bluetooth::shim::Btm::StartConnectability() { bluetooth::shim::GetAdvertising()->StartAdvertising(); } void bluetooth::shim::Btm::StopConnectability() { bluetooth::shim::GetAdvertising()->StopAdvertising(); } bool bluetooth::shim::Btm::StartActiveScanning() { StartScanning(kActiveScanning); return true; } bool bluetooth::shim::Btm::StopActiveScanning() { bluetooth::shim::GetScanning()->StopScanning(); return true; } bool bluetooth::shim::Btm::StartObserving() { StartScanning(kPassiveScanning); return true; } bool bluetooth::shim::Btm::StopObserving() { bluetooth::shim::GetScanning()->StopScanning(); return true; } void bluetooth::shim::Btm::StartScanning(bool use_active_scanning) { bluetooth::shim::GetScanning()->StartScanning( use_active_scanning, [](AdvertisingReport report) { LOG_INFO(LOG_TAG, "%s Received advertising report from device:%s", __func__, report.string_address.c_str()); RawAddress raw_address; RawAddress::FromString(report.string_address, raw_address); btm_ble_process_adv_addr(raw_address, &report.address_type); btm_ble_process_adv_pkt_cont( report.extended_event_type, report.address_type, raw_address, kPhyConnectionLe1M, kPhyConnectionNone, kAdvDataInfoNotPresent, kTxPowerInformationNotPresent, report.rssi, kNotPeriodicAdvertisement, report.len, report.data); }, [](DirectedAdvertisingReport report) { LOG_WARN(LOG_TAG, "%s Directed advertising is unsupported from device:%s", __func__, report.string_address.c_str()); }, [](ExtendedAdvertisingReport report) { LOG_INFO(LOG_TAG, "%s Received extended advertising report from device:%s", __func__, report.string_address.c_str()); RawAddress raw_address; RawAddress::FromString(report.string_address, raw_address); if (report.address_type != BLE_ADDR_ANONYMOUS) { btm_ble_process_adv_addr(raw_address, &report.address_type); } btm_ble_process_adv_pkt_cont( report.extended_event_type, report.address_type, raw_address, kPhyConnectionLe1M, kPhyConnectionNone, kAdvDataInfoNotPresent, kTxPowerInformationNotPresent, report.rssi, kNotPeriodicAdvertisement, report.len, report.data); }, []() { LOG_INFO(LOG_TAG, "%s Scanning timeout", __func__); }); } size_t bluetooth::shim::Btm::GetNumberOfAdvertisingInstances() const { return bluetooth::shim::GetAdvertising()->GetNumberOfAdvertisingInstances(); } system/main/shim/btm.h +20 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,11 @@ static constexpr int kClearInquiryFilter = 0; static constexpr int kFilterOnDeviceClass = 1; static constexpr int kFilterOnAddress = 2; static constexpr uint8_t kPhyConnectionNone = 0x00; static constexpr uint8_t kPhyConnectionLe1M = 0x01; static constexpr uint8_t kPhyConnectionLe2M = 0x02; static constexpr uint8_t kPhyConnectionLeCoded = 0x03; using DiscoverabilityState = struct { int mode; uint16_t interval; Loading Loading @@ -122,6 +127,7 @@ class ReadRemoteName { class Btm { public: Btm(); ~Btm(); // Callbacks void OnInquiryResult(std::vector<const uint8_t> result); Loading Loading @@ -186,12 +192,26 @@ class Btm { tBTM_CMPL_CB* callback); BtmStatus CancelAllReadRemoteDeviceName(); void StartAdvertising(); void StopAdvertising(); void StartConnectability(); void StopConnectability(); bool StartActiveScanning(); bool StopActiveScanning(); bool StartObserving(); bool StopObserving(); size_t GetNumberOfAdvertisingInstances() const; private: ReadRemoteName le_read_remote_name_; ReadRemoteName classic_read_remote_name_; // TODO(cmanton) abort if there is no classic acl link up bool CheckClassicAclLink(const RawAddress& raw_address) { return true; } bool CheckLeAclLink(const RawAddress& raw_address) { return true; } void StartScanning(bool use_active_scanning); }; } // namespace shim Loading system/main/shim/btm_api.cc +66 −13 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ static bluetooth::shim::Btm shim_btm; extern tBTM_CB btm_cb; extern void btm_acl_update_busy_level(tBTM_BLI_EVENT event); extern void btm_clear_all_pending_le_entry(void); extern void btm_clr_inq_result_flt(void); extern void btm_sort_inq_result(void); tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, tBTM_INQ_RESULTS_CB* p_results_cb, Loading @@ -39,13 +42,15 @@ tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, CHECK(p_results_cb != nullptr); CHECK(p_cmpl_cb != nullptr); uint8_t classic_mode = p_inqparms->mode & 0x0f; // TODO(cmanton) Setup the LE portion too uint8_t le_mode = p_inqparms->mode >> 4; btm_cb.btm_inq_vars.inq_cmpl_info.num_resp = 0; /* Clear the results counter */ LOG_INFO(LOG_TAG, "%s Start inquiry mode classic:%hhd le:%hhd", __func__, classic_mode, le_mode); uint8_t classic_mode = p_inqparms->mode & 0x0f; if (!shim_btm.StartActiveScanning()) { LOG_WARN(LOG_TAG, "%s Unable to start le active scanning", __func__); return BTM_ERR_PROCESSING; } if (!shim_btm.SetInquiryFilter(classic_mode, p_inqparms->filter_cond_type, p_inqparms->filter_cond)) { LOG_WARN(LOG_TAG, "%s Unable to set inquiry filter", __func__); Loading @@ -57,6 +62,14 @@ tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, LOG_WARN(LOG_TAG, "%s Unable to start inquiry", __func__); return BTM_ERR_PROCESSING; } btm_cb.btm_inq_vars.state = BTM_INQ_ACTIVE_STATE; btm_cb.btm_inq_vars.p_inq_cmpl_cb = p_cmpl_cb; btm_cb.btm_inq_vars.p_inq_results_cb = p_results_cb; btm_cb.btm_inq_vars.inq_active = p_inqparms->mode; btm_acl_update_busy_level(BTM_BLI_INQ_EVT); return BTM_CMD_STARTED; } Loading Loading @@ -109,14 +122,15 @@ tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode, switch (le_discoverable_mode) { case kDiscoverableModeOff: shim_btm.SetLeDiscoverabilityOff(); shim_btm.StopAdvertising(); break; case kLimitedDiscoverableMode: shim_btm.SetLeLimitedDiscoverability(); break; case kGeneralDiscoverableMode: shim_btm.SetLeGeneralDiscoverability(); shim_btm.StartAdvertising(); break; default: LOG_WARN(LOG_TAG, "%s Unexpected le discoverability mode:%d", __func__, le_discoverable_mode); } switch (classic_discoverable_mode) { Loading @@ -129,6 +143,9 @@ tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode, case kGeneralDiscoverableMode: shim_btm.SetClassicGeneralDiscoverability(window, interval); break; default: LOG_WARN(LOG_TAG, "%s Unexpected classic discoverability mode:%d", __func__, classic_discoverable_mode); } return BTM_SUCCESS; } Loading @@ -149,6 +166,43 @@ tBTM_STATUS bluetooth::shim::BTM_SetInquiryScanType(uint16_t scan_type) { return BTM_WRONG_MODE; } tBTM_STATUS bluetooth::shim::BTM_BleObserve(bool start, uint8_t duration_sec, tBTM_INQ_RESULTS_CB* p_results_cb, tBTM_CMPL_CB* p_cmpl_cb) { if (start) { CHECK(p_results_cb != nullptr); CHECK(p_cmpl_cb != nullptr); if (btm_cb.ble_ctr_cb.scan_activity & BTM_LE_OBSERVE_ACTIVE) { LOG_WARN(LOG_TAG, "%s Observing already active", __func__); return BTM_WRONG_MODE; } btm_cb.ble_ctr_cb.p_obs_results_cb = p_results_cb; btm_cb.ble_ctr_cb.p_obs_cmpl_cb = p_cmpl_cb; if (!shim_btm.StartObserving()) { LOG_WARN(LOG_TAG, "%s Unable to start le observing", __func__); return BTM_ERR_PROCESSING; } btm_cb.ble_ctr_cb.scan_activity |= BTM_LE_OBSERVE_ACTIVE; } else { if (!(btm_cb.ble_ctr_cb.scan_activity & BTM_LE_OBSERVE_ACTIVE)) { LOG_WARN(LOG_TAG, "%s Observing already inactive", __func__); } btm_cb.ble_ctr_cb.scan_activity &= ~BTM_LE_OBSERVE_ACTIVE; if (!shim_btm.StopObserving()) { LOG_WARN(LOG_TAG, "%s Unable to stop le observing", __func__); return BTM_ERR_PROCESSING; } if (btm_cb.ble_ctr_cb.p_obs_cmpl_cb) { (btm_cb.ble_ctr_cb.p_obs_cmpl_cb)(&btm_cb.btm_inq_vars.inq_cmpl_info); } btm_cb.ble_ctr_cb.p_obs_results_cb = nullptr; btm_cb.ble_ctr_cb.p_obs_cmpl_cb = nullptr; } return BTM_CMD_STARTED; } tBTM_STATUS bluetooth::shim::BTM_SetPageScanType(uint16_t scan_type) { switch (scan_type) { case kInterlacedScanType: Loading Loading @@ -217,10 +271,10 @@ tBTM_STATUS bluetooth::shim::BTM_SetConnectability(uint16_t page_mode, switch (le_connectible_mode) { case kConnectibleModeOff: shim_btm.SetLeConnectibleOff(); shim_btm.StopConnectability(); break; case kConnectibleModeOn: shim_btm.SetLeConnectibleOn(); shim_btm.StartConnectability(); break; default: return BTM_ILLEGAL_VALUE; Loading Loading @@ -658,6 +712,5 @@ void bluetooth::shim::BTM_BleEnableDisableFilterFeature( } uint8_t bluetooth::shim::BTM_BleMaxMultiAdvInstanceCount() { // TODO(cmanton) Connect this to the gd side return 5; return shim_btm.GetNumberOfAdvertisingInstances(); } system/main/shim/controller.cc +1 −2 Original line number Diff line number Diff line Loading @@ -250,8 +250,7 @@ static uint16_t get_ble_maxium_advertising_data_length(void) { } static uint8_t get_ble_number_of_supported_advertising_sets(void) { LOG_WARN(LOG_TAG, "%s TODO Unimplemented", __func__); return 0; return GetController()->GetControllerLeNumberOfSupportedAdverisingSets(); } static uint16_t get_acl_buffer_count_classic(void) { Loading system/main/shim/entry.cc +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ future_t* bluetooth::shim::StopGabeldorscheStack() { return (future_t*)nullptr; } bluetooth::shim::IAdvertising* bluetooth::shim::GetAdvertising() { return GetGabeldorscheStack()->GetAdvertising(); } bluetooth::shim::IController* bluetooth::shim::GetController() { return GetGabeldorscheStack()->GetController(); } Loading Loading @@ -61,3 +65,7 @@ bluetooth::shim::IName* bluetooth::shim::GetName() { bluetooth::shim::IPage* bluetooth::shim::GetPage() { return GetGabeldorscheStack()->GetPage(); } bluetooth::shim::IScanning* bluetooth::shim::GetScanning() { return GetGabeldorscheStack()->GetScanning(); } Loading
system/main/shim/btm.cc +100 −1 Original line number Diff line number Diff line Loading @@ -19,12 +19,14 @@ #include <algorithm> #include <cstring> #include "stack/btm/btm_int_types.h" #include "main/shim/btm.h" #include "main/shim/entry.h" #include "main/shim/shim.h" #include "osi/include/log.h" bluetooth::shim::Btm::Btm() {} extern tBTM_CB btm_cb; static constexpr size_t kMaxInquiryResultSize = 4096; static uint8_t inquiry_result_buf[kMaxInquiryResultSize]; Loading @@ -37,12 +39,30 @@ static constexpr uint8_t kExtendedInquiryResultMode = 2; static constexpr size_t kRemoteDeviceNameLength = 248; static constexpr uint8_t kAdvDataInfoNotPresent = 0xff; static constexpr uint8_t kTxPowerInformationNotPresent = 0x7f; static constexpr uint8_t kNotPeriodicAdvertisement = 0x00; static constexpr bool kActiveScanning = true; static constexpr bool kPassiveScanning = true; extern void btm_process_cancel_complete(uint8_t status, uint8_t mode); extern void btm_process_inq_complete(uint8_t status, uint8_t result_type); extern void btm_process_inq_results(uint8_t* p, uint8_t result_mode); extern void btm_ble_process_adv_addr(RawAddress& raw_address, uint8_t* address_type); extern void btm_ble_process_adv_pkt_cont( uint16_t event_type, uint8_t address_type, const RawAddress& raw_address, uint8_t primary_phy, uint8_t secondary_phy, uint8_t advertising_sid, int8_t tx_power, int8_t rssi, uint16_t periodic_adv_int, uint8_t data_len, uint8_t* data); using BtmRemoteDeviceName = tBTM_REMOTE_DEV_NAME; bluetooth::shim::Btm::Btm() {} bluetooth::shim::Btm::~Btm() {} /** * */ Loading Loading @@ -430,3 +450,82 @@ bluetooth::shim::Btm::CancelAllReadRemoteDeviceName() { __func__); return bluetooth::shim::BTM_WRONG_MODE; } void bluetooth::shim::Btm::StartAdvertising() { bluetooth::shim::GetAdvertising()->StartAdvertising(); } void bluetooth::shim::Btm::StopAdvertising() { bluetooth::shim::GetAdvertising()->StopAdvertising(); } void bluetooth::shim::Btm::StartConnectability() { bluetooth::shim::GetAdvertising()->StartAdvertising(); } void bluetooth::shim::Btm::StopConnectability() { bluetooth::shim::GetAdvertising()->StopAdvertising(); } bool bluetooth::shim::Btm::StartActiveScanning() { StartScanning(kActiveScanning); return true; } bool bluetooth::shim::Btm::StopActiveScanning() { bluetooth::shim::GetScanning()->StopScanning(); return true; } bool bluetooth::shim::Btm::StartObserving() { StartScanning(kPassiveScanning); return true; } bool bluetooth::shim::Btm::StopObserving() { bluetooth::shim::GetScanning()->StopScanning(); return true; } void bluetooth::shim::Btm::StartScanning(bool use_active_scanning) { bluetooth::shim::GetScanning()->StartScanning( use_active_scanning, [](AdvertisingReport report) { LOG_INFO(LOG_TAG, "%s Received advertising report from device:%s", __func__, report.string_address.c_str()); RawAddress raw_address; RawAddress::FromString(report.string_address, raw_address); btm_ble_process_adv_addr(raw_address, &report.address_type); btm_ble_process_adv_pkt_cont( report.extended_event_type, report.address_type, raw_address, kPhyConnectionLe1M, kPhyConnectionNone, kAdvDataInfoNotPresent, kTxPowerInformationNotPresent, report.rssi, kNotPeriodicAdvertisement, report.len, report.data); }, [](DirectedAdvertisingReport report) { LOG_WARN(LOG_TAG, "%s Directed advertising is unsupported from device:%s", __func__, report.string_address.c_str()); }, [](ExtendedAdvertisingReport report) { LOG_INFO(LOG_TAG, "%s Received extended advertising report from device:%s", __func__, report.string_address.c_str()); RawAddress raw_address; RawAddress::FromString(report.string_address, raw_address); if (report.address_type != BLE_ADDR_ANONYMOUS) { btm_ble_process_adv_addr(raw_address, &report.address_type); } btm_ble_process_adv_pkt_cont( report.extended_event_type, report.address_type, raw_address, kPhyConnectionLe1M, kPhyConnectionNone, kAdvDataInfoNotPresent, kTxPowerInformationNotPresent, report.rssi, kNotPeriodicAdvertisement, report.len, report.data); }, []() { LOG_INFO(LOG_TAG, "%s Scanning timeout", __func__); }); } size_t bluetooth::shim::Btm::GetNumberOfAdvertisingInstances() const { return bluetooth::shim::GetAdvertising()->GetNumberOfAdvertisingInstances(); }
system/main/shim/btm.h +20 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,11 @@ static constexpr int kClearInquiryFilter = 0; static constexpr int kFilterOnDeviceClass = 1; static constexpr int kFilterOnAddress = 2; static constexpr uint8_t kPhyConnectionNone = 0x00; static constexpr uint8_t kPhyConnectionLe1M = 0x01; static constexpr uint8_t kPhyConnectionLe2M = 0x02; static constexpr uint8_t kPhyConnectionLeCoded = 0x03; using DiscoverabilityState = struct { int mode; uint16_t interval; Loading Loading @@ -122,6 +127,7 @@ class ReadRemoteName { class Btm { public: Btm(); ~Btm(); // Callbacks void OnInquiryResult(std::vector<const uint8_t> result); Loading Loading @@ -186,12 +192,26 @@ class Btm { tBTM_CMPL_CB* callback); BtmStatus CancelAllReadRemoteDeviceName(); void StartAdvertising(); void StopAdvertising(); void StartConnectability(); void StopConnectability(); bool StartActiveScanning(); bool StopActiveScanning(); bool StartObserving(); bool StopObserving(); size_t GetNumberOfAdvertisingInstances() const; private: ReadRemoteName le_read_remote_name_; ReadRemoteName classic_read_remote_name_; // TODO(cmanton) abort if there is no classic acl link up bool CheckClassicAclLink(const RawAddress& raw_address) { return true; } bool CheckLeAclLink(const RawAddress& raw_address) { return true; } void StartScanning(bool use_active_scanning); }; } // namespace shim Loading
system/main/shim/btm_api.cc +66 −13 Original line number Diff line number Diff line Loading @@ -31,6 +31,9 @@ static bluetooth::shim::Btm shim_btm; extern tBTM_CB btm_cb; extern void btm_acl_update_busy_level(tBTM_BLI_EVENT event); extern void btm_clear_all_pending_le_entry(void); extern void btm_clr_inq_result_flt(void); extern void btm_sort_inq_result(void); tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, tBTM_INQ_RESULTS_CB* p_results_cb, Loading @@ -39,13 +42,15 @@ tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, CHECK(p_results_cb != nullptr); CHECK(p_cmpl_cb != nullptr); uint8_t classic_mode = p_inqparms->mode & 0x0f; // TODO(cmanton) Setup the LE portion too uint8_t le_mode = p_inqparms->mode >> 4; btm_cb.btm_inq_vars.inq_cmpl_info.num_resp = 0; /* Clear the results counter */ LOG_INFO(LOG_TAG, "%s Start inquiry mode classic:%hhd le:%hhd", __func__, classic_mode, le_mode); uint8_t classic_mode = p_inqparms->mode & 0x0f; if (!shim_btm.StartActiveScanning()) { LOG_WARN(LOG_TAG, "%s Unable to start le active scanning", __func__); return BTM_ERR_PROCESSING; } if (!shim_btm.SetInquiryFilter(classic_mode, p_inqparms->filter_cond_type, p_inqparms->filter_cond)) { LOG_WARN(LOG_TAG, "%s Unable to set inquiry filter", __func__); Loading @@ -57,6 +62,14 @@ tBTM_STATUS bluetooth::shim::BTM_StartInquiry(tBTM_INQ_PARMS* p_inqparms, LOG_WARN(LOG_TAG, "%s Unable to start inquiry", __func__); return BTM_ERR_PROCESSING; } btm_cb.btm_inq_vars.state = BTM_INQ_ACTIVE_STATE; btm_cb.btm_inq_vars.p_inq_cmpl_cb = p_cmpl_cb; btm_cb.btm_inq_vars.p_inq_results_cb = p_results_cb; btm_cb.btm_inq_vars.inq_active = p_inqparms->mode; btm_acl_update_busy_level(BTM_BLI_INQ_EVT); return BTM_CMD_STARTED; } Loading Loading @@ -109,14 +122,15 @@ tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode, switch (le_discoverable_mode) { case kDiscoverableModeOff: shim_btm.SetLeDiscoverabilityOff(); shim_btm.StopAdvertising(); break; case kLimitedDiscoverableMode: shim_btm.SetLeLimitedDiscoverability(); break; case kGeneralDiscoverableMode: shim_btm.SetLeGeneralDiscoverability(); shim_btm.StartAdvertising(); break; default: LOG_WARN(LOG_TAG, "%s Unexpected le discoverability mode:%d", __func__, le_discoverable_mode); } switch (classic_discoverable_mode) { Loading @@ -129,6 +143,9 @@ tBTM_STATUS bluetooth::shim::BTM_SetDiscoverability(uint16_t discoverable_mode, case kGeneralDiscoverableMode: shim_btm.SetClassicGeneralDiscoverability(window, interval); break; default: LOG_WARN(LOG_TAG, "%s Unexpected classic discoverability mode:%d", __func__, classic_discoverable_mode); } return BTM_SUCCESS; } Loading @@ -149,6 +166,43 @@ tBTM_STATUS bluetooth::shim::BTM_SetInquiryScanType(uint16_t scan_type) { return BTM_WRONG_MODE; } tBTM_STATUS bluetooth::shim::BTM_BleObserve(bool start, uint8_t duration_sec, tBTM_INQ_RESULTS_CB* p_results_cb, tBTM_CMPL_CB* p_cmpl_cb) { if (start) { CHECK(p_results_cb != nullptr); CHECK(p_cmpl_cb != nullptr); if (btm_cb.ble_ctr_cb.scan_activity & BTM_LE_OBSERVE_ACTIVE) { LOG_WARN(LOG_TAG, "%s Observing already active", __func__); return BTM_WRONG_MODE; } btm_cb.ble_ctr_cb.p_obs_results_cb = p_results_cb; btm_cb.ble_ctr_cb.p_obs_cmpl_cb = p_cmpl_cb; if (!shim_btm.StartObserving()) { LOG_WARN(LOG_TAG, "%s Unable to start le observing", __func__); return BTM_ERR_PROCESSING; } btm_cb.ble_ctr_cb.scan_activity |= BTM_LE_OBSERVE_ACTIVE; } else { if (!(btm_cb.ble_ctr_cb.scan_activity & BTM_LE_OBSERVE_ACTIVE)) { LOG_WARN(LOG_TAG, "%s Observing already inactive", __func__); } btm_cb.ble_ctr_cb.scan_activity &= ~BTM_LE_OBSERVE_ACTIVE; if (!shim_btm.StopObserving()) { LOG_WARN(LOG_TAG, "%s Unable to stop le observing", __func__); return BTM_ERR_PROCESSING; } if (btm_cb.ble_ctr_cb.p_obs_cmpl_cb) { (btm_cb.ble_ctr_cb.p_obs_cmpl_cb)(&btm_cb.btm_inq_vars.inq_cmpl_info); } btm_cb.ble_ctr_cb.p_obs_results_cb = nullptr; btm_cb.ble_ctr_cb.p_obs_cmpl_cb = nullptr; } return BTM_CMD_STARTED; } tBTM_STATUS bluetooth::shim::BTM_SetPageScanType(uint16_t scan_type) { switch (scan_type) { case kInterlacedScanType: Loading Loading @@ -217,10 +271,10 @@ tBTM_STATUS bluetooth::shim::BTM_SetConnectability(uint16_t page_mode, switch (le_connectible_mode) { case kConnectibleModeOff: shim_btm.SetLeConnectibleOff(); shim_btm.StopConnectability(); break; case kConnectibleModeOn: shim_btm.SetLeConnectibleOn(); shim_btm.StartConnectability(); break; default: return BTM_ILLEGAL_VALUE; Loading Loading @@ -658,6 +712,5 @@ void bluetooth::shim::BTM_BleEnableDisableFilterFeature( } uint8_t bluetooth::shim::BTM_BleMaxMultiAdvInstanceCount() { // TODO(cmanton) Connect this to the gd side return 5; return shim_btm.GetNumberOfAdvertisingInstances(); }
system/main/shim/controller.cc +1 −2 Original line number Diff line number Diff line Loading @@ -250,8 +250,7 @@ static uint16_t get_ble_maxium_advertising_data_length(void) { } static uint8_t get_ble_number_of_supported_advertising_sets(void) { LOG_WARN(LOG_TAG, "%s TODO Unimplemented", __func__); return 0; return GetController()->GetControllerLeNumberOfSupportedAdverisingSets(); } static uint16_t get_acl_buffer_count_classic(void) { Loading
system/main/shim/entry.cc +8 −0 Original line number Diff line number Diff line Loading @@ -30,6 +30,10 @@ future_t* bluetooth::shim::StopGabeldorscheStack() { return (future_t*)nullptr; } bluetooth::shim::IAdvertising* bluetooth::shim::GetAdvertising() { return GetGabeldorscheStack()->GetAdvertising(); } bluetooth::shim::IController* bluetooth::shim::GetController() { return GetGabeldorscheStack()->GetController(); } Loading Loading @@ -61,3 +65,7 @@ bluetooth::shim::IName* bluetooth::shim::GetName() { bluetooth::shim::IPage* bluetooth::shim::GetPage() { return GetGabeldorscheStack()->GetPage(); } bluetooth::shim::IScanning* bluetooth::shim::GetScanning() { return GetGabeldorscheStack()->GetScanning(); }