android/usb: pass in the UsbDevice when downloading

This finally allows us to download from not just the first device, but specifically
the device that the user picks.

Passing the object through a void pointer is not nice - but since this traverses
C code other solutions (like passing an index into the list) seemed even worse.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-03-14 18:11:46 -07:00
parent 1495aa2dbf
commit ec3a968df9
8 changed files with 38 additions and 11 deletions

View file

@ -48,6 +48,7 @@ typedef struct dc_user_device_t
FILE *libdc_logfile;
struct dive_table *download_table;
struct dive_site_table *sites;
void *androidUsbDeviceDescriptor;
} device_data_t;
const char *errmsg (dc_status_t rc);
@ -67,7 +68,7 @@ extern char *dumpfile_name;
dc_status_t ble_packet_open(dc_iostream_t **iostream, dc_context_t *context, const char* devaddr, void *userdata);
dc_status_t rfcomm_stream_open(dc_iostream_t **iostream, dc_context_t *context, const char* devaddr);
dc_status_t ftdi_open(dc_iostream_t **iostream, dc_context_t *context);
dc_status_t serial_usb_android_open(dc_iostream_t **iostream, dc_context_t *context);
dc_status_t serial_usb_android_open(dc_iostream_t **iostream, dc_context_t *context, void *androidUsbDevice);
dc_status_t divecomputer_device_open(device_data_t *data);