question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Characteristic change event not received

See original GitHub issue

Summary


A characteristic change event is logged but never received through the subscribed observable when a CharacteristicChangeEvent is fired while the notification is being setup

Preconditions


A RxBleDevice is connected and has a characteristic with indication property #### Steps to reproduce actual result
1. connect to a BluetoothDevice
2. setup indications
Observable.combineLatest(
connection.setupIndication(UUID.fromString(00008a82-0000-1000-8000-00805f9b34fb)),
connection.setupIndication(UUID.fromString(00008a91-0000-1000-8000-00805f9b34fb)),
(indication1, indication2) -> { return indication1;})
.flatMap(observable-> observable)
.doOnNext(bytes -> { log.d(bytes) })
.subscribe();
  1. As soon as onDescriptor write is fired a onChangeEvent happens that the observable never sees

Actual result


No log

Expected result


Log of bytes

Actual Log: Galaxy s6 6.0.1

D/RxBle#Radio: FINISHED RxBleRadioOperationConnect(149819350)
 D/BluetoothGatt: onClientConnParamsChanged() - Device=98:7B:F3:6B:F9:99 interval=6 status=0
D/RxBle#Radio:   QUEUED RxBleRadioOperationServicesDiscover(8272968)
 D/RxBle#Radio:  STARTED RxBleRadioOperationServicesDiscover(8272968)
 D/BluetoothGatt: discoverServices() - device: 98:7B:F3:6B:F9:99
 D/BluetoothGatt: onSearchComplete() = Device=98:7B:F3:6B:F9:99 Status=0
D/RxBle#BluetoothGatt: onServicesDiscovered status=0
D/BluetoothGatt: setCharacteristicNotification() - uuid: 00008a82-0000-1000-8000-00805f9b34fb enable: true
 D/RxBle#Radio:   QUEUED RxBleRadioOperationDescriptorWrite(72475096)
D/RxBle#Radio: FINISHED RxBleRadioOperationServicesDiscover(8272968)
D/RxBle#Radio:  STARTED RxBleRadioOperationDescriptorWrite(72475096)
D/BluetoothGatt: onClientConnParamsChanged() - Device=98:7B:F3:6B:F9:99 interval=39 status=0
D/RxBle#BluetoothGatt: onDescriptorWrite descriptor=00002902-0000-1000-8000-00805f9b34fb status=0
**D/RxBle#BluetoothGatt: onCharacteristicChanged characteristic=00008a82-0000-1000-8000-00805f9b34fb**
D/RxBle#Radio: FINISHED RxBleRadioOperationDescriptorWrite(72475096)

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
gryffindor14commented, May 22, 2017

Hey @dariuszseweryn, thanks for taking a look at this. For us, yes, receiving the indication is important to the transmission.

Our use case is that when we subscribe to the characteristic it fires a characteristic change event with a value. We then write to another characteristic which causes us to receive another characteristic change event with another value that we combine into a key.

I have had better results when writing the client descriptor myself while starting to observe the change event from RxBleGattCallback.

connection.setupNotification(characteristic, NotificationSetupMode.COMPAT)
    .flatmap(observable-> Observable.combineLatest(observable, writeClientDescriptor(connection), 
          return bytes; //from observable
)
1reaction
gryffindor14commented, Aug 11, 2018

It will require 1.2.0. I believe I posted how I got it to work in the thread. It requires setting up the notification with the NotificationCompat option. connection.setupNotification(uuid, NotificationSetupMode.COMPAT) .flatmap { notification -> return notification.mergeWith(connection.writeDescriptor(descriptor_uuid, BluetoothGattDescriptor.ENABLE_NOTIFICATIONS).ignoreElements())

note the ignoreElements() method at the end. This merges the notification byte[] stream with the descriptorWrite byte[] stream but the write for the descriptor is ignored.

combineLatest() also works as mentioned in the thread. connection.writeDescriptor is a completeable in the rxjava2 version and therefore does not emit any values. Good luck!

Griffin

On Sat, Aug 11, 2018 at 7:44 AM SogoodIT notifications@github.com wrote:

@gryffindor14 https://github.com/gryffindor14 @mswokk https://github.com/mswokk i’m meet the same issue on rxandroidble version 1.1.0,can you tell me how to fix this? preferably with 1.1.0, 1.2.0 is also ok.That code is incomplete, i can’t got u well, thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Polidea/RxAndroidBle/issues/195#issuecomment-412269987, or mute the thread https://github.com/notifications/unsubscribe-auth/ABGR_wxNHRiL-XCZ9Qvpy0mEECVT408hks5uPsOagaJpZM4NfeUb .

Read more comments on GitHub >

github_iconTop Results From Across the Web

onchange event not fire when the change come from another ...
The change event occurs when a control loses the input focus and its value has been modified since gaining focus. This event is...
Read more >
HTMLElement: change event - Web APIs | MDN
The change event is fired for , , and elements when the user modifies the element's value. Unlike the input event, the change...
Read more >
string control value change event not triggering - NI Community
i am trying to scan a barcode with a usb HID barcode scanner. i am using an event structure to detect the value...
Read more >
Setting and modifying a change event on a feature in ...
First, you don't change values by modifying internal feature property .values_ . Internal OL properties should never be modifed directly. The ...
Read more >
Learn Change Data Capture Characteristics Unit - Trailhead
Change Data Capture can generate change events for all custom objects defined in your Salesforce org and a subset of standard objects.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found