summaryrefslogtreecommitdiffstats
path: root/network/wifinetworkmodel.h
blob: 0df445983bfc95c8b8138f04f8504be5ee54092c (plain)
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
#ifndef WIFI_NETWORK_MODEL_H
#define WIFI_NETWORK_MODEL_H

#include <QAbstractListModel>
#include <QStringList>
#include <QtQml/QQmlContext>
#include <QJsonObject>

class WifiNetwork
{
    public:
        WifiNetwork(const QString &address,
                    const QString &security,
                    const QString &service,
                    const QString &ssid,
                    const QString &state,
                    const int &strength);
        QString address() const;
        QString service() const;
        QString ssid() const;
        QString security() const;
        QString state() const;
        int strength() const;
        void setAddress(const QString address);
        void setState(const QString state);
        void setStrength(const int strength);

    private:
        QString m_address;
        QString m_security;
        QString m_service;
        QString m_ssid;
        QString m_state;
        int m_strength;
};

class WifiNetworkModel : public QAbstractListModel
{
    Q_OBJECT

    public:
        enum WifiNetworkRoles {
            AddressRole = Qt::UserRole + 1,
            SecurityRole,
            ServiceRole,
            SsidRole,
            StateRole,
            StrengthRole
        };

        WifiNetworkModel(QObject *parent = Q_NULLPTR);

        void addNetwork(WifiNetwork *network);
        void removeNetwork(WifiNetwork *network);
        void removeAllNetworks();
        WifiNetwork *getNetwork(QString service);
        int rowCount(const QModelIndex &parent = QModelIndex()) const;
        QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
        void updateProperties(QString service, QJsonObject properties);

    signals:
        void strengthChanged(int strength);

    protected:
        QHash<int, QByteArray> roleNames() const;

    private:
        QList<WifiNetwork *> m_networks;
        QModelIndex indexOf(WifiNetwork *network);
};
#endif // WIFI_NETWORK_MODEL_H
ot;Freescale/meta-freescale" path="meta-freescale" remote="github" revision="06178400afbd641a6709473fd21d893dcd3cfbfa" upstream="pyro"/> <project name="Freescale/meta-freescale-3rdparty" path="meta-freescale-3rdparty" remote="github" revision="35badbde05d4f10d4faeefc30bc126b5bd228e2e" upstream="pyro"/> <project name="Freescale/meta-freescale-distro" path="meta-freescale-distro" remote="github" revision="cd5c7a2539f40004f74126e9fdf08254fd9a6390" upstream="pyro"/> --> <!-- consolidate on meta-freescale from git.yoctoproject.org --> <project name="meta-freescale" path="meta-freescale" remote="yocto" revision="71a54c7b50221800fa4c90c30a425c2f119db3bc" upstream="rocko"/> <!-- Boundary devices bsp layer --> <project name="boundarydevices/meta-boundary" path="meta-boundary" remote="github" revision="f96f41b2e5beda2b51acb702d082568898b36a68" upstream="rocko"/> <!-- ti vayu / jacinto 6 / DRA7 --> <project name="meta-ti" path="meta-ti" remote="yocto" revision="ed83a43c6a76875ee5f0388b3b60a28f2a373a10" upstream="rocko"/> <!-- iotivity --> <project name="meta-oic" path="meta-oic" remote="yocto" revision="70d5bec59a3b8aabaa4a69f1d8513ff22d86b473" upstream="1.2.1"/> <!-- rpi 2, 3 and 3 B+ --> <project name="meta-raspberrypi" path="meta-raspberrypi" remote="yocto" revision="9e08912bbaadaac9e1a15a3d003ca66d769cc9b9" upstream="rocko"/> <!-- DragonBoard 410c specific things --> <project name="meta-qcom" path="meta-qcom" remote="yocto" revision="7f06e9f1ce105b70a4bbec836626ba534f97f0f8" upstream="rocko"/> <!-- Altera SOCFPGA platform --> <!-- pinned to version from master until branch for morty exists --> <!-- https://github.com/kraj/meta-altera --> <project name="kraj/meta-altera" path="meta-altera" remote="github" revision="094f4c84da21e199134056f41dcf69f92cacdbd9" upstream="rocko"/> <!-- Image Security Analysis FrameWork (isafw) --> <!-- try master or disable --> <project name="01org/meta-security-isafw" path="meta-security-isafw" remote="github" revision="489abdc65cefb566d696c8b218aa0b9b99a350ae" upstream="master"/> <!-- Security layer --> <project name="meta-security" path="meta-security" remote="yocto" revision="8f6969a775fa6afbf553e72ba83e71197780b2d8" upstream="master"/> <!-- SmartDeviceLink layer --> <project name="phongt/meta-sdl" path="meta-sdl" remote="github" revision="60c9fe8a4a9c6ca95f222685f8d6248f16236f2a" upstream="release/4.4.0"/> </manifest>