~aleteoryx/muditaos

ref: 21a7855d8c229f7893bc60a9b2fab1ae0615cbf6 muditaos/module-apps/application-settings/windows/BtScanWindow.hpp -rw-r--r-- 1.4 KiB
21a7855d — Kuba [EGD-6973] Fix Auto date is on by default 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
// 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 <functional>
#include <string>

#include "AppWindow.hpp"
#include "gui/widgets/Image.hpp"
#include "gui/widgets/Label.hpp"
#include "gui/widgets/Window.hpp"
#include <BoxLayout.hpp>
#include <memory>
#include <service-bluetooth/BluetoothMessage.hpp>

namespace gui
{
    namespace name::window
    {
        inline constexpr auto name_btscan = "BT_SCAN";
    }

    class BtScanWindow : public AppWindow
    {
      protected:
        VBox *box;

      public:
        BtScanWindow(app::Application *app, std::vector<Devicei> devices = {});

        void onBeforeShow(ShowMode mode, SwitchData *data) override;
        void rebuild() override;
        void buildInterface() override;
        auto onInput(const InputEvent &inputEvent) -> bool override;
        void destroyInterface() override;

      private:
        void invalidate() noexcept;
        std::vector<Devicei> devices;
    };

    class DeviceData : public SwitchData
    {
        std::vector<Devicei> devices;

      public:
        DeviceData(std::vector<Devicei> devices) : SwitchData(), devices(std::move(devices))
        {}
        auto getDevices() -> const std::vector<Devicei> &
        {
            return devices;
        }
    };
} // namespace gui