B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService: Difference between revisions
< B2G | Bluetooth | WebBluetooth-v2
Jump to navigation
Jump to search
Line 9: | Line 9: | ||
interface BluetoothGattService | interface BluetoothGattService | ||
{ | { | ||
[Cached, Pure] | [Cached, Pure] readonly attribute sequence<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic|BluetoothGattCharacteristic]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#characteristics|characteristics]]; | ||
[Cached, Pure] readonly attribute sequence<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService|BluetoothGattService]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#includedServices|includedServices]]; | |||
[Cached, Pure] | |||
readonly attribute boolean | readonly attribute boolean [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#isPrimary|isPrimary]]; | ||
readonly attribute DOMString | readonly attribute DOMString [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#uuid|uuid]]; | ||
readonly attribute unsigned short | readonly attribute unsigned short [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#instanceId|instanceId]]; | ||
[NewObject, Throws] | [NewObject, Throws] Promise<[[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattCharacteristic#BluetoothGattCharacteristic|BluetoothGattCharacteristic]]> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#addCharacteristic.28DOMString_aUuid.2C_Permissions_aPermissions.2C_Properties_aProperties.29|addCharacteristic(DOMString aUuid, Permission aPermissions, Properties aProperties)]]; | ||
[NewObject, Throws] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#addIncludedService.28BluetoothGattService_aService.29|addIncludedService(BluetoothGattService aService)]]; | |||
[NewObject, Throws] | |||
}; | }; | ||
Revision as of 06:23, 20 November 2014
Overview
BluetoothGattService represents the service provided by GATT server. BluetoothGattService consists of the service definition, a list of included services which this service references, and a list of characteristics in this service.
Interfaces
BluetoothGattService
[CheckPermissions="bluetooth"] interface BluetoothGattService { [Cached, Pure] readonly attribute sequence<BluetoothGattCharacteristic> characteristics; [Cached, Pure] readonly attribute sequence<BluetoothGattService> includedServices; readonly attribute boolean isPrimary; readonly attribute DOMString uuid; readonly attribute unsigned short instanceId; [NewObject, Throws] Promise<BluetoothGattCharacteristic> addCharacteristic(DOMString aUuid, Permission aPermissions, Properties aProperties); [NewObject, Throws] Promise<void> addIncludedService(BluetoothGattService aService); };
Properties
- BluetoothGattService.characteristics
- BluetoothGattService.includedServices
- BluetoothGattService.isPrimary
- BluetoothGattService.uuid
- BluetoothGattService.instanceId
characteristics
- Description
- A cached array of charactertistics contained in this service.
- Value Type
- sequence<BluetoothGattCharacteristic>
- Default Value
- Empty array (array with length = 0)
includedServices
- Description
- A cached array of included services referenced by this service.
- Value Type
- sequence<BluetoothGattService>
- Default Value
- Empty array (array with length = 0)
isPrimary
- Description
- Indicate whether this is a primary or secondary service.
- Value Type
- boolean
- Default Value
- false
uuid
- Description
- This property stores the UUID of this service.
- Value Type
- DOMString
- Default Value
- Empty string ("")
instanceId
- Description
- This property stores the instance id of this service.
- Value Type
- unsigned short
- Default Value
- 0
Methods
- BluetoothGattService.addCharacteristic(DOMString aUuid, Permissions aPermissions, Properties aProperties)
- BluetoothGattService.addIncludedService(BluetoothGattService aService)
addCharacteristic(DOMString aUuid, Permissions aPermissions, Properties aProperties)
- Description
- The method adds a characteristic to this service.
- Return
- A Promise to indicate whether the operation is resolved or rejected. Once the Promise is resolved, the property characteristics is also updated with the added characteristic.
addIncludedService(BluetoothGattService aService)
- Description
- The method adds an included service to this service.
- Return
- A Promise to indicate whether the operation is resolved or rejected. Once the Promise is resolved, the property includedServices is also updated with the added service.