From 28ee10141fbd4874f8f78c0c699d5e62635f77f6 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sat, 25 Jul 2020 07:45:50 +0200 Subject: GATTCharacteristic: Add enableNotificationOrIndication(..)..; DIRECTBT_CHARACTERISTIC_VALUE_CACHE_NOTIFICATION_COMPAT GATTCharacteristic (Java/C++): Add enableNotificationOrIndication(..) and use it as default for BLE active addCharacteristicListener(..). It is recommended to utilize notification over indication, as its link-layer handshake and higher potential bandwidth may deliver material higher performance. +++ Add setting BluetoothFactory.DIRECTBT_CHARACTERISTIC_VALUE_CACHE_NOTIFICATION_COMPAT (and also document DEBUG and VERBOSE). DIRECTBT_CHARACTERISTIC_VALUE_CACHE_NOTIFICATION_COMPAT Have direct_bt provide compatibility to TinyB's BluetoothGattCharacteristic API: BluetoothGattCharacteristic#getValue() value cache and BluetoothGattCharacteristic#enableValueNotifications(BluetoothNotification) value notification. DBTGattCharacteristic benefits from _disabled_ compatibility (and DEBUG) performance wise, as no listener nor cache needs to be added in this case! --- java/tinyb/dbus/DBusGattCharacteristic.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'java/tinyb') diff --git a/java/tinyb/dbus/DBusGattCharacteristic.java b/java/tinyb/dbus/DBusGattCharacteristic.java index 2cf874bc..2fcbfb39 100644 --- a/java/tinyb/dbus/DBusGattCharacteristic.java +++ b/java/tinyb/dbus/DBusGattCharacteristic.java @@ -113,7 +113,12 @@ public class DBusGattCharacteristic extends DBusObject implements BluetoothGattC { return false; // FIXME } - + @Override + public boolean enableNotificationOrIndication(final boolean[] enabledState) + throws IllegalStateException + { + return false; // FIXME + } @Override public boolean addCharacteristicListener(final GATTCharacteristicListener listener, final boolean[] enabledState) throws IllegalStateException -- cgit v1.2.3