M module-bluetooth/Bluetooth/BluetoothStateMachine.hpp => module-bluetooth/Bluetooth/BluetoothStateMachine.hpp +4 -5
@@ 5,7 5,6 @@
#define BOOST_SML_CFG_DISABLE_MIN_SIZE // GCC10 fix
#include <boost/sml.hpp>
-#include <sml-utils/Logger.hpp>
#include <stdexcept>
#include "command/event/Events.hpp"
#include "service-bluetooth/SettingsHolder.hpp"
@@ 13,6 12,7 @@
#include "WorkerController.hpp"
#include "Device.hpp"
#include <log/log.hpp>
+#include <sml-utils/Logger.hpp>
namespace bluetooth
{
@@ 364,10 364,9 @@ namespace bluetooth
state<Idle> + sml::event<bluetooth::event::StartStream>/ StartAudio = state<Idle>,
state<Idle> + sml::event<bluetooth::event::StopStream>/ StopAudio = state<Idle>,
- 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<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-bluetooth/Bluetooth/BtKeysStorage.cpp => module-bluetooth/Bluetooth/BtKeysStorage.cpp +2 -2
@@ 74,7 74,7 @@ namespace bluetooth
json11::Json finalJson = json11::Json::object{{strings::keys, keys}};
auto keysEntryDump = finalJson.dump();
- LOG_INFO("Current keys state: %s", keysEntryDump.c_str());
+ LOG_DEBUG("Current keys state: %s", keysEntryDump.c_str());
if (keys.empty()) {
LOG_ERROR("Keys empty!");
@@ 84,7 84,7 @@ namespace bluetooth
auto ret = processOnFoundKey(bd_addr, [&type, &link_key](const json11::Json &key, bd_addr_t) {
auto foundLinkKey = key[strings::link_key].string_value().c_str();
memcpy(link_key, reinterpret_cast<const uint8_t *>(foundLinkKey), sizeof(link_key_t));
- LOG_INFO("Getting key: %s", foundLinkKey);
+ LOG_DEBUG("Getting key: %s", foundLinkKey);
*type = static_cast<link_key_type_t>(key[strings::type].int_value());
return 1;
M module-bluetooth/Bluetooth/interface/profiles/HFP/HFP.cpp => module-bluetooth/Bluetooth/interface/profiles/HFP/HFP.cpp +5 -1
@@ 480,6 480,9 @@ namespace bluetooth
if (currentCallStatus == CallStatus::Incoming) {
hfp_ag_answer_incoming_call(); // will answer the call if it wasn't answered
}
+ else {
+ hfp_ag_outgoing_call_established();
+ }
currentCallStatus = CallStatus::Active;
return Error::Success;
}
@@ 521,9 524,10 @@ namespace bluetooth
if (currentCallStatus != CallStatus::OutgoingPlacedFromHFP) {
LOG_DEBUG("Started outgoing call from Pure");
hfp_ag_outgoing_call_initiated(number.c_str());
+ hfp_ag_outgoing_call_accepted();
+ hfp_ag_outgoing_call_ringing();
currentCallStatus = CallStatus::OutgoingPlacedFromPure;
}
- hfp_ag_outgoing_call_established();
return Error::Success;
}
auto HFP::HFPImpl::setNetworkRegistrationStatus(bool registered) const noexcept -> Error::Code
M module-bluetooth/lib/btstack => module-bluetooth/lib/btstack +1 -1
@@ 1,1 1,1 @@
-Subproject commit 172c792707c7e6a8ff68b939b0988f3af9a092b1
+Subproject commit b62bb8ad81fdf7bced9db9b30dda226de484a299
M module-services/service-bluetooth/ServiceBluetooth.cpp => module-services/service-bluetooth/ServiceBluetooth.cpp +8 -7
@@ 110,7 110,6 @@ sys::ReturnCodes ServiceBluetooth::InitHandler()
connectHandler<message::bluetooth::ResponseAuthenticatePairCancel>();
connectHandler<message::bluetooth::RequestStatusIndicatorData>();
connectHandler<CellularCallerIdMessage>();
- connectHandler<CellularCallActiveNotification>();
connectHandler<CellularIncominCallMessage>();
connectHandler<cellular::CallEndedNotification>();
connectHandler<cellular::CallStartedNotification>();
@@ 118,6 117,7 @@ sys::ReturnCodes ServiceBluetooth::InitHandler()
connectHandler<CellularCurrentOperatorNameNotification>();
connectHandler<CellularNetworkStatusUpdateNotification>();
connectHandler<sevm::BatteryStatusChangeMessage>();
+ connectHandler<cellular::CallOutgoingAccepted>();
settingsHolder->onStateChange = [this]() {
auto initialState = std::visit(bluetooth::IntVisitor(), settingsHolder->getValue(bluetooth::Settings::State));
@@ 496,12 496,6 @@ auto ServiceBluetooth::handle(CellularCallerIdMessage *msg) -> std::shared_ptr<s
return sys::MessageNone{};
}
-auto ServiceBluetooth::handle(CellularCallActiveNotification *msg) -> std::shared_ptr<sys::Message>
-{
- sendWorkerCommand(std::make_unique<bluetooth::event::CallAnswered>());
- return std::make_shared<sys::ResponseMessage>();
-}
-
auto ServiceBluetooth::handle(CellularSignalStrengthUpdateNotification *msg) -> std::shared_ptr<sys::Message>
{
auto signalStrength = Store::GSM::get()->getSignalStrength();
@@ 591,3 585,10 @@ auto ServiceBluetooth::handle(CellularIncominCallMessage *msg) -> std::shared_pt
sendWorkerCommand(std::make_unique<bluetooth::event::StartRinging>());
return sys::MessageNone{};
}
+auto ServiceBluetooth::handle(cellular::CallOutgoingAccepted *msg) -> std::shared_ptr<sys::Message>
+{
+ LOG_DEBUG("Outgoing 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 -2
@@ 66,7 66,6 @@ namespace sevm
}
class CellularCallerIdMessage;
-class CellularCallActiveNotification;
class CellularSignalStrengthUpdateNotification;
class CellularCurrentOperatorNameNotification;
class CellularIncominCallMessage;
@@ 75,6 74,7 @@ namespace cellular
{
class CallEndedNotification;
class CallStartedNotification;
+ class CallOutgoingAccepted;
}
class ServiceBluetooth : public sys::Service
@@ 139,10 139,10 @@ class ServiceBluetooth : public sys::Service
[[nodiscard]] auto handle(message::bluetooth::ResponseAuthenticatePairCancel *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(message::bluetooth::RequestStatusIndicatorData *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(CellularCallerIdMessage *msg) -> std::shared_ptr<sys::Message>;
- [[nodiscard]] auto handle(CellularCallActiveNotification *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(CellularIncominCallMessage *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(cellular::CallEndedNotification *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(cellular::CallStartedNotification *msg) -> std::shared_ptr<sys::Message>;
+ [[nodiscard]] auto handle(cellular::CallOutgoingAccepted *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(CellularSignalStrengthUpdateNotification *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(CellularCurrentOperatorNameNotification *msg) -> std::shared_ptr<sys::Message>;
[[nodiscard]] auto handle(CellularNetworkStatusUpdateNotification *msg) -> std::shared_ptr<sys::Message>;
M module-services/service-cellular/call/CallMachine.hpp => module-services/service-cellular/call/CallMachine.hpp +1 -0
@@ 213,6 213,7 @@ namespace call
{
void operator()(Dependencies &di, CallData &call)
{
+ di.gui->notifyOutgoingCallAnswered();
di.timer->start();
}
} constexpr HandleStartedCall;
M module-services/service-cellular/call/api/CallGUI.cpp => module-services/service-cellular/call/api/CallGUI.cpp +5 -0
@@ 44,3 44,8 @@ void CallGUI::notifyCallDurationUpdate(const time_t &duration)
owner->bus.sendMulticast(std::make_shared<cellular::CallDurationNotification>(duration),
sys::BusChannel::ServiceCellularNotifications);
}
+void CallGUI::notifyOutgoingCallAnswered()
+{
+ owner->bus.sendMulticast(std::make_shared<cellular::CallOutgoingAccepted>(),
+ sys::BusChannel::ServiceCellularNotifications);
+}
M module-services/service-cellular/call/api/CallGUI.hpp => module-services/service-cellular/call/api/CallGUI.hpp +2 -0
@@ 22,6 22,7 @@ namespace call::api
virtual void notifyCallEnded() = 0;
virtual void notifyCallActive() = 0;
virtual void notifyCallDurationUpdate(const time_t &duration) = 0;
+ virtual void notifyOutgoingCallAnswered() = 0;
virtual ~GUI() = default;
};
}; // namespace call::api
@@ 40,4 41,5 @@ class CallGUI : public call::api::GUI
void notifyCallEnded() override;
void notifyCallActive() override;
void notifyCallDurationUpdate(const time_t &duration) override;
+ void notifyOutgoingCallAnswered() override;
};
M module-services/service-cellular/call/tests/test-CallMachine.cpp => module-services/service-cellular/call/tests/test-CallMachine.cpp +3 -0
@@ 41,6 41,8 @@ namespace mocks
fakeit::When(Method(gui, notifyCallEnded)).AlwaysReturn();
fakeit::When(Method(gui, notifyCallActive)).AlwaysReturn();
fakeit::When(Method(gui, notifyCallDurationUpdate)).AlwaysReturn();
+ fakeit::When(Method(gui, notifyOutgoingCallAnswered)).AlwaysReturn();
+
return gui;
}
@@ 362,6 364,7 @@ TEST_CASE("call outgoing - answered")
REQUIRE(machine->machine.process_event(call::event::StartCall{CallType::CT_OUTGOING, number.getView()}));
REQUIRE(machine->machine.process_event(call::event::Answer{}));
fakeit::Verify(Method(di.audio, play)).Exactly(0);
+ fakeit::Verify(Method(di.gui, notifyOutgoingCallAnswered)).Exactly(1);
REQUIRE(machine->machine.process_event(call::event::Ended{}));
fakeit::Verify(Method(di.audio, stop)).Exactly(1);
}
M module-services/service-cellular/service-cellular/CellularMessage.hpp => module-services/service-cellular/service-cellular/CellularMessage.hpp +6 -0
@@ 1070,6 1070,12 @@ namespace cellular
time_t callDuration;
};
+ class CallOutgoingAccepted : public sys::DataMessage
+ {
+ public:
+ explicit CallOutgoingAccepted() : sys::DataMessage(MessageType::MessageTypeUninitialized){};
+ };
+
class CellularIsCallActive : public sys::DataMessage
{};
struct CellularIsCallActiveResponse : public sys::ResponseMessage