-
Notifications
You must be signed in to change notification settings - Fork 238
/
Copy pathConnectivity.h
32 lines (26 loc) · 868 Bytes
/
Connectivity.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
#ifndef MQTT_CONNECTIVITY_h
#define MQTT_CONNECTIVITY_h
#include <WiFi.h>
#include <MQTT.h>
class Connectivity {
public:
Connectivity();
void begin();
void loop();
void sendStatus();
bool reconnect();
static MQTTClientCallbackAdvancedFunction messageReceived(MQTTClient *client, char topic[], char bytes[], int length);
private:
// Edit your server settings here
WiFiClient networkClient;
String ssid = "EnterYourSsidHere";
String password = "EnterYourWifiPasswordHere";
MQTTClient mqttClient;
String mqttServer = "test.mosquitto.org";
String mqttUsername = "";
String mqttPassword = "";
String mqttClientID = "undefined";
int mqttPort = 1883;
unsigned long nextStatusMessage = 0;
};
#endif // MQTT_CONNECTIVITY_h