hci.c (98a2fd1ca4b9043573a35fa7416e26b5293fc617) hci.c (94e4aaa2aeeec85f32a238213d1b04ea33f011ba)
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

--- 2308 unchanged lines hidden (view full) ---

2317
2318 connection->state = SENT_CREATE_CONNECTION;
2319#endif
2320 break;
2321 }
2322 return;
2323
2324 case RECEIVED_CONNECTION_REQUEST:
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

--- 2308 unchanged lines hidden (view full) ---

2317
2318 connection->state = SENT_CREATE_CONNECTION;
2319#endif
2320 break;
2321 }
2322 return;
2323
2324 case RECEIVED_CONNECTION_REQUEST:
2325 log_info("sending hci_accept_connection_request");
2325 log_info("sending hci_accept_connection_request, remote eSCO %u", connection->remote_supported_feature_eSCO);
2326 connection->state = ACCEPTED_CONNECTION_REQUEST;
2327 connection->role = HCI_ROLE_SLAVE;
2328 if (connection->address_type == BD_ADDR_TYPE_CLASSIC){
2329 hci_send_cmd(&hci_accept_connection_request, connection->address, 1);
2330 } else {
2326 connection->state = ACCEPTED_CONNECTION_REQUEST;
2327 connection->role = HCI_ROLE_SLAVE;
2328 if (connection->address_type == BD_ADDR_TYPE_CLASSIC){
2329 hci_send_cmd(&hci_accept_connection_request, connection->address, 1);
2330 } else {
2331 if (connection->remote_supported_feature_eSCO){
2332 // S4 - max latency == transmission interval = 0x000c == 12 ms
2331 // remote supported features are not set for this hci_connection_t struct, but there must be an existing ACL connection already
2332 hci_connection_t * base_acl_connection = hci_connection_for_bd_addr_and_type(connection->address, BD_ADDR_TYPE_CLASSIC);
2333 if (!base_acl_connection || !base_acl_connection->remote_supported_feature_eSCO){
2334 // max latency, retransmission interval: N/A. any packet type
2333 hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0x000c, hci_stack->sco_voice_setting, 0x02, 0x003f);
2334 } else {
2335 hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0x000c, hci_stack->sco_voice_setting, 0x02, 0x003f);
2336 } else {
2335 // max latency, retransmission interval: N/A. any packet type
2336 hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0x000c, hci_stack->sco_voice_setting, 0xff, 0x003f);
2337 // S4 - max latency == transmission interval = 0x000c == 12 ms,
2338 hci_send_cmd(&hci_accept_synchronous_connection, connection->address, 8000, 8000, 0x000c, hci_stack->sco_voice_setting, 0x02, 0x388);
2337 }
2338 }
2339 return;
2340
2341#ifdef HAVE_BLE
2342 case SEND_CANCEL_CONNECTION:
2343 connection->state = SENT_CANCEL_CONNECTION;
2344 hci_send_cmd(&hci_le_create_connection_cancel);

--- 1047 unchanged lines hidden ---
2339 }
2340 }
2341 return;
2342
2343#ifdef HAVE_BLE
2344 case SEND_CANCEL_CONNECTION:
2345 connection->state = SENT_CANCEL_CONNECTION;
2346 hci_send_cmd(&hci_le_create_connection_cancel);

--- 1047 unchanged lines hidden ---