Update Aggregatting gateway can now receive PUBLISH from a broker

Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
tomoaki
2020-03-05 17:39:54 +09:00
parent 53be14f76e
commit 258d534009
22 changed files with 397 additions and 180 deletions

View File

@@ -234,29 +234,48 @@ void Gateway::initialize(int argc, char** argv)
_params.clientListName = strdup(param);
}
if (getParam("PredefinedTopicList", param) == 0)
if (getParam("PredefinedTopic", param) == 0)
{
_params.predefinedTopicFileName = strdup(param);
if ( !strcasecmp(param, "YES") )
{
_params.predefinedTopic = true;
if (getParam("PredefinedTopicList", param) == 0)
{
_params.predefinedTopicFileName = strdup(param);
}
}
}
if ( _params.clientListName == nullptr )
if (getParam("AggregatingGateway", param) == 0)
{
_params.clientListName = strdup(( _params.configDir + string(CLIENT_LIST) ).c_str());
if ( !strcasecmp(param, "YES") )
{
_params.aggregatingGw = true;
}
}
if ( _params.predefinedTopicFileName == nullptr )
if (getParam("Forwarder", param) == 0)
{
_params.predefinedTopicFileName = strdup(( _params.configDir + string(PREDEFINEDTOPIC_FILE) ).c_str());
if ( !strcasecmp(param, "YES") )
{
_params.forwarder = true;
}
}
/* ClientList and Adapters Initialize */
_adapterManager->initialize();
if (getParam("QoS-1", param) == 0)
{
if ( !strcasecmp(param, "YES") )
{
_params.qosMinus1 = true;
}
}
bool aggregate = _adapterManager->isAggregaterActive();
_clientList->initialize(aggregate);
/* Setup predefined topics */
_clientList->setPredefinedTopics(aggregate);
/* Initialize adapters */
_adapterManager->initialize( _params.gatewayName, _params.aggregatingGw, _params.forwarder, _params.qosMinus1);
/* Setup ClientList and Predefined topics */
_clientList->initialize(_params.aggregatingGw);
}
void Gateway::run(void)