~aleteoryx/muditaos

0684b1271b8674e7416b5b815a29faa1843edd44 — Mateusz Grzegorzek 4 years ago b95f902
[BH-515] Create main Bell app

Create main Bell app
M board/linux/libiosyscalls/test/CMakeLists.txt => board/linux/libiosyscalls/test/CMakeLists.txt +1 -0
@@ 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

M module-apps/CMakeLists.txt => module-apps/CMakeLists.txt +2 -0
@@ 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

A module-apps/application-bell-main/ApplicationBellMain.cpp => module-apps/application-bell-main/ApplicationBellMain.cpp +43 -0
@@ 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<gui::BellMainWindow>(app);
        });
    }

    sys::MessagePointer ApplicationBellMain::DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp)
    {
        auto retMsg = Application::DataReceivedHandler(msgl);
        if (dynamic_cast<sys::ResponseMessage *>(retMsg.get())->retCode == sys::ReturnCodes::Success) {
            return retMsg;
        }
        return std::make_shared<sys::ResponseMessage>();
    }
} // namespace app

A module-apps/application-bell-main/ApplicationBellMain.hpp => module-apps/application-bell-main/ApplicationBellMain.hpp +41 -0
@@ 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 <Application.hpp>

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<ApplicationBellMain>
    {
        static auto GetManifest() -> manager::ApplicationManifest
        {
            return {{manager::actions::Launch}};
        }
    };
} // namespace app

A module-apps/application-bell-main/CMakeLists.txt => module-apps/application-bell-main/CMakeLists.txt +7 -0
@@ 0,0 1,7 @@
add_library(application-bell-main INTERFACE)

target_sources(application-bell-main
    INTERFACE
        ApplicationBellMain.cpp
        windows/BellMainWindow.cpp
)

A module-apps/application-bell-main/windows/BellMainWindow.cpp => module-apps/application-bell-main/windows/BellMainWindow.cpp +23 -0
@@ 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 <i18n/i18n.hpp>

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

A module-apps/application-bell-main/windows/BellMainWindow.hpp => module-apps/application-bell-main/windows/BellMainWindow.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 <AppWindow.hpp>

namespace gui
{
    class BellMainWindow : public AppWindow
    {
      public:
        explicit BellMainWindow(app::Application *app);

        void buildInterface() override;
    };
} // namespace gui

M module-bluetooth/tests/CMakeLists.txt => module-bluetooth/tests/CMakeLists.txt +1 -0
@@ 5,5 5,6 @@ add_catch2_executable(
        tests-main.cpp
        tests-StatefulController.cpp
    LIBS
        module-sys
        module-bluetooth
)

M module-bsp/tests/CMakeLists.txt => module-bsp/tests/CMakeLists.txt +1 -0
@@ 5,5 5,6 @@
        tests-main.cpp
        test-battery-charger-utils.cpp
    LIBS
        module-sys
        module-bsp
)

M module-cellular/test/CMakeLists.txt => module-cellular/test/CMakeLists.txt +7 -0
@@ 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
)

M module-services/service-cellular/tests/CMakeLists.txt => module-services/service-cellular/tests/CMakeLists.txt +3 -0
@@ 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
)

M module-services/service-db/test/CMakeLists.txt => module-services/service-db/test/CMakeLists.txt +2 -0
@@ 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/

M module-services/service-db/test/test-settings-Settings/CMakeLists.txt => module-services/service-db/test/test-settings-Settings/CMakeLists.txt +1 -0
@@ 15,5 15,6 @@ add_catch2_executable(
            ${CMAKE_SOURCE_DIR}/module-utils/
        DEPS
        LIBS
            module-sys
            magic_enum
)

M module-services/service-db/test/test-settings/CMakeLists.txt => module-services/service-db/test/test-settings/CMakeLists.txt +1 -0
@@ 12,5 12,6 @@ add_catch2_executable(
            service-cellular
            module-cellular
        DEPS
            module-sys
            PurePhone-disk-img
)

M module-sys/CMakeLists.txt => module-sys/CMakeLists.txt +1 -0
@@ 61,6 61,7 @@ target_link_libraries(module-sys
        eventstore
    PUBLIC
        module-os
        module-bsp
    )

# Board specific compilation definitions,options,include directories and features

M module-utils/Clipboard/test/CMakeLists.txt => module-utils/Clipboard/test/CMakeLists.txt +1 -0
@@ 5,5 5,6 @@ add_catch2_executable(
    SRCS
        unittest_clipboard.cpp
    LIBS
        module-sys
        clipboard
)

M module-vfs/tests/CMakeLists.txt => module-vfs/tests/CMakeLists.txt +5 -1
@@ 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

M products/BellHybrid/BellHybridMain.cpp => products/BellHybrid/BellHybridMain.cpp +3 -51
@@ 20,6 20,7 @@
#include <application-calculator/ApplicationCalculator.hpp>
#include <application-alarm-clock/ApplicationAlarmClock.hpp>
#include <application-onboarding/ApplicationOnBoarding.hpp>
#include <application-bell-main/ApplicationBellMain.hpp>

// services
#include <service-appmgr/model/ApplicationManager.hpp>


@@ 121,61 122,12 @@ int main()
        [sysmgr]() {
            // vector with launchers to applications
            std::vector<std::unique_ptr<app::ApplicationLauncher>> applications;
#ifdef ENABLE_APP_DESKTOP
            applications.push_back(
                app::CreateLauncher<app::ApplicationDesktop>(app::name_desktop, app::Closeable::False));
#endif
#ifdef ENABLE_APP_CALL
            applications.push_back(app::CreateLauncher<app::ApplicationCall>(app::name_call, app::Closeable::False));
#endif
#ifdef ENABLE_APP_SETTINGS
            applications.push_back(app::CreateLauncher<app::ApplicationSettings>(app::name_settings));
#endif
#ifdef ENABLE_APP_SETTINGS_NEW
            applications.push_back(app::CreateLauncher<app::ApplicationSettingsNew>(app::name_settings_new));
#endif
#ifdef ENABLE_APP_NOTES
            applications.push_back(app::CreateLauncher<app::ApplicationNotes>(app::name_notes));
#endif
#ifdef ENABLE_APP_CALLLOG
            applications.push_back(app::CreateLauncher<app::ApplicationCallLog>(app::CallLogAppStr));
#endif
#ifdef ENABLE_APP_PHONEBOOK
            applications.push_back(app::CreateLauncher<app::ApplicationPhonebook>(app::name_phonebook));
#endif
#ifdef ENABLE_APP_MESSAGES
            applications.push_back(app::CreateLauncher<app::ApplicationMessages>(app::name_messages));
#endif
#ifdef ENABLE_APP_SPECIAL_INPUT
            applications.push_back(
                app::CreateLauncher<app::ApplicationSpecialInput>(app::special_input, app::Closeable::False));
#endif
#ifdef ENABLE_APP_ANTENNA
            applications.push_back(app::CreateLauncher<app::ApplicationAntenna>(app::name_antenna));
#endif
#ifdef ENABLE_APP_CALENDAR
            applications.push_back(app::CreateLauncher<app::ApplicationCalendar>(app::name_calendar));
#endif
#ifdef ENABLE_APP_MUSIC_PLAYER
            applications.push_back(app::CreateLauncher<app::ApplicationMusicPlayer>(app::name_music_player));
#endif
#ifdef ENABLE_APP_MEDITATION
            applications.push_back(
                app::CreateLauncher<app::ApplicationMeditation>(app::name_meditation, app::Closeable::True));
#endif
#ifdef ENABLE_APP_CALCULATOR
            applications.push_back(app::CreateLauncher<app::ApplicationCalculator>(app::name_calculator));
#endif
#ifdef ENABLE_APP_ALARM_CLOCK
            applications.push_back(app::CreateLauncher<app::ApplicationAlarmClock>(app::name_alarm_clock));
#endif
#ifdef ENABLE_APP_ONBOARDING
            applications.push_back(app::CreateLauncher<app::ApplicationOnBoarding>(app::name_onboarding));
#endif
                app::CreateLauncher<app::ApplicationBellMain>(app::applicationBellName, app::Closeable::False));
            // start application manager
            return sysmgr->RunSystemService(
                std::make_shared<app::manager::ApplicationManager>(
                    app::manager::ApplicationManager::ServiceName, std::move(applications), app::name_desktop),
                    app::manager::ApplicationManager::ServiceName, std::move(applications), app::applicationBellName),
                sysmgr.get());
        });