-
Notifications
You must be signed in to change notification settings - Fork 10
/
wifiapi.h
157 lines (138 loc) · 4.05 KB
/
wifiapi.h
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#ifndef WIFIAPI_H
#define WIFIAPI_H
#include <QtNetwork>
#include <QList>
class WifiApi
{
public:
WifiApi(QString apiKey);
// Data Structures
struct AccessPoint {
struct Settings{
struct Lighting{
int intensity;
};
Lighting* lighting = new Lighting();
};
struct Properties{
QString name;
QString ipAddress;
QString lastSeenTime;
QString firmwareVersion;
QString hardwareModel;
bool isPrimaryPoint;
bool isBridged;
QString meshResult;
};
QString id;
Settings* settings = new Settings();
Properties* properties = new Properties();
};
struct Station{
struct Connection {
bool connected;
QString ip;
QString wirelessBand;
};
QString macAddress;
QString apId;
QString id;
QString name;
QString type;
QString ouiName;
Connection* connection = new Connection();
};
struct StationGroup{
struct Color{
double red;
double green;
double blue;
};
int id;
QString name;
QStringList memberStationIDs;
Color* color = new Color();
};
struct System{
struct Manager {
QString id;
QString email;
bool owner;
};
struct PortForwardMapping{
int wanStartPort;
int wanEndPort;
int lanStartPort;
bool forwardTcp;
QString ip;
};
struct Network{
struct WAN{
QList<PortForwardMapping*> portForwardMappings;
QString dnsMode;
};
struct LAN{
struct PrioritizedStation{
QString endTime;
QString stationId;
};
PrioritizedStation* prioritizedStation = new PrioritizedStation();
QString ipAddress;
QString netMask;
QString dhcpPoolBegin;
QString dhcpPoolEnd;
};
WAN* wan = new WAN();
LAN* lan = new LAN();
QString wlanSSID;
};
struct GuestWireless{
bool enabled;
QString SSID;
QString welcomeMatEnabled;
QString pskVisible;
};
QList<Station*> devices;
QString id;
Network* network = new Network();
GuestWireless* guestWireless;
QList<StationGroup*> deviceGroups;
QList<AccessPoint*> accessPoints;
QList<Manager*> managers;
};
// API Methods
/*!
* \brief Fetches data and settings related to the user's WiFi system.
*
* Data includes the group ID, and all currently applied settings and properties.
* \return
*/
System* fetchSystem();
/*!
* \brief Fetches all devices on the network currently.
*
*
* \return
*/
QList<Station*> fetchDevices(QString groupId);
/*!
* \brief fetches connection statuses and IDs of all wifi points within group
*
* \return
*/
// QNetworkReply fetchAccessPointStatus();
QString getOperationId(QString groupId, QString operationObject, QString opName, QString query);
QJsonObject getOperationResult(QString operationId, QString endpointSegment);
// QNetworkReply checkOperation(QString operationElement,QString operationName);
QJsonObject findValueFromJsonArray(QJsonArray arr, QString key, QString val);
void prioritizeStation(Station* station, QString endTime, QString groupId);
void removePrioritizedStation(QString groupId);
QJsonObject fetchRealtimeMetrics(QString groupId);
void setApiKey(QString apiKey);
void pauseStations(QList<Station*> station, QString expiryTimestamp, QString groupId);
private:
QString API_KEY;
};
Q_DECLARE_METATYPE(WifiApi::Station);
Q_DECLARE_METATYPE(WifiApi::Station*);
#endif // WIFIAPI_H