~aleteoryx/muditaos

ref: 7188802f8e1bed65994ccf777407f88467bb2bb7 muditaos/module-services/service-appmgr/include/service-appmgr/Actions.hpp -rw-r--r-- 2.5 KiB
7188802f — Mateusz Grzegorzek [BH-669] Fix CMake in service-appmgr 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
// 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-gui/gui/SwitchData.hpp>

#include <memory>
#include <string>
#include <vector>

namespace app::manager
{
    class ActionRequest; // Forward declaration.

    namespace actions
    {
        using ActionId        = int;
        using ActionParams    = gui::SwitchData;
        using ActionParamsPtr = std::unique_ptr<ActionParams>;

        enum Action : ActionId
        {
            Home,
            AutoLock,
            Launch,
            Call,
            AbortCall,
            ActivateCall,
            HandleOutgoingCall,
            HandleIncomingCall,
            HandleCallerId,
            NotAnEmergencyNotification,
            NoSimNotification,
            Dial,
            EmergencyDial,
            ShowCallLog,
            CreateSms,
            ShowSmsTemplates,
            ShowContacts,
            ShowEmergencyContacts,
            AddContact,
            EditContact,
            ShowContactDetails,
            ShowSpecialInput,
            ShowAlarm,
            ShowMMIResult,
            ShowMMIResponse,
            ShowMMIPush,
            SmsRejectNoSim,
            DisplayLowBatteryScreen,
            SystemBrownout,
            DisplayLogoAtExit,
            SMSRejectedByOfflineNotification,
            CallRejectedByOfflineNotification,
            PhoneModeChanged,
            NotificationsChanged,
            ShowPopup,
            AbortPopup,
            UserAction // The last enumerator in the Action enum.
                       // All user-defined actions shall have values greater than UserAction.
                       // All system-wide actions shall have values lesser than UserAction.
        };

        enum class ActionFlag
        {
            None,
            AcceptWhenInBackground /// Accepts actions even if in background.
        };

        struct RegisteredAction
        {
            constexpr RegisteredAction(ActionId id, ActionFlag flag = ActionFlag::None) : id{id}, flag{flag}
            {}

            const ActionId id;
            const ActionFlag flag;
        };
        using ActionFilter = std::vector<RegisteredAction>;

        class ConvertibleToAction
        {
          public:
            virtual ~ConvertibleToAction() noexcept = default;

            virtual auto toAction() const -> std::unique_ptr<ActionRequest> = 0;
        };
    } // namespace actions
} // namespace app::manager