Read/write ble characteristics from/to particular service

63
January 11, 2019, at 8:10 PM

I have several services with different UUIDs, but with the same characteristics UUIDs. I'm not sure what characteristic will be got if I call rxBleConnection.readCharacteristic(UUID). How to do it the best? I can find a particular service from the services list and then deal with BluetoothGattService and its characteristics, but maybe there is another way?

Answer 1

When there is more than one characteristic with the same UUID the only API that allows the user to control which characteristic will be used are:

  • RxBleConnection.readCharacteristic(BluetoothGattCharacteristic)
  • RxBleConnection.writeCharacteristic(BluetoothGattCharacteristic, byte[])
  • RxBleConnection.setupNotification(BluetoothGattCharacteristic)
  • RxBleConnection.setupIndication(BluetoothGattCharacteristic)
  • Other that expose usage of BluetoothGattCharacteristic

To get a reference to the BluetoothGattCharacteristic the user should search the result of RxBleConnection.discoverServices() — first to get the needed BluetoothGattService and then search the service for the needed BluetoothGattCharacteristic

READ ALSO
Updating ExpandableListView inside a fragment from another Activity (not the parent Activity)

Updating ExpandableListView inside a fragment from another Activity (not the parent Activity)

In my case i have two Activities that contains a ViewPager with the relative FragmentsSo the situation is something like that:

60
Haven't perfect understanding with Firebase-Database and Firebase-authentication

Haven't perfect understanding with Firebase-Database and Firebase-authentication

In hear I'm supposed to register users from my web appBut after one user registration, the second user always removes current user details and come under the previous uid

70
Android APK not installing in device

Android APK not installing in device

I have created Same project as two WorkSpace in my systemex: AppSampleHindi and AppSampleEnglish,

57