hci: introduce LE_EXTENDED_ADVERTISING_LEGACY_HANDLE

This commit is contained in:
Matthias Ringwald 2024-09-11 09:01:16 +02:00
parent 6897da5c53
commit 2d0c79651a
2 changed files with 4 additions and 3 deletions

View File

@ -409,6 +409,7 @@ typedef enum {
#define LE_ADVERTISING_DATA_SIZE 31 #define LE_ADVERTISING_DATA_SIZE 31
#define LE_EXTENDED_ADVERTISING_DATA_SIZE 229 #define LE_EXTENDED_ADVERTISING_DATA_SIZE 229
#define LE_EXTENDED_ADVERTISING_LEGACY_HANDLE 0
#define LE_EXTENDED_ADVERTISING_MAX_HANDLE 0xEFu #define LE_EXTENDED_ADVERTISING_MAX_HANDLE 0xEFu
#define LE_EXTENDED_ADVERTISING_MAX_CHUNK_LEN 251 #define LE_EXTENDED_ADVERTISING_MAX_CHUNK_LEN 251

View File

@ -4415,7 +4415,7 @@ static void event_handler(uint8_t *packet, uint16_t size){
} }
} }
// support legacy advertisements // support legacy advertisements
if (advertising_handle == 0){ if (advertising_handle == LE_EXTENDED_ADVERTISING_LEGACY_HANDLE){
hci_stack->le_advertisements_state &= ~LE_ADVERTISEMENT_STATE_ACTIVE; hci_stack->le_advertisements_state &= ~LE_ADVERTISEMENT_STATE_ACTIVE;
hci_update_advertisements_enabled_for_current_roles(); hci_update_advertisements_enabled_for_current_roles();
} }
@ -8812,9 +8812,9 @@ uint8_t gap_extended_advertising_set_resolvable_private_address_update(uint16_t
} }
uint8_t gap_extended_advertising_setup(le_advertising_set_t * storage, const le_extended_advertising_parameters_t * advertising_parameters, uint8_t * out_advertising_handle){ uint8_t gap_extended_advertising_setup(le_advertising_set_t * storage, const le_extended_advertising_parameters_t * advertising_parameters, uint8_t * out_advertising_handle){
// find free advertisement handle // find free advertisement handle. we use LE_EXTENDED_ADVERTISING_LEGACY_HANDLE for non-extended advertising
uint8_t advertisement_handle; uint8_t advertisement_handle;
for (advertisement_handle = 1; advertisement_handle <= LE_EXTENDED_ADVERTISING_MAX_HANDLE; advertisement_handle++){ for (advertisement_handle = LE_EXTENDED_ADVERTISING_LEGACY_HANDLE + 1; advertisement_handle <= LE_EXTENDED_ADVERTISING_MAX_HANDLE; advertisement_handle++){
if (hci_advertising_set_for_handle(advertisement_handle) == NULL) break; if (hci_advertising_set_for_handle(advertisement_handle) == NULL) break;
} }
if (advertisement_handle > LE_EXTENDED_ADVERTISING_MAX_HANDLE) return ERROR_CODE_MEMORY_CAPACITY_EXCEEDED; if (advertisement_handle > LE_EXTENDED_ADVERTISING_MAX_HANDLE) return ERROR_CODE_MEMORY_CAPACITY_EXCEEDED;