From a9c63c4d0bf8d82aa94b52dbff16c2d0d2191b2c Mon Sep 17 00:00:00 2001 From: "sangrae.kim" Date: Fri, 26 Jun 2015 15:54:07 +0900 Subject: [PATCH] [Web Device API] Modify the Bluetooth api reference Change-Id: Iaf8cf01740eda1b70617a6765331a8828263b38b Signed-off-by: sangrae.kim --- .../html/device_api/mobile/tizen/bluetooth.html | 284 +- .../html/device_api/wearable/tizen/bluetooth.html | 2989 +++++++++++++++++--- 2 files changed, 2723 insertions(+), 550 deletions(-) diff --git a/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html b/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html index 370588e..362a7d1 100644 --- a/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html +++ b/org.tizen.web.apireference/html/device_api/mobile/tizen/bluetooth.html @@ -222,9 +222,7 @@ For more information on the Bluetooth features, see BluetoothLEScanCallback -void onstarted ()
- void ondevicefound (BluetoothLEDevice device)
- void onfinished (BluetoothLEDevice[] foundDevices) +void onsuccess (BluetoothLEDevice device) BluetoothLEAdvertiseCallback @@ -412,7 +410,7 @@ For more information on the Bluetooth features, see

1.7. BluetoothAdvertisePacketType

- The Bluetooth LE packet type + The Bluetooth LE packet type.
    enum BluetoothAdvertisePacketType { "ADVERTISE", "SCAN_RESPONSE" };

@@ -431,7 +429,7 @@ SCAN_RESPONSE- the scan response packet

1.8. BluetoothAdvertisingState

- The Bluetooth advertising state + The Bluetooth advertising state.
    enum BluetoothAdvertisingState { "STARTED", "STOPPED" };

@@ -450,7 +448,7 @@ STOPPED - advertising has stopped

1.9. BluetoothAdvertisingMode

- The Bluetooth advertising mode + The Bluetooth advertising mode.
    enum BluetoothAdvertisingMode { "BALANCED", "LOW_LATENCY", "LOW_ENERGY" };

@@ -496,7 +494,7 @@ The tizen.bluetooth object allows access to the Bluetooth API. The BluetoothLEServiceData interface is a service specific data container of Bluetooth LE device.

    interface BluetoothLEServiceData {
-        attribute BluetoothUUID serviceuuid;
+        attribute BluetoothUUID uuid;
         attribute DOMString data;
      };

@@ -506,8 +504,8 @@ The tizen.bluetooth object allows access to the Bluetooth API.

Attributes

    -
  • -BluetoothUUID serviceuuid
    +
  • +BluetoothUUID uuid
    The 16 bit UUID of service data

    @@ -545,7 +543,7 @@ The tizen.bluetooth object allows access to the Bluetooth API.

    • DOMString id
      - The manufacturer assigned ID. + The manufacturer assigned ID

      Since: @@ -554,7 +552,7 @@ The tizen.bluetooth object allows access to the Bluetooth API.

    • DOMString data
      - The manufacturer data content. + The manufacturer data content

      Since: @@ -571,7 +569,7 @@ The tizen.bluetooth object allows access to the Bluetooth API.

    dictionary BluetoothLEAdvertiseDataInit {
         boolean? includeName;
-        BluetoothUUID[]? serviceuuids;
+        BluetoothUUID[]? uuids;
         BluetoothLESolicitationUUID[]? solicitationuuids;
         unsigned long? appearance;
         boolean? includeTxPowerLevel;
@@ -596,7 +594,7 @@ This dictionary is used as an input parameter of the BluetoothLEAdvertiseData co
 
    [Constructor(optional BluetoothLEAdvertiseDataInit? init)]
     interface BluetoothLEAdvertiseData {
          attribute boolean? includeName;
-         attribute BluetoothUUID[]? serviceuuids;
+         attribute BluetoothUUID[]? uuids;
          attribute BluetoothLESolicitationUUID[]? solicitationuuids;
          attribute unsigned long? appearance;
          attribute boolean? includeTxPowerLevel;
@@ -623,18 +621,17 @@ This represents the data to be advertised as well as the scan response data for
 
  • boolean includeName [nullable]
    The flag indicating whether the device name should be included in advertise or scan response data. -By default, this attribute is set to null. If attribute is set to null, The default value is set to a false. +If attribute is set to null, The default value is set to a false.

    Since: 2.3.1

  • -
  • +
  • BluetoothUUID[] - serviceuuids [nullable]
    + uuids [nullable]
    The service UUID for advertise or scan response data. -By default, this attribute is set to null.

    Since: @@ -645,7 +642,6 @@ By default, this attribute is set to null. BluetoothLESolicitationUUID[] solicitationuuids [nullable]

    The service solicitation UUID for advertise or scan response data. -By default, this attribute is set to null.

    Since: @@ -655,7 +651,6 @@ By default, this attribute is set to null.

  • unsigned long appearance [nullable]
    The external appearance of this device for advertise or scan response data. -By default, this attribute is set to null.
  • BluetoothLEManufacturerData manufacturerData [nullable]
    The manufacturer specific data for advertise or scan response data. -By default, this attribute is set to null.

    Since: @@ -2210,9 +2203,7 @@ This interface offers methods to control local Bluetooth Low Energy behavior, su

    • -Scanning for remote devices
    • -
    • -Listening for changes in Bluetooth Low Energy state
    • +Scanning and Advertising for remote devices
  • @@ -2273,7 +2264,7 @@ The ErrorCallback will be launched in the following situations: with error type TypeMismatchError, if any input attribute is not compatible with the expected type for this attribute.

  • - with error type InvalidStateError, if device is currently in progress of scanning + with error type InvalidStateError, if device is currently in progress of scanning, if the local Bluetooth le adapter is currently not enabled.

  • with error type SecurityError, if the application does not have the privilege to call this method. @@ -2284,14 +2275,8 @@ The ErrorCallback will be launched in the following situations:

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     onstarted: function() {
    -         console.log("Scan started");
    -     },
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              console.log("[Found device] address: " + device.address);
    -     },
    -     onfinished: function(devices) {
    -         console.log("Found devices: " + devices.length);
          }
      });
      
    @@ -2333,17 +2318,11 @@ The ErrorCallback will be launched in the following situations:

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     onstarted: function() {
    -         console.log("Scan started");
    -     },
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              if (device.address == "11:22:33:44:55:66") {
                  console.log("Found device: " + device.name);
                  adapter.stopScan();
              }
    -     },
    -     onfinished: function(devices) {
    -         console.log("Found devices: " + devices.length);
          }
      });
      
    @@ -2397,7 +2376,7 @@ The ErrorCallback will be launched in the following situations:
  • successCallback: - called when edvertisement is found. + Callback function that is called when advertise is started successfully.
  • errorCallback [optional] [nullable]: @@ -2420,10 +2399,10 @@ The ErrorCallback will be launched in the following situations: with error type TypeMismatchError, if any input attribute is not compatible with the expected type for this attribute.

  • - with error type QuotaPatameterError, if any input attribute is not compatible with the maximum data size for this attribute. + with error type QuotaExceededError, if any input attribute is not compatible with the maximum data size for this attribute.

  • - with error type InvalidStateError, if device is currently in progress of advertising + with error type InvalidStateError, if device is currently in progress of advertising, if the local Bluetooth le adapter is currently not enabled.

  • with error type SecurityError, if the application does not have the privilege to call this method. @@ -2439,18 +2418,24 @@ The ErrorCallback will be launched in the following situations: includeName: true, // Whether the device name should be included includeTxPowerLevel: true, // Whether the transmission power level should be included appearance: 192, // The external appearance of device, 192 - Generic Watch - serviceuuids: [battery_svc_uuid_16], + uuids: [battery_svc_uuid_16], solicitationuuids: [heart_rate_svc_uuid_16] }; var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions); var connectable = true; - adapter.startAdvertise(advertiseData, "ADVERTISE", function() { - onstate: function(state) { + adapter.startAdvertise( + advertiseData, + "ADVERTISE", + function onstate(state) { console.log("Advertiser state: " + state); - } - }, "LOW_LATENCY", connectable); + }, + function(e) { + console.log("Failed to startAdvertise : " + e.message); + }, + "LOW_LATENCY", + connectable);

  • @@ -2495,17 +2480,16 @@ The ErrorCallback will be launched in the following situations: includeName: true, // Whether the device name should be included includeTxPowerLevel: true, // Whether the transmission power level should be included appearance: 192, // The external appearance of device, 192 - Generic Watch - serviceuuids: [battery_svc_uuid_16], + uuids: [battery_svc_uuid_16], solicitationuuids: [heart_rate_svc_uuid_16] }; var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions); - adapter.startAdvertise(advertiseData, "ADVERTISE", function() { - onstate: function(state) { + adapter.startAdvertise(advertiseData, "ADVERTISE", + function onstate(state) { console.log("Advertiser state: " + state); - } - }); + }); adapter.stopAdvertise(); @@ -2527,29 +2511,6 @@ The ErrorCallback will be launched in the following situations: Since: 2.3.1

    -
    -

    Code example:

     function onError(e) {
    -     console.log("Error occured: " + e.message);
    - }
    -
    - function onDeviceFound(device) {
    -    if (device.address == "11:22:33:44:55:66") {
    -        console.log("Found device: " + device.name);
    -        try {
    -             var service = device.getService(device.uuids[0]);
    -             console.log("Service got");
    -        } catch(e) {
    -            console.log("Failed to retrieve service: " + e.message);
    -        }
    -    }
    - }
    -
    - var adapter = tizen.bluetooth.getLEAdapter();
    - adapter.startScan({
    -     ondevicefound: onDeviceFound
    - }, onError);
    - 
    -

    Attributes

    -
    -onfinished -
    -
    -
    - Called when the device scanning process has finished. -
    -
    void onfinished(BluetoothLEDevice[] foundDevices);
    -             
    -

    - Since: - 2.3.1 -

    -
    -

    Parameters:

    -
      -
    • -foundDevices: - Array of devices found in this discovery session -
    • -
    -
    -
    @@ -3806,7 +3709,7 @@ A BluetoothLEDevice object can be retrieved by using one of the followi

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              console.log("Found device: " + device.address);
          }
      });
    @@ -3825,7 +3728,7 @@ A BluetoothLEDevice object can be retrieved by using one of the followi
     

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              console.log("Found device: " + device.name);
          }
      });
    @@ -3844,7 +3747,7 @@ A BluetoothLEDevice object can be retrieved by using one of the followi
     

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              console.log("Found device: " + device.txpowerlevel);
          }
      });
    @@ -3863,7 +3766,7 @@ A BluetoothLEDevice object can be retrieved by using one of the followi
     

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              console.log("Found device: " + device.appearance);
          }
      });
    @@ -3883,19 +3786,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi
     

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     onstarted: function() {
    -         console.log("Scan started");
    -     },
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              var uuids = device.uuids;
              var services = "";
              for (var i = 0; i < uuids.length; i++) {
                  services += uuids[i] + "\n";
              }
              console.log ("Service found: " + services);
    -     },
    -     onfinished: function(devices) {
    -         console.log("Found devices: " + devices.length);
          }
      });
      
    @@ -3914,19 +3811,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     onstarted: function() {
    -         console.log("Scan started");
    -     },
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              var uuids = device.solicitationuuids;
              var services = "";
              for (var i = 0; i < uuids.length; i++) {
                  services += uuids[i] + "\n";
              }
              console.log ("Service solicitations found: " + services);
    -     },
    -     onfinished: function(devices) {
    -         console.log("Found devices: " + devices.length);
          }
      });
      
    @@ -3945,19 +3836,13 @@ A BluetoothLEDevice object can be retrieved by using one of the followi

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     onstarted: function() {
    -         console.log("Scan started");
    -     },
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              var serviceData = device.serviceData;
              var data = "";
              for (var i = 0; i < serviceData.length; i++) {
                  data += serviceData[i].id + serviceData[i].data + "\n";
              }
              console.log ("Service data found: " + data);
    -     },
    -     onfinished: function(devices) {
    -         console.log("Found devices: " + devices.length);
          }
      });
      
    @@ -3975,16 +3860,10 @@ A BluetoothLEDevice object can be retrieved by using one of the followi

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
      adapter.startScan({
    -     onstarted: function() {
    -         console.log("Scan started");
    -     },
    -     ondevicefound: function(device) {
    +     onsuccess: function(device) {
              var manufacturerData = device.manufacturerData;
              console.log ("Manufacture id: " + manufacturerData.id);
              console.log ("Manufacture data: " + manufacturerData.data);
    -     },
    -     onfinished: function(devices) {
    -         console.log("Found devices: " + devices.length);
          }
      });
      
    @@ -4064,7 +3943,7 @@ The ErrorCallback is launched with these error types: var adapter = tizen.bluetooth.getLEAdapter(); adapter.startScan({ - ondevicefound: function(device) { + onsuccess: function(device) { if (device.address == "11:22:33:44:55:66") { console.log("Found device: " + device.name); device.connect(onconnected, onerror); @@ -4155,7 +4034,7 @@ The ErrorCallback is launched with these error types: var adapter = tizen.bluetooth.getLEAdapter(); adapter.startScan({ - ondevicefound: onDeviceFound + onsuccess: onDeviceFound }, onerror);
    @@ -4173,15 +4052,6 @@ The ErrorCallback is launched with these error types: Since: 2.3.1

    -
    -

    -The ErrorCallback is launched with these error types: -

    -
      -
    • - UnknownError - If any other error occurs
    • -
    -

    Privilege level: public @@ -4237,7 +4107,7 @@ The ErrorCallback is launched with these error types: var adapter = tizen.bluetooth.getLEAdapter(); adapter.startScan({ - ondevicefound: onDeviceFound + onsuccess: onDeviceFound }, onerror);

    @@ -4299,7 +4169,7 @@ The ErrorCallback is launched with these error types: var adapter = tizen.bluetooth.getLEAdapter(); adapter.startScan({ - ondevicefound: onDeviceFound + onsuccess: onDeviceFound }, onerror);
    @@ -4352,7 +4222,7 @@ The ErrorCallback is launched with these error types: var adapter = tizen.bluetooth.getLEAdapter(); var listenerID = null; adapter.startScan({ - ondevicefound: onDeviceFound + onsuccess: onDeviceFound }, onerror);
    @@ -6440,7 +6310,7 @@ To guarantee that the Bluetooth Low Energy application runs on a device with Blu
  • http://tizen.org/feature/network.bluetooth.le
  • - For more information, see Application Filtering. + For more information, see Application Filtering.

    4. Full WebIDL

    module Bluetooth {
    @@ -6468,7 +6338,7 @@ To guarantee that the Bluetooth Low Energy application runs on a device with Blu
         Tizen implements BluetoothManagerObject;
     
         interface BluetoothLEServiceData {
    -        attribute BluetoothUUID serviceuuid;
    +        attribute BluetoothUUID uuid;
             attribute DOMString data;
          };
     
    @@ -6479,7 +6349,7 @@ To guarantee that the Bluetooth Low Energy application runs on a device with Blu
     
         dictionary BluetoothLEAdvertiseDataInit {
             boolean? includeName;
    -        BluetoothUUID[]? serviceuuids;
    +        BluetoothUUID[]? uuids;
             BluetoothLESolicitationUUID[]? solicitationuuids;
             unsigned long? appearance;
             boolean? includeTxPowerLevel;
    @@ -6490,7 +6360,7 @@ To guarantee that the Bluetooth Low Energy application runs on a device with Blu
         [Constructor(optional BluetoothLEAdvertiseDataInit? init)]
         interface BluetoothLEAdvertiseData {
              attribute boolean? includeName;
    -         attribute BluetoothUUID[]? serviceuuids;
    +         attribute BluetoothUUID[]? uuids;
              attribute BluetoothLESolicitationUUID[]? solicitationuuids;
              attribute unsigned long? appearance;
              attribute boolean? includeTxPowerLevel;
    @@ -6602,9 +6472,7 @@ To guarantee that the Bluetooth Low Energy application runs on a device with Blu
         };
     
         [Callback, NoInterfaceObject] interface BluetoothLEScanCallback {
    -        void onstarted();
    -        void ondevicefound(BluetoothLEDevice device);
    -        void onfinished(BluetoothLEDevice[] foundDevices);
    +        void onsuccess(BluetoothLEDevice device);
         };
     
         [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothLEAdvertiseCallback {
    diff --git a/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html b/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html
    index 1513718..b2d68d2 100644
    --- a/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html
    +++ b/org.tizen.web.apireference/html/device_api/wearable/tizen/bluetooth.html
    @@ -22,7 +22,7 @@ Controls local Bluetooth device, that is, turn Bluetooth on/off, etc.          <
               
  • Sets visibility
  • -Discovers nearby Bluetooth devices (Device discovery)
  • +Discovers nearby Bluetooth devices (Device discovery, including Bluetooth LE devices)
  • Gets bonded devices information
  • @@ -31,6 +31,10 @@ Controls bonding
  • Connects to a service on a remote device and exchanges data
  • Registers a service (RFCOMM) on a local device, which can be consumed by remote devices to exchange data
  • +
  • +Advertise for remote devices (including Bluetooth LE devices)
  • +
  • +Act as a GATT client (Generic Attribute Profile client)
  • For more information on the Bluetooth features, see Bluetooth Guide. @@ -53,54 +57,88 @@ For more information on the Bluetooth features, see BluetoothHealthChannelType +

  • 1.6. BluetoothLESolicitationUUID +
  • +
  • 1.7. BluetoothAdvertisePacketType +
  • +
  • 1.8. BluetoothAdvertisingState +
  • +
  • 1.9. BluetoothAdvertisingMode +
  • 2. Interfaces
  • @@ -122,9 +160,26 @@ For more information on the Bluetooth features, see BluetoothLEServiceData + + + +BluetoothLEManufacturerData + + + +BluetoothLEAdvertiseDataInit + + + +BluetoothLEAdvertiseData + + + BluetoothManager -BluetoothAdapter getDefaultAdapter () +BluetoothAdapter getDefaultAdapter ()
    + BluetoothLEAdapter getLEAdapter () BluetoothAdapter @@ -143,10 +198,58 @@ For more information on the Bluetooth features, see BluetoothProfileHandler getBluetoothProfileHandler (BluetoothProfileType profileType) +BluetoothLEAdapter +void startScan (BluetoothLEScanCallback successCallback, optional ErrorCallback? errorCallback)
    + void stopScan ()
    + void startAdvertise (BluetoothLEAdvertiseData advertiseData, BluetoothAdvertisePacketType packetType, BluetoothLEAdvertiseCallback successCallback, optional ErrorCallback? errorCallback, optional BluetoothAdvertisingMode? mode, optional boolean? connectable)
    + void stopAdvertise () + + +BluetoothGATTService + + + +BluetoothGATTCharacteristic +void readValue (ReadValueSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    + void writeValue (byte[] value, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    + long addValueChangeListener (ReadValueSuccessCallback callback)
    + void removeValueChangeListener (long watchID) + + +BluetoothGATTDescriptor +void readValue (ReadValueSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    + void writeValue (byte[] value, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback) + + +BluetoothLEScanCallback +void onsuccess (BluetoothLEDevice device) + + +BluetoothLEAdvertiseCallback +void onstate (BluetoothAdvertisingState state) + + +BluetoothLEConnectChangeCallback +void onconnected (BluetoothLEDevice device)
    + void ondisconnected (BluetoothLEDevice device) + + +ReadValueSuccessCallback +void onread (byte[] value) + + BluetoothDevice void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) +BluetoothLEDevice +void connect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    + void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    + BluetoothGATTService getService (BluetoothUUID uuid)
    + long addConnectStateChangeListener (BluetoothLEConnectChangeCallback listener)
    + void removeConnectStateChangeListener (long watchID) + + BluetoothSocket unsigned long writeData (byte[] data)
    byte[] readData ()
    @@ -293,6 +396,76 @@ For more information on the Bluetooth features, see +

    1.6. BluetoothLESolicitationUUID

    +
    + The service solicitation UUID of the Bluetooth LE device. +
    +
        typedef DOMString BluetoothLESolicitationUUID;
    +

    + Since: + 2.3.1 +

    + +
    +

    1.7. BluetoothAdvertisePacketType

    +
    + The Bluetooth LE packet type. +
    +
        enum BluetoothAdvertisePacketType { "ADVERTISE", "SCAN_RESPONSE" };
    +

    + Since: + 2.3.1 +

    +
    +
      +
    • +ADVERTISE - the advertising packet
    • +
    • +SCAN_RESPONSE- the scan response packet
    • +
    +
    +
    +
    +

    1.8. BluetoothAdvertisingState

    +
    + The Bluetooth advertising state. +
    +
        enum BluetoothAdvertisingState { "STARTED", "STOPPED" };
    +

    + Since: + 2.3.1 +

    +
    +
      +
    • +STARTED - advertising has started
    • +
    • +STOPPED - advertising has stopped
    • +
    +
    +
    +
    +

    1.9. BluetoothAdvertisingMode

    +
    + The Bluetooth advertising mode. +
    +
        enum BluetoothAdvertisingMode { "BALANCED", "LOW_LATENCY", "LOW_ENERGY" };
    +

    + Since: + 2.3.1 +

    +
    +
      +
    • +BALANCED- Balanced advertising mode
    • +
    • +LOW_LATENCY- Low latency advertising mode
    • +
    • +LOW_ENERGY - Low energy advertising mode
    • +
    +
    +

    2. Interfaces

    @@ -315,8 +488,214 @@ The tizen.bluetooth object allows access to the Bluetooth API.

    +
    +

    2.2. BluetoothLEServiceData

    +
    + The BluetoothLEServiceData interface is a service specific data container of Bluetooth LE device. +
    +
        interface BluetoothLEServiceData {
    +        attribute BluetoothUUID uuid;
    +        attribute DOMString data;
    +     };
    +

    + Since: + 2.3.1 +

    +
    +

    Attributes

    +
      +
    • +BluetoothUUID uuid
      + The 16 bit UUID of service data +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +DOMString data
      + The service data of the Bluetooth LE device +
      +

      + Since: + 2.3.1 +

      +
    • +
    +
    +
    +
    +

    2.3. BluetoothLEManufacturerData

    +
    + The BluetoothLEManufacturerData interface is a manufacturer specific data container for an advertise or scan response data. +
    +
        interface BluetoothLEManufacturerData {
    +        attribute DOMString id;
    +        attribute DOMString data;
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Attributes

    +
      +
    • +DOMString id
      + The manufacturer assigned ID +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +DOMString data
      + The manufacturer data content +
      +

      + Since: + 2.3.1 +

      +
    • +
    +
    +
    +
    +

    2.4. BluetoothLEAdvertiseDataInit

    +
    + Provides a dictionary for specifying advertise or scan response data. +
    +
        dictionary BluetoothLEAdvertiseDataInit {
    +        boolean? includeName;
    +        BluetoothUUID[]? uuids;
    +        BluetoothLESolicitationUUID[]? solicitationuuids;
    +        unsigned long? appearance;
    +        boolean? includeTxPowerLevel;
    +        BluetoothLEServiceData[]? serviceData;
    +        BluetoothLEManufacturerData? manufacturerData;
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    +This dictionary is used as an input parameter of the BluetoothLEAdvertiseData construtor. +

    +
    +
    +
    +

    2.5. BluetoothLEAdvertiseData

    +
    + The BluetoothLEAdvertiseData interface is an advertise or scan response data container for Bluetooth advertising. +
    +
        [Constructor(optional BluetoothLEAdvertiseDataInit? init)]
    +    interface BluetoothLEAdvertiseData {
    +         attribute boolean? includeName;
    +         attribute BluetoothUUID[]? uuids;
    +         attribute BluetoothLESolicitationUUID[]? solicitationuuids;
    +         attribute unsigned long? appearance;
    +         attribute boolean? includeTxPowerLevel;
    +         attribute BluetoothLEServiceData[]? serviceData;
    +         attribute BluetoothLEManufacturerData? manufacturerData;
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    +The BluetoothLEAdvertiseData container for Bluetooth LE advertising. +This represents the data to be advertised as well as the scan response data for active scans. +

    +
    +
    +

    Constructors

    +
    BluetoothLEAdvertiseData(optional BluetoothLEAdvertiseDataInit? init);
    +
    +
    +

    Attributes

    +
      +
    • +boolean includeName [nullable]
      + The flag indicating whether the device name should be included in advertise or scan response data. +If attribute is set to null, The default value is set to a false. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +BluetoothUUID[] + uuids [nullable]
      + The service UUID for advertise or scan response data. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +BluetoothLESolicitationUUID[] + solicitationuuids [nullable]
      + The service solicitation UUID for advertise or scan response data. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +unsigned long appearance [nullable]
      + The external appearance of this device for advertise or scan response data. +
      +
      +

      +See the list of appearance codes for sample values. +

      +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +boolean includeTxPowerLevel [nullable]
      + The transmission power level should be included in advertise or scan response data. +If attribute is set to null, The default value is set to a false. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +BluetoothLEServiceData[] + serviceData [nullable]
      + The service data for advertise or scan response data. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • +BluetoothLEManufacturerData manufacturerData [nullable]
      + The manufacturer specific data for advertise or scan response data. +
      +

      + Since: + 2.3.1 +

      +
    • +
    +
    +
    -

    2.2. BluetoothManager

    +

    2.6. BluetoothManager

    The BluetoothManager interface provides access to the BluetoothAdapter object.
    @@ -325,6 +704,8 @@ The tizen.bluetooth object allows access to the Bluetooth API. readonly attribute BluetoothClassDeviceMinor deviceMinor; readonly attribute BluetoothClassDeviceService deviceService; BluetoothAdapter getDefaultAdapter() raises(WebAPIException); + + BluetoothLEAdapter getLEAdapter() raises(WebAPIException); };

    Since: @@ -414,39 +795,91 @@ The tizen.bluetooth object allows access to the Bluetooth API. - - - -

    -

    2.3. BluetoothAdapter

    +
    +getLEAdapter +
    +
    - The BluetoothAdapter interface provides access to control the device's Bluetooth adapter. -
    -
        [NoInterfaceObject] interface BluetoothAdapter {
    -        readonly attribute DOMString name;
    -        readonly attribute BluetoothAddress address;
    -        readonly attribute boolean powered;
    -        readonly attribute boolean visible;
    -
    -        void setName(DOMString name,
    -                     optional SuccessCallback? successCallback,
    -                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setPowered(boolean state,
    -                        optional SuccessCallback? successCallback,
    -                        optional ErrorCallback? errorCallback) raises(WebAPIException);
    -
    -        void setVisible(boolean mode,
    -                        optional SuccessCallback? successCallback,
    -                        optional ErrorCallback? errorCallback,
    -                        optional unsigned short? timeout) raises(WebAPIException);
    -
    -        void setChangeListener(BluetoothAdapterChangeCallback listener) raises(WebAPIException);
    -
    -        void unsetChangeListener() raises(WebAPIException);
    -
    -        void discoverDevices(BluetoothDiscoverDevicesSuccessCallback successCallback,
    -                             optional ErrorCallback? errorCallback) raises(WebAPIException);
    + Gets the default Low Energy Bluetooth adapter.
    +            
    +
    BluetoothLEAdapter getLEAdapter();
    +             
    +

    + Since: + 2.3.1 +

    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +

    Remark : + To check if this method is supported or not, use tizen.systeminfo.getCapability("http://tizen.org/feature/network.bluetooth.le"). +

    +
    +

    Return value:

    + BluetoothLEAdapter The local BluetoothLEAdapter object. +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      • + with error type NotSupportedError, if the feature is not supported. +

      • +
      • + with error type UnknownError, if any other error occurs. +

      • +
      +
    +
    +
    +

    Code example:

     try {
    +     var adapter = tizen.bluetooth.getLEAdapter();
    + } catch (err) {
    +     console.log(err.name +": " + err.message);
    + }
    + 
    +
    + + + + +
    +

    2.7. BluetoothAdapter

    +
    + The BluetoothAdapter interface provides access to control the device's Bluetooth adapter. +
    +
        [NoInterfaceObject] interface BluetoothAdapter {
    +        readonly attribute DOMString name;
    +        readonly attribute BluetoothAddress address;
    +        readonly attribute boolean powered;
    +        readonly attribute boolean visible;
    +
    +        void setName(DOMString name,
    +                     optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
    +        void setPowered(boolean state,
    +                        optional SuccessCallback? successCallback,
    +                        optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
    +        void setVisible(boolean mode,
    +                        optional SuccessCallback? successCallback,
    +                        optional ErrorCallback? errorCallback,
    +                        optional unsigned short? timeout) raises(WebAPIException);
    +
    +        void setChangeListener(BluetoothAdapterChangeCallback listener) raises(WebAPIException);
    +
    +        void unsetChangeListener() raises(WebAPIException);
    +
    +        void discoverDevices(BluetoothDiscoverDevicesSuccessCallback successCallback,
    +                             optional ErrorCallback? errorCallback) raises(WebAPIException);
     
             void stopDiscovery(optional SuccessCallback? successCallback,
                                optional ErrorCallback? errorCallback) raises(WebAPIException);
    @@ -622,15 +1055,15 @@ The ErrorCallback is launched with these error types:
     

    Parameters:

    • -name: +name: Name to set
    • -successCallback [optional] [nullable]: +successCallback [optional] [nullable]: Callback function that is called when the asynchronous call completes successfully
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called when an error occurs
    @@ -678,7 +1111,7 @@ The ErrorCallback is launched with these error types: For most Bluetooth actions, the Bluetooth adapter must be powered on.

    Deprecated. - It is deprecated since Tizen 2.3 and will be removed in Tizen 3.0. Instead, let the user turn on/off Bluetooth through the Settings application. See Managing Bluetooth Tutorial. + It is deprecated since Tizen 2.3 and will be removed in Tizen 3.0. Instead, let the user turn on/off Bluetooth through the Settings application. For more information, see the Bluetooth Tutorial.

    void setPowered(boolean state, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
                  
    @@ -716,15 +1149,15 @@ The ErrorCallback is launched with these error names:

    Parameters:

    @@ -787,7 +1220,7 @@ The ErrorCallback is launched with these error names: Sets the local device visibility by sending a request to a Bluetooth hardware to change the device visible state to mode.

    Deprecated. - It is deprecated since Tizen 2.3 and will be removed in Tizen 3.0. Instead, let the user change the Bluetooth visibility through the Settings application. See the Managing Bluetooth Tutorial. + It is deprecated since Tizen 2.3 and will be removed in Tizen 3.0. Instead, let the user change the Bluetooth visibility through the Settings application. See the Bluetooth Tutorial.

    void setVisible(boolean mode, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback, optional unsigned short? timeout);
                  
    @@ -831,20 +1264,20 @@ The ErrorCallback is launched with these error types:

    Parameters:

    @@ -911,7 +1344,7 @@ It can either be set to: true - to show the device or falseParameters:

    @@ -1047,11 +1480,11 @@ The ErrorCallback is launched with these error types:

    Parameters:

    @@ -1145,11 +1578,11 @@ The ErrorCallback is launched with these error types:

    Parameters:

    @@ -1267,11 +1700,11 @@ The ErrorCallback is launched with these error types:

    Parameters:

    @@ -1355,15 +1788,15 @@ The ErrorCallback is launched with these error types:

    Parameters:

    @@ -1438,15 +1871,15 @@ The ErrorCallback is launched with these error types:

    Parameters:

    @@ -1467,7 +1900,7 @@ The ErrorCallback is launched with these error types:

    Code example:

     function onBondingSuccess(device) {
         console.log("Device Name:" + device.name);
         console.log("Device Address:" + device.address);
    -    console.log("Device Service UUIDs:" + device.uuids.join("\n"));
    +    console.log("Device Service UUIDs:" + device.uuids.join("
    ")); } function onError(e) { @@ -1520,15 +1953,15 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -address: +address: Address of a bonded device
    • -successCallback [optional] [nullable]: +successCallback [optional] [nullable]: Callback function that is called when an asynchronous call completes successfully
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called when an error occurs
    @@ -1616,19 +2049,19 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -uuid: +uuid: UUID of the new service, to which clients connect
    • -name: +name: Name of a service
    • -successCallback: +successCallback: Callback function that is called on successful service registration
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called when an error occurs
    @@ -1713,7 +2146,7 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -profileType: +profileType: Bluetooth Profile type
    @@ -1749,23 +2182,16 @@ The ErrorCallback is launched with these error types: -
    -

    2.4. BluetoothDevice

    +
    +

    2.8. BluetoothLEAdapter

    - The BluetoothDevice interface represents a remote Bluetooth device. + The BluetoothLEAdapter interface provides access to control the device's Bluetooth Low Energy adapter.
    -
        [NoInterfaceObject] interface BluetoothDevice {
    -        readonly attribute DOMString name;
    -        readonly attribute BluetoothAddress address;
    -        readonly attribute BluetoothClass deviceClass;
    -        readonly attribute boolean isBonded;
    -        readonly attribute boolean isTrusted;
    -        readonly attribute boolean isConnected;
    -        readonly attribute BluetoothUUID[] uuids;
    -
    -        void connectToServiceByUUID(BluetoothUUID uuid,
    -                                    BluetoothSocketSuccessCallback successCallback,
    -                                    optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
        [NoInterfaceObject] interface BluetoothLEAdapter {
    +        void startScan(BluetoothLEScanCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void stopScan() raises(WebAPIException);
    +        void startAdvertise(BluetoothLEAdvertiseData advertiseData, BluetoothAdvertisePacketType packetType, BluetoothLEAdvertiseCallback successCallback, optional ErrorCallback? errorCallback, optional BluetoothAdvertisingMode? mode, optional boolean? connectable) raises(WebAPIException);
    +        void stopAdvertise() raises(WebAPIException);
         };

    Since: @@ -1773,171 +2199,1768 @@ The ErrorCallback is launched with these error types:

    -A BluetoothDevice object can be retrieved using one of the following APIs: +This interface offers methods to control local Bluetooth Low Energy behavior, such as:

    • - BluetoothAdapter.getDevice()
    • -
    • - BluetoothAdapter.getKnownDevices()
    • -
    • - BluetoothAdapter.discoverDevices()
    • -
    • - BluetoothAdapter.createBonding()
    • +Scanning and Advertising for remote devices
    -
    -

    Attributes

    -
      -
    • - readonly -DOMString name
      - The readable name of this remote device. +
      +

      Methods

      +
      +
      +startScan +
      +
      +
      + Starts scanning for Low Energy advertisement.
      +
      void startScan(BluetoothLEScanCallback successCallback, optional ErrorCallback? errorCallback);
      +             

      Since: 2.3.1

      -
      -

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      - adapter.getDevice("11:22:33:44:55:66", function(device) {
      -    console.log("Device Name: " + device.name);
      - });
      - 
      -
      -
    • -
    • - readonly -BluetoothAddress address
      - The hardware address of this remote device. -
      -

      - Since: - 2.3.1 +

      +

      +The scanning process can be canceled anytime, by calling the stopScan() method in the BluetoothLEAdapter interface.

      -
      -

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      - adapter.getDevice("11:22:33:44:55:66", function(device) {
      -    console.log("Device Address: " + device.address);
      - });
      - 
      -
      -
    • -
    • - readonly -BluetoothClass deviceClass
      - The device class, which represents the type of the device and the services it provides. -
      -

      - Since: - 2.3.1 +

      +The ErrorCallback will be launched in the following situations:

      -
      -

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      - adapter.getDevice("11:22:33:44:55:66", function(device) {
      -    console.log("Device Major Class: " + device.deviceClass.major);
      - });
      - 
      -
      -
    • -
    • - readonly -boolean isBonded
      - The bond state of this remote device with the local device. -
      -

      - Since: - 2.3.1 +

        +
      • + ServiceNotAvailableError - If a Bluetooth device is turned off
      • +
      • + UnknownError - If any other error occurs.
      • +
      +
    +

    + Privilege level: + public

    -
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
    - });
    - 
    -
    - -
  • - readonly -boolean isTrusted
    - The flag indicating whether the local device recognizes this remote device as a trusted device or not. -
    -

    - Since: - 2.3.1 +

    + Privilege: + http://tizen.org/privilege/bluetooth

    +
    +

    Parameters:

    +
      +
    • +successCallback: + called when advertisement is found. +
    • +
    • +errorCallback [optional] [nullable]: + The method to invoke when an error occurs. +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if any input attribute is not compatible with the expected type for this attribute. +

      • +
      • + with error type InvalidStateError, if device is currently in progress of scanning, if the local Bluetooth le adapter is currently not enabled. +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
    +

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         console.log("[Found device] address: " + device.address);
    +     }
      });
      
    -
  • -
  • - readonly -boolean isConnected
    - The flag indicating whether the connection state of this remote device with the local device. + +
    +stopScan +
    +
    +
    + Stops scanning for Low Energy advertisement.
    +
    void stopScan();
    +             

    Since: 2.3.1

    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      • + with error type UnknownError, if any other error occurs +

      • +
      +
    +
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
    +

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             adapter.stopScan();
    +         }
    +     }
      });
      
    -
  • -
  • - readonly -BluetoothUUID[] - uuids
    - The list of 128 bit service UUIDs available on this remote device. + +
    +startAdvertise +
    +
    +
    + Starts advertising for Low Energy Devices.
    +
    void startAdvertise(BluetoothLEAdvertiseData advertiseData, BluetoothAdvertisePacketType packetType, BluetoothLEAdvertiseCallback successCallback, optional ErrorCallback? errorCallback, optional BluetoothAdvertisingMode? mode, optional boolean? connectable);
    +             

    Since: 2.3.1

    +
    +

    +A advertising process can be canceled anytime, by calling stopAdvertise() on the BluetoothLEAdapter. +

    +

    +The ErrorCallback will be launched in the following situations: +

    +
      +
    • + ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +advertiseData: + BluetoothLEAdvertiseData object to be added +
    • +
    • +packetType: + The bluetooth LE packet type +
    • +
    • +successCallback: + Callback function that is called when advertise is started successfully. +
    • +
    • +errorCallback [optional] [nullable]: + The method to invoke when an error occurs. +
    • +
    • +mode [optional] [nullable]: + The power and latency mode of advertising. The default mode is "BALANCED". +
    • +
    • +connectable [optional] [nullable]: + The connectable status. It's true if the advertisement will be connectable. The default value of the parameter is true. +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if any input attribute is not compatible with the expected type for this attribute. +

      • +
      • + with error type QuotaExceededError, if any input attribute is not compatible with the maximum data size for this attribute. +

      • +
      • + with error type InvalidStateError, if device is currently in progress of advertising, if the local Bluetooth le adapter is currently not enabled. +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    + var battery_svc_uuid_16 = "180f"; // the service UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
    + var heart_rate_svc_uuid_16 = "180d"; // the service solicitation UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
    + var advertiseOptions = {
    +     includeName: true,          // Whether the device name should be included
    +     includeTxPowerLevel: true,    // Whether the transmission power level should be included
    +     appearance: 192,     // The external appearance of device, 192 - Generic Watch
    +     uuids: [battery_svc_uuid_16],
    +     solicitationuuids: [heart_rate_svc_uuid_16]
    + };
    +
    + var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
    + var connectable = true;
    +
    + adapter.startAdvertise(
    +     advertiseData,
    +     "ADVERTISE",
    +     function onstate(state) {
    +         console.log("Advertiser state: " + state);
    +     },
    +     function(e) {
    +         console.log("Failed to startAdvertise : " + e.message);
    +     },
    +     "LOW_LATENCY",
    +     connectable);
    + 
    +
    +
    +
    +stopAdvertise +
    +
    +
    + Stops advertising for Low Energy Devices. +
    +
    void stopAdvertise();
    +             
    +

    + Since: + 2.3.1 +

    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      • + with error type UnknownError, if any other error occurs +

      • +
      +
    +
    +
    +

    Code example:

     var adapter = tizen.bluetooth.getLEAdapter();
    + var battery_svc_uuid_16 = "180f"; // the service UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
    + var heart_rate_svc_uuid_16 = "180d"; // the service solicitation UUID, 16-bit UUID or 128-bit UUID is supported. (e.g. 180F, 0000180F-0000-1000-8000-00805F9B34FB)
    + var advertiseOptions = {
    +     includeName: true,          // Whether the device name should be included
    +     includeTxPowerLevel: true,    // Whether the transmission power level should be included
    +     appearance: 192,     // The external appearance of device, 192 - Generic Watch
    +     uuids: [battery_svc_uuid_16],
    +     solicitationuuids: [heart_rate_svc_uuid_16]
    + };
    +
    + var advertiseData = new tizen.BluetoothLEAdvertiseData(advertiseOptions);
    +
    + adapter.startAdvertise(advertiseData, "ADVERTISE",
    +     function onstate(state) {
    +         console.log("Advertiser state: " + state);
    +     });
    + adapter.stopAdvertise();
    + 
    +
    +
    + +
    +
  • +
    +

    2.9. BluetoothGATTService

    +
    + Bluetooth Low Energy Service. The service can be retrieved with BluetoothLEDevice.getService(). +
    +
        [NoInterfaceObject] interface BluetoothGATTService {
    +        readonly attribute BluetoothUUID uuid;
    +        readonly attribute BluetoothGATTService[] services;
    +        readonly attribute BluetoothGATTCharacteristic[] characteristics;
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Attributes

    +
      +
    • + readonly +BluetoothUUID uuid
      + UUID of the service. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +BluetoothGATTService[] + services
      + A list of services included in this service. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +BluetoothGATTCharacteristic[] + characteristics
      + A list of characteristics in this service. +
      +

      + Since: + 2.3.1 +

      +
    • +
    +
    +
    +
    +

    2.10. BluetoothGATTCharacteristic

    +
    + A characteristic provided by Bluetooth Low Energy service. +
    +
        [NoInterfaceObject] interface BluetoothGATTCharacteristic {
    +        readonly attribute BluetoothGATTDescriptor[] descriptors;
    +        readonly attribute boolean isBroadcast;
    +        readonly attribute boolean hasExtendedProperties;
    +        readonly attribute boolean isNotify;
    +        readonly attribute boolean isIndication;
    +        readonly attribute boolean isReadable;
    +        readonly attribute boolean isSignedWrite;
    +        readonly attribute boolean isWritable;
    +        readonly attribute boolean isWriteNoResponse;
    +        void readValue(ReadValueSuccessCallback successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void writeValue(byte[] value, optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
    +        long addValueChangeListener(ReadValueSuccessCallback callback) raises(WebAPIException);
    +
    +        void removeValueChangeListener(long watchID);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Attributes

    +
      +
    • + readonly +BluetoothGATTDescriptor[] + descriptors
      + A list of descriptors in this characteristic. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isBroadcast
      + Indicates if the characteristic is broadcastable. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean hasExtendedProperties
      + Indicates if the characteristic has extended properties. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isNotify
      + Indicates if the characteristic supports notification. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isIndication
      + Indicates if the characteristic supports indication. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isReadable
      + Indicates if the characteristic is readable. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isSignedWrite
      + Indicates if the characteristic supports write with the signature. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isWritable
      + Indicates if the characteristic is writable. +
      +

      + Since: + 2.3.1 +

      +
    • +
    • + readonly +boolean isWriteNoResponse
      + Indicates if the characteristic supports writing without response. +
      +

      + Since: + 2.3.1 +

      +
    • +
    +
    +
    +

    Methods

    +
    +
    +readValue +
    +
    +
    + Reads the characteristic value from the remote device. Updates characteristic value attribute. +
    +
    void readValue(ReadValueSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +successCallback: + Callback function that is called when the characteristic value is read successfully +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called in case of failure +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter. +

      • +
      • + with error type InvalidStateError, if device is currently not connected +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     function onerror(e) {
    +      console.log("Failed to connect to device: " + e.message);
    + }
    +
    + function proccessDevice(device) {
    +     device.connect(onConnected, onerror);
    +     function onConnected() {
    +         var service = device.getService(device.uuids[0]);
    +         if (service.characteristics.length > 0) {
    +             var characteristic = service.characteristics[0];
    +             characteristic.readValue(function(val) {
    +                  console.log("Value read: " + val);
    +                  device.disconnect();
    +             });
    +         }
    +     }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             proccessDevice(device);
    +         }
    +     }
    + });
    + 
    +
    +
    +
    +writeValue +
    +
    +
    + Writes the characteristic value to the remote device. +
    +
    void writeValue(byte[] value, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +value: + the characteristic value to write +
    • +
    • +successCallback [optional] [nullable]: + Callback function that is called when the characteristic value is written successfully +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called in case of failure +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter. +

      • +
      • + with error type InvalidStateError, if device is currently not connected +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     function onerror(e) {
    +      console.log("Failed to connect to device: " + e.message);
    + }
    +
    + function proccessDevice(device) {
    +     device.connect(onConnected, onerror);
    +     function onConnected() {
    +         var service = device.getService(device.uuids[0]);
    +         if (service.characteristics.length > 0) {
    +             var characteristic = service.characteristics[0];
    +             var data = new Array(1, 2, 3, 4, 5, 6);
    +             characteristic.writeValue(data, function() {
    +                  console.log("Value written");
    +                  device.disconnect();
    +             }, function(e) {
    +                  console.log("Failed to write: " + e.message);
    +             });
    +         }
    +     }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             proccessDevice(device);
    +         }
    +     }
    + });
    + 
    +
    +
    +
    +addValueChangeListener +
    +
    +
    + Registers a callback to be called when characteristic value of the characteristic changes. +
    +
    long addValueChangeListener(ReadValueSuccessCallback callback);
    +             
    +

    + Since: + 2.3.1 +

    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +callback: + Listener function that is called when the connection state changes +
    • +
    +
    +
    +

    Return value:

    + long The watchID to be used to unregister the listener +
    +
    +

    Exceptions:

    +
    • WebAPIException
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      +
    +
    +
    +

    Code example:

     function proccessDevice(device) {
    +
    +     function onConnected() {
    +         var service = device.getService("5BCE9431-6C75-32AB-AFE0-2EC108A30860");
    +         if (service.characteristics.length > 0) {
    +             var characteristic = service.characteristics[0];
    +             var watchID;
    +
    +             watchID = characteristic.addValueChangeListener(function(value) {
    +                 console.log("Characteristic value changed: " + value);
    +                 characteristic.removeValueChangeListener(watchID);
    +                 device.disconnect();
    +             });
    +         }
    +     }
    +
    +     device.connect(onConnected);
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             adapter.stopScan();
    +             proccessDevice(device);
    +         }
    +     }
    + });
    + 
    +
    +
    +
    +removeValueChangeListener +
    +
    +
    + Unregisters a characteristic value change listener +
    +
    void removeValueChangeListener(long watchID);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +watchID: + The watchID identifier returned by the addValueChangeListener() method. +
    • +
    +
    +
    +
    +
    +
    +
    +

    2.11. BluetoothGATTDescriptor

    +
    + Bluetooth Low Energy Descriptor. +
    +
        [NoInterfaceObject] interface BluetoothGATTDescriptor {
    +        void readValue(ReadValueSuccessCallback successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void writeValue(byte[] value, optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Methods

    +
    +
    +readValue +
    +
    +
    + Reads descriptor value from remote device. Updates descriptor value attribute. +
    +
    void readValue(ReadValueSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +successCallback: + Callback function that is called when the descriptor value is read successfully +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called in case of failure +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter. +

      • +
      • + with error type InvalidStateError, if device is currently not connected +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     function onerror(e) {
    +      console.log("Failed to connect to device: " + e.message);
    + }
    +
    + function proccessDevice(device) {
    +     device.connect(onConnected, onerror);
    +     function onConnected() {
    +         var service = device.getService(device.uuids[0]);
    +         if (service.characteristics.length > 0) {
    +             var characteristic = service.characteristics[0];
    +             var descriptor = characteristic.descriptors[0];
    +             descriptor.readValue(function(val) {
    +                  console.log("Value read: " + val);
    +                  device.disconnect();
    +             });
    +         }
    +     }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             proccessDevice(device);
    +         }
    +     }
    + });
    + 
    +
    +
    +
    +writeValue +
    +
    +
    + Writes the descriptor value to the remote device. +
    +
    void writeValue(byte[] value, optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +value: + the descriptor value to write +
    • +
    • +successCallback [optional] [nullable]: + Callback function that is called when the descriptor value is written successfully +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called in case of failure +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter. +

      • +
      • + with error type InvalidStateError, if device is currently not connected +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     function onerror(e) {
    +      console.log("Failed to connect to device: " + e.message);
    + }
    +
    + function proccessDevice(device) {
    +     device.connect(onConnected, onerror);
    +     function onConnected() {
    +         var service = device.getService(device.uuids[0]);
    +         if (service.characteristics.length > 0) {
    +             var characteristic = service.characteristics[0];
    +             var data = new Array(1, 2, 3, 4, 5, 6);
    +             var descriptor = characteristic.descriptors[0];
    +             descriptor.writeValue(data, function() {
    +                  console.log("Value written");
    +                  device.disconnect();
    +             }, function(e) {
    +                  console.log("Failed to write: " + e.message);
    +             });
    +         }
    +     }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             proccessDevice(device);
    +         }
    +     }
    + });
    + 
    +
    +
    +
    +
    +
    +
    +

    2.12. BluetoothLEScanCallback

    +
    + Bluetooth scanning process interface that defines the success callback for BluetoothLEAdapter.startScan()
    +
        [Callback, NoInterfaceObject] interface BluetoothLEScanCallback {
    +        void onsuccess(BluetoothLEDevice device);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Methods

    +
    +
    +onsuccess +
    +
    +
    + Called when a new device is successfully discovered in the process of scanning. +
    +
    void onsuccess(BluetoothLEDevice device);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +device: + Device that is found +
    • +
    +
    +
    +
    +
    +
    +
    +

    2.13. BluetoothLEAdvertiseCallback

    +
    + Bluetooth advertising process interface that defines the success callback for BluetoothLEAdapter.startAdvertise()
    +
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothLEAdvertiseCallback {
    +        void onstate(BluetoothAdvertisingState state);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Methods

    +
    +
    +onstate +
    +
    +
    + Called when the advertising state is changed. +
    +
    void onstate(BluetoothAdvertisingState state);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +state: + State that is Advertising process +
    • +
    +
    +
    +
    +
    +
    +
    +

    2.14. BluetoothLEConnectChangeCallback

    +
    + Bluetooth LE connecting process interface that defines callbacks for getting notified about changes of connect to a specific LE based service on a remote Bluetooth LE device. +
    +
        [Callback, NoInterfaceObject] interface BluetoothLEConnectChangeCallback {
    +        void onconnected(BluetoothLEDevice device);
    +        void ondisconnected(BluetoothLEDevice device);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Methods

    +
    +
    +onconnected +
    +
    +
    + Called at the beginning of connect to a specific LE based service on a remote Bluetooth LE device. +
    +
    void onconnected(BluetoothLEDevice device);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • device
    • +
    +
    +
    +
    +ondisconnected +
    +
    +
    + Called at the beginning of disconnect to a specific LE based service on a remote Bluetooth LE device. +
    +
    void ondisconnected(BluetoothLEDevice device);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • device
    • +
    +
    +
    +
    +
    +
    +
    +

    2.15. ReadValueSuccessCallback

    +
    + The ReadValueSuccessCallback interface implements the callback for +BluetoothGATTCharacteristic.readValue() and +BluetoothGATTDescriptor.readValue() methods. +
    +
        [Callback=FunctionOnly, NoInterfaceObject] interface ReadValueSuccessCallback {
    +        void onread(byte[] value);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    Methods

    +
    +
    +onread +
    +
    +
    + Called when a characteristic value has been read. +
    +
    void onread(byte[] value);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +value: + Read characteristic value +
    • +
    +
    +
    +
    +
    +
    +
    +

    2.16. BluetoothDevice

    +
    + The BluetoothDevice interface represents a remote Bluetooth device. +
    +
        [NoInterfaceObject] interface BluetoothDevice {
    +        readonly attribute DOMString name;
    +        readonly attribute BluetoothAddress address;
    +        readonly attribute BluetoothClass deviceClass;
    +        readonly attribute boolean isBonded;
    +        readonly attribute boolean isTrusted;
    +        readonly attribute boolean isConnected;
    +        readonly attribute BluetoothUUID[] uuids;
    +
    +        void connectToServiceByUUID(BluetoothUUID uuid,
    +                                    BluetoothSocketSuccessCallback successCallback,
    +                                    optional ErrorCallback? errorCallback) raises(WebAPIException);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    +A BluetoothDevice object can be retrieved using one of the following APIs: +

    +
      +
    • + BluetoothAdapter.getDevice()
    • +
    • + BluetoothAdapter.getKnownDevices()
    • +
    • + BluetoothAdapter.discoverDevices()
    • +
    • + BluetoothAdapter.createBonding()
    • +
    +
    +
    +

    Attributes

    +
      +
    • + readonly +DOMString name
      + The readable name of this remote device. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    console.log("Device Name: " + device.name);
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothAddress address
      + The hardware address of this remote device. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    console.log("Device Address: " + device.address);
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothClass deviceClass
      + The device class, which represents the type of the device and the services it provides. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    console.log("Device Major Class: " + device.deviceClass.major);
      + });
      + 
      +
      +
    • +
    • + readonly +boolean isBonded
      + The bond state of this remote device with the local device. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    console.log("Is bonded: " + (device.isBonded ? "Yes" : "No"));
      + });
      + 
      +
      +
    • +
    • + readonly +boolean isTrusted
      + The flag indicating whether the local device recognizes this remote device as a trusted device or not. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    console.log("Is trusted: " + (device.isTrusted ? "Yes" : "No"));
      + });
      + 
      +
      +
    • +
    • + readonly +boolean isConnected
      + The flag indicating whether the connection state of this remote device with the local device. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    console.log("Is connected: " + (device.isConnected ? "Yes" : "No"));
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothUUID[] + uuids
      + The list of 128 bit service UUIDs available on this remote device. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getDefaultAdapter();
      + var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
      + adapter.getDevice("11:22:33:44:55:66", function(device) {
      +    var uuids = device.uuids;
      +    var services = "";
      +    for (var i = 0; i < uuids.length; i++) {
      +        services += uuids[i] + "
      "; + } + console.log ("Services found: " + services); + if (uuids.indexOf(CHAT_SERVICE_UUID) != -1) { + // Connects to service + device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket) { + // + // Connected to service, handle socket + // + }, function (e) { + console.log("Could not connect to chat service !!!. Error: " + e.message); + }); + } + }); +
      +
      +
    • +
    +
    +
    +

    Methods

    +
    +
    +connectToServiceByUUID +
    +
    +
    + Connects to a specified service identified by uuid on this remote device. +
    +
    void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    +If opening a connection is successful, then a BluetoothSocket object with open state is sent using successCallback, through which data can be exchanged by both devices. +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • + NotFoundError - If there is no service with the specified uuid
    • +
    • + InvalidValuesError - If any of the input parameters contain an invalid value
    • +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth.spp +

    +
    +

    Parameters:

    +
      +
    • +uuid: + 128 bit unique identifier, which specifies the service on the remote device +
    • +
    • +successCallback: + Callback function that is called when an asynchronous call completes successfully +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when opening of a socket fails +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    + var clientSocket = null;
    +
    + // Calls a method that is invoked when user wants to send a message to a remote device.
    + function sendMessage(msg) {
    +    // Validates socket state, if everything is ok.
    +    if (clientSocket != null && clientSocket.state == "OPEN") {
    +        // Sends the message.
    +        clientSocket.writeData(msg);
    +    }
    + }
    +
    + // Calls a method that is invoked when a socket is open.
    + function onSocketConnected(socket) {
    +    clientSocket = socket;
    +    console.log("Opening a socket successfully!!!");
    +    socket.onmessage = function () {
    +        var data = socket.readData();
    +        var recvmsg = "";
    +        for (var i = 0; i < data.length; i++)
    +        {
    +           recvmsg += String.fromCharCode(data[i]);
    +        }
    +        console.log("server msg >> " + recvmsg);
    +    };
    +
    +    socket.onclose = function() {
    +        console.log("socket disconnected.");
    +    };
    + }
    +
    + function onDeviceReady(device) {
    +    // Validates device and service uuid
    +    if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
    +       // Opens socket
    +       device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e) {
    +           console.log ("Error connecting to service. Reason: " + e.message);
    +        });
    +    }
    +    else {
    +        console.log ("Chat service is not supported by this device");
    +    }
    + }
    +
    + function onSetPowered() {
    +    // Gets the BluetoothDevice object.
    +    adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
    + }
    +
    + adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
    + 
    +
    +
    +
    +
    +
    +
    +

    2.17. BluetoothLEDevice

    +
    + The BluetoothLEDevice interface represents a remote Bluetooth LE device. +
    +
        [NoInterfaceObject] interface BluetoothLEDevice {
    +        readonly attribute BluetoothAddress address;
    +        readonly attribute DOMString? name;
    +        readonly attribute unsigned long? txpowerlevel;
    +        readonly attribute unsigned long? appearance;
    +        readonly attribute BluetoothUUID[]? uuids;
    +        readonly attribute BluetoothLESolicitationUUID[]? solicitationuuids;
    +        readonly attribute BluetoothLEServiceData[]? serviceData;
    +        readonly attribute BluetoothLEManufacturerData? manufacturerData;
    +
    +        void connect(optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void disconnect(optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
    +        BluetoothGATTService getService(BluetoothUUID uuid) raises(WebAPIException);
    +
    +        long addConnectStateChangeListener(BluetoothLEConnectChangeCallback listener) raises(WebAPIException);
    +
    +        void removeConnectStateChangeListener(long watchID);
    +    };
    +

    + Since: + 2.3.1 +

    +
    +

    +A BluetoothLEDevice object can be retrieved by using one of the following APIs: +

    +
      +
    • + BluetoothLEAdapter.startScan()
    • +
    +
    +
    +

    Attributes

    +
      +
    • + readonly +BluetoothAddress address
      + The address of the Bluetooth LE device from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         console.log("Found device: " + device.address);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +DOMString name [nullable]
      + The name of the Bluetooth LE device from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         console.log("Found device: " + device.name);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +unsigned long txpowerlevel [nullable]
      + The transmission power level of the Bluetooth LE device from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         console.log("Found device: " + device.txpowerlevel);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +unsigned long appearance [nullable]
      + The appearance of the Bluetooth LE device from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         console.log("Found device: " + device.appearance);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothUUID[] + uuids [nullable]
      + The list of 128 bit service UUIDs available on this remote device. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         var uuids = device.uuids;
      +         var services = "";
      +         for (var i = 0; i < uuids.length; i++) {
      +             services += uuids[i] + "\n";
      +         }
      +         console.log ("Service found: " + services);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothLESolicitationUUID[] + solicitationuuids [nullable]
      + The list of service solicitation UUIDs available on Bluetooth LE device from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         var uuids = device.solicitationuuids;
      +         var services = "";
      +         for (var i = 0; i < uuids.length; i++) {
      +             services += uuids[i] + "\n";
      +         }
      +         console.log ("Service solicitations found: " + services);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothLEServiceData[] + serviceData [nullable]
      + The list of service data available on Bluetooth LE device from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         var serviceData = device.serviceData;
      +         var data = "";
      +         for (var i = 0; i < serviceData.length; i++) {
      +             data += serviceData[i].id + serviceData[i].data + "\n";
      +         }
      +         console.log ("Service data found: " + data);
      +     }
      + });
      + 
      +
      +
    • +
    • + readonly +BluetoothLEManufacturerData manufacturerData [nullable]
      + The manufacturer data from the scan result information. +
      +

      + Since: + 2.3.1 +

      +
      +

      Code example:

       var adapter = tizen.bluetooth.getLEAdapter();
      + adapter.startScan({
      +     onsuccess: function(device) {
      +         var manufacturerData = device.manufacturerData;
      +         console.log ("Manufacture id: " + manufacturerData.id);
      +         console.log ("Manufacture data: " + manufacturerData.data);
      +     }
      + });
      + 
      +
      +
    • +
    +
    +
    +

    Methods

    +
    +
    +connect +
    +
    +
    + Establishes Low Energy connection to the device. +
    +
    void connect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    +Connection is required to readValue() and writeValue() from the remote device. +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • + UnknownError - If any other error occurs
    • +
    +
    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
      +
    • +successCallback [optional] [nullable]: + Callback function that is called when the connection is established successfully +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called in case of failure +
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter. +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - var CHAT_SERVICE_UUID = "5BCE9431-6C75-32AB-AFE0-2EC108A30860";
    - adapter.getDevice("11:22:33:44:55:66", function(device) {
    -    var uuids = device.uuids;
    -    var services = "";
    -    for (var i = 0; i < uuids.length; i++) {
    -        services += uuids[i] + "\n";
    -    }
    -    console.log ("Services found: " + services);
    -    if (uuids.indexOf(CHAT_SERVICE_UUID) != -1) {
    -        // Connects to service
    -        device.connectToServiceByUUID(CHAT_SERVICE_UUID, function(socket) {
    -            //
    -            // Connected to service, handle socket
    -            //
    -        }, function (e) {
    -            console.log("Could not connect to chat service !!!. Error: " + e.message);
    -        });
    -    }
    +

    Code example:

     function onerror(e) {
    +      console.log("Failed to connect to device: " + e.message);
    + }
    +
    + function onconnected() {
    +     console.log("Connected to device");
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: function(device) {
    +         if (device.address == "11:22:33:44:55:66") {
    +             console.log("Found device: " + device.name);
    +             device.connect(onconnected, onerror);
    +         }
    +     }
      });
      
    - - -
    -
    -

    Methods

    -
    -
    -connectToServiceByUUID + +
    +disconnect
    - Connects to a specified service identified by uuid on this remote device. + Disconnects from the device.
    -
    void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +
    void disconnect(optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback);
                  

    Since: @@ -1945,17 +3968,10 @@ A BluetoothDevice object can be retrieved using one of the following AP

    -If opening a connection is successful, then a BluetoothSocket object with open state is sent using successCallback, through which data can be exchanged by both devices. -

    -

    The ErrorCallback is launched with these error types:

    • - NotFoundError - If there is no service with the specified uuid
    • -
    • - InvalidValuesError - If any of the input parameters contain an invalid value
    • -
    • UnknownError - If any other error occurs
    @@ -1965,22 +3981,91 @@ The ErrorCallback is launched with these error types:

    Privilege: - http://tizen.org/privilege/bluetooth.spp + http://tizen.org/privilege/bluetooth

    Parameters:

    • -uuid: - 128 bit unique identifier, which specifies the service on the remote device +successCallback [optional] [nullable]: + Callback function that is called when the connection is finished successfully
    • -successCallback: - Callback function that is called when an asynchronous call completes successfully +errorCallback [optional] [nullable]: + Callback function that is called in case of failure
    • +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter. +

      • +
      • + with error type InvalidStateError, if device is currently not connected +

      • +
      • + with error type SecurityError, if the application does not have the privilege to call this method. +

      • +
      +
    +
    +
    +

    Code example:

     function onerror(e) {
    +     console.log("Error occured: " + e.message);
    + }
    +
    + function onDeviceFound(device) {
    +    function ondisconnect() {
    +        console.log("Disconnected");
    +    }
    +
    +    function onconnected() {
    +        console.log("Connected to device");
    +        device.disconnect(ondisconnect, onerror);
    +    }
    +
    +    if (device.address == "11:22:33:44:55:66") {
    +        console.log("Found device: " + device.name);
    +        device.connect(onconnected, onerror);
    +    }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: onDeviceFound
    + }, onerror);
    + 
    +
    +
    +
    +getService +
    +
    +
    + Retrieves a service from the device for the given UUID. +
    +
    BluetoothGATTService getService(BluetoothUUID uuid);
    +             
    +

    + Since: + 2.3.1 +

    +

    + Privilege level: + public +

    +

    + Privilege: + http://tizen.org/privilege/bluetooth +

    +
    +

    Parameters:

    +
    • -errorCallback [optional] [nullable]: - Callback function that is called when opening of a socket fails +uuid: + UUID of the service
    @@ -1988,65 +4073,157 @@ The ErrorCallback is launched with these error types:

    Exceptions:

    • WebAPIException
      • - with error type TypeMismatchError, if the input parameter is not compatible with the expected type for that parameter + with error type NotFoundError, if there is no service with the given UUID.

      • with error type SecurityError, if the application does not have the privilege to call this method.

      • +
      • + with error type InvalidStateError, if the GATT service is not available. +

      • +
      • + with error type UnknownError, if any other error occurs. +

    -

    Code example:

     var adapter = tizen.bluetooth.getDefaultAdapter();
    - var clientSocket = null;
    +

    Code example:

     function onconnected(device) {
    +        console.log("Connected to device");
    +        var service = device.getService(device.uuids[0]);
    +        console.log("Service got");
    + }
     
    - // Calls a method that is invoked when user wants to send a message to a remote device.
    - function sendMessage(msg) {
    -    // Validates socket state, if everything is ok.
    -    if (clientSocket != null && clientSocket.state == "OPEN") {
    -        // Sends the message.
    -        clientSocket.writeData(msg);
    -    }
    + function onerror(e) {
    +     console.log("Error occured: " + e.message);
      }
     
    - // Calls a method that is invoked when a socket is open.
    - function onSocketConnected(socket) {
    -    clientSocket = socket;
    -    console.log("Opening a socket successfully!!!");
    -    socket.onmessage = function () {
    -        var data = socket.readData();
    -        var recvmsg = "";
    -        for (var i = 0; i < data.length; i++)
    -        {
    -           recvmsg += String.fromCharCode(data[i]);
    -        }
    -        console.log("server msg >> " + recvmsg);
    -    };
    + function onDeviceFound(device) {
    +    if (device.address == "11:22:33:44:55:66") {
    +        console.log("Found device: " + device.name);
    +        device.connect(onconnected.bind(null, device), onerror);
    +    }
    + }
     
    -    socket.onclose = function() {
    -        console.log("socket disconnected.");
    -    };
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: onDeviceFound
    + }, onerror);
    + 
    +
    + +
    +addConnectStateChangeListener +
    +
    +
    + Registers a listener to be called when the device connects or disconnects. +
    +
    long addConnectStateChangeListener(BluetoothLEConnectChangeCallback listener);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +listener: + Listener functions that are called when the connection state changes +
    • +
    +
    +
    +

    Return value:

    + long The watchID to be used to unregister the listener +
    +
    +

    Exceptions:

    +
    • WebAPIException
      • + with error type UnknownError, if any other error occurs. +

      +
    +
    +
    +

    Code example:

     function onerror(e) {
    +     console.log("Error occured: " + e.message);
      }
     
    - function onDeviceReady(device) {
    -    // Validates device and service uuid
    -    if (device.uuids.indexOf("5BCE9431-6C75-32AB-AFE0-2EC108A30860") != -1) {
    -       // Opens socket
    -       device.connectToServiceByUUID("5BCE9431-6C75-32AB-AFE0-2EC108A30860", onSocketConnected, function(e) {
    -           console.log ("Error connecting to service. Reason: " + e.message);
    -        });
    + function onDeviceFound(device) {
    +    var onConnectionStateChange = {
    +        onconnected: function(device) {
    +            console.log("Device " + device.name + " connected");
    +        },
    +        ondisconnected: function(device) {
    +            console.log("Device " + device.name + " disconnected");
    +        }
         }
    -    else {
    -        console.log ("Chat service is not supported by this device");
    +
    +    if (device.address === "11:22:33:44:55:66") {
    +        console.log("Found device: " + device.name);
    +        device.addConnectStateChangeListener(onConnectionStateChange);
    +        device.connect();
         }
      }
     
    - function onSetPowered() {
    -    // Gets the BluetoothDevice object.
    -    adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) { console.log("Error: " + e.message); });
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan({
    +     onsuccess: onDeviceFound
    + }, onerror);
    + 
    +
    +
    +
    +removeConnectStateChangeListener +
    +
    +
    + Unregisters a Bluetooth device connection listener +
    +
    void removeConnectStateChangeListener(long watchID);
    +             
    +

    + Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +watchID: + The watchID identifier returned by the addConnectStateChangeListener() method. +
    • +
    +
    +
    +

    Code example:

     function onerror(e) {
    +     console.log("Error occured: " + e.message);
      }
     
    - adapter.setPowered(true, onSetPowered, function(e) {console.log ("Could not turn on Bluetooth adapter. reason: " + e.message); });
    + function onDeviceFound(device) {
    +    var onConnectionStateChange = {
    +        onconnected: function(device) {
    +            console.log("Device " + device.name + " connected");
    +        },
    +        ondisconnected: function(device) {
    +            console.log("Device " + device.name + " disconnected");
    +            device.removeConnectStateChangeListener(listenerID);
    +        }
    +    }
    +
    +    if (device.address === "11:22:33:44:55:66") {
    +        console.log("Found device: " + device.name);
    +        listenerID = device.addConnectStateChangeListener(onConnectionStateChange);
    +        device.connect();
    +    }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + var listenerID = null;
    + adapter.startScan({
    +     onsuccess: onDeviceFound
    + }, onerror);
      
    @@ -2054,7 +4231,7 @@ The ErrorCallback is launched with these error types:
    -

    2.5. BluetoothSocket

    +

    2.18. BluetoothSocket

    The BluetoothSocket interface represents the Bluetooth socket.
    @@ -2178,7 +4355,7 @@ By default, this attribute is set to null.

    Parameters:

    • -data: +data: The data to send
    @@ -2370,7 +4547,7 @@ This method should be called only in the BluetoothSocket.onmessage hand
    -

    2.6. BluetoothClass

    +

    2.19. BluetoothClass

    The BluetoothClass interface represents Bluetooth Class of Device/Service(CoD).
    @@ -2503,7 +4680,7 @@ values.

    Parameters:

    • -service: +service: Service to check
    @@ -2539,7 +4716,7 @@ values.
    -

    2.7. BluetoothClassDeviceMajor

    +

    2.20. BluetoothClassDeviceMajor

    The BluetoothClassDeviceMajor interface holds the identifiers for major device classes of Bluetooth CoD.
    @@ -2563,7 +4740,7 @@ values.

    -

    2.8. BluetoothClassDeviceMinor

    +

    2.21. BluetoothClassDeviceMinor

    The BluetoothClassDeviceMinor interface holds the identifiers for minor device classes of Bluetooth CoD.
    @@ -2654,7 +4831,7 @@ values.

    -

    2.9. BluetoothClassDeviceService

    +

    2.22. BluetoothClassDeviceService

    The BluetoothClassDeviceService interface holds identifiers for the major service classes of Bluetooth CoD.
    @@ -2675,7 +4852,7 @@ values.

    -

    2.10. BluetoothServiceHandler

    +

    2.23. BluetoothServiceHandler

    The BluetoothServiceHandler interface provides methods to handle Bluetooth service.
    @@ -2780,11 +4957,11 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -successCallback [optional] [nullable]: +successCallback [optional] [nullable]: Callback function that is called when the record is removed successfully from the service records database
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called in case of failure (to unregister)
    @@ -2851,7 +5028,7 @@ The ErrorCallback is launched with these error types:
    -

    2.11. BluetoothProfileHandler

    +

    2.24. BluetoothProfileHandler

    The BluetoothProfileHandler interface represents the Bluetooth profile handler.
    @@ -2878,7 +5055,7 @@ The ErrorCallback is launched with these error types:
    -

    2.12. BluetoothHealthProfileHandler

    +

    2.25. BluetoothHealthProfileHandler

    This interface represents the handler of Bluetooth health device profile. The BluetoothHealthProfileHandler object is created by BluetoothAdapter.getBluetoothProfileHandler(). @@ -2894,7 +5071,7 @@ The BluetoothHealthProfileHandler object is created by BluetoothAdapter.getB Since: 2.3.1

    - +

    Methods

    @@ -2934,20 +5111,20 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -dataType: +dataType: MDEP data type used for communication, which is referenced in the ISO/IEEE 11073-20601 spec For example, pulse oximeter is 4100 and blood pressure monitor is 4103.
    • -name: +name: Friendly name associated with sink application
    • -successCallback: +successCallback: Callback function that is called when a sink application is registered successfully
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called when an error occurs
    @@ -3018,19 +5195,19 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -peer: +peer: Remote device which acts as the Source role
    • -application: +application: Registered application for the Sink role
    • -successCallback: +successCallback: Callback function that is called when a connection is established successfully
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called when an error occurs
    @@ -3082,7 +5259,7 @@ The ErrorCallback is launched with these error types:
    -

    2.13. BluetoothHealthApplication

    +

    2.26. BluetoothHealthApplication

    The BluetoothHealthApplication interface represents the Bluetooth health application.
    @@ -3191,11 +5368,11 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -successCallback [optional] [nullable]: +successCallback [optional] [nullable]: Callback function that is called when a sink application is registered successfully
    • -errorCallback [optional] [nullable]: +errorCallback [optional] [nullable]: Callback function that is called when an error occurs
    @@ -3259,7 +5436,7 @@ The ErrorCallback is launched with these error types:
    -

    2.14. BluetoothHealthChannel

    +

    2.27. BluetoothHealthChannel

    The BluetoothHealthChannel interface represents the Bluetooth health channel.
    @@ -3416,7 +5593,7 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -data: +data: Data to send
    @@ -3488,7 +5665,7 @@ The ErrorCallback is launched with these error types:

    Parameters:

    • -listener: +listener: Event listener of Bluetooth health channel
    @@ -3607,7 +5784,7 @@ This stops receiving notifications.
    -

    2.15. BluetoothAdapterChangeCallback

    +

    2.28. BluetoothAdapterChangeCallback

    The BluetoothAdapterChangeCallback interface specifies a set of methods to be invoked when the changes of Bluetooth adapter occur.
    @@ -3640,7 +5817,7 @@ This stops receiving notifications.

    Parameters:

    • -powered: +powered: Flag indicating power state of local Bluetooth: true means power-on, false means power-off
    @@ -3663,7 +5840,7 @@ This stops receiving notifications.

    Parameters:

    • -name: +name: Name of local Bluetooth
    @@ -3686,7 +5863,7 @@ This stops receiving notifications.

    Parameters:

    • -visible: +visible: Flag indicating visibility of local Bluetooth: true means that local Bluetooth is discoverable, false means that local Bluetooth is hidden from other devices
    @@ -3696,9 +5873,9 @@ This stops receiving notifications.
    -

    2.16. BluetoothDeviceSuccessCallback

    +

    2.29. BluetoothDeviceSuccessCallback

    - The BluetoothDeviceSuccessCallback interface implements the success callback BluetoothAdapter.getDevice() and BluetoothAdapter.createBonding(). + The BluetoothDeviceSuccessCallback interface implements the success callback BluetoothAdapter.getDevice() and BluetoothAdapter.createBonding().
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceSuccessCallback {
             void onsuccess(BluetoothDevice device);
    @@ -3727,7 +5904,7 @@ This stops receiving notifications.
     

    Parameters:

    • -device: +device: BluetoothDevice object
    @@ -3737,9 +5914,9 @@ This stops receiving notifications.
    -

    2.17. BluetoothDeviceArraySuccessCallback

    +

    2.30. BluetoothDeviceArraySuccessCallback

    - The BluetoothDeviceArraySuccessCallback interface that defines the success callback for BluetoothAdapter.getKnownDevices(). + The BluetoothDeviceArraySuccessCallback interface that defines the success callback for BluetoothAdapter.getKnownDevices().
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceArraySuccessCallback {
             void onsuccess(BluetoothDevice[] devices);
    @@ -3768,7 +5945,7 @@ This stops receiving notifications.
     

    Parameters:

    • -devices: +devices: List of devices known to local Bluetooth adapter Each element is a BluetoothDevice.
    • @@ -3779,9 +5956,9 @@ Each element is a BluetoothDevice.
    -

    2.18. BluetoothDiscoverDevicesSuccessCallback

    +

    2.31. BluetoothDiscoverDevicesSuccessCallback

    - The BluetoothDiscoverDevicesSuccessCallback interface that defines the success callback for BluetoothAdapter.discoverDevices(). + The BluetoothDiscoverDevicesSuccessCallback interface that defines the success callback for BluetoothAdapter.discoverDevices().
        [Callback, NoInterfaceObject] interface BluetoothDiscoverDevicesSuccessCallback {
             void onstarted();
    @@ -3827,7 +6004,7 @@ Each element is a BluetoothDevice.
     

    Parameters:

    • -device: +device: Device that is found
    @@ -3851,7 +6028,7 @@ After that, this device is no longer visible.

    Parameters:

    • -address: +address: Address of the device that is no longer in range or visible
    @@ -3874,7 +6051,7 @@ After that, this device is no longer visible.

    Parameters:

    • -foundDevices: +foundDevices: Array of devices found in this discovery session
    @@ -3884,9 +6061,9 @@ After that, this device is no longer visible.
    -

    2.19. BluetoothSocketSuccessCallback

    +

    2.32. BluetoothSocketSuccessCallback

    - The BluetoothSocketSuccessCallback interface that defines the success method for BluetoothDevice.connectToServiceByUUID(). + The BluetoothSocketSuccessCallback interface that defines the success method for BluetoothDevice.connectToServiceByUUID().
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothSocketSuccessCallback {
             void onsuccess(BluetoothSocket socket);
    @@ -3915,7 +6092,7 @@ After that, this device is no longer visible.
     

    Parameters:

    • -socket: +socket: Socket to connect to the specified service on a remote device
    @@ -3925,9 +6102,9 @@ After that, this device is no longer visible.
    -

    2.20. BluetoothServiceSuccessCallback

    +

    2.33. BluetoothServiceSuccessCallback

    - The BluetoothServiceSuccessCallback interface implements the success callback for BluetoothAdapter.registerRFCOMMServiceByUUID(). + The BluetoothServiceSuccessCallback interface implements the success callback for BluetoothAdapter.registerRFCOMMServiceByUUID().
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothServiceSuccessCallback {
             void onsuccess(BluetoothServiceHandler handler);
    @@ -3956,7 +6133,7 @@ After that, this device is no longer visible.
     

    Parameters:

    • -handler: +handler: Bluetooth service handler
    @@ -3966,9 +6143,9 @@ After that, this device is no longer visible.
    -

    2.21. BluetoothHealthApplicationSuccessCallback

    +

    2.34. BluetoothHealthApplicationSuccessCallback

    - The BluetoothHealthApplicationSuccessCallback interface that defines the success method for BluetoothHealthProfileHandler.registerSinkApplication(). + The BluetoothHealthApplicationSuccessCallback interface that defines the success method for BluetoothHealthProfileHandler.registerSinkApplication().
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothHealthApplicationSuccessCallback {
             void onsuccess(BluetoothHealthApplication application);
    @@ -3997,7 +6174,7 @@ After that, this device is no longer visible.
     

    Parameters:

    • -application: +application: Registered health application
    @@ -4007,9 +6184,9 @@ After that, this device is no longer visible.
    -

    2.22. BluetoothHealthChannelSuccessCallback

    +

    2.35. BluetoothHealthChannelSuccessCallback

    - The BluetoothHealthChannelSuccessCallback interface that defines the success method for BluetoothHealthProfileHandler.connectToSource() and the event callback for BluetoothHealthApplication.onconnect. + The BluetoothHealthChannelSuccessCallback interface that defines the success method for BluetoothHealthProfileHandler.connectToSource() and the event callback for BluetoothHealthApplication.onconnect().
        [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothHealthChannelSuccessCallback {
             void onsuccess(BluetoothHealthChannel channel);
    @@ -4038,7 +6215,7 @@ After that, this device is no longer visible.
     

    Parameters:

    • -channel: +channel: Connected health channel
    @@ -4048,7 +6225,7 @@ After that, this device is no longer visible.
    -

    2.23. BluetoothHealthChannelChangeCallback

    +

    2.36. BluetoothHealthChannelChangeCallback

    The BluetoothHealthChannelChangeCallback interface specifies a set of methods to be invoked when the changes of heath channel occur.
    @@ -4081,7 +6258,7 @@ After that, this device is no longer visible.

    Parameters:

    • -data: +data: Received data
    @@ -4124,8 +6301,16 @@ To guarantee that the Bluetooth healthcare application runs on a device with Blu

  • http://tizen.org/feature/network.bluetooth.health
  • +
    +

    +

    +To guarantee that the Bluetooth Low Energy application runs on a device with Bluetooth Low Energy feature, declare the following feature requirements in the config file: +

    +

    +
  • http://tizen.org/feature/network.bluetooth.le
  • +

    - For more information, see Application Filtering. + For more information, see Application Filtering.

    4. Full WebIDL

    module Bluetooth {
    @@ -4139,18 +6324,58 @@ To guarantee that the Bluetooth healthcare application runs on a device with Blu
     
         enum BluetoothHealthChannelType { "RELIABLE", "STREAMING" };
     
    +    typedef DOMString BluetoothLESolicitationUUID;
    +
    +    enum BluetoothAdvertisePacketType { "ADVERTISE", "SCAN_RESPONSE" };
    +
    +    enum BluetoothAdvertisingState { "STARTED", "STOPPED" };
    +
    +    enum BluetoothAdvertisingMode { "BALANCED", "LOW_LATENCY", "LOW_ENERGY" };
    +
         [NoInterfaceObject] interface BluetoothManagerObject {
             readonly attribute BluetoothManager bluetooth;
         };
         Tizen implements BluetoothManagerObject;
     
    +    interface BluetoothLEServiceData {
    +        attribute BluetoothUUID uuid;
    +        attribute DOMString data;
    +     };
    +
    +    interface BluetoothLEManufacturerData {
    +        attribute DOMString id;
    +        attribute DOMString data;
    +    };
    +
    +    dictionary BluetoothLEAdvertiseDataInit {
    +        boolean? includeName;
    +        BluetoothUUID[]? uuids;
    +        BluetoothLESolicitationUUID[]? solicitationuuids;
    +        unsigned long? appearance;
    +        boolean? includeTxPowerLevel;
    +        BluetoothLEServiceData[]? serviceData;
    +        BluetoothLEManufacturerData? manufacturerData;
    +    };
    +
    +    [Constructor(optional BluetoothLEAdvertiseDataInit? init)]
    +    interface BluetoothLEAdvertiseData {
    +         attribute boolean? includeName;
    +         attribute BluetoothUUID[]? uuids;
    +         attribute BluetoothLESolicitationUUID[]? solicitationuuids;
    +         attribute unsigned long? appearance;
    +         attribute boolean? includeTxPowerLevel;
    +         attribute BluetoothLEServiceData[]? serviceData;
    +         attribute BluetoothLEManufacturerData? manufacturerData;
    +    };
    +
         [NoInterfaceObject] interface BluetoothManager {
             readonly attribute BluetoothClassDeviceMajor deviceMajor;
             readonly attribute BluetoothClassDeviceMinor deviceMinor;
             readonly attribute BluetoothClassDeviceService deviceService;
             BluetoothAdapter getDefaultAdapter() raises(WebAPIException);
    -    };
     
    +        BluetoothLEAdapter getLEAdapter() raises(WebAPIException);
    +    };
     
         [NoInterfaceObject] interface BluetoothAdapter {
             readonly attribute DOMString name;
    @@ -4206,6 +6431,63 @@ To guarantee that the Bluetooth healthcare application runs on a device with Blu
             BluetoothProfileHandler getBluetoothProfileHandler(BluetoothProfileType profileType) raises(WebAPIException);
         };
     
    +    [NoInterfaceObject] interface BluetoothLEAdapter {
    +        void startScan(BluetoothLEScanCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void stopScan() raises(WebAPIException);
    +        void startAdvertise(BluetoothLEAdvertiseData advertiseData, BluetoothAdvertisePacketType packetType, BluetoothLEAdvertiseCallback successCallback, optional ErrorCallback? errorCallback, optional BluetoothAdvertisingMode? mode, optional boolean? connectable) raises(WebAPIException);
    +        void stopAdvertise() raises(WebAPIException);
    +    };
    +
    +    [NoInterfaceObject] interface BluetoothGATTService {
    +        readonly attribute BluetoothUUID uuid;
    +        readonly attribute BluetoothGATTService[] services;
    +        readonly attribute BluetoothGATTCharacteristic[] characteristics;
    +    };
    +
    +    [NoInterfaceObject] interface BluetoothGATTCharacteristic {
    +        readonly attribute BluetoothGATTDescriptor[] descriptors;
    +        readonly attribute boolean isBroadcast;
    +        readonly attribute boolean hasExtendedProperties;
    +        readonly attribute boolean isNotify;
    +        readonly attribute boolean isIndication;
    +        readonly attribute boolean isReadable;
    +        readonly attribute boolean isSignedWrite;
    +        readonly attribute boolean isWritable;
    +        readonly attribute boolean isWriteNoResponse;
    +        void readValue(ReadValueSuccessCallback successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void writeValue(byte[] value, optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
    +        long addValueChangeListener(ReadValueSuccessCallback callback) raises(WebAPIException);
    +
    +        void removeValueChangeListener(long watchID);
    +    };
    +
    +    [NoInterfaceObject] interface BluetoothGATTDescriptor {
    +        void readValue(ReadValueSuccessCallback successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void writeValue(byte[] value, optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +    };
    +
    +    [Callback, NoInterfaceObject] interface BluetoothLEScanCallback {
    +        void onsuccess(BluetoothLEDevice device);
    +    };
    +
    +    [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothLEAdvertiseCallback {
    +        void onstate(BluetoothAdvertisingState state);
    +    };
    +
    +    [Callback, NoInterfaceObject] interface BluetoothLEConnectChangeCallback {
    +        void onconnected(BluetoothLEDevice device);
    +        void ondisconnected(BluetoothLEDevice device);
    +    };
    +
    +    [Callback=FunctionOnly, NoInterfaceObject] interface ReadValueSuccessCallback {
    +        void onread(byte[] value);
    +    };
    +
         [NoInterfaceObject] interface BluetoothDevice {
             readonly attribute DOMString name;
             readonly attribute BluetoothAddress address;
    @@ -4219,6 +6501,29 @@ To guarantee that the Bluetooth healthcare application runs on a device with Blu
                                         BluetoothSocketSuccessCallback successCallback,
                                         optional ErrorCallback? errorCallback) raises(WebAPIException);
         };
    +
    +    [NoInterfaceObject] interface BluetoothLEDevice {
    +        readonly attribute BluetoothAddress address;
    +        readonly attribute DOMString? name;
    +        readonly attribute unsigned long? txpowerlevel;
    +        readonly attribute unsigned long? appearance;
    +        readonly attribute BluetoothUUID[]? uuids;
    +        readonly attribute BluetoothLESolicitationUUID[]? solicitationuuids;
    +        readonly attribute BluetoothLEServiceData[]? serviceData;
    +        readonly attribute BluetoothLEManufacturerData? manufacturerData;
    +
    +        void connect(optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +        void disconnect(optional SuccessCallback? successCallback,
    +                     optional ErrorCallback? errorCallback) raises(WebAPIException);
    +
    +        BluetoothGATTService getService(BluetoothUUID uuid) raises(WebAPIException);
    +
    +        long addConnectStateChangeListener(BluetoothLEConnectChangeCallback listener) raises(WebAPIException);
    +
    +        void removeConnectStateChangeListener(long watchID);
    +    };
    +
         [NoInterfaceObject] interface BluetoothSocket {
             readonly attribute BluetoothUUID uuid;
             readonly attribute BluetoothSocketState state;
    -- 
    2.7.4