From c01b9da9f441d74578792ffeca2db25734b19704 Mon Sep 17 00:00:00 2001 From: Tomasz Sterna Date: Tue, 31 Mar 2015 13:35:29 +0200 Subject: Expose Watch Info over DBus interface --- daemon/watchconnector.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'daemon/watchconnector.cpp') diff --git a/daemon/watchconnector.cpp b/daemon/watchconnector.cpp index f992847..ec9bc20 100644 --- a/daemon/watchconnector.cpp +++ b/daemon/watchconnector.cpp @@ -28,6 +28,29 @@ QDebug operator<< (QDebug d, const WatchConnector::WatchVersions &ver) { return d; } +QVariantMap WatchConnector::SoftwareVersion::toMap() +{ + QVariantMap map; + map.insert("version", this->version); + map.insert("build", this->build.toTime_t()); + map.insert("commit", this->commit); + map.insert("hardware", this->hw_string); + map.insert("metadata", this->metadata_version); + map.insert("recovery", this->is_recovery); + return map; +} + +QVariantMap WatchConnector::WatchVersions::toMap() +{ + QVariantMap map; + map.insert("bootloader", this->bootLoaderBuild.toTime_t()); + map.insert("serial", this->serialNumber); + map.insert("address", this->address.toHex()); + map.insertMulti("firmware", this->main.toMap()); + map.insertMulti("firmware", this->safe.toMap()); + return map; +} + WatchConnector::WatchConnector(QObject *parent) : QObject(parent), l(metaObject()->className()), socket(nullptr), is_connected(false) { @@ -72,6 +95,8 @@ WatchConnector::WatchConnector(QObject *parent) : if (u.bad()) { qCWarning(l) << "short read while reading firmware version"; + } else { + emit versionsChanged(); } qCDebug(l) << "hardware information:" << _versions; -- cgit v1.2.3