~aleteoryx/muditaos

ce43ee37e53569fc125f338004dd463a34fbe0db — Bartosz Cichocki 3 years ago d727430
[MOS-570] Fix HFP answering bug

Call answer event was incorrectly routed to BT, thus
the device was not aware of answering the call
M module-bluetooth/Bluetooth/BluetoothStateMachine.hpp => module-bluetooth/Bluetooth/BluetoothStateMachine.hpp +1 -0
@@ 367,6 367,7 @@ namespace bluetooth
                        state<Idle> + sml::event<bluetooth::event::StartRouting> / forwardEvent= state<Call>,
                        state<Idle> + sml::event<bluetooth::event::IncomingCallNumber>  / forwardEvent  = state<Call>,
                        state<Idle> + sml::event<bluetooth::event::CallStarted> / forwardEvent= state<Call>,

                        state<Call> = state<Idle> // this one is needed to go out from Call substate properly!

                            );

M module-services/service-bluetooth/ServiceBluetooth.cpp => module-services/service-bluetooth/ServiceBluetooth.cpp +8 -0
@@ 118,6 118,7 @@ sys::ReturnCodes ServiceBluetooth::InitHandler()
    connectHandler<cellular::NetworkStatusUpdateNotification>();
    connectHandler<sevm::BatteryStatusChangeMessage>();
    connectHandler<cellular::CallOutgoingAccepted>();
    connectHandler<cellular::CallActiveNotification>();

    settingsHolder->onStateChange = [this]() {
        auto initialState = std::visit(bluetooth::IntVisitor(), settingsHolder->getValue(bluetooth::Settings::State));


@@ 592,3 593,10 @@ auto ServiceBluetooth::handle(cellular::CallOutgoingAccepted *msg) -> std::share

    return sys::MessageNone{};
}
auto ServiceBluetooth::handle(cellular::CallActiveNotification *msg) -> std::shared_ptr<sys::Message>
{
    LOG_DEBUG("Incoming call accepted");
    sendWorkerCommand(std::make_unique<bluetooth::event::CallAnswered>());

    return sys::MessageNone{};
}

M module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp => module-services/service-bluetooth/service-bluetooth/ServiceBluetooth.hpp +2 -0
@@ 75,6 75,7 @@ namespace cellular
    class SignalStrengthUpdateNotification;
    class CurrentOperatorNameNotification;
    class NetworkStatusUpdateNotification;
    class CallActiveNotification;
}

class ServiceBluetooth : public sys::Service


@@ 147,6 148,7 @@ class ServiceBluetooth : public sys::Service
    [[nodiscard]] auto handle(cellular::CurrentOperatorNameNotification *msg) -> std::shared_ptr<sys::Message>;
    [[nodiscard]] auto handle(cellular::NetworkStatusUpdateNotification *msg) -> std::shared_ptr<sys::Message>;
    [[nodiscard]] auto handle(sevm::BatteryStatusChangeMessage *msg) -> std::shared_ptr<sys::Message>;
    [[nodiscard]] auto handle(cellular::CallActiveNotification *msg) -> std::shared_ptr<sys::Message>;
};

namespace sys