Domotique/WifiControlSensor/MQTT.h

32 lines
1.1 KiB
C
Raw Permalink Normal View History

2016-04-14 01:37:28 +02:00
#pragma once
2016-10-28 18:04:30 +02:00
#ifndef CONFIG_DISABLE_MQTT
2016-04-14 01:37:28 +02:00
#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);
2016-04-14 01:37:28 +02:00
void MqttCheckSubscription();
void MqttChangeGpioValue(int gpio, int value);
2016-09-28 15:45:45 +02:00
void MqttChangePWMValue(int gpio, int value);
2016-04-14 01:37:28 +02:00
bool MqttIsConfigured();
2016-11-20 18:08:15 +01:00
int MqttPublishGPIO();
2016-10-28 18:04:30 +02:00
#else
int MqttConnect(){return 0;}
int MqttIsConnected(){return 0;}
2016-11-20 23:47:25 +01:00
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;}
2016-10-28 18:04:30 +02:00
void MqttCheckSubscription(){}
2016-11-20 23:47:25 +01:00
void MqttChangeGpioValue(int, int){}
void MqttChangePWMValue(int, int){}
bool MqttIsConfigured(){return false;}
2016-11-20 18:08:15 +01:00
int MqttPublishGPIO(){return 0;}
2016-10-28 18:04:30 +02:00
#endif