diff --git a/gradle.properties b/gradle.properties index 5c43924..3e5d1fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -21,4 +21,4 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true -VERSION_LIB=0.0.18 \ No newline at end of file +VERSION_LIB=0.0.19 \ No newline at end of file diff --git a/simpleBleClient/proguard-rules.pro b/simpleBleClient/proguard-rules.pro index bcbdc0a..862c94e 100644 --- a/simpleBleClient/proguard-rules.pro +++ b/simpleBleClient/proguard-rules.pro @@ -24,6 +24,17 @@ # This is generated automatically by the Android Gradle plugin. -dontwarn java.lang.invoke.StringConcatFactory +-keepclassmembers class ** { + public void enableLogging(); +} +-keep class android.util.Log { + public static *** e(...); + public static *** d(...); + public static *** v(...); + public static *** i(...); + public static *** w(...); +} + -keep public interface com.bortxapps.simplebleclient.api.contracts.BleNetworkMessageProcessor { public *; } -keep public interface com.bortxapps.simplebleclient.api.contracts.SimpleBleClient { public *; } -keep class com.bortxapps.simplebleclient.api.contracts.SimpleBleClient$DefaultImpls { *; } diff --git a/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/exceptions/BleError.kt b/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/exceptions/BleError.kt index cea8b60..191e925 100644 --- a/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/exceptions/BleError.kt +++ b/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/exceptions/BleError.kt @@ -6,6 +6,7 @@ public enum class BleError { MISSING_BLE_PERMISSIONS, BLE_NOT_ENABLED, BLE_NOT_SUPPORTED, + INTERNAL_ERROR_COMMUNICATION_CANCELLED_DUE_COROUTINE, COMMUNICATION_FAILED, SEND_COMMAND_FAILED_NO_DATA_RECEIVED_IN_RESPONSE, SEND_COMMAND_FAILED_NO_CHARACTERISTIC_FOUND_TO_SEND, diff --git a/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/BleManagerGattCallBacks.kt b/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/BleManagerGattCallBacks.kt index e61545d..1dc6e35 100644 --- a/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/BleManagerGattCallBacks.kt +++ b/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/BleManagerGattCallBacks.kt @@ -43,20 +43,20 @@ internal class BleManagerGattCallBacks(bleConfiguration: BleConfiguration, bleMe } BluetoothProfile.STATE_DISCONNECTED -> { - Log.e("BleManagerGattCallBacks", "onConnectionStateChange: STATE_DISCONNECTED") + Log.d("BleManagerGattCallBacks", "onConnectionStateChange: STATE_DISCONNECTED") onDisconnectedDeferred?.complete(true) } BluetoothProfile.STATE_CONNECTING -> { - Log.e("BleManagerGattCallBacks", "onConnectionStateChange: STATE_CONNECTING") + Log.d("BleManagerGattCallBacks", "onConnectionStateChange: STATE_CONNECTING") } BluetoothProfile.STATE_DISCONNECTING -> { - Log.e("BleManagerGattCallBacks", "onConnectionStateChange: STATE_DISCONNECTING") + Log.d("BleManagerGattCallBacks", "onConnectionStateChange: STATE_DISCONNECTING") } else -> { - Log.e("BleManagerGattCallBacks", "onConnectionStateChange: UNKNOWN") + Log.d("BleManagerGattCallBacks", "onConnectionStateChange: UNKNOWN") } } connectionStatus.tryEmit(newState) diff --git a/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/utils/BleManagerGattOperationBase.kt b/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/utils/BleManagerGattOperationBase.kt index 5fc5a77..d5d7bb6 100644 --- a/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/utils/BleManagerGattOperationBase.kt +++ b/simpleBleClient/src/main/java/com/bortxapps/simplebleclient/manager/utils/BleManagerGattOperationBase.kt @@ -34,7 +34,7 @@ internal abstract class BleManagerGattOperationBase( try { return operation() } catch (e: CancellationException) { - handleException(e, BleError.COMMUNICATION_FAILED) + handleException(e, BleError.INTERNAL_ERROR_COMMUNICATION_CANCELLED_DUE_COROUTINE) } catch (e: UninitializedPropertyAccessException) { handleException(e, BleError.INTERNAL_ERROR) } catch (e: SimpleBleClientException) {