mirror of
https://github.com/eclipse/paho.mqtt-sn.embedded-c.git
synced 2025-12-15 16:36:52 +01:00
BugFix ClientList file name is not shown
Signed-off-by: tomoaki <tomoaki@tomy-tech.com>
This commit is contained in:
@@ -67,25 +67,13 @@ void ClientList::setClientList(int type)
|
|||||||
{
|
{
|
||||||
char param[MQTTSNGW_PARAM_MAX];
|
char param[MQTTSNGW_PARAM_MAX];
|
||||||
string fileName;
|
string fileName;
|
||||||
GatewayParams* params = theGateway->getGWParams();
|
theGateway->getParam("ClientsList", param);
|
||||||
if (theGateway->getParam("ClientsList", param) == 0)
|
fileName = string(param);
|
||||||
{
|
|
||||||
fileName = string(param);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fileName = params->configDir + string(CLIENT_LIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!createList(fileName.c_str(), type))
|
if (!createList(fileName.c_str(), type))
|
||||||
{
|
{
|
||||||
throw Exception("ClientList::initialize(): No client list defined by the configuration.");
|
throw Exception("ClientList::initialize(): No client list defined by the configuration.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( params->clientListName == nullptr )
|
|
||||||
{
|
|
||||||
params->clientListName = strdup(fileName.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClientList::setPredefinedTopics(bool aggrecate)
|
void ClientList::setPredefinedTopics(bool aggrecate)
|
||||||
@@ -93,21 +81,11 @@ void ClientList::setPredefinedTopics(bool aggrecate)
|
|||||||
char param[MQTTSNGW_PARAM_MAX];
|
char param[MQTTSNGW_PARAM_MAX];
|
||||||
|
|
||||||
string fileName;
|
string fileName;
|
||||||
GatewayParams* params = theGateway->getGWParams();
|
|
||||||
|
|
||||||
if (theGateway->getParam("PredefinedTopicList", param) == 0)
|
theGateway->getParam("PredefinedTopicList", param);
|
||||||
{
|
fileName = string(param);
|
||||||
fileName = string(param);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fileName = params->configDir + string(PREDEFINEDTOPIC_FILE);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( readPredefinedList(fileName.c_str(), aggrecate) )
|
readPredefinedList(fileName.c_str(), aggrecate);
|
||||||
{
|
|
||||||
params->predefinedTopicFileName = strdup(fileName.c_str());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,11 +103,11 @@ void ClientList::setPredefinedTopics(bool aggrecate)
|
|||||||
*
|
*
|
||||||
* Ex:
|
* Ex:
|
||||||
* #Client List
|
* #Client List
|
||||||
* ClientId1,11200@192.168.10.10
|
* ClientId1,192.168.10.10:11200
|
||||||
* ClientID2,35000@192.168.50.200,unstableLine
|
* ClientID2,192.168.50.200:35000,unstableLine
|
||||||
* ClientID3,40000@192.168.200.50,secureConnection
|
* ClientID3,192.168.200.50:40000,secureConnection
|
||||||
* ClientID4,41000@192.168.200.51,unstableLine,secureConnection
|
* ClientID4,192.168.200.51:41000,unstableLine,secureConnection
|
||||||
* ClientID5,41000@192.168.200.51,unstableLine,secureConnection,QoS-1
|
* ClientID5,192.168.200.51:41000,unstableLine,secureConnection,QoS-1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool ClientList::createList(const char* fileName, int type)
|
bool ClientList::createList(const char* fileName, int type)
|
||||||
|
|||||||
@@ -215,6 +215,26 @@ void Gateway::initialize(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getParam("ClientsList", param) == 0)
|
||||||
|
{
|
||||||
|
_params.clientListName = strdup(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (getParam("PredefinedTopicList", param) == 0)
|
||||||
|
{
|
||||||
|
_params.predefinedTopicFileName = strdup(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _params.clientListName == nullptr )
|
||||||
|
{
|
||||||
|
_params.clientListName = strdup(( _params.configDir + string(CLIENT_LIST) ).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( _params.predefinedTopicFileName == nullptr )
|
||||||
|
{
|
||||||
|
_params.predefinedTopicFileName = strdup(( _params.configDir + string(PREDEFINEDTOPIC_FILE) ).c_str());
|
||||||
|
}
|
||||||
|
|
||||||
/* ClientList and Adapters Initialize */
|
/* ClientList and Adapters Initialize */
|
||||||
_adapterManager->initialize();
|
_adapterManager->initialize();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user