diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2018-05-12 11:22:54 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-05-12 21:09:14 -0700 |
commit | adf3d945e190d1e697b30aa9b7feae93d3297b38 (patch) | |
tree | af0ea69c088e80d67804ad1b96fb81d63446b9ee | |
parent | aa96aa3ac31a13d58423cf4068ae17a66d9108fa (diff) | |
download | subsurface-adf3d945e190d1e697b30aa9b7feae93d3297b38.tar.gz |
DC transport debugging messages
Show the transport types we support for each of the supported dive computers.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | core/downloadfromdcthread.cpp | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp index 1c60ca6cf..4c1343bbc 100644 --- a/core/downloadfromdcthread.cpp +++ b/core/downloadfromdcthread.cpp @@ -166,13 +166,38 @@ void fill_computer_list() qSort(vendorList); } +#define NUMTRANSPORTS 6 +static QString transportStringTable[NUMTRANSPORTS] = { + QStringLiteral("SERIAL"), + QStringLiteral("USB"), + QStringLiteral("USBHID"), + QStringLiteral("IRDA"), + QStringLiteral("BT"), + QStringLiteral("BLE") +}; + +static QString getTransportString(unsigned int transport) +{ + QString ts; + for (int i = 0; i < NUMTRANSPORTS; i++) { + if (transport & 1 << i) + ts += transportStringTable[i] + ", "; + } + ts.chop(2); + return ts; +} + void show_computer_list() { + unsigned int transportMask = get_supported_transports(NULL); qDebug() << "Supported dive computers:"; Q_FOREACH (QString vendor, vendorList) { QString msg = vendor + ": "; Q_FOREACH (QString product, productList[vendor]) { - msg += product + ", "; + dc_descriptor_t *descriptor = descriptorLookup[vendor + product]; + unsigned int transport = dc_descriptor_get_transports(descriptor) & transportMask; + QString transportString = getTransportString(transport); + msg += product + " (" + transportString +"), "; } msg.chop(2); qDebug() << msg; |