Code Monkey home page Code Monkey logo

Comments (12)

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024 1

The setupNotification would return an Observable that will emit BleCharacteristicNotificationOfOtherTypeAlreadySetException. (Long name...)

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024 1

Added support for the indications with commit: https://github.com/Polidea/RxAndroidBle/commit/f69ce78b18f635d23efc9b71e06c3e6e7d87d1c9.
A new release will be made after we will fix the bugs found. For the moment you can use the snapshot: compile 'com.polidea.rxandroidble:rxandroidble:1.1.0-SNAPSHOT'.

from rxandroidble.

uKL avatar uKL commented on July 30, 2024

This is true, the library does not handle indications yet. You are welcome to open a pull request :)

from rxandroidble.

mgranberry avatar mgranberry commented on July 30, 2024

How much testing do you want to see? It looks like setupNotification is heavily-tested, but much of that seems like it would be redundant to replicate.

from rxandroidble.

uKL avatar uKL commented on July 30, 2024

If you'd use same code don't duplicate tests. Just test what is new. Also I'd review the pull request itself for any bugs.

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

With Paweł we will think how to handle situations where user would set a notification after setting indication to the same characteristic. Edge case - never the less needs to be addressed somehow. With your current proposal first setter would win and the second one would end up using the first one.

from rxandroidble.

mgranberry avatar mgranberry commented on July 30, 2024

@dariuszseweryn that is correct, and the reason that I haven't made a PR yet.

from rxandroidble.

mzgreen avatar mzgreen commented on July 30, 2024

What about adding an overwrite parameter to setupNoticication and setupIndication methods?

When user would want to set a notification after setting indication to the same characteristic and overwrite is false then nothing happens, otherwise a notification is set. The same would apply in other direction (setting indication after setting notification to the same characteristic).

from rxandroidble.

cbodin avatar cbodin commented on July 30, 2024

This is exactly what i'm needing. Your hack works great @mzgreen.

Is the overwrite parameter really needed? It seems like an overwrite could always happen and leave it up to the developer to check if a notification/indication is already set to the same characteristic.

from rxandroidble.

mzgreen avatar mzgreen commented on July 30, 2024

@cbodin Actually my idea with overwrite was wrong. It could lead to unexpected behavior. One way would be to not allow to set notification after setting indication and vice-versa. There is no perfect solution that would make it easier for developer I think.

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

We will go with emitting an exception when the indication is being set after notification was already setup (or vice-versa). We are discussing the best API still though. The code should be available within this week.

from rxandroidble.

cbodin avatar cbodin commented on July 30, 2024

Emitting exception directly when subscribing or throwing an exception when the setupNotification method is called?

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.