
Facilitates interaction with a Dasung 253 monitor via USB by abstracting UART commands, offering simplified classes and functions for monitor manipulation, incorporating jSerialComm and USB Serial libraries.
This is a KMM (Kotlin Multiplatform Module) library which allows a Kotlin project to interact with a Dasung 253 monitor via its USB port.
This module abstracts away the UART commands which the monitor understands and provides simpler classes and functions for manipulating it.
It is based on reference code from Dasung.
It uses the jSerialComm and USB Serial For Android libraries under the hood.
| Platform | Supported | Artifact |
|---|---|---|
| Core | dev.mcarr.d253:library | |
| JVM | ✓ | dev.mcarr.d253:library-jvm |
| Android | ✓ | dev.mcarr.d253:library-android |
| Native | ✗ | |
| iOS | ✗ | |
| Web | ✗ |
// Get a reference to the monitor
val monitor = D253SerialPortList().getMonitors().first()
// Query the monitor
val params = port.getParameters()
// Print the results
println("Threshold: ${params.threshold}")
println("Light: ${params.light}")
println("Speed: ${params.speed}")
println("Frontlight: ${params.frontlight}")
println("Enhancement: ${params.enhancement}")
println("Display mode: ${params.displayMode}")Javadoc can be found here.
The setup instructions below assume that you're building a gradle project, with a TOML file for dependency management and KTS files for gradle scripts.
The instructions should still work for other setups with minor changes.
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
// For the android serial library
maven(url = "https://jitpack.io")
}
}# libs.versions.toml
[versions]
d253 = "1.0.1"
[libraries]
d253-library-core = { module = "dev.mcarr.d253:library", version.ref = "d253" }
d253-library-jvm = { module = "dev.mcarr.d253:library-jvm", version.ref = "d253" }
d253-library-android = { module = "dev.mcarr.d253:library-android", version.ref = "d253" }// app (not root) build.gradle.kts
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.d253.library.core)
}
}
val jvmMain by getting {
dependencies {
implementation(libs.d253.library.jvm)
}
}
val androidMain by getting {
dependencies {
implementation(libs.d253.library.android)
}
}
}
}implement the monitor detection function and logic
add support for other platforms
list required java version
more docs
This is a KMM (Kotlin Multiplatform Module) library which allows a Kotlin project to interact with a Dasung 253 monitor via its USB port.
This module abstracts away the UART commands which the monitor understands and provides simpler classes and functions for manipulating it.
It is based on reference code from Dasung.
It uses the jSerialComm and USB Serial For Android libraries under the hood.
| Platform | Supported | Artifact |
|---|---|---|
| Core | dev.mcarr.d253:library | |
| JVM | ✓ | dev.mcarr.d253:library-jvm |
| Android | ✓ | dev.mcarr.d253:library-android |
| Native | ✗ | |
| iOS | ✗ | |
| Web | ✗ |
// Get a reference to the monitor
val monitor = D253SerialPortList().getMonitors().first()
// Query the monitor
val params = port.getParameters()
// Print the results
println("Threshold: ${params.threshold}")
println("Light: ${params.light}")
println("Speed: ${params.speed}")
println("Frontlight: ${params.frontlight}")
println("Enhancement: ${params.enhancement}")
println("Display mode: ${params.displayMode}")Javadoc can be found here.
The setup instructions below assume that you're building a gradle project, with a TOML file for dependency management and KTS files for gradle scripts.
The instructions should still work for other setups with minor changes.
// settings.gradle.kts
dependencyResolutionManagement {
repositories {
// For the android serial library
maven(url = "https://jitpack.io")
}
}# libs.versions.toml
[versions]
d253 = "1.0.1"
[libraries]
d253-library-core = { module = "dev.mcarr.d253:library", version.ref = "d253" }
d253-library-jvm = { module = "dev.mcarr.d253:library-jvm", version.ref = "d253" }
d253-library-android = { module = "dev.mcarr.d253:library-android", version.ref = "d253" }// app (not root) build.gradle.kts
kotlin {
sourceSets {
val commonMain by getting {
dependencies {
implementation(libs.d253.library.core)
}
}
val jvmMain by getting {
dependencies {
implementation(libs.d253.library.jvm)
}
}
val androidMain by getting {
dependencies {
implementation(libs.d253.library.android)
}
}
}
}implement the monitor detection function and logic
add support for other platforms
list required java version
more docs