Confirmed users
891
edits
| Line 51: | Line 51: | ||
== Methods == | == Methods == | ||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#connect.28DOMString_address.29|BluetoothGattServer.connect(DOMString address)]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#disconnect.28DOMString_address.29|BluetoothGattServer.disconnect(DOMString address)]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#addService.28BluetoothGattService_service.29|BluetoothGattServer.addService(BluetoothGattService service)]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#removeService.28BluetoothGattService_service.29|BluetoothGattServer.removeService(BluetoothGattService service)]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#clearServices.28.29|BluetoothGattServer.clearServices()]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#close.28.29|BluetoothGattServer.close()]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#notifyCharacteristicChanged.28DOMString_address.2C_DOMString_uuid.2C_int_instanceId.2C_bool_confirm.29|BluetoothGattServer.notifyCharacteristicChanged(DOMString address, DOMString uuid, int instanceId, bool confirm)]] | |||
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_int_status.2C_int_requestId.2C_ArrayBuffer_value.29|BluetoothGattServer.sendResponse(DOMString address, int status, int requestId, ArrayBuffer value)]] | |||
=== connect(DOMString address) === | === connect(DOMString address) === | ||
; Description | |||
: The method initiates a connection to remote LE device. | |||
; Parameter | |||
: ''address'' | |||
:: The address of remote LE device to connect. | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. | |||
=== disconnect(DOMString address) === | === disconnect(DOMString address) === | ||
; Description | |||
: The method disconnects the established connection of remote LE device. | |||
; Parameter | |||
: ''address'' | |||
:: The address of remote LE device to disconnect. | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. | |||
=== addService(BluetoothGattService service) === | === addService(BluetoothGattService service) === | ||
; Description | |||
: The method adds a service to provide. | |||
; Parameter | |||
: ''service'' | |||
:: The [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService|BluetoothGattService]] object to add. | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. If the Promise is resolved, property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#services|services]] is also updated with the added service. | |||
=== removeService(BluetoothGattService service) === | === removeService(BluetoothGattService service) === | ||
; Description | |||
: The method removes a provided service. | |||
; Parameter | |||
: ''service'' | |||
:: The [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattService#BluetoothGattService|BluetoothGattService]] object to remove. | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. If the Promise is resolved, property [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#services|services]] is also updated without the removed service. | |||
=== clearServices() === | === clearServices() === | ||
; Description | ; Description | ||
: The method removes all services | : The method removes all provided services. | ||
; Return | ; Return | ||
| Line 71: | Line 118: | ||
=== notifyCharacteristicChanged(DOMString address, DOMString uuid, int instanceId, bool confirm) === | === notifyCharacteristicChanged(DOMString address, DOMString uuid, int instanceId, bool confirm) === | ||
; Description | |||
: The method sends a notification/indication that a local characteristic has been updated. | |||
; Parameter | |||
: ''address'' | |||
:: The address of remote LE device to notify. | |||
: ''uuid'' | |||
:: UUID of the updated characteristic. | |||
: ''instanceId'' | |||
:: Instance id of the updated characteristic. | |||
: ''confirm'' | |||
:: Whether to request confirmation from the client (indication) or not (notification). | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. | |||
=== sendResponse(DOMString address, int status, int requestId, ArrayBuffer value) === | === sendResponse(DOMString address, int status, int requestId, ArrayBuffer value) === | ||
; Description | |||
: The method sends a response to a read or write request to a remote LE device. | |||
; Parameter | |||
: ''address'' | |||
:: The address of remote LE device to notify. | |||
: ''status'' | |||
:: The status of the request to reply. | |||
: ''requestId'' | |||
:: The ID of the request to reply. | |||
: ''ArrayBuffer'' | |||
:: The value of the attribute that was read/written. | |||
; Return | |||
: A Promise to indicate whether the operation is resolved or rejected. | |||