B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer: Difference between revisions

→‎removeService(BluetoothGattService service): Refine the description that the promise would be rejected if the service doesn't exist in the server.
(Refine the argument of BluetoothGattServer.notifyCharacteristicChanged())
(→‎removeService(BluetoothGattService service): Refine the description that the promise would be rejected if the service doesn't exist in the server.)
 
(6 intermediate revisions by 2 users not shown)
Line 21: Line 21:
   [NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#removeService.28BluetoothGattService_service.29|removeService(BluetoothGattService service)]];
   [NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#removeService.28BluetoothGattService_service.29|removeService(BluetoothGattService service)]];
   [NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#notifyCharacteristicChanged.28DOMString_address.2C_BluetoothGattCharacteristic_characteristic.2C_bool_confirm.29|notifyCharacteristicChanged(DOMString address, BluetoothGattCharacteristic characteristic, bool confirm)]];
   [NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#notifyCharacteristicChanged.28DOMString_address.2C_BluetoothGattCharacteristic_characteristic.2C_bool_confirm.29|notifyCharacteristicChanged(DOMString address, BluetoothGattCharacteristic characteristic, bool confirm)]];
   [NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_int_status.2C_int_requestId.2C_ArrayBuffer_value.29|sendResponse(DOMString address, int status, int requestId)]];
   [NewObject] Promise<void> [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_unsigned_short_status.2C_unsigned_long_requestId.29|sendResponse(DOMString address, unsigned short status, unsigned long requestId)]];
  };
  };


Line 70: Line 70:
  {
  {
   readonly attribute DOMString address;
   readonly attribute DOMString address;
   readonly attribute short requestId;
   readonly attribute unsigned long requestId;
   readonly attribute BluetoothGattCharacteristic? characteristic;
   readonly attribute BluetoothGattCharacteristic? characteristic;
   readonly attribute BluetoothGattDescriptor? descriptor;
   readonly attribute BluetoothGattDescriptor? descriptor;
  readonly attribute ArrayBuffer? value;
  readonly attribute boolean needRsp;
  };
  };


Line 83: Line 85:
: ''descriptor''
: ''descriptor''
:: The descriptor requested to read. Null if remote client requests to read a local characteristic.
:: The descriptor requested to read. Null if remote client requests to read a local characteristic.
: ''value''
:: The new characteristic/descriptor value to be written in write requests. Null if the request was a read request.
: ''needRsp''
:: Indicate whether a response is needed or not. If needRsp is true, application needs to explicitly call [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_unsigned_short_status.2C_unsigned_long_requestId.29|sendResponse(DOMString address, unsigned short status, unsigned long requestId)]].


=== onattributewritereq ===
=== onattributewritereq ===
Line 93: Line 99:
  {
  {
   readonly attribute DOMString address;
   readonly attribute DOMString address;
   readonly attribute short requestId;
   readonly attribute unsigned long requestId;
   readonly attribute BluetoothGattCharacteristic? characteristic;
   readonly attribute BluetoothGattCharacteristic? characteristic;
   readonly attribute BluetoothGattDescriptor? descriptor;
   readonly attribute BluetoothGattDescriptor? descriptor;
  readonly attribute ArrayBuffer? value;
  readonly attribute boolean needRsp;
  };
  };


Line 106: Line 114:
: ''descriptor''
: ''descriptor''
:: The descriptor requested to write. Null if remote client requests to write a local characteristic.
:: The descriptor requested to write. Null if remote client requests to write a local characteristic.
: ''value''
:: The new characteristic/descriptor value to be written in write requests. Null if the request was a read request.
: ''needRsp''
:: Indicate whether a response is needed or not. If needRsp is true, application needs to explicitly call [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_unsigned_short_status.2C_unsigned_long_requestId.29|sendResponse(DOMString address, unsigned_short status, unsigned long requestId)]].
<!--
<!--
=== onexecutewritereq ===
=== onexecutewritereq ===
Line 133: Line 145:
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#removeService.28BluetoothGattService_service.29|BluetoothGattServer.removeService(BluetoothGattService service)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#removeService.28BluetoothGattService_service.29|BluetoothGattServer.removeService(BluetoothGattService service)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#notifyCharacteristicChanged.28DOMString_address.2C_BluetoothGattCharacteristic_characteristic.2C_bool_confirm.29|BluetoothGattServer.notifyCharacteristicChanged(DOMString address, BluetoothGattCharacteristic characteristic, bool confirm)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#notifyCharacteristicChanged.28DOMString_address.2C_BluetoothGattCharacteristic_characteristic.2C_bool_confirm.29|BluetoothGattServer.notifyCharacteristicChanged(DOMString address, BluetoothGattCharacteristic characteristic, bool confirm)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_int_status.2C_int_requestId.29|BluetoothGattServer.sendResponse(DOMString address, int status, int requestId)]]
* [[B2G/Bluetooth/WebBluetooth-v2/BluetoothGattServer#sendResponse.28DOMString_address.2C_unsigned_short_status.2C_unsigned_long_requestId.29|BluetoothGattServer.sendResponse(DOMString address, unsigned short status, unsigned long requestId)]]


=== connect(DOMString address) ===
=== connect(DOMString address) ===
Line 162: Line 174:
=== addService(BluetoothGattService service) ===
=== addService(BluetoothGattService service) ===
; Description
; Description
: The method adds a service to provide.
: The method adds a service. If the service already exists in the GATT server, the promise will be rejected.


; Parameter
; Parameter
Line 173: Line 185:
=== removeService(BluetoothGattService service) ===
=== removeService(BluetoothGattService service) ===
; Description
; Description
: The method removes a provided service.
: The method removes a provided service. If the service doesn't exist in the GATT server, the promise will be rejected.


; Parameter
; Parameter
Line 197: Line 209:
: A Promise to indicate whether the operation is resolved or rejected.
: A Promise to indicate whether the operation is resolved or rejected.


=== sendResponse(DOMString address, int status, int requestId) ===
=== sendResponse(DOMString address, unsigned short status, unsigned long requestId) ===


; Description
; Description
39

edits