desc:移植串口通信Lib
parent
c69ec99c44
commit
f3a207b7a9
@ -0,0 +1,159 @@
|
|||||||
|
project.ext {
|
||||||
|
sign = [
|
||||||
|
keystore_path : "../signature/innovationapp.jks",
|
||||||
|
keystore_pwd : "123456",
|
||||||
|
keystore_alias: "yinuo"
|
||||||
|
]
|
||||||
|
|
||||||
|
compileOptions = [
|
||||||
|
sourceCompatibility: JavaVersion.VERSION_1_8,
|
||||||
|
targetCompatibility: JavaVersion.VERSION_1_8,
|
||||||
|
]
|
||||||
|
|
||||||
|
versions = [
|
||||||
|
compileSdkVersion : 31,
|
||||||
|
buildToolsVersion : "33.0.3",
|
||||||
|
minSdkVersion : 23,
|
||||||
|
targetSdkVersion : 28,
|
||||||
|
versionCode : 1,
|
||||||
|
versionName : "1.0",
|
||||||
|
jvmTarget : "1.8",
|
||||||
|
|
||||||
|
appcompat : "1.2.0",
|
||||||
|
material : "1.2.1",
|
||||||
|
okhttp : "4.9.1",
|
||||||
|
retrofit : "2.9.0",
|
||||||
|
rxjava : "3.0.13",
|
||||||
|
rxandroid : "3.0.0",
|
||||||
|
kotlin : "1.5.10",
|
||||||
|
kotlin_android : "1.5.0",
|
||||||
|
converter_gson : '2.9.0',
|
||||||
|
retrofit_rxjava : "2.9.0",
|
||||||
|
room : "2.3.0",
|
||||||
|
jxl : "2.6.12",
|
||||||
|
navigation_fragment_ktx: "2.3.0",
|
||||||
|
navigation_ui_ktx : "2.3.0",
|
||||||
|
glide : "4.12.0",
|
||||||
|
photo_view : "2.3.0",
|
||||||
|
luban : "1.1.8",
|
||||||
|
gson : "2.8.6",
|
||||||
|
arouter : "1.5.2",
|
||||||
|
mmkv : "1.2.10",
|
||||||
|
okhttp_logger : "3.12.7",
|
||||||
|
lifecycle_process : "2.3.1",
|
||||||
|
]
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
okhttp : "com.squareup.okhttp3:okhttp:${versions.okhttp}",
|
||||||
|
retrofit : "com.squareup.retrofit2:retrofit:${versions.retrofit}",
|
||||||
|
rxjava : "io.reactivex.rxjava3:rxjava:${versions.rxjava}",
|
||||||
|
rxandroid : "io.reactivex.rxjava3:rxandroid:${versions.rxandroid}",
|
||||||
|
okhttp_logger : "com.squareup.okhttp3:logging-interceptor:${versions.okhttp_logger}",
|
||||||
|
kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:${versions.kotlin}",
|
||||||
|
kotlin_android : "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlin_android}",
|
||||||
|
converter_gson : "com.squareup.retrofit2:converter-gson:${versions.converter_gson}",
|
||||||
|
retrofit_rxjava : "com.squareup.retrofit2:adapter-rxjava3:${versions.retrofit_rxjava}",
|
||||||
|
room : "androidx.room:room-runtime:${versions.room}",
|
||||||
|
room_compiler : "androidx.room:room-compiler:${versions.room}",
|
||||||
|
room_ktx : "androidx.room:room-ktx:${versions.room}",
|
||||||
|
room_rxjava : "androidx.room:room-rxjava3:${versions.room}",
|
||||||
|
jxl : "net.sourceforge.jexcelapi:jxl:${versions.jxl}",
|
||||||
|
navigation_fragment_ktx: "androidx.navigation:navigation-fragment-ktx:${versions.navigation_fragment_ktx}",
|
||||||
|
navigation_ui_ktx : "androidx.navigation:navigation-ui-ktx:${versions.navigation_ui_ktx}",
|
||||||
|
navigation_arg : "androidx.navigation:navigation-safe-args-gradle-plugin:${versions.navigation_ui_ktx}",
|
||||||
|
glide : "com.github.bumptech.glide:glide:${versions.glide}",
|
||||||
|
gilde_integration : "com.github.bumptech.glide:okhttp3-integration:${versions.glide}",
|
||||||
|
annotationProcessor : "com.github.bumptech.glide:compiler:${versions.glide}",
|
||||||
|
photo_view : "com.github.chrisbanes:PhotoView:${versions.photo_view}",
|
||||||
|
luban : "top.zibin:Luban:${versions.luban}",
|
||||||
|
gson : "com.google.code.gson:gson:${versions.gson}",
|
||||||
|
arouter : "com.alibaba:arouter-api:${versions.arouter}",
|
||||||
|
arouter_compiler : "com.alibaba:arouter-compiler:${versions.arouter}",
|
||||||
|
mmkv : "com.tencent:mmkv-static:${versions.mmkv}",
|
||||||
|
lifecycle_process : "androidx.lifecycle:lifecycle-process:${versions.lifecycle_process}",
|
||||||
|
]
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android project android {} default config
|
||||||
|
*/
|
||||||
|
setAndroidConfig = {
|
||||||
|
extension ->
|
||||||
|
extension.compileSdkVersion versions.compileSdkVersion
|
||||||
|
|
||||||
|
extension.defaultConfig {
|
||||||
|
minSdkVersion versions.minSdkVersion
|
||||||
|
targetSdkVersion versions.targetSdkVersion
|
||||||
|
versionCode versions.versionCode
|
||||||
|
versionName versions.vserionName
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
}
|
||||||
|
|
||||||
|
extension.compileOptions {
|
||||||
|
targetCompatibility = compileOptions.targetCompatibility
|
||||||
|
sourceCompatibility = compileOptions.sourceCompatibility
|
||||||
|
}
|
||||||
|
|
||||||
|
extension.kotlinOptions {
|
||||||
|
jvmTarget = versions.jvmTarget
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android project dependencies {} default config
|
||||||
|
*/
|
||||||
|
setDependencies = {
|
||||||
|
extension ->
|
||||||
|
extension.implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android library config
|
||||||
|
*/
|
||||||
|
setLibDefaultConfig = {
|
||||||
|
extension ->
|
||||||
|
extension.apply plugin: 'com.android.library'
|
||||||
|
extension.apply plugin: 'kotlin-android'
|
||||||
|
extension.apply plugin: 'kotlin-parcelize'
|
||||||
|
extension.apply plugin: 'kotlin-kapt'
|
||||||
|
extension.description "lib"
|
||||||
|
|
||||||
|
setAndroidConfig extension.android
|
||||||
|
setDependencies extension.dependencies
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android application config
|
||||||
|
*/
|
||||||
|
setAppDefaultConfig = {
|
||||||
|
extension ->
|
||||||
|
extension.apply plugin: 'com.android.application'
|
||||||
|
extension.apply plugin: 'kotlin-android'
|
||||||
|
extension.apply plugin: 'kotlin-parcelize'
|
||||||
|
extension.apply plugin: 'kotlin-kapt'
|
||||||
|
extension.description "lib"
|
||||||
|
|
||||||
|
setAndroidConfig extension.android
|
||||||
|
setDependencies extension.dependencies
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* android library common config
|
||||||
|
*/
|
||||||
|
setArouterConfig = {
|
||||||
|
extension ->
|
||||||
|
extension.android.defaultConfig {
|
||||||
|
javaCompileOptions {
|
||||||
|
annotationProcessorOptions {
|
||||||
|
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 添加ARouter依赖
|
||||||
|
extension.dependencies.implementation(rootProject.ext.dependencies.arouter) {
|
||||||
|
exclude group: 'com.android.support'
|
||||||
|
}
|
||||||
|
extension.dependencies.annotationProcessor rootProject.ext.dependencies.arouter_compiler
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1 @@
|
|||||||
|
/build
|
@ -0,0 +1,22 @@
|
|||||||
|
apply from: "${rootProject.rootDir}/buildCommon/commonLibConfig.gradle"
|
||||||
|
project.ext.setLibDefaultConfig project
|
||||||
|
|
||||||
|
android {
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
buildFeatures {
|
||||||
|
viewBinding true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.aill:AndroidSerialPort:1.0.8'
|
||||||
|
}
|
@ -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
|
@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="com.common.serialport">
|
||||||
|
|
||||||
|
</manifest>
|
@ -0,0 +1,41 @@
|
|||||||
|
package com.common.queue.Task;
|
||||||
|
|
||||||
|
public interface ITask extends Comparable<ITask> {
|
||||||
|
|
||||||
|
// 将该任务插入队列
|
||||||
|
void enqueue();
|
||||||
|
|
||||||
|
// 执行具体任务的方法
|
||||||
|
void doTask();
|
||||||
|
|
||||||
|
// 任务执行完成后的回调方法
|
||||||
|
void finishTask();
|
||||||
|
|
||||||
|
// 设置任务优先级
|
||||||
|
ITask setPriority(TaskPriority mTaskPriority);
|
||||||
|
|
||||||
|
// 获取任务优先级
|
||||||
|
TaskPriority getPriority();
|
||||||
|
|
||||||
|
// 当优先级相同 按照插入顺序 先入先出 该方法用来标记插入顺序
|
||||||
|
void setSequence(int mSequence);
|
||||||
|
|
||||||
|
// 获取入队次序
|
||||||
|
int getSequence();
|
||||||
|
|
||||||
|
// 每个任务的状态,就是标记完成和未完成
|
||||||
|
boolean getStatus();
|
||||||
|
|
||||||
|
// 设置每个任务的执行时间,该方法用于任务执行时间确定的情况
|
||||||
|
ITask setDuration(int duration);
|
||||||
|
|
||||||
|
// 获取每个任务执行的时间
|
||||||
|
int getDuration();
|
||||||
|
|
||||||
|
// 阻塞任务执行,该方法用于任务执行时间不确定的情况
|
||||||
|
void blockTask() throws Exception;
|
||||||
|
|
||||||
|
// 解除阻塞任务,该方法用于任务执行时间不确定的情况
|
||||||
|
void unLockBlock();
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.common.queue.Task;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
|
|
||||||
|
public class TaskEvent {
|
||||||
|
private WeakReference<ITask> mTask;
|
||||||
|
int mEventType;
|
||||||
|
|
||||||
|
public ITask getTask() {
|
||||||
|
return mTask.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTask(ITask mTask) {
|
||||||
|
this.mTask = new WeakReference<>(mTask);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEventType() {
|
||||||
|
return mEventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEventType(int mEventType) {
|
||||||
|
this.mEventType = mEventType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class EventType {
|
||||||
|
public static final int DO = 0X00;
|
||||||
|
public static final int FINISH = 0X01;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,100 @@
|
|||||||
|
package com.common.queue;
|
||||||
|
|
||||||
|
import android.os.Handler;
|
||||||
|
import android.os.Looper;
|
||||||
|
import android.os.Message;
|
||||||
|
|
||||||
|
import com.common.queue.Task.TaskEvent;
|
||||||
|
import com.common.queue.Task.ITask;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
public class TaskExecutor {
|
||||||
|
private final String TAG = "ShowTaskExecutor";
|
||||||
|
private BlockTaskQueue taskQueue;
|
||||||
|
private TaskHandler mTaskHandler;
|
||||||
|
private boolean isRunning = true;
|
||||||
|
private static final int MSG_EVENT_DO = 0;
|
||||||
|
private static final int MSG_EVENT_FINISH = 1;
|
||||||
|
|
||||||
|
public TaskExecutor(BlockTaskQueue taskQueue) {
|
||||||
|
this.taskQueue = taskQueue;
|
||||||
|
mTaskHandler = new TaskHandler();
|
||||||
|
}
|
||||||
|
//开始遍历任务队列
|
||||||
|
public void start() {
|
||||||
|
Executors.newSingleThreadExecutor().execute(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
while (isRunning) { //死循环
|
||||||
|
ITask iTask;
|
||||||
|
iTask = taskQueue.take(); //取任务
|
||||||
|
if (iTask != null) {
|
||||||
|
//执行任务
|
||||||
|
TaskEvent doEvent = new TaskEvent();
|
||||||
|
doEvent.setTask(iTask);
|
||||||
|
doEvent.setEventType(TaskEvent.EventType.DO);
|
||||||
|
mTaskHandler.obtainMessage(MSG_EVENT_DO, doEvent).sendToTarget();
|
||||||
|
//一直阻塞,直到任务执行完
|
||||||
|
if (iTask.getDuration()!=0) {
|
||||||
|
TimeUnit.MILLISECONDS.sleep(iTask.getDuration());
|
||||||
|
}else {
|
||||||
|
iTask.blockTask();
|
||||||
|
}
|
||||||
|
//完成任务
|
||||||
|
TaskEvent finishEvent = new TaskEvent();
|
||||||
|
finishEvent.setTask(iTask);
|
||||||
|
finishEvent.setEventType(TaskEvent.EventType.FINISH);
|
||||||
|
mTaskHandler.obtainMessage(MSG_EVENT_FINISH, finishEvent).sendToTarget();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
//根据不同的消息回调不同的方法。
|
||||||
|
private static class TaskHandler extends Handler {
|
||||||
|
TaskHandler() {
|
||||||
|
super(Looper.getMainLooper());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleMessage(Message msg) {
|
||||||
|
super.handleMessage(msg);
|
||||||
|
TaskEvent taskEvent = (TaskEvent) msg.obj;
|
||||||
|
if (msg.what == MSG_EVENT_DO && taskEvent.getEventType() == TaskEvent.EventType.DO) {
|
||||||
|
taskEvent.getTask().doTask();
|
||||||
|
}
|
||||||
|
if (msg.what == MSG_EVENT_FINISH && taskEvent.getEventType() == TaskEvent.EventType.FINISH) {
|
||||||
|
taskEvent.getTask().finishTask();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startRunning() {
|
||||||
|
isRunning = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void pauseRunning() {
|
||||||
|
isRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isRunning() {
|
||||||
|
return isRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetExecutor() {
|
||||||
|
isRunning = true;
|
||||||
|
taskQueue.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clearExecutor() {
|
||||||
|
pauseRunning();
|
||||||
|
taskQueue.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,103 @@
|
|||||||
|
package com.common.serialport
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import com.aill.androidserialport.SerialPort
|
||||||
|
import com.common.serialport.inter.SerialPortHelper
|
||||||
|
import com.common.queue.TaskScheduler
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
class EasySerialPort(
|
||||||
|
private val portPath: String,
|
||||||
|
private val baudRate: Int,
|
||||||
|
private val mReceiver: (ByteArray) -> Unit
|
||||||
|
) : Runnable {
|
||||||
|
private var mPort: SerialPort? = null
|
||||||
|
private var startReceiveMsg = true
|
||||||
|
private var autoRetryConnect = false
|
||||||
|
|
||||||
|
init {
|
||||||
|
openSerialPort();
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun openSerialPort() {
|
||||||
|
mPort = SerialPortHelper.openSerialPort(portPath, baudRate)
|
||||||
|
mPort?.let {
|
||||||
|
startReceiveMsg = true
|
||||||
|
Thread(this).start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭串口
|
||||||
|
*/
|
||||||
|
open fun closePort() {
|
||||||
|
startReceiveMsg = false
|
||||||
|
SerialPortHelper.closePort(mPort)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 循环读消息
|
||||||
|
*/
|
||||||
|
override fun run() {
|
||||||
|
while (startReceiveMsg) {
|
||||||
|
try {
|
||||||
|
val ips = mPort?.inputStream
|
||||||
|
val readByte = ips?.available()?.let { ByteArray(it) }
|
||||||
|
readByte?.let {
|
||||||
|
val size = ips.read(it)
|
||||||
|
if (size > 0) {
|
||||||
|
mReceiver.invoke(readByte)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (e: IOException) {
|
||||||
|
Log.e(
|
||||||
|
"EasySerialPort",
|
||||||
|
"read msg error; path = " + portPath + ", error msg = " + e.message
|
||||||
|
)
|
||||||
|
e.printStackTrace()
|
||||||
|
if (autoRetryConnect) {
|
||||||
|
closePort()
|
||||||
|
openSerialPort()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 写消息
|
||||||
|
*/
|
||||||
|
open fun write(data: ByteArray) {
|
||||||
|
val task = SendMsgTask(data) {
|
||||||
|
try {
|
||||||
|
val outputStream = mPort?.outputStream
|
||||||
|
outputStream?.write(it)
|
||||||
|
outputStream?.flush()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
Log.e(
|
||||||
|
"EasySerialPort",
|
||||||
|
"write msg error; path = " + portPath + ", error msg = " + e.message
|
||||||
|
)
|
||||||
|
e.printStackTrace()
|
||||||
|
if (autoRetryConnect) {
|
||||||
|
closePort()
|
||||||
|
openSerialPort()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TaskScheduler.getInstance().enqueue(task)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始自动重连
|
||||||
|
*/
|
||||||
|
open fun enableAutoConnect() {
|
||||||
|
this.autoRetryConnect = true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭自动重连
|
||||||
|
*/
|
||||||
|
open fun disableAutoConnect() {
|
||||||
|
this.autoRetryConnect = true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package com.common.serialport
|
||||||
|
|
||||||
|
import com.common.queue.Task.BaseTask
|
||||||
|
|
||||||
|
class SendMsgTask(private val byteArray: ByteArray, private val action: (ByteArray) -> Unit) :
|
||||||
|
BaseTask() {
|
||||||
|
|
||||||
|
override fun doTask() {
|
||||||
|
super.doTask()
|
||||||
|
action.invoke(byteArray)
|
||||||
|
unLockBlock()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,10 @@
|
|||||||
|
package com.common.serialport.inter
|
||||||
|
|
||||||
|
import com.aill.androidserialport.SerialPort
|
||||||
|
|
||||||
|
interface IHelper {
|
||||||
|
|
||||||
|
fun openSerialPort(portPath: String, baudrate: Int): SerialPort?;
|
||||||
|
|
||||||
|
fun closePort(port: SerialPort?);
|
||||||
|
}
|
@ -0,0 +1,29 @@
|
|||||||
|
package com.common.serialport.inter
|
||||||
|
|
||||||
|
import android.util.Log
|
||||||
|
import com.aill.androidserialport.SerialPort
|
||||||
|
import java.io.File
|
||||||
|
import java.io.IOException
|
||||||
|
|
||||||
|
object SerialPortHelper : IHelper {
|
||||||
|
override fun openSerialPort(portPath: String, baudrate: Int): SerialPort? {
|
||||||
|
try {
|
||||||
|
return SerialPort(File(portPath), baudrate, 0);
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
Log.e("SerialPortHelper", "open port error; " + e.message)
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun closePort(port: SerialPort?) {
|
||||||
|
try {
|
||||||
|
port?.close()
|
||||||
|
port?.inputStream?.close()
|
||||||
|
port?.outputStream?.close()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
Log.e("SerialPortHelper", "closePort error; " + e.message)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
include ':myapplication' //, ':libuvccamera-release'
|
include ':myapplication' //, ':libuvccamera-release'
|
||||||
include ':library'
|
include ':library'
|
||||||
include ':ijkplayer-java'
|
include ':ijkplayer-java'
|
||||||
|
include ':commonSPort'
|
||||||
|
Loading…
Reference in New Issue