- 在 AndroidManifest.xml 中添加 USB Host 权限声明 - 集成 CH934X Android SDK 并通过反射调用原生功能 - 实现设备查找、串口读写、GPIO 和 Modem 控制功能 - 添加异常回调机制处理设备拔出等情况 - 提供 Stream 数据流支持实时串口数据监听 - 完善单元测试覆盖所有核心功能模块
58 lines
1.1 KiB
Kotlin
58 lines
1.1 KiB
Kotlin
group = "com.xiarui.ch934x_serial"
|
|
version = "1.0"
|
|
|
|
buildscript {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
|
|
dependencies {
|
|
classpath("com.android.tools.build:gradle:8.11.1")
|
|
}
|
|
}
|
|
|
|
allprojects {
|
|
repositories {
|
|
google()
|
|
mavenCentral()
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id("com.android.library")
|
|
}
|
|
|
|
android {
|
|
namespace = "com.xiarui.ch934x_serial"
|
|
|
|
compileSdk = 36
|
|
|
|
compileOptions {
|
|
sourceCompatibility = JavaVersion.VERSION_17
|
|
targetCompatibility = JavaVersion.VERSION_17
|
|
}
|
|
|
|
defaultConfig {
|
|
minSdk = 24
|
|
}
|
|
|
|
testOptions {
|
|
unitTests.all {
|
|
it.outputs.upToDateWhen { false }
|
|
|
|
it.testLogging {
|
|
events("passed", "skipped", "failed", "standardOut", "standardError")
|
|
showStandardStreams = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
// CH934X Android SDK,随插件发布。
|
|
implementation(fileTree(mapOf("dir" to "libs", "include" to listOf("*.jar"))))
|
|
testImplementation("junit:junit:4.13.2")
|
|
testImplementation("org.mockito:mockito-core:5.0.0")
|
|
}
|