1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

mqtt: move checks to mqtt_check()

This commit is contained in:
Steffen Vogel 2019-03-26 07:10:07 +01:00
parent c249dcc89d
commit 81267f9759

View file

@ -204,7 +204,14 @@ int mqtt_parse(struct node *n, json_t *cfg)
if (!m->format)
error("Invalid format '%s' for node %s", format, node_name(n));
// Some checks
return 0;
}
int mqtt_check(struct node *n)
{
int ret;
struct mqtt *m = (struct mqtt *) n->_vd;
ret = mosquitto_sub_topic_check(m->subscribe);
if (ret != MOSQ_ERR_SUCCESS)
error("Invalid subscribe topic: '%s' for node %s: %s", m->subscribe, node_name(n), mosquitto_strerror(ret));
@ -451,6 +458,7 @@ static struct plugin p = {
.type.stop = mqtt_type_stop,
.reverse = mqtt_reverse,
.parse = mqtt_parse,
.check = mqtt_check,
.print = mqtt_print,
.start = mqtt_start,
.destroy = mqtt_destroy,