Sequenceablepublic class GattCharacteristic extends Object implements Sequenceable
The GATT characteristic is a basic data element for constructing a GATT service. The characteristic contains a value, additional information, and optional GATT descriptors.
Sequenceable.Producer<T>| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
PROPERTY_READ |
Indicates that the characteristic is readable.
|
static int |
PROPERTY_WRITE |
Indicates that the characteristic can be written.
|
static int |
PROPERTY_WRITE_NO_RESPONSE |
Indicates that the characteristic can be written with no response.
|
| 构造器 | 说明 |
|---|---|
GattCharacteristic(UUID uuid,
int permissions,
int properties) |
A constructor used to create a
GattCharacteristic instance. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
addDescriptor(GattDescriptor descriptor) |
Adds a
GattDescriptor object to this characteristic. |
Optional<GattDescriptor> |
getDescriptor(UUID uuid) |
Returns a
Optional with a given UUID out of the list of
descriptors for this characteristic. |
List<GattDescriptor> |
getDescriptors() |
Obtains a list of
GattDescriptor objects for this characteristic. |
int |
getPermissions() |
Obtains the permissions for a characteristic.
|
int |
getProperties() |
Obtains the properties of a characteristic.
|
GattService |
getService() |
Obtains the
GattService to which a characteristic belongs. |
UUID |
getUuid() |
Obtains the UUID of a characteristic.
|
byte[] |
getValue() |
Obtains the stored value of a characteristic.
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
boolean |
setValue(byte[] values) |
Sets the stored value of a characteristic.
|
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic static final int PROPERTY_READ
public static final int PROPERTY_WRITE
public static final int PROPERTY_WRITE_NO_RESPONSE
public GattCharacteristic(UUID uuid, int permissions, int properties)
GattCharacteristic instance.uuid - Indicates the UUID of the characteristic.permissions - Indicates the permissions of the characteristic in bit mask.properties - Indicates the properties of the characteristic in bit mask.public UUID getUuid()
public int getPermissions()
public int getProperties()
public boolean setValue(byte[] values)
values - Indicates the stored value of the characteristic.true if the stored value is set successfully; returns false otherwise.public byte[] getValue()
public GattService getService()
GattService to which a characteristic belongs.GattService to which the characteristic belongs.public boolean addDescriptor(GattDescriptor descriptor)
GattDescriptor object to this characteristic.descriptor - Indicates the descriptor to add.true if the descriptor is added to this characteristic; returns false otherwise.public List<GattDescriptor> getDescriptors()
GattDescriptor objects for this characteristic.GattDescriptor objects for this characteristic.public Optional<GattDescriptor> getDescriptor(UUID uuid)
Optional with a given UUID out of the list of
descriptors for this characteristic.uuid - Indicates the UUID of the descriptor.Optional object or Optional#empty()
if no descriptor with the given UUID was found.public boolean marshalling(Parcel out)
SequenceableSequenceable object into a Parcel.marshalling 在接口中 Sequenceableout - Indicates the Parcel object to which the Sequenceable
object will be marshaled..true if the marshalling is successful; returns false otherwise.public boolean unmarshalling(Parcel in)
SequenceableSequenceable object from a Parcel.unmarshalling 在接口中 Sequenceablein - Indicates the Parcel object into which the Sequenceable
object has been marshaled.true if the unmarshalling is successful; returns false otherwise.