Commit a16f0a82 authored by Michael Ott's avatar Michael Ott
Browse files

Introduce version numbers for dcdbpusher and the plugins

parent fee8cc37
......@@ -13,7 +13,9 @@ DISTFILES_HASHES = bacnet-stack-$(BACNET-STACK_VERSION).tgz|66b69111d91432fa67a7
include $(DCDBCOREPATH)/common.mk
CXXFLAGS = -std=c++11 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -DBOOST_NETWORK_ENABLE_HTTPS -O2 -g -Wall -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-variable -DBOOST_LOG_DYN_LINK -I$(DCDBBASEPATH)/dcdb/include -I$(DCDBDEPLOYPATH)/include -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/asio/asio/include
VERSION = $(shell git describe --tags|sed 's/-\([0-9]*\)/.\1/')
CXXFLAGS = -std=c++11 -DBOOST_DATE_TIME_POSIX_TIME_STD_CONFIG -DBOOST_NETWORK_ENABLE_HTTPS -O2 -g -Wall -Wno-unused-function -Wno-deprecated-declarations -Wno-unused-variable -DBOOST_LOG_DYN_LINK -I$(DCDBBASEPATH)/dcdb/include -I$(DCDBDEPLOYPATH)/include -I$(DCDBDEPSPATH)/cpp-netlib-0.12.0-final/deps/asio/asio/include -DVERSION=\"$(VERSION)\"
LIBS = -L../deps/mosquitto_build/lib -L$(DCDBDEPLOYPATH)/lib/ -ldl -lmosquitto -lboost_system -lboost_thread -lboost_log_setup -lboost_log -lboost_regex -lpthread -lcrypto -lssl -lcppnetlib-server-parsers -lcppnetlib-uri -rdynamic
OBJS = src/dcdbpusher.o src/Configuration.o src/MQTTPusher.o src/HttpsServer.o
......
......@@ -199,7 +199,7 @@ bool Configuration::readPlugins() {
BOOST_FOREACH(boost::property_tree::iptree::value_type &plugin, cfg.get_child("plugins")) {
if (boost::iequals(plugin.first, "plugin")) {
if (!plugin.second.empty()) {
LOG(info) << "Loading plugin \"" << plugin.second.data() << "\"...";
LOG(info) << "Loading plugin " << plugin.second.data() << "...";
std::string pluginConfig; //path to config file for plugin
std::string pluginLib = "libdcdbplugin_" + plugin.second.data(); //TODO add version information? //path to the plugin-lib
#if __APPLE__
......@@ -268,13 +268,13 @@ bool Configuration::readPlugins() {
dynLib.configurator->setGlobalSettings(_global.pluginSettings);
//read in config
if (!(dynLib.configurator->readConfig(pluginConfig))) {
LOG(error) << "Plugin \"" << dynLib.id << "\" could not read configuration!";
LOG(error) << "Plugin " << dynLib.id << " could not read configuration!";
return false;
}
// returning an empty vector may indicate problems with the config file
if(dynLib.configurator->getSensorGroups().size() == 0) {
LOG(warning) << "Plugin \"" << dynLib.id << "\" created no sensors!";
LOG(warning) << "Plugin " << dynLib.id << " created no sensors!";
}
//check if an MQTT-suffix was assigned twice
......@@ -290,7 +290,7 @@ bool Configuration::readPlugins() {
//save dl-struct
_plugins.push_back(dynLib);
LOG(info) << "Plugin \"" << dynLib.id << "\" loaded!";
LOG(info) << "Plugin " << dynLib.id << " " << dynLib.configurator->getVersion() << " loaded!";
} else {
LOG(info) << pluginConfig << " not found. Omitting";
}
......
......@@ -32,6 +32,7 @@
#include "HttpsServer.h"
#include "Configuration.h"
#include "MQTTPusher.h"
#include "version.h"
#include <boost/foreach.hpp>
#include <boost/asio.hpp>
......@@ -107,6 +108,7 @@ void printSyntax()
}
int main(int argc, char** argv) {
cout << "dcdbpusher " << VERSION << endl << endl;
boost::asio::io_service io;
boost::thread_group threads;
......
......@@ -28,6 +28,7 @@ class ConfiguratorInterface {
public:
virtual ~ConfiguratorInterface() {}
virtual std::string getVersion() = 0;
virtual bool readConfig(std::string cfgPath) = 0;
virtual bool reReadConfig() = 0;
virtual void setGlobalSettings(const pluginSettings_t& pluginSettings) = 0;
......
......@@ -18,6 +18,7 @@
#include "ConfiguratorInterface.h"
#include "SensorBase.h"
#include "SensorGroupTemplate.h"
#include "version.h"
#include <iostream>
#include <sstream>
......@@ -81,6 +82,9 @@ public:
ConfiguratorTemplate& operator=(const ConfiguratorTemplate&) = delete;
std::string getVersion() {
return std::string(VERSION);
}
/**
* Read in the given configuration
*
......
//
// version.h
// dcdbpusher
//
// Created by Ott, Michael on 19.12.18.
// Copyright © 2018 LRZ. All rights reserved.
//
#ifndef VERSION_H
#define VERSION_H
#ifndef VERSION
#define VERSION "0.1"
#endif
#endif /* version_h */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment