Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
dcdb
dcdb
Commits
a16f0a82
Commit
a16f0a82
authored
Dec 19, 2018
by
Michael Ott
Browse files
Introduce version numbers for dcdbpusher and the plugins
parent
fee8cc37
Changes
6
Hide whitespace changes
Inline
Side-by-side
Makefile
View file @
a16f0a82
...
@@ -13,7 +13,9 @@ DISTFILES_HASHES = bacnet-stack-$(BACNET-STACK_VERSION).tgz|66b69111d91432fa67a7
...
@@ -13,7 +13,9 @@ DISTFILES_HASHES = bacnet-stack-$(BACNET-STACK_VERSION).tgz|66b69111d91432fa67a7
include
$(DCDBCOREPATH)/common.mk
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
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
OBJS
=
src/dcdbpusher.o src/Configuration.o src/MQTTPusher.o src/HttpsServer.o
...
...
src/Configuration.cpp
View file @
a16f0a82
...
@@ -199,7 +199,7 @@ bool Configuration::readPlugins() {
...
@@ -199,7 +199,7 @@ bool Configuration::readPlugins() {
BOOST_FOREACH
(
boost
::
property_tree
::
iptree
::
value_type
&
plugin
,
cfg
.
get_child
(
"plugins"
))
{
BOOST_FOREACH
(
boost
::
property_tree
::
iptree
::
value_type
&
plugin
,
cfg
.
get_child
(
"plugins"
))
{
if
(
boost
::
iequals
(
plugin
.
first
,
"plugin"
))
{
if
(
boost
::
iequals
(
plugin
.
first
,
"plugin"
))
{
if
(
!
plugin
.
second
.
empty
())
{
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
pluginConfig
;
//path to config file for plugin
std
::
string
pluginLib
=
"libdcdbplugin_"
+
plugin
.
second
.
data
();
//TODO add version information? //path to the plugin-lib
std
::
string
pluginLib
=
"libdcdbplugin_"
+
plugin
.
second
.
data
();
//TODO add version information? //path to the plugin-lib
#if __APPLE__
#if __APPLE__
...
@@ -268,13 +268,13 @@ bool Configuration::readPlugins() {
...
@@ -268,13 +268,13 @@ bool Configuration::readPlugins() {
dynLib
.
configurator
->
setGlobalSettings
(
_global
.
pluginSettings
);
dynLib
.
configurator
->
setGlobalSettings
(
_global
.
pluginSettings
);
//read in config
//read in config
if
(
!
(
dynLib
.
configurator
->
readConfig
(
pluginConfig
)))
{
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
;
return
false
;
}
}
// returning an empty vector may indicate problems with the config file
// returning an empty vector may indicate problems with the config file
if
(
dynLib
.
configurator
->
getSensorGroups
().
size
()
==
0
)
{
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
//check if an MQTT-suffix was assigned twice
...
@@ -290,7 +290,7 @@ bool Configuration::readPlugins() {
...
@@ -290,7 +290,7 @@ bool Configuration::readPlugins() {
//save dl-struct
//save dl-struct
_plugins
.
push_back
(
dynLib
);
_plugins
.
push_back
(
dynLib
);
LOG
(
info
)
<<
"Plugin
\"
"
<<
dynLib
.
id
<<
"
\
"
loaded!"
;
LOG
(
info
)
<<
"Plugin "
<<
dynLib
.
id
<<
"
"
<<
dynLib
.
configurator
->
getVersion
()
<<
" loaded!"
;
}
else
{
}
else
{
LOG
(
info
)
<<
pluginConfig
<<
" not found. Omitting"
;
LOG
(
info
)
<<
pluginConfig
<<
" not found. Omitting"
;
}
}
...
...
src/dcdbpusher.cpp
View file @
a16f0a82
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include "HttpsServer.h"
#include "HttpsServer.h"
#include "Configuration.h"
#include "Configuration.h"
#include "MQTTPusher.h"
#include "MQTTPusher.h"
#include "version.h"
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
#include <boost/asio.hpp>
#include <boost/asio.hpp>
...
@@ -107,6 +108,7 @@ void printSyntax()
...
@@ -107,6 +108,7 @@ void printSyntax()
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
cout
<<
"dcdbpusher "
<<
VERSION
<<
endl
<<
endl
;
boost
::
asio
::
io_service
io
;
boost
::
asio
::
io_service
io
;
boost
::
thread_group
threads
;
boost
::
thread_group
threads
;
...
...
src/includes/ConfiguratorInterface.h
View file @
a16f0a82
...
@@ -28,6 +28,7 @@ class ConfiguratorInterface {
...
@@ -28,6 +28,7 @@ class ConfiguratorInterface {
public:
public:
virtual
~
ConfiguratorInterface
()
{}
virtual
~
ConfiguratorInterface
()
{}
virtual
std
::
string
getVersion
()
=
0
;
virtual
bool
readConfig
(
std
::
string
cfgPath
)
=
0
;
virtual
bool
readConfig
(
std
::
string
cfgPath
)
=
0
;
virtual
bool
reReadConfig
()
=
0
;
virtual
bool
reReadConfig
()
=
0
;
virtual
void
setGlobalSettings
(
const
pluginSettings_t
&
pluginSettings
)
=
0
;
virtual
void
setGlobalSettings
(
const
pluginSettings_t
&
pluginSettings
)
=
0
;
...
...
src/includes/ConfiguratorTemplate.h
View file @
a16f0a82
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#include "ConfiguratorInterface.h"
#include "ConfiguratorInterface.h"
#include "SensorBase.h"
#include "SensorBase.h"
#include "SensorGroupTemplate.h"
#include "SensorGroupTemplate.h"
#include "version.h"
#include <iostream>
#include <iostream>
#include <sstream>
#include <sstream>
...
@@ -81,6 +82,9 @@ public:
...
@@ -81,6 +82,9 @@ public:
ConfiguratorTemplate
&
operator
=
(
const
ConfiguratorTemplate
&
)
=
delete
;
ConfiguratorTemplate
&
operator
=
(
const
ConfiguratorTemplate
&
)
=
delete
;
std
::
string
getVersion
()
{
return
std
::
string
(
VERSION
);
}
/**
/**
* Read in the given configuration
* Read in the given configuration
*
*
...
...
src/includes/version.h
0 → 100644
View file @
a16f0a82
//
// 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 */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment