Version: Smart Feature Phone 3.0

BluetoothGattServer.startAdvertising

Description#

The method starts to broadcast advertisements with an optional custom advertisement data.

Syntax#

var promise = instanceOfBluetoothGattServer.startAdvertising(advData);

Parameters#

  • advData The custom advertisement data object. The default value of the object is defined in BluetoothAdvertisingData.
dictionary BluetoothAdvertisingData
{
/**
* Uuid value of Appearance characteristic of the GAP service which can be
* mapped to an icon or string that describes the physical representation of
* the device during the device discovery procedure.
*/
unsigned short appearance = 0;
/**
* Whether to broadcast with device name or not.
*/
boolean includeDevName = false;
/**
* Whether to broadcast with TX power or not.
*/
boolean includeTxPower = false;
/**
* Company Identifier Code for manufacturer data.
*
* This ID will be combined with |manufacturerData| byte array specified
* below as the broadcasting manufacturer data. Please see Core Specification
* Supplement (CSS) v6 1.4 for more details.
*/
unsigned short manufacturerId = 0;
/**
* Byte array of custom manufacturer specific data.
*
* These bytes will be appended to |manufacturerId| specified above as the
* broadcasting manufacturer data. Please see Core Specification Supplement
* (CSS) v6 1.4 for more details.
*/
ArrayBuffer? manufacturerData = null;
/**
* 128-bit Service UUID for service data.
*
* This UUID will be combinded with |serviceData| specified below as the
* broadcasting service data. Please see Core Specification Supplement (CSS)
* v6 1.11 for more details.
*/
DOMString serviceUuid = "";
/**
* Data associated with |serviceUuid|.
*
* These bytes will be appended to |serviceUuid| specified above as the
* broadcasting manufacturer data. Please see Core Specification Supplement
* (CSS) v6 1.11 for more details.
*/
ArrayBuffer? serviceData = null;
/**
* A list of Service or Service Class UUIDs.
* Please see Core Specification Supplement (CSS) v6 1.1 for more details.
*/
sequence<DOMString> serviceUuids = [];
};

Return value#

A Promise to indicate whether the operation is resolved or rejected. If the bluetooth adapter is currently disabled, the Promise would be rejected.