~aleteoryx/muditaos

ref: 4f3366ee808e63a8d4e439e22a43d30c73be12f1 muditaos/module-apps/application-antenna/windows/AntennaMainWindow.hpp -rw-r--r-- 1.7 KiB
4f3366ee — Piotr Tański [EGD-4157] Actions queue added 5 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
// Copyright (c) 2017-2020, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#pragma once

#include "Application.hpp"
#include "gui/widgets/Text.hpp"
#include "windows/AppWindow.hpp"

#include "service-antenna/ServiceAntenna.hpp"
namespace gui
{

    class AntennaMainWindow : public AppWindow
    {
      protected:
        std::vector<gui::Label *> titles;

        std::vector<gui::Label *> buttons;
        gui::Text *operators = nullptr;

        gui::Label *addLabel(const UTF8 &title,
                             std::function<bool(Item &)> activatedCallback,
                             bool visibleBorder = true);
        const std::string titlesText[4] = {"CSQ: ", "Status: ", "Band: ", "Operators: "};
        enum class labelDescripion
        {
            csq       = 0,
            status    = 1,
            band      = 2,
            operators = 3
        };

        enum buttonDescriotion
        {
            AntennaA = 0,
            AntennaB,
            StartScan,
            ScanMode,
            LockAntennaManager,
            AlgoParams
        };

      public:
        AntennaMainWindow(app::Application *app);

        // virtual methods
        bool onInput(const InputEvent &inputEvent) override;
        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void rebuild() override;
        void buildInterface() override;
        void destroyInterface() override;
        void updateDebugInfo(std::vector<std::string> &data);
        void updateOperatorsScan(std::vector<std::string> &data);
        void updateAntennaButtons(bsp::cellular::antenna antenna);
        void updateLockedButton(antenna::lockState antennaState);
    };

} /* namespace gui */