From 0684b1271b8674e7416b5b815a29faa1843edd44 Mon Sep 17 00:00:00 2001 From: Mateusz Grzegorzek Date: Fri, 11 Jun 2021 08:55:42 +0200 Subject: [PATCH] [BH-515] Create main Bell app Create main Bell app --- board/linux/libiosyscalls/test/CMakeLists.txt | 1 + module-apps/CMakeLists.txt | 2 + .../ApplicationBellMain.cpp | 43 +++++++++++++++ .../ApplicationBellMain.hpp | 41 ++++++++++++++ .../application-bell-main/CMakeLists.txt | 7 +++ .../windows/BellMainWindow.cpp | 23 ++++++++ .../windows/BellMainWindow.hpp | 17 ++++++ module-bluetooth/tests/CMakeLists.txt | 1 + module-bsp/tests/CMakeLists.txt | 1 + module-cellular/test/CMakeLists.txt | 7 +++ .../service-cellular/tests/CMakeLists.txt | 3 ++ .../service-db/test/CMakeLists.txt | 2 + .../test-settings-Settings/CMakeLists.txt | 1 + .../test/test-settings/CMakeLists.txt | 1 + module-sys/CMakeLists.txt | 1 + module-utils/Clipboard/test/CMakeLists.txt | 1 + module-vfs/tests/CMakeLists.txt | 6 ++- products/BellHybrid/BellHybridMain.cpp | 54 ++----------------- 18 files changed, 160 insertions(+), 52 deletions(-) create mode 100644 module-apps/application-bell-main/ApplicationBellMain.cpp create mode 100644 module-apps/application-bell-main/ApplicationBellMain.hpp create mode 100644 module-apps/application-bell-main/CMakeLists.txt create mode 100644 module-apps/application-bell-main/windows/BellMainWindow.cpp create mode 100644 module-apps/application-bell-main/windows/BellMainWindow.hpp diff --git a/board/linux/libiosyscalls/test/CMakeLists.txt b/board/linux/libiosyscalls/test/CMakeLists.txt index bfd29f6a7b8c43fe5f71f690abf33e77e9f49432..4d50f8638d5621a418ebc604c0af7de51971e8c5 100644 --- a/board/linux/libiosyscalls/test/CMakeLists.txt +++ b/board/linux/libiosyscalls/test/CMakeLists.txt @@ -5,6 +5,7 @@ add_catch2_executable( SRCS ${CMAKE_CURRENT_LIST_DIR}/unittest_iosys.cpp LIBS + module-sys module-vfs iosyscalls DEPS PurePhone-disk-img diff --git a/module-apps/CMakeLists.txt b/module-apps/CMakeLists.txt index be816f4dc6eaab5e9deec93cb508ce4830e3e3ea..f4ec85defa2dd1ea015e358ed73209e6ddd9e6e0 100644 --- a/module-apps/CMakeLists.txt +++ b/module-apps/CMakeLists.txt @@ -118,6 +118,7 @@ include_directories( ../module-db ) add_subdirectory(popups) add_subdirectory(locks) +add_subdirectory(application-bell-main) target_link_libraries(${PROJECT_NAME} PRIVATE @@ -131,6 +132,7 @@ target_link_libraries(${PROJECT_NAME} Microsoft.GSL::GSL eventstore PUBLIC + application-bell-main module-audio module-bsp module-db diff --git a/module-apps/application-bell-main/ApplicationBellMain.cpp b/module-apps/application-bell-main/ApplicationBellMain.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6066b5a55b5d4ede72f3d3421e36db265e17ecc9 --- /dev/null +++ b/module-apps/application-bell-main/ApplicationBellMain.cpp @@ -0,0 +1,43 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include "ApplicationBellMain.hpp" +#include "windows/BellMainWindow.hpp" + +namespace app +{ + ApplicationBellMain::ApplicationBellMain(std::string name, + std::string parent, + sys::phone_modes::PhoneMode mode, + StartInBackground startInBackground) + : Application(name, parent, mode, startInBackground) + {} + + sys::ReturnCodes ApplicationBellMain::InitHandler() + { + auto ret = Application::InitHandler(); + if (ret != sys::ReturnCodes::Success) { + return ret; + } + + createUserInterface(); + + return sys::ReturnCodes::Success; + } + + void ApplicationBellMain::createUserInterface() + { + windowsFactory.attach(gui::name::window::main_window, [](Application *app, const std::string &name) { + return std::make_unique(app); + }); + } + + sys::MessagePointer ApplicationBellMain::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) + { + auto retMsg = Application::DataReceivedHandler(msgl); + if (dynamic_cast(retMsg.get())->retCode == sys::ReturnCodes::Success) { + return retMsg; + } + return std::make_shared(); + } +} // namespace app diff --git a/module-apps/application-bell-main/ApplicationBellMain.hpp b/module-apps/application-bell-main/ApplicationBellMain.hpp new file mode 100644 index 0000000000000000000000000000000000000000..f6c6dcac136080015952e79dfdfd67e886a68044 --- /dev/null +++ b/module-apps/application-bell-main/ApplicationBellMain.hpp @@ -0,0 +1,41 @@ +// 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 + +namespace app +{ + inline constexpr auto applicationBellName = "ApplicationBell"; + + class ApplicationBellMain : public Application + { + public: + ApplicationBellMain(std::string name = applicationBellName, + std::string parent = "", + sys::phone_modes::PhoneMode mode = sys::phone_modes::PhoneMode::Offline, + StartInBackground startInBackground = {false}); + + sys::ReturnCodes InitHandler() override; + + void createUserInterface() override; + void destroyUserInterface() override + {} + + sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override; + + sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final + { + return sys::ReturnCodes::Success; + } + }; + + template <> struct ManifestTraits + { + static auto GetManifest() -> manager::ApplicationManifest + { + return {{manager::actions::Launch}}; + } + }; +} // namespace app diff --git a/module-apps/application-bell-main/CMakeLists.txt b/module-apps/application-bell-main/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..a061dfbe82911f83ca96a73916ca70db329c87a6 --- /dev/null +++ b/module-apps/application-bell-main/CMakeLists.txt @@ -0,0 +1,7 @@ +add_library(application-bell-main INTERFACE) + +target_sources(application-bell-main + INTERFACE + ApplicationBellMain.cpp + windows/BellMainWindow.cpp +) diff --git a/module-apps/application-bell-main/windows/BellMainWindow.cpp b/module-apps/application-bell-main/windows/BellMainWindow.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3a5aa451fc99027346f658d068f1221c0541d6df --- /dev/null +++ b/module-apps/application-bell-main/windows/BellMainWindow.cpp @@ -0,0 +1,23 @@ +// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. +// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md + +#include "BellMainWindow.hpp" +#include + +namespace gui +{ + BellMainWindow::BellMainWindow(app::Application *app) : AppWindow(app, gui::name::window::main_window) + { + buildInterface(); + } + + void BellMainWindow::buildInterface() + { + AppWindow::buildInterface(); + + bottomBar->setActive(BottomBar::Side::CENTER, true); + bottomBar->setText(gui::BottomBar::Side::CENTER, utils::translate(style::strings::common::start)); + + setTitle("Bell Hybrid+"); + } +} // namespace gui diff --git a/module-apps/application-bell-main/windows/BellMainWindow.hpp b/module-apps/application-bell-main/windows/BellMainWindow.hpp new file mode 100644 index 0000000000000000000000000000000000000000..225c84fb0a8cf28bf775c95ef6b7a79975c38616 --- /dev/null +++ b/module-apps/application-bell-main/windows/BellMainWindow.hpp @@ -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 + +namespace gui +{ + class BellMainWindow : public AppWindow + { + public: + explicit BellMainWindow(app::Application *app); + + void buildInterface() override; + }; +} // namespace gui diff --git a/module-bluetooth/tests/CMakeLists.txt b/module-bluetooth/tests/CMakeLists.txt index 80036cae8a1bedb7802874024efc1a05f74ac000..300515046dc05d7a16cce096a0e6b9824bc21825 100644 --- a/module-bluetooth/tests/CMakeLists.txt +++ b/module-bluetooth/tests/CMakeLists.txt @@ -5,5 +5,6 @@ add_catch2_executable( tests-main.cpp tests-StatefulController.cpp LIBS + module-sys module-bluetooth ) diff --git a/module-bsp/tests/CMakeLists.txt b/module-bsp/tests/CMakeLists.txt index 11a86d94d6e7bb24fdd0d0a33f2b493423f1d118..e4bcddc343012b020e7d54341f3c12ab2270fbec 100644 --- a/module-bsp/tests/CMakeLists.txt +++ b/module-bsp/tests/CMakeLists.txt @@ -5,5 +5,6 @@ tests-main.cpp test-battery-charger-utils.cpp LIBS + module-sys module-bsp ) diff --git a/module-cellular/test/CMakeLists.txt b/module-cellular/test/CMakeLists.txt index 40ffcd7fe1e9311660ef5dbeae5a7f5154003f06..f13e62f2f4bff4ee4adbb559569c4b73afa67661 100644 --- a/module-cellular/test/CMakeLists.txt +++ b/module-cellular/test/CMakeLists.txt @@ -5,6 +5,7 @@ add_catch2_executable( SRCS unittest_URC.cpp LIBS + module-sys module-cellular ) @@ -14,6 +15,7 @@ add_catch2_executable( SRCS unittest_response.cpp LIBS + module-sys module-cellular ) @@ -23,6 +25,7 @@ add_catch2_executable( SRCS unittest_parse_result.cpp LIBS + module-sys module-cellular ) @@ -32,6 +35,7 @@ add_catch2_executable( SRCS unittest_ATStream.cpp LIBS + module-sys module-cellular ) @@ -41,6 +45,7 @@ add_catch2_executable( SRCS unittest_cmux.cpp LIBS + module-sys module-cellular ) @@ -50,6 +55,7 @@ add_catch2_executable( SRCS unittest_ATURCStream.cpp LIBS + module-sys module-cellular ) @@ -59,6 +65,7 @@ add_catch2_executable( SRCS unittest_CellularResult.cpp LIBS + module-sys module-cellular module-bsp ) diff --git a/module-services/service-cellular/tests/CMakeLists.txt b/module-services/service-cellular/tests/CMakeLists.txt index b5989c3a007e8e75b7a885e522c437e781a77d66..087a674df7674081b2f2bb654fc71418c748ae2a 100644 --- a/module-services/service-cellular/tests/CMakeLists.txt +++ b/module-services/service-cellular/tests/CMakeLists.txt @@ -4,6 +4,7 @@ add_catch2_executable( SRCS unittest_request_factory.cpp LIBS + module-sys module-cellular ) @@ -34,6 +35,7 @@ add_catch2_executable( SRCS unittest_qmbn.cpp LIBS + module-sys module-cellular ) @@ -43,5 +45,6 @@ add_gtest_executable( SRCS unittest_connection-manager.cpp LIBS + module-sys module-cellular ) diff --git a/module-services/service-db/test/CMakeLists.txt b/module-services/service-db/test/CMakeLists.txt index 397e9da35e532b3e315ff2cf75bfdd8f5a9e9f56..0518ac69f8fa258c0f0cb4098f849a07af852395 100644 --- a/module-services/service-db/test/CMakeLists.txt +++ b/module-services/service-db/test/CMakeLists.txt @@ -10,6 +10,7 @@ add_catch2_executable( test-service-db-quotes.cpp test-factory-settings.cpp LIBS + module-sys service-audio module-vfs module-audio @@ -28,6 +29,7 @@ add_catch2_executable( test-entry-path.cpp ${CMAKE_SOURCE_DIR}/module-services/service-db/EntryPath.cpp LIBS + module-sys INCLUDE ${CMAKE_SOURCE_DIR}/module-utils/ ${CMAKE_SOURCE_DIR}/module-services/service-db/ diff --git a/module-services/service-db/test/test-settings-Settings/CMakeLists.txt b/module-services/service-db/test/test-settings-Settings/CMakeLists.txt index 5222ed934b917eee23d4d21a158bfd219d14e6eb..3457046e87a89ec56ebec145a9509dd18566b70d 100644 --- a/module-services/service-db/test/test-settings-Settings/CMakeLists.txt +++ b/module-services/service-db/test/test-settings-Settings/CMakeLists.txt @@ -15,5 +15,6 @@ add_catch2_executable( ${CMAKE_SOURCE_DIR}/module-utils/ DEPS LIBS + module-sys magic_enum ) diff --git a/module-services/service-db/test/test-settings/CMakeLists.txt b/module-services/service-db/test/test-settings/CMakeLists.txt index 228b39f8a5644a40f10481bbc8939328609e64f5..f614ff52b3689e74b160ad084697b5081669a5ac 100644 --- a/module-services/service-db/test/test-settings/CMakeLists.txt +++ b/module-services/service-db/test/test-settings/CMakeLists.txt @@ -12,5 +12,6 @@ add_catch2_executable( service-cellular module-cellular DEPS + module-sys PurePhone-disk-img ) diff --git a/module-sys/CMakeLists.txt b/module-sys/CMakeLists.txt index 9450a3cccae662ed0870e1da35d40c4b038ae088..ccbd88468960395007ab7bf77cd67a9d77fe2b83 100644 --- a/module-sys/CMakeLists.txt +++ b/module-sys/CMakeLists.txt @@ -61,6 +61,7 @@ target_link_libraries(module-sys eventstore PUBLIC module-os + module-bsp ) # Board specific compilation definitions,options,include directories and features diff --git a/module-utils/Clipboard/test/CMakeLists.txt b/module-utils/Clipboard/test/CMakeLists.txt index ef90565a64a53ff89225ae1b965d4be3f599e439..2072b32cc9d78ffbbf5a067af80f06bb6ab706fe 100644 --- a/module-utils/Clipboard/test/CMakeLists.txt +++ b/module-utils/Clipboard/test/CMakeLists.txt @@ -5,5 +5,6 @@ add_catch2_executable( SRCS unittest_clipboard.cpp LIBS + module-sys clipboard ) diff --git a/module-vfs/tests/CMakeLists.txt b/module-vfs/tests/CMakeLists.txt index faa96cc1ae48b68f7c08b91987ade4fe539769ce..3417142c61c512bc6292be1e323188fd7abbd324 100644 --- a/module-vfs/tests/CMakeLists.txt +++ b/module-vfs/tests/CMakeLists.txt @@ -11,6 +11,7 @@ add_catch2_executable( SRCS ${CMAKE_CURRENT_LIST_DIR}/unittest_disk_manager.cpp LIBS + module-sys module-vfs DEPS test_disk_image @@ -23,6 +24,7 @@ add_catch2_executable( INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../include/internal LIBS + module-sys module-vfs ) @@ -41,6 +43,7 @@ add_catch2_executable( INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../include/internal LIBS + module-sys module-vfs DEPS ${LITTLEFS_IMAGE} @@ -52,8 +55,8 @@ add_catch2_executable( ${CMAKE_CURRENT_LIST_DIR}/unittest_filesystem_dualmount.cpp INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../include/internal - LIBS + module-sys module-vfs DEPS ${LITTLEFS_IMAGE} @@ -64,6 +67,7 @@ add_catch2_executable( SRCS ${CMAKE_CURRENT_LIST_DIR}/unittest_filesystem_inotify.cpp LIBS + module-sys module-vfs INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/../include/internal diff --git a/products/BellHybrid/BellHybridMain.cpp b/products/BellHybrid/BellHybridMain.cpp index 8a2881b111d69a6c0af8d117cad4580670de4148..29e0eb769544fb7ac6d03a07ad7569936ddd7e22 100644 --- a/products/BellHybrid/BellHybridMain.cpp +++ b/products/BellHybrid/BellHybridMain.cpp @@ -20,6 +20,7 @@ #include #include #include +#include // services #include @@ -121,61 +122,12 @@ int main() [sysmgr]() { // vector with launchers to applications std::vector> applications; -#ifdef ENABLE_APP_DESKTOP applications.push_back( - app::CreateLauncher(app::name_desktop, app::Closeable::False)); -#endif -#ifdef ENABLE_APP_CALL - applications.push_back(app::CreateLauncher(app::name_call, app::Closeable::False)); -#endif -#ifdef ENABLE_APP_SETTINGS - applications.push_back(app::CreateLauncher(app::name_settings)); -#endif -#ifdef ENABLE_APP_SETTINGS_NEW - applications.push_back(app::CreateLauncher(app::name_settings_new)); -#endif -#ifdef ENABLE_APP_NOTES - applications.push_back(app::CreateLauncher(app::name_notes)); -#endif -#ifdef ENABLE_APP_CALLLOG - applications.push_back(app::CreateLauncher(app::CallLogAppStr)); -#endif -#ifdef ENABLE_APP_PHONEBOOK - applications.push_back(app::CreateLauncher(app::name_phonebook)); -#endif -#ifdef ENABLE_APP_MESSAGES - applications.push_back(app::CreateLauncher(app::name_messages)); -#endif -#ifdef ENABLE_APP_SPECIAL_INPUT - applications.push_back( - app::CreateLauncher(app::special_input, app::Closeable::False)); -#endif -#ifdef ENABLE_APP_ANTENNA - applications.push_back(app::CreateLauncher(app::name_antenna)); -#endif -#ifdef ENABLE_APP_CALENDAR - applications.push_back(app::CreateLauncher(app::name_calendar)); -#endif -#ifdef ENABLE_APP_MUSIC_PLAYER - applications.push_back(app::CreateLauncher(app::name_music_player)); -#endif -#ifdef ENABLE_APP_MEDITATION - applications.push_back( - app::CreateLauncher(app::name_meditation, app::Closeable::True)); -#endif -#ifdef ENABLE_APP_CALCULATOR - applications.push_back(app::CreateLauncher(app::name_calculator)); -#endif -#ifdef ENABLE_APP_ALARM_CLOCK - applications.push_back(app::CreateLauncher(app::name_alarm_clock)); -#endif -#ifdef ENABLE_APP_ONBOARDING - applications.push_back(app::CreateLauncher(app::name_onboarding)); -#endif + app::CreateLauncher(app::applicationBellName, app::Closeable::False)); // start application manager return sysmgr->RunSystemService( std::make_shared( - app::manager::ApplicationManager::ServiceName, std::move(applications), app::name_desktop), + app::manager::ApplicationManager::ServiceName, std::move(applications), app::applicationBellName), sysmgr.get()); });