A image/user/db/settings_bell_001.sql => image/user/db/settings_bell_001.sql +46 -0
@@ 0,0 1,46 @@
+-- Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+-- For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+--
+-- Main settings table, for string application persistent data
+--
+CREATE TABLE IF NOT EXISTS settings_tab (
+ path TEXT NOT NULL UNIQUE PRIMARY KEY,
+ value TEXT
+);
+
+--
+-- Dictionary table, for variables with fixed set of values
+--
+CREATE TABLE IF NOT EXISTS dictionary_tab (
+ id INTEGER PRIMARY KEY,
+ path TEXT NOT NULL,
+ value TEXT,
+ CONSTRAINT dictionary_unique
+ UNIQUE (path, value) ON CONFLICT REPLACE
+ );
+
+--
+-- Table contains information who to inform
+-- about changes in values.
+--
+CREATE TABLE IF NOT EXISTS notifications_tab (
+ id INTEGER PRIMARY KEY,
+ path TEXT NOT NULL,
+ service TEXT,
+ CONSTRAINT notification_unique
+ UNIQUE(path, service)
+ );
+
+CREATE TABLE IF NOT EXISTS settings_changed_tab(
+
+ id INTEGER PRIMARY KEY,
+ path TEXT NOT NULL,
+ value TEXT,
+ CONSTRAINT changed_unique
+ UNIQUE(path ) ON CONFLICT REPLACE
+);
+
+CREATE TRIGGER IF NOT EXISTS on_update UPDATE OF value ON settings_tab
+WHEN new.value <> old.value BEGIN INSERT OR REPLACE INTO settings_changed_tab (path, value) VALUES (new.path,new.value); END;
+
A image/user/db/settings_bell_002.sql => image/user/db/settings_bell_002.sql +45 -0
@@ 0,0 1,45 @@
+-- Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+-- For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+-- ----------- insert default values ----------------------
+INSERT OR REPLACE INTO dictionary_tab (path, value) VALUES
+ ('system/phone_mode', 'online'),
+ ('system/phone_mode', 'offline'),
+ ('system/phone_mode', 'dnd');
+
+-- ----------- insert default values -------------------
+INSERT OR IGNORE INTO settings_tab (path, value) VALUES
+ ('system/phone_mode', 'online'),
+ ('gs_time_format', '0'),
+ ('gs_date_format', '1'),
+ ('gs_auto_lock_time', '30'),
+ ('gs_unlock_lock_time', '0'),
+ ('gs_unlock_attempt_lock_time', '15'),
+ ('gs_no_lock_time_attempts_left', '3'),
+ ('gs_active_sim', ''),
+ ('gs_lock_pass_hash', ''),
+ ('gs_lock_screen_passcode_is_on', '0'),
+ ('gs_display_language', 'English'),
+ ('gs_input_language', 'English'),
+ ('\ApplicationManager\\gs_onboarding_done', '0'),
+ ('gs_usb_security', '1'),
+ ('gs_os_update_version', '0.00.0'),
+ ('gs_os_current_version', '0.00.0'),
+ ('battery_critical_level', '10'),
+ ('cl_offline_mode', '0'),
+ ('cl_current_uid', '0'),
+ ('off_connection_frequency', '0'),
+ ('off_notifications_when_locked', '0'),
+ ('off_calls_from_favorites', '0'),
+ ('\EventManager\\br_state', '0'),
+ ('\EventManager\\br_auto_mode', '0'),
+ ('\EventManager\\br_level', '50.0f'),
+ ('keypad_light_state', '0'),
+ ('gs_current_timezone_name', ''),
+ ('gs_current_timezone_rules', ''),
+ ('\ServiceTime\\gs_automatic_date_and_time_is_on', '1'),
+ ('temperature_unit', 'C'),
+ ('ringing_duration', '10000'),
+ ('ringing_tone', 'Nick_Lewis_-_Kristies_Elephant.mp3');
+
+
M module-apps/apps-common/CMakeLists.txt => module-apps/apps-common/CMakeLists.txt +2 -0
@@ 52,6 52,8 @@ target_sources(apps-common
windows/OptionWindow.cpp
PUBLIC
widgets/TimeSetFmtSpinner.hpp
+ actions/AlarmRingingData.hpp
+ actions/AlarmTriggeredAction.hpp
)
add_subdirectory(popups)
A module-apps/apps-common/actions/AlarmRingingData.hpp => module-apps/apps-common/actions/AlarmRingingData.hpp +16 -0
@@ 0,0 1,16 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include <SwitchData.hpp>
+
+namespace app::actions
+{
+ class AlarmRingingData : public gui::SwitchData
+ {
+ public:
+ AlarmRingingData() : SwitchData()
+ {}
+ };
+} // namespace app::actions
A module-apps/apps-common/actions/AlarmTriggeredAction.hpp => module-apps/apps-common/actions/AlarmTriggeredAction.hpp +27 -0
@@ 0,0 1,27 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include "AlarmRingingData.hpp"
+
+#include <service-appmgr/Actions.hpp>
+#include <service-appmgr/messages/ActionRequest.hpp>
+
+namespace app::actions
+{
+ class AlarmTriggeredAction : public sys::DataMessage, public app::manager::actions::ConvertibleToAction
+ {
+ public:
+ AlarmTriggeredAction() : sys::DataMessage(MessageType::MessageTypeUninitialized)
+ {}
+
+ std::unique_ptr<app::manager::ActionRequest> toAction() const override
+ {
+ auto params = std::make_unique<AlarmRingingData>();
+ return std::make_unique<app::manager::ActionRequest>(
+ sender, app::manager::actions::ShowAlarm, std::move(params));
+ }
+ };
+
+} // namespace app::actions
M module-services/service-audio/ServiceAudio.cpp => module-services/service-audio/ServiceAudio.cpp +2 -1
@@ 199,7 199,8 @@ constexpr bool ServiceAudio::IsResumable(const audio::PlaybackType &type) const
constexpr bool ServiceAudio::ShouldLoop(const std::optional<audio::PlaybackType> &type) const
{
- return type.value_or(audio::PlaybackType::None) == audio::PlaybackType::CallRingtone
+ return type.value_or(audio::PlaybackType::None) == audio::PlaybackType::CallRingtone ||
+ type.value_or(audio::PlaybackType::None) == audio::PlaybackType::Alarm
#if ENABLE_PLAYBACK_AUTO_REPEAT == 1
|| type.value_or(audio::PlaybackType::None) == audio::PlaybackType::Multimedia
#endif
M module-services/service-db/agents/settings/SettingsAgent.cpp => module-services/service-db/agents/settings/SettingsAgent.cpp +3 -3
@@ 19,8 19,8 @@ namespace settings
} // namespace settings
-SettingsAgent::SettingsAgent(sys::Service *parentService, settings::SettingsCache *cache)
- : DatabaseAgent(parentService), cache(cache), factorySettings(settings::factory::path)
+SettingsAgent::SettingsAgent(sys::Service *parentService, const std::string dbName, settings::SettingsCache *cache)
+ : DatabaseAgent(parentService), cache(cache), factorySettings(settings::factory::path), dbName{dbName}
{
if (nullptr == cache) {
this->cache = settings::SettingsCache::getInstance();
@@ 74,7 74,7 @@ auto SettingsAgent::getDbInitString() -> const std::string
auto SettingsAgent::getDbFilePath() -> const std::string
{
- return (purefs::dir::getUserDiskPath() / "settings_v2.db").string();
+ return (purefs::dir::getUserDiskPath() / dbName).string();
}
auto SettingsAgent::getAgentName() -> const std::string
{
M module-services/service-db/agents/settings/SettingsAgent.hpp => module-services/service-db/agents/settings/SettingsAgent.hpp +2 -1
@@ 26,7 26,7 @@ namespace sys
class SettingsAgent : public DatabaseAgent
{
public:
- SettingsAgent(sys::Service *parentService, settings::SettingsCache *cache = nullptr);
+ SettingsAgent(sys::Service *parentService, const std::string dbName, settings::SettingsCache *cache = nullptr);
~SettingsAgent() = default;
void initDb() override;
@@ 44,6 44,7 @@ class SettingsAgent : public DatabaseAgent
using SetOfRecipents = std::set<std::string>;
SetOfRecipents profileChangedRecipients;
SetOfRecipents modeChangeRecipients;
+ const std::string dbName;
// db operations
auto dbGetValue(const settings::EntryPath &path) -> std::optional<std::string>;
M module-services/service-db/agents/settings/SystemSettings.hpp => module-services/service-db/agents/settings/SystemSettings.hpp +1 -5
@@ 68,8 68,4 @@ namespace settings
constexpr inline auto state = "keypad_light_state";
} // namespace KeypadLight
- namespace Temperature
- {
- constexpr inline auto unit = "temperature_unit";
- } // namespace Temperature
-}; // namespace settings
+}; // namespace settings
M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +0 -2
@@ 23,11 23,9 @@
#include <Service/ServiceCreator.hpp>
#include <service-appmgr/Constants.hpp>
#include <service-audio/ServiceAudio.hpp>
-#include <service-bluetooth/ServiceBluetooth.hpp>
#include <service-desktop/ServiceDesktop.hpp>
#include <service-fileindexer/Constants.hpp>
#include <service-gui/ServiceGUI.hpp>
-#include <service-lwip/ServiceLwIP.hpp>
#include <service-time/ServiceTime.hpp>
#include <Application.hpp>
M products/BellHybrid/CMakeLists.txt => products/BellHybrid/CMakeLists.txt +1 -5
@@ 42,20 42,16 @@ target_link_libraries(BellHybrid
bell::app-settings
bell::app-powernap
appmgr
- db
+ bell::db
evtmgr
messagetype
- module-apps
module-bsp
module-vfs
service-audio
- service-bluetooth
service-desktop
- service-lwip
service-time
sys
platform
- ${LWIP_LIBRARIES}
"$<$<STREQUAL:${PROJECT_TARGET},TARGET_Linux>:iosyscalls>"
"$<$<STREQUAL:${PROJECT_TARGET},TARGET_RT1051>:CrashCatcher::CrashCatcher>"
)
D products/BellHybrid/alarms/AlarmHandlerActions.cpp => products/BellHybrid/alarms/AlarmHandlerActions.cpp +0 -37
@@ 1,37 0,0 @@
-// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
-// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-
-#include "AlarmHandlerActions.hpp"
-
-#include <BellAlarmHandler.hpp>
-#include <application-bell-main/ApplicationBellMain.hpp>
-#include <application-bell-main/data/AlarmRingingSwitchData.hpp>
-#include <apps-common/windows/AppWindow.hpp>
-#include <service-appmgr/include/service-appmgr/Constants.hpp>
-#include <service-appmgr/messages/SwitchRequest.hpp>
-#include <service-time/ServiceTime.hpp>
-
-namespace alarms
-{
- auto playAlarmSound(const std::string &soundPath) -> bool
- {
- // playAlarmSound after it will be implemented [BH-660]
- return true;
- }
-
- auto displayAlarmPopup(stm::ServiceTime *serviceTime) -> bool
- {
- auto msg = std::make_shared<app::manager::SwitchRequest>(BellAlarmClockHandler::name,
- app::applicationBellName,
- gui::name::window::main_window,
- std::make_unique<AlarmRingingSwitchData>());
- serviceTime->bus.sendUnicast(std::move(msg), service::name::appmgr);
- return true;
- }
-
- auto turnOnFrontlight() -> bool
- {
- // turnOnFrontlight after it will be implemented [BH-756]
- return true;
- }
-} // namespace alarms
M products/BellHybrid/alarms/BellAlarmHandler.cpp => products/BellHybrid/alarms/BellAlarmHandler.cpp +14 -10
@@ 1,26 1,30 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#include <BellAlarmHandler.hpp>
-#include <AlarmHandlerActions.hpp>
-#include <service-time/ServiceTime.hpp>
+#include "BellAlarmHandler.hpp"
+#include "src/actions/PlayToneAction.hpp"
+#include "src/actions/NotifyGUIAction.hpp"
+#include "src/actions/FrontlightAction.hpp"
namespace alarms
{
- BellAlarmClockHandler::BellAlarmClockHandler(stm::ServiceTime *serviceTime) : serviceTime(serviceTime)
- {}
+ BellAlarmClockHandler::BellAlarmClockHandler(sys::Service *service) : service{service}
+ {
+ actions.emplace_back(std::make_unique<PlayToneAction>(*service));
+ actions.emplace_back(std::make_unique<NotifyGUIAction>(*service));
+ actions.emplace_back(std::make_unique<FrontlightAction>());
+ }
auto BellAlarmClockHandler::handle(const AlarmEventRecord &record) -> bool
{
LOG_DEBUG("BellAlarmClockHandler");
- auto result = false;
+ auto result{true};
if (record.enabled) {
- result = playAlarmSound(record.musicTone);
- result = turnOnFrontlight();
- result = displayAlarmPopup(serviceTime);
- return result;
+ for (const auto &action : actions) {
+ result &= action->execute();
+ }
}
return result;
M products/BellHybrid/alarms/CMakeLists.txt => products/BellHybrid/alarms/CMakeLists.txt +14 -4
@@ 1,11 1,18 @@
add_library(alarms STATIC)
+add_library(bell::alarms ALIAS alarms)
target_sources(alarms
PRIVATE
BellAlarmHandler.cpp
- AlarmHandlerActions.cpp
- include/AlarmHandlerActions.hpp
+ src/actions/PlayToneAction.cpp
+ src/actions/NotifyGUIAction.cpp
+ src/actions/FrontlightAction.cpp
+
+ include/AbstractAlarmAction.hpp
include/BellAlarmHandler.hpp
+ src/actions/PlayToneAction.hpp
+ src/actions/FrontlightAction.hpp
+ src/actions/NotifyGUIAction.hpp
PUBLIC
include/popups/AlarmPopupRequestParams.hpp
)
@@ 13,14 20,17 @@ target_sources(alarms
target_include_directories(alarms
PRIVATE
include
-
+
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
)
target_link_libraries(alarms
PRIVATE
- application-bell-main
+ module-vfs
+ bell::db
+ bell::app-common
+ apps-common
PUBLIC
module-db
service-time
R products/BellHybrid/apps/application-bell-main/include/application-bell-main/data/AlarmRingingSwitchData.hpp => products/BellHybrid/alarms/include/AbstractAlarmAction.hpp +3 -5
@@ 3,14 3,12 @@
#pragma once
-#include <SwitchData.hpp>
-
namespace alarms
{
- class AlarmRingingSwitchData : public gui::SwitchData
+ class AbstractAlarmAction
{
public:
- AlarmRingingSwitchData() : SwitchData()
- {}
+ virtual ~AbstractAlarmAction() = default;
+ virtual bool execute() = 0;
};
} // namespace alarms
M products/BellHybrid/alarms/include/BellAlarmHandler.hpp => products/BellHybrid/alarms/include/BellAlarmHandler.hpp +5 -8
@@ 3,26 3,23 @@
#pragma once
+#include "AbstractAlarmAction.hpp"
#include <service-time/AlarmHandler.hpp>
-
-namespace stm
-{
- class ServiceTime;
-}
+#include <Service/Service.hpp>
namespace alarms
{
-
class BellAlarmClockHandler : public AlarmHandler
{
public:
- explicit BellAlarmClockHandler(stm::ServiceTime *serviceTime);
+ explicit BellAlarmClockHandler(sys::Service *service);
auto handle(const AlarmEventRecord &record) -> bool;
static constexpr auto name = "BellAlarmClockHandler";
private:
- stm::ServiceTime *serviceTime;
+ sys::Service *service{};
+ std::vector<std::unique_ptr<AbstractAlarmAction>> actions;
};
class EveningReminderHandler : public AlarmHandler
R products/BellHybrid/alarms/include/AlarmHandlerActions.hpp => products/BellHybrid/alarms/src/actions/FrontlightAction.cpp +6 -13
@@ 1,20 1,13 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
-#pragma once
-
-#include <module-db/Interface/AlarmEventRecord.hpp>
-
-namespace stm
-{
- class ServiceTime;
-}
+#include "FrontlightAction.hpp"
namespace alarms
{
-
- auto playAlarmSound(const std::string &soundPath) -> bool;
- auto displayAlarmPopup(stm::ServiceTime *serviceTime) -> bool;
- auto turnOnFrontlight() -> bool;
-
+ bool FrontlightAction::execute()
+ {
+ // turnOnFrontlight after it will be implemented [BH-756]
+ return true;
+ }
} // namespace alarms
A products/BellHybrid/alarms/src/actions/FrontlightAction.hpp => products/BellHybrid/alarms/src/actions/FrontlightAction.hpp +17 -0
@@ 0,0 1,17 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include "AbstractAlarmAction.hpp"
+
+namespace alarms
+{
+
+ class FrontlightAction : public AbstractAlarmAction
+ {
+ public:
+ bool execute() override;
+ };
+
+} // namespace alarms
A products/BellHybrid/alarms/src/actions/NotifyGUIAction.cpp => products/BellHybrid/alarms/src/actions/NotifyGUIAction.cpp +17 -0
@@ 0,0 1,17 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#include "NotifyGUIAction.hpp"
+
+#include <apps-common/actions/AlarmTriggeredAction.hpp>
+#include <service-appmgr/include/service-appmgr/Constants.hpp>
+
+namespace alarms
+{
+ NotifyGUIAction::NotifyGUIAction(sys::Service &service) : service{service}
+ {}
+ bool NotifyGUIAction::execute()
+ {
+ return service.bus.sendUnicast(std::make_shared<app::actions::AlarmTriggeredAction>(), service::name::appmgr);
+ }
+} // namespace alarms
A products/BellHybrid/alarms/src/actions/NotifyGUIAction.hpp => products/BellHybrid/alarms/src/actions/NotifyGUIAction.hpp +22 -0
@@ 0,0 1,22 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include "AbstractAlarmAction.hpp"
+
+#include <Service/Service.hpp>
+
+namespace alarms
+{
+ class NotifyGUIAction : public AbstractAlarmAction
+ {
+ public:
+ explicit NotifyGUIAction(sys::Service &service);
+ bool execute() override;
+
+ private:
+ sys::Service &service;
+ };
+
+} // namespace alarms
A products/BellHybrid/alarms/src/actions/PlayToneAction.cpp => products/BellHybrid/alarms/src/actions/PlayToneAction.cpp +52 -0
@@ 0,0 1,52 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#include "PlayToneAction.hpp"
+#include <module-vfs/include/user/purefs/filesystem_paths.hpp>
+#include <service-audio/AudioServiceAPI.hpp>
+#include <service-time/ServiceTime.hpp>
+#include <db/SystemSettings.hpp>
+#include <Timers/TimerFactory.hpp>
+
+namespace
+{
+ constexpr auto timerName = "playDurationTimer";
+ constexpr auto musicDir = "/music/";
+} // namespace
+
+namespace alarms
+{
+ alarms::PlayToneAction::PlayToneAction(sys::Service &service) : service{service}
+ {
+ settings.init(service::ServiceProxy{service.weak_from_this()});
+ }
+ bool alarms::PlayToneAction::execute()
+ {
+ const auto valueStr = settings.getValue(bell::settings::Ringing::duration, settings::SettingsScope::Global);
+ const auto ringingDuration = std::chrono::seconds{utils::getNumericValue<uint32_t>(valueStr)};
+ const auto tone = settings.getValue(bell::settings::Ringing::tone, settings::SettingsScope::Global);
+ const auto tonePath = std::filesystem::path{purefs::dir::getUserDiskPath().string() + musicDir + tone};
+
+ spawnTimer(ringingDuration);
+
+ return AudioServiceAPI::PlaybackStart(&service, audio::PlaybackType::Alarm, tonePath);
+ }
+
+ void PlayToneAction::detachTimer()
+ {
+ if (timer.isValid()) {
+ timer.stop();
+ timer.reset();
+ }
+ }
+ void PlayToneAction::spawnTimer(std::chrono::seconds timeout)
+ {
+ if (not timer.isValid()) {
+ auto callback = [this](sys::Timer &) { AudioServiceAPI::Stop(&service, {audio::PlaybackType::Alarm}); };
+ timer = sys::TimerFactory::createSingleShotTimer(&service, timerName, timeout, callback);
+ }
+ timer.stop();
+ timer.start();
+ }
+
+} // namespace alarms
A products/BellHybrid/alarms/src/actions/PlayToneAction.hpp => products/BellHybrid/alarms/src/actions/PlayToneAction.hpp +28 -0
@@ 0,0 1,28 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+#include "AbstractAlarmAction.hpp"
+#include <service-db/Settings.hpp>
+#include <module-sys/Timers/TimerHandle.hpp>
+#include <Service/Service.hpp>
+
+namespace alarms
+{
+ class PlayToneAction : public AbstractAlarmAction
+ {
+ public:
+ explicit PlayToneAction(sys::Service &service);
+ bool execute() override;
+
+ private:
+ void spawnTimer(std::chrono::seconds timeout);
+ void detachTimer();
+
+ sys::Service &service;
+ settings::Settings settings;
+ sys::TimerHandle timer;
+ };
+
+} // namespace alarms
M products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp => products/BellHybrid/apps/application-bell-main/ApplicationBellMain.cpp +6 -1
@@ 20,7 20,12 @@ namespace app
sys::bluetooth::BluetoothMode bluetoothMode,
StartInBackground startInBackground)
: Application(name, parent, mode, bluetoothMode, startInBackground)
- {}
+ {
+ addActionReceiver(manager::actions::ShowAlarm, [this](auto &&data) {
+ switchWindow(gui::name::window::main_window, std::move(data));
+ return actionHandled();
+ });
+ }
sys::ReturnCodes ApplicationBellMain::InitHandler()
{
M products/BellHybrid/apps/application-bell-main/CMakeLists.txt => products/BellHybrid/apps/application-bell-main/CMakeLists.txt +1 -1
@@ 24,7 24,6 @@ target_sources(application-bell-main
PUBLIC
include/application-bell-main/ApplicationBellMain.hpp
- include/application-bell-main/data/AlarmRingingSwitchData.hpp
)
target_include_directories(application-bell-main
@@ 42,6 41,7 @@ target_link_libraries(application-bell-main
module-gui
service-gui
time
+ bell::db
bell::evtmgr
bell::app-common
bell::app-alarm
M products/BellHybrid/apps/application-bell-main/models/TemperatureModel.cpp => products/BellHybrid/apps/application-bell-main/models/TemperatureModel.cpp +2 -2
@@ 5,7 5,7 @@
#include <apps-common/Application.hpp>
#include <service-db/Settings.hpp>
-#include <service-db/agents/settings/SystemSettings.hpp>
+#include <db/SystemSettings.hpp>
#include <evtmgr/api/TemperatureApi.hpp>
namespace app::home_screen
@@ 16,7 16,7 @@ namespace app::home_screen
}
utils::temperature::Temperature TemperatureModel::getTemperature() const
{
- const auto unitStr = settings.getValue(settings::Temperature::unit, settings::SettingsScope::Global);
+ const auto unitStr = settings.getValue(bell::settings::Temperature::unit, settings::SettingsScope::Global);
const auto unit = *utils::temperature::strToUnit(unitStr);
auto temperature = evtmgr::api::getCurrentTemperature();
M products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp => products/BellHybrid/apps/application-bell-main/windows/BellHomeScreenWindow.cpp +2 -2
@@ 5,8 5,8 @@
#include "data/BellMainStyle.hpp"
#include <application-bell-main/ApplicationBellMain.hpp>
-#include <application-bell-main/data/AlarmRingingSwitchData.hpp>
#include <apps-common/widgets/BellBaseLayout.hpp>
+#include <apps-common/actions/AlarmTriggeredAction.hpp>
#include <gui/input/InputEvent.hpp>
#include <gui/widgets/TextFixedSize.hpp>
#include <gui/widgets/Style.hpp>
@@ 201,7 201,7 @@ namespace gui
void BellHomeScreenWindow::onBeforeShow(ShowMode, SwitchData *data)
{
presenter->onBeforeShow();
- const auto alarmRingingSwitchData = dynamic_cast<alarms::AlarmRingingSwitchData *>(data);
+ const auto alarmRingingSwitchData = dynamic_cast<app::actions::AlarmRingingData *>(data);
if (alarmRingingSwitchData != nullptr) {
presenter->handleAlarmRingingEvent();
}
M products/BellHybrid/apps/application-bell-settings/CMakeLists.txt => products/BellHybrid/apps/application-bell-settings/CMakeLists.txt +1 -0
@@ 68,6 68,7 @@ target_sources(application-bell-settings
target_link_libraries(application-bell-settings
PRIVATE
bellgui
+ bell::db
service-appmgr
PUBLIC
apps-common
M products/BellHybrid/apps/application-bell-settings/models/TemperatureUnitModel.cpp => products/BellHybrid/apps/application-bell-settings/models/TemperatureUnitModel.cpp +2 -2
@@ 5,11 5,11 @@
#include <apps-common/Application.hpp>
#include <service-db/Settings.hpp>
-#include <service-db/agents/settings/SystemSettings.hpp>
+#include <db/SystemSettings.hpp>
namespace
{
- constexpr auto temperatureUnit = settings::Temperature::unit;
+ constexpr auto temperatureUnit = bell::settings::Temperature::unit;
} // namespace
namespace app::bell_settings
M products/BellHybrid/apps/common/CMakeLists.txt => products/BellHybrid/apps/common/CMakeLists.txt +0 -1
@@ 15,7 15,6 @@ target_sources(application-bell-common
PUBLIC
include/common/models/AlarmModel.hpp
include/common/models/AbstractAlarmModel.hpp
-
)
M products/BellHybrid/services/db/CMakeLists.txt => products/BellHybrid/services/db/CMakeLists.txt +2 -0
@@ 1,10 1,12 @@
add_library(db STATIC)
+add_library(bell::db ALIAS db)
target_sources(db
PRIVATE
ServiceDB.cpp
PUBLIC
include/db/ServiceDB.hpp
+ include/db/SystemSettings.hpp
)
target_include_directories(db
M products/BellHybrid/services/db/ServiceDB.cpp => products/BellHybrid/services/db/ServiceDB.cpp +1 -1
@@ 74,7 74,7 @@ sys::ReturnCodes ServiceDB::InitHandler()
// Create record interfaces
alarmEventRecordInterface = std::make_unique<AlarmEventRecordInterface>(eventsDB.get());
- databaseAgents.emplace(std::make_unique<SettingsAgent>(this));
+ databaseAgents.emplace(std::make_unique<SettingsAgent>(this, "settings_bell.db"));
for (auto &dbAgent : databaseAgents) {
dbAgent->initDb();
A products/BellHybrid/services/db/include/db/SystemSettings.hpp => products/BellHybrid/services/db/include/db/SystemSettings.hpp +17 -0
@@ 0,0 1,17 @@
+// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
+// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md
+
+#pragma once
+
+namespace bell::settings
+{
+ namespace Temperature
+ {
+ constexpr inline auto unit = "temperature_unit";
+ } // namespace Temperature
+ namespace Ringing
+ {
+ constexpr inline auto duration = "ringing_duration";
+ constexpr inline auto tone = "ringing_tone";
+ } // namespace Ringing
+}; // namespace bell::settings
M products/PurePhone/services/db/ServiceDB.cpp => products/PurePhone/services/db/ServiceDB.cpp +1 -1
@@ 232,7 232,7 @@ sys::ReturnCodes ServiceDB::InitHandler()
std::make_unique<NotificationsRecordInterface>(notificationsDB.get(), contactRecordInterface.get());
quotesRecordInterface = std::make_unique<Quotes::QuotesAgent>(quotesDB.get());
- databaseAgents.emplace(std::make_unique<SettingsAgent>(this));
+ databaseAgents.emplace(std::make_unique<SettingsAgent>(this, "settings_v2.db"));
databaseAgents.emplace(std::make_unique<FileIndexerAgent>(this));
for (auto &dbAgent : databaseAgents) {