gap: replace BTSTACK_EVENT_DISCOVERABLE_ENABLED with BTSTACK_EVENT_SCAN_MODE_CHANGED

This commit is contained in:
Matthias Ringwald 2022-06-17 18:23:43 +02:00
parent 2b6431f1ad
commit 71fd255d61
4 changed files with 13 additions and 11 deletions

View File

@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
### Changed
- HCI Dump: provide log level to log_message implementation
- GAP: replace BTSTACK_EVENT_DISCOVERABLE_ENABLED with BTSTACK_EVENT_SCAN_MODE_CHANGED
## Release v1.5.3

View File

@ -1004,8 +1004,9 @@ typedef uint8_t sm_key_t[16];
/**
* @format 1
* @param discoverable
* @param connectable
*/
#define BTSTACK_EVENT_DISCOVERABLE_ENABLED 0x66u
#define BTSTACK_EVENT_SCAN_MODE_CHANGED 0x66u
// Daemon Events

View File

@ -1459,12 +1459,12 @@ static inline uint8_t btstack_event_nr_connections_changed_get_number_connection
/**
* @brief Get field discoverable from event BTSTACK_EVENT_DISCOVERABLE_ENABLED
* @brief Get field discoverable from event BTSTACK_EVENT_SCAN_MODE_CHANGED
* @param event packet
* @return discoverable
* @note: btstack_type 1
*/
static inline uint8_t btstack_event_discoverable_enabled_get_discoverable(const uint8_t * event){
static inline uint8_t btstack_event_scan_mode_changed_get_discoverable(const uint8_t * event){
return event[2];
}

View File

@ -174,7 +174,7 @@ enum {
// prototypes
#ifdef ENABLE_CLASSIC
static void hci_update_scan_enable(void);
static void hci_emit_discoverable_enabled(uint8_t enabled);
static void hci_emit_scan_mode_changed(uint8_t discoverable, uint8_t connectable);
static int hci_local_ssp_activated(void);
static bool hci_remote_ssp_supported(hci_con_handle_t con_handle);
static bool hci_ssp_supported(hci_connection_t * connection);
@ -2617,7 +2617,7 @@ static void handle_command_complete_event(uint8_t * packet, uint16_t size){
break;
#ifdef ENABLE_CLASSIC
case HCI_OPCODE_HCI_WRITE_SCAN_ENABLE:
hci_emit_discoverable_enabled(hci_stack->discoverable);
hci_emit_scan_mode_changed(hci_stack->discoverable, hci_stack->connectable);
break;
case HCI_OPCODE_HCI_PERIODIC_INQUIRY_MODE:
status = hci_event_command_complete_get_return_parameters(packet)[0];
@ -4772,7 +4772,7 @@ void gap_discoverable_control(uint8_t enable){
if (enable) enable = 1; // normalize argument
if (hci_stack->discoverable == enable){
hci_emit_discoverable_enabled(hci_stack->discoverable);
hci_emit_scan_mode_changed(hci_stack->discoverable, hci_stack->connectable);
return;
}
@ -6788,12 +6788,12 @@ static gap_security_level_t gap_security_level_for_connection(hci_connection_t *
return security_level;
}
static void hci_emit_discoverable_enabled(uint8_t enabled){
log_info("BTSTACK_EVENT_DISCOVERABLE_ENABLED %u", enabled);
uint8_t event[3];
event[0] = BTSTACK_EVENT_DISCOVERABLE_ENABLED;
static void hci_emit_scan_mode_changed(uint8_t discoverable, uint8_t connectable){
uint8_t event[4];
event[0] = BTSTACK_EVENT_SCAN_MODE_CHANGED;
event[1] = sizeof(event) - 2;
event[2] = enabled;
event[2] = discoverable;
event[3] = connectable;
hci_emit_event(event, sizeof(event), 1);
}