this looks suspiciously easy
Linus Torvalds
torvalds at linux-foundation.org
Wed Apr 18 21:31:02 PDT 2018
Looks good to me.
Linus
On Wed, Apr 18, 2018, 21:26 Dirk Hohndel <dirk at hohndel.org> wrote:
> Hey Linus,
>
> I am surprised how simple this seems to be. What am I missing?
>
> /D
>
>
> From 4da077bcb6ef06655abd5216dce742b2b185efeb Mon Sep 17 00:00:00 2001
> From: Dirk Hohndel <dirk at hohndel.org>
> Date: Wed, 18 Apr 2018 21:19:14 -0700
> Subject: [PATCH] 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 at hohndel.org>
> ---
> core/downloadfromdcthread.cpp | 35 +++++++++++++++++++++--------------
> 1 file changed, 21 insertions(+), 14 deletions(-)
>
> diff --git a/core/downloadfromdcthread.cpp b/core/downloadfromdcthread.cpp
> index b3bf8ba28334..e67d71403ad2 100644
> --- a/core/downloadfromdcthread.cpp
> +++ b/core/downloadfromdcthread.cpp
> @@ -101,20 +101,6 @@ static void fill_supported_mobile_list()
> mobileProductList["Atomic Aquatics"] =
> 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
> }
>
> @@ -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)
> --
> 2.17.0
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.subsurface-divelog.org/pipermail/subsurface/attachments/20180419/14f4a5e2/attachment.html>
More information about the subsurface
mailing list