From 831711da1fdaafb37a5328ce908657fece01b679 Mon Sep 17 00:00:00 2001 From: Matthias Ringwald Date: Wed, 23 Aug 2017 17:08:09 +0200 Subject: [PATCH] hci: fix gap_set_connection_parameter_range and gap_set_connection_parameters (don't reset values on HCI Reset) --- src/hci.c | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/src/hci.c b/src/hci.c index 870233206..2a9f3246d 100644 --- a/src/hci.c +++ b/src/hci.c @@ -2364,23 +2364,7 @@ static void hci_state_reset(void){ hci_stack->le_connecting_state = LE_CONNECTING_IDLE; hci_stack->le_whitelist = 0; hci_stack->le_whitelist_capacity = 0; - - // connection parameter to use for outgoing connections - hci_stack->le_connection_interval_min = 0x0008; // 10 ms - hci_stack->le_connection_interval_max = 0x0018; // 30 ms - hci_stack->le_connection_latency = 4; // 4 - hci_stack->le_supervision_timeout = 0x0048; // 720 ms - hci_stack->le_minimum_ce_length = 2; // 1.25 ms - hci_stack->le_maximum_ce_length = 0x0030; // 30 ms #endif - - // connection parameter range used to answer connection parameter update requests in l2cap - hci_stack->le_connection_parameter_range.le_conn_interval_min = 6; - hci_stack->le_connection_parameter_range.le_conn_interval_max = 3200; - hci_stack->le_connection_parameter_range.le_conn_latency_min = 0; - hci_stack->le_connection_parameter_range.le_conn_latency_max = 500; - hci_stack->le_connection_parameter_range.le_supervision_timeout_min = 10; - hci_stack->le_connection_parameter_range.le_supervision_timeout_max = 3200; } #ifdef ENABLE_CLASSIC @@ -2444,6 +2428,24 @@ void hci_init(const hci_transport_t *transport, const void *config){ // voice setting - signed 16 bit pcm data with CVSD over the air hci_stack->sco_voice_setting = 0x60; +#ifdef ENABLE_LE_CENTRAL + // connection parameter to use for outgoing connections + hci_stack->le_connection_interval_min = 0x0008; // 10 ms + hci_stack->le_connection_interval_max = 0x0018; // 30 ms + hci_stack->le_connection_latency = 4; // 4 + hci_stack->le_supervision_timeout = 0x0048; // 720 ms + hci_stack->le_minimum_ce_length = 2; // 1.25 ms + hci_stack->le_maximum_ce_length = 0x0030; // 30 ms +#endif + + // connection parameter range used to answer connection parameter update requests in l2cap + hci_stack->le_connection_parameter_range.le_conn_interval_min = 6; + hci_stack->le_connection_parameter_range.le_conn_interval_max = 3200; + hci_stack->le_connection_parameter_range.le_conn_latency_min = 0; + hci_stack->le_connection_parameter_range.le_conn_latency_max = 500; + hci_stack->le_connection_parameter_range.le_supervision_timeout_min = 10; + hci_stack->le_connection_parameter_range.le_supervision_timeout_max = 3200; + hci_state_reset(); }