~aleteoryx/muditaos

30ae0e08ca5f48c4f626508996f4e9758bb24822 — Bartosz Cichocki 4 years ago 54e5bdd
[EGD-6882] Fix call hangup after BT device disconnect

Updated the BT stack with events that are handled through the
button so now it's possible to fallback to the earspeaker when
BT connection is lost

Added handling of those events
M module-bluetooth/Bluetooth/interface/profiles/HSP/HSP.cpp => module-bluetooth/Bluetooth/interface/profiles/HSP/HSP.cpp +8 -2
@@ 189,7 189,6 @@ namespace bluetooth
            else {
                scoHandle = hsp_subevent_audio_connection_complete_get_handle(event);
                LOG_DEBUG("Audio connection established with SCO handle 0x%04x.\n", scoHandle);
                cellularInterface->answerIncomingCall(const_cast<sys::Service *>(ownerService));
                hci_request_sco_can_send_now_event();
                RunLoop::trigger();
            }


@@ 197,7 196,6 @@ namespace bluetooth
        case HSP_SUBEVENT_AUDIO_DISCONNECTION_COMPLETE:
            LOG_DEBUG("Audio connection released.\n\n");
            sendAudioEvent(audio::EventType::BlutoothHSPDeviceState, audio::Event::DeviceState::Disconnected);
            cellularInterface->hangupCall(const_cast<sys::Service *>(ownerService));
            scoHandle   = HCI_CON_HANDLE_INVALID;
            isConnected = false;
            break;


@@ 207,6 205,14 @@ namespace bluetooth
        case HSP_SUBEVENT_SPEAKER_GAIN_CHANGED:
            LOG_DEBUG("Received speaker gain change %d\n", hsp_subevent_speaker_gain_changed_get_gain(event));
            break;
        case HSP_SUBEVENT_HS_CALL_ANSWER:
            LOG_DEBUG("HSP CALL ANSWER");
            cellularInterface->answerIncomingCall(const_cast<sys::Service *>(ownerService));
            break;
        case HSP_SUBEVENT_HS_CALL_HANGUP:
            LOG_DEBUG("HSP CALL HANGUP");
            cellularInterface->hangupCall(const_cast<sys::Service *>(ownerService));
            break;
        case HSP_SUBEVENT_HS_COMMAND: {
            ATcommandBuffer.fill(0);
            auto cmd_length   = hsp_subevent_hs_command_get_value_length(event);

M module-bluetooth/lib/btstack => module-bluetooth/lib/btstack +1 -1
@@ 1,1 1,1 @@
Subproject commit 45e9304c0b9f764e195c54b23136a948071fd4e5
Subproject commit 8ccf25d5f4657e9b6140d2ea04a023af80e42909