Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
9.2.2023: Due to updates GitLab will be unavailable for some minutes between 9:00 and 11:00.
Open sidebar
dcdb
dcdb
Commits
6dec7770
Commit
6dec7770
authored
Jun 27, 2019
by
Micha Müller
Browse files
Pusher: fixes to Caliper plugin
parent
fd7dbb41
Changes
4
Hide whitespace changes
Inline
Side-by-side
dcdbpusher/config/caliper.conf
View file @
6dec7770
global
{
mqttPrefix
/
FF112233445566778899AABB
mqttPrefix
/
caliper
}
group
cali
{
...
...
dcdbpusher/includes/ConfiguratorTemplate.h
View file @
6dec7770
...
...
@@ -1066,7 +1066,7 @@ protected:
*/
bool
constructSensorTopics
()
{
// Sensor names are adjusted according to the respective MQTT topics
for
(
auto
&
g
:
_sensorGroups
)
for
(
auto
&
g
:
_sensorGroups
)
{
for
(
auto
&
s
:
g
->
acquireSensors
())
{
s
->
setMqtt
(
MQTTChecker
::
formatTopic
(
_mqttPrefix
)
+
MQTTChecker
::
formatTopic
(
g
->
getMqttPart
())
+
...
...
@@ -1075,6 +1075,8 @@ protected:
if
(
s
->
getSinkPath
()
!=
""
)
s
->
setSinkPath
(
MQTTChecker
::
topicToFile
(
s
->
getMqtt
(),
s
->
getSinkPath
()));
}
g
->
releaseSensors
();
}
return
true
;
}
///@}
...
...
dcdbpusher/sensors/caliper/CaliperSensorGroup.cpp
View file @
6dec7770
...
...
@@ -132,13 +132,9 @@ void CaliperSensorGroup::read() {
//retrieve all messages currently available at the socket
while
(
true
)
{
const
ssize_t
nrec
=
recv
(
_connection
,
(
void
*
)
buf
,
bufSize
,
MSG_DONTWAIT
);
#ifdef DEBUG
LOG
(
debug
)
<<
_groupName
<<
": Receiving message..."
;
#endif
//nrec==0 indicates that the connection was closed. Probably because Caliper terminated
if
(
nrec
==
0
)
{
//TODO clean up sensors
close
(
_connection
);
_connection
=
-
1
;
LOG
(
debug
)
<<
_groupName
<<
": Connection closed"
;
...
...
@@ -164,9 +160,6 @@ void CaliperSensorGroup::read() {
reading_t
reading
;
reading
.
value
=
1
;
reading
.
timestamp
=
std
::
stoull
(
timestamp
);
#ifdef DEBUG
LOG
(
debug
)
<<
_groupName
<<
": Received value "
<<
feName
<<
" ("
<<
timestamp
<<
")"
;
#endif
S_Ptr
s
;
auto
it
=
_sensorIndex
.
find
(
feName
);
...
...
dcdbpusher/sensors/caliper/CaliperSensorGroup.h
View file @
6dec7770
...
...
@@ -49,7 +49,6 @@ public:
bool
execOnStart
()
final
override
;
void
execOnStop
()
final
override
;
//TODO spins forever ?! why !?!? probably some evil spirit does not release sensors after acquiring them
std
::
vector
<
SBasePtr
>&
acquireSensors
()
final
override
{
while
(
_lock
.
test_and_set
(
std
::
memory_order_acquire
))
{}
return
_baseSensors
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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