Domotique/WifiControlSensor/MQTT.h
2016-12-14 00:08:47 +01:00

38 lines
1.5 KiB
C++

#pragma once
#ifndef CONFIG_DISABLE_MQTT
#include "Adafruit_MQTT.h"
typedef struct {uint8_t updated; int value;} gpioInfo;
Adafruit_MQTT_Publish *MqttCreatePublisher(const char *fmt, ...);
int MqttConnect();
int MqttIsConnected();
int MqttSetup(char *server, char *user, char *passwd, int port, char * hostname);
template<typename T> int MqttPublish(Adafruit_MQTT_Publish *publisher, T value);
int MqttPublishBMP180(double temp, double pressure);
int MqttPublishDHT(float temp, float humidity);
int MqttPublishDry(int dry);
int MqttPublishIp(const String &ip);
void MqttCheckSubscription();
void MqttCheckIRQ();
void MqttChangeGpioValue(int gpio, int value);
void MqttChangePWMValue(int gpio, int value);
bool MqttIsConfigured();
void MqttNofityIRQ(uint8_t gpio, int value);
void MqttNofity(int gpio, int value);
#else
int MqttConnect(){return 0;}
int MqttIsConnected(){return 0;}
int MqttSetup(char *server, char *user, char *passwd, int port, char * hostname){return 0;}
template<typename T> int MqttPublish(Adafruit_MQTT_Publish *publisher, T value){return 0;}
int MqttPublishBMP180(double temp, double pressure){return 0;}
int MqttPublishDHT(float temp, float humidity){return 0;}
int MqttPublishDry(int dry){return 0;}
int MqttPublishIP(const String &ip){return 0;}
void MqttCheckSubscription(){}
void MqttCheckIRQ(){}
void MqttChangeGpioValue(int gpio, int value){}
void MqttChangePWMValue(int gpio, int value){}
bool MqttIsConfigured(){}
void MqttNofityIRQ(uint8_t gpio, int value){}
void MqttNofity(int gpio, int value){}
#endif