M module-services/service-cellular/CMakeLists.txt => module-services/service-cellular/CMakeLists.txt +1 -0
@@ 19,6 19,7 @@ set(SOURCES
call/CellularCall.cpp
call/CallAudio.cpp
call/CallGUI.cpp
+ call/CallDB.cpp
call/CallRingGuard.cpp
CellularServiceAPI.cpp
CellularUrcHandler.cpp
A module-services/service-cellular/call/CallDB.cpp => module-services/service-cellular/call/CallDB.cpp +18 -0
@@ 0,0 1,18 @@
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#include "CallDB.hpp"
+#include "service-appmgr/data/CallActionsParams.hpp"
+#include <queries/notifications/QueryNotificationsIncrement.hpp>
+#include <service-appmgr/Controller.hpp>
+
+CallDB::CallDB(sys::Service &s) : owner(s)
+{}
+
+void CallDB::incrementNotAnsweredCallsNotification(const utils::PhoneNumber::View &number)
+{
+ DBServiceAPI::GetQuery(
+ &owner,
+ db::Interface::Name::Notifications,
+ std::make_unique<db::query::notifications::Increment>(NotificationsRecord::Key::Calls, number));
+}
A module-services/service-cellular/call/CallDB.hpp => module-services/service-cellular/call/CallDB.hpp +21 -0
@@ 0,0 1,21 @@
+// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include <PhoneNumber.hpp>
+
+namespace sys
+{
+ class Service;
+}
+
+class CallDB
+{
+ sys::Service &owner;
+
+ public:
+ explicit CallDB(sys::Service &);
+
+ void incrementNotAnsweredCallsNotification(const utils::PhoneNumber::View &number);
+};
M module-services/service-cellular/call/CallRingGuard.cpp => module-services/service-cellular/call/CallRingGuard.cpp +5 -0
@@ 14,3 14,8 @@ bool callClipGuard(CellularCall::Call &call)
return call.mode == sys::phone_modes::PhoneMode::DoNotDisturb && call.operations.areCallsFromFavouritesEnabled() &&
call.operations.isNumberInFavourites();
}
+
+bool callDNDGuard(CellularCall::Call &call)
+{
+ return call.mode == sys::phone_modes::PhoneMode::DoNotDisturb;
+}
M module-services/service-cellular/call/CallRingGuard.hpp => module-services/service-cellular/call/CallRingGuard.hpp +8 -0
@@ 24,3 24,11 @@ bool callRingGuard(CellularCall::Call &call);
/// - we have this somebody phone number via CLIP URC
/// It wont be ever called for private numbers
bool callClipGuard(CellularCall::Call &call);
+
+/// Guard to check if we should place missed call notification
+/// This flow is when:
+/// - We are in do not disturb mode
+/// - somebody calls
+/// - we have this somebody phone number via CLIP/RING URC
+/// It wont be ever called for private numbers
+bool callDNDGuard(CellularCall::Call &call);
M module-services/service-cellular/call/CellularCall.cpp => module-services/service-cellular/call/CellularCall.cpp +7 -1
@@ 6,6 6,7 @@
#include "service-cellular/ServiceCellular.hpp"
#include "service-db/agents/settings/SystemSettings.hpp"
+#include <queries/notifications/QueryNotificationsIncrement.hpp>
#include <CalllogRecord.hpp>
#include <PhoneNumber.hpp>
#include <Utils.hpp>
@@ 21,7 22,7 @@
namespace CellularCall
{
- Call::Call(ServiceCellular &owner) : owner(owner), audio(owner), gui(owner)
+ Call::Call(ServiceCellular &owner) : owner(owner), audio(owner), gui(owner), db(owner)
{
utils::PhoneNumber::View number = utils::PhoneNumber::View();
const CallType type = CallType::CT_NONE;
@@ 60,6 61,11 @@ namespace CellularCall
gui.notifyCLIP(number);
return true;
}
+
+ if (callDNDGuard(*this)) {
+ db.incrementNotAnsweredCallsNotification(number);
+ }
+
return false;
}
M module-services/service-cellular/service-cellular/call/CellularCall.hpp => module-services/service-cellular/service-cellular/call/CellularCall.hpp +2 -0
@@ 5,6 5,7 @@
#include "call/CallAudio.hpp"
#include "call/CallGUI.hpp"
+#include "call/CallDB.hpp"
#include "PhoneModes/PhoneMode.hpp"
#include <Interface/CalllogRecord.hpp>
#include <SystemManager/CpuSentinel.hpp>
@@ 63,6 64,7 @@ namespace CellularCall
ServiceCellular &owner;
CallRingAudio audio;
CallGUI gui;
+ CallDB db;
public:
void setMode(sys::phone_modes::PhoneMode mode)