From: Piotr Czaja Date: Fri, 29 Jan 2016 11:19:42 +0000 (+0100) Subject: [Bluetooth] - improving examples X-Git-Tag: tizen_3.0/TD_SYNC/20161201~177^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94af3798bbd8f1581c381b2ec1c513176ff3573f;p=sdk%2Fonline-doc.git [Bluetooth] - improving examples Change-Id: I6d08a2a1186d71c914250065490e4b20d65c9edd Signed-off-by: Piotr Czaja --- 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 5f94932..4667b48 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 @@ -503,7 +503,12 @@ The tizen.bluetooth object allows access to the Bluetooth API.

Constructors

-
BluetoothLEServiceData(DOMString uuid, DOMString data);
+
+
BluetoothLEServiceData(DOMString uuid, DOMString data);
+
+

Code example:

 // Creates a serviceData.
+ var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+ 

Attributes

@@ -516,6 +521,12 @@ The tizen.bluetooth object allows access to the Bluetooth API. Since: 2.3.1

+
+

Code example:

 // Creates a serviceData.
+ var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
+ service.uuid = "f236-41a4";
+ 
+
  • DOMString data
    @@ -525,6 +536,12 @@ The tizen.bluetooth object allows access to the Bluetooth API. Since: 2.3.1

    +
    +

    Code example:

     // Creates a serviceData.
    + var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    + service.data = "0x1815";
    + 
    +
  • @@ -565,6 +582,12 @@ The tizen.bluetooth object allows access to the Bluetooth API. Since: 2.3.1

    +
    +

    Code example:

     // Creates a manufacturerData.
    + var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    + manufacturer.id = "129";
    + 
    +
  • DOMString data
    @@ -574,6 +597,12 @@ The tizen.bluetooth object allows access to the Bluetooth API. Since: 2.3.1

    +
    +

    Code example:

     // Creates a manufacturerData.
    + var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    + manufacturer.data = "0x0059"
    + 
    +
  • @@ -601,6 +630,11 @@ The tizen.bluetooth object allows access to the Bluetooth API. This dictionary is used as an input parameter of the BluetoothLEAdvertiseData constructor.

    +
    +

    Code example:

     var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    +                    appearance: 192, includeTxPowerLevel: false  }
    + 
    +

    2.5. BluetoothLEAdvertiseData

    @@ -627,6 +661,12 @@ The BluetoothLEAdvertiseData container for Bluetooth LE advertising. This represents the data to be advertised as well as the scan response data for active scans.

    +
    +

    Code example:

     var advertData = { includeName : false, uuids: ["f236-41a4"], solicitationuuids: ["5857-4d3f"],
    +                    appearance: 192, includeTxPowerLevel: false }
    + var advertise = new tizen.BluetoothLEAdvertiseData(advertData);
    + 
    +

    Constructors

    BluetoothLEAdvertiseData(optional BluetoothLEAdvertiseDataInit? init);
    @@ -643,6 +683,11 @@ If attribute is set to null, The default value is set to a false. Since: 2.3.1

    +
    +

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    + advertise.includeName = true;
    + 
    +
  • BluetoothUUID[] @@ -653,6 +698,11 @@ If attribute is set to null, The default value is set to a false. Since: 2.3.1

    +
    +

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    + advertise.uuids = ["180d"];
    + 
    +
  • BluetoothLESolicitationUUID[] @@ -663,6 +713,11 @@ If attribute is set to null, The default value is set to a false. Since: 2.3.1

    +
    +

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    + advertise.solicitationuuids = ["180f"];
    + 
    +
  • unsigned long appearance [nullable]
  • boolean includeTxPowerLevel [nullable]
    @@ -687,6 +747,11 @@ If attribute is set to null, The default value is set to a false. Since: 2.3.1

    +
    +

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    + advertise.includeTxPowerLevel = true;
    + 
    +
  • BluetoothLEServiceData serviceData [nullable]
    @@ -696,6 +761,12 @@ If attribute is set to null, The default value is set to a false. Since: 2.3.1

    +
    +

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    + var service = new tizen.BluetoothLEServiceData("c500-11e5", "0x1811");
    + advertise.serviceData = service;
    + 
    +
  • BluetoothLEManufacturerData manufacturerData [nullable]
    @@ -705,6 +776,12 @@ If attribute is set to null, The default value is set to a false. Since: 2.3.1

    +
    +

    Code example:

     var advertise = new tizen.BluetoothLEAdvertiseData();
    + var manufacture = new tizen.BluetoothLEManufacturerData("127", "0x0057");
    + advertise.manufacturerData = manufacture;
    + 
    +
  • @@ -738,6 +815,10 @@ If attribute is set to null, The default value is set to a false. Since: 1.0

    +
    +

    Code example:

     console.log(tizen.bluetooth.deviceMajor);
    + 
    +
  • readonly @@ -748,6 +829,10 @@ If attribute is set to null, The default value is set to a false. Since: 1.0

    +
    +

    Code example:

     console.log(tizen.bluetooth.deviceMinor);
    + 
    +
  • readonly @@ -758,6 +843,10 @@ If attribute is set to null, The default value is set to a false. Since: 1.0

    +
    +

    Code example:

     console.log(tizen.bluetooth.deviceService);
    + 
    +
  • @@ -806,9 +895,8 @@ Instead, use http://tizen.org/privilege/bluetooth.
    -

    Code example:

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

    Code example:

     try {
    +     var adapter = tizen.bluetooth.getDefaultAdapter() ;
      } catch (err) {
          console.log (err.name +": " + err.message);
      }
    @@ -863,9 +951,8 @@ Instead, use http://tizen.org/privilege/bluetooth.
     
             
    -

    Code example:

     var adapter = null;
    - try {
    -     adapter = tizen.bluetooth.getLEAdapter();
    +

    Code example:

     try {
    +     var adapter = tizen.bluetooth.getLEAdapter();
      } catch (err) {
          console.log(err.name +": " + err.message);
      }
    @@ -2469,6 +2556,22 @@ Instead, use http://tizen.org/privilege/bluetooth.
                 Since: 
      2.3.1
               

    +
    +

    Code example:

      function onconnected(device) {
    +    console.log("Connected to device");
    +    var service = device.getService(device.uuids[0]);
    +    console.log("Service got");
    +  }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan(
    +  function onsuccess(device) {
    +    console.log("[Found device] address: " + device.address);
    +    device.connect(onconnected.bind(null, device), onerror);
    + });
    +
    + 
    +

    Attributes

      @@ -2481,6 +2584,12 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +
      +

      Code example:

       var service = device.getService(device.uuids[0]);
      + console.log("Service UUID " + service.uuid);
      +
      + 
      +
    • readonly @@ -2492,6 +2601,14 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +
      +

      Code example:

       var service = device.getService(device.uuids[0]);
      + for( var i = 0; i  service.services.length; ++i) {
      +   console.log("Subservices UUID " + service.services[i].uuid);
      + }
      +
      + 
      +
    • readonly @@ -2503,6 +2620,14 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +
      +

      Code example:

       var service = device.getService(device.uuids[0]);
      + for( var i = 0; i  service.characteristics.length; ++i) {
      +   console.log("Subservices UUID " + service.characteristics[i].isWritable);
      + }
      +
      + 
      +
    @@ -2918,6 +3043,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

    +

    Remark : + Example of using can be find at addValueChangeListener code example. +

    Parameters:

      @@ -3158,6 +3286,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +

      Remark : + Example of using can be find at startScan code example. +

      Methods

      @@ -3198,6 +3329,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +

      Remark : + Example of using can be find at startAdvertise code example. +

      Methods

      @@ -3240,6 +3374,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +

      Remark : + Example of using can be find at addConnectStateChangeListener code example. +

      Methods

      @@ -3300,6 +3437,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.3.1

      +

      Remark : + Example of using can be find at BluetoothGATTCharacteristic.readValue() and BluetoothGATTDescriptor.readValue() code examples. +

      Methods

      @@ -5245,6 +5385,10 @@ Instead, use http://tizen.org/privilege/bluetooth. function healthConnectSuccess(channel) { console.log("Health device is connected"); + var status = "Name of remote device: " + channel.peer.name + + "channel type of device profile: " + channel.channelType + + "health application name: " + channel.appication.name; + console.log(status); } function healthConnectError(e) { @@ -5831,6 +5975,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 2.2

      +

      Remark : + Example of using can be find at setChangeListener code example. +

      Methods

      @@ -5918,6 +6065,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 1.0

      +

      Remark : + Example of using can be find at getDevice and createBonding code examples. +

      Methods

      @@ -5959,6 +6109,9 @@ Instead, use http://tizen.org/privilege/bluetooth. Since: 1.0

      +

      Remark : + Example of using can be find at getKnownDevices code example. +

      Methods

      @@ -6004,6 +6157,9 @@ Each element is a BluetoothDevice. Since: 1.0

      +

      Remark : + Example of using can be find at discoverDevices code example. +

      Methods

      @@ -6106,6 +6262,9 @@ After that, this device is no longer visible. Since: 1.0

      +

      Remark : + Example of using can be find at connectToServiceByUUID code example. +

      Methods

      @@ -6147,6 +6306,9 @@ After that, this device is no longer visible. Since: 1.0

      +

      Remark : + Example of using can be find at registerRFCOMMServiceByUUID code example. +

      Methods

      @@ -6188,6 +6350,9 @@ After that, this device is no longer visible. Since: 2.2

      +

      Remark : + Example of using can be find at registerSinkApplication code example. +

      Methods

      @@ -6229,6 +6394,9 @@ After that, this device is no longer visible. Since: 2.2

      +

      Remark : + Example of using can be find at connectToSource code example. +

      Methods

      @@ -6272,6 +6440,9 @@ After that, this device is no longer visible. Since: 2.2

      +

      Remark : + Example of using can be find at setListener code example. +

      Methods