Compare commits
No commits in common. "abfc172642df2300b3cb4ea2d2ec8597a2651101" and "77136476e2735f7fe742d1986f81708f44b156be" have entirely different histories.
abfc172642
...
77136476e2
4 changed files with 14 additions and 23 deletions
|
|
@ -10,9 +10,10 @@ val keystoreProperties = Properties ()
|
|||
keystoreProperties . load ( FileInputStream ( rootProject . file ("keystore.properties") ) )
|
||||
|
||||
plugins {
|
||||
id ("com.android.application") . version ("9.0.0")
|
||||
id ("org.jetbrains.kotlin.plugin.compose") . version ("2.3.0")
|
||||
id ("org.jetbrains.kotlin.plugin.serialization") . version ("2.3.0")
|
||||
id ("com.android.application") . version ("8.13.1")
|
||||
id ("org.jetbrains.kotlin.android") . version ("2.2.21")
|
||||
id ("org.jetbrains.kotlin.plugin.compose") . version ("2.2.21")
|
||||
id ("org.jetbrains.kotlin.plugin.serialization") . version ("2.2.21")
|
||||
}
|
||||
|
||||
android {
|
||||
|
|
@ -48,7 +49,7 @@ android {
|
|||
}
|
||||
compileOptions {
|
||||
// Required even though we don't have any Java sources because it needs to match Kotlin's JVM version
|
||||
targetCompatibility = JavaVersion . VERSION_25
|
||||
targetCompatibility = JavaVersion . VERSION_23
|
||||
}
|
||||
buildFeatures {
|
||||
compose = true
|
||||
|
|
@ -57,22 +58,22 @@ android {
|
|||
|
||||
kotlin {
|
||||
compilerOptions {
|
||||
jvmTarget = JvmTarget . JVM_25
|
||||
jvmTarget = JvmTarget . JVM_23
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Android runtime libraries
|
||||
implementation ( "com.google.android.material:material:1.13.0" )
|
||||
implementation ( "androidx.activity:activity-compose:1.12.2" )
|
||||
implementation ( "androidx.activity:activity-compose:1.12.1" )
|
||||
implementation ( "androidx.core:core-ktx:1.17.0" )
|
||||
implementation ( "androidx.compose.material3:material3:1.4.0" )
|
||||
implementation ( "androidx.compose.ui:ui:1.10.1" )
|
||||
implementation ( "androidx.compose.ui:ui-graphics:1.10.1" )
|
||||
debugImplementation ( "androidx.compose.ui:ui-tooling:1.10.1" )
|
||||
implementation ( "androidx.compose.ui:ui:1.10.0" )
|
||||
implementation ( "androidx.compose.ui:ui-graphics:1.10.0" )
|
||||
debugImplementation ( "androidx.compose.ui:ui-tooling:1.10.0" )
|
||||
implementation ( "androidx.lifecycle:lifecycle-runtime-ktx:2.10.0" )
|
||||
implementation ( "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.10.2" )
|
||||
implementation ( "org.jetbrains.kotlinx:kotlinx-serialization-json:1.10.0" )
|
||||
implementation ( "org.jetbrains.kotlinx:kotlinx-serialization-json:1.9.0" )
|
||||
// Other libraries
|
||||
implementation ( "io.github.davidepianca98:kmqtt-common:1.0.0" )
|
||||
implementation ( "io.github.davidepianca98:kmqtt-client:1.0.0" )
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ package com.kernelmaft.zanbur.common
|
|||
|
||||
|
||||
object Config {
|
||||
const val MQTT_SERVER_HOST = "merovech.kernelmaft.com"
|
||||
const val MQTT_SERVER_HOST = "deorwine.kernelmaft.com"
|
||||
const val MQTT_SERVER_PORT = 1883
|
||||
const val MQTT_TOPIC = "zigbee2mqtt"
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
package com.kernelmaft.zanbur.network
|
||||
|
||||
import kotlinx.coroutines.CoroutineExceptionHandler
|
||||
|
||||
|
||||
|
||||
val exceptionPrinter = CoroutineExceptionHandler { _ , throwable ->
|
||||
throwable . printStackTrace ()
|
||||
throw throwable
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ object MqttClient {
|
|||
this . coroutineScope = coroutineScope
|
||||
val json = Json { ignoreUnknownKeys = true }
|
||||
|
||||
coroutineScope . launch ( IO + exceptionPrinter ) {
|
||||
coroutineScope . launch (IO) {
|
||||
client = MQTTClient ( MQTT5 , MQTT_SERVER_HOST , MQTT_SERVER_PORT , null ) {
|
||||
for ( handler in publishHandlers ) handler ( it , json )
|
||||
}
|
||||
|
|
@ -38,7 +38,7 @@ object MqttClient {
|
|||
fun addPublishHandler ( handler : MqttPublishHandler ) = publishHandlers . add (handler)
|
||||
|
||||
fun publish ( topic : String , payload : UByteArray ) {
|
||||
coroutineScope !! . launch ( IO + exceptionPrinter ) {
|
||||
coroutineScope !! . launch (IO) {
|
||||
client !! . publish ( false , AT_MOST_ONCE , topic , payload )
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue