Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not discover services with ble client sdk. #87

Open
maitolab opened this issue Nov 27, 2023 · 1 comment
Open

Can not discover services with ble client sdk. #87

maitolab opened this issue Nov 27, 2023 · 1 comment

Comments

@maitolab
Copy link

maitolab commented Nov 27, 2023

I am using the client sdk with the latest version 1.0.10. After calling the connect and discoverService function as below:

val client = ClientBleGatt.Companion.connect(context, device.address, scope)
val service = client.discoverServices()

Then I faced the warning and could not find any services.

Unhandled exception in callback
java.lang.IllegalStateException: This mutex is not locked
    at kotlinx.coroutines.sync.MutexImpl.unlock(Mutex.kt:213)
    at kotlinx.coroutines.sync.Mutex$DefaultImpls.unlock$default(Mutex.kt:98)
    at no.nordicsemi.android.kotlin.ble.core.mutex.MutexWrapper.unlock(MutexWrapper.kt:56)
    at no.nordicsemi.android.kotlin.ble.client.api.ClientMutexHandleCallback.tryEmit(ClientMutexHandleCallback.kt:32)
    at no.nordicsemi.android.kotlin.ble.client.real.ClientBleGattCallback.onServicesDiscovered(ClientBleGattCallback.kt:70)
    at android.bluetooth.BluetoothGatt$1$5.run(BluetoothGatt.java:347)
    at android.bluetooth.BluetoothGatt.runOrQueueCallback(BluetoothGatt.java:823)
    at android.bluetooth.BluetoothGatt.access$200(BluetoothGatt.java:47)
    at android.bluetooth.BluetoothGatt$1.onSearchComplete(BluetoothGatt.java:342)
    at android.bluetooth.IBluetoothGattCallback$Stub.onTransact(IBluetoothGattCallback.java:241)
    at android.os.Binder.execTransactInternal(Binder.java:1184)
    at android.os.Binder.execTransact(Binder.java:1143)
@andrewowen
Copy link

late response, but I noticed you're using ClientBleGatt.Companion.connect() but I'm pretty positive you should just be calling ClientBleGatt.connect(context, device.address, scope) instead. Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants