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.

Trying to read in subscription callback fails

See original GitHub issue

Version

Tell us which versions you are using:

  • react-native-ble-manager: 3.3.0
  • react-native: 0.44.0
  • Android, Nexus 5X

Expected behaviour

Doing a read in the callback of a subscription should be succesful

Actual behaviour

The read always fails, so I have to retry it in the catch statement with a timeout, then it works. It seems that the BLE is “busy” and thus is not ready to read yet. I don’t know if it is the peripheral or the Android BLE manager that is not ready yet.

Steps to reproduce

  1. Subscribe to a characteristic
  2. In the callback for the subscribe event, read the same characteristic

Stack trace and console log

It just says, read failed.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
whitedogg13commented, May 31, 2017

Hi @marcosinigaglia , I might spot a possible cause.

In line 404 @ Peripheral.java, we have codes like this:

if (gatt.writeDescriptor(descriptor)) {
   ...
   callback.invoke();
   ...
}

This call flow uses writeDescriptor in a synchronous manner. However, from Android doc https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html, we can see the writeDescriptor just returns whether the operation is initialied and the actual result comes from onDescriptorWrite callback.

I will try to fix this and report it later 😃

0reactions
vikericommented, Jun 1, 2017

@whitedogg13 that’s great! Well done!

Read more comments on GitHub >

github_iconTop Results From Across the Web

javascript error inside subscribe callback - Stack Overflow
now lets assume sometime I get data as null and i tried to access it as res.data[0].some_property then it will throw js error...
Read more >
What might cause the delay of the subscription callback? #27
It's possible that the Lambda times out and a well formed response isn't being sent back to the AppSync resolver. Again, with Lambda...
Read more >
Subscriptions - Apollo GraphQL Docs
Allows the registration of a callback function, that will be triggered when the useSubscription Hook / Subscription component completes the subscription.
Read more >
Why You Should Not Put Any Logic in the RxJS Subscribe ...
For the reactive approach, it is trickier. First, we need to set up a third observable to display the errors. Then, we use...
Read more >
Subscribe Arguments - RxJS
In short we deprecated all signatures where you specified an anonymous error or complete callback and passed an empty function to one of...
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