disconnect LE HCI Connections for active GATT Clients

This commit is contained in:
matthias.ringwald@gmail.com 2014-05-16 22:10:43 +00:00
parent c73ffc61ed
commit 4d766027c1
2 changed files with 16 additions and 0 deletions

View File

@ -562,6 +562,7 @@ gatt_client_t * get_gatt_client_context_for_handle(uint16_t handle){
return NULL;
}
static void gatt_client_run(){
if (!hci_can_send_packet_now_using_packet_buffer(HCI_COMMAND_DATA_PACKET)) return;
// printf("handle_peripheral_list 4\n");
@ -1249,3 +1250,15 @@ le_command_status_t gatt_client_write_long_characteristic_descriptor(gatt_client
return BLE_PERIPHERAL_OK;
}
// used by daemon
void gatt_client_disconnect_connection(connection_t * connection){
if (!connection) return;
linked_item_t *it;
for (it = (linked_item_t *) gatt_client_connections; it ; it = it->next){
gatt_client_t * client = (gatt_client_t *) it;
if (client->context == connection){
gap_le_disconnect(client->handle);
}
}
}

View File

@ -220,6 +220,9 @@ void gatt_client_register_handler(void (*le_callback)(le_event_t * event));
void gatt_client_start(gatt_client_t *context, uint16_t handle);
void gatt_client_stop(gatt_client_t *context);
gatt_client_t * get_gatt_client_context_for_handle(uint16_t handle);
void gatt_client_disconnect_connection(connection_t * connection);
// next command is used with daemon
int gatt_client_is_ready(gatt_client_t *context);
// returns primary services