1212#ifndef ADAFRUITIO_AIRLIFT_H
1313#define ADAFRUITIO_AIRLIFT_H
1414
15- #if !defined(ARDUINO_SAMD_MKR1000) && defined(ARDUINO_ARCH_SAMD)
16-
1715#include " Arduino.h"
1816#include " AdafruitIO.h"
1917#include " WiFiNINA.h"
3129 #define ESP32_GPIO0 -1 // Not connected
3230#endif
3331
32+ // br: try to emulate everything in the header to avoid wifinina-wifi101 conflicts
3433class AdafruitIO_AIRLIFT : public AdafruitIO {
3534
3635 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+ }
3962
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();
4270
4371 protected:
44- void _connect ();
72+ // void _connect();
4573 const char *_ssid;
4674 const char *_pass;
4775
4876 WiFiSSLClient *_http_client;
4977 WiFiSSLClient *_mqtt_client;
5078
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+ }
5196};
5297
53- #endif // ARDUINO_ARCH_SAMD
5498
5599#endif // ADAFRUITIO_AIRLIFT_H
0 commit comments