pass MessageMap to DataHandler
This commit is contained in:
@@ -51,11 +51,11 @@ const struct argp_child* datahandler_getargs()
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool datahandler_register(BusHandler* busHandler, list<DataHandler*>& handlers)
|
bool datahandler_register(BusHandler* busHandler, MessageMap* messages, list<DataHandler*>& handlers)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
#ifdef HAVE_MQTT
|
#ifdef HAVE_MQTT
|
||||||
DataHandler* handler = mqtthandler_register(busHandler);
|
DataHandler* handler = mqtthandler_register(busHandler, messages);
|
||||||
if (handler) {
|
if (handler) {
|
||||||
handlers.push_back(handler);
|
handlers.push_back(handler);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -42,10 +42,11 @@ const struct argp_child* datahandler_getargs();
|
|||||||
/**
|
/**
|
||||||
* Registration function that is called once during initialization.
|
* Registration function that is called once during initialization.
|
||||||
* @param busHandler the @a BusHandler instance.
|
* @param busHandler the @a BusHandler instance.
|
||||||
|
* @param messages the @a MessageMap instance.
|
||||||
* @param handlers the @a list to which new @a DataHandler instances shall be added.
|
* @param handlers the @a list to which new @a DataHandler instances shall be added.
|
||||||
* @return true if registration was successful.
|
* @return true if registration was successful.
|
||||||
*/
|
*/
|
||||||
bool datahandler_register(BusHandler* busHandler, list<DataHandler*>& handlers);
|
bool datahandler_register(BusHandler* busHandler, MessageMap* messages, list<DataHandler*>& handlers);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ MainLoop::MainLoop(const struct options opt, Device *device, MessageMap* message
|
|||||||
m_htmlPath = opt.htmlPath;
|
m_htmlPath = opt.htmlPath;
|
||||||
m_network = new Network(opt.localOnly, opt.port, opt.httpPort, &m_netQueue);
|
m_network = new Network(opt.localOnly, opt.port, opt.httpPort, &m_netQueue);
|
||||||
m_network->start("network");
|
m_network->start("network");
|
||||||
if (!datahandler_register(m_busHandler, m_dataHandlers)) {
|
if (!datahandler_register(m_busHandler, messages, m_dataHandlers)) {
|
||||||
logError(lf_main, "error registering data handlers");
|
logError(lf_main, "error registering data handlers");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user