~aleteoryx/muditaos

ref: dbdcaf300351c016dd4577c5c22b1019adcc69f8 muditaos/module-gui/gui/widgets/TopBar/NetworkAccessTechnologyWidget.cpp -rw-r--r-- 1.6 KiB
dbdcaf30 — Alek Rudnik [EGD-5821] Add Network Access Technology widget 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
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved.
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md

#include "NetworkAccessTechnologyWidget.hpp"
#include "Item.hpp"

namespace gui
{
    NetworkAccessTechnologyWidget::NetworkAccessTechnologyWidget(
        Item *parent, uint32_t x, uint32_t y, uint32_t w, uint32_t h)
        : StatusBarWidgetBase(parent, x, y, w, h)
    {
        setFilled(false);
        setBorderColor(gui::ColorNoColor);
        setFont(style::header::font::modes);
        setAlignment(gui::Alignment(gui::Alignment::Horizontal::Left, gui::Alignment::Vertical::Center));
    }

    void NetworkAccessTechnologyWidget::update(const Store::Network::AccessTechnology accessTechnology)
    {
        _accessTechnology      = accessTechnology;
        constexpr auto text2g  = "2G";
        constexpr auto text3g  = "3G";
        constexpr auto textLte = "LTE";

        switch (accessTechnology) {
        case Store::Network::AccessTechnology::Gsm:
        case Store::Network::AccessTechnology::GsmWEgprs:
            setText(text2g);
            break;
        case Store::Network::AccessTechnology::Utran:
        case Store::Network::AccessTechnology::UtranWHsdpa:
        case Store::Network::AccessTechnology::UtranWHsupa:
        case Store::Network::AccessTechnology::UtranWHsdpaAndWHsupa:
            setText(text3g);
            break;
        case Store::Network::AccessTechnology::EUtran:
            setText(textLte);
            break;
        case Store::Network::AccessTechnology::Unknown:
            setText("");
            break;
        }
    }
} // namespace gui