IoT Structure
This commit is contained in:
parent
a88a65e437
commit
822eb66285
8 changed files with 72 additions and 2 deletions
36
Template Project/lib/ESPMegaPRO/ESPMegaIoT.hpp
Normal file
36
Template Project/lib/ESPMegaPRO/ESPMegaIoT.hpp
Normal file
|
@ -0,0 +1,36 @@
|
|||
#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];
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue