diff options
author | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2017-03-08 09:44:06 +0100 |
---|---|---|
committer | Maurice Kalinowski <maurice.kalinowski@qt.io> | 2017-03-08 08:54:31 +0000 |
commit | 6d04bd496fd11ae5adcf8aa8974d08483c4ff89d (patch) | |
tree | 64308f939d1f82af83d5e1a415f621b631a074a5 /tradeshow/iot-sensortag/main.cpp | |
parent | da65192baaab330b5f516c451ad0d08f3a9ad4b2 (diff) |
iot-sensortag: Add IP display
When the app automatically runs on startup, we need to have a way to
identify the device's IP address to deploy updates, for instance new MAC
filter addresses.
When clicking on the date string, it switches to show the IP addresses
available.
Change-Id: Ie3b10f2b701674ee07f1a8c7a3b064e67d8f6373
Reviewed-by: Risto Avila <risto.avila@qt.io>
Diffstat (limited to 'tradeshow/iot-sensortag/main.cpp')
-rw-r--r-- | tradeshow/iot-sensortag/main.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tradeshow/iot-sensortag/main.cpp b/tradeshow/iot-sensortag/main.cpp index 0925a5a..5164919 100644 --- a/tradeshow/iot-sensortag/main.cpp +++ b/tradeshow/iot-sensortag/main.cpp @@ -161,6 +161,14 @@ int main(int argc, char *argv[]) qCDebug(boot2QtDemos) << "screen dimensions" << scr->geometry().size(); qCDebug(boot2QtDemos) << "Scale factor:" << sf.data(); + QString addressString; + for (auto address : QNetworkInterface::allAddresses()) { + if (address.protocol() == QAbstractSocket::IPv4Protocol && address != QHostAddress(QHostAddress::LocalHost) + && !address.toString().startsWith(QLatin1String("169"))) { + addressString.append(address.toString()); + addressString.append(QLatin1Char('/')); + } + } #if defined(UI_SMALL) mainFile = namingScheme + QStringLiteral("/resources/small/MainSmall.qml"); styleFile = namingScheme + QStringLiteral("/resources/small/StyleSmall.qml"); @@ -216,6 +224,7 @@ int main(int argc, char *argv[]) item->setProperty("dataProviderPool", QVariant::fromValue(dataProviderPool)); item->setProperty("contentFile", mainFile); item->setProperty("seriesStorage", QVariant::fromValue(&seriesStorage)); + item->setProperty("addresses", addressString); } int returnValue = app.exec(); dataProviderPool->stopScanning(); |