mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-03-29 13:20:39 +00:00
added gap_update_connection_parameters
This commit is contained in:
parent
198795bf17
commit
c37a3166d2
51
.gitignore
vendored
51
.gitignore
vendored
@ -4,4 +4,53 @@
|
||||
*.*~
|
||||
.netrc
|
||||
|
||||
include/btstack/version.h
|
||||
include/btstack/version.h
|
||||
|
||||
.classpath
|
||||
.project
|
||||
.settings/
|
||||
AndroidManifest.xml
|
||||
CocoaTouch/
|
||||
MSP-EXP430F5438-CC256x/
|
||||
Makefile
|
||||
Makefile.am
|
||||
Makefile.in
|
||||
Ports/
|
||||
aclocal.m4
|
||||
autom4te.cache/
|
||||
ble/
|
||||
bootstrap.sh
|
||||
btstack-config.h
|
||||
chipset-cc256x/
|
||||
chipset-csr/
|
||||
config-iphone.sh
|
||||
config.guess
|
||||
config.status
|
||||
config.sub
|
||||
config/
|
||||
configure
|
||||
configure.ac
|
||||
docs/
|
||||
eZ430-RF2560/
|
||||
example/
|
||||
gen/
|
||||
ic_launcher-web.png
|
||||
include/
|
||||
java/
|
||||
layout
|
||||
m4/
|
||||
package.sh
|
||||
platforms/
|
||||
proguard-project.txt
|
||||
project.properties
|
||||
project.xcodeproj/
|
||||
res/
|
||||
src/
|
||||
test/
|
||||
tools/
|
||||
mtk/BTstackDaemon
|
||||
mtk/BTstackDaemonRespawn
|
||||
mtk/inquiry
|
||||
mtk/le_scan
|
||||
mtk/minimal_peripheral
|
||||
mtk/rfcomm-echo
|
||||
|
14
ble/gap_le.h
14
ble/gap_le.h
@ -41,6 +41,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <btstack/utils.h>
|
||||
|
||||
typedef enum {
|
||||
GAP_RANDOM_ADDRESS_TYPE_OFF = 0,
|
||||
GAP_RANDOM_ADDRESS_NON_RESOLVABLE,
|
||||
@ -59,6 +61,18 @@ void gap_random_address_set_mode(gap_random_address_type_t random_address_type);
|
||||
*/
|
||||
void gap_random_address_set_update_period(int period_ms);
|
||||
|
||||
/**
|
||||
* @brief Updates the connection parameters for a given LE connection
|
||||
* @param handle
|
||||
* @param conn_interval_min (unit: 1.25ms)
|
||||
* @param conn_interval_max (unit: 1.25ms)
|
||||
* @param conn_latency
|
||||
* @param supervision_timeout (unit: 10ms)
|
||||
* @returns 0 if ok
|
||||
*/
|
||||
void gap_update_connection_parameters(hci_con_handle_t con_handle, uint16_t conn_interval_min,
|
||||
uint16_t conn_interval_max, uint16_t conn_latency, uint16_t supervision_timeout);
|
||||
|
||||
#if defined __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
29
src/hci.c
29
src/hci.c
@ -1839,6 +1839,15 @@ void hci_run(){
|
||||
hci_send_cmd(&hci_set_connection_encryption, connection->con_handle, 1);
|
||||
return;
|
||||
}
|
||||
#ifdef HAVE_BLE
|
||||
if (connection->le_conn_interval_min){
|
||||
uint16_t connection_interval_min = connection->le_conn_interval_min;
|
||||
connection->le_conn_interval_min = 0;
|
||||
hci_send_cmd(&hci_le_connection_update, connection->con_handle, connection_interval_min,
|
||||
connection->le_conn_interval_max, connection->le_conn_latency, connection->le_supervision_timeout,
|
||||
0x0000, 0xffff);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
switch (hci_stack->state){
|
||||
@ -2466,6 +2475,26 @@ le_command_status_t le_central_connect_cancel(){
|
||||
return BLE_PERIPHERAL_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Updates the connection parameters for a given LE connection
|
||||
* @param handle
|
||||
* @param conn_interval_min (unit: 1.25ms)
|
||||
* @param conn_interval_max (unit: 1.25ms)
|
||||
* @param conn_latency
|
||||
* @param supervision_timeout (unit: 10ms)
|
||||
* @returns 0 if ok
|
||||
*/
|
||||
int gap_update_connection_parameters(hci_con_handle_t con_handle, uint16_t conn_interval_min,
|
||||
uint16_t conn_interval_max, uint16_t conn_latency, uint16_t supervision_timeout){
|
||||
hci_connection_t * connection = hci_connection_for_handle(con_handle);
|
||||
if (!connection) return ERROR_CODE_UNKNOWN_CONNECTION_IDENTIFIER;
|
||||
connection->le_conn_interval_min = conn_interval_min;
|
||||
connection->le_conn_interval_max = conn_interval_max;
|
||||
connection->le_conn_latency = conn_latency;
|
||||
connection->le_supervision_timeout = supervision_timeout;
|
||||
return 0;
|
||||
}
|
||||
|
||||
le_command_status_t gap_disconnect(hci_con_handle_t handle){
|
||||
hci_connection_t * conn = hci_connection_for_handle(handle);
|
||||
if (!conn){
|
||||
|
@ -343,6 +343,12 @@ typedef struct {
|
||||
|
||||
// number ACL packets sent to controller
|
||||
uint8_t num_acl_packets_sent;
|
||||
|
||||
// connection parameter update
|
||||
uint16_t le_conn_interval_min;
|
||||
uint16_t le_conn_interval_max;
|
||||
uint16_t le_conn_latency;
|
||||
uint16_t le_supervision_timeout;
|
||||
} hci_connection_t;
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user