track loopback mode, allow sending SCO packets in loopback mode

This commit is contained in:
Matthias Ringwald 2015-11-12 12:22:19 +01:00
parent 1ae22036c4
commit 0e1ceea46c
2 changed files with 25 additions and 14 deletions

View File

@ -558,6 +558,9 @@ int hci_send_sco_packet_buffer(int size){
}
uint8_t * packet = hci_stack->hci_packet_buffer;
// skip checks in loopback mode
if (!hci_stack->loopback_mode){
hci_con_handle_t con_handle = READ_ACL_CONNECTION_HANDLE(packet); // same for ACL and SCO
// check for free places on Bluetooth module
@ -575,6 +578,7 @@ int hci_send_sco_packet_buffer(int size){
return 0;
}
connection->num_sco_packets_sent++;
}
hci_dump_packet( HCI_SCO_DATA_PACKET, 0, packet, size);
return hci_stack->hci_transport->send_packet(HCI_SCO_DATA_PACKET, packet, size);
@ -2610,6 +2614,10 @@ int hci_send_cmd_packet(uint8_t *packet, int size){
}
}
if (IS_COMMAND(packet, hci_write_loopback_mode)){
hci_stack->loopback_mode = packet[3];
}
#ifdef HAVE_BLE
if (IS_COMMAND(packet, hci_le_set_advertising_parameters)){
hci_stack->adv_addr_type = packet[8];

View File

@ -131,6 +131,7 @@ extern "C" {
#define OGF_CONTROLLER_BASEBAND 0x03
#define OGF_INFORMATIONAL_PARAMETERS 0x04
#define OGF_STATUS_PARAMETERS 0x05
#define OGF_TESTING 0x06
#define OGF_LE_CONTROLLER 0x08
#define OGF_BTSTACK 0x3d
#define OGF_VENDOR 0x3f
@ -720,6 +721,8 @@ typedef struct {
uint16_t sco_voice_setting;
uint8_t loopback_mode;
// buffer for single connection decline
uint8_t decline_reason;
bd_addr_t decline_addr;