Domotique/WifiControlSensor/MQTT.h
2016-11-20 23:59:50 +01:00

32 lines
1.1 KiB
C++

#pragma once
#ifndef CONFIG_DISABLE_MQTT
#include "Adafruit_MQTT.h"
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 MqttPublishIp(const String &ip);
void MqttCheckSubscription();
void MqttChangeGpioValue(int gpio, int value);
void MqttChangePWMValue(int gpio, int value);
bool MqttIsConfigured();
int MqttPublishGPIO();
#else
int MqttConnect(){return 0;}
int MqttIsConnected(){return 0;}
int MqttSetup(char *, char *, char *, int, char *){return 0;}
template<typename T> int MqttPublish(void *, T){return 0;}
int MqttPublishBMP180(double, double){return 0;}
int MqttPublishDHT(float, float){return 0;}
int MqttPublishIP(const String &){return 0;}
void MqttCheckSubscription(){}
void MqttChangeGpioValue(int, int){}
void MqttChangePWMValue(int, int){}
bool MqttIsConfigured(){return false;}
int MqttPublishGPIO(){return 0;}
#endif