Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -51,4 +54,7 @@ interface SimpleBluetoothDeviceInterface {
interface OnErrorListener {
fun onError(error: Throwable)
}

fun getOutputStream(): OutputStream
fun getInputStream(): InputStream
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
Expand Down
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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