#include #include #include #include #include #include #include #include #include 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 *)); void checkCardType(uint8_t card_id); private: void sessionKeepAlive(); void mqttReconnect(); void wifiReconnect(); void mqttCallback(char *topic, byte *payload, unsigned int length); PubSubClient mqtt; ExpansionCard *expansionCards[255]; bool card_publish_enabled[255]; char payload_buffer[200]; char base_topic[100]; };