diff --git a/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterface.kt b/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterface.kt index 689f6ee..4fff64d 100644 --- a/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterface.kt +++ b/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterface.kt @@ -1,5 +1,8 @@ package com.harrysoft.androidbluetoothserial +import java.io.InputStream +import java.io.OutputStream + interface SimpleBluetoothDeviceInterface { /** * @return The BluetoothSerialDevice instance that the interface is wrapping. @@ -51,4 +54,7 @@ interface SimpleBluetoothDeviceInterface { interface OnErrorListener { fun onError(error: Throwable) } + + fun getOutputStream(): OutputStream + fun getInputStream(): InputStream } diff --git a/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterfaceImpl.kt b/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterfaceImpl.kt index cd15c77..49f72e1 100644 --- a/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterfaceImpl.kt +++ b/androidBluetoothSerial/src/main/java/com/harrysoft/androidbluetoothserial/SimpleBluetoothDeviceInterfaceImpl.kt @@ -3,6 +3,8 @@ package com.harrysoft.androidbluetoothserial import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.disposables.CompositeDisposable import io.reactivex.schedulers.Schedulers +import java.io.InputStream +import java.io.OutputStream /** * Implementation of SimpleBluetoothDeviceInterface, package-private @@ -49,6 +51,14 @@ internal class SimpleBluetoothDeviceInterfaceImpl(override val device: Bluetooth errorListener = listener } + override fun getOutputStream(): OutputStream { + return device.outputStream + } + + override fun getInputStream(): InputStream { + return device.inputStream + } + fun close() { compositeDisposable.dispose() } diff --git a/build.gradle b/build.gradle index dfa20b9..74a857c 100644 --- a/build.gradle +++ b/build.gradle @@ -5,7 +5,7 @@ buildscript { jcenter() } dependencies { - classpath 'com.android.tools.build:gradle:3.5.3' + classpath 'com.android.tools.build:gradle:4.2.2' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } } diff --git a/gradle.properties b/gradle.properties index 743d692..2de2ee2 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,3 +11,6 @@ org.gradle.jvmargs=-Xmx1536m # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects # org.gradle.parallel=true + +android.useAndroidX=true +android.enableJetifier=true diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 80feee7..c94dce2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip