Hi Jacob
I haven't played around with LE TX Power. Some Controllers have custom commands for this and it's also not clear what a Controller can support. Which Controller are you working with?
Anyway, I think there a no general 'set tx power' HCI commands, but there's the advertising_tx_power in the HCI_LE_Set_Extended_Advertising_Parameters
If your Controller supports this and if you have enabled support for extended advertising ENABLE_LE_EXTENDED_ADVERTISING,
you can send legacy advertisings with the additional features from the extended.
Here's an example using extended advertising
static const uint8_t adv_sid = 0;
static le_advertising_set_t le_advertising_set;
static uint8_t adv_handle = 0;
static const le_extended_advertising_parameters_t extended_params = {
.advertising_event_properties = 1, // connectable
.primary_advertising_interval_min = 0x4b0, // 750 ms
.primary_advertising_interval_max = 0x4b0, // 750 ms
.primary_advertising_channel_map = 7,
.own_address_type = 0,
.peer_address_type = 0,
.peer_address = { 0 },
.advertising_filter_policy = 0,
.advertising_tx_power = 10, // 10 dBm
.primary_advertising_phy = 1, // LE 1M PHY
.secondary_advertising_max_skip = 0,
.secondary_advertising_phy = 1, // LE 1M PHY
.advertising_sid = adv_sid,
.scan_request_notification_enable = 0,
};
static void setup_advertising() {
gap_extended_advertising_setup(&le_advertising_set, &extended_params, &adv_handle);
gap_extended_advertising_set_adv_data(adv_handle, sizeof(extended_adv_data), extended_adv_data);
gap_extended_advertising_start(adv_handle, 0, 0);
}
Please enable and check the HCI packet log to see if it workied.
Cheers
Matthias
> On 23 May 2023, at 21:09, J Ch <
jacob.ch...@gmail.com> wrote:
>
> Hello. Is there an API function that allows me to set BLE TX power above the nominal rate? I see that there is something buried deep in hci.c for extended advertisements, but I don't know how to use it, and I don't know if I can use it for legacy (non-extended) advertisements. Thank you.
>
> --
> You received this message because you are subscribed to the Google Groups "btstack-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
btstack-dev...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/btstack-dev/4d4d404c-3936-4135-8c46-96d5d1a547b7n%40googlegroups.com.