const ModuleFactory LeAdvertisingManager::Factory = ModuleFactory([]() { return new LeAdvertisingManager(); });
enum class AdvertisingApiType {
- LE_4_0 = 1,
+ LEGACY = 1,
ANDROID_HCI = 2,
- LE_5_0 = 3,
+ EXTENDED = 3,
};
struct Advertiser {
}
if (controller_->IsSupported(hci::OpCode::LE_SET_EXTENDED_ADVERTISING_PARAMETERS)) {
- advertising_api_type_ = AdvertisingApiType::LE_5_0;
+ advertising_api_type_ = AdvertisingApiType::EXTENDED;
} else if (controller_->IsSupported(hci::OpCode::LE_MULTI_ADVT)) {
advertising_api_type_ = AdvertisingApiType::ANDROID_HCI;
} else {
- advertising_api_type_ = AdvertisingApiType::LE_4_0;
+ advertising_api_type_ = AdvertisingApiType::LEGACY;
}
}
address_manager_registered = false;
paused = false;
}
- if (advertising_api_type_ == AdvertisingApiType::LE_5_0) {
+ if (advertising_api_type_ == AdvertisingApiType::EXTENDED) {
le_advertising_interface_->EnqueueCommand(
hci::LeRemoveAdvertisingSetBuilder::Create(advertiser_id),
module_handler_->BindOnce(impl::check_status<LeRemoveAdvertisingSetCompleteView>));
}
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0): {
+ case (AdvertisingApiType::LEGACY): {
le_advertising_interface_->EnqueueCommand(
hci::LeSetAdvertisingParametersBuilder::Create(
config.interval_min,
curr_set.advertising_handle_ = id;
enabled_sets_[id] = curr_set;
} break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
ExtendedAdvertisingConfig new_config = config;
new_config.legacy_pdus = true;
os::Handler* handler) {
id_map_[id] = reg_id;
- if (advertising_api_type_ != AdvertisingApiType::LE_5_0) {
+ if (advertising_api_type_ != AdvertisingApiType::EXTENDED) {
create_advertiser(id, config, scan_callback, set_terminated_callback, handler);
return;
}
// then the Controller will return the error code Command Disallowed (0x0C).
// Thus, we should disable it before removing it.
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0):
+ case (AdvertisingApiType::LEGACY):
le_advertising_interface_->EnqueueCommand(
hci::LeSetAdvertisingEnableBuilder::Create(Enable::DISABLED),
module_handler_->BindOnce(impl::check_status<LeSetAdvertisingEnableCompleteView>));
hci::LeMultiAdvtSetEnableBuilder::Create(Enable::DISABLED, advertiser_id),
module_handler_->BindOnce(impl::check_status<LeMultiAdvtCompleteView>));
break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
le_advertising_interface_->EnqueueCommand(
hci::LeSetExtendedAdvertisingEnableBuilder::Create(Enable::DISABLED, enabled_vector),
module_handler_->BindOnce(impl::check_status<LeSetExtendedAdvertisingEnableCompleteView>));
void set_parameters(AdvertiserId advertiser_id, ExtendedAdvertisingConfig config) {
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0): {
+ case (AdvertisingApiType::LEGACY): {
// TODO
} break;
case (AdvertisingApiType::ANDROID_HCI): {
// TODO
} break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
// sid must be in range 0x00 to 0x0F. Since no controller supports more than
// 16 advertisers, it's safe to make sid equal to id.
config.sid = advertiser_id % kAdvertisingSetIdMask;
void set_data(AdvertiserId advertiser_id, bool set_scan_rsp, std::vector<GapData> data) {
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0): {
+ case (AdvertisingApiType::LEGACY): {
// TODO
} break;
case (AdvertisingApiType::ANDROID_HCI): {
// TODO
} break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
// TODO(b/149221472): Support fragmentation
auto operation = Operation::COMPLETE_ADVERTISEMENT;
auto fragment_preference = FragmentPreference::CONTROLLER_SHOULD_NOT;
Enable enable_value = enable ? Enable::ENABLED : Enable::DISABLED;
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0): {
+ case (AdvertisingApiType::LEGACY): {
// TODO
} break;
case (AdvertisingApiType::ANDROID_HCI): {
// TODO
} break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
le_advertising_interface_->EnqueueCommand(
hci::LeSetExtendedAdvertisingEnableBuilder::Create(enable_value, enabled_sets),
module_handler_->BindOnceOn(
}
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0): {
+ case (AdvertisingApiType::LEGACY): {
le_advertising_interface_->EnqueueCommand(
hci::LeSetAdvertisingEnableBuilder::Create(Enable::DISABLED),
module_handler_->BindOnceOn(
}
}
} break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
if (enabled_sets.size() != 0) {
le_advertising_interface_->EnqueueCommand(
hci::LeSetExtendedAdvertisingEnableBuilder::Create(Enable::DISABLED, enabled_sets),
}
switch (advertising_api_type_) {
- case (AdvertisingApiType::LE_4_0): {
+ case (AdvertisingApiType::LEGACY): {
le_advertising_interface_->EnqueueCommand(
hci::LeSetAdvertisingEnableBuilder::Create(Enable::ENABLED),
module_handler_->BindOnceOn(
}
}
} break;
- case (AdvertisingApiType::LE_5_0): {
+ case (AdvertisingApiType::EXTENDED): {
if (enabled_sets.size() != 0) {
le_advertising_interface_->EnqueueCommand(
hci::LeSetExtendedAdvertisingEnableBuilder::Create(Enable::ENABLED, enabled_sets),
const ModuleFactory LeScanningManager::Factory = ModuleFactory([]() { return new LeScanningManager(); });
enum class ScanApiType {
- LE_4_0 = 1,
+ LEGACY = 1,
ANDROID_HCI = 2,
- LE_5_0 = 3,
+ EXTENDED = 3,
};
struct LeScanningManager::impl : public bluetooth::hci::LeAddressManagerCallback {
le_scanning_interface_ = hci_layer_->GetLeScanningInterface(
module_handler_->BindOn(this, &LeScanningManager::impl::handle_scan_results));
if (controller_->IsSupported(OpCode::LE_SET_EXTENDED_SCAN_PARAMETERS)) {
- api_type_ = ScanApiType::LE_5_0;
+ api_type_ = ScanApiType::EXTENDED;
} else if (controller_->IsSupported(OpCode::LE_EXTENDED_SCAN_PARAMS)) {
api_type_ = ScanApiType::ANDROID_HCI;
} else {
- api_type_ = ScanApiType::LE_4_0;
+ api_type_ = ScanApiType::LEGACY;
}
configure_scan();
}
uint8_t phys_in_use = 1;
switch (api_type_) {
- case ScanApiType::LE_5_0:
+ case ScanApiType::EXTENDED:
le_scanning_interface_->EnqueueCommand(hci::LeSetExtendedScanParametersBuilder::Create(
own_address_type_, filter_policy_, phys_in_use, parameter_vector),
module_handler_->BindOnce(impl::check_status));
module_handler_->BindOnce(impl::check_status));
break;
- case ScanApiType::LE_4_0:
+ case ScanApiType::LEGACY:
le_scanning_interface_->EnqueueCommand(
hci::LeSetScanParametersBuilder::Create(LeScanType::ACTIVE, interval_ms_, window_ms_, own_address_type_,
filter_policy_),
}
switch (api_type_) {
- case ScanApiType::LE_5_0:
+ case ScanApiType::EXTENDED:
le_scanning_interface_->EnqueueCommand(
hci::LeSetExtendedScanEnableBuilder::Create(Enable::ENABLED,
FilterDuplicates::DISABLED /* filter duplicates */, 0, 0),
module_handler_->BindOnce(impl::check_status));
break;
case ScanApiType::ANDROID_HCI:
- case ScanApiType::LE_4_0:
+ case ScanApiType::LEGACY:
le_scanning_interface_->EnqueueCommand(
hci::LeSetScanEnableBuilder::Create(Enable::ENABLED, Enable::DISABLED /* filter duplicates */),
module_handler_->BindOnce(impl::check_status));
}
registered_callback_->Handler()->Post(std::move(on_stopped));
switch (api_type_) {
- case ScanApiType::LE_5_0:
+ case ScanApiType::EXTENDED:
le_scanning_interface_->EnqueueCommand(
hci::LeSetExtendedScanEnableBuilder::Create(Enable::DISABLED,
FilterDuplicates::DISABLED /* filter duplicates */, 0, 0),
registered_callback_ = nullptr;
break;
case ScanApiType::ANDROID_HCI:
- case ScanApiType::LE_4_0:
+ case ScanApiType::LEGACY:
le_scanning_interface_->EnqueueCommand(
hci::LeSetScanEnableBuilder::Create(Enable::DISABLED, Enable::DISABLED /* filter duplicates */),
module_handler_->BindOnce(impl::check_status));