From cba100f55e534b4149f008b34e39cb70816bef0c Mon Sep 17 00:00:00 2001 From: Filip1159 Date: Sat, 18 Sep 2021 21:36:08 +0200 Subject: [PATCH] First commit, working communication with asking for user permission --- .gitignore | 15 + .idea/.gitignore | 3 + .idea/compiler.xml | 6 + .idea/gradle.xml | 21 + .idea/misc.xml | 16 + .idea/vcs.xml | 6 + app/.gitignore | 1 + app/build.gradle | 39 + app/proguard-rules.pro | 21 + .../ExampleInstrumentedTest.java | 26 + app/src/main/AndroidManifest.xml | 23 + .../serialportattemp4/MainActivity.java | 64 + .../drawable-v24/ic_launcher_foreground.xml | 30 + .../res/drawable/ic_launcher_background.xml | 170 ++ app/src/main/res/layout/activity_main.xml | 19 + .../res/mipmap-anydpi-v26/ic_launcher.xml | 5 + .../mipmap-anydpi-v26/ic_launcher_round.xml | 5 + app/src/main/res/mipmap-hdpi/ic_launcher.webp | Bin 0 -> 1404 bytes .../res/mipmap-hdpi/ic_launcher_round.webp | Bin 0 -> 2898 bytes app/src/main/res/mipmap-mdpi/ic_launcher.webp | Bin 0 -> 982 bytes .../res/mipmap-mdpi/ic_launcher_round.webp | Bin 0 -> 1772 bytes .../main/res/mipmap-xhdpi/ic_launcher.webp | Bin 0 -> 1900 bytes .../res/mipmap-xhdpi/ic_launcher_round.webp | Bin 0 -> 3918 bytes .../main/res/mipmap-xxhdpi/ic_launcher.webp | Bin 0 -> 2884 bytes .../res/mipmap-xxhdpi/ic_launcher_round.webp | Bin 0 -> 5914 bytes .../main/res/mipmap-xxxhdpi/ic_launcher.webp | Bin 0 -> 3844 bytes .../res/mipmap-xxxhdpi/ic_launcher_round.webp | Bin 0 -> 7778 bytes app/src/main/res/values-night/themes.xml | 16 + app/src/main/res/values/colors.xml | 10 + app/src/main/res/values/strings.xml | 3 + app/src/main/res/values/themes.xml | 16 + app/src/main/res/xml/device_filter.xml | 35 + .../serialportattemp4/ExampleUnitTest.java | 17 + build.gradle | 17 + gradle.properties | 19 + gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 59203 bytes gradle/wrapper/gradle-wrapper.properties | 6 + gradlew | 185 ++ gradlew.bat | 89 + settings.gradle | 10 + usbSerialForAndroid/build.gradle | 35 + .../results.bin | 1 + .../hoho/android/usbserial/BuildConfig.dex | Bin 0 -> 900 bytes .../CdcAcmSerialDriver$CdcAcmSerialPort.dex | Bin 0 -> 7012 bytes .../usbserial/driver/CdcAcmSerialDriver.dex | Bin 0 -> 2916 bytes .../Ch34xSerialDriver$Ch340SerialPort.dex | Bin 0 -> 8644 bytes .../usbserial/driver/Ch34xSerialDriver.dex | Bin 0 -> 2648 bytes .../usbserial/driver/CommonUsbSerialPort.dex | Bin 0 -> 7392 bytes .../Cp21xxSerialDriver$Cp21xxSerialPort.dex | Bin 0 -> 7664 bytes .../usbserial/driver/Cp21xxSerialDriver.dex | Bin 0 -> 2280 bytes .../FtdiSerialDriver$FtdiSerialPort.dex | Bin 0 -> 10816 bytes .../usbserial/driver/FtdiSerialDriver.dex | Bin 0 -> 2336 bytes .../android/usbserial/driver/ProbeTable.dex | Bin 0 -> 3232 bytes .../ProlificSerialDriver$DeviceType.dex | Bin 0 -> 1776 bytes ...rolificSerialDriver$ProlificSerialPort.dex | Bin 0 -> 13384 bytes .../usbserial/driver/ProlificSerialDriver.dex | Bin 0 -> 2600 bytes .../driver/SerialTimeoutException.dex | Bin 0 -> 660 bytes .../hoho/android/usbserial/driver/UsbId.dex | Bin 0 -> 2152 bytes .../usbserial/driver/UsbSerialDriver.dex | Bin 0 -> 828 bytes .../driver/UsbSerialPort$ControlLine.dex | Bin 0 -> 1784 bytes .../usbserial/driver/UsbSerialPort$Parity.dex | Bin 0 -> 884 bytes .../usbserial/driver/UsbSerialPort.dex | Bin 0 -> 2668 bytes .../usbserial/driver/UsbSerialProber.dex | Bin 0 -> 3532 bytes .../android/usbserial/util/MonotonicClock.dex | Bin 0 -> 748 bytes .../SerialInputOutputManager$Listener.dex | Bin 0 -> 944 bytes .../util/SerialInputOutputManager$State.dex | Bin 0 -> 1700 bytes .../util/SerialInputOutputManager.dex | Bin 0 -> 6232 bytes .../transformed/desugar_graph.bin | Bin 0 -> 235 bytes .../results.bin | 1 + .../hoho/android/usbserial/BuildConfig.dex | Bin 0 -> 900 bytes .../CdcAcmSerialDriver$CdcAcmSerialPort.dex | Bin 0 -> 7012 bytes .../usbserial/driver/CdcAcmSerialDriver.dex | Bin 0 -> 2916 bytes .../Ch34xSerialDriver$Ch340SerialPort.dex | Bin 0 -> 8644 bytes .../usbserial/driver/Ch34xSerialDriver.dex | Bin 0 -> 2648 bytes .../usbserial/driver/CommonUsbSerialPort.dex | Bin 0 -> 7396 bytes .../Cp21xxSerialDriver$Cp21xxSerialPort.dex | Bin 0 -> 7664 bytes .../usbserial/driver/Cp21xxSerialDriver.dex | Bin 0 -> 2280 bytes .../FtdiSerialDriver$FtdiSerialPort.dex | Bin 0 -> 10816 bytes .../usbserial/driver/FtdiSerialDriver.dex | Bin 0 -> 2336 bytes .../android/usbserial/driver/ProbeTable.dex | Bin 0 -> 3220 bytes .../ProlificSerialDriver$DeviceType.dex | Bin 0 -> 1776 bytes ...rolificSerialDriver$ProlificSerialPort.dex | Bin 0 -> 13396 bytes .../usbserial/driver/ProlificSerialDriver.dex | Bin 0 -> 2600 bytes .../driver/SerialTimeoutException.dex | Bin 0 -> 660 bytes .../hoho/android/usbserial/driver/UsbId.dex | Bin 0 -> 2152 bytes .../usbserial/driver/UsbSerialDriver.dex | Bin 0 -> 828 bytes .../driver/UsbSerialPort$ControlLine.dex | Bin 0 -> 1784 bytes .../usbserial/driver/UsbSerialPort$Parity.dex | Bin 0 -> 884 bytes .../usbserial/driver/UsbSerialPort.dex | Bin 0 -> 2668 bytes .../usbserial/driver/UsbSerialProber.dex | Bin 0 -> 3516 bytes .../android/usbserial/util/MonotonicClock.dex | Bin 0 -> 748 bytes .../SerialInputOutputManager$Listener.dex | Bin 0 -> 944 bytes .../util/SerialInputOutputManager$State.dex | Bin 0 -> 1700 bytes .../util/SerialInputOutputManager.dex | Bin 0 -> 6240 bytes .../transformed/desugar_graph.bin | Bin 0 -> 235 bytes .../results.bin | 1 + .../results.bin | 1 + .../transformed/classes/classes.dex | Bin 0 -> 57608 bytes .../hoho/android/usbserial/BuildConfig.java | 10 + .../debug/aapt/AndroidManifest.xml | 9 + .../debug/aapt/output-metadata.json | 18 + .../debug/aar-metadata.properties | 3 + .../debug/annotationProcessors.json | 1 + .../debug/classes.jar | Bin 0 -> 104055 bytes .../compile_r_class_jar/debug/R.jar | Bin 0 -> 309 bytes .../compile_symbol_list/debug/R.txt | 0 .../mergeDebugJniLibFolders/merger.xml | 2 + .../incremental/mergeDebugShaders/merger.xml | 2 + .../incremental/packageDebugAssets/merger.xml | 2 + .../compile-file-map.properties | 1 + .../packageDebugResources/merger.xml | 2 + .../hoho/android/usbserial/BuildConfig.class | Bin 0 -> 630 bytes .../CdcAcmSerialDriver$CdcAcmSerialPort.class | Bin 0 -> 7759 bytes .../usbserial/driver/CdcAcmSerialDriver.class | Bin 0 -> 2955 bytes .../Ch34xSerialDriver$Ch340SerialPort.class | Bin 0 -> 9520 bytes .../usbserial/driver/Ch34xSerialDriver.class | Bin 0 -> 2555 bytes .../driver/CommonUsbSerialPort.class | Bin 0 -> 8150 bytes .../Cp21xxSerialDriver$Cp21xxSerialPort.class | Bin 0 -> 8493 bytes .../usbserial/driver/Cp21xxSerialDriver.class | Bin 0 -> 2222 bytes .../FtdiSerialDriver$FtdiSerialPort.class | Bin 0 -> 11578 bytes .../usbserial/driver/FtdiSerialDriver.class | Bin 0 -> 2263 bytes .../android/usbserial/driver/ProbeTable.class | Bin 0 -> 3617 bytes .../ProlificSerialDriver$DeviceType.class | Bin 0 -> 1446 bytes ...lificSerialDriver$ProlificSerialPort.class | Bin 0 -> 15065 bytes .../driver/ProlificSerialDriver.class | Bin 0 -> 2686 bytes .../driver/SerialTimeoutException.class | Bin 0 -> 431 bytes .../hoho/android/usbserial/driver/UsbId.class | Bin 0 -> 2068 bytes .../usbserial/driver/UsbSerialDriver.class | Bin 0 -> 334 bytes .../driver/UsbSerialPort$ControlLine.class | Bin 0 -> 1444 bytes .../driver/UsbSerialPort$Parity.class | Bin 0 -> 420 bytes .../usbserial/driver/UsbSerialPort.class | Bin 0 -> 1863 bytes .../usbserial/driver/UsbSerialProber.class | Bin 0 -> 3883 bytes .../usbserial/util/MonotonicClock.class | Bin 0 -> 496 bytes .../SerialInputOutputManager$Listener.class | Bin 0 -> 350 bytes .../util/SerialInputOutputManager$State.class | Bin 0 -> 1364 bytes .../util/SerialInputOutputManager.class | Bin 0 -> 7186 bytes .../local_only_symbol_list/debug/R-def.txt | 2 + .../manifest-merger-blame-debug-report.txt | 11 + .../merged_manifest/debug/AndroidManifest.xml | 9 + .../navigation_json/debug/navigation.json | 1 + .../debug/output-metadata.json | 18 + .../hoho/android/usbserial/BuildConfig.class | Bin 0 -> 630 bytes .../CdcAcmSerialDriver$CdcAcmSerialPort.class | Bin 0 -> 7759 bytes .../usbserial/driver/CdcAcmSerialDriver.class | Bin 0 -> 2955 bytes .../Ch34xSerialDriver$Ch340SerialPort.class | Bin 0 -> 9520 bytes .../usbserial/driver/Ch34xSerialDriver.class | Bin 0 -> 2555 bytes .../driver/CommonUsbSerialPort.class | Bin 0 -> 8150 bytes .../Cp21xxSerialDriver$Cp21xxSerialPort.class | Bin 0 -> 8493 bytes .../usbserial/driver/Cp21xxSerialDriver.class | Bin 0 -> 2222 bytes .../FtdiSerialDriver$FtdiSerialPort.class | Bin 0 -> 11578 bytes .../usbserial/driver/FtdiSerialDriver.class | Bin 0 -> 2263 bytes .../android/usbserial/driver/ProbeTable.class | Bin 0 -> 3617 bytes .../ProlificSerialDriver$DeviceType.class | Bin 0 -> 1446 bytes ...lificSerialDriver$ProlificSerialPort.class | Bin 0 -> 15065 bytes .../driver/ProlificSerialDriver.class | Bin 0 -> 2686 bytes .../driver/SerialTimeoutException.class | Bin 0 -> 431 bytes .../hoho/android/usbserial/driver/UsbId.class | Bin 0 -> 2068 bytes .../usbserial/driver/UsbSerialDriver.class | Bin 0 -> 334 bytes .../driver/UsbSerialPort$ControlLine.class | Bin 0 -> 1444 bytes .../driver/UsbSerialPort$Parity.class | Bin 0 -> 420 bytes .../usbserial/driver/UsbSerialPort.class | Bin 0 -> 1863 bytes .../usbserial/driver/UsbSerialProber.class | Bin 0 -> 3883 bytes .../usbserial/util/MonotonicClock.class | Bin 0 -> 496 bytes .../SerialInputOutputManager$Listener.class | Bin 0 -> 350 bytes .../util/SerialInputOutputManager$State.class | Bin 0 -> 1364 bytes .../util/SerialInputOutputManager.class | Bin 0 -> 7186 bytes .../debug/classes.jar | Bin 0 -> 103768 bytes .../debug/package-aware-r.txt | 1 + .../logs/manifest-merger-debug-report.txt | 25 + .../source-classes-mapping.txt | 40 + usbSerialForAndroid/coverage.gradle | 79 + usbSerialForAndroid/proguard-rules.pro | 1 + .../publishToMavenLocal.gradle | 20 + .../src/androidTest/AndroidManifest.xml | 7 + .../hoho/android/usbserial/CrossoverTest.java | 163 ++ .../hoho/android/usbserial/DeviceTest.java | 2126 +++++++++++++++++ .../usbserial/driver/ProlificWrapper.java | 13 + .../android/usbserial/util/TelnetWrapper.java | 152 ++ .../android/usbserial/util/UsbWrapper.java | 275 +++ .../src/main/AndroidManifest.xml | 4 + .../usbserial/driver/CdcAcmSerialDriver.java | 327 +++ .../usbserial/driver/Ch34xSerialDriver.java | 387 +++ .../usbserial/driver/CommonUsbSerialPort.java | 301 +++ .../usbserial/driver/Cp21xxSerialDriver.java | 335 +++ .../usbserial/driver/FtdiSerialDriver.java | 431 ++++ .../android/usbserial/driver/ProbeTable.java | 87 + .../driver/ProlificSerialDriver.java | 580 +++++ .../driver/SerialTimeoutException.java | 15 + .../hoho/android/usbserial/driver/UsbId.java | 76 + .../usbserial/driver/UsbSerialDriver.java | 33 + .../usbserial/driver/UsbSerialPort.java | 261 ++ .../usbserial/driver/UsbSerialProber.java | 92 + .../usbserial/util/MonotonicClock.java | 14 + .../util/SerialInputOutputManager.java | 254 ++ .../driver/FtdiSerialDriverTest.java | 89 + 195 files changed, 7211 insertions(+) create mode 100644 .gitignore create mode 100644 .idea/.gitignore create mode 100644 .idea/compiler.xml create mode 100644 .idea/gradle.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 app/.gitignore create mode 100644 app/build.gradle create mode 100644 app/proguard-rules.pro create mode 100644 app/src/androidTest/java/com/example/serialportattemp4/ExampleInstrumentedTest.java create mode 100644 app/src/main/AndroidManifest.xml create mode 100644 app/src/main/java/com/example/serialportattemp4/MainActivity.java create mode 100644 app/src/main/res/drawable-v24/ic_launcher_foreground.xml create mode 100644 app/src/main/res/drawable/ic_launcher_background.xml create mode 100644 app/src/main/res/layout/activity_main.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml create mode 100644 app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-hdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-mdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp create mode 100644 app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp create mode 100644 app/src/main/res/values-night/themes.xml create mode 100644 app/src/main/res/values/colors.xml create mode 100644 app/src/main/res/values/strings.xml create mode 100644 app/src/main/res/values/themes.xml create mode 100644 app/src/main/res/xml/device_filter.xml create mode 100644 app/src/test/java/com/example/serialportattemp4/ExampleUnitTest.java create mode 100644 build.gradle create mode 100644 gradle.properties create mode 100644 gradle/wrapper/gradle-wrapper.jar create mode 100644 gradle/wrapper/gradle-wrapper.properties create mode 100644 gradlew create mode 100644 gradlew.bat create mode 100644 settings.gradle create mode 100644 usbSerialForAndroid/build.gradle create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/results.bin create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/BuildConfig.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/CdcAcmSerialDriver$CdcAcmSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/Ch34xSerialDriver$Ch340SerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/Ch34xSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/CommonUsbSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/Cp21xxSerialDriver$Cp21xxSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/Cp21xxSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/FtdiSerialDriver$FtdiSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/FtdiSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/ProbeTable.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver$DeviceType.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver$ProlificSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/SerialTimeoutException.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/UsbId.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialPort$ControlLine.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialPort$Parity.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialProber.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/util/MonotonicClock.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/util/SerialInputOutputManager$Listener.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/util/SerialInputOutputManager$State.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/debug/com/hoho/android/usbserial/util/SerialInputOutputManager.dex create mode 100644 usbSerialForAndroid/build/.transforms/801ad004df923f90f09bf5a905c899dd/transformed/desugar_graph.bin create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/results.bin create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/BuildConfig.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/CdcAcmSerialDriver$CdcAcmSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/Ch34xSerialDriver$Ch340SerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/Ch34xSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/CommonUsbSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/Cp21xxSerialDriver$Cp21xxSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/Cp21xxSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/FtdiSerialDriver$FtdiSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/FtdiSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/ProbeTable.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver$DeviceType.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver$ProlificSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/SerialTimeoutException.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/UsbId.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialDriver.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialPort$ControlLine.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialPort$Parity.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialPort.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/driver/UsbSerialProber.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/util/MonotonicClock.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/util/SerialInputOutputManager$Listener.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/util/SerialInputOutputManager$State.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/debug/com/hoho/android/usbserial/util/SerialInputOutputManager.dex create mode 100644 usbSerialForAndroid/build/.transforms/cfee14be31762b3317dfe1730fe267db/transformed/desugar_graph.bin create mode 100644 usbSerialForAndroid/build/.transforms/d7513fe86d78563eca08131602792524/results.bin create mode 100644 usbSerialForAndroid/build/.transforms/f7b9d1a1177b62f6330d340b9abcba31/results.bin create mode 100644 usbSerialForAndroid/build/.transforms/f7b9d1a1177b62f6330d340b9abcba31/transformed/classes/classes.dex create mode 100644 usbSerialForAndroid/build/generated/source/buildConfig/debug/com/hoho/android/usbserial/BuildConfig.java create mode 100644 usbSerialForAndroid/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/AndroidManifest.xml create mode 100644 usbSerialForAndroid/build/intermediates/aapt_friendly_merged_manifests/debug/aapt/output-metadata.json create mode 100644 usbSerialForAndroid/build/intermediates/aar_metadata/debug/aar-metadata.properties create mode 100644 usbSerialForAndroid/build/intermediates/annotation_processor_list/debug/annotationProcessors.json create mode 100644 usbSerialForAndroid/build/intermediates/compile_library_classes_jar/debug/classes.jar create mode 100644 usbSerialForAndroid/build/intermediates/compile_r_class_jar/debug/R.jar create mode 100644 usbSerialForAndroid/build/intermediates/compile_symbol_list/debug/R.txt create mode 100644 usbSerialForAndroid/build/intermediates/incremental/mergeDebugJniLibFolders/merger.xml create mode 100644 usbSerialForAndroid/build/intermediates/incremental/mergeDebugShaders/merger.xml create mode 100644 usbSerialForAndroid/build/intermediates/incremental/packageDebugAssets/merger.xml create mode 100644 usbSerialForAndroid/build/intermediates/incremental/packageDebugResources/compile-file-map.properties create mode 100644 usbSerialForAndroid/build/intermediates/incremental/packageDebugResources/merger.xml create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/BuildConfig.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/CdcAcmSerialDriver$CdcAcmSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/Ch34xSerialDriver$Ch340SerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/Ch34xSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/CommonUsbSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/Cp21xxSerialDriver$Cp21xxSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/Cp21xxSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/FtdiSerialDriver$FtdiSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/FtdiSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/ProbeTable.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/ProlificSerialDriver$DeviceType.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/ProlificSerialDriver$ProlificSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/ProlificSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/SerialTimeoutException.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/UsbId.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/UsbSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/UsbSerialPort$ControlLine.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/UsbSerialPort$Parity.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/UsbSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/driver/UsbSerialProber.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/util/MonotonicClock.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/util/SerialInputOutputManager$Listener.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/util/SerialInputOutputManager$State.class create mode 100644 usbSerialForAndroid/build/intermediates/javac/debug/classes/com/hoho/android/usbserial/util/SerialInputOutputManager.class create mode 100644 usbSerialForAndroid/build/intermediates/local_only_symbol_list/debug/R-def.txt create mode 100644 usbSerialForAndroid/build/intermediates/manifest_merge_blame_file/debug/manifest-merger-blame-debug-report.txt create mode 100644 usbSerialForAndroid/build/intermediates/merged_manifest/debug/AndroidManifest.xml create mode 100644 usbSerialForAndroid/build/intermediates/navigation_json/debug/navigation.json create mode 100644 usbSerialForAndroid/build/intermediates/packaged_manifests/debug/output-metadata.json create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/BuildConfig.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/CdcAcmSerialDriver$CdcAcmSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/Ch34xSerialDriver$Ch340SerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/Ch34xSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/CommonUsbSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/Cp21xxSerialDriver$Cp21xxSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/Cp21xxSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/FtdiSerialDriver$FtdiSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/FtdiSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/ProbeTable.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver$DeviceType.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver$ProlificSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/ProlificSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/SerialTimeoutException.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/UsbId.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/UsbSerialDriver.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/UsbSerialPort$ControlLine.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/UsbSerialPort$Parity.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/UsbSerialPort.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/driver/UsbSerialProber.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/util/MonotonicClock.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/util/SerialInputOutputManager$Listener.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/util/SerialInputOutputManager$State.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_dir/debug/com/hoho/android/usbserial/util/SerialInputOutputManager.class create mode 100644 usbSerialForAndroid/build/intermediates/runtime_library_classes_jar/debug/classes.jar create mode 100644 usbSerialForAndroid/build/intermediates/symbol_list_with_package_name/debug/package-aware-r.txt create mode 100644 usbSerialForAndroid/build/outputs/logs/manifest-merger-debug-report.txt create mode 100644 usbSerialForAndroid/build/tmp/compileDebugJavaWithJavac/source-classes-mapping.txt create mode 100644 usbSerialForAndroid/coverage.gradle create mode 100644 usbSerialForAndroid/proguard-rules.pro create mode 100644 usbSerialForAndroid/publishToMavenLocal.gradle create mode 100644 usbSerialForAndroid/src/androidTest/AndroidManifest.xml create mode 100644 usbSerialForAndroid/src/androidTest/java/com/hoho/android/usbserial/CrossoverTest.java create mode 100644 usbSerialForAndroid/src/androidTest/java/com/hoho/android/usbserial/DeviceTest.java create mode 100644 usbSerialForAndroid/src/androidTest/java/com/hoho/android/usbserial/driver/ProlificWrapper.java create mode 100644 usbSerialForAndroid/src/androidTest/java/com/hoho/android/usbserial/util/TelnetWrapper.java create mode 100644 usbSerialForAndroid/src/androidTest/java/com/hoho/android/usbserial/util/UsbWrapper.java create mode 100644 usbSerialForAndroid/src/main/AndroidManifest.xml create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/CdcAcmSerialDriver.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/Ch34xSerialDriver.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/CommonUsbSerialPort.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/Cp21xxSerialDriver.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/FtdiSerialDriver.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/ProbeTable.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/ProlificSerialDriver.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/SerialTimeoutException.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbId.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialDriver.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialPort.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/driver/UsbSerialProber.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/util/MonotonicClock.java create mode 100644 usbSerialForAndroid/src/main/java/com/hoho/android/usbserial/util/SerialInputOutputManager.java create mode 100644 usbSerialForAndroid/src/test/java/com/hoho/android/usbserial/driver/FtdiSerialDriverTest.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..aa724b7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +*.iml +.gradle +/local.properties +/.idea/caches +/.idea/libraries +/.idea/modules.xml +/.idea/workspace.xml +/.idea/navEditor.xml +/.idea/assetWizardSettings.xml +.DS_Store +/build +/captures +.externalNativeBuild +.cxx +local.properties diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..26d3352 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..fb7f4a8 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml new file mode 100644 index 0000000..01da9a7 --- /dev/null +++ b/.idea/gradle.xml @@ -0,0 +1,21 @@ + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..070ea19 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore new file mode 100644 index 0000000..42afabf --- /dev/null +++ b/app/.gitignore @@ -0,0 +1 @@ +/build \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle new file mode 100644 index 0000000..8eed281 --- /dev/null +++ b/app/build.gradle @@ -0,0 +1,39 @@ +plugins { + id 'com.android.application' +} + +android { + compileSdk 30 + + defaultConfig { + applicationId "com.example.serialportattemp4" + minSdk 23 + targetSdk 30 + versionCode 1 + versionName "1.0" + + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' + } + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +dependencies { + + implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'com.google.android.material:material:1.4.0' + implementation 'androidx.constraintlayout:constraintlayout:2.1.0' + testImplementation 'junit:junit:4.+' + androidTestImplementation 'androidx.test.ext:junit:1.1.3' + androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' + implementation project(':usbSerialForAndroid') +} \ No newline at end of file diff --git a/app/proguard-rules.pro b/app/proguard-rules.pro new file mode 100644 index 0000000..481bb43 --- /dev/null +++ b/app/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile \ No newline at end of file diff --git a/app/src/androidTest/java/com/example/serialportattemp4/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/example/serialportattemp4/ExampleInstrumentedTest.java new file mode 100644 index 0000000..6673a9b --- /dev/null +++ b/app/src/androidTest/java/com/example/serialportattemp4/ExampleInstrumentedTest.java @@ -0,0 +1,26 @@ +package com.example.serialportattemp4; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + assertEquals("com.example.serialportattemp4", appContext.getPackageName()); + } +} \ No newline at end of file diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..55e91f0 --- /dev/null +++ b/app/src/main/AndroidManifest.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/example/serialportattemp4/MainActivity.java b/app/src/main/java/com/example/serialportattemp4/MainActivity.java new file mode 100644 index 0000000..151ba56 --- /dev/null +++ b/app/src/main/java/com/example/serialportattemp4/MainActivity.java @@ -0,0 +1,64 @@ +package com.example.serialportattemp4; + +import androidx.appcompat.app.AppCompatActivity; + +import android.app.PendingIntent; +import android.content.Context; +import android.content.Intent; +import android.hardware.usb.UsbDeviceConnection; +import android.hardware.usb.UsbManager; +import android.os.Bundle; +import android.widget.Button; +import android.widget.Toast; + +import com.hoho.android.usbserial.driver.UsbSerialDriver; +import com.hoho.android.usbserial.driver.UsbSerialPort; +import com.hoho.android.usbserial.driver.UsbSerialProber; + +import java.io.IOException; +import java.util.ArrayList; + +public class MainActivity extends AppCompatActivity { + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.activity_main); + + Button sendButton = findViewById(R.id.sendButton); + + sendButton.setOnClickListener(view -> { + UsbManager usbManager = (UsbManager) getSystemService(Context.USB_SERVICE); + ArrayList drivers = (ArrayList) UsbSerialProber.getDefaultProber().findAllDrivers(usbManager); + if (drivers == null || drivers.isEmpty()) { + Toast.makeText(MainActivity.this, "drivers is null or empty", Toast.LENGTH_LONG).show(); + return; + } + UsbSerialDriver driver = drivers.get(0); + UsbDeviceConnection con = usbManager.openDevice(driver.getDevice()); + if (con == null) { + Toast.makeText(MainActivity.this, "Con is null", Toast.LENGTH_SHORT).show(); + if (usbManager.hasPermission(driver.getDevice())) { + Toast.makeText(this, "HAS PERMISSION", Toast.LENGTH_SHORT).show(); + } else { + Toast.makeText(this, "NO PERMISSION :( :(", Toast.LENGTH_SHORT).show(); + PendingIntent usbPermissionIntent = PendingIntent.getBroadcast(this, 0, new Intent(BuildConfig.APPLICATION_ID + ".GRANT_USB"), 0); + usbManager.requestPermission(driver.getDevice(), usbPermissionIntent); + } + return; + } + UsbSerialPort port = driver.getPorts().get(0); + if (port == null) { + Toast.makeText(MainActivity.this, "Port is null", Toast.LENGTH_SHORT).show(); + return; + } + try { + port.open(con); + port.setParameters(115200, 8, UsbSerialPort.STOPBITS_1, UsbSerialPort.PARITY_NONE); + port.write("00000000000".getBytes(), 1000); + } catch (IOException ioe) { + Toast.makeText(MainActivity.this, "IOE", Toast.LENGTH_SHORT).show(); + } + }); + } +} \ No newline at end of file diff --git a/app/src/main/res/drawable-v24/ic_launcher_foreground.xml b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml new file mode 100644 index 0000000..2b068d1 --- /dev/null +++ b/app/src/main/res/drawable-v24/ic_launcher_foreground.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_launcher_background.xml b/app/src/main/res/drawable/ic_launcher_background.xml new file mode 100644 index 0000000..07d5da9 --- /dev/null +++ b/app/src/main/res/drawable/ic_launcher_background.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml new file mode 100644 index 0000000..f6fb59f --- /dev/null +++ b/app/src/main/res/layout/activity_main.xml @@ -0,0 +1,19 @@ + + + + +