mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-04-16 08:42:28 +00:00
hci/gap: save the le connection interval on connection complete and connection update
This commit is contained in:
parent
900fc9c688
commit
c9db5c2133
@ -396,6 +396,12 @@ int gap_auto_connection_stop(bd_addr_type_t address_typ, bd_addr_t address);
|
|||||||
*/
|
*/
|
||||||
void gap_auto_connection_stop_all(void);
|
void gap_auto_connection_stop_all(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Get connection interval
|
||||||
|
* @return connection interval, otherwise 0 if error
|
||||||
|
*/
|
||||||
|
uint16_t gap_le_connection_interval(hci_con_handle_t connection_handle);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @brief Get encryption key size.
|
* @brief Get encryption key size.
|
||||||
|
17
src/hci.c
17
src/hci.c
@ -2384,7 +2384,8 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
|
|
||||||
conn->state = OPEN;
|
conn->state = OPEN;
|
||||||
conn->role = packet[6];
|
conn->role = packet[6];
|
||||||
conn->con_handle = little_endian_read_16(packet, 4);
|
conn->con_handle = hci_subevent_le_connection_complete_get_connection_handle(packet);
|
||||||
|
conn->le_connection_interval = hci_subevent_le_connection_complete_get_conn_interval(packet);
|
||||||
|
|
||||||
#ifdef ENABLE_LE_PERIPHERAL
|
#ifdef ENABLE_LE_PERIPHERAL
|
||||||
if (packet[6] == HCI_ROLE_SLAVE){
|
if (packet[6] == HCI_ROLE_SLAVE){
|
||||||
@ -2403,7 +2404,13 @@ static void event_handler(uint8_t *packet, int size){
|
|||||||
hci_emit_nr_connections_changed();
|
hci_emit_nr_connections_changed();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// log_info("LE buffer size: %u, count %u", little_endian_read_16(packet,6), packet[8]);
|
// log_info("LE buffer size: %u, count %u", little_endian_read_16(packet,6), packet[8]);
|
||||||
|
case HCI_SUBEVENT_LE_CONNECTION_UPDATE_COMPLETE:
|
||||||
|
handle = hci_subevent_le_connection_update_complete_get_connection_handle(packet);
|
||||||
|
conn = hci_connection_for_handle(handle);
|
||||||
|
if (!conn) break;
|
||||||
|
conn->le_connection_interval = hci_subevent_le_connection_update_complete_get_conn_interval(packet);
|
||||||
|
break;
|
||||||
|
|
||||||
case HCI_SUBEVENT_LE_REMOTE_CONNECTION_PARAMETER_REQUEST:
|
case HCI_SUBEVENT_LE_REMOTE_CONNECTION_PARAMETER_REQUEST:
|
||||||
// connection
|
// connection
|
||||||
@ -4599,6 +4606,12 @@ void gap_auto_connection_stop_all(void){
|
|||||||
}
|
}
|
||||||
hci_run();
|
hci_run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint16_t gap_le_connection_interval(hci_con_handle_t connection_handle){
|
||||||
|
hci_connection_t * conn = hci_connection_for_handle(connection_handle);
|
||||||
|
if (!conn) return 0;
|
||||||
|
return conn->le_connection_interval;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -526,6 +526,7 @@ typedef struct {
|
|||||||
uint16_t le_supervision_timeout;
|
uint16_t le_supervision_timeout;
|
||||||
|
|
||||||
#ifdef ENABLE_BLE
|
#ifdef ENABLE_BLE
|
||||||
|
uint16_t le_connection_interval;
|
||||||
// LE Security Manager
|
// LE Security Manager
|
||||||
sm_connection_t sm_connection;
|
sm_connection_t sm_connection;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user