Domotique/WifiControlSensor/MQTT.h

38 lines
1.5 KiB
C
Raw 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"
2016-12-14 00:08:47 +01:00
typedef struct {uint8_t updated; int value;} gpioInfo;
2016-04-14 01:37:28 +02:00
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);
2016-04-14 01:37:28 +02:00
void MqttCheckSubscription();
2016-12-14 00:08:47 +01:00
void MqttCheckIRQ();
2016-04-14 01:37:28 +02:00
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-12-14 00:08:47 +01:00
void MqttNofityIRQ(uint8_t gpio, int value);
void MqttNofity(int gpio, int value);
2016-10-28 18:04:30 +02:00
#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;}
2016-10-28 18:04:30 +02:00
void MqttCheckSubscription(){}
2016-12-14 00:08:47 +01:00
void MqttCheckIRQ(){}
2016-10-28 18:04:30 +02:00
void MqttChangeGpioValue(int gpio, int value){}
void MqttChangePWMValue(int gpio, int value){}
bool MqttIsConfigured(){}
2016-12-14 00:08:47 +01:00
void MqttNofityIRQ(uint8_t gpio, int value){}
void MqttNofity(int gpio, int value){}
2016-10-28 18:04:30 +02:00
#endif