mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-01-01 00:28:18 +00:00
hci: fix restart connect with whitelist after whitelist modification
This commit is contained in:
parent
8d446e2b8d
commit
cd7411deb4
@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
||||
|
||||
### Fixed
|
||||
- HCI: fix remove le device from whitelist
|
||||
- HCI: fix restart connect with whitelist after whitelist modification
|
||||
- L2CAP: make l2cap_get_remote_mtu_for_local_cid available to LE-only builds
|
||||
- HFP: use 'don't care' to accept SCO connections, fixes issue on ESP32
|
||||
- HFP: fix LC3-WB init
|
||||
|
@ -3290,7 +3290,6 @@ static void event_handle_le_connection_complete(const uint8_t * packet){
|
||||
if (status == ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER){
|
||||
// reset state
|
||||
hci_stack->le_connecting_state = LE_CONNECTING_IDLE;
|
||||
hci_stack->le_connecting_request = LE_CONNECTING_IDLE;
|
||||
// get outgoing connection conn struct for direct connect
|
||||
conn = gap_get_outgoing_connection();
|
||||
}
|
||||
|
53
test/gap/gap_whitelist.c
Normal file
53
test/gap/gap_whitelist.c
Normal file
@ -0,0 +1,53 @@
|
||||
#define BTSTACK_FILE__ "gatt_whitelist.c"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include "btstack.h"
|
||||
|
||||
#define HEARTBEAT_PERIOD_MS 2000
|
||||
|
||||
static btstack_timer_source_t heartbeat;
|
||||
static btstack_packet_callback_registration_t hci_event_callback_registration;
|
||||
static bd_addr_t addr;
|
||||
|
||||
static void heartbeat_handler(struct btstack_timer_source *ts){
|
||||
addr[5]++;
|
||||
addr[4]++;
|
||||
gap_whitelist_add(BD_ADDR_TYPE_LE_PUBLIC, addr);
|
||||
printf("Add %s to Whitelist\n", bd_addr_to_str(addr));
|
||||
|
||||
btstack_run_loop_set_timer(ts, HEARTBEAT_PERIOD_MS);
|
||||
btstack_run_loop_add_timer(ts);
|
||||
}
|
||||
|
||||
static void packet_handler (uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size){
|
||||
UNUSED(channel);
|
||||
UNUSED(size);
|
||||
if (packet_type != HCI_EVENT_PACKET) return;
|
||||
switch (hci_event_packet_get_type(packet)) {
|
||||
case BTSTACK_EVENT_STATE:
|
||||
if (btstack_event_state_get_state(packet) != HCI_STATE_WORKING) return;
|
||||
// started
|
||||
printf("GAP Connect with Whitelist\n");
|
||||
gap_connect_with_whitelist();
|
||||
// set one-shot timer
|
||||
heartbeat.process = &heartbeat_handler;
|
||||
btstack_run_loop_set_timer(&heartbeat, HEARTBEAT_PERIOD_MS);
|
||||
btstack_run_loop_add_timer(&heartbeat);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int btstack_main(void);
|
||||
int btstack_main(void)
|
||||
{
|
||||
// register for HCI events
|
||||
hci_event_callback_registration.callback = &packet_handler;
|
||||
hci_add_event_handler(&hci_event_callback_registration);
|
||||
|
||||
hci_power_control(HCI_POWER_ON);
|
||||
return 0;
|
||||
}
|
||||
/* EXAMPLE_END */
|
Loading…
Reference in New Issue
Block a user