From 3812cfd7b8342c27442e23380554aa446e176a1d Mon Sep 17 00:00:00 2001 From: rrandomsky Date: Fri, 4 Aug 2023 19:45:17 +0200 Subject: [PATCH] [MOS-1010] Fix for Alarm disappearance during end of call window It was possible to display an Alarm with the appropriate Alarm window exactly when end of call window with call summary are displayed and automatically closed after 3 seconds. This commit will fix this scenario. Now Alarm is snooze in the same way as if there is a phone call going on. --- .../application-call/ApplicationCall.cpp | 4 +++ .../service-cellular/CellularServiceAPI.cpp | 27 +++++++++++++++++++ .../service-cellular/CellularServiceAPI.hpp | 1 + module-services/service-time/ServiceTime.cpp | 10 ++++++- pure_changelog.md | 1 + 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/module-apps/application-call/ApplicationCall.cpp b/module-apps/application-call/ApplicationCall.cpp index 0345cb2fe1f080b4e65bb769de6656157cd17cf3..133edea7ef331a68467549e6e6feb88b1f626fa4 100644 --- a/module-apps/application-call/ApplicationCall.cpp +++ b/module-apps/application-call/ApplicationCall.cpp @@ -187,6 +187,10 @@ namespace app return sys::MessageNone{}; }); + connect(typeid(cellular::IsCallActive), [&](sys::Message *request) { + return std::make_shared(callModel->getState() != call::CallState::None); + }); + connect(typeid(cellular::CallStartedNotification), [&](sys::Message *request) { auto message = static_cast(request); callModel->setPhoneNumber(message->getNumber()); diff --git a/module-services/service-cellular/CellularServiceAPI.cpp b/module-services/service-cellular/CellularServiceAPI.cpp index 7f3478b22c57a647f347b42e7ed6bfb7b68fc167..df833afffe6b54bdf91ec59652f86fde25c0ed9e 100644 --- a/module-services/service-cellular/CellularServiceAPI.cpp +++ b/module-services/service-cellular/CellularServiceAPI.cpp @@ -4,6 +4,7 @@ #include "service-cellular/CellularMessage.hpp" #include "service-cellular/CellularServiceAPI.hpp" #include "service-cellular/ServiceCellular.hpp" +#include "application-call/include/application-call/ApplicationCall.hpp" #include #include @@ -242,6 +243,7 @@ bool CellularServiceAPI::GetAntenna(sys::Service *serv, bsp::cellular::antenna & bool CellularServiceAPI::IsCallInProgress(sys::Service *serv, bool &response) { + // Ask cellular is in Active state (any other state than Idle) auto msg = std::make_shared(); auto ret = serv->bus.sendUnicastSync(msg, service::name::cellular, 1000); if (ret.first == sys::ReturnCodes::Success) { @@ -255,6 +257,31 @@ bool CellularServiceAPI::IsCallInProgress(sys::Service *serv, bool &response) return false; } +bool CellularServiceAPI::IsCallStateForCallApplicationActive(sys::Service *serv, bool &response) +{ + // Ask ApplicationCall (if App even exist) about its internal Call State + auto msg = std::make_shared(); + auto ret = serv->bus.sendUnicastSync(msg, app::name_call, 1000); + if (ret.first == sys::ReturnCodes::Success) { + auto celResponse = std::dynamic_pointer_cast(ret.second); + if ((celResponse != nullptr) && (celResponse->retCode == sys::ReturnCodes::Success)) { + LOG_DEBUG("Is Call in active for ApplicationCall: %d", celResponse->active); + response = celResponse->active; + return true; + } + } + else if (ret.first == sys::ReturnCodes::ServiceDoesntExist) { + LOG_DEBUG("App doesn't exist so it cannot have an active call state"); + response = false; + return true; // Tolerant behavior + } + + LOG_DEBUG("ApplicationCall doesn't seem to be responding, so we're assuming the app doesn't exist, " + "so App can not have active call state"); + response = false; + return false; +} + bool CellularServiceAPI::TransmitDtmfTones(sys::Service *serv, DTMFCode code) { auto msg = std::make_shared(code); diff --git a/module-services/service-cellular/service-cellular/CellularServiceAPI.hpp b/module-services/service-cellular/service-cellular/CellularServiceAPI.hpp index 6584be805b39f7868a769acdf017268b82c8b6a7..45592d5216f6652771b0af94ec063b55401dc3a6 100644 --- a/module-services/service-cellular/service-cellular/CellularServiceAPI.hpp +++ b/module-services/service-cellular/service-cellular/CellularServiceAPI.hpp @@ -86,6 +86,7 @@ namespace CellularServiceAPI bool GetQNWINFO(sys::Service *serv, std::string &response); bool GetAntenna(sys::Service *serv, bsp::cellular::antenna &response); bool IsCallInProgress(sys::Service *serv, bool &response); + bool IsCallStateForCallApplicationActive(sys::Service *serv, bool &response); /** * @brief Transmits DTMF tone * @param serv diff --git a/module-services/service-time/ServiceTime.cpp b/module-services/service-time/ServiceTime.cpp index 48882a39e1879e868dd354ac648ef1d532b927dd..e8cd162698a8e5dd6281681fba0aab30c2e3a831 100644 --- a/module-services/service-time/ServiceTime.cpp +++ b/module-services/service-time/ServiceTime.cpp @@ -50,8 +50,16 @@ namespace stm alarmOperations->updateEventsCache(TimePointNow()); alarmOperations->addCheckIfPhoneCallIsOngoingCallback([this]() -> bool { bool isPhoneCallInProgress = false; + // Check Call state in Cellular if (!CellularServiceAPI::IsCallInProgress(this, isPhoneCallInProgress)) { - LOG_ERROR("Unable to check if the Call is in progress"); + LOG_ERROR("Unable to check if the Call is in progress for Cellular service"); + } + + // Double check is ApplicationCall (if App exist) has active state of call + if (!isPhoneCallInProgress && + !CellularServiceAPI::IsCallStateForCallApplicationActive(this, isPhoneCallInProgress)) { + LOG_WARN("Unable to check if the ApplicationCall has Active Call State. " + "Call Status not considered active"); } return isPhoneCallInProgress; }); diff --git a/pure_changelog.md b/pure_changelog.md index 6aed186b540c4e5738972320a9d0f4d567213ef1..2d64acb4beb359d7d2bf02ff2ec8413ef118e70b 100644 --- a/pure_changelog.md +++ b/pure_changelog.md @@ -33,6 +33,7 @@ * Fixed hard fault handling * Fixed issue with uneven first screen redraw after turning the phone on * Fixed issue with bypassing phone lock window after unplugging USB cable on tethering popup +* Fixed Alarm disappearance during end of call window ## [1.7.2 2023-07-28]