~aleteoryx/muditaos

85a6dba50db83e014b9bdc1c89292e24d0c4cb54 — Lefucjusz 1 year, 6 months ago 9b9c145
[BH-2054] Fix build with CONFIG_ENABLE_TEMP set to ON

* Fix of the issue that project build would
fail if trying to run it with enabled
temperature sensor. The sensor itself is
not functional due to hardware issue,
but if such option is present in the
codebase, it should be kept working.
* Cleanups.
38 files changed, 179 insertions(+), 191 deletions(-)

M module-services/service-evtmgr/service-evtmgr/EventManagerCommon.hpp
M products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp
M products/BellHybrid/apps/application-bell-settings/models/LayoutModel.cpp
M products/BellHybrid/apps/application-bell-settings/models/TemperatureUnitModel.cpp
M products/BellHybrid/apps/application-bell-settings/presenter/LayoutWindowPresenter.cpp
M products/BellHybrid/apps/common/include/common/layouts/BaseHomeScreenLayoutProvider.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithAmPm.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithBattery.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithDate.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithQuotes.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithQuotesAmPm.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithTemp.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutNames.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalSimple.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalWithAmPm.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalWithDate.hpp
M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayouts.hpp
M products/BellHybrid/apps/common/include/common/layouts/ShortcutsLayoutProvider.hpp
M products/BellHybrid/apps/common/include/common/layouts/ShortcutsLayouts.hpp
M products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayoutClassic.hpp
M products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayoutProvider.hpp
M products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayouts.hpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithBattery.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithDate.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithQuotesAmPm.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithTemp.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVertical.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalSimple.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalWithAmPm.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalWithDate.cpp
M products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp
M products/BellHybrid/apps/common/src/layouts/ShortcutsLayoutClassic.cpp
M products/BellHybrid/apps/common/src/layouts/UpdateInstructionLayoutClassic.cpp
M products/BellHybrid/services/evtmgr/EventManager.cpp
M module-services/service-evtmgr/service-evtmgr/EventManagerCommon.hpp => module-services/service-evtmgr/service-evtmgr/EventManagerCommon.hpp +7 -6
@@ 1,4 1,4 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 36,7 36,7 @@ class EventManagerCommon : public sys::Service
    sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;

    // Invoked during initialization
    sys::ReturnCodes InitHandler();
    sys::ReturnCodes InitHandler() override;

    sys::ReturnCodes DeinitHandler() override;



@@ 61,11 61,12 @@ class EventManagerCommon : public sys::Service
    LogDumpFunction logDumpFunction;

  protected:
    std::function<void(const time_t)> onMinuteTick;
    virtual void handleKeyEvent(sys::Message *msg);
    virtual void initProductEvents();
    virtual auto createEventWorker() -> std::unique_ptr<WorkerEventCommon> = 0;

    std::function<void(std::time_t time)> onMinuteTick;

    std::shared_ptr<settings::Settings> settings;
    std::unique_ptr<WorkerEventCommon> EventWorker;



@@ 73,13 74,13 @@ class EventManagerCommon : public sys::Service
    // press settings.
    std::string targetApplication;
    // alarm timestamp in seconds from midnight
    uint32_t alarmTimestamp;
    std::uint32_t alarmTimestamp;
    // ID of alarm waiting to trigger
    uint32_t alarmID;
    std::uint32_t alarmID;
    const EventManagerParams eventManagerParams;

    /// @return: < 0 - error occured during log flush
    /// @return:   0 - log flush did not happen
    /// @return:   1 - log flush successflul
    /// @return:   1 - log flush successful
    int dumpLogsToFile();
};

M products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp => products/BellHybrid/apps/application-bell-main/presenters/StateController.cpp +0 -2
@@ 111,8 111,6 @@ namespace app::home_screen
            {};
            struct DeepDownPress
            {};
            struct AlarmInput
            {};
            struct Timer
            {};
            struct TimeUpdate

M products/BellHybrid/apps/application-bell-settings/models/LayoutModel.cpp => products/BellHybrid/apps/application-bell-settings/models/LayoutModel.cpp +2 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <common/models/LayoutModel.hpp>


@@ 8,7 8,6 @@

namespace app::bell_settings
{

    LayoutModel::LayoutModel(ApplicationCommon *app)
    {
        settings.init(service::ServiceProxy{app->weak_from_this()});


@@ 16,7 15,7 @@ namespace app::bell_settings

    std::optional<std::string> LayoutModel::getValue() const
    {
        if (const auto result = settings.getValue(bell::settings::Layout::layout, settings::SettingsScope::Global);
        if (auto result = settings.getValue(bell::settings::Layout::layout, settings::SettingsScope::Global);
            not result.empty()) {
            return result;
        }

M products/BellHybrid/apps/application-bell-settings/models/TemperatureUnitModel.cpp => products/BellHybrid/apps/application-bell-settings/models/TemperatureUnitModel.cpp +1 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "models/TemperatureUnitModel.hpp"


@@ 34,5 34,4 @@ namespace app::bell_settings
    {
        settings.setValue(temperatureUnit, utils::temperature::unitToStr(unit), settings::SettingsScope::Global);
    }

} // namespace app::bell_settings

M products/BellHybrid/apps/application-bell-settings/presenter/LayoutWindowPresenter.cpp => products/BellHybrid/apps/application-bell-settings/presenter/LayoutWindowPresenter.cpp +24 -19
@@ 2,7 2,6 @@
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "LayoutWindowPresenter.hpp"
#include <service-appmgr/Controller.hpp>
#include <common/layouts/BaseHomeScreenLayoutProvider.hpp>
#include <appmgr/messages/ChangeHomescreenLayoutMessage.hpp>



@@ 10,17 9,22 @@
#include <Temperature.hpp>
#include <service-appmgr/ServiceApplicationManagerName.hpp>

constexpr auto alarmTime              = 0;
constexpr auto clockTime              = 0;
constexpr Store::Battery batteryState = {
    .levelState = Store::Battery::LevelState::Normal,
    .state      = Store::Battery::State::Discharging,
    .level      = 100,
};
constexpr utils::temperature::Temperature temperature = {
    .unit  = utils::temperature::Temperature::Unit::Celsius,
    .value = 21.0f,
};
namespace
{
    constexpr auto alarmTime = 0;
    constexpr auto clockTime = 0;

    constexpr Store::Battery batteryState = {
        .levelState = Store::Battery::LevelState::Normal,
        .state      = Store::Battery::State::Discharging,
        .level      = 100,
    };

    constexpr utils::temperature::Temperature temperature = {
        .unit  = utils::temperature::Temperature::Unit::Celsius,
        .value = 21.0f,
    };
} // namespace

namespace app::bell_settings
{


@@ 37,8 41,9 @@ namespace app::bell_settings
    std::vector<gui::Item *> LayoutWindowPresenter::getLayouts() const
    {
        std::vector<gui::Item *> layouts;
        layouts.reserve(layoutOptions.size());

        for (auto const &[option, _] : layoutOptions) {
        for (const auto &[option, _] : layoutOptions) {
            layouts.push_back(option->getLayout());
        }



@@ 47,9 52,9 @@ namespace app::bell_settings

    gui::Item *LayoutWindowPresenter::getSelectedLayout() const
    {
        const auto layoutSelected = layoutModel->getValue();
        const auto &layoutSelected = layoutModel->getValue();

        for (auto const &[option, name] : layoutOptions) {
        for (const auto &[option, name] : layoutOptions) {
            if (name == layoutSelected) {
                return option->getLayout();
            }


@@ 60,11 65,11 @@ namespace app::bell_settings

    void LayoutWindowPresenter::setLayout(gui::Item *selectedLayout)
    {
        for (auto const &[option, name] : layoutOptions) {
        for (const auto &[option, name] : layoutOptions) {
            if (option->getLayout() == selectedLayout) {
                layoutModel->setValue(name);
                auto layoutChangeRequest = std::make_shared<ChangeHomescreenLayoutMessage>(name);
                app->bus.sendUnicast(layoutChangeRequest, service::name::appmgr);
                app->bus.sendUnicast(std::move(layoutChangeRequest), service::name::appmgr);
                break;
            }
        }


@@ 72,7 77,7 @@ namespace app::bell_settings

    void LayoutWindowPresenter::initLayoutOptions()
    {
        quoteModel->setCallback([=](std::string quote, std::string author) {
        quoteModel->setCallback([=](const auto &quote, const auto &author) {
            for (auto &[layout, _] : layoutOptions) {
                layout->setQuoteText(quote, author);
            }


@@ 92,7 97,7 @@ namespace app::bell_settings
            layout->setAlarmTime(alarmTime);
            layout->setBatteryLevelState(batteryState);
            layout->setTemperature(temperature);
            layoutOptions.push_back({layout, layoutEntry.first});
            layoutOptions.emplace_back(layout, layoutEntry.first);
        }
    }
} // namespace app::bell_settings

M products/BellHybrid/apps/common/include/common/layouts/BaseHomeScreenLayoutProvider.hpp => products/BellHybrid/apps/common/include/common/layouts/BaseHomeScreenLayoutProvider.hpp +4 -4
@@ 27,7 27,7 @@ namespace app::home_screen
        AlarmSnoozed,
        PreWakeUpActive
    };
};
}

namespace gui
{


@@ 40,7 40,7 @@ namespace gui
        std::string name;

      public:
        BaseHomeScreenLayoutProvider(std::string name) : name{std::move(name)} {};
        explicit BaseHomeScreenLayoutProvider(std::string name) : name{std::move(name)} {};
        virtual ~BaseHomeScreenLayoutProvider() noexcept = default;

        std::string getName()


@@ 54,7 54,7 @@ namespace gui
        virtual void updateUsbStatus(bool isConnected)                          = 0;
        virtual void setTime(std::time_t newTime)                               = 0;
        virtual void setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt)    = 0;
        virtual std::time_t getAlarmTime() const                                = 0;
        [[nodiscard]] virtual std::time_t getAlarmTime() const                  = 0;
        virtual void setAlarmTime(std::time_t newTime)                          = 0;
        virtual SnoozeTimer *getSnoozeTimer()                                   = 0;
        virtual Item *getLayout()                                               = 0;


@@ 65,4 65,4 @@ namespace gui
        virtual void setSnoozeTime(std::time_t newTime){};
        virtual void setQuoteText(const UTF8 &quoteContent, const UTF8 &quoteAuthor){};
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassic.hpp +23 -25
@@ 9,16 9,15 @@

namespace style::homescreen_classic
{
    constexpr inline auto status_box_layout_w          = 350U;
    constexpr inline auto info_box_layout_h            = 70U;
    constexpr inline auto connection_box_layout_h      = 44U;
    constexpr inline auto connection_box_top_margin    = 20U;
    constexpr inline auto connection_box_bottom_margin = -20;

    inline constexpr auto status_box_layout_w{350U};
    inline constexpr auto info_box_layout_h{70U};
    inline constexpr auto connection_box_layout_h{44U};
    inline constexpr auto connection_box_top_margin{20U};
    inline constexpr auto connection_box_bottom_margin{-20};
} // namespace style::homescreen_classic

namespace gui
{

    class BellBaseLayout;
    class TextFixedSize;
    class AlarmSetSpinner;


@@ 54,20 53,19 @@ namespace gui
    class HomeScreenLayoutClassic : public BaseHomeScreenLayoutProvider, protected BellBaseLayout
    {
      public:
        HomeScreenLayoutClassic(std::string name);
        explicit HomeScreenLayoutClassic(std::string name);

        virtual auto setViewState(app::home_screen::ViewState state) -> void override;
        virtual auto setTime(std::time_t newTime) -> void override;
        auto setViewState(app::home_screen::ViewState state) -> void override;
        auto setTime(std::time_t newTime) -> void override;
        auto setTextDescription(const UTF8 &desc) -> void override;
        auto setBatteryLevelState(const Store::Battery &batteryContext) -> void override;
        auto setTimeFormat(utils::time::Locale::TimeFormat fmt) -> void override;
        auto setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt) -> void override;
        auto setSnoozeFormat(utils::time::Locale::TimeFormat fmt) -> void override;
        auto getAlarmTime() const -> std::time_t override;
        [[nodiscard]] auto getAlarmTime() const -> std::time_t override;
        auto setAlarmTime(std::time_t newTime) -> void override;
        auto setSnoozeTime(std::time_t newTime) -> void override;
        auto updateUsbStatus(bool isConnected) -> void override;
        auto setQuoteText(const UTF8 &quoteContent, const UTF8 &quoteAuthor) -> void override;

        auto getSnoozeTimer() -> SnoozeTimer * override;
        auto getLayout() -> Item * override;


@@ 83,20 81,20 @@ namespace gui
        void adjustConnectionStatusPosition();

      protected:
        VBox *widgetBox                        = nullptr;
        HBox *timeHBox                         = nullptr;
        TimeSetFmtSpinner *time                = nullptr;
        HBox *statusBox                        = nullptr;
        HBox *infoBox                          = nullptr;
        HBox *connectionBox                    = nullptr;
        BellBattery *battery                   = nullptr;
        BellConnectionStatus *connectionStatus = nullptr;
        TextFixedSize *bottomText              = nullptr;
        AlarmSetSpinner *alarm    = nullptr;
        SnoozeTimer *snoozeTimer  = nullptr;
        Icon *lowBatteryWarning                = nullptr;
        VBox *widgetBox{nullptr};
        HBox *timeHBox{nullptr};
        TimeSetFmtSpinner *time{nullptr};
        HBox *statusBox{nullptr};
        HBox *infoBox{nullptr};
        HBox *connectionBox{nullptr};
        BellBattery *battery{nullptr};
        BellConnectionStatus *connectionStatus{nullptr};
        TextFixedSize *bottomText{nullptr};
        AlarmSetSpinner *alarm{nullptr};
        SnoozeTimer *snoozeTimer{nullptr};
        Icon *lowBatteryWarning{nullptr};

        std::function<void()> onShowMessage;
        std::function<void()> onHideMessage;
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithAmPm.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithAmPm.hpp +3 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 10,7 10,7 @@ namespace gui
    class HomeScreenLayoutClassicWithAmPm : public HomeScreenLayoutClassic
    {
      public:
        HomeScreenLayoutClassicWithAmPm(std::string name);
        explicit HomeScreenLayoutClassicWithAmPm(std::string name);

        auto setTime(std::time_t newTime) -> void override;



@@ 21,4 21,4 @@ namespace gui

        TextFixedSize *fmt{};
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithBattery.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithBattery.hpp +3 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 10,9 10,9 @@ namespace gui
    class HomeScreenLayoutClassicWithBattery : public HomeScreenLayoutClassic
    {
      public:
        HomeScreenLayoutClassicWithBattery(std::string name);
        explicit HomeScreenLayoutClassicWithBattery(std::string name);

      protected:
        bool isBatteryVisibilityAllowed(const Store::Battery &batteryContext) override;
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithDate.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithDate.hpp +4 -5
@@ 10,7 10,7 @@ namespace gui
    class HomeScreenLayoutClassicWithDate : public HomeScreenLayoutClassic
    {
      public:
        HomeScreenLayoutClassicWithDate(std::string name);
        explicit HomeScreenLayoutClassicWithDate(std::string name);

        void setTime(std::time_t newTime) override;
        void setTimeFormat(utils::time::Locale::TimeFormat fmt) override;


@@ 19,8 19,7 @@ namespace gui
        void buildInterface() override;
        bool isBatteryVisibilityAllowed(const Store::Battery &batteryContext) override;

        Text *date          = nullptr;
        TextFixedSize *ampm = nullptr;
        bool showAMPM       = false;
        Text *date{nullptr};
        TextFixedSize *ampm{nullptr};
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithQuotes.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithQuotes.hpp +1 -1
@@ 27,4 27,4 @@ namespace gui
        void hideQuotes();
        void adjustWidgetBox();
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithQuotesAmPm.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithQuotesAmPm.hpp +1 -1
@@ 20,4 20,4 @@ namespace gui

        TextFixedSize *ampm{nullptr};
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithTemp.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutClassicWithTemp.hpp +6 -7
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 7,23 7,22 @@

namespace style::homescreen_classic
{
    constexpr inline auto temperature_w = 170U;
    constexpr inline auto temperature_h = 102U;
    inline constexpr auto temperature_w{170U};
    inline constexpr auto temperature_h{102U};
} // namespace style::homescreen_classic

namespace gui
{

    class HomeScreenLayoutClassicWithTemp : public HomeScreenLayoutClassic
    {
      public:
        HomeScreenLayoutClassicWithTemp(std::string name);
        explicit HomeScreenLayoutClassicWithTemp(std::string name);

        auto setTemperature(utils::temperature::Temperature newTemp) -> void override;

      protected:
        auto buildInterface() -> void override;

        TextFixedSize *tempText{};
        TextFixedSize *tempText{nullptr};
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutNames.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutNames.hpp +14 -16
@@ 3,24 3,22 @@

#pragma once

namespace gui
#include <ProductConfig.hpp>

namespace gui::layout
{
    namespace layout
    {
        constexpr auto Classic               = "Classic";
        constexpr auto ClassicWithBattery    = "ClassicWithBattery";
        constexpr auto ClassicWithAmPm       = "ClassicWithAmPm";
        constexpr auto ClassicWithDate       = "ClassicWithDate";
        constexpr auto ClassicWithQuotes     = "ClassicWithQuotes";
        constexpr auto ClassicWithQuotesAmPm = "ClassicWithQuotesAmPm";
        constexpr auto VerticalSimple        = "VerticalSimple";
        constexpr auto VerticalWithDate      = "VerticalWithDate";
        constexpr auto VerticalWithAmPm      = "VerticalWithAmPm";
        constexpr auto VerticalWithDateAmPm  = "VerticalWithDateAmPm";
    inline constexpr auto Classic               = "Classic";
    inline constexpr auto ClassicWithBattery    = "ClassicWithBattery";
    inline constexpr auto ClassicWithAmPm       = "ClassicWithAmPm";
    inline constexpr auto ClassicWithDate       = "ClassicWithDate";
    inline constexpr auto ClassicWithQuotes     = "ClassicWithQuotes";
    inline constexpr auto ClassicWithQuotesAmPm = "ClassicWithQuotesAmPm";
    inline constexpr auto VerticalSimple        = "VerticalSimple";
    inline constexpr auto VerticalWithDate      = "VerticalWithDate";
    inline constexpr auto VerticalWithAmPm      = "VerticalWithAmPm";
    inline constexpr auto VerticalWithDateAmPm  = "VerticalWithDateAmPm";

#if CONFIG_ENABLE_TEMP == 1
        constexpr auto ClassicWithTemp = "ClassicWithTemp";
    inline constexpr auto ClassicWithTemp = "ClassicWithTemp";
#endif

    } // namespace layout
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVertical.hpp +6 -7
@@ 11,7 11,6 @@

namespace gui
{

    class BellBaseLayout;
    class TextFixedSize;
    class AlarmIcon;


@@ 34,15 33,15 @@ namespace gui
    class HomeScreenLayoutVertical : public BaseHomeScreenLayoutProvider, public LayoutVertical
    {
      public:
        HomeScreenLayoutVertical(std::string name);
        explicit HomeScreenLayoutVertical(std::string name);

        virtual auto setViewState(app::home_screen::ViewState state) -> void override;
        virtual auto setTime(std::time_t newTime) -> void override;
        auto setViewState(app::home_screen::ViewState state) -> void override;
        auto setTime(std::time_t newTime) -> void override;
        auto setTextDescription(const UTF8 &desc) -> void override;
        auto setBatteryLevelState(const Store::Battery &batteryContext) -> void override;
        auto setTimeFormat(utils::time::Locale::TimeFormat fmt) -> void override;
        auto setAlarmTimeFormat(utils::time::Locale::TimeFormat fmt) -> void override;
        auto getAlarmTime() const -> std::time_t override;
        [[nodiscard]] auto getAlarmTime() const -> std::time_t override;
        auto setAlarmTime(std::time_t newTime) -> void override;
        auto updateUsbStatus(bool isConnected) -> void override;
        void setQuoteText(const UTF8 &quoteContent, const UTF8 &quoteAuthor) override;


@@ 54,6 53,6 @@ namespace gui
        auto setScreenMode(ScreenMode mode) -> void;
        virtual bool isBatteryVisibilityAllowed(const Store::Battery &batteryContext);
        virtual bool isAlarmTimeVisibilityAllowed();
        bool isBatteryCharging(const Store::Battery::State state);
        bool isBatteryCharging(Store::Battery::State state);
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalSimple.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalSimple.hpp +3 -3
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 11,6 11,6 @@ namespace gui
    class HomeScreenLayoutVerticalSimple : public HomeScreenLayoutVertical
    {
      public:
        HomeScreenLayoutVerticalSimple(std::string name);
        explicit HomeScreenLayoutVerticalSimple(std::string name);
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalWithAmPm.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalWithAmPm.hpp +5 -5
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 7,9 7,9 @@

namespace style::homescreen_vertical_ampm
{
    constexpr inline auto alarm_margin_top   = 83U;
    constexpr inline auto battery_margin_bot = 68U;
    constexpr inline auto ampm_margin_bot    = 77U;
    inline constexpr auto alarm_margin_top{83U};
    inline constexpr auto battery_margin_bot{68U};
    inline constexpr auto ampm_margin_bot{77U};
} // namespace style::homescreen_vertical_ampm

namespace gui


@@ 24,4 24,4 @@ namespace gui

        TextFixedSize *ampm{};
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalWithDate.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayoutVerticalWithDate.hpp +5 -6
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 7,17 7,16 @@

namespace style::homescreen_vertical_date
{
    constexpr inline auto margin_top = 64U;
    constexpr inline auto margin_bot = 70U;
    inline constexpr auto margin_top{64U};
    inline constexpr auto margin_bot{70U};
} // namespace style::homescreen_vertical_date

namespace gui
{

    class HomeScreenLayoutVerticalWithDate : public HomeScreenLayoutVertical
    {
      public:
        HomeScreenLayoutVerticalWithDate(std::string name);
        explicit HomeScreenLayoutVerticalWithDate(std::string name);

        void setTime(std::time_t newTime) override;
        void setTimeFormat(utils::time::Locale::TimeFormat fmt) override;


@@ 29,4 28,4 @@ namespace gui
        TextFixedSize *ampm = nullptr;
        TextFixedSize *date = nullptr;
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayouts.hpp => products/BellHybrid/apps/common/include/common/layouts/HomeScreenLayouts.hpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 20,4 20,4 @@ namespace gui
        std::map<std::string, LayoutGenerator> getAllLayouts();
        std::string getDefaultLayout();
    } // namespace factory
};    // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/ShortcutsLayoutProvider.hpp => products/BellHybrid/apps/common/include/common/layouts/ShortcutsLayoutProvider.hpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 27,4 27,4 @@ namespace gui

        virtual Item *getLayout() = 0;
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/ShortcutsLayouts.hpp => products/BellHybrid/apps/common/include/common/layouts/ShortcutsLayouts.hpp +3 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once


@@ 10,10 10,11 @@
namespace gui
{
    class ShortcutsLayoutProvider;

    using LayoutGenerator = std::function<ShortcutsLayoutProvider *()>;

    namespace factory
    {
        std::vector<LayoutGenerator> getLayouts();
    } // namespace factory
};    // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayoutClassic.hpp => products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayoutClassic.hpp +1 -1
@@ 40,4 40,4 @@ namespace gui

        auto buildInterface(const Instruction &instruction) -> void;
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayoutProvider.hpp => products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayoutProvider.hpp +1 -1
@@ 27,4 27,4 @@ namespace gui

        virtual Item *getLayout() = 0;
    };
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayouts.hpp => products/BellHybrid/apps/common/include/common/layouts/UpdateInstructionLayouts.hpp +2 -1
@@ 10,10 10,11 @@
namespace gui
{
    class UpdateInstructionLayoutProvider;

    using LayoutGenerator = std::function<UpdateInstructionLayoutProvider *()>;

    namespace factory
    {
        std::vector<LayoutGenerator> getUpdateInstructionLayouts();
    } // namespace factory
};    // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassic.cpp +2 -6
@@ 20,7 20,7 @@

namespace
{
    constexpr auto dischargingLevelShowTop = 20;
    constexpr auto dischargingLevelShowTop{20};

    bool isBatteryCharging(const Store::Battery::State state)
    {


@@ 406,8 406,4 @@ namespace gui
            }
        }
    }

    auto HomeScreenLayoutClassic::setQuoteText(const UTF8 &quoteContent, const UTF8 &quoteAuthor) -> void
    {}

}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithAmPm.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutClassicWithAmPm.hpp"


@@ 65,4 65,4 @@ namespace gui
        }
        HomeScreenLayoutClassic::handleContentChanged();
    }
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithBattery.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithBattery.cpp +2 -2
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include <common/layouts/HomeScreenLayoutClassicWithBattery.hpp>


@@ 14,4 14,4 @@ namespace gui
    {
        return true;
    }
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithDate.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithDate.cpp +1 -1
@@ 86,4 86,4 @@ namespace gui
    {
        return true;
    }
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithQuotesAmPm.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithQuotesAmPm.cpp +1 -2
@@ 58,5 58,4 @@ namespace gui
            ampm->setVisible(false);
        }
    }

}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithTemp.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutClassicWithTemp.cpp +8 -4
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutClassicWithTemp.hpp"


@@ 20,17 20,21 @@ namespace gui
    {
        using namespace bellMainStyle;

        tempText = new TextFixedSize(statusBox);
        tempText = new TextFixedSize(nullptr);
        tempText->setMaximumSize(style::homescreen_classic::temperature_w, style::homescreen_classic::temperature_h);
        tempText->setAlignment(Alignment(Alignment::Horizontal::Center, Alignment::Vertical::Center));
        tempText->setFont(mainWindow::bottomDescription::font_normal);
        tempText->setEdges(RectangleEdge::None);
        tempText->activeItem = false;
        tempText->drawUnderline(false);
        tempText->setMargins(Margins(0, style::bell_base_layout::info_box_top_margin, 0, 0));

        infoBox->addWidget(tempText);
    }

    auto HomeScreenLayoutClassicWithTemp::setTemperature(utils::temperature::Temperature newTemp) -> void
    {
        tempText->setText(utils::temperature::tempToStrDec(newTemp));
        statusBox->resizeItems();
        infoBox->resizeItems();
    }
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVertical.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVertical.cpp +3 -4
@@ 18,7 18,7 @@

namespace
{
    constexpr auto dischargingLevelShowTop = 20;
    constexpr auto dischargingLevelShowTop{20};
} // namespace

namespace gui


@@ 158,7 158,7 @@ namespace gui
        return false;
    }

    bool HomeScreenLayoutVertical::isBatteryCharging(const Store::Battery::State state)
    bool HomeScreenLayoutVertical::isBatteryCharging(Store::Battery::State state)
    {
        using State = Store::Battery::State;
        return (state == State::Charging) || (state == State::ChargingDone);


@@ 212,5 212,4 @@ namespace gui
        connectionStatus->show(isConnected);
        connectionStatus->informContentChanged();
    }

}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalSimple.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalSimple.cpp +1 -3
@@ 1,10 1,9 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutVerticalSimple.hpp"
#include "data/BellMainStyle.hpp"
#include "widgets/BellBattery.hpp"
#include "widgets/DuoHBox.hpp"
#include "widgets/SnoozeTimer.hpp"

#include <apps-common/actions/AlarmRingingData.hpp>


@@ 12,7 11,6 @@
#include <gui/widgets/Icon.hpp>
#include <gui/widgets/text/TextFixedSize.hpp>
#include <gui/widgets/Style.hpp>
#include <time/time_constants.hpp>
#include <widgets/AlarmIcon.hpp>
#include <widgets/AlarmSetSpinner.hpp>
#include <widgets/ClockVertical.hpp>

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalWithAmPm.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalWithAmPm.cpp +2 -4
@@ 1,4 1,4 @@
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutVerticalWithAmPm.hpp"


@@ 7,11 7,9 @@
#include "widgets/SnoozeTimer.hpp"

#include <apps-common/actions/AlarmRingingData.hpp>
#include <gui/input/InputEvent.hpp>
#include <gui/widgets/Icon.hpp>
#include <gui/widgets/text/TextFixedSize.hpp>
#include <gui/widgets/Style.hpp>
#include <time/time_constants.hpp>
#include <widgets/AlarmIcon.hpp>
#include <widgets/AlarmSetSpinner.hpp>
#include <widgets/ClockVertical.hpp>


@@ 67,4 65,4 @@ namespace gui
        const auto isPM  = date::is_pm(hours);
        ampm->setText(isPM ? utils::time::Locale::getPM() : utils::time::Locale::getAM());
    }
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalWithDate.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayoutVerticalWithDate.cpp +2 -5
@@ 1,4 1,4 @@
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "layouts/HomeScreenLayoutVerticalWithDate.hpp"


@@ 7,16 7,13 @@
#include "widgets/SnoozeTimer.hpp"

#include <apps-common/actions/AlarmRingingData.hpp>
#include <gui/input/InputEvent.hpp>
#include <gui/widgets/Icon.hpp>
#include <gui/widgets/text/TextFixedSize.hpp>
#include <gui/widgets/Style.hpp>

#include <widgets/AlarmIcon.hpp>
#include <widgets/AlarmSetSpinner.hpp>
#include <widgets/ClockVertical.hpp>

#include <time/time_constants.hpp>
#include <time/dateCommon.hpp>
#include <service-time/api/TimeSettingsApi.hpp>



@@ 116,4 113,4 @@ namespace gui
    {
        return true;
    }
}; // namespace gui
} // namespace gui

M products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp => products/BellHybrid/apps/common/src/layouts/HomeScreenLayouts.cpp +2 -2
@@ 1,4 1,3 @@

// Copyright (c) 2017-2024, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md



@@ 73,7 72,8 @@ namespace gui::factory
#if CONFIG_ENABLE_TEMP == 1
            ,
            {
                "ClassicWithTemp", []() { return new HomeScreenLayoutClassicWithTemp("ClassicWithTemp"); }
                gui::layout::ClassicWithTemp,
                    []() { return new HomeScreenLayoutClassicWithTemp(gui::layout::ClassicWithTemp); }
            }
#endif
        };

M products/BellHybrid/apps/common/src/layouts/ShortcutsLayoutClassic.cpp => products/BellHybrid/apps/common/src/layouts/ShortcutsLayoutClassic.cpp +8 -8
@@ 12,25 12,25 @@ namespace
{
    namespace container
    {
        constexpr auto width      = 544U;
        constexpr auto height     = 220U;
        constexpr auto top_margin = 74U;
        constexpr auto width{544U};
        constexpr auto height{220U};
        constexpr auto top_margin{74U};

        namespace separator
        {
            constexpr auto height = 22U;
            constexpr auto height{22U};
        } // namespace separator

        namespace image
        {
            constexpr auto height = container::height - separator::height;
            constexpr auto width  = 448U;
            constexpr auto height{container::height - separator::height};
            constexpr auto width{448U};
        } // namespace image

        namespace text
        {
            constexpr auto height = 146U;
            constexpr auto width  = 448U;
            constexpr auto height{146U};
            constexpr auto width{448U};
        } // namespace text
    } // namespace container
} // namespace

M products/BellHybrid/apps/common/src/layouts/UpdateInstructionLayoutClassic.cpp => products/BellHybrid/apps/common/src/layouts/UpdateInstructionLayoutClassic.cpp +20 -20
@@ 11,48 11,48 @@ namespace
{
    namespace container
    {
        constexpr auto width      = 544U;
        constexpr auto height     = 436U;
        constexpr auto top_margin = 20U;
        constexpr auto width{544U};
        constexpr auto height{436U};
        constexpr auto top_margin{20U};

        namespace centerBox
        {
            constexpr auto width  = 448U;
            constexpr auto height = container::height;
            constexpr auto width{448U};
            constexpr auto height{container::height};
        } // namespace centerBox

        namespace imageBox
        {
            constexpr auto width  = centerBox::width;
            constexpr auto height = 120U;
            constexpr auto width{centerBox::width};
            constexpr auto height{120U};
        } // namespace imageBox

        namespace title
        {
            constexpr auto height        = 56U;
            constexpr auto width         = centerBox::width;
            constexpr auto font          = style::window::font::large;
            constexpr auto bottom_margin = 32U;
            constexpr auto height{56U};
            constexpr auto width{centerBox::width};
            constexpr auto font{style::window::font::large};
            constexpr auto bottom_margin{32U};
        } // namespace title

        namespace instruction
        {
            constexpr auto maxNumberOfLines = 3;
            constexpr auto width            = centerBox::width - 40U;
            constexpr auto minHeight        = 43U;
            constexpr auto maxHeight        = minHeight * maxNumberOfLines;
            constexpr auto bottom_margin    = 14U;
            constexpr auto maxNumberOfLines{3};
            constexpr auto width{centerBox::width - 40U};
            constexpr auto minHeight{43U};
            constexpr auto maxHeight{minHeight * maxNumberOfLines};
            constexpr auto bottom_margin{14U};

            namespace number
            {
                constexpr auto width = 36U;
                constexpr auto font  = style::window::font::verybiglight;
                constexpr auto width{36U};
                constexpr auto font{style::window::font::verybiglight};
            } // namespace number

            namespace text
            {
                constexpr auto width = instruction::width - number::width;
                constexpr auto font  = style::window::font::verybiglight;
                constexpr auto width{instruction::width - number::width};
                constexpr auto font{style::window::font::verybiglight};
            } // namespace text
        }     // namespace instruction
    } // namespace container

M products/BellHybrid/services/evtmgr/EventManager.cpp => products/BellHybrid/services/evtmgr/EventManager.cpp +2 -1
@@ 22,6 22,7 @@
#include <service-evtmgr/WorkerEventCommon.hpp>
#include <sys/messages/AlarmActivationStatusChangeRequest.hpp>
#include <switches/LatchState.hpp>
#include <ProductConfig.hpp>

namespace
{


@@ 49,7 50,7 @@ EventManager::EventManager(LogDumpFunction logDumpFunction, const std::string &n
#if CONFIG_ENABLE_TEMP == 1
    temperatureSource = hal::temperature::AbstractTemperatureSource::Factory::create();
    updateTemperature(*temperatureSource);
    onMinuteTick = [this](const time_t) { updateTemperature(*temperatureSource); };
    onMinuteTick = [this](std::time_t time) { updateTemperature(*temperatureSource); };
#endif
}