-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bluetooth.generic] Enable BLE notification for linked channels #10122
[bluetooth.generic] Enable BLE notification for linked channels #10122
Conversation
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
…characteristics are able to notify Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much for taking the time to contribute this. I was working on a PR that allowed the notifications to be configurable but I think that just enabling it by default is probably the better way to go. Nice job.
...h.bluegiga/src/main/java/org/openhab/binding/bluetooth/bluegiga/BlueGigaBluetoothDevice.java
Outdated
Show resolved
Hide resolved
...g.openhab.binding.bluetooth/src/main/java/org/openhab/binding/bluetooth/BluetoothDevice.java
Outdated
Show resolved
Hide resolved
...ic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
...ic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java
Show resolved
Hide resolved
Signed-off-by: Peter Rosenberg <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also can you please update the canRead
and canWrite
methods to check the characteristic property flags? Since you are adding support for the properties you should complete those TODOs as well.
Once that is done I think this is ready to merge. Thanks for all your work.
...ic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java
Outdated
Show resolved
Hide resolved
...ic/src/main/java/org/openhab/binding/bluetooth/generic/internal/GenericBluetoothHandler.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Peter Rosenberg <[email protected]>
Signed-off-by: Peter Rosenberg <[email protected]>
You're welcome, thank you for your review. |
Signed-off-by: Peter Rosenberg <[email protected]>
…hab#10122) * [bluetooth] Add BluetoothDevice.isNotifying() * [bluetooth] Improve Characteristic properties support * [bluez] Improve Characteristic properties support * [bluetooth] Add BluetoothDevice.canNotify() * [bluez] Also catch DBusExecutionException on read value * [bluetooth.generic] Activate notifications for linked channels where characteristics are able to notify * [bluez] Adjust javadoc * [bluegiga] Add BluetoothDevice.isNotifying() support * [bluegiga] Fix notification enabled check * [bluetooth] move canNotify() to Characteristic * [bluegiga] rename notificationEnabled to notifying * [bluetooth.generic] use handlerToChannels to subscribe to notifications * [bluetooth.generic] implement TODOs of canRead()/canWrite() * [bluetooth.generic] optimize ChannelUID * [bluetooth.generic] use channelUids for link check Signed-off-by: Peter Rosenberg <[email protected]>
…hab#10122) * [bluetooth] Add BluetoothDevice.isNotifying() * [bluetooth] Improve Characteristic properties support * [bluez] Improve Characteristic properties support * [bluetooth] Add BluetoothDevice.canNotify() * [bluez] Also catch DBusExecutionException on read value * [bluetooth.generic] Activate notifications for linked channels where characteristics are able to notify * [bluez] Adjust javadoc * [bluegiga] Add BluetoothDevice.isNotifying() support * [bluegiga] Fix notification enabled check * [bluetooth] move canNotify() to Characteristic * [bluegiga] rename notificationEnabled to notifying * [bluetooth.generic] use handlerToChannels to subscribe to notifications * [bluetooth.generic] implement TODOs of canRead()/canWrite() * [bluetooth.generic] optimize ChannelUID * [bluetooth.generic] use channelUids for link check Signed-off-by: Peter Rosenberg <[email protected]> Signed-off-by: John Marshall <[email protected]>
…hab#10122) * [bluetooth] Add BluetoothDevice.isNotifying() * [bluetooth] Improve Characteristic properties support * [bluez] Improve Characteristic properties support * [bluetooth] Add BluetoothDevice.canNotify() * [bluez] Also catch DBusExecutionException on read value * [bluetooth.generic] Activate notifications for linked channels where characteristics are able to notify * [bluez] Adjust javadoc * [bluegiga] Add BluetoothDevice.isNotifying() support * [bluegiga] Fix notification enabled check * [bluetooth] move canNotify() to Characteristic * [bluegiga] rename notificationEnabled to notifying * [bluetooth.generic] use handlerToChannels to subscribe to notifications * [bluetooth.generic] implement TODOs of canRead()/canWrite() * [bluetooth.generic] optimize ChannelUID * [bluetooth.generic] use channelUids for link check Signed-off-by: Peter Rosenberg <[email protected]>
…hab#10122) * [bluetooth] Add BluetoothDevice.isNotifying() * [bluetooth] Improve Characteristic properties support * [bluez] Improve Characteristic properties support * [bluetooth] Add BluetoothDevice.canNotify() * [bluez] Also catch DBusExecutionException on read value * [bluetooth.generic] Activate notifications for linked channels where characteristics are able to notify * [bluez] Adjust javadoc * [bluegiga] Add BluetoothDevice.isNotifying() support * [bluegiga] Fix notification enabled check * [bluetooth] move canNotify() to Characteristic * [bluegiga] rename notificationEnabled to notifying * [bluetooth.generic] use handlerToChannels to subscribe to notifications * [bluetooth.generic] implement TODOs of canRead()/canWrite() * [bluetooth.generic] optimize ChannelUID * [bluetooth.generic] use channelUids for link check Signed-off-by: Peter Rosenberg <[email protected]>
Bluetooth low energy (BLE) allows central devices (like openHAB) to subscribe for changes. Whenever a subscribed value changes, the central devices is notified immediately so we don't need to wait until the value is polled next time.
Such a behaviour is useful for applications like push buttons or other devices where immediate action is required.
Changes
BluetoothCharacteristic
to make them accessibleBluetoothDevice.canNotify()
andBluetoothDevice.isNotifying()
This is my first pull request to openHAB, feedback is very welcome.