- Refactor mqtt_publish_stat() to take va_list - Make publish_stat format its response with json_vprintf() so it is valid JSON. - Call publish_stat in channel_set, the only place where the GPIO state changes - Return (valid) JSON response in all RPCs
15 lines
334 B
C
15 lines
334 B
C
#ifndef __MQTT_H
|
|
#define __MQTT_H
|
|
|
|
#include "mgos.h"
|
|
#include "mgos_mqtt.h"
|
|
|
|
#define MQTT_TOPIC_PREFIX ""
|
|
#define MQTT_TOPIC_BROADCAST_CMD "/mongoose/broadcast"
|
|
#define MQTT_TOPIC_BROADCAST_STAT "/mongoose/broadcast/stat"
|
|
|
|
void mqtt_init();
|
|
void mqtt_publish_stat(const char *stat, const char *fmt, ...);
|
|
|
|
#endif // __MQTT_H
|