aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-18 21:19:14 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-04-24 18:02:51 -0700
commitc5e40868209b365c7549d0da29b7063a72f21ed6 (patch)
tree116be5f882e83bb03424afd8018f1f8de07799b1
parent0aa87687a85abfcac2cd2da3c77a600ab47a0280 (diff)
downloadsubsurface-c5e40868209b365c7549d0da29b7063a72f21ed6.tar.gz
Only offer dive computers with supported transports
On Android we still need to do more filtering as only some of the USB divecomputers are supported. But on iOS this takes care of it without the hard coded list. Additionally, if built without BT or BLE support, the corresponding dive computers are no longer shown (e.g. Perdix AI on Windows). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--core/downloadfromdcthread.cpp35
1 files changed, 21 insertions, 14 deletions
diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp
index b3bf8ba28..e67d71403 100644
--- a/core/downloadfromdcthread.cpp
+++ b/core/downloadfromdcthread.cpp
@@ -102,20 +102,6 @@ static void fill_supported_mobile_list()
QStringList({{"Cobalt"}, {"Cobalt 2"}});
#endif
-#if defined(Q_OS_IOS)
- /* BLE only, Qt does not support classic BT on iOS */
- mobileProductList["Heinrichs Weikamp"] =
- QStringList({{"OSTC 2"}, {"OSTC 3"}, {"OSTC 3+"}, {"OSTC 4"}, {"OSTC Plus"}, {"OSTC Sport"}, {"OSTC 2 TR"}});
- mobileProductList["Mares"] =
- QStringList({{"Puck Pro"}, {"Smart"}, {"Quad"}});
- mobileProductList["Scubapro"] =
- QStringList({{"Aladin Sport Matrix"}, {"Aladin Square"}, {"G2"}});
- mobileProductList["Shearwater"] =
- QStringList({{"Perdix"}, {"Perdix AI"}, {"Petrel"}, {"Petrel 2"}});
- mobileProductList["Suunto"] =
- QStringList({{"EON Core"}, {"EON Steel"}});
-
-#endif
}
void fill_computer_list()
@@ -123,10 +109,31 @@ void fill_computer_list()
dc_iterator_t *iterator = NULL;
dc_descriptor_t *descriptor = NULL;
+ int transportMask = 0;
+#if defined(BT_SUPPORT)
+ transportMask |= DC_TRANSPORT_BLUETOOTH;
+#endif
+#if defined(BLE_SUPPORT)
+ transportMask |= DC_TRANSPORT_BLE;
+#endif
+#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(Q_OS_MAC)
+ transportMask |= DC_TRANSPORT_IRDA;
+#endif
+#if !defined(Q_OS_IOS)
+ transportMask |= DC_TRANSPORT_USB | DC_TRANSPORT_USBHID;
+#endif
+#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
+ transportMask |= DC_TRANSPORT_SERIAL;
+#endif
+
fill_supported_mobile_list();
dc_descriptor_iterator(&iterator);
while (dc_iterator_next(iterator, &descriptor) == DC_STATUS_SUCCESS) {
+ if ((dc_descriptor_get_transports(descriptor) & transportMask) == 0)
+ // none of the transports are available, skip
+ continue;
+
const char *vendor = dc_descriptor_get_vendor(descriptor);
const char *product = dc_descriptor_get_product(descriptor);
#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)