From e21b679a03af4764538fc8730c81383d28655b18 Mon Sep 17 00:00:00 2001 From: tomoaki Date: Sat, 6 May 2017 12:02:41 +0900 Subject: [PATCH] Update: Add Travis CI check. Change: Move a Makefile into MQTTSNGateway directory. How to build $ git clone -b gateway https://github.com/eclipse/paho.mqtt-sn.embedded-c $ cd paho.mqtt-sn.embedded-c/MQTTSNGateway $ make $ make install $ make clean Signed-off-by: tomoaki --- .cproject | 17 +++++++++++------ .travis.yml | 21 +++++++++++++++++++++ Makefile => MQTTSNGateway/Makefile | 23 ++++++++++++----------- MQTTSNGateway/README.md | 2 +- MQTTSNGateway/src/MQTTSNGWProcess.h | 1 + MQTTSNGateway/src/MQTTSNGWVersion.h | 22 ++++++++++++++++++++++ MQTTSNGateway/src/MQTTSNGWVersion.h.in | 22 ++++++++++++++++++++++ MQTTSNGateway/src/MQTTSNGateway.cpp | 3 ++- MQTTSNGateway/src/MQTTSNGateway.h | 2 -- 9 files changed, 92 insertions(+), 21 deletions(-) create mode 100644 .travis.yml rename Makefile => MQTTSNGateway/Makefile (91%) create mode 100644 MQTTSNGateway/src/MQTTSNGWVersion.h create mode 100644 MQTTSNGateway/src/MQTTSNGWVersion.h.in diff --git a/.cproject b/.cproject index 3466b14..12edf27 100644 --- a/.cproject +++ b/.cproject @@ -21,7 +21,7 @@ - - + @@ -132,9 +136,9 @@ - - - + + + @@ -170,4 +174,5 @@ + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..f6d2209 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,21 @@ +language: cpp +compiler: g++ + +install: + +addons: + apt: + sources: + - ubuntu-toolchain-r-test + packages: + - g++-4.8 + +script: + - cd MQTTSNGateway + - make CXX="g++-4.8" SENSORNET="xbee" + - make CXX="g++-4.8" SENSORNET="udp" + +notifications: + emails: + - tomoaki@tomy-tech.com + \ No newline at end of file diff --git a/Makefile b/MQTTSNGateway/Makefile similarity index 91% rename from Makefile rename to MQTTSNGateway/Makefile index 652be9e..3d3608b 100644 --- a/Makefile +++ b/MQTTSNGateway/Makefile @@ -7,11 +7,11 @@ LAPPL := mainLogmonitor TESTPROGNAME := testPFW TESTAPPL := mainTestProcess -CONFIG := MQTTSNGateway/gateway.conf -CLIENTS := MQTTSNGateway/clients.conf +CONFIG := gateway.conf +CLIENTS := clients.conf -SRCDIR := MQTTSNGateway/src -SUBDIR := MQTTSNPacket/src +SRCDIR := src +SUBDIR := ../MQTTSNPacket/src OS := linux SENSORNET := udp @@ -59,7 +59,7 @@ $(SUBDIR)/MQTTSNSubscribeServer.c \ $(SUBDIR)/MQTTSNUnsubscribeClient.c \ $(SUBDIR)/MQTTSNUnsubscribeServer.c -CXX := g++ +CXX := g++ CPPFLAGS += INCLUDES += -I$(SRCDIR) \ @@ -72,7 +72,7 @@ DEFS := LIBS += -L/usr/local/lib LDFLAGS := CXXFLAGS := -Wall -O3 -std=c++11 -LDADD := -lpthread -lssl -lcrypto +LDADD := -lpthread -lssl -lcrypto -lrt OUTDIR := Build PROG := $(OUTDIR)/$(PROGNAME) @@ -129,13 +129,14 @@ clean: rm -rf $(OUTDIR) install: - cp -pf $(PROG) ../ - cp -pf $(LPROG) ../ - cp -pf $(CONFIG) ../ - cp -pf $(CLIENTS) ../ + cp -pf $(PROG) ../../ + cp -pf $(LPROG) ../../ + cp -pf $(CONFIG) ../../ + cp -pf $(CLIENTS) ../../ exectest: cp -pf $(CONFIG) $(OUTDIR) - cd $(OUTDIR); ./$(TESTPROGNAME) -f ./gateway.conf + cd $(OUTDIR) + ./$(TESTPROGNAME) -f ./gateway.conf \ No newline at end of file diff --git a/MQTTSNGateway/README.md b/MQTTSNGateway/README.md index bc3314e..d7a9080 100644 --- a/MQTTSNGateway/README.md +++ b/MQTTSNGateway/README.md @@ -3,7 +3,7 @@ ### **step1. Build the gateway** ```` $ git clone -b gateway https://github.com/eclipse/paho.mqtt-sn.embedded-c -$ cd paho.mqtt-sn.embedded-c +$ cd paho.mqtt-sn.embedded-c/MQTTSNGateway $ make $ make install $ make clean diff --git a/MQTTSNGateway/src/MQTTSNGWProcess.h b/MQTTSNGateway/src/MQTTSNGWProcess.h index 807ad83..21bd6e4 100644 --- a/MQTTSNGateway/src/MQTTSNGWProcess.h +++ b/MQTTSNGateway/src/MQTTSNGWProcess.h @@ -40,6 +40,7 @@ namespace MQTTSNGW ==================================*/ #define WRITELOG theProcess->putLog #define CHK_SIGINT (theProcess->checkSignal() == SIGINT) +#define UNUSED(x) ((void)(x)) /*================================= Class Process ==================================*/ diff --git a/MQTTSNGateway/src/MQTTSNGWVersion.h b/MQTTSNGateway/src/MQTTSNGWVersion.h new file mode 100644 index 0000000..90f4eab --- /dev/null +++ b/MQTTSNGateway/src/MQTTSNGWVersion.h @@ -0,0 +1,22 @@ +/************************************************************************************** + * Copyright (c) 2017, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial version + **************************************************************************************/ + +#ifndef MQTTSNGWVERSION_H_IN_ +#define MQTTSNGWVERSION_H_IN_ + +#define PAHO_GATEWAY_VERSION "1.1.0" + +#endif /* MQTTSNGWVERSION_H_IN_ */ diff --git a/MQTTSNGateway/src/MQTTSNGWVersion.h.in b/MQTTSNGateway/src/MQTTSNGWVersion.h.in new file mode 100644 index 0000000..8dab1a0 --- /dev/null +++ b/MQTTSNGateway/src/MQTTSNGWVersion.h.in @@ -0,0 +1,22 @@ +/************************************************************************************** + * Copyright (c) 2017, Tomoaki Yamaguchi + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * and Eclipse Distribution License v1.0 which accompany this distribution. + * + * The Eclipse Public License is available at + * http://www.eclipse.org/legal/epl-v10.html + * and the Eclipse Distribution License is available at + * http://www.eclipse.org/org/documents/edl-v10.php. + * + * Contributors: + * Tomoaki Yamaguchi - initial version + **************************************************************************************/ + +#ifndef MQTTSNGWVERSION_H_IN_ +#define MQTTSNGWVERSION_H_IN_ + +#define PAHO_GATEWAY_VERSION "@GATEWAY_VERSION@" + +#endif /* MQTTSNGWVERSION_H_IN_ */ \ No newline at end of file diff --git a/MQTTSNGateway/src/MQTTSNGateway.cpp b/MQTTSNGateway/src/MQTTSNGateway.cpp index 1065612..a67545e 100644 --- a/MQTTSNGateway/src/MQTTSNGateway.cpp +++ b/MQTTSNGateway/src/MQTTSNGateway.cpp @@ -17,6 +17,7 @@ #include "MQTTSNGateway.h" #include "SensorNetwork.h" #include "MQTTSNGWProcess.h" +#include "MQTTSNGWVersion.h" #include using namespace MQTTSNGW; @@ -218,7 +219,7 @@ void Gateway::run(void) WRITELOG("%s\n", PAHO_COPYRIGHT1); WRITELOG("%s\n", PAHO_COPYRIGHT2); WRITELOG(" *\n%s\n", PAHO_COPYRIGHT3); - WRITELOG("%s\n", GATEWAY_VERSION); + WRITELOG(" * Version: %s\n", PAHO_GATEWAY_VERSION); WRITELOG("%s\n", PAHO_COPYRIGHT4); WRITELOG("\n%s %s has been started.\n\n", currentDateTime(), _params.gatewayName); WRITELOG(" ConfigFile: %s\n", _params.configName); diff --git a/MQTTSNGateway/src/MQTTSNGateway.h b/MQTTSNGateway/src/MQTTSNGateway.h index 3f6af96..b5360c0 100644 --- a/MQTTSNGateway/src/MQTTSNGateway.h +++ b/MQTTSNGateway/src/MQTTSNGateway.h @@ -25,8 +25,6 @@ namespace MQTTSNGW /*================================= * Starting prompt ==================================*/ -#define GATEWAY_VERSION " * Version: 0.9.7" - #define PAHO_COPYRIGHT0 " * MQTT-SN Transparent Gateway" #define PAHO_COPYRIGHT1 " * Part of Project Paho in Eclipse" #define PAHO_COPYRIGHT2 " * (http://git.eclipse.org/c/paho/org.eclipse.paho.mqtt-sn.embedded-c.git/)"