Class BluetoothGattDescriptor
java.lang.Object
com.github.hypfvieh.bluetooth.wrapper.AbstractBluetoothObject
com.github.hypfvieh.bluetooth.wrapper.BluetoothGattDescriptor
Wrapper class which represents a GATT descriptor on a remote device.
- Author:
- hypfvieh
-
Constructor Summary
ConstructorsConstructorDescriptionBluetoothGattDescriptor(GattDescriptor1 _descriptor, BluetoothGattCharacteristic _characteristicWrapper, String _dbusPath, org.freedesktop.dbus.connections.impl.DBusConnection _dbusConnection) -
Method Summary
Modifier and TypeMethodDescriptionGet theBluetoothGattCharacteristicinstance behind thisBluetoothGattDescriptorobject.getFlags()From bluez Documentation:protected Class<? extends org.freedesktop.dbus.interfaces.DBusInterface> DBus-Interface class used in this wrapper object.Get the rawGattDescriptor1object behind this wrapper.getUuid()From bluez Documentation:byte[]getValue()From bluez Documentation:byte[]Read a value from the GATT descriptor register.
Supported options:toString()voidwriteValue(byte[] _value, Map<String, Object> _options) Write value to the GATT descriptor register.
Supported options:Methods inherited from class com.github.hypfvieh.bluetooth.wrapper.AbstractBluetoothObject
byteListToByteArray, getBluetoothType, getDbusConnection, getDbusPath, getRemoteObjects, getTyped, optionsToVariantMap, setTyped, toPrimitives
-
Constructor Details
-
BluetoothGattDescriptor
public BluetoothGattDescriptor(GattDescriptor1 _descriptor, BluetoothGattCharacteristic _characteristicWrapper, String _dbusPath, org.freedesktop.dbus.connections.impl.DBusConnection _dbusConnection)
-
-
Method Details
-
getInterfaceClass
DBus-Interface class used in this wrapper object.- Specified by:
getInterfaceClassin classAbstractBluetoothObject- Returns:
- class which implements the interface
-
writeValue
public void writeValue(byte[] _value, Map<String, Object> _options) throws BluezFailedException, BluezInProgressException, BluezNotPermittedException, BluezNotAuthorizedException, BluezNotSupportedException, BluezInvalidValueLengthExceptionWrite value to the GATT descriptor register.
Supported options:
"offset": uint16 offset "device": Object Device (Server only)
- Parameters:
_value- value to write_options- options to use- Throws:
BluezFailedException- on failure if anything failedBluezInProgressException- when operation already in progress if operation in progressBluezNotPermittedException- if operation not permittedBluezNotAuthorizedException- when not authorized if not authorizedBluezNotSupportedException- when operation not supported if not supportedBluezInvalidValueLengthException- if length is invalid
-
readValue
public byte[] readValue(Map<String, Object> _options) throws BluezFailedException, BluezInProgressException, BluezNotPermittedException, BluezNotAuthorizedException, BluezNotSupportedExceptionRead a value from the GATT descriptor register.
Supported options:
"offset": uint16 offset "device": Object Device (Server only)
- Parameters:
_options- options to use- Returns:
- byte array, maybe null
- Throws:
BluezFailedException- on failure if anything failedBluezInProgressException- when operation already in progress if operation in progressBluezNotPermittedException- if operation not permittedBluezNotAuthorizedException- when not authorized if not authorizedBluezNotSupportedException- when operation not supported if not supported
-
getUuid
From bluez Documentation:128-bit descriptor UUID.
- Returns:
- uuid, maybe null
-
getCharacteristic
Get theBluetoothGattCharacteristicinstance behind thisBluetoothGattDescriptorobject.- Returns:
BluetoothGattCharacteristic, maybe null
-
getRawCharacteric
Get the rawGattDescriptor1object behind this wrapper.- Returns:
GattDescriptor1, maybe null
-
getValue
public byte[] getValue()From bluez Documentation:The cached value of the descriptor. This property
gets updated only after a successful read request, upon
which a PropertiesChanged signal will be emitted.- Returns:
- byte array, maybe null
-
getFlags
From bluez Documentation:Defines how the descriptor value can be used.
Possible values:
"read" "write" "encrypt-read" "encrypt-write" "encrypt-authenticated-read" "encrypt-authenticated-write" "secure-read" (Server Only) "secure-write" (Server Only)- Returns:
- List of String, maybe null
-
toString
-