Code Monkey home page Code Monkey logo

Comments (6)

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

In the first block what would happen is:

  1. rxBleConnection would be established
  2. once the rxBleConnection will be available the readCharacteristic() will trigger
  3. once the readCharacteristic() will finish the writeCharacteristic() will start
  4. subscribe() will get the writtenBytes

With the second block - with the current implementation (which will try to share the connection between both subscription) it is uncertain wether the readCharacteristic() or writeCharacteristic() will be triggered first. In such a simple example there is no big difference but if the communication would be stateful in some way the other subscription could change the state of the first one.

My suggestion is to use the first block as there you can execute the flow exactly as you want.

from rxandroidble.

zzt93 avatar zzt93 commented on July 30, 2024

In the first case, you mean if I can't read some characteristic from other device, I can't write?

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

Usually if you can't read from a characteristic that means that the connection is broken and you have to establish a new one. So yes. If a readCharacteristic() would fail you won't be able to writeCharacteristic

from rxandroidble.

zzt93 avatar zzt93 commented on July 30, 2024

But if the device in the other side doesn't write any characteristic, what will I read?

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

I think that you should learn more about the Bluetooth Low Energy.
The characteristic is a kind of a property on the server device. What it will serve during readCharacteristic() is up to the server.
I am sorry but this is not really question about the library itself but more about how the BLE works. I suggest you to check www.google.com or ask a question on www.stackoverflow.com .

Best Regards

from rxandroidble.

zzt93 avatar zzt93 commented on July 30, 2024

Thanks for your suggestion.

from rxandroidble.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.