libPocuter 1.0 Support library for programming the Pocuter

PocuterWIFI.h
Go to the documentation of this file.
1 #ifndef POCUTERWIFI_H
2 #define POCUTERWIFI_H
3 #include <stdint.h>
4
10 class PocuterWIFI {
11 public:
12 struct wifiCredentials {
13 uint8_t ssid[32];
14 uint8_t password[64];
15 };
16 struct ipInfo {
17 uint32_t ipV4;
18 uint32_t netmask;
19 uint32_t gw;
20 };
21
22 enum AUTH_MODE {
23 WIFIAUTH_OPEN = 0,
24 WIFIAUTH_WEP,
25 WIFIAUTH_WPA_PSK,
26 WIFIAUTH_WPA2_PSK,
27 WIFIAUTH_WPA_WPA2_PSK,
28 WIFIAUTH_WPA2_ENTERPRISE,
29 WIFIAUTH_WPA3_PSK,
30 WIFIAUTH_WPA2_WPA3_PSK,
31 WIFIAUTH_WAPI_PSK,
32 WIFIAUTH_MAX
33 };
34
35 struct apInfo {
36 uint8_t ssid[33];
37 uint8_t bssid[6];
38 uint8_t channel;
39 int8_t signalStrength;
40 AUTH_MODE authMode;
41 };
42
43 enum WIFIERROR {
44 WIFIERROR_OK = 0,
45 WIFIERROR_INIT_FAILED,
46 WIFIERROR_COULD_NOT_SET_WIFI_MODE,
47 WIFIERROR_NO_CREDENTIALS,
48 WIFIERROR_WPS_TIMEOUT,
49
50
51
52
53 WIFIERROR_UNKNOWN
54
55
56 };
57 enum WIFIEVENT {
58 WIFIEVENT_DISCONNECTED,
59 WIFIEVENT_CONNECTED,
60 WIFIEVENT_TRY_CONNECTING,
61 WIFIEVENT_GOT_IP,
62 WIFIEVENT_WPS_TIMEOUT,
63 WIFIEVENT_WPS_FAILED,
64
65 };
66
67 enum WIFI_STATE {
68 WIFI_STATE_INIT_FAILED,
69 WIFI_STATE_DISCONNECTED,
70 WIFI_STATE_TRY_CONNECTING,
71 WIFI_STATE_CONNECTED,
72 WIFI_WAITING_WPS,
73 WIFI_WAITING_AP
74 };
75
76
84 typedef void (wifiEventHandler)(WIFIEVENT, void* data, void* userData);
85
91 virtual WIFI_STATE getState() = 0;
92
100 virtual void registerEventHandler(wifiEventHandler* h, void* u) = 0;
101
111 virtual WIFIERROR startWPS() = 0;
112
113
114
123 virtual WIFIERROR startAccessPoint() = 0;
124
133 virtual WIFIERROR getCredentials(wifiCredentials* c) = 0;
134
144 virtual WIFIERROR connect() = 0;
145
157 virtual WIFIERROR connect(const wifiCredentials* c) = 0;
158
172 virtual WIFIERROR scanAPs(apInfo* i, uint16_t* size, uint16_t* totalAPs) = 0;
173
183 virtual const ipInfo* getIpInfo() = 0;
184
185 private:
186
187 };
188
189
190
191 #endif /* POCUTERWIFI_H */
192
PocuterWIFI::apInfo::authMode
AUTH_MODE authMode
Definition: PocuterWIFI.h:40
PocuterWIFI::getIpInfo
virtual const ipInfo * getIpInfo()=0
get ipInfo
PocuterWIFI::WIFIAUTH_WPA2_ENTERPRISE
@ WIFIAUTH_WPA2_ENTERPRISE
Definition: PocuterWIFI.h:28
PocuterWIFI::WIFI_STATE_DISCONNECTED
@ WIFI_STATE_DISCONNECTED
Definition: PocuterWIFI.h:69
PocuterWIFI::apInfo
Definition: PocuterWIFI.h:35
PocuterWIFI::getCredentials
virtual WIFIERROR getCredentials(wifiCredentials *c)=0
get the current credentials
PocuterWIFI::ipInfo::netmask
uint32_t netmask
Definition: PocuterWIFI.h:18
PocuterWIFI::WIFIEVENT_CONNECTED
@ WIFIEVENT_CONNECTED
Definition: PocuterWIFI.h:59
PocuterWIFI::WIFIAUTH_WPA2_WPA3_PSK
@ WIFIAUTH_WPA2_WPA3_PSK
Definition: PocuterWIFI.h:30
PocuterWIFI::wifiCredentials::password
uint8_t password[64]
Definition: PocuterWIFI.h:14
PocuterWIFI::WIFIAUTH_WAPI_PSK
@ WIFIAUTH_WAPI_PSK
Definition: PocuterWIFI.h:31
PocuterWIFI::wifiCredentials
Definition: PocuterWIFI.h:12
PocuterWIFI::WIFI_WAITING_AP
@ WIFI_WAITING_AP
Definition: PocuterWIFI.h:73
PocuterWIFI::WIFIERROR_INIT_FAILED
@ WIFIERROR_INIT_FAILED
Definition: PocuterWIFI.h:45
PocuterWIFI::WIFI_STATE_CONNECTED
@ WIFI_STATE_CONNECTED
Definition: PocuterWIFI.h:71
PocuterWIFI::apInfo::channel
uint8_t channel
Definition: PocuterWIFI.h:38
PocuterWIFI::WIFIERROR_OK
@ WIFIERROR_OK
Definition: PocuterWIFI.h:44
PocuterWIFI::registerEventHandler
virtual void registerEventHandler(wifiEventHandler *h, void *u)=0
registers an event handler
PocuterWIFI::wifiCredentials::ssid
uint8_t ssid[32]
Definition: PocuterWIFI.h:13
PocuterWIFI::ipInfo::gw
uint32_t gw
Definition: PocuterWIFI.h:19
PocuterWIFI::WIFI_WAITING_WPS
@ WIFI_WAITING_WPS
Definition: PocuterWIFI.h:72
PocuterWIFI::WIFIAUTH_WPA_PSK
@ WIFIAUTH_WPA_PSK
Definition: PocuterWIFI.h:25
PocuterWIFI::apInfo::ssid
uint8_t ssid[33]
Definition: PocuterWIFI.h:36
PocuterWIFI
Pocuter WIFI configurations.
Definition: PocuterWIFI.h:10
PocuterWIFI::WIFIEVENT_TRY_CONNECTING
@ WIFIEVENT_TRY_CONNECTING
Definition: PocuterWIFI.h:60
PocuterWIFI::scanAPs
virtual WIFIERROR scanAPs(apInfo *i, uint16_t *size, uint16_t *totalAPs)=0
scan for access points
PocuterWIFI::WIFIERROR_NO_CREDENTIALS
@ WIFIERROR_NO_CREDENTIALS
Definition: PocuterWIFI.h:47
PocuterWIFI::WIFIEVENT_WPS_TIMEOUT
@ WIFIEVENT_WPS_TIMEOUT
Definition: PocuterWIFI.h:62
PocuterWIFI::WIFIERROR
WIFIERROR
Definition: PocuterWIFI.h:43
PocuterWIFI::WIFI_STATE_INIT_FAILED
@ WIFI_STATE_INIT_FAILED
Definition: PocuterWIFI.h:68
PocuterWIFI::apInfo::bssid
uint8_t bssid[6]
Definition: PocuterWIFI.h:37
PocuterWIFI::connect
virtual WIFIERROR connect()=0
connect to wifi with saved credentials
PocuterWIFI::WIFIAUTH_WPA2_PSK
@ WIFIAUTH_WPA2_PSK
Definition: PocuterWIFI.h:26
PocuterWIFI::WIFIAUTH_WPA_WPA2_PSK
@ WIFIAUTH_WPA_WPA2_PSK
Definition: PocuterWIFI.h:27
PocuterWIFI::WIFIERROR_WPS_TIMEOUT
@ WIFIERROR_WPS_TIMEOUT
Definition: PocuterWIFI.h:48
PocuterWIFI::WIFIERROR_COULD_NOT_SET_WIFI_MODE
@ WIFIERROR_COULD_NOT_SET_WIFI_MODE
Definition: PocuterWIFI.h:46
PocuterWIFI::AUTH_MODE
AUTH_MODE
Definition: PocuterWIFI.h:22
PocuterWIFI::getState
virtual WIFI_STATE getState()=0
get the state of the WIFI
PocuterWIFI::ipInfo::ipV4
uint32_t ipV4
Definition: PocuterWIFI.h:17
PocuterWIFI::WIFIAUTH_MAX
@ WIFIAUTH_MAX
Definition: PocuterWIFI.h:32
PocuterWIFI::WIFI_STATE_TRY_CONNECTING
@ WIFI_STATE_TRY_CONNECTING
Definition: PocuterWIFI.h:70
PocuterWIFI::WIFIAUTH_WPA3_PSK
@ WIFIAUTH_WPA3_PSK
Definition: PocuterWIFI.h:29
PocuterWIFI::WIFIAUTH_OPEN
@ WIFIAUTH_OPEN
Definition: PocuterWIFI.h:23
PocuterWIFI::WIFIAUTH_WEP
@ WIFIAUTH_WEP
Definition: PocuterWIFI.h:24
PocuterWIFI::WIFIEVENT
WIFIEVENT
Definition: PocuterWIFI.h:57
PocuterWIFI::wifiEventHandler
void() wifiEventHandler(WIFIEVENT, void *data, void *userData)
typedef of the event handler
Definition: PocuterWIFI.h:84
PocuterWIFI::apInfo::signalStrength
int8_t signalStrength
Definition: PocuterWIFI.h:39
PocuterWIFI::WIFIEVENT_WPS_FAILED
@ WIFIEVENT_WPS_FAILED
Definition: PocuterWIFI.h:63
PocuterWIFI::WIFIERROR_UNKNOWN
@ WIFIERROR_UNKNOWN
Definition: PocuterWIFI.h:53
PocuterWIFI::WIFIEVENT_DISCONNECTED
@ WIFIEVENT_DISCONNECTED
Definition: PocuterWIFI.h:58
PocuterWIFI::WIFI_STATE
WIFI_STATE
Definition: PocuterWIFI.h:67
PocuterWIFI::ipInfo
Definition: PocuterWIFI.h:16
PocuterWIFI::startWPS
virtual WIFIERROR startWPS()=0
starts WPS request.
PocuterWIFI::startAccessPoint
virtual WIFIERROR startAccessPoint()=0
starts an access point to set the WIFI credentials
PocuterWIFI::WIFIEVENT_GOT_IP
@ WIFIEVENT_GOT_IP
Definition: PocuterWIFI.h:61