28 lines
No EOL
603 B
C++
28 lines
No EOL
603 B
C++
#ifndef Networking_h
|
|
#define Networking_h
|
|
|
|
#include <PubSubClient.h>
|
|
#include <ESP8266WiFi.h>
|
|
|
|
class Networking{
|
|
char* _hostname;
|
|
char* _ssid;
|
|
char* _password;
|
|
|
|
WiFiClient _wifiClient;
|
|
PubSubClient _mqttClient;
|
|
|
|
void waitForWiFi();
|
|
void waitForMQTT();
|
|
void mqttCallback(char *topic, byte *payload, unsigned int length);
|
|
|
|
public:
|
|
Networking(char* hostname, char* ssid, char* password, char* mqttServer);
|
|
void setup();
|
|
void reconnect();
|
|
void loop();
|
|
void publish(const char* topic, const char* payload);
|
|
void publish(const char* topic, const char* payload, bool retained);
|
|
};
|
|
|
|
#endif |