From 42125d173b16d1b39b04391a74851ee82d6f0e37 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Sat, 25 Aug 2018 08:38:21 +0900 Subject: [PATCH 1/7] Update for Issue #132 Signed-off-by: tomoaki --- MQTTSNGateway/predefinedTopic.conf | 20 ++--- MQTTSNGateway/src/MQTTSNGWClientList.cpp | 88 +++++++++++--------- MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp | 10 ++- MQTTSNGateway/src/MQTTSNGateway.cpp | 11 +++ MQTTSNGateway/src/MQTTSNGateway.h | 2 + 5 files changed, 76 insertions(+), 55 deletions(-) diff --git a/MQTTSNGateway/predefinedTopic.conf b/MQTTSNGateway/predefinedTopic.conf index 95d23ea..4ace6b1 100644 --- a/MQTTSNGateway/predefinedTopic.conf +++ b/MQTTSNGateway/predefinedTopic.conf @@ -16,14 +16,13 @@ # # ClientID, TopicName, TopicID # -# This file is consist from two sections. -# One for QoS-1 PUBLISH Clients, the other for another clients. +# Topics is common to all clients, ClientID should be COMMON. # # pre-defined-topics for Clients # -GatewayTestClient,ty4tw/predefinedTopic1, 1 +COMMON,ty4tw/predefinedTopic1, 1 GatewayTestClient,ty4tw/predefinedTopic2, 2 GatewayTestClient,ty4tw/predefinedTopic3, 3 @@ -31,16 +30,7 @@ GatewayTestClient,ty4tw/predefinedTopic3, 3 # pre-defined-topics for QoS-1 clients. # -QoS-1_Client01,ty4tw/proxy/predefTopic1, 1 -QoS-1_Client01,ty4tw/proxy/predefTopic2, 2 -QoS-1_Client01,ty4tw/proxy/predefTopic3, 3 - -QoS-1_Client02,ty4tw/proxy/predefTopic1, 1 -QoS-1_Client02,ty4tw/proxy/predefTopic3, 2 -QoS-1_Client02,ty4tw/proxy/predefTopic3, 3 - -QoS-1_Client03,ty4tw/proxy/predefTopic1, 1 -QoS-1_Client03,ty4tw/proxy/predefTopic2, 2 -QoS-1_Client03,ty4tw/proxy/predefTopic3, 3 - +QoS-1_Client03,ty4tw/proxy/predefTopic4, 1 +QoS-1_Client03,ty4tw/proxy/predefTopic5, 2 +QoS-1_Client03,ty4tw/proxy/predefTopic6, 3 diff --git a/MQTTSNGateway/src/MQTTSNGWClientList.cpp b/MQTTSNGateway/src/MQTTSNGWClientList.cpp index 488944b..2e4bf92 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientList.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientList.cpp @@ -24,6 +24,8 @@ extern Gateway* theGateway; /*===================================== Class ClientList =====================================*/ +const char* common_topic = "COMMON"; + ClientList::ClientList() { _clientCnt = 0; @@ -414,50 +416,58 @@ Client* ClientList::createClient(SensorNetAddress* addr, MQTTSNString* clientId, Client* ClientList::createPredefinedTopic( MQTTSNString* clientId, string topicName, uint16_t topicId, bool aggregate) { - Client* client = getClient(clientId); + if ( clientId->cstring == common_topic ) + { + _gateway->getTopics()->add((const char*)topicName.c_str(), topicId); + return 0; + } + else + { + Client* client = getClient(clientId); - if ( _authorize && client == nullptr) - { - return 0; - } + if ( _authorize && client == nullptr ) + { + return 0; + } - /* anonimous clients */ - if ( _clientCnt > MAX_CLIENTS ) - { - return nullptr; // full of clients - } + /* anonimous clients */ + if ( _clientCnt > MAX_CLIENTS ) + { + return nullptr; // full of clients + } - if ( client == nullptr ) - { - /* creat a new client */ - client = new Client(); - client->setClientId(*clientId); - if ( aggregate ) - { - client->setAggregated(); - } - _mutex.lock(); + if ( client == nullptr ) + { + /* creat a new client */ + client = new Client(); + client->setClientId(*clientId); + if ( aggregate ) + { + client->setAggregated(); + } + _mutex.lock(); - /* add the list */ - if ( _firstClient == nullptr ) - { - _firstClient = client; - _endClient = client; - } - else - { - _endClient->_nextClient = client; - client->_prevClient = _endClient; - _endClient = client; - } - _clientCnt++; - _mutex.unlock(); - } + /* add the list */ + if ( _firstClient == nullptr ) + { + _firstClient = client; + _endClient = client; + } + else + { + _endClient->_nextClient = client; + client->_prevClient = _endClient; + _endClient = client; + } + _clientCnt++; + _mutex.unlock(); + } - // create Topic & Add it - client->getTopics()->add((const char*)topicName.c_str(), topicId); - client->_hasPredefTopic = true; - return client; + // create Topic & Add it + client->getTopics()->add((const char*)topicName.c_str(), topicId); + client->_hasPredefTopic = true; + return client; + } } uint16_t ClientList::getClientCount() diff --git a/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp b/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp index dd01c50..3162f04 100644 --- a/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp +++ b/MQTTSNGateway/src/MQTTSNGWPublishHandler.cpp @@ -79,10 +79,18 @@ MQTTGWPacket* MQTTSNPublishHandler::handlePublish(Client* client, MQTTSNPacket* else { topic = client->getTopics()->getTopicById(&topicid); + if ( !topic ) + { + topic = _gateway->getTopics()->getTopicById(&topicid); + if ( topic ) + { + topic = client->getTopics()->add(topic->getTopicName()->c_str(), topic->getTopicId()); + } + } if( !topic && qos == 3 ) { - WRITELOG("%s Invali TopicId.%s %s\n", ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER); + WRITELOG("%s Invalid TopicId.%s %s\n", ERRMSG_HEADER, client->getClientId(), ERRMSG_FOOTER); return nullptr; } diff --git a/MQTTSNGateway/src/MQTTSNGateway.cpp b/MQTTSNGateway/src/MQTTSNGateway.cpp index 46d4281..c5894ce 100644 --- a/MQTTSNGateway/src/MQTTSNGateway.cpp +++ b/MQTTSNGateway/src/MQTTSNGateway.cpp @@ -37,6 +37,7 @@ Gateway::Gateway(void) _packetEventQue.setMaxSize(MAX_INFLIGHTMESSAGES * MAX_CLIENTS); _clientList = new ClientList(); _adapterManager = new AdapterManager(this); + _topics = new Topics(); } Gateway::~Gateway() @@ -103,6 +104,11 @@ Gateway::~Gateway() { delete _clientList; } + + if ( _topics ) + { + delete _topics; + } } int Gateway::getParam(const char* parameter, char* value) @@ -312,6 +318,11 @@ AdapterManager* Gateway::getAdapterManager(void) return _adapterManager; } +Topics* Gateway::getTopics(void) +{ + return _topics; +} + bool Gateway::hasSecureConnection(void) { return ( _params.certKey diff --git a/MQTTSNGateway/src/MQTTSNGateway.h b/MQTTSNGateway/src/MQTTSNGateway.h index b4c0f5c..d9b4857 100644 --- a/MQTTSNGateway/src/MQTTSNGateway.h +++ b/MQTTSNGateway/src/MQTTSNGateway.h @@ -191,6 +191,7 @@ public: AdapterManager* getAdapterManager(void); int getParam(const char* parameter, char* value); bool hasSecureConnection(void); + Topics* getTopics(void); private: GatewayParams _params; @@ -201,6 +202,7 @@ private: LightIndicator _lightIndicator; SensorNetwork _sensorNetwork; AdapterManager* _adapterManager {nullptr}; + Topics* _topics; }; } From 6ef24f3bb8ccb90e2ee875177a4ec179842218fd Mon Sep 17 00:00:00 2001 From: tomoaki Date: Sat, 25 Aug 2018 09:55:05 +0900 Subject: [PATCH 2/7] Change Commom ClientID of predifinedTopic.conf to '*' #132 Signed-off-by: tomoaki --- MQTTSNGateway/predefinedTopic.conf | 4 ++-- MQTTSNGateway/src/MQTTSNGWClientList.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/MQTTSNGateway/predefinedTopic.conf b/MQTTSNGateway/predefinedTopic.conf index 4ace6b1..cca2ada 100644 --- a/MQTTSNGateway/predefinedTopic.conf +++ b/MQTTSNGateway/predefinedTopic.conf @@ -16,13 +16,13 @@ # # ClientID, TopicName, TopicID # -# Topics is common to all clients, ClientID should be COMMON. +# Topics is common to all clients, ClientID should be *. # # pre-defined-topics for Clients # -COMMON,ty4tw/predefinedTopic1, 1 +*,ty4tw/predefinedTopic1, 1 GatewayTestClient,ty4tw/predefinedTopic2, 2 GatewayTestClient,ty4tw/predefinedTopic3, 3 diff --git a/MQTTSNGateway/src/MQTTSNGWClientList.cpp b/MQTTSNGateway/src/MQTTSNGWClientList.cpp index 2e4bf92..e4e0bb9 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientList.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientList.cpp @@ -24,7 +24,7 @@ extern Gateway* theGateway; /*===================================== Class ClientList =====================================*/ -const char* common_topic = "COMMON"; +const char* common_topic = "*"; ClientList::ClientList() { From fa4725b85d54626d1f6be998a5474ae800128a3d Mon Sep 17 00:00:00 2001 From: tomoaki Date: Sat, 25 Aug 2018 10:21:09 +0900 Subject: [PATCH 3/7] BugFix Subscribe pre\defined\topic #132 Signed-off-by: tomoaki --- MQTTSNGateway/src/MQTTSNGWSubscribeHandler.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/MQTTSNGateway/src/MQTTSNGWSubscribeHandler.cpp b/MQTTSNGateway/src/MQTTSNGWSubscribeHandler.cpp index 6bca10f..cd4bc30 100644 --- a/MQTTSNGateway/src/MQTTSNGWSubscribeHandler.cpp +++ b/MQTTSNGateway/src/MQTTSNGWSubscribeHandler.cpp @@ -59,6 +59,8 @@ MQTTGWPacket* MQTTSNSubscribeHandler::handleSubscribe(Client* client, MQTTSNPack if ( topicFilter.type == MQTTSN_TOPIC_TYPE_PREDEFINED ) { topic = client->getTopics()->getTopicById(&topicFilter); + + if ( topic ) { topicId = topic->getTopicId(); @@ -67,7 +69,15 @@ MQTTGWPacket* MQTTSNSubscribeHandler::handleSubscribe(Client* client, MQTTSNPack } else { - goto RespExit; + topic = _gateway->getTopics()->getTopicById(&topicFilter); + if ( !topic ) + { + topic = client->getTopics()->add(topic->getTopicName()->c_str(), topic->getTopicId()); + } + else + { + goto RespExit; + } } } else if (topicFilter.type == MQTTSN_TOPIC_TYPE_NORMAL) From fd782f8e502f4f8cb75248e9a5ae40c2fe15cf19 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Sun, 21 Oct 2018 11:00:47 +0900 Subject: [PATCH 4/7] Do not discard PUBLISH message while the client is sleeping. Signed-off-by: tomoaki --- .settings/language.settings.xml | 67 +++++++++++++------ MQTTSNGateway/src/MQTTGWConnectionHandler.cpp | 15 +++-- 2 files changed, 54 insertions(+), 28 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index f557f24..5aca929 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -1,25 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp b/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp index d5b9fd0..303bfe2 100644 --- a/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp +++ b/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp @@ -90,10 +90,13 @@ void MQTTGWConnectionHandler::handlePingresp(Client* client, MQTTGWPacket* packe void MQTTGWConnectionHandler::handleDisconnect(Client* client, MQTTGWPacket* packet) { - MQTTSNPacket* snPacket = new MQTTSNPacket(); - snPacket->setDISCONNECT(0); - client->disconnected(); - client->getNetwork()->close(); - Event* ev1 = new Event(); - ev1->setClientSendEvent(client, snPacket); + if ( !client->isSleep() ) + { + MQTTSNPacket* snPacket = new MQTTSNPacket(); + snPacket->setDISCONNECT(0); + client->disconnected(); + client->getNetwork()->close(); + Event* ev1 = new Event(); + ev1->setClientSendEvent(client, snPacket); + } } From 7e132684666ea84ece85ec8bfc7cfb0e96aafe5a Mon Sep 17 00:00:00 2001 From: tomoaki Date: Tue, 15 Jan 2019 09:37:54 +0900 Subject: [PATCH 5/7] Update: Add MQTT-SN message length to the Gateway log. Signed-off-by: tomoaki --- .settings/language.settings.xml | 4 ++-- MQTTSNGateway/src/MQTTGWConnectionHandler.cpp | 3 --- MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp | 2 +- MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp | 2 +- MQTTSNGateway/src/MQTTSNGWPacket.cpp | 2 +- MQTTSNGateway/src/MQTTSNGWVersion.h | 2 +- 6 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.settings/language.settings.xml b/.settings/language.settings.xml index 5aca929..7d5c34b 100644 --- a/.settings/language.settings.xml +++ b/.settings/language.settings.xml @@ -11,7 +11,7 @@ - + @@ -33,7 +33,7 @@ - + diff --git a/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp b/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp index 303bfe2..47ad782 100644 --- a/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp +++ b/MQTTSNGateway/src/MQTTGWConnectionHandler.cpp @@ -90,13 +90,10 @@ void MQTTGWConnectionHandler::handlePingresp(Client* client, MQTTGWPacket* packe void MQTTGWConnectionHandler::handleDisconnect(Client* client, MQTTGWPacket* packet) { - if ( !client->isSleep() ) - { MQTTSNPacket* snPacket = new MQTTSNPacket(); snPacket->setDISCONNECT(0); client->disconnected(); client->getNetwork()->close(); Event* ev1 = new Event(); ev1->setClientSendEvent(client, snPacket); - } } diff --git a/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp b/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp index b927532..78b8c4b 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp @@ -262,7 +262,7 @@ void ClientRecvTask::log(Client* client, MQTTSNPacket* packet, MQTTSNString* id) void ClientRecvTask::log(const char* clientId, MQTTSNPacket* packet) { - char pbuf[SIZE_OF_LOG_PACKET * 3]; + char pbuf[ (SIZE_OF_LOG_PACKET + 3) * 3]; char msgId[6]; switch (packet->getType()) diff --git a/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp b/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp index 788d024..478f6fc 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp @@ -84,7 +84,7 @@ void ClientSendTask::run() void ClientSendTask::log(Client* client, MQTTSNPacket* packet) { - char pbuf[SIZE_OF_LOG_PACKET * 3]; + char pbuf[(SIZE_OF_LOG_PACKET + 3) * 3]; char msgId[6]; const char* clientId = client ? (const char*)client->getClientId() : UNKNOWNCL ; diff --git a/MQTTSNGateway/src/MQTTSNGWPacket.cpp b/MQTTSNGateway/src/MQTTSNGWPacket.cpp index 998eaf1..1494a2c 100644 --- a/MQTTSNGateway/src/MQTTSNGWPacket.cpp +++ b/MQTTSNGateway/src/MQTTSNGWPacket.cpp @@ -428,7 +428,7 @@ char* MQTTSNPacket::print(char* pbuf) int i = MQTTSNPacket_decode(_buf, _bufLen, &value); int size = _bufLen > SIZE_OF_LOG_PACKET ? SIZE_OF_LOG_PACKET : _bufLen; - for (; i < size; i++) + for (i = 0; i < size; i++) { sprintf(*pptr, " %02X", *(_buf + i)); *pptr += 3; diff --git a/MQTTSNGateway/src/MQTTSNGWVersion.h b/MQTTSNGateway/src/MQTTSNGWVersion.h index 1fd764c..ff9d6e1 100644 --- a/MQTTSNGateway/src/MQTTSNGWVersion.h +++ b/MQTTSNGateway/src/MQTTSNGWVersion.h @@ -17,6 +17,6 @@ #ifndef MQTTSNGWVERSION_H_IN_ #define MQTTSNGWVERSION_H_IN_ -#define PAHO_GATEWAY_VERSION "1.3.0" +#define PAHO_GATEWAY_VERSION "1.3.1" #endif /* MQTTSNGWVERSION_H_IN_ */ From c7b8ef1e5473bcf9dd34b227680dc25189807da2 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Tue, 15 Jan 2019 16:38:55 +0900 Subject: [PATCH 6/7] Refacter the MQTT-SN Packet printf() Signed-off-by: tomoaki --- .cproject | 526 +++++++++++++------ MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp | 2 +- MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp | 2 +- MQTTSNGateway/src/MQTTSNGWPacket.cpp | 5 +- 4 files changed, 354 insertions(+), 181 deletions(-) diff --git a/.cproject b/.cproject index f52491d..78de229 100644 --- a/.cproject +++ b/.cproject @@ -1,178 +1,354 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp b/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp index 78b8c4b..5957cae 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientRecvTask.cpp @@ -262,7 +262,7 @@ void ClientRecvTask::log(Client* client, MQTTSNPacket* packet, MQTTSNString* id) void ClientRecvTask::log(const char* clientId, MQTTSNPacket* packet) { - char pbuf[ (SIZE_OF_LOG_PACKET + 3) * 3]; + char pbuf[ SIZE_OF_LOG_PACKET * 3 + 1]; char msgId[6]; switch (packet->getType()) diff --git a/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp b/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp index 478f6fc..fc8c412 100644 --- a/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp +++ b/MQTTSNGateway/src/MQTTSNGWClientSendTask.cpp @@ -84,7 +84,7 @@ void ClientSendTask::run() void ClientSendTask::log(Client* client, MQTTSNPacket* packet) { - char pbuf[(SIZE_OF_LOG_PACKET + 3) * 3]; + char pbuf[SIZE_OF_LOG_PACKET * 3 + 1]; char msgId[6]; const char* clientId = client ? (const char*)client->getClientId() : UNKNOWNCL ; diff --git a/MQTTSNGateway/src/MQTTSNGWPacket.cpp b/MQTTSNGateway/src/MQTTSNGWPacket.cpp index 1494a2c..c2a017a 100644 --- a/MQTTSNGateway/src/MQTTSNGWPacket.cpp +++ b/MQTTSNGateway/src/MQTTSNGWPacket.cpp @@ -423,12 +423,9 @@ char* MQTTSNPacket::print(char* pbuf) { char* ptr = pbuf; char** pptr = &pbuf; - int value = 0; - - int i = MQTTSNPacket_decode(_buf, _bufLen, &value); int size = _bufLen > SIZE_OF_LOG_PACKET ? SIZE_OF_LOG_PACKET : _bufLen; - for (i = 0; i < size; i++) + for (int i = 0; i < size; i++) { sprintf(*pptr, " %02X", *(_buf + i)); *pptr += 3; From 284b5d5b46b52b057234e1248df3395ffd3cb257 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Tue, 15 Jan 2019 17:18:16 +0900 Subject: [PATCH 7/7] Update READ.me MQTT-SN transparent Gateway to transparent/aggrigating gateway. Signed-off-by: tomoaki --- MQTTSNGateway/README.md | 11 +++++++---- MQTTSNGateway/gateway.conf | 4 ++-- MQTTSNGateway/src/MQTTSNGWAggregater.cpp | 2 +- README.md | 5 +++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/MQTTSNGateway/README.md b/MQTTSNGateway/README.md index 108511e..af6094d 100644 --- a/MQTTSNGateway/README.md +++ b/MQTTSNGateway/README.md @@ -1,4 +1,7 @@ -**MQTT-SN** requires a MQTT-SN Gateway which acts as a protocol converter to convert **MQTT-SN messages to MQTT messages**. MQTT-SN client (UDP) can not communicate directly with MQTT broker(TCP/IP). +# MQTT-SN Transparent / Aggrigating Gateway + +**MQTT-SN** requires a MQTT-SN Gateway which acts as a protocol converter to convert **MQTT-SN messages to MQTT messages**. MQTT-SN client over SensorNetwork can not communicate directly with MQTT broker(TCP/IP). +This Gateway can run as a transparent or aggrigating Gateway by specifying the gateway.conf. ### **step1. Build the gateway** ```` @@ -36,12 +39,12 @@ BrokerPortNo=1883 BrokerSecurePortNo=8883 # -# When AggregateGateway=YES or ClientAuthentication=YES, +# When AggregatingGateway=YES or ClientAuthentication=YES, # All clients must be specified by the ClientList File # ClientAuthentication=NO -AggregateGateway=NO +AggregatingGateway=NO QoS-1=NO Forwarder=NO @@ -82,7 +85,7 @@ ShearedMemory=NO; Client should know the MulticastIP and MulticastPortNo to send a SEARCHGW message. **GatewayId** is used by GWINFO message. **KeepAlive** is a duration of ADVERTISE message in seconds. -when **AggregateGateway** or **ClientAuthentication** is **YES**, All clients which connect to the gateway must be declared by a **ClientsList** file. +when **AggregatingGateway** or **ClientAuthentication** is **YES**, All clients which connect to the gateway must be declared by a **ClientsList** file. Format of the file is ClientId and SensorNetwork Address. e.g. IP address and Port No etc, in CSV. more detail see clients.conf. When **QoS-1** is **YES**, QoS-1 PUBLISH is available. All clients which send QoS-1 PUBLISH must be specified by Client.conf file. When **PredefinedTopic** is **YES**, **Pre-definedTopicId**s specified by **PredefinedTopicList** are effective. This file defines Pre-definedTopics of the clients. In this file, ClientID,TopicName and TopicID are declared in CSV format. diff --git a/MQTTSNGateway/gateway.conf b/MQTTSNGateway/gateway.conf index 52481de..c06853b 100644 --- a/MQTTSNGateway/gateway.conf +++ b/MQTTSNGateway/gateway.conf @@ -19,12 +19,12 @@ BrokerPortNo=1883 BrokerSecurePortNo=8883 # -# When AggregateGateway=YES or ClientAuthentication=YES, +# When AggregatingGateway=YES or ClientAuthentication=YES, # All clients must be specified by the ClientList File # ClientAuthentication=NO -AggregateGateway=NO +AggregatingGateway=NO QoS-1=NO Forwarder=NO diff --git a/MQTTSNGateway/src/MQTTSNGWAggregater.cpp b/MQTTSNGateway/src/MQTTSNGWAggregater.cpp index 1eceedd..b74ec86 100644 --- a/MQTTSNGateway/src/MQTTSNGWAggregater.cpp +++ b/MQTTSNGateway/src/MQTTSNGWAggregater.cpp @@ -40,7 +40,7 @@ void Aggregater::initialize(void) { char param[MQTTSNGW_PARAM_MAX]; - if (_gateway->getParam("AggregateGateway", param) == 0 ) + if (_gateway->getParam("AggregatingGateway", param) == 0 ) { if (!strcasecmp(param, "YES") ) { diff --git a/README.md b/README.md index d0818f6..5a46018 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,14 @@ It is dual licensed under the EPL and EDL (see about.html and notice.html for mo There are three sub-projects: 1. MQTTSNPacket - simple de/serialization of MQTT-SN packets, plus helper functions -2. MQTTGateway - MQTT-SN transparent gateway - connects MQTT-SN clients with an MQTT server. See the README within the project for more information. +2. MQTTGateway - MQTT-SN transparent/aggregating gateway - connects MQTT-SN clients with an MQTT server. See the README within the project for more information. 3. MQTTSNClient - high(er) level C++ client (not yet complete) The *MQTTSNPacket* directory contains the lowest level C library with the smallest requirements. This supplies simple serialization and deserialization routines. They serve as a base for the higher level libraries, but can also be used on their own. It is mainly up to you to write and read to and from the network. -The *MQTTSNGateway* directory contains an MQTT-SN to MQTT transparent gateway (see the MQTT-SN specification for a description of that.) It can +The *MQTTSNGateway* directory contains an MQTT-SN to MQTT transparent/aggregating gateway (see the MQTT-SN specification for a description of that.) It can be used to connect the MQTT-SN client to an MQTT server. The *MQTTSNClient* directory contains the next level C++ library. This is intended to mirror the way the MQTTClient works in the Paho embedded @@ -45,3 +45,4 @@ Discussion of the Paho clients takes place on the [Eclipse Mattermost Paho chann General questions about the MQTT protocol are discussed in the [MQTT Google Group](https://groups.google.com/forum/?hl=en-US&fromgroups#!forum/mqtt). More information is available via the [MQTT community](http://mqtt.org). +