From 859cabd7ce64ed74f08860e9d068d244f8cc2df7 Mon Sep 17 00:00:00 2001 From: Tomasz Marciniak Date: Mon, 8 Feb 2016 15:28:39 +0100 Subject: [PATCH] [Bluetooth] Added getServiceAllUuids() function. Change-Id: I3ecdcfce61b0e5648ff295b495b79b38021cc370 Signed-off-by: Tomasz Marciniak --- .../web/tizen/network/bluetooth_tutorial_w.htm | 10 +++- .../html/device_api/mobile/tizen/bluetooth.html | 57 +++++++++++++++++++++- 2 files changed, 65 insertions(+), 2 deletions(-) diff --git a/org.tizen.tutorials/html/web/tizen/network/bluetooth_tutorial_w.htm b/org.tizen.tutorials/html/web/tizen/network/bluetooth_tutorial_w.htm index f8c30b2..e18ff9d 100644 --- a/org.tizen.tutorials/html/web/tizen/network/bluetooth_tutorial_w.htm +++ b/org.tizen.tutorials/html/web/tizen/network/bluetooth_tutorial_w.htm @@ -558,6 +558,14 @@ for (i; i < serviceUUIDs.length; i++) } +
  • Retrieve all service UUIDs using the getServiceAllUuids() method of the BluetoothLEDevice interface.

    +
    +var services = remoteDevice.getServiceAllUuids();
    +
    +console.log("Services length " + services.length);
    +
    +
  • +

    Accessing the Bluetooth GATT Characteristic Value

    @@ -726,4 +734,4 @@ var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga - \ No newline at end of file + 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 4667b48..499dcc8 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 @@ -245,6 +245,7 @@ For more information on the Bluetooth features, see connect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    void disconnect (optional SuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    BluetoothGATTService getService (BluetoothUUID uuid)
    + BluetoothUUID[] getServiceAllUuids ()
    long addConnectStateChangeListener (BluetoothLEConnectChangeCallback listener)
    void removeConnectStateChangeListener (long watchID) @@ -3899,7 +3900,7 @@ A BluetoothLEDevice object can be retrieved by using one of the followi readonly BluetoothUUID[] uuids [nullable]
    - The list of 128 bit service UUIDs available on this remote device. + The list of service UUIDs from scan result.

    Since: @@ -4242,6 +4243,58 @@ Instead, use http://tizen.org/privilege/bluetooth. +

    +getServiceAllUuids +
    +
    +
    + Retrieves list of all service UUIDs from connected GATT server. +
    +
    BluetoothUUID[] getServiceAllUuids();
    +             
    +

    + Since: + 3.0 +

    +

    + Privilege level: + public +

    +

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

    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • with error type InvalidValuesError, If GATT server is not available.

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

      • +
      +
    +
    +
    +

    Code example:

     function onconnected(device) {
    +        console.log("Connected to device");
    +        var services = device.getServiceAllUuids();
    +        console.log("Services length " + services.length);
    + }
    +
    + 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);
    +        device.connect(onconnected.bind(null, device), onerror);
    +    }
    + }
    +
    + var adapter = tizen.bluetooth.getLEAdapter();
    + adapter.startScan(onDeviceFound, onerror);
    + 
    +
    +
    addConnectStateChangeListener
    @@ -6722,6 +6775,8 @@ To guarantee that the Bluetooth Low Energy application runs on a device with Blu BluetoothGATTService getService(BluetoothUUID uuid) raises(WebAPIException); + BluetoothUUID[] getServiceAllUuids() raises(WebAPIException); + long addConnectStateChangeListener(BluetoothLEConnectChangeCallback listener) raises(WebAPIException); void removeConnectStateChangeListener(long watchID); -- 2.7.4