java.lang.Object | |
↳ | android.bluetooth.BluetoothGattCharacteristic |
Represents a Bluetooth GATT Characteristic
A GATT characteristic is a basic data element used to construct a GATT service,
BluetoothGattService
. The characteristic contains a value as well as
additional information and optional GATT descriptors,
BluetoothGattDescriptor
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | FORMAT_FLOAT | Characteristic value format type float (32-bit float) | |||||||||
int | FORMAT_SFLOAT | Characteristic value format type sfloat (16-bit float) | |||||||||
int | FORMAT_SINT16 | Characteristic value format type sint16 | |||||||||
int | FORMAT_SINT32 | Characteristic value format type sint32 | |||||||||
int | FORMAT_SINT8 | Characteristic value format type sint8 | |||||||||
int | FORMAT_UINT16 | Characteristic value format type uint16 | |||||||||
int | FORMAT_UINT32 | Characteristic value format type uint32 | |||||||||
int | FORMAT_UINT8 | Characteristic value format type uint8 | |||||||||
int | PERMISSION_READ | Characteristic read permission | |||||||||
int | PERMISSION_READ_ENCRYPTED | Characteristic permission: Allow encrypted read operations | |||||||||
int | PERMISSION_READ_ENCRYPTED_MITM | Characteristic permission: Allow reading with man-in-the-middle protection | |||||||||
int | PERMISSION_WRITE | Characteristic write permission | |||||||||
int | PERMISSION_WRITE_ENCRYPTED | Characteristic permission: Allow encrypted writes | |||||||||
int | PERMISSION_WRITE_ENCRYPTED_MITM | Characteristic permission: Allow encrypted writes with man-in-the-middle protection | |||||||||
int | PERMISSION_WRITE_SIGNED | Characteristic permission: Allow signed write operations | |||||||||
int | PERMISSION_WRITE_SIGNED_MITM | Characteristic permission: Allow signed write operations with man-in-the-middle protection | |||||||||
int | PROPERTY_BROADCAST | Characteristic proprty: Characteristic is broadcastable. | |||||||||
int | PROPERTY_EXTENDED_PROPS | Characteristic property: Characteristic has extended properties | |||||||||
int | PROPERTY_INDICATE | Characteristic property: Characteristic supports indication | |||||||||
int | PROPERTY_NOTIFY | Characteristic property: Characteristic supports notification | |||||||||
int | PROPERTY_READ | Characteristic property: Characteristic is readable. | |||||||||
int | PROPERTY_SIGNED_WRITE | Characteristic property: Characteristic supports write with signature | |||||||||
int | PROPERTY_WRITE | Characteristic property: Characteristic can be written. | |||||||||
int | PROPERTY_WRITE_NO_RESPONSE | Characteristic property: Characteristic can be written without response. | |||||||||
int | WRITE_TYPE_DEFAULT | Write characteristic, requesting acknoledgement by the remote device | |||||||||
int | WRITE_TYPE_NO_RESPONSE | Wrtite characteristic without requiring a response by the remote device | |||||||||
int | WRITE_TYPE_SIGNED | Write characteristic including authentication signature |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
mDescriptors | List of descriptors included in this characteristic. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Create a new BluetoothGattCharacteristic.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Adds a descriptor to this characteristic.
|
||||||||||
|
Returns a descriptor with a given UUID out of the list of
descriptors for this characteristic.
|
||||||||||
|
Returns a list of descriptors for this characteristic.
|
||||||||||
|
Return the stored value of this characteristic.
|
||||||||||
|
Returns the instance ID for this characteristic.
|
||||||||||
|
Return the stored value of this characteristic.
|
||||||||||
|
Returns the permissions for this characteristic.
|
||||||||||
|
Returns the properties of this characteristic.
|
||||||||||
|
Returns the service this characteristic belongs to.
|
||||||||||
|
Return the stored value of this characteristic.
|
||||||||||
|
Returns the UUID of this characteristic
|
||||||||||
|
Get the stored value for this characteristic.
|
||||||||||
|
Gets the write type for this characteristic.
|
||||||||||
|
Set the locally stored value of this characteristic.
|
||||||||||
|
Updates the locally stored value of this characteristic.
|
||||||||||
|
Set the locally stored value of this characteristic.
|
||||||||||
|
Set the locally stored value of this characteristic.
|
||||||||||
|
Set the write type for this characteristic
Setting the write type of a characteristic determines how the
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Characteristic value format type float (32-bit float)
Characteristic value format type sfloat (16-bit float)
Characteristic value format type sint16
Characteristic value format type sint32
Characteristic value format type sint8
Characteristic value format type uint16
Characteristic value format type uint32
Characteristic value format type uint8
Characteristic read permission
Characteristic permission: Allow encrypted read operations
Characteristic permission: Allow reading with man-in-the-middle protection
Characteristic write permission
Characteristic permission: Allow encrypted writes
Characteristic permission: Allow encrypted writes with man-in-the-middle protection
Characteristic permission: Allow signed write operations
Characteristic permission: Allow signed write operations with man-in-the-middle protection
Characteristic proprty: Characteristic is broadcastable.
Characteristic property: Characteristic has extended properties
Characteristic property: Characteristic supports indication
Characteristic property: Characteristic supports notification
Characteristic property: Characteristic is readable.
Characteristic property: Characteristic supports write with signature
Characteristic property: Characteristic can be written.
Characteristic property: Characteristic can be written without response.
Write characteristic, requesting acknoledgement by the remote device
Wrtite characteristic without requiring a response by the remote device
Write characteristic including authentication signature
List of descriptors included in this characteristic.
Create a new BluetoothGattCharacteristic.
Requires
BLUETOOTH
permission.
uuid | The UUID for this characteristic |
---|---|
properties | Properties of this characteristic |
permissions | Permissions for this characteristic |
Adds a descriptor to this characteristic.
Requires
BLUETOOTH
permission.
descriptor | Descriptor to be added to this characteristic. |
---|
Returns a descriptor with a given UUID out of the list of descriptors for this characteristic.
Returns a list of descriptors for this characteristic.
Return the stored value of this characteristic.
See
getValue()
for details.
formatType | The format type used to interpret the characteristic value. |
---|---|
offset | Offset at which the float value can be found. |
Returns the instance ID for this characteristic.
If a remote device offers multiple characteristics with the same UUID, the instance ID is used to distuinguish between characteristics.
Return the stored value of this characteristic.
The formatType parameter determines how the characteristic value
is to be interpreted. For example, settting formatType to
FORMAT_UINT16
specifies that the first two bytes of the
characteristic value at the given offset are interpreted to generate the
return value.
formatType | The format type used to interpret the characteristic value. |
---|---|
offset | Offset at which the integer value can be found. |
Returns the permissions for this characteristic.
Returns the properties of this characteristic.
The properties contain a bit mask of property flags indicating the features of this characteristic.
Returns the service this characteristic belongs to.
Return the stored value of this characteristic.
See
getValue()
for details.
offset | Offset at which the string value can be found. |
---|
Returns the UUID of this characteristic
Get the stored value for this characteristic.
This function returns the stored value for this characteristic as
retrieved by calling
readCharacteristic(BluetoothGattCharacteristic)
. The cached
value of the characteristic is updated as a result of a read characteristic
operation or if a characteristic update notification has been received.
Gets the write type for this characteristic.
Set the locally stored value of this characteristic.
See
setValue(byte[])
for details.
value | New value for this characteristic |
---|---|
formatType | Integer format type used to transform the value parameter |
offset | Offset at which the value should be placed |
Updates the locally stored value of this characteristic.
This function modifies the locally stored cached value of this
characteristic. To send the value to the remote device, call
writeCharacteristic(BluetoothGattCharacteristic)
to send the value to the
remote device.
value | New value for this characteristic |
---|
Set the locally stored value of this characteristic.
See
setValue(byte[])
for details.
value | New value for this characteristic |
---|
Set the locally stored value of this characteristic.
See
setValue(byte[])
for details.
mantissa | Mantissa for this characteristic |
---|---|
exponent | exponent value for this characteristic |
formatType | Float format type used to transform the value parameter |
offset | Offset at which the value should be placed |
Set the write type for this characteristic
Setting the write type of a characteristic determines how the
writeCharacteristic(BluetoothGattCharacteristic)
function write this
characteristic.
writeType |
The write type to for this characteristic. Can be one
of:
WRITE_TYPE_DEFAULT
,
WRITE_TYPE_NO_RESPONSE
or
WRITE_TYPE_SIGNED
.
|
---|