From fb74f1d4864deef0ff2f330844c29fd3623912ff Mon Sep 17 00:00:00 2001 From: Sanders MARTINE Date: Wed, 6 Mar 2024 17:35:21 +0100 Subject: [PATCH 1/2] [DSDK-200] Expose MTU --- transport-ble/src/main/java/com/ledger/live/ble/BleManager.kt | 2 +- .../src/main/java/com/ledger/live/ble/model/BleState.kt | 3 ++- .../src/main/java/com/ledger/live/ble/service/BleService.kt | 2 +- .../java/com/ledger/live/ble/service/model/BleServiceEvent.kt | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/transport-ble/src/main/java/com/ledger/live/ble/BleManager.kt b/transport-ble/src/main/java/com/ledger/live/ble/BleManager.kt index 32be3f3..5f2f180 100644 --- a/transport-ble/src/main/java/com/ledger/live/ble/BleManager.kt +++ b/transport-ble/src/main/java/com/ledger/live/ble/BleManager.kt @@ -432,7 +432,7 @@ class BleManager internal constructor( when (event) { is BleServiceEvent.BleDeviceConnected -> { connectionCallback?.onConnectionSuccess(connectedDevice) - _bleState.tryEmit(BleState.Connected(connectedDevice)) + _bleState.tryEmit(BleState.Connected(connectedDevice = connectedDevice, mtu = event.mtu)) } is BleServiceEvent.BleDeviceDisconnected -> { diff --git a/transport-ble/src/main/java/com/ledger/live/ble/model/BleState.kt b/transport-ble/src/main/java/com/ledger/live/ble/model/BleState.kt index bd66f32..5d76b6d 100644 --- a/transport-ble/src/main/java/com/ledger/live/ble/model/BleState.kt +++ b/transport-ble/src/main/java/com/ledger/live/ble/model/BleState.kt @@ -7,7 +7,8 @@ sealed class BleState { ): BleState() data class Connected ( - val connectedDevice: BleDeviceModel + val connectedDevice: BleDeviceModel, + val mtu: Int, ): BleState() data class Disconnected(val error: BleError? = null): BleState() diff --git a/transport-ble/src/main/java/com/ledger/live/ble/service/BleService.kt b/transport-ble/src/main/java/com/ledger/live/ble/service/BleService.kt index 5fd80d9..f4de1eb 100644 --- a/transport-ble/src/main/java/com/ledger/live/ble/service/BleService.kt +++ b/transport-ble/src/main/java/com/ledger/live/ble/service/BleService.kt @@ -103,7 +103,7 @@ class BleService : Service() { is BleServiceStateMachine.BleServiceState.Ready -> { if (!isReady) { isReady = true - notify(BleServiceEvent.BleDeviceConnected) + notify(BleServiceEvent.BleDeviceConnected(mtu = it.mtu)) } it.answer?.let { answer -> diff --git a/transport-ble/src/main/java/com/ledger/live/ble/service/model/BleServiceEvent.kt b/transport-ble/src/main/java/com/ledger/live/ble/service/model/BleServiceEvent.kt index 54ce7e4..a015c3b 100644 --- a/transport-ble/src/main/java/com/ledger/live/ble/service/model/BleServiceEvent.kt +++ b/transport-ble/src/main/java/com/ledger/live/ble/service/model/BleServiceEvent.kt @@ -3,7 +3,7 @@ package com.ledger.live.ble.service.model import com.ledger.live.ble.model.BleError sealed class BleServiceEvent { - data object BleDeviceConnected: BleServiceEvent() + data class BleDeviceConnected(val mtu: Int): BleServiceEvent() data class BleDeviceDisconnected(val error: BleError? = null): BleServiceEvent() data class SuccessSend(val sendId: String): BleServiceEvent() data class SendAnswer(val sendId: String, val answer: String): BleServiceEvent() From 8d1e5b5ac83128604f2d23b856be9fe5a39b1c06 Mon Sep 17 00:00:00 2001 From: Sanders MARTINE Date: Thu, 27 Jun 2024 15:29:44 +0200 Subject: [PATCH 2/2] [DSDK-55] Fix errors when publishing artifact on mavel local --- transport-ble/build.gradle | 40 +++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/transport-ble/build.gradle b/transport-ble/build.gradle index bd4ba8a..f461223 100644 --- a/transport-ble/build.gradle +++ b/transport-ble/build.gradle @@ -31,6 +31,11 @@ android { kotlinOptions { jvmTarget = "11" } + publishing { + singleVariant('release') { + withSourcesJar() + } + } } dependencies { @@ -59,31 +64,34 @@ dependencies { androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' } -task sourceJar(type: Jar) { - from android.sourceSets.main.java.srcDirs - archiveClassifier.set("sources") -} +//task sourceJar(type: Jar) { +// from android.sourceSets.main.java.srcDirs +// archiveClassifier.set("sources") +//} publishing { publications { - /*release(MavenPublication) { - groupId 'com.ledger.live' - artifactId 'android-transport-ble' - version '1.0.0' - - artifact("$buildDir/outputs/aar/transport-ble-release.aar") - }*/ - - debug(MavenPublication) { + release(MavenPublication) { groupId 'com.ledger.live' artifactId 'android-transport-ble' version '1.0.0-rc15' - artifact(sourceJar) + afterEvaluate { - //artifact("$buildDir/outputs/aar/transport-ble-debug.aar") - from components.debug + // artifact("$buildDir/outputs/aar/transport-ble-release.aar") + from components.release } } + +// debug(MavenPublication) { +// groupId 'com.ledger.live' +// artifactId 'android-transport-ble' +// version "1.0.0-rc15" +// //artifact(sourceJar) +// afterEvaluate { +// //artifact("$buildDir/outputs/aar/transport-ble-debug.aar") +// from components.debug +// } +// } } /*repositories {