Reedyuk / blue-falcon

A Bluetooth kotlin multiplatform "Cross-Platform" library for iOS and Android
https://bluefalcon.dev
Apache License 2.0
328 stars 43 forks source link

Characteristic indication #31

Closed ivannador closed 4 years ago

ivannador commented 4 years ago

Would it be possible to add characteristic indication capability beside notification? Our specific usecase and GATT server device requires that we set indication on a characteristic.

Thanks in advance!

Reedyuk commented 4 years ago

So you would want to send an enum something like: public static final byte[] ENABLE_NOTIFICATION_VALUE public static final byte[] ENABLE_INDICATION_VALUE public static final byte[] DISABLE_NOTIFICATION_VALUE

Would you also want to be able to set the descriptor value too?

Just trying to think how i can make this as generic as possible to support Android, iOS, MacOS.

ivannador commented 4 years ago

Wow that was fast, thanks. :)

Personally I think it would be best to provide an indicateCharacteristic() method (with the same arguments as its notify counterpart). It could then set the ENABLE_INDICATION_VALUE in the descriptor internally. No other descriptor value setting is needed I think. AFAIK on iOS it wouldn't matter as it handles it automatically. No clue about macOS though but I imagine it works the same.

Reedyuk commented 4 years ago

Yep makes sense, let me see if i can squeeze out a change over the weekend, otherwise, happy for you to fork and put a pr in.

ivannador commented 4 years ago

Just published a PR. I also added the possibility to set both notification and indication. That makes it more in line with iOS functionality.

Reedyuk commented 4 years ago

I have merged and published as 0.6.5, this should appear in maven central within the next few hours.