java.lang.Object | |
↳ | android.bluetooth.BluetoothGattService |
Represents a Bluetooth GATT Service
Gatt Service contains a collection of BluetoothGattCharacteristic
,
as well as referenced services.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | SERVICE_TYPE_PRIMARY | Primary service | |||||||||
int | SERVICE_TYPE_SECONDARY | Secondary service (included by primary services) |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
mCharacteristics | List of characteristics included in this service. | ||||||||||
mIncludedServices | List of included services for this service. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new BluetoothGattService.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Add a characteristic to this service.
| |||||||||||
Add an included service to this service.
| |||||||||||
Returns a characteristic with a given UUID out of the list of
characteristics offered by this service.
| |||||||||||
Returns a list of characteristics included in this service.
| |||||||||||
Get the list of included GATT services for this service.
| |||||||||||
Returns the instance ID for this service
If a remote device offers multiple services with the same UUID (ex. | |||||||||||
Get the type of this service (primary/secondary)
| |||||||||||
Returns the UUID of this service
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Primary service
Secondary service (included by primary services)
List of characteristics included in this service.
List of included services for this service.
Create a new BluetoothGattService.
Requires BLUETOOTH
permission.
uuid | The UUID for this service |
---|---|
serviceType | The type of this service,
SERVICE_TYPE_PRIMARY or
SERVICE_TYPE_SECONDARY
|
Add a characteristic to this service.
Requires BLUETOOTH
permission.
characteristic | The characteristics to be added |
---|
Add an included service to this service.
Requires BLUETOOTH
permission.
service | The service to be added |
---|
Returns a characteristic with a given UUID out of the list of characteristics offered by this service.
This is a convenience function to allow access to a given characteristic
without enumerating over the list returned by getCharacteristics()
manually.
If a remote service offers multiple characteristics with the same UUID, the first instance of a characteristic with the given UUID is returned.
Returns a list of characteristics included in this service.
Get the list of included GATT services for this service.
Returns the instance ID for this service
If a remote device offers multiple services with the same UUID (ex. multiple battery services for different batteries), the instance ID is used to distuinguish services.
Returns the UUID of this service