Code Monkey home page Code Monkey logo

Comments (15)

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

Hello,
Currently the library doesn't help with binding the devices and you have to bind it yourself.

from rxandroidble.

mars3142 avatar mars3142 commented on July 30, 2024

I don't want to bind the device. Just connecting, reading and writing.

from rxandroidble.

uKL avatar uKL commented on July 30, 2024

How does your device get the pin then? Standard Bluetooth implementation requires to pair the device in a PIN mode (binding process), which is currently unsupported. You can always bind the device yourself using BluetoothDevice object and continue with the library then. Although pull requests are kindly welcome!

from rxandroidble.

mars3142 avatar mars3142 commented on July 30, 2024

I added a notification to a characteristic and in the StatusBar a "binding notification" pops up. This is really bad, because I expected a PIN dialog popping up.

I'll check your advice with manual binding, but this way I had to know which characteristics are protected or is this a one time thing? How about PIN changes? Will I need to bind again?

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

I am not an expert in binding the device just yet. The behaviour for binding may be different from vendor to vendor.
When binding devices - with the "Just Works" solution it's a one time thing. Other types you need to check out by yourself. If you will do that - please share the info here. The library may benefit from it.

Best Regards

from rxandroidble.

 avatar commented on July 30, 2024

Any updates on this item? It would be nice have binding devices feature built into library.

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

There is a chance that soon the connection will not be closed automatically when there is an encryption error. It will enable users to workaround this issue.

from rxandroidble.

 avatar commented on July 30, 2024

And what about functionality, that will automatically propose to pair device using pin number if it's required by device during connection (when invoking establishConnection)? For example how it's done from the Android's settings app. It's handled automatically there.

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

I do not have much experience with devices that need bonding so I cannot really tell. I have read that usually Android shows a dialog / notification by itself.

If you will have a moment for investigation - feel free to look into it and report your findings or submit a PR :)

from rxandroidble.

 avatar commented on July 30, 2024

If I have a chance I will :) Since it's demand feature for me right now.
Thanks for update.

from rxandroidble.

 avatar commented on July 30, 2024

I figured out how we can bond device by prompting entering ping. Since RxBleDevice has a reference to BluetoothDevice we can simply call createBond() and Android will do everything else for us.

Reference:
https://developer.android.com/reference/android/bluetooth/BluetoothDevice.html#createBond()

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

Unfortunately when testing I could not get stable results with .createBond(). Once bonded — when canceled the bond — I could not make the device to bond again. Is that an issue for you?

from rxandroidble.

 avatar commented on July 30, 2024

I can't reproduce this issue. Everything works good for me. Small note, that I've checking for already bounded devices, and don't bond it when it's already bonded.

from rxandroidble.

JohnnyJem avatar JohnnyJem commented on July 30, 2024

According to Apple guidelines(which most devices should aim to fulfill):

"as explained in Apple’s Bluetooth Accessory Design Guidelines. Instead, you should make sure to set the permissions as you want on your characteristics (see the usage of BLE_GAP_CONN_SEC_MODE_SET_ENC_NO_MITM() above), so that an error will be returned to the Central when it tries to do something that requires encryption. This error will then trigger most Central devices to automatically start bonding."

Basically if you attempt to read a characteristic that requires "authorization" the device should return a "ERROR_INSUFFICIENT_AUTHEN (0x41)" error code that will prompt the android system to automatically begin bonding the device. As for the pin requirement:

See
https://stackoverflow.com/questions/29204634/ios-bluetooth-ble-security-and-just-works-association-model
for a link to a table which explains the types of device configurations needed in order to have a pairing response needing "passkey entry" .

from rxandroidble.

dariuszseweryn avatar dariuszseweryn commented on July 30, 2024

As it is now possible to workaround this by either using BluetoothDevice RxBleDevice.getBluetoothDevice() and calling BluetoothDevice.createBond() or by retrying RxBleConnection.readCharacteristic()/RxBleConnection.writeCharacteristic()/RxBleConnection.setupNotification()—closing.

There is already an issue for adding helpers.

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.