Compare commits

..

No commits in common. "abfc172642df2300b3cb4ea2d2ec8597a2651101" and "77136476e2735f7fe742d1986f81708f44b156be" have entirely different histories.

4 changed files with 14 additions and 23 deletions

View file

@ -10,9 +10,10 @@ val keystoreProperties = Properties ()
keystoreProperties . load ( FileInputStream ( rootProject . file ("keystore.properties") ) ) keystoreProperties . load ( FileInputStream ( rootProject . file ("keystore.properties") ) )
plugins { plugins {
id ("com.android.application") . version ("9.0.0") id ("com.android.application") . version ("8.13.1")
id ("org.jetbrains.kotlin.plugin.compose") . version ("2.3.0") id ("org.jetbrains.kotlin.android") . version ("2.2.21")
id ("org.jetbrains.kotlin.plugin.serialization") . version ("2.3.0") id ("org.jetbrains.kotlin.plugin.compose") . version ("2.2.21")
id ("org.jetbrains.kotlin.plugin.serialization") . version ("2.2.21")
} }
android { android {
@ -48,7 +49,7 @@ android {
} }
compileOptions { compileOptions {
// Required even though we don't have any Java sources because it needs to match Kotlin's JVM version // 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 { buildFeatures {
compose = true compose = true
@ -57,22 +58,22 @@ android {
kotlin { kotlin {
compilerOptions { compilerOptions {
jvmTarget = JvmTarget . JVM_25 jvmTarget = JvmTarget . JVM_23
} }
} }
dependencies { dependencies {
// Android runtime libraries // Android runtime libraries
implementation ( "com.google.android.material:material:1.13.0" ) 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.core:core-ktx:1.17.0" )
implementation ( "androidx.compose.material3:material3:1.4.0" ) implementation ( "androidx.compose.material3:material3:1.4.0" )
implementation ( "androidx.compose.ui:ui:1.10.1" ) implementation ( "androidx.compose.ui:ui:1.10.0" )
implementation ( "androidx.compose.ui:ui-graphics:1.10.1" ) implementation ( "androidx.compose.ui:ui-graphics:1.10.0" )
debugImplementation ( "androidx.compose.ui:ui-tooling:1.10.1" ) debugImplementation ( "androidx.compose.ui:ui-tooling:1.10.0" )
implementation ( "androidx.lifecycle:lifecycle-runtime-ktx:2.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-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 // Other libraries
implementation ( "io.github.davidepianca98:kmqtt-common:1.0.0" ) implementation ( "io.github.davidepianca98:kmqtt-common:1.0.0" )
implementation ( "io.github.davidepianca98:kmqtt-client:1.0.0" ) implementation ( "io.github.davidepianca98:kmqtt-client:1.0.0" )

View file

@ -3,7 +3,7 @@ package com.kernelmaft.zanbur.common
object Config { 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_SERVER_PORT = 1883
const val MQTT_TOPIC = "zigbee2mqtt" const val MQTT_TOPIC = "zigbee2mqtt"

View file

@ -1,10 +0,0 @@
package com.kernelmaft.zanbur.network
import kotlinx.coroutines.CoroutineExceptionHandler
val exceptionPrinter = CoroutineExceptionHandler { _ , throwable ->
throwable . printStackTrace ()
throw throwable
}

View file

@ -25,7 +25,7 @@ object MqttClient {
this . coroutineScope = coroutineScope this . coroutineScope = coroutineScope
val json = Json { ignoreUnknownKeys = true } val json = Json { ignoreUnknownKeys = true }
coroutineScope . launch ( IO + exceptionPrinter ) { coroutineScope . launch (IO) {
client = MQTTClient ( MQTT5 , MQTT_SERVER_HOST , MQTT_SERVER_PORT , null ) { client = MQTTClient ( MQTT5 , MQTT_SERVER_HOST , MQTT_SERVER_PORT , null ) {
for ( handler in publishHandlers ) handler ( it , json ) for ( handler in publishHandlers ) handler ( it , json )
} }
@ -38,7 +38,7 @@ object MqttClient {
fun addPublishHandler ( handler : MqttPublishHandler ) = publishHandlers . add (handler) fun addPublishHandler ( handler : MqttPublishHandler ) = publishHandlers . add (handler)
fun publish ( topic : String , payload : UByteArray ) { fun publish ( topic : String , payload : UByteArray ) {
coroutineScope !! . launch ( IO + exceptionPrinter ) { coroutineScope !! . launch (IO) {
client !! . publish ( false , AT_MOST_ONCE , topic , payload ) client !! . publish ( false , AT_MOST_ONCE , topic , payload )
} }
} }