hci.c (36916f811e962f4e6d2870902a0aef12846a5c91) | hci.c (47bf68a79f013b54beff3810563dfb8c4485b8cc) |
---|---|
1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 5647 unchanged lines hidden (view full) --- 5656 hci_stack->substate = HCI_HALTING_DISCONNECT_ALL; 5657 if (!hci_can_send_command_packet_now()) return; 5658 5659 // close all open connections 5660 connection = (hci_connection_t *) hci_stack->connections; 5661 if (connection) { 5662 hci_con_handle_t con_handle = (uint16_t) connection->con_handle; 5663 | 1/* 2 * Copyright (C) 2014 BlueKitchen GmbH 3 * 4 * Redistribution and use in source and binary forms, with or without 5 * modification, are permitted provided that the following conditions 6 * are met: 7 * 8 * 1. Redistributions of source code must retain the above copyright --- 5647 unchanged lines hidden (view full) --- 5656 hci_stack->substate = HCI_HALTING_DISCONNECT_ALL; 5657 if (!hci_can_send_command_packet_now()) return; 5658 5659 // close all open connections 5660 connection = (hci_connection_t *) hci_stack->connections; 5661 if (connection) { 5662 hci_con_handle_t con_handle = (uint16_t) connection->con_handle; 5663 |
5664 log_info("HCI_STATE_HALTING, connection %p, handle %u, state %u", connection, con_handle, connection->state); | 5664 log_info("HCI_STATE_HALTING, connection %p, handle %u, state %u", (void*)connection, con_handle, connection->state); |
5665 5666 // check state 5667 switch(connection->state) { 5668 case SENT_DISCONNECT: 5669 case RECEIVED_DISCONNECTION_COMPLETE: 5670 // wait until connection is gone 5671 return; 5672 default: --- 65 unchanged lines hidden (view full) --- 5738 log_info("HCI_STATE_FALLING_ASLEEP"); 5739 // close all open connections 5740 connection = (hci_connection_t *) hci_stack->connections; 5741 if (connection){ 5742 5743 // send disconnect 5744 if (!hci_can_send_command_packet_now()) return; 5745 | 5665 5666 // check state 5667 switch(connection->state) { 5668 case SENT_DISCONNECT: 5669 case RECEIVED_DISCONNECTION_COMPLETE: 5670 // wait until connection is gone 5671 return; 5672 default: --- 65 unchanged lines hidden (view full) --- 5738 log_info("HCI_STATE_FALLING_ASLEEP"); 5739 // close all open connections 5740 connection = (hci_connection_t *) hci_stack->connections; 5741 if (connection){ 5742 5743 // send disconnect 5744 if (!hci_can_send_command_packet_now()) return; 5745 |
5746 log_info("HCI_STATE_FALLING_ASLEEP, connection %p, handle %u", connection, (uint16_t)connection->con_handle); | 5746 log_info("HCI_STATE_FALLING_ASLEEP, connection %p, handle %u", (void*)connection, (uint16_t)connection->con_handle); |
5747 hci_send_cmd(&hci_disconnect, connection->con_handle, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION); 5748 5749 // send disconnected event right away - causes higher layer connections to get closed, too. 5750 hci_shutdown_connection(connection); 5751 return; 5752 } 5753 5754 if (hci_classic_supported()){ --- 5158 unchanged lines hidden --- | 5747 hci_send_cmd(&hci_disconnect, connection->con_handle, ERROR_CODE_REMOTE_USER_TERMINATED_CONNECTION); 5748 5749 // send disconnected event right away - causes higher layer connections to get closed, too. 5750 hci_shutdown_connection(connection); 5751 return; 5752 } 5753 5754 if (hci_classic_supported()){ --- 5158 unchanged lines hidden --- |