summaryrefslogtreecommitdiffstats
path: root/android-mobile/src/org/subsurfacedivelog
AgeCommit message (Collapse)Author
2020-03-16android usb serial: Prepare device / driver selectGravatar Christof Arnosti
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>
2020-03-08usb-serial-for-android: Implement timeout-handlingGravatar Christof Arnosti
Since the Android USB stack and subsequently the usb-serial-for-android driver have problems with read-timeouts, the read-timeout is now implemented in AndroidSerial.java. Also, DC_STATUS_TIMEOUT is returned if there are less bytes returned than expected. Different chipsets seem to behave differently with usb-serial-for-android. On CP210x the read blocks until there is some data here, but on FTDI the chip seems to return whatever is currently in the buffer (so 0 bytes if the buffer is empty). This different behaviour should be mitigated by the changes by this commit. Signed-off-by: Christof Arnosti <charno@charno.ch>
2020-03-07usb-serial-for-android: add PID/VIDsGravatar Christof Arnosti
Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-07usb-serial-for-android: ImplementationGravatar Christof Arnosti
Implement the libdivecomputer API in Java and create C/JNI translation layer. [Dirk Hohndel: whitespace harmonization - yes, some of this is Java, this still makes it much easier to read for me; also changed the FTDI conditional compilation to make sure we can still use that for mobile-on-desktop if necessary] Signed-off-by: Christof Arnosti <charno@charno.ch> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Whitespace cleanup, extra braces, and null checksGravatar Dirk Hohndel
Thanks to Lubomir for the review. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: fix function signature in java codeGravatar Dirk Hohndel
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: only handle Intents after the app is initializedGravatar Dirk Hohndel
The old code happened to work because this function only got called if the app was already running, but the correct thing to do is to always wait until we have first called back from C++ code, indicating that the app is indeed fully initialized. This way we only process the Intent in one place in the Java code. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: add callback from IntentGravatar Dirk Hohndel
Right now all this does is add the device string to the log. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2018-08-11Android: add Java class to receive IntentsGravatar Dirk Hohndel
We want to be able to respond to a USB device being plugged in. This simply logs the information we get from the device. Sadly the really useful getProductName and getManufacturerName require API level 21 (so Android 5.0 or newer) and we still have a couple hundred users on 4.1-4.4. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>