From 351e6293c45b3e2a37d5d771bb953aa883d9c1dd Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 26 Aug 2020 16:40:42 +0200 Subject: 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. --- java/tinyb/dbus/DBusGattCharacteristic.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'java/tinyb/dbus/DBusGattCharacteristic.java') 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: */ -- cgit v1.2.3