summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Papp <lpapp@kde.org>2013-07-27 16:57:08 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-02 21:05:07 +0100
commit959775c41683033adbd99faab7e3d70e0009c143 (patch)
tree4d6586946d44617271dbbc56840d45196e855dec /examples
parent5a2314414fc89c6ef44521f6d13899045b6da7af (diff)
downloadqtserialport-959775c41683033adbd99faab7e3d70e0009c143.tar.gz
Add API for querying the serial number
Thanks go to Massimo Callegari for the initial patch and the request to remind us again. Thanks also go to Denis and Sergey for working on the windows serial number parser. Task-number: QTBUG-31981 Change-Id: I60d882280f481eb99d275e0a9c81da50292b1c61 Reviewed-by: Massimo Callegari <massimocallegari@yahoo.it> Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/serialport/cenumerator/main.cpp3
-rw-r--r--examples/serialport/enumerator/main.cpp1
-rw-r--r--examples/serialport/terminal/settingsdialog.ui11
3 files changed, 13 insertions, 2 deletions
diff --git a/examples/serialport/cenumerator/main.cpp b/examples/serialport/cenumerator/main.cpp
index 2d770e8..5007389 100644
--- a/examples/serialport/cenumerator/main.cpp
+++ b/examples/serialport/cenumerator/main.cpp
@@ -56,15 +56,18 @@ int main(int argc, char *argv[])
const QString blankString = QObject::tr("N/A");
QString description;
QString manufacturer;
+ QString serialNumber;
foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) {
description = serialPortInfo.description();
manufacturer = serialPortInfo.manufacturer();
+ serialNumber = serialPortInfo.serialNumber();
out << endl
<< QObject::tr("Port: ") << serialPortInfo.portName() << endl
<< QObject::tr("Location: ") << serialPortInfo.systemLocation() << endl
<< QObject::tr("Description: ") << (!description.isEmpty() ? description : blankString) << endl
<< QObject::tr("Manufacturer: ") << (!manufacturer.isEmpty() ? manufacturer : blankString) << endl
+ << QObject::tr("Serial number: ") << (!serialNumber.isEmpty() ? serialNumber : blankString) << endl
<< QObject::tr("Vendor Identifier: ") << (serialPortInfo.hasVendorIdentifier() ? QByteArray::number(serialPortInfo.vendorIdentifier(), 16) : blankString) << endl
<< QObject::tr("Product Identifier: ") << (serialPortInfo.hasProductIdentifier() ? QByteArray::number(serialPortInfo.productIdentifier(), 16) : blankString) << endl
<< QObject::tr("Busy: ") << (serialPortInfo.isBusy() ? QObject::tr("Yes") : QObject::tr("No")) << endl;
diff --git a/examples/serialport/enumerator/main.cpp b/examples/serialport/enumerator/main.cpp
index f365ace..48cacbd 100644
--- a/examples/serialport/enumerator/main.cpp
+++ b/examples/serialport/enumerator/main.cpp
@@ -61,6 +61,7 @@ int main(int argc, char *argv[])
+ QObject::tr("Location: ") + info.systemLocation() + "\n"
+ QObject::tr("Description: ") + info.description() + "\n"
+ QObject::tr("Manufacturer: ") + info.manufacturer() + "\n"
+ + QObject::tr("Serial number: ") + info.serialNumber() + "\n"
+ QObject::tr("Vendor Identifier: ") + (info.hasVendorIdentifier() ? QString::number(info.vendorIdentifier(), 16) : QString()) + "\n"
+ QObject::tr("Product Identifier: ") + (info.hasProductIdentifier() ? QString::number(info.productIdentifier(), 16) : QString()) + "\n"
+ QObject::tr("Busy: ") + (info.isBusy() ? QObject::tr("Yes") : QObject::tr("No")) + "\n";
diff --git a/examples/serialport/terminal/settingsdialog.ui b/examples/serialport/terminal/settingsdialog.ui
index 28c1211..8f15b1a 100644
--- a/examples/serialport/terminal/settingsdialog.ui
+++ b/examples/serialport/terminal/settingsdialog.ui
@@ -97,20 +97,27 @@
</widget>
</item>
<item row="3" column="0">
+ <widget class="QLabel" name="serialNumberLabel">
+ <property name="text">
+ <string>Serial number:</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0">
<widget class="QLabel" name="locationLabel">
<property name="text">
<string>Location:</string>
</property>
</widget>
</item>
- <item row="4" column="0">
+ <item row="5" column="0">
<widget class="QLabel" name="vidLabel">
<property name="text">
<string>Vendor ID:</string>
</property>
</widget>
</item>
- <item row="5" column="0">
+ <item row="6" column="0">
<widget class="QLabel" name="pidLabel">
<property name="text">
<string>Product ID:</string>