diff --git a/MQTTSNGateway/Makefile b/MQTTSNGateway/Makefile index 731d88e..6b9c630 100644 --- a/MQTTSNGateway/Makefile +++ b/MQTTSNGateway/Makefile @@ -18,6 +18,18 @@ OS := linux SENSORNET := udp TEST := tests +# include directories, for MacOS/homebrew add -I/usr/local/opt/openssl/include/ +# library search paths, for MacOS/homebrew add -L/usr/local/opt/openssl/lib/ +ifeq ($(shell) uname),Darwin) + CXX := clang++ + INCLUDE := -I/usr/local/opt/openssl/include/ + LIB := -L/usr/local/opt/openssl/lib/ +else + CXX := g++ + INCLUDE := + LIB := +endif + INSTALL_DIR=../../ CONFIG_DIR=../../ @@ -74,11 +86,8 @@ $(SUBDIR)/MQTTSNSubscribeServer.c \ $(SUBDIR)/MQTTSNUnsubscribeClient.c \ $(SUBDIR)/MQTTSNUnsubscribeServer.c -CXX := g++ CPPFLAGS += -# include directories, for MacOS/homebrew add -I/usr/local/opt/openssl/include/ -INCLUDE := INCLUDES += $(INCLUDE) -I$(SRCDIR) \ -I$(SRCDIR)/$(OS) \ -I$(SRCDIR)/$(OS)/$(SENSORNET) \ @@ -88,8 +97,7 @@ INCLUDES += $(INCLUDE) -I$(SRCDIR) \ # preprocessor defines DEFS := -# library search paths, for MacOS/homebrew add -L/usr/local/opt/openssl/lib/ -LIB := + LIBS += $(LIB) -L/usr/local/lib LDFLAGS := diff --git a/MQTTSNGateway/README.md b/MQTTSNGateway/README.md index c206204..c7a791c 100644 --- a/MQTTSNGateway/README.md +++ b/MQTTSNGateway/README.md @@ -7,12 +7,12 @@ This Gateway can run as a transparent or aggregating Gateway by specifying the g ```` $ git clone -b develop https://github.com/eclipse/paho.mqtt-sn.embedded-c $ cd paho.mqtt-sn.embedded-c/MQTTSNGateway -$ make [SENSORNET={udp6|xbee}] +$ make [SENSORNET={udp6|xbee|loralink}] $ make install $ make clean ```` By default, a gateway for UDP is built. -In order to create a gateway for UDP6 or XBee, SENSORNET argument is required. +In order to create a gateway for UDP6, XBee or LoRaLink, SENSORNET argument is required. MQTT-SNGateway, MQTT-SNLogmonitor and *.conf files are copied into ../ directory. If you want to install the gateway into specific directories, enter a command line as follows: @@ -94,6 +94,11 @@ Baudrate=38400 SerialDevice=/dev/ttyUSB0 ApiMode=2 +#LoRaLink +BaudrateLoRaLink=115200 +DeviceRxLoRaLink=/dev/ttyLoRaLinkRx +DeviceTxLoRaLink=/dev/ttyLoRaLinkTx + # LOG ShearedMemory=NO; diff --git a/MQTTSNGateway/src/tests/TestTopics.cpp b/MQTTSNGateway/src/tests/TestTopics.cpp index 404013e..52c968b 100644 --- a/MQTTSNGateway/src/tests/TestTopics.cpp +++ b/MQTTSNGateway/src/tests/TestTopics.cpp @@ -214,7 +214,7 @@ void TestTopics::test(void) for ( int i = 0; i < 10 ; i++ ) { MQTTSN_topicid tp1; - char tp0[10]; + char tp0[20]; sprintf(tp0, "Topic/%d/%d", i, i); tp1.type = MQTTSN_TOPIC_TYPE_NORMAL; tp1.data.long_.len = strlen(tp0); @@ -237,7 +237,7 @@ void TestTopics::test(void) for ( int i = 0; i < 10 ; i++ ) { MQTTSN_topicid tp1; - char tp0[10]; + char tp0[20]; sprintf(tp0, "Topic/%d", i); tp1.type = MQTTSN_TOPIC_TYPE_NORMAL; tp1.data.long_.len = strlen(tp0); @@ -261,7 +261,7 @@ void TestTopics::test(void) for ( int i = 0; i < 10 ; i++ ) { MQTTSN_topicid tpid1; - char tp0[10]; + char tp0[20]; sprintf(tp0, "TOPIC/%d/%d", i, i); tpid1.type = MQTTSN_TOPIC_TYPE_NORMAL; tpid1.data.long_.len = strlen(tp0);