Sequenceablepublic class GattService extends Object implements Sequenceable
The GATT service contains a collection of GattCharacteristic.
Sequenceable.Producer<T>| 构造器 | 说明 |
|---|---|
GattService(UUID uuid,
boolean isPrimary) |
A constructor used to create a
GattService instance with a specified UUID. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
addCharacteristic(GattCharacteristic characteristic) |
Adds a
GattCharacteristic object to a service. |
boolean |
addService(GattService service) |
Adds a GATT service to a service.
|
Optional<GattCharacteristic> |
getCharacteristic(UUID uuid) |
Obtains a characteristic with a specified UUID of a service.
|
List<GattCharacteristic> |
getCharacteristics() |
Obtains the
GattCharacteristic list of a service. |
List<GattService> |
getIncludedServices() |
Obtains the list of GATT services contained in a service.
|
UUID |
getUuid() |
Obtains the UUID of a service.
|
boolean |
isPrimary() |
Checks whether a service is the primary service.
|
boolean |
marshalling(Parcel out) |
Marshals this
Sequenceable object into a Parcel. |
boolean |
unmarshalling(Parcel in) |
Unmarshals this
Sequenceable object from a Parcel. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waithasFileDescriptorpublic GattService(UUID uuid, boolean isPrimary)
GattService instance with a specified UUID.uuid - Indicates the UUID of the GattService instance.isPrimary - Indicates whether the GattService instance is primary or secondary.
true indicates primary and false indicates secondary.public boolean isPrimary()
true if the service is the primary service; returns false otherwise.public UUID getUuid()
public boolean addService(GattService service)
service - Indicates the GATT service to add, which is specified in GattService.true if the GATT service is added to the service.public List<GattService> getIncludedServices()
public boolean addCharacteristic(GattCharacteristic characteristic)
GattCharacteristic object to a service.characteristic - Indicates the characteristic to add.true if the characteristic is added to the service.public List<GattCharacteristic> getCharacteristics()
GattCharacteristic list of a service.GattCharacteristic list of the service.public Optional<GattCharacteristic> getCharacteristic(UUID uuid)
uuid - Indicates the UUID of the characteristic.Optional object if the characteristic is found;
returns Optional#empty() otherwise.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.