diff options
| author | Tomasz Sterna <tomek@xiaoka.com> | 2015-03-31 13:35:29 +0200 |
|---|---|---|
| committer | Tomasz Sterna <tomek@xiaoka.com> | 2015-03-31 13:37:04 +0200 |
| commit | c01b9da9f441d74578792ffeca2db25734b19704 (patch) | |
| tree | 03201c4d40085e9f6547d227a5df29ba6206277a /daemon/watchconnector.cpp | |
| parent | 435b5066f57ed0f0710dcc61ca927380e3916a7e (diff) | |
Expose Watch Info over DBus interface
Diffstat (limited to 'daemon/watchconnector.cpp')
| -rw-r--r-- | daemon/watchconnector.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
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; |
