~aleteoryx/muditaos

ref: 684ecb7a786f128036b88fc7c2e4484ee7c044bb muditaos/module-services/service-gui/service-gui/ServiceGUIStateManager.hpp -rw-r--r-- 1.1 KiB
684ecb7a — Lukasz Mastalerz [BH-1767] Fix the pre-revert issue inside ServiceGUI 2 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
// Copyright (c) 2017-2023, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once
namespace service::gui
{
    enum class RenderingState
    {
        Idle,
        Rendering
    };

    enum class DisplayingState
    {
        Idle,
        Displaying
    };

    enum class ServiceGUIState
    {
        Initializing,
        Running,
        Closing,
        Closed
    };

    class ServiceGUIStateManager
    {
      public:
        ServiceGUIStateManager()  = default;
        ~ServiceGUIStateManager() = default;
        bool isInState(DisplayingState state);
        bool isInState(RenderingState state);
        bool isInState(ServiceGUIState state);

        void setState(DisplayingState state);
        void setState(RenderingState state);
        void setState(ServiceGUIState state);

      private:
        DisplayingState displayingState{DisplayingState::Idle};
        RenderingState renderingState{RenderingState::Idle};
        ServiceGUIState serviceState{ServiceGUIState::Initializing};
    };
} // namespace service::gui