diff options
author | Sven Gothel <[email protected]> | 2020-08-26 16:40:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-08-26 16:40:42 +0200 |
commit | 351e6293c45b3e2a37d5d771bb953aa883d9c1dd (patch) | |
tree | bc5a3f8f85e23ce527012646e4fc98be6ab50f1e /java/tinyb/dbus/DBusGattCharacteristic.java | |
parent | 1d8d9c8bfac90059d928704316171725c23601f1 (diff) |
BluetoothGattCharacteristic: API Change: 'writeValue(byte[] value)' -> 'writeValue(byte[] value, boolean withResponse)'
Add both writeValue(..) mapping to Java
[1] BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.1 Write Characteristic Value Without Response
[2] BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.3 Write Characteristic Value
Previously only [1] existed and [2] seemingly isn't supported by DBus yet(?)
Adding the additional paramter 'boolean withResponse' to determine which variant is desired,
while removing the original method type.
The TinyB/DBus implementation will throw a BluetoothException if 'withResponse' == true,
as it is not supported.
This change allows clarification of the actual method being desired
and supports a fail fast if not supported.
Diffstat (limited to 'java/tinyb/dbus/DBusGattCharacteristic.java')
-rw-r--r-- | java/tinyb/dbus/DBusGattCharacteristic.java | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/java/tinyb/dbus/DBusGattCharacteristic.java b/java/tinyb/dbus/DBusGattCharacteristic.java index 2fcbfb39..9d9700e7 100644 --- a/java/tinyb/dbus/DBusGattCharacteristic.java +++ b/java/tinyb/dbus/DBusGattCharacteristic.java @@ -72,7 +72,13 @@ public class DBusGattCharacteristic extends DBusObject implements BluetoothGattC public native void disableValueNotifications(); @Override - public native boolean writeValue(byte[] argValue) throws BluetoothException; + public boolean writeValue(final byte[] argValue, final boolean withResponse) throws BluetoothException { + if( withResponse ) { + throw new DBusBluetoothException("writeValue with response not yet supported"); + } + return writeValueImpl(argValue); + } + private native boolean writeValueImpl(byte[] argValue) throws BluetoothException; /* D-Bus property accessors: */ |