hsp_hs.c (6535961a1f105e850ecdf294c128b9fc982ee05a) hsp_hs.c (c169df2f885b47a4b0894cfd04e316df94bbf2f2)
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

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

364}
365
366
367static void hsp_run(void){
368
369 if (wait_ok) return;
370
371 if (hs_accept_sco_connection && hci_can_send_command_packet_now()){
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

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

364}
365
366
367static void hsp_run(void){
368
369 if (wait_ok) return;
370
371 if (hs_accept_sco_connection && hci_can_send_command_packet_now()){
372
373 bool eSCO = hs_accept_sco_connection == 2;
372 hs_accept_sco_connection = 0;
373
374 log_info("HSP: sending hci_accept_connection_request.");
375 // remote supported feature eSCO is set if link type is eSCO
376 // eSCO: S4 - max latency == transmission interval = 0x000c == 12 ms,
377 uint16_t max_latency;
378 uint8_t retransmission_effort;
379 uint16_t packet_types;
374 hs_accept_sco_connection = 0;
375
376 log_info("HSP: sending hci_accept_connection_request.");
377 // remote supported feature eSCO is set if link type is eSCO
378 // eSCO: S4 - max latency == transmission interval = 0x000c == 12 ms,
379 uint16_t max_latency;
380 uint8_t retransmission_effort;
381 uint16_t packet_types;
380
381 if (hci_remote_esco_supported(rfcomm_handle)){
382
383 if (eSCO && hci_extended_sco_link_supported() && hci_remote_esco_supported(rfcomm_handle)){
382 max_latency = 0x000c;
383 retransmission_effort = 0x02;
384 packet_types = 0x388;
385 } else {
386 max_latency = 0xffff;
387 retransmission_effort = 0xff;
388 packet_types = 0x003f;
389 }

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

524 uint16_t handle;
525 // printf("packet_handler HCI_EVENT_PACKET type %u, packet[0] %x\n", packet_type, packet[0]);
526 switch (event) {
527 case HCI_EVENT_CONNECTION_REQUEST:
528 switch(hci_event_connection_request_get_link_type(packet)){
529 case 0: // SCO
530 case 2: // eSCO
531 hci_event_connection_request_get_bd_addr(packet, event_addr);
384 max_latency = 0x000c;
385 retransmission_effort = 0x02;
386 packet_types = 0x388;
387 } else {
388 max_latency = 0xffff;
389 retransmission_effort = 0xff;
390 packet_types = 0x003f;
391 }

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

526 uint16_t handle;
527 // printf("packet_handler HCI_EVENT_PACKET type %u, packet[0] %x\n", packet_type, packet[0]);
528 switch (event) {
529 case HCI_EVENT_CONNECTION_REQUEST:
530 switch(hci_event_connection_request_get_link_type(packet)){
531 case 0: // SCO
532 case 2: // eSCO
533 hci_event_connection_request_get_bd_addr(packet, event_addr);
532 printf("remote device %s\n", bd_addr_to_str(remote));
533 printf("accept sco for device %s\n", bd_addr_to_str(event_addr));
534
535 if (bd_addr_cmp(event_addr, remote) == 0){
534 if (bd_addr_cmp(event_addr, remote) == 0){
536 printf("hs_accept_sco_connection \n");
537 hs_accept_sco_connection = 1;
535 if (hci_event_connection_request_get_link_type(packet) == 2){
536 hs_accept_sco_connection = 2;
537 } else {
538 hs_accept_sco_connection = 1;
539 }
540 log_info("hs_accept_sco_connection %u", hs_accept_sco_connection);
538 }
539 break;
540 default:
541 break;
542 }
543 break;
544
545 case HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE:{

--- 144 unchanged lines hidden ---
541 }
542 break;
543 default:
544 break;
545 }
546 break;
547
548 case HCI_EVENT_SYNCHRONOUS_CONNECTION_COMPLETE:{

--- 144 unchanged lines hidden ---