~aleteoryx/muditaos

ref: 1da915ace94b631914c768efcb878e0a6393195e muditaos/module-apps/application-clock/ApplicationClock.hpp -rw-r--r-- 1.8 KiB
1da915ac — Wojtek Rzepecki [BH-777] Add Bell specific ld script configuration 4 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// 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"
#include "Service/Message.hpp"
#include "gui/widgets/Label.hpp"
#include "gui/widgets/Image.hpp"
#include "gui/widgets/ProgressBar.hpp"
#include "module-sys/Timers/TimerHandle.hpp"

namespace app
{
    const inline std::string name_clock = "ApplicationClock";

    class ApplicationClock : public Application
    {
        sys::TimerHandle timerClock;
        void timerClockCallback();

      public:
        ApplicationClock(std::string name                    = name_clock,
                         std::string parent                  = {},
                         sys::phone_modes::PhoneMode mode    = sys::phone_modes::PhoneMode::Connected,
                         StartInBackground startInBackground = {false},
                         uint32_t stackDepth                 = 4096,
                         sys::ServicePriority priority       = sys::ServicePriority::Idle);

        sys::MessagePointer DataReceivedHandler(sys::DataMessage *msgl, sys::ResponseMessage *resp) override;
        sys::ReturnCodes InitHandler() override;
        sys::ReturnCodes DeinitHandler() override;

        sys::ReturnCodes SwitchPowerModeHandler(const sys::ServicePowerMode mode) override final
        {
            return sys::ReturnCodes::Success;
        }

        void createUserInterface() override;
        void destroyUserInterface() override;
    };

    template <> struct ManifestTraits<ApplicationClock>
    {
        static auto GetManifest() -> manager::ApplicationManifest
        {
            return {{manager::actions::Launch, manager::actions::PhoneModeChanged}};
        }
    };
} /* namespace app */