12
12
#ifndef ADAFRUITIO_AIRLIFT_H
13
13
#define ADAFRUITIO_AIRLIFT_H
14
14
15
- #if !defined(ARDUINO_SAMD_MKR1000) && defined(ARDUINO_ARCH_SAMD)
16
-
17
15
#include " Arduino.h"
18
16
#include " AdafruitIO.h"
19
17
#include " WiFiNINA.h"
31
29
#define ESP32_GPIO0 -1 // Not connected
32
30
#endif
33
31
32
+ // br: try to emulate everything in the header to avoid wifinina-wifi101 conflicts
34
33
class AdafruitIO_AIRLIFT : public AdafruitIO {
35
34
36
35
public:
37
- AdafruitIO_AIRLIFT (const char *user, const char *key, const char *ssid, const char *pass);
38
- ~AdafruitIO_AIRLIFT ();
36
+ AdafruitIO_AIRLIFT (const char *user, const char *key, const char *ssid, const char *pass):AdafruitIO(user, key)
37
+ {
38
+ _ssid = ssid;
39
+ _pass = pass;
40
+ _mqtt_client = new WiFiSSLClient;
41
+ _mqtt = new Adafruit_MQTT_Client (_mqtt_client, _host, _mqtt_port);
42
+ _http_client = new WiFiSSLClient;
43
+ _http = new HttpClient (*_http_client, _host, _http_port);
44
+ }
45
+
46
+ // ~AdafruitIO_AIRLIFT();
47
+
48
+ aio_status_t networkStatus ()
49
+ {
50
+ switch (WiFi.status ())
51
+ {
52
+ case WL_CONNECTED:
53
+ return AIO_NET_CONNECTED;
54
+ case WL_CONNECT_FAILED:
55
+ return AIO_NET_CONNECT_FAILED;
56
+ case WL_IDLE_STATUS:
57
+ return AIO_IDLE;
58
+ default :
59
+ return AIO_NET_DISCONNECTED;
60
+ }
61
+ }
39
62
40
- aio_status_t networkStatus ();
41
- const char * connectionType ();
63
+ const char *connectionType ()
64
+ {
65
+ return " AIRLIFT" ;
66
+ }
67
+
68
+ // aio_status_t networkStatus();
69
+ // const char* connectionType();
42
70
43
71
protected:
44
- void _connect ();
72
+ // void _connect();
45
73
const char *_ssid;
46
74
const char *_pass;
47
75
48
76
WiFiSSLClient *_http_client;
49
77
WiFiSSLClient *_mqtt_client;
50
78
79
+ void _connect ()
80
+ {
81
+ // for breakouts, check if the pins would be externally defined
82
+ #ifdef BOARDEF
83
+ WiFi.setPins (SPIWIFI_SS, SPIWIFI_ACK, ESP32_RESETN, ESP32_GPIO0, &SPIWIFI);
84
+ #endif
85
+
86
+ // check esp32 module status
87
+ if (WiFi.status () == WL_NO_MODULE)
88
+ {
89
+ Serial.println (" No Module!!" );
90
+ Serial.print (WiFi.status ());
91
+ }
92
+
93
+ WiFi.begin (_ssid, _pass);
94
+ _status = AIO_NET_DISCONNECTED;
95
+ }
51
96
};
52
97
53
- #endif // ARDUINO_ARCH_SAMD
54
98
55
99
#endif // ADAFRUITIO_AIRLIFT_H
0 commit comments