aboutsummaryrefslogtreecommitdiffstats
path: root/core/serial_usb_android.h
diff options
context:
space:
mode:
authorGravatar Christof Arnosti <charno@charno.ch>2020-03-11 11:33:52 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-16 07:58:20 -0700
commita34a81d120fa2c66522bfcd450003e58dae62d3b (patch)
tree540bf5035f6ff24552bfd1d6645ff19bcfa6f942 /core/serial_usb_android.h
parent822b05bec4c81a35720f3c1e504a2a36f861d13a (diff)
downloadsubsurface-a34a81d120fa2c66522bfcd450003e58dae62d3b.tar.gz
android usb serial: Prepare device / driver select
This commit contains the serial_android_usb part of the changes proposed in issue #2657. What's implemented: - A data structure that contains all the data that can be used to describe an usb device (including user-facing string). - A function to get a list of all attached usb devices (optionally with selectable driver class). - Changes in the serial_android_usb_open-function and in the Java part to use the information about the usb device and optionally selected driver when connecting. This commit keeps compatibility with the current UI-Code in the case that only one USB-Device is connected. If two devices are connected, only the first one is tried. There are still some small things to do: - Change the user-facing string to something more descriptive. - Parts which aren't uesd anymore when the UI-Part is implemented are simply marked as obsolete (to keep compatibility for now). But generally it seems to work. [Dirk Hohndel: some white space / coding style adjustments] Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/serial_usb_android.h')
-rw-r--r--core/serial_usb_android.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/serial_usb_android.h b/core/serial_usb_android.h
new file mode 100644
index 000000000..7283950b3
--- /dev/null
+++ b/core/serial_usb_android.h
@@ -0,0 +1,16 @@
+#ifndef SERIAL_USB_ANDROID_H
+#define SERIAL_USB_ANDROID_H
+
+#include <string>
+#include <vector>
+
+/* USB Device Information */
+struct android_usb_serial_device_descriptor {
+ QAndroidJniObject usbDevice; /* the UsbDevice */
+ std::string className; /* the driver class name. If empty, then "autodetect" */
+ std::string uiRepresentation; /* The string that can be used for the user interface. */
+};
+
+std::vector<android_usb_serial_device_descriptor> serial_usb_android_get_devices(bool driverSelection);
+
+#endif