summaryrefslogtreecommitdiffstats
path: root/signal-composer/signalcomposer.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-12-05 20:01:00 -0500
committerScott Murray <scott.murray@konsulko.com>2019-12-06 15:57:15 +0000
commitd56ec009cca4dcfab6062ef4b69de647550d5178 (patch)
treeebbb5e75a3a40ddf8f274c164dcaebb476e5de7b /signal-composer/signalcomposer.cpp
parent3cd5fe38ba160fd8d0fdba40f8bd2b5ea8e001b5 (diff)
Add units and timestamp to signal-composer signal
The units and timestamp fields from signal-composer events may be useful for applications, so add them to the signal they get. Bug-AGL: SPEC-3023 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: I3c33da9b3afd04f0e18e00674328114e8903ce95 (cherry picked from commit 5f4576999a08efd4ccb401f033cd8183a53566b3)
Diffstat (limited to 'signal-composer/signalcomposer.cpp')
-rw-r--r--signal-composer/signalcomposer.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/signal-composer/signalcomposer.cpp b/signal-composer/signalcomposer.cpp
index b02c6d3..90e6446 100644
--- a/signal-composer/signalcomposer.cpp
+++ b/signal-composer/signalcomposer.cpp
@@ -76,9 +76,16 @@ void SignalComposer::onMessageReceived(MessageType type, Message *message)
if(v.canConvert(QMetaType::QString))
value = v.toString();
else
- qWarning() << "Unconvertible type for uid " << uid;
+ qWarning() << "Unconvertible value type for uid " << uid;
+ QString units = tmsg->eventData().value("unit").toString();
+ v = tmsg->eventData().value("timestamp").toVariant();
+ quint64 timestamp = 0;
+ if(v.canConvert(QMetaType::ULongLong))
+ timestamp = v.toULongLong();
+ else
+ qWarning() << "Unconvertible timestamp type for uid " << uid;
- emit signalEvent(uid, value);
+ emit signalEvent(uid, value, units, timestamp);
}
}
message->deleteLater();