Direct-BT
2.3.1
Direct-BT - Direct Bluetooth Programming.
|
Public Member Functions | |
synchronized void | close () |
Release the native memory associated with this object The object should not be used following a call to close. More... | |
boolean | equals (final Object obj) |
String | getUUID () |
Get the UUID of this characteristic. More... | |
BTType | getBluetoothType () |
Returns the BluetoothType of this object. More... | |
BTGattChar | clone () |
BTGattDesc | find (final String UUID, final long timeoutMS) |
Find a BluetoothGattDescriptor. More... | |
BTGattDesc | find (final String UUID) |
Find a BluetoothGattDescriptor. More... | |
final BTGattService | getService () |
Returns the service to which this characteristic belongs to. More... | |
final boolean | getNotifying (final boolean enabledState[]) |
Returns true if notification for changes of this characteristic are activated. More... | |
final GattCharPropertySet | getProperties () |
Returns the properties of this characteristic. More... | |
final byte[] | readValue () throws BTException |
Reads the value of this characteristic. More... | |
final boolean | writeValue (final byte[] value, final boolean withResponse) throws BTException |
Writes the value of this characteristic, using one of the following methods depending on. More... | |
final List< BTGattDesc > | getDescriptors () |
Returns a list of BluetoothGattDescriptors this characteristic exposes. More... | |
final synchronized boolean | configNotificationIndication (final boolean enableNotification, final boolean enableIndication, final boolean enabledState[]) throws IllegalStateException |
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration. More... | |
boolean | enableNotificationOrIndication (final boolean enabledState[]) throws IllegalStateException |
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration. More... | |
final boolean | addCharListener (final Listener listener) |
Add the given BTGattChar.Listener to the listener list if not already present. More... | |
final boolean | addCharListener (final Listener listener, final boolean enabledState[]) |
Add the given BTGattChar.Listener to the listener list if not already present and if enabling the notification or indication for this characteristic at BLE level was successful. More... | |
final int | removeAllAssociatedCharListener (final boolean disableIndicationNotification) |
Disables the notification and/or indication for this characteristic BLE level if. More... | |
final synchronized void | disableValueNotifications () |
Disables notifications of the value and unregisters the callback object passed through the corresponding enable method. More... | |
final short | getHandle () |
Characteristic Handle of this instance. More... | |
final short | getValueHandle () |
Returns Characteristics Value Handle. More... | |
final int | getClientCharacteristicsConfigIndex () |
Returns optional Client Characteristic Configuration index within descriptorList. More... | |
final String | toString () |
Public Member Functions inherited from jau.direct_bt.DBTObject | |
final int | hashCode () |
Public Member Functions inherited from jau.direct_bt.DBTNativeDownlink | |
final void | delete () |
Deletes the. More... | |
Protected Member Functions | |
native void | deleteImpl (long nativeInstance) |
Deletes the native instance. More... | |
Protected Member Functions inherited from jau.direct_bt.DBTObject | |
DBTObject (final long nativeInstance, final int hashValue) | |
void | finalize () |
Protected Member Functions inherited from jau.direct_bt.DBTNativeDownlink | |
DBTNativeDownlink (final long nativeInstance) | |
boolean | isValid () |
Definition at line 41 of file DBTGattChar.java.
final boolean jau.direct_bt.DBTGattChar.addCharListener | ( | final Listener | listener | ) |
Add the given BTGattChar.Listener to the listener list if not already present.
Occurring notifications and indications for this characteristic, if enabled via configNotificationIndication(boolean, boolean, boolean[]) or enableNotificationOrIndication(boolean[]), will call the respective BTGattChar.Listener callback method.
Implementation wraps given BTGattChar.Listener into a BTGattCharListener to restrict the listener to listen only to this BTGattChar instance.
listener | A BTGattChar.Listener instance, listening to this BTGattChar's events |
IllegalStateException | if the DBTDevice's GATTHandler is null, i.e. not connected |
IllegalStateException | if the given BTGattChar.Listener is already in use, i.e. added. |
Implements org.direct_bt.BTGattChar.
Definition at line 269 of file DBTGattChar.java.
final boolean jau.direct_bt.DBTGattChar.addCharListener | ( | final Listener | listener, |
final boolean | enabledState[] | ||
) |
Add the given BTGattChar.Listener to the listener list if not already present and if enabling the notification or indication for this characteristic at BLE level was successful.
Notification and/or indication configuration is only performed per characteristic if changed.
Implementation will enable notification if available, otherwise indication will be enabled if available.
Implementation uses enableNotificationOrIndication(boolean[]) to enable either.
Occurring notifications and indications for this characteristic will call the respective BTGattChar.Listener callback method.
listener | A BTGattChar.Listener instance, listening to this BTGattChar's events |
enabledState | array of size 2, holding the resulting enabled state for notification and indication using enableNotificationOrIndication(boolean[]) |
IllegalStateException | if the BTDevice's GATTHandler is null, i.e. not connected |
IllegalStateException | if the given BTGattChar.Listener is already in use, i.e. added. |
Implements org.direct_bt.BTGattChar.
Definition at line 274 of file DBTGattChar.java.
BTGattChar jau.direct_bt.DBTGattChar.clone | ( | ) |
Reimplemented from jau.direct_bt.DBTObject.
Definition at line 144 of file DBTGattChar.java.
synchronized void jau.direct_bt.DBTGattChar.close | ( | ) |
Release the native memory associated with this object The object should not be used following a call to close.
Reimplemented from jau.direct_bt.DBTObject.
Definition at line 117 of file DBTGattChar.java.
final synchronized boolean jau.direct_bt.DBTGattChar.configNotificationIndication | ( | final boolean | enableNotification, |
final boolean | enableIndication, | ||
final boolean | enabledState[] | ||
) | throws IllegalStateException |
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration.
Method enables notification and/or indication for this characteristic at BLE level.
Implementation masks this Characteristic properties PropertyBitVal::Notify and PropertyBitVal::Indicate with the respective user request parameters, hence removes unsupported requests.
Notification and/or indication configuration is only performed per characteristic if changed.
It is recommended to utilize notification over indication, as its link-layer handshake and higher potential bandwidth may deliver material higher performance.
enableNotification | |
enableIndication | |
enabledState | array of size 2, holding the resulting enabled state for notification and indication. |
IllegalStateException | if notification or indication is set to be enabled and the BTDevice's GATTHandler is null, i.e. not connected |
Implements org.direct_bt.BTGattChar.
Definition at line 187 of file DBTGattChar.java.
|
protected |
Deletes the native instance.
Called via delete() and at this point
nativeInstance | copy of nativeInstance reference, which has been already zeroed. |
Reimplemented from jau.direct_bt.DBTNativeDownlink.
final synchronized void jau.direct_bt.DBTGattChar.disableValueNotifications | ( | ) |
Disables notifications of the value and unregisters the callback object passed through the corresponding enable method.
It disables notifcations at BLE level for this characteristic.
Implements org.direct_bt.BTGattChar.
Definition at line 290 of file DBTGattChar.java.
boolean jau.direct_bt.DBTGattChar.enableNotificationOrIndication | ( | final boolean | enabledState[] | ) | throws IllegalStateException |
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.3.3 Client Characteristic Configuration.
Method will attempt to enable notification on the BLE level, if available, otherwise indication if available.
Notification and/or indication configuration is only performed per characteristic if changed.
It is recommended to utilize notification over indication, as its link-layer handshake and higher potential bandwidth may deliver material higher performance.
enabledState | array of size 2, holding the resulting enabled state for notification and indication. |
IllegalStateException | if notification or indication is set to be enabled and the BTDevice's GATTHandler is null, i.e. not connected |
Implements org.direct_bt.BTGattChar.
Definition at line 237 of file DBTGattChar.java.
boolean jau.direct_bt.DBTGattChar.equals | ( | final Object | obj | ) |
Reimplemented from jau.direct_bt.DBTObject.
Definition at line 126 of file DBTGattChar.java.
BTGattDesc jau.direct_bt.DBTGattChar.find | ( | final String | UUID | ) |
Find a BluetoothGattDescriptor.
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 BluetoothGattDescriptor you are waiting for
Implements org.direct_bt.BTGattChar.
Definition at line 156 of file DBTGattChar.java.
BTGattDesc jau.direct_bt.DBTGattChar.find | ( | final String | UUID, |
final long | timeoutMS | ||
) |
Find a BluetoothGattDescriptor.
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 BluetoothGattDescriptor 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.
Implements org.direct_bt.BTGattChar.
Definition at line 148 of file DBTGattChar.java.
BTType jau.direct_bt.DBTGattChar.getBluetoothType | ( | ) |
Returns the BluetoothType of this object.
Implements org.direct_bt.BTObject.
Definition at line 139 of file DBTGattChar.java.
final int jau.direct_bt.DBTGattChar.getClientCharacteristicsConfigIndex | ( | ) |
Returns optional Client Characteristic Configuration index within descriptorList.
Definition at line 311 of file DBTGattChar.java.
final List<BTGattDesc> jau.direct_bt.DBTGattChar.getDescriptors | ( | ) |
Returns a list of BluetoothGattDescriptors this characteristic exposes.
Implements org.direct_bt.BTGattChar.
Definition at line 184 of file DBTGattChar.java.
final short jau.direct_bt.DBTGattChar.getHandle | ( | ) |
Characteristic Handle of this instance.
Attribute handles are unique for each device (server) (BT Core Spec v5.2: Vol 3, Part F Protocol..: 3.2.2 Attribute Handle).
Definition at line 300 of file DBTGattChar.java.
final boolean jau.direct_bt.DBTGattChar.getNotifying | ( | final boolean | enabledState[] | ) |
Returns true if notification for changes of this characteristic are activated.
enabledState | array of size 2, storage for the current enabled state for notification and indication. |
Implements org.direct_bt.BTGattChar.
Definition at line 164 of file DBTGattChar.java.
final GattCharPropertySet jau.direct_bt.DBTGattChar.getProperties | ( | ) |
Returns the properties of this characteristic.
BT Core Spec v5.2: Vol 3, Part G GATT: 3.3.1.1 Characteristic Properties
Implements org.direct_bt.BTGattChar.
Definition at line 171 of file DBTGattChar.java.
final BTGattService jau.direct_bt.DBTGattChar.getService | ( | ) |
Returns the service to which this characteristic belongs to.
Implements org.direct_bt.BTGattChar.
Definition at line 161 of file DBTGattChar.java.
String jau.direct_bt.DBTGattChar.getUUID | ( | ) |
Get the UUID of this characteristic.
Implements org.direct_bt.BTGattChar.
Definition at line 136 of file DBTGattChar.java.
final short jau.direct_bt.DBTGattChar.getValueHandle | ( | ) |
Returns Characteristics Value Handle.
Attribute handles are unique for each device (server) (BT Core Spec v5.2: Vol 3, Part F Protocol..: 3.2.2 Attribute Handle).
Definition at line 308 of file DBTGattChar.java.
final byte [] jau.direct_bt.DBTGattChar.readValue | ( | ) | throws BTException |
Reads the value of this characteristic.
Implements org.direct_bt.BTGattChar.
Definition at line 174 of file DBTGattChar.java.
final int jau.direct_bt.DBTGattChar.removeAllAssociatedCharListener | ( | final boolean | disableIndicationNotification | ) |
Disables the notification and/or indication for this characteristic BLE level if.
and removes all associated BTGattChar.Listener or BTGattCharListener from the listener list, which are associated with this characteristic instance.
If the DBTDevice's GATTHandler is null, i.e. not connected,
is being returned.
disableIndicationNotification | if true, disables the notification and/or indication for this characteristic using configNotificationIndication(boolean, boolean, boolean[]) |
Implements org.direct_bt.BTGattChar.
Definition at line 282 of file DBTGattChar.java.
final String jau.direct_bt.DBTGattChar.toString | ( | ) |
final boolean jau.direct_bt.DBTGattChar.writeValue | ( | final byte[] | argValue, |
final boolean | withResponse | ||
) | throws BTException |
Writes the value of this characteristic, using one of the following methods depending on.
BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.3 Write Characteristic Value BT Core Spec v5.2: Vol 3, Part G GATT: 4.9.1 Write Characteristic Value Without Response
[in] | arg_value | The data as vector<uchar> to be written packed in a GBytes struct |
withResponse | if true
|
Implements org.direct_bt.BTGattChar.
Definition at line 179 of file DBTGattChar.java.