mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
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>
This commit is contained in:
parent
aa96aa3ac3
commit
adf3d945e1
1 changed files with 26 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue