this looks suspiciously easy

Jef Driesen jef at libdivecomputer.org
Wed Apr 18 23:13:23 PDT 2018


On 2018-04-19 06:25, Dirk Hohndel wrote:
> @@ -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
> +

You can also get the mask with the built-in transports from 
libdivecomputer with the dc_context_get_transports() function. With the 
above, you'll for example show usb or usbhid devices even when 
libdivecomputer was build without usb or usbhid support.

For transports where subsurface uses a custom I/O implementation 
(bluetooth and ble), you of course need to set the bits as above.

Jef


More information about the subsurface mailing list