ESPMegaPRO-v3-SDK/Template Project/lib/ESPMegaPRO/ESPMegaIoT.hpp

36 lines
1.1 KiB
C++

#include <ExpansionCard.hpp>
#include <AnalogCard.hpp>
#include <DigitalInputCard.hpp>
#include <DigitalOutputCard.hpp>
#include <PubSubClient.h>
#include <ETH.h>
class ESPMegaIoT
{
public:
void begin();
void loop();
void registerCard(uint8_t card_id);
void deregisterCard(uint8_t card_id);
void publishCard(uint8_t card_id);
void subscribeToTopic(char *topic);
void unsubscribeFromTopic(char *topic);
void connectToEthernet();
bool ethernetConnected();
void connectToWifi(char *ssid, char *password);
void connectToWifi(char *ssid);
void disconnectFromWifi();
bool wifiConnected();
void connectToMqtt(char *mqtt_server, uint16_t mqtt_port, char *mqtt_user, char *mqtt_password);
void disconnectFromMqtt();
void publishToTopic(char *topic, char *payload);
void registerMqttCallback(void (*callback)(char *, char *));
private:
void sessionKeepAlive();
void mqttReconnect();
void wifiReconnect();
PubSubClient mqtt;
ExpansionCard *expansionCards[255];
bool card_publish_enabled[255];
}