diff options
author | Scott Murray <scott.murray@konsulko.com> | 2019-12-05 20:01:00 -0500 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-12-05 20:01:00 -0500 |
commit | 5f4576999a08efd4ccb401f033cd8183a53566b3 (patch) | |
tree | 02f8e4e3e03534e4fd3edd23b07e07c69380eb37 /signal-composer | |
parent | 2e95f1fb45741c9a2b22dc286990c590ed9e5b06 (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
Diffstat (limited to 'signal-composer')
-rw-r--r-- | signal-composer/signalcomposer.cpp | 11 | ||||
-rw-r--r-- | signal-composer/signalcomposer.h | 2 |
2 files changed, 10 insertions, 3 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(); diff --git a/signal-composer/signalcomposer.h b/signal-composer/signalcomposer.h index d0b0332..594e263 100644 --- a/signal-composer/signalcomposer.h +++ b/signal-composer/signalcomposer.h @@ -32,7 +32,7 @@ class SignalComposer : public QObject virtual ~SignalComposer(); signals: - void signalEvent(QString uid, QString value); + void signalEvent(QString uid, QString value, QString units, quint64 timestamp); private: MessageEngine *m_mloop; |