From f9250fd02eba1a0e2fa2c52457398198549edf1b Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Wed, 27 Jan 2021 13:43:11 +0100 Subject: API renaming of missed 'Characteristic', add listener to API name table --- README.md | 3 ++- api/direct_bt/ATTPDUTypes.hpp | 3 +++ examples/java/DBTScanner10.java | 2 +- java/jau/direct_bt/DBTGattChar.java | 12 ++++++------ java/org/direct_bt/AdapterSettings.java | 9 ++++++--- java/org/direct_bt/BTDevice.java | 6 +++--- java/org/direct_bt/BTGattChar.java | 12 ++++++------ java/org/direct_bt/BTGattCharListener.java | 9 +++++---- java/org/direct_bt/BTGattService.java | 12 ++++++------ java/org/direct_bt/BTManager.java | 2 +- java/tinyb/dbus/DBusGattCharacteristic.java | 8 ++++---- 11 files changed, 43 insertions(+), 35 deletions(-) diff --git a/README.md b/README.md index cf8bb7ea..87452536 100644 --- a/README.md +++ b/README.md @@ -170,7 +170,8 @@ API Documentation Up to date API documentation can be found: -* [Brief overview of *direct_bt*](https://jausoft.com/projects/direct_bt/build/documentation/cpp/html/namespacedirect__bt.html#details). +* [API Overview](https://jausoft.com/projects/direct_bt/build/documentation/cpp/html/namespacedirect__bt.html#details) (C++) +and the [same in the Java API](https://jausoft.com/projects/direct_bt/build/documentation/java/html/namespaceorg_1_1direct__bt.html#details). * [C++ API Doc](https://jausoft.com/projects/direct_bt/build/documentation/cpp/html/index.html). diff --git a/api/direct_bt/ATTPDUTypes.hpp b/api/direct_bt/ATTPDUTypes.hpp index 5bb02042..4abba66b 100644 --- a/api/direct_bt/ATTPDUTypes.hpp +++ b/api/direct_bt/ATTPDUTypes.hpp @@ -122,6 +122,9 @@ * BTGattService | DBTGattService | BTGattService | * BTGattChar | DBTGattChar | BTGattChar | * BTGattDesc | DBTGattDesc | BTGattDesc | + * AdapterStatusListener | | AdapterStatusListener | + * BTGattCharListener | | BTGattCharListener | + * ChangedAdapterSetFunc() | | BTManager::ChangedAdapterSetListener | * * - - - - - - - - - - - - - - - * diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java index 231f772a..08ae5e95 100644 --- a/examples/java/DBTScanner10.java +++ b/examples/java/DBTScanner10.java @@ -603,7 +603,7 @@ public class DBTScanner10 { } }; final boolean enabledState[] = { false, false }; - final boolean addedCharPingPongListenerRes = char2.addCharacteristicListener(charPingPongListener, enabledState); + final boolean addedCharPingPongListenerRes = char2.addCharListener(charPingPongListener, enabledState); if( !QUIET ) { println("Added CharPingPongListenerRes: "+addedCharPingPongListenerRes+", enabledState "+Arrays.toString(enabledState)); } diff --git a/java/jau/direct_bt/DBTGattChar.java b/java/jau/direct_bt/DBTGattChar.java index 86863e5c..03d818b5 100644 --- a/java/jau/direct_bt/DBTGattChar.java +++ b/java/jau/direct_bt/DBTGattChar.java @@ -166,7 +166,7 @@ public class DBTGattChar extends DBTObject implements BTGattChar } } }; - this.addCharacteristicListener(characteristicListener); // silent, don't enable native GATT ourselves + this.addCharListener(characteristicListener); // silent, don't enable native GATT ourselves } } @@ -175,7 +175,7 @@ public class DBTGattChar extends DBTObject implements BTGattChar if( !isValid() ) { return; } - removeAllAssociatedCharacteristicListener(true); + removeAllAssociatedCharListener(true); super.close(); } @@ -302,12 +302,12 @@ public class DBTGattChar extends DBTObject implements BTGattChar } @Override - public final boolean addCharacteristicListener(final BTGattCharListener listener) { + public final boolean addCharListener(final BTGattCharListener listener) { return getService().getDevice().addCharListener(listener); } @Override - public final boolean addCharacteristicListener(final BTGattCharListener listener, final boolean enabledState[/*2*/]) { + public final boolean addCharListener(final BTGattCharListener listener, final boolean enabledState[/*2*/]) { if( !enableNotificationOrIndication(enabledState) ) { return false; } @@ -315,7 +315,7 @@ public class DBTGattChar extends DBTObject implements BTGattChar } @Override - public final boolean removeCharacteristicListener(final BTGattCharListener l, final boolean disableIndicationNotification) { + public final boolean removeCharListener(final BTGattCharListener l, final boolean disableIndicationNotification) { if( disableIndicationNotification ) { configNotificationIndication(false /* enableNotification */, false /* enableIndication */, new boolean[2]); } @@ -323,7 +323,7 @@ public class DBTGattChar extends DBTObject implements BTGattChar } @Override - public final int removeAllAssociatedCharacteristicListener(final boolean disableIndicationNotification) { + public final int removeAllAssociatedCharListener(final boolean disableIndicationNotification) { if( disableIndicationNotification ) { configNotificationIndication(false /* enableNotification */, false /* enableIndication */, new boolean[2]); } diff --git a/java/org/direct_bt/AdapterSettings.java b/java/org/direct_bt/AdapterSettings.java index 5aac5d92..a14e0b0b 100644 --- a/java/org/direct_bt/AdapterSettings.java +++ b/java/org/direct_bt/AdapterSettings.java @@ -16,7 +16,7 @@ * ## Direct-BT Layers * * Direct-BT implements the following layers - * - BTManager for adapter configuration and adapter add/removal notifications (BTManager#ChangedAdapterSetListener) + * - BTManager for adapter configuration and adapter add/removal notifications (BTManager::ChangedAdapterSetListener) * - Using *BlueZ Kernel Manager Control Channel* via MgmtMsg communication. * - *HCI Handling* via HCIHandler using HCIPacket implementing connect/disconnect w/ tracking, device discovery, etc * - *ATT PDU* AttPDUMsg via L2CAP for low level packet communication @@ -79,6 +79,9 @@ * BTGattService | DBTGattService | BTGattService | * BTGattChar | DBTGattChar | BTGattChar | * BTGattDesc | DBTGattDesc | BTGattDesc | + * AdapterStatusListener | | AdapterStatusListener | + * BTGattCharListener | | BTGattCharListener | + * ChangedAdapterSetFunc() | | BTManager::ChangedAdapterSetListener | * * - - - - - - - - - - - - - - - * @@ -86,7 +89,7 @@ * * A fully event driven workflow from adapter management via device discovery to GATT programming is supported. * - * BTManager#ChangedAdapterSetListener allows listening to added and removed BTAdapter via BTManager. + * BTManager::ChangedAdapterSetListener allows listening to added and removed BTAdapter via BTManager. * * AdapterStatusListener allows listening to BTAdapter changes and BTDevice discovery. * @@ -96,7 +99,7 @@ * which maintain a set of unique listener instances without duplicates. * * - BTManager - * - BTManager#ChangedAdapterSetListener + * - BTManager::ChangedAdapterSetListener * * - BTAdapter * - AdapterStatusListener diff --git a/java/org/direct_bt/BTDevice.java b/java/org/direct_bt/BTDevice.java index 18991f8d..c8ee27e9 100644 --- a/java/org/direct_bt/BTDevice.java +++ b/java/org/direct_bt/BTDevice.java @@ -829,7 +829,7 @@ public interface BTDevice extends BTObject *

* @param listener A {@link BTGattCharListener} instance, listening to all {@link BTGattChar} events of this device * @return true if the given listener is not element of the list and has been newly added, otherwise false. - * @throws IllegalStateException if the {@link BTDevice}'s GATTHandler is null, i.e. not connected + * @throws IllegalStateException if the {@link BTDevice}'s BTGattHandler is null, i.e. not connected * @throws IllegalStateException if the given {@link BTGattCharListener} is already in use, i.e. added. * @see BTGattChar#configNotificationIndication(boolean, boolean, boolean[]) * @see BTGattChar#enableNotificationOrIndication(boolean[]) @@ -842,7 +842,7 @@ public interface BTDevice extends BTObject /** * Remove the given {@link BTGattCharListener} from the listener list. *

- * If the {@link BTDevice}'s GATTHandler is null, i.e. not connected, {@code false} is being returned. + * If the {@link BTDevice}'s BTGattHandler is null, i.e. not connected, {@code false} is being returned. *

* @param listener A {@link BTGattCharListener} instance * @return true if the given listener is an element of the list and has been removed, otherwise false. @@ -857,7 +857,7 @@ public interface BTDevice extends BTObject * Implementation tests all listener's {@link BTGattCharListener#getAssociatedChar()} * to match with the given associated characteristic. *

- * @param associatedCharacteristic the match criteria to remove any GATTCharacteristicListener from the list + * @param associatedCharacteristic the match criteria to remove any BTGattCharListener from the list * @return number of removed listener. * @since 2.0.0 * @implNote not implemented in tinyb.dbus diff --git a/java/org/direct_bt/BTGattChar.java b/java/org/direct_bt/BTGattChar.java index 877e9cac..5dfb2373 100644 --- a/java/org/direct_bt/BTGattChar.java +++ b/java/org/direct_bt/BTGattChar.java @@ -134,7 +134,7 @@ public interface BTGattChar extends BTObject *

* Occurring notifications and indications, if enabled via {@link #configNotificationIndication(boolean, boolean, boolean[])} * or {@link #enableNotificationOrIndication(boolean[])}, - * will call the respective GATTCharacteristicListener callback method. + * will call the respective BTGattCharListener callback method. *

* @param listener A {@link BTGattCharListener} instance, listening to this {@link BTGattChar}'s events * @return true if the given listener is not element of the list and has been newly added, otherwise false. @@ -145,7 +145,7 @@ public interface BTGattChar extends BTObject * @since 2.0.0 * @implNote not implemented in tinyb.dbus */ - public boolean addCharacteristicListener(final BTGattCharListener listener) + public boolean addCharListener(final BTGattCharListener listener) throws IllegalStateException; /** @@ -173,7 +173,7 @@ public interface BTGattChar extends BTObject * @since 2.0.0 * @implNote not implemented in tinyb.dbus */ - public boolean addCharacteristicListener(final BTGattCharListener listener, final boolean enabledState[/*2*/]) + public boolean addCharListener(final BTGattCharListener listener, final boolean enabledState[/*2*/]) throws IllegalStateException; /** @@ -192,7 +192,7 @@ public interface BTGattChar extends BTObject * @since 2.0.0 * @implNote not implemented in tinyb.dbus */ - public boolean removeCharacteristicListener(final BTGattCharListener l, final boolean disableIndicationNotification); + public boolean removeCharListener(final BTGattCharListener l, final boolean disableIndicationNotification); /** * Disables the notification and/or indication for this characteristic BLE level @@ -211,11 +211,11 @@ public interface BTGattChar extends BTObject * using {@link #configNotificationIndication(boolean, boolean, boolean[])} * @return number of removed listener. * @see #configNotificationIndication(boolean, boolean, boolean[]) - * @see BTDevice#removeAllAssociatedCharacteristicListener(BTGattChar) + * @see BTDevice#removeAllAssociatedCharListener(BTGattChar) * @since 2.0.0 * @implNote not implemented in tinyb.dbus */ - public int removeAllAssociatedCharacteristicListener(final boolean disableIndicationNotification); + public int removeAllAssociatedCharListener(final boolean disableIndicationNotification); /** * Sets the given value BluetoothNotification to have its run function diff --git a/java/org/direct_bt/BTGattCharListener.java b/java/org/direct_bt/BTGattCharListener.java index f95e0166..d24a3d49 100644 --- a/java/org/direct_bt/BTGattCharListener.java +++ b/java/org/direct_bt/BTGattCharListener.java @@ -31,11 +31,11 @@ import java.lang.ref.WeakReference; * {@link BTGattChar} event listener for notification and indication events. *

* A listener instance may be attached to a {@link BTGattChar} via - * {@link BTGattChar#addCharacteristicListener(BTGattCharListener)} to listen to its events. + * {@link BTGattChar#addCharListener(BTGattCharListener)} to listen to its events. *

*

* A listener instance may be attached to a {@link BTDevice} via - * {@link BTDevice#addCharacteristicListener(BTGattCharListener, BTGattChar)} + * {@link BTDevice#addCharListener(BTGattCharListener, BTGattChar)} * to listen to all events of the device or the matching filtered events. *

*

@@ -46,7 +46,7 @@ import java.lang.ref.WeakReference; * To attach multiple listener, one instance per attachment must be created. *
* This restriction is due to implementation semantics of strictly associating - * one Java {@link BTGattCharListener} instance to one C++ {@code GATTCharacteristicListener} instance. + * one Java {@link BTGattCharListener} instance to one C++ {@code BTGattCharListener} instance. * The latter will be added to the native list of listeners. * This class's {@code nativeInstance} field links the Java instance to mentioned C++ listener. *
@@ -107,9 +107,10 @@ public abstract class BTGattCharListener { final boolean confirmationSent) { } + @Override public String toString() { final BTGattChar c = getAssociatedChar(); final String cs = null != c ? c.toString() : "null"; - return "GATTCharacteristicListener[associated "+cs+"]"; + return "BTGattCharListener[associated "+cs+"]"; } }; diff --git a/java/org/direct_bt/BTGattService.java b/java/org/direct_bt/BTGattService.java index 6b85878d..4822d71c 100644 --- a/java/org/direct_bt/BTGattService.java +++ b/java/org/direct_bt/BTGattService.java @@ -42,11 +42,11 @@ public interface BTGattService extends BTObject @Override public BTGattService clone(); - /** Find a BluetoothGattCharacteristic. If parameter UUID is not null, + /** Find a BTGattChar. If parameter UUID is not null, * the returned object will have to match it. * It will first check for existing objects. It will not turn on discovery * or connect to devices. - * @parameter UUID optionally specify the UUID of the BluetoothGattCharacteristic you are + * @parameter UUID optionally specify the UUID of the BTGattChar you are * waiting for * @parameter timeoutMS the function will return after timeout time in milliseconds, a * value of zero means wait forever. If object is not found during this time null will be returned. @@ -55,7 +55,7 @@ public interface BTGattService extends BTObject */ public BTGattChar find(String UUID, long timeoutMS); - /** Find a BluetoothGattCharacteristic. If parameter UUID is not null, + /** Find a BTGattChar. If parameter UUID is not null, * the returned object will have to match it. * It will first check for existing objects. It will not turn on discovery * or connect to devices. @@ -100,7 +100,7 @@ public interface BTGattService extends BTObject * @since 2.0.0 * @implNote not implemented in tinyb.dbus * @see BTGattChar#enableNotificationOrIndication(boolean[]) - * @see BTDevice#addCharacteristicListener(BTGattCharListener, BTGattChar) + * @see BTDevice#addCharListener(BTGattCharListener, BTGattChar) */ public static boolean addCharListenerToAll(final BTDevice device, final List services, final BTGattCharListener listener) { @@ -128,7 +128,7 @@ public interface BTGattService extends BTObject * @since 2.0.0 * @implNote not implemented in tinyb.dbus * @see BTGattChar#configNotificationIndication(boolean, boolean, boolean[]) - * @see BTDevice#removeCharacteristicListener(BTGattCharListener) + * @see BTDevice#removeCharListener(BTGattCharListener) */ public static boolean removeCharListenerFromAll(final BTDevice device, final List services, final BTGattCharListener listener) { @@ -148,7 +148,7 @@ public interface BTGattService extends BTObject * @since 2.0.0 * @implNote not implemented in tinyb.dbus * @see BTGattChar#configNotificationIndication(boolean, boolean, boolean[]) - * @see BTDevice#removeAllCharacteristicListener() + * @see BTDevice#removeAllCharListener() */ public static int removeAllCharListener(final BTDevice device, final List services) { for(final Iterator is = services.iterator(); is.hasNext(); ) { diff --git a/java/org/direct_bt/BTManager.java b/java/org/direct_bt/BTManager.java index c770d6cf..5fc5f8e1 100644 --- a/java/org/direct_bt/BTManager.java +++ b/java/org/direct_bt/BTManager.java @@ -60,7 +60,7 @@ public interface BTManager *

*

* If using {@link #isDirectBT() Direct-BT}, user are encouraged to - * {@link BTGattChar#addCharacteristicListener(GATTCharacteristicListener, boolean[]) utilize GATTCharacteristicListener} + * {@link BTGattChar#addCharListener(BTGattCharListener, boolean[]) utilize BTGattCharListener} * to handle value notifications when they occur w/o caching. *

*

diff --git a/java/tinyb/dbus/DBusGattCharacteristic.java b/java/tinyb/dbus/DBusGattCharacteristic.java index 01d67e15..df270cfc 100644 --- a/java/tinyb/dbus/DBusGattCharacteristic.java +++ b/java/tinyb/dbus/DBusGattCharacteristic.java @@ -110,7 +110,7 @@ public class DBusGattCharacteristic extends DBusObject implements BTGattChar } @Override - public boolean addCharacteristicListener(final BTGattCharListener listener) { + public boolean addCharListener(final BTGattCharListener listener) { return false; // FIXME } @Override @@ -126,17 +126,17 @@ public class DBusGattCharacteristic extends DBusObject implements BTGattChar return false; // FIXME } @Override - public boolean addCharacteristicListener(final BTGattCharListener listener, final boolean[] enabledState) + public boolean addCharListener(final BTGattCharListener listener, final boolean[] enabledState) throws IllegalStateException { return false; // FIXME } @Override - public boolean removeCharacteristicListener(final BTGattCharListener l, final boolean disableIndicationNotification) { + public boolean removeCharListener(final BTGattCharListener l, final boolean disableIndicationNotification) { return false; // FIXME } @Override - public int removeAllAssociatedCharacteristicListener(final boolean disableIndicationNotification) { + public int removeAllAssociatedCharListener(final boolean disableIndicationNotification) { return 0; // FIXME } -- cgit v1.2.3