From 05cd9bed106164810b92cc072efd389836083750 Mon Sep 17 00:00:00 2001 From: "Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics" Date: Wed, 5 Aug 2026 13:59:37 +0200 Subject: [PATCH 1/2] [10.1][Bluetooth] Add connect/disconnect API for audio profile [ACR] https://jira.sec.samsung.net/browse/TWDAPI-304 --- .../device_api/mobile/tizen/bluetooth.html | 483 +++++++++++++++++- .../web/api/10.1/device_api/tv/index.html | 6 - .../10.1/device_api/tv/tizen/bluetooth.html | 483 +++++++++++++++++- .../device_api/wearable/tizen/bluetooth.html | 483 +++++++++++++++++- .../web/guides/connectivity/bluetooth.md | 65 +++ 5 files changed, 1439 insertions(+), 81 deletions(-) diff --git a/docs/application/web/api/10.1/device_api/mobile/tizen/bluetooth.html b/docs/application/web/api/10.1/device_api/mobile/tizen/bluetooth.html index cf12856488..edc45d6b72 100644 --- a/docs/application/web/api/10.1/device_api/mobile/tizen/bluetooth.html +++ b/docs/application/web/api/10.1/device_api/mobile/tizen/bluetooth.html @@ -55,28 +55,34 @@

Table of Contents

1.3. BluetoothSocketState
  • - 1.4. BluetoothLESolicitationUUID + 1.4. BluetoothAudioProfileType
  • - 1.5. BluetoothAdvertisePacketType + 1.5. BluetoothConnectionProfileType
  • - 1.6. BluetoothAdvertisingState + 1.6. BluetoothLESolicitationUUID
  • - 1.7. BluetoothAdvertisingMode + 1.7. BluetoothAdvertisePacketType
  • - 1.8. Bytes + 1.8. BluetoothAdvertisingState
  • - 1.9. BluetoothGATTServiceVariant + 1.9. BluetoothAdvertisingMode
  • - 1.10. BluetoothGATTCharacteristicVariant + 1.10. Bytes
  • - 1.11. BluetoothGATTDescriptorVariant + 1.11. BluetoothGATTServiceVariant +
  • +
  • + 1.12. BluetoothGATTCharacteristicVariant +
  • +
  • + 1.13. BluetoothGATTDescriptorVariant
  • @@ -155,13 +161,15 @@

    Table of Contents

  • 2.37. BluetoothDeviceSuccessCallback
  • -
  • 2.38. BluetoothDeviceArraySuccessCallback +
  • 2.38. BluetoothAudioSuccessCallback +
  • +
  • 2.39. BluetoothDeviceArraySuccessCallback
  • -
  • 2.39. BluetoothDiscoverDevicesSuccessCallback +
  • 2.40. BluetoothDiscoverDevicesSuccessCallback
  • -
  • 2.40. BluetoothSocketSuccessCallback +
  • 2.41. BluetoothSocketSuccessCallback
  • -
  • 2.41. BluetoothServiceSuccessCallback +
  • 2.42. BluetoothServiceSuccessCallback
  • @@ -353,7 +361,12 @@

    Summary of Interfaces and Methods

    BluetoothDevice -
    void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    + +
    void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void audioConnect (BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void audioDisconnect (BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    +
    boolean isProfileConnected (BluetoothConnectionProfileType profileType)
    + BluetoothLEDevice @@ -414,6 +427,10 @@

    Summary of Interfaces and Methods

    void onsuccess (BluetoothDevice device)
    +BluetoothAudioSuccessCallback +
    void onsuccess (BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected)
    + + BluetoothDeviceArraySuccessCallback
    void onsuccess (BluetoothDevice[] devices)
    @@ -496,8 +513,64 @@

    1. Type Definitions

    +
    +

    1.4. BluetoothAudioProfileType

    +
    + Specifies the Bluetooth audio profile type. +
    +
      enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" };
    +

    Since: + 1.0 +

    +
    +
      +
    • +HSP_HFP - Headset Profile/Hands-Free Profile (local device AG and remote device HF Client)
    • +
    • +A2DP - Advanced Audio Distribution Profile Source Connection (remote device is A2DP Sink)
    • +
    • +AG - Audio Gateway (local device HF Client and remote device AG)
    • +
    • +A2DP_SINK - Advanced Audio Distribution Profile Sink Connection (remote device is A2DP Source)
    • +
    • +ALL - All supported profiles related with audio (Both Host and Device role)
    • +
    +
    +
    +
    +

    1.5. BluetoothConnectionProfileType

    +
    + Specifies the Bluetooth connection profile type. +
    +
      enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" };
    +

    Since: + 10.1 +

    +
    +
      +
    • +RFCOMM - RFCOMM profile
    • +
    • +A2DP - Advanced Audio Distribution Profile
    • +
    • +HSP - Headset Profile
    • +
    • +HID - Human Interface Device Profile
    • +
    • +NAP - Network Access Profile
    • +
    • +AG - Audio Gateway Profile
    • +
    • +GATT - Generic Attribute Profile
    • +
    • +NAP_SERVER - Network Access Profile Server
    • +
    • +A2DP_SINK - Advanced Audio Distribution Profile Sink
    • +
    +
    +
    -

    1.4. BluetoothLESolicitationUUID

    +

    1.6. BluetoothLESolicitationUUID

    The service solicitation UUID of the Bluetooth LE device.
    @@ -511,7 +584,7 @@

    1. Type Definitions

    -

    1.5. BluetoothAdvertisePacketType

    +

    1.7. BluetoothAdvertisePacketType

    The Bluetooth LE packet type.
    @@ -529,7 +602,7 @@

    1. Type Definitions

    -

    1.6. BluetoothAdvertisingState

    +

    1.8. BluetoothAdvertisingState

    The Bluetooth advertising state.
    @@ -547,7 +620,7 @@

    1. Type Definitions

    -

    1.7. BluetoothAdvertisingMode

    +

    1.9. BluetoothAdvertisingMode

    The Bluetooth advertising mode.
    @@ -567,7 +640,7 @@

    1. Type Definitions

    -

    1.8. Bytes

    +

    1.10. Bytes

    The Bytes type, that aggregates all types in Bluetooth API used to pass binary data. It can be either a byte[] or a DOMString or a Uint8Array.
    @@ -577,7 +650,7 @@

    1. Type Definitions

    -

    1.9. BluetoothGATTServiceVariant

    +

    1.11. BluetoothGATTServiceVariant

    The type of objects which are either BluetoothGATTService or BluetoothGATTServerService, depending on the context in which they appear.
    @@ -587,7 +660,7 @@

    1. Type Definitions

    -

    1.10. BluetoothGATTCharacteristicVariant

    +

    1.12. BluetoothGATTCharacteristicVariant

    The type of objects which are either BluetoothGATTCharacteristic or BluetoothGATTServerCharacteristic, depending on the context in which they appear.
    @@ -597,7 +670,7 @@

    1. Type Definitions

    -

    1.11. BluetoothGATTDescriptorVariant

    +

    1.13. BluetoothGATTDescriptorVariant

    The type of objects which are either BluetoothGATTDescriptor or BluetoothGATTServerDescriptor, depending on the context in which they appear.
    @@ -5942,6 +6015,11 @@

    Methods

    readonly attribute BluetoothUUID[] uuids; void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + boolean isProfileConnected(BluetoothConnectionProfileType profileType) raises(WebAPIException); };

    Since: 1.0 @@ -6270,6 +6348,302 @@

    Methods

    /* Execution. */ +if (adapter.powered) +{ + console.log("Bluetooth is already enabled"); + adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) + { + console.log("Error: " + e.message); + }); +} +else +{ + console.log("Try to launch the Bluetooth Settings application"); + tizen.application.launchAppControl( + bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply); +} + +
    + +
    +audioConnect +
    +
    +
    + Connects to a remote Bluetooth audio device with the specified audio profile type. +
    +
    void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +

    Since: + 10.1 +

    +
    +

    +This method initiates the process of establishing an audio connection to a bonded remote device using the specified audio profile. +The remote device must be bonded with the local device before calling this method. +

    +

    +When the connection request succeeds, the successCallback is invoked with connection information. +While connecting with ALL as a profile type, success callback will be called twice (for HSP_HFP and A2DP). +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • +ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • +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 +

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of audio profile to use for the connection. +
    • +
    • +successCallback: + Callback function that is called when an asynchronous call completes successfully. +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when an error occurs. +
    • +
    +
    +
    +

    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();
    +function onAudioConnectSuccess(address, profileType, connected)
    +{
    +  console.log("Connected device: " + address);
    +  console.log("Profile type: " + profileType);
    +  console.log("Connected: " + connected);
    +}
    +
    +function onError(e)
    +{
    +  console.log("Could not connect to audio device, reason: " + e.message);
    +}
    +
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  device.audioConnect("A2DP", onAudioConnectSuccess, onError);
    +}
    +
    +/* Execution. */
    +
    +if (adapter.powered)
    +{
    +  console.log("Bluetooth is already enabled");
    +  adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e)
    +  {
    +    console.log("Error: " + e.message);
    +  });
    +}
    +else
    +{
    +  console.log("Try to launch the Bluetooth Settings application");
    +  tizen.application.launchAppControl(
    +      bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
    +}
    +
    +
    +
    +
    +audioDisconnect +
    +
    +
    + Disconnects from a remote Bluetooth audio device with the specified audio profile type. +
    +
    void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    +

    Since: + 10.1 +

    +
    +

    +This method initiates the process of terminating an audio connection to a connected remote device using the specified audio profile. +The remote device must be connected before calling this method. +

    +

    +When the disconnection request succeeds, the successCallback is invoked with connection information. +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • +ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • +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 +

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of audio profile to disconnect. +
    • +
    • +successCallback [optional] [nullable]: + Callback function that is called when an asynchronous call completes successfully. +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when an error occurs. +
    • +
    +
    +
    +

    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();
    +function onAudioDisconnectSuccess(address, profileType, connected)
    +{
    +  console.log("Disconnected device: " + address);
    +  console.log("Profile type: " + profileType);
    +  console.log("Connected: " + connected);
    +}
    +
    +function onError(e)
    +{
    +  console.log("Could not disconnect from audio device, reason: " + e.message);
    +}
    +
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  device.audioDisconnect("A2DP", onAudioDisconnectSuccess, onError);
    +}
    +
    +/* Execution. */
    +
    +if (adapter.powered)
    +{
    +  console.log("Bluetooth is already enabled");
    +  adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e)
    +  {
    +    console.log("Error: " + e.message);
    +  });
    +}
    +else
    +{
    +  console.log("Try to launch the Bluetooth Settings application");
    +  tizen.application.launchAppControl(
    +      bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
    +}
    +
    +
    +
    +
    +isProfileConnected +
    +
    +
    + Checks whether a specific Bluetooth profile is connected to the remote device. +
    +
    boolean isProfileConnected(BluetoothConnectionProfileType profileType);
    +

    Since: + 10.1 +

    +
    +

    +This method returns the connection status of the specified Bluetooth profile for the bonded remote device. +The remote device must be bonded with the local device before calling this method. +

    +
    +

    Privilege level: + public +

    +

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

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of Bluetooth profile to check. +
    • +
    +
    +
    +

    Return value:

    +
      +boolean: + true if the specified profile is connected, false otherwise. +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type ServiceNotAvailableError, if a Bluetooth device is turned off. +

      • +
      • + 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. +

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

      • +
      +
    +
    +
    +

    Code example:

    var adapter = tizen.bluetooth.getDefaultAdapter();
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  var isConnected = device.isProfileConnected("A2DP");
    +  console.log("A2DP profile connected: " + isConnected);
    +}
    +
    +/* Execution. */
    +
     if (adapter.powered)
     {
       console.log("Bluetooth is already enabled");
    @@ -8494,8 +8868,57 @@ 

    Methods

    +
    +

    2.38. BluetoothAudioSuccessCallback

    +
    + The BluetoothAudioSuccessCallback interface implements the success callback for BluetoothAdapter.audioConnect() and BluetoothAdapter.audioDisconnect(). +
    +
      [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothAudioSuccessCallback {
    +    void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
    +  };
    +

    Since: + 1.0 +

    +

    Remark: + Example of using can be find at audioConnect and audioDisconnect code examples. +

    +
    +

    Methods

    +
    +
    +onsuccess +
    +
    +
    + Called when the audio connect/disconnect operation is successful. +
    +
    void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
    +

    Since: + 1.0 +

    +
    +

    Parameters:

    +
      +
    • +address: + The MAC address of the remote device. +
    • +
    • +profileType: + The audio profile type used for the operation. +
    • +
    • +connected: + true if connected, false if disconnected. +
    • +
    +
    +
    +
    +
    +
    -

    2.38. BluetoothDeviceArraySuccessCallback

    +

    2.39. BluetoothDeviceArraySuccessCallback

    The BluetoothDeviceArraySuccessCallback interface that defines the success callback for BluetoothAdapter.getKnownDevices().
    @@ -8537,7 +8960,7 @@

    Methods

    -

    2.39. BluetoothDiscoverDevicesSuccessCallback

    +

    2.40. BluetoothDiscoverDevicesSuccessCallback

    The BluetoothDiscoverDevicesSuccessCallback interface that defines the success callback for BluetoothAdapter.discoverDevices().
    @@ -8636,7 +9059,7 @@

    Methods

    -

    2.40. BluetoothSocketSuccessCallback

    +

    2.41. BluetoothSocketSuccessCallback

    The BluetoothSocketSuccessCallback interface that defines the success method for BluetoothDevice.connectToServiceByUUID().
    @@ -8677,7 +9100,7 @@

    Methods

    -

    2.41. BluetoothServiceSuccessCallback

    +

    2.42. BluetoothServiceSuccessCallback

    The BluetoothServiceSuccessCallback interface implements the success callback for BluetoothAdapter.registerRFCOMMServiceByUUID().
    @@ -8776,6 +9199,8 @@

    4. Full WebIDL

    typedef (BluetoothGATTCharacteristic or BluetoothGATTServerCharacteristic) BluetoothGATTCharacteristicVariant; typedef (BluetoothGATTDescriptor or BluetoothGATTServerDescriptor) BluetoothGATTDescriptorVariant; enum BluetoothSocketState { "CLOSED", "OPEN" }; + enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" }; + enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" }; enum BluetoothAdvertisePacketType { "ADVERTISE", "SCAN_RESPONSE" }; enum BluetoothAdvertisingState { "STARTED", "STOPPED" }; enum BluetoothAdvertisingMode { "BALANCED", "LOW_LATENCY", "LOW_ENERGY" }; @@ -9022,6 +9447,11 @@

    4. Full WebIDL

    readonly attribute BluetoothUUID[] uuids; void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + boolean isProfileConnected(BluetoothConnectionProfileType profileType) raises(WebAPIException); }; [NoInterfaceObject] interface BluetoothLEDevice { readonly attribute BluetoothAddress address; @@ -9174,6 +9604,9 @@

    4. Full WebIDL

    [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceSuccessCallback { void onsuccess(BluetoothDevice device); }; + [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothAudioSuccessCallback { + void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected); + }; [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceArraySuccessCallback { void onsuccess(BluetoothDevice[] devices); }; diff --git a/docs/application/web/api/10.1/device_api/tv/index.html b/docs/application/web/api/10.1/device_api/tv/index.html index b062ad32a8..033a10077a 100644 --- a/docs/application/web/api/10.1/device_api/tv/index.html +++ b/docs/application/web/api/10.1/device_api/tv/index.html @@ -195,12 +195,6 @@

    Security

    Mandatory Yes -PrivacyPrivilege -This Privacy Privilege API defines a set of APIs that manage the permissions for using a privacy-related privileges of application. -10.1 -Mandatory -Yes -

    System

    diff --git a/docs/application/web/api/10.1/device_api/tv/tizen/bluetooth.html b/docs/application/web/api/10.1/device_api/tv/tizen/bluetooth.html index f5e4144f5f..d26bd8cba8 100644 --- a/docs/application/web/api/10.1/device_api/tv/tizen/bluetooth.html +++ b/docs/application/web/api/10.1/device_api/tv/tizen/bluetooth.html @@ -55,28 +55,34 @@

    Table of Contents

    1.3. BluetoothSocketState
  • - 1.4. BluetoothLESolicitationUUID + 1.4. BluetoothAudioProfileType
  • - 1.5. BluetoothAdvertisePacketType + 1.5. BluetoothConnectionProfileType
  • - 1.6. BluetoothAdvertisingState + 1.6. BluetoothLESolicitationUUID
  • - 1.7. BluetoothAdvertisingMode + 1.7. BluetoothAdvertisePacketType
  • - 1.8. Bytes + 1.8. BluetoothAdvertisingState
  • - 1.9. BluetoothGATTServiceVariant + 1.9. BluetoothAdvertisingMode
  • - 1.10. BluetoothGATTCharacteristicVariant + 1.10. Bytes
  • - 1.11. BluetoothGATTDescriptorVariant + 1.11. BluetoothGATTServiceVariant +
  • +
  • + 1.12. BluetoothGATTCharacteristicVariant +
  • +
  • + 1.13. BluetoothGATTDescriptorVariant
  • @@ -155,13 +161,15 @@

    Table of Contents

  • 2.37. BluetoothDeviceSuccessCallback
  • -
  • 2.38. BluetoothDeviceArraySuccessCallback +
  • 2.38. BluetoothAudioSuccessCallback +
  • +
  • 2.39. BluetoothDeviceArraySuccessCallback
  • -
  • 2.39. BluetoothDiscoverDevicesSuccessCallback +
  • 2.40. BluetoothDiscoverDevicesSuccessCallback
  • -
  • 2.40. BluetoothSocketSuccessCallback +
  • 2.41. BluetoothSocketSuccessCallback
  • -
  • 2.41. BluetoothServiceSuccessCallback +
  • 2.42. BluetoothServiceSuccessCallback
  • @@ -353,7 +361,12 @@

    Summary of Interfaces and Methods

    - + @@ -414,6 +427,10 @@

    Summary of Interfaces and Methods

    + + + + @@ -496,8 +513,64 @@

    1. Type Definitions

    +
    +

    1.4. BluetoothAudioProfileType

    +
    + Specifies the Bluetooth audio profile type. +
    +
      enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" };
    +

    Since: + 6.0 +

    +
    +
      +
    • +HSP_HFP - Headset Profile/Hands-Free Profile (local device AG and remote device HF Client)
    • +
    • +A2DP - Advanced Audio Distribution Profile Source Connection (remote device is A2DP Sink)
    • +
    • +AG - Audio Gateway (local device HF Client and remote device AG)
    • +
    • +A2DP_SINK - Advanced Audio Distribution Profile Sink Connection (remote device is A2DP Source)
    • +
    • +ALL - All supported profiles related with audio (Both Host and Device role)
    • +
    +
    +
    +
    +

    1.5. BluetoothConnectionProfileType

    +
    + Specifies the Bluetooth connection profile type. +
    +
      enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" };
    +

    Since: + 10.1 +

    +
    +
      +
    • +RFCOMM - RFCOMM profile
    • +
    • +A2DP - Advanced Audio Distribution Profile
    • +
    • +HSP - Headset Profile
    • +
    • +HID - Human Interface Device Profile
    • +
    • +NAP - Network Access Profile
    • +
    • +AG - Audio Gateway Profile
    • +
    • +GATT - Generic Attribute Profile
    • +
    • +NAP_SERVER - Network Access Profile Server
    • +
    • +A2DP_SINK - Advanced Audio Distribution Profile Sink
    • +
    +
    +
    -

    1.4. BluetoothLESolicitationUUID

    +

    1.6. BluetoothLESolicitationUUID

    The service solicitation UUID of the Bluetooth LE device.
    @@ -511,7 +584,7 @@

    1. Type Definitions

    -

    1.5. BluetoothAdvertisePacketType

    +

    1.7. BluetoothAdvertisePacketType

    The Bluetooth LE packet type.
    @@ -529,7 +602,7 @@

    1. Type Definitions

    -

    1.6. BluetoothAdvertisingState

    +

    1.8. BluetoothAdvertisingState

    The Bluetooth advertising state.
    @@ -547,7 +620,7 @@

    1. Type Definitions

    -

    1.7. BluetoothAdvertisingMode

    +

    1.9. BluetoothAdvertisingMode

    The Bluetooth advertising mode.
    @@ -567,7 +640,7 @@

    1. Type Definitions

    -

    1.8. Bytes

    +

    1.10. Bytes

    The Bytes type, that aggregates all types in Bluetooth API used to pass binary data. It can be either a byte[] or a DOMString or a Uint8Array.
    @@ -577,7 +650,7 @@

    1. Type Definitions

    -

    1.9. BluetoothGATTServiceVariant

    +

    1.11. BluetoothGATTServiceVariant

    The type of objects which are either BluetoothGATTService or BluetoothGATTServerService, depending on the context in which they appear.
    @@ -587,7 +660,7 @@

    1. Type Definitions

    -

    1.10. BluetoothGATTCharacteristicVariant

    +

    1.12. BluetoothGATTCharacteristicVariant

    The type of objects which are either BluetoothGATTCharacteristic or BluetoothGATTServerCharacteristic, depending on the context in which they appear.
    @@ -597,7 +670,7 @@

    1. Type Definitions

    -

    1.11. BluetoothGATTDescriptorVariant

    +

    1.13. BluetoothGATTDescriptorVariant

    The type of objects which are either BluetoothGATTDescriptor or BluetoothGATTServerDescriptor, depending on the context in which they appear.
    @@ -5942,6 +6015,11 @@

    Methods

    readonly attribute BluetoothUUID[] uuids; void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + boolean isProfileConnected(BluetoothConnectionProfileType profileType) raises(WebAPIException); };

    Since: 6.0 @@ -6270,6 +6348,302 @@

    Methods

    /* Execution. */ +if (adapter.powered) +{ + console.log("Bluetooth is already enabled"); + adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) + { + console.log("Error: " + e.message); + }); +} +else +{ + console.log("Try to launch the Bluetooth Settings application"); + tizen.application.launchAppControl( + bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply); +} + +
    + +
    +audioConnect +
    +
    +
    + Connects to a remote Bluetooth audio device with the specified audio profile type. +
    +
    void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +

    Since: + 10.1 +

    +
    +

    +This method initiates the process of establishing an audio connection to a bonded remote device using the specified audio profile. +The remote device must be bonded with the local device before calling this method. +

    +

    +When the connection request succeeds, the successCallback is invoked with connection information. +While connecting with ALL as a profile type, success callback will be called twice (for HSP_HFP and A2DP). +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • +ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • +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 +

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of audio profile to use for the connection. +
    • +
    • +successCallback: + Callback function that is called when an asynchronous call completes successfully. +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when an error occurs. +
    • +
    +
    +
    +

    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();
    +function onAudioConnectSuccess(address, profileType, connected)
    +{
    +  console.log("Connected device: " + address);
    +  console.log("Profile type: " + profileType);
    +  console.log("Connected: " + connected);
    +}
    +
    +function onError(e)
    +{
    +  console.log("Could not connect to audio device, reason: " + e.message);
    +}
    +
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  device.audioConnect("A2DP", onAudioConnectSuccess, onError);
    +}
    +
    +/* Execution. */
    +
    +if (adapter.powered)
    +{
    +  console.log("Bluetooth is already enabled");
    +  adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e)
    +  {
    +    console.log("Error: " + e.message);
    +  });
    +}
    +else
    +{
    +  console.log("Try to launch the Bluetooth Settings application");
    +  tizen.application.launchAppControl(
    +      bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
    +}
    +
    +
    +
    +
    +audioDisconnect +
    +
    +
    + Disconnects from a remote Bluetooth audio device with the specified audio profile type. +
    +
    void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    +

    Since: + 10.1 +

    +
    +

    +This method initiates the process of terminating an audio connection to a connected remote device using the specified audio profile. +The remote device must be connected before calling this method. +

    +

    +When the disconnection request succeeds, the successCallback is invoked with connection information. +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • +ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • +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 +

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of audio profile to disconnect. +
    • +
    • +successCallback [optional] [nullable]: + Callback function that is called when an asynchronous call completes successfully. +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when an error occurs. +
    • +
    +
    +
    +

    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();
    +function onAudioDisconnectSuccess(address, profileType, connected)
    +{
    +  console.log("Disconnected device: " + address);
    +  console.log("Profile type: " + profileType);
    +  console.log("Connected: " + connected);
    +}
    +
    +function onError(e)
    +{
    +  console.log("Could not disconnect from audio device, reason: " + e.message);
    +}
    +
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  device.audioDisconnect("A2DP", onAudioDisconnectSuccess, onError);
    +}
    +
    +/* Execution. */
    +
    +if (adapter.powered)
    +{
    +  console.log("Bluetooth is already enabled");
    +  adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e)
    +  {
    +    console.log("Error: " + e.message);
    +  });
    +}
    +else
    +{
    +  console.log("Try to launch the Bluetooth Settings application");
    +  tizen.application.launchAppControl(
    +      bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
    +}
    +
    +
    +
    +
    +isProfileConnected +
    +
    +
    + Checks whether a specific Bluetooth profile is connected to the remote device. +
    +
    boolean isProfileConnected(BluetoothConnectionProfileType profileType);
    +

    Since: + 10.1 +

    +
    +

    +This method returns the connection status of the specified Bluetooth profile for the bonded remote device. +The remote device must be bonded with the local device before calling this method. +

    +
    +

    Privilege level: + public +

    +

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

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of Bluetooth profile to check. +
    • +
    +
    +
    +

    Return value:

    +
      +boolean: + true if the specified profile is connected, false otherwise. +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type ServiceNotAvailableError, if a Bluetooth device is turned off. +

      • +
      • + 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. +

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

      • +
      +
    +
    +
    +

    Code example:

    var adapter = tizen.bluetooth.getDefaultAdapter();
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  var isConnected = device.isProfileConnected("A2DP");
    +  console.log("A2DP profile connected: " + isConnected);
    +}
    +
    +/* Execution. */
    +
     if (adapter.powered)
     {
       console.log("Bluetooth is already enabled");
    @@ -8494,8 +8868,57 @@ 

    Methods

    +
    +

    2.38. BluetoothAudioSuccessCallback

    +
    + The BluetoothAudioSuccessCallback interface implements the success callback for BluetoothAdapter.audioConnect() and BluetoothAdapter.audioDisconnect(). +
    +
      [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothAudioSuccessCallback {
    +    void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
    +  };
    +

    Since: + 6.0 +

    +

    Remark: + Example of using can be find at audioConnect and audioDisconnect code examples. +

    +
    +

    Methods

    +
    +
    +onsuccess +
    +
    +
    + Called when the audio connect/disconnect operation is successful. +
    +
    void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
    +

    Since: + 6.0 +

    +
    +

    Parameters:

    +
      +
    • +address: + The MAC address of the remote device. +
    • +
    • +profileType: + The audio profile type used for the operation. +
    • +
    • +connected: + true if connected, false if disconnected. +
    • +
    +
    +
    +
    +
    +
    -

    2.38. BluetoothDeviceArraySuccessCallback

    +

    2.39. BluetoothDeviceArraySuccessCallback

    The BluetoothDeviceArraySuccessCallback interface that defines the success callback for BluetoothAdapter.getKnownDevices().
    @@ -8537,7 +8960,7 @@

    Methods

    -

    2.39. BluetoothDiscoverDevicesSuccessCallback

    +

    2.40. BluetoothDiscoverDevicesSuccessCallback

    The BluetoothDiscoverDevicesSuccessCallback interface that defines the success callback for BluetoothAdapter.discoverDevices().
    @@ -8636,7 +9059,7 @@

    Methods

    -

    2.40. BluetoothSocketSuccessCallback

    +

    2.41. BluetoothSocketSuccessCallback

    The BluetoothSocketSuccessCallback interface that defines the success method for BluetoothDevice.connectToServiceByUUID().
    @@ -8677,7 +9100,7 @@

    Methods

    -

    2.41. BluetoothServiceSuccessCallback

    +

    2.42. BluetoothServiceSuccessCallback

    The BluetoothServiceSuccessCallback interface implements the success callback for BluetoothAdapter.registerRFCOMMServiceByUUID().
    @@ -8768,6 +9191,8 @@

    4. Full WebIDL

    typedef (BluetoothGATTCharacteristic or BluetoothGATTServerCharacteristic) BluetoothGATTCharacteristicVariant; typedef (BluetoothGATTDescriptor or BluetoothGATTServerDescriptor) BluetoothGATTDescriptorVariant; enum BluetoothSocketState { "CLOSED", "OPEN" }; + enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" }; + enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" }; enum BluetoothAdvertisePacketType { "ADVERTISE", "SCAN_RESPONSE" }; enum BluetoothAdvertisingState { "STARTED", "STOPPED" }; enum BluetoothAdvertisingMode { "BALANCED", "LOW_LATENCY", "LOW_ENERGY" }; @@ -9014,6 +9439,11 @@

    4. Full WebIDL

    readonly attribute BluetoothUUID[] uuids; void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + boolean isProfileConnected(BluetoothConnectionProfileType profileType) raises(WebAPIException); }; [NoInterfaceObject] interface BluetoothLEDevice { readonly attribute BluetoothAddress address; @@ -9166,6 +9596,9 @@

    4. Full WebIDL

    [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceSuccessCallback { void onsuccess(BluetoothDevice device); }; + [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothAudioSuccessCallback { + void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected); + }; [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceArraySuccessCallback { void onsuccess(BluetoothDevice[] devices); }; diff --git a/docs/application/web/api/10.1/device_api/wearable/tizen/bluetooth.html b/docs/application/web/api/10.1/device_api/wearable/tizen/bluetooth.html index 1204db4fb3..5eda04aa78 100755 --- a/docs/application/web/api/10.1/device_api/wearable/tizen/bluetooth.html +++ b/docs/application/web/api/10.1/device_api/wearable/tizen/bluetooth.html @@ -55,28 +55,34 @@

    Table of Contents

    1.3. BluetoothSocketState
  • - 1.4. BluetoothLESolicitationUUID + 1.4. BluetoothAudioProfileType
  • - 1.5. BluetoothAdvertisePacketType + 1.5. BluetoothConnectionProfileType
  • - 1.6. BluetoothAdvertisingState + 1.6. BluetoothLESolicitationUUID
  • - 1.7. BluetoothAdvertisingMode + 1.7. BluetoothAdvertisePacketType
  • - 1.8. Bytes + 1.8. BluetoothAdvertisingState
  • - 1.9. BluetoothGATTServiceVariant + 1.9. BluetoothAdvertisingMode
  • - 1.10. BluetoothGATTCharacteristicVariant + 1.10. Bytes
  • - 1.11. BluetoothGATTDescriptorVariant + 1.11. BluetoothGATTServiceVariant +
  • +
  • + 1.12. BluetoothGATTCharacteristicVariant +
  • +
  • + 1.13. BluetoothGATTDescriptorVariant
  • @@ -155,13 +161,15 @@

    Table of Contents

  • 2.37. BluetoothDeviceSuccessCallback
  • -
  • 2.38. BluetoothDeviceArraySuccessCallback +
  • 2.38. BluetoothAudioSuccessCallback +
  • +
  • 2.39. BluetoothDeviceArraySuccessCallback
  • -
  • 2.39. BluetoothDiscoverDevicesSuccessCallback +
  • 2.40. BluetoothDiscoverDevicesSuccessCallback
  • -
  • 2.40. BluetoothSocketSuccessCallback +
  • 2.41. BluetoothSocketSuccessCallback
  • -
  • 2.41. BluetoothServiceSuccessCallback +
  • 2.42. BluetoothServiceSuccessCallback
  • @@ -353,7 +361,12 @@

    Summary of Interfaces and Methods

    - + @@ -414,6 +427,10 @@

    Summary of Interfaces and Methods

    + + + + @@ -496,8 +513,64 @@

    1. Type Definitions

    +
    +

    1.4. BluetoothAudioProfileType

    +
    + Specifies the Bluetooth audio profile type. +
    +
      enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" };
    +

    Since: + 2.3.1 +

    +
    +
      +
    • +HSP_HFP - Headset Profile/Hands-Free Profile (local device AG and remote device HF Client)
    • +
    • +A2DP - Advanced Audio Distribution Profile Source Connection (remote device is A2DP Sink)
    • +
    • +AG - Audio Gateway (local device HF Client and remote device AG)
    • +
    • +A2DP_SINK - Advanced Audio Distribution Profile Sink Connection (remote device is A2DP Source)
    • +
    • +ALL - All supported profiles related with audio (Both Host and Device role)
    • +
    +
    +
    +
    +

    1.5. BluetoothConnectionProfileType

    +
    + Specifies the Bluetooth connection profile type. +
    +
      enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" };
    +

    Since: + 10.1 +

    +
    +
      +
    • +RFCOMM - RFCOMM profile
    • +
    • +A2DP - Advanced Audio Distribution Profile
    • +
    • +HSP - Headset Profile
    • +
    • +HID - Human Interface Device Profile
    • +
    • +NAP - Network Access Profile
    • +
    • +AG - Audio Gateway Profile
    • +
    • +GATT - Generic Attribute Profile
    • +
    • +NAP_SERVER - Network Access Profile Server
    • +
    • +A2DP_SINK - Advanced Audio Distribution Profile Sink
    • +
    +
    +
    -

    1.4. BluetoothLESolicitationUUID

    +

    1.6. BluetoothLESolicitationUUID

    The service solicitation UUID of the Bluetooth LE device.
    @@ -511,7 +584,7 @@

    1. Type Definitions

    -

    1.5. BluetoothAdvertisePacketType

    +

    1.7. BluetoothAdvertisePacketType

    The Bluetooth LE packet type.
    @@ -529,7 +602,7 @@

    1. Type Definitions

    -

    1.6. BluetoothAdvertisingState

    +

    1.8. BluetoothAdvertisingState

    The Bluetooth advertising state.
    @@ -547,7 +620,7 @@

    1. Type Definitions

    -

    1.7. BluetoothAdvertisingMode

    +

    1.9. BluetoothAdvertisingMode

    The Bluetooth advertising mode.
    @@ -567,7 +640,7 @@

    1. Type Definitions

    -

    1.8. Bytes

    +

    1.10. Bytes

    The Bytes type, that aggregates all types in Bluetooth API used to pass binary data. It can be either a byte[] or a DOMString or a Uint8Array.
    @@ -577,7 +650,7 @@

    1. Type Definitions

    -

    1.9. BluetoothGATTServiceVariant

    +

    1.11. BluetoothGATTServiceVariant

    The type of objects which are either BluetoothGATTService or BluetoothGATTServerService, depending on the context in which they appear.
    @@ -587,7 +660,7 @@

    1. Type Definitions

    -

    1.10. BluetoothGATTCharacteristicVariant

    +

    1.12. BluetoothGATTCharacteristicVariant

    The type of objects which are either BluetoothGATTCharacteristic or BluetoothGATTServerCharacteristic, depending on the context in which they appear.
    @@ -597,7 +670,7 @@

    1. Type Definitions

    -

    1.11. BluetoothGATTDescriptorVariant

    +

    1.13. BluetoothGATTDescriptorVariant

    The type of objects which are either BluetoothGATTDescriptor or BluetoothGATTServerDescriptor, depending on the context in which they appear.
    @@ -5942,6 +6015,11 @@

    Methods

    readonly attribute BluetoothUUID[] uuids; void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + boolean isProfileConnected(BluetoothConnectionProfileType profileType) raises(WebAPIException); };

    Since: 2.3.1 @@ -6270,6 +6348,302 @@

    Methods

    /* Execution. */ +if (adapter.powered) +{ + console.log("Bluetooth is already enabled"); + adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e) + { + console.log("Error: " + e.message); + }); +} +else +{ + console.log("Try to launch the Bluetooth Settings application"); + tizen.application.launchAppControl( + bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply); +} + +
    + +
    +audioConnect +
    +
    +
    + Connects to a remote Bluetooth audio device with the specified audio profile type. +
    +
    void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback);
    +

    Since: + 10.1 +

    +
    +

    +This method initiates the process of establishing an audio connection to a bonded remote device using the specified audio profile. +The remote device must be bonded with the local device before calling this method. +

    +

    +When the connection request succeeds, the successCallback is invoked with connection information. +While connecting with ALL as a profile type, success callback will be called twice (for HSP_HFP and A2DP). +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • +ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • +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 +

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of audio profile to use for the connection. +
    • +
    • +successCallback: + Callback function that is called when an asynchronous call completes successfully. +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when an error occurs. +
    • +
    +
    +
    +

    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();
    +function onAudioConnectSuccess(address, profileType, connected)
    +{
    +  console.log("Connected device: " + address);
    +  console.log("Profile type: " + profileType);
    +  console.log("Connected: " + connected);
    +}
    +
    +function onError(e)
    +{
    +  console.log("Could not connect to audio device, reason: " + e.message);
    +}
    +
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  device.audioConnect("A2DP", onAudioConnectSuccess, onError);
    +}
    +
    +/* Execution. */
    +
    +if (adapter.powered)
    +{
    +  console.log("Bluetooth is already enabled");
    +  adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e)
    +  {
    +    console.log("Error: " + e.message);
    +  });
    +}
    +else
    +{
    +  console.log("Try to launch the Bluetooth Settings application");
    +  tizen.application.launchAppControl(
    +      bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
    +}
    +
    +
    +
    +
    +audioDisconnect +
    +
    +
    + Disconnects from a remote Bluetooth audio device with the specified audio profile type. +
    +
    void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback);
    +

    Since: + 10.1 +

    +
    +

    +This method initiates the process of terminating an audio connection to a connected remote device using the specified audio profile. +The remote device must be connected before calling this method. +

    +

    +When the disconnection request succeeds, the successCallback is invoked with connection information. +

    +

    +The ErrorCallback is launched with these error types: +

    +
      +
    • +ServiceNotAvailableError - If a Bluetooth device is turned off
    • +
    • +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 +

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of audio profile to disconnect. +
    • +
    • +successCallback [optional] [nullable]: + Callback function that is called when an asynchronous call completes successfully. +
    • +
    • +errorCallback [optional] [nullable]: + Callback function that is called when an error occurs. +
    • +
    +
    +
    +

    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();
    +function onAudioDisconnectSuccess(address, profileType, connected)
    +{
    +  console.log("Disconnected device: " + address);
    +  console.log("Profile type: " + profileType);
    +  console.log("Connected: " + connected);
    +}
    +
    +function onError(e)
    +{
    +  console.log("Could not disconnect from audio device, reason: " + e.message);
    +}
    +
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  device.audioDisconnect("A2DP", onAudioDisconnectSuccess, onError);
    +}
    +
    +/* Execution. */
    +
    +if (adapter.powered)
    +{
    +  console.log("Bluetooth is already enabled");
    +  adapter.getDevice("35:F4:59:D1:7A:03", onDeviceReady, function(e)
    +  {
    +    console.log("Error: " + e.message);
    +  });
    +}
    +else
    +{
    +  console.log("Try to launch the Bluetooth Settings application");
    +  tizen.application.launchAppControl(
    +      bluetoothSwitchAppControl, null, launchSuccess, launchError, serviceReply);
    +}
    +
    +
    +
    +
    +isProfileConnected +
    +
    +
    + Checks whether a specific Bluetooth profile is connected to the remote device. +
    +
    boolean isProfileConnected(BluetoothConnectionProfileType profileType);
    +

    Since: + 10.1 +

    +
    +

    +This method returns the connection status of the specified Bluetooth profile for the bonded remote device. +The remote device must be bonded with the local device before calling this method. +

    +
    +

    Privilege level: + public +

    +

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

    +
    +

    Parameters:

    +
      +
    • +profileType: + Type of Bluetooth profile to check. +
    • +
    +
    +
    +

    Return value:

    +
      +boolean: + true if the specified profile is connected, false otherwise. +
    +
    +
    +

    Exceptions:

    +
    • WebAPIException
        +
      • + with error type ServiceNotAvailableError, if a Bluetooth device is turned off. +

      • +
      • + 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. +

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

      • +
      +
    +
    +
    +

    Code example:

    var adapter = tizen.bluetooth.getDefaultAdapter();
    +function onDeviceReady(device)
    +{
    +  /* device needs to be bonded first */
    +  var isConnected = device.isProfileConnected("A2DP");
    +  console.log("A2DP profile connected: " + isConnected);
    +}
    +
    +/* Execution. */
    +
     if (adapter.powered)
     {
       console.log("Bluetooth is already enabled");
    @@ -8494,8 +8868,57 @@ 

    Methods

    +
    +

    2.38. BluetoothAudioSuccessCallback

    +
    + The BluetoothAudioSuccessCallback interface implements the success callback for BluetoothAdapter.audioConnect() and BluetoothAdapter.audioDisconnect(). +
    +
      [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothAudioSuccessCallback {
    +    void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
    +  };
    +

    Since: + 2.3.1 +

    +

    Remark: + Example of using can be find at audioConnect and audioDisconnect code examples. +

    +
    +

    Methods

    +
    +
    +onsuccess +
    +
    +
    + Called when the audio connect/disconnect operation is successful. +
    +
    void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
    +

    Since: + 2.3.1 +

    +
    +

    Parameters:

    +
      +
    • +address: + The MAC address of the remote device. +
    • +
    • +profileType: + The audio profile type used for the operation. +
    • +
    • +connected: + true if connected, false if disconnected. +
    • +
    +
    +
    +
    +
    +
    -

    2.38. BluetoothDeviceArraySuccessCallback

    +

    2.39. BluetoothDeviceArraySuccessCallback

    The BluetoothDeviceArraySuccessCallback interface that defines the success callback for BluetoothAdapter.getKnownDevices().
    @@ -8537,7 +8960,7 @@

    Methods

    -

    2.39. BluetoothDiscoverDevicesSuccessCallback

    +

    2.40. BluetoothDiscoverDevicesSuccessCallback

    The BluetoothDiscoverDevicesSuccessCallback interface that defines the success callback for BluetoothAdapter.discoverDevices().
    @@ -8636,7 +9059,7 @@

    Methods

    -

    2.40. BluetoothSocketSuccessCallback

    +

    2.41. BluetoothSocketSuccessCallback

    The BluetoothSocketSuccessCallback interface that defines the success method for BluetoothDevice.connectToServiceByUUID().
    @@ -8677,7 +9100,7 @@

    Methods

    -

    2.41. BluetoothServiceSuccessCallback

    +

    2.42. BluetoothServiceSuccessCallback

    The BluetoothServiceSuccessCallback interface implements the success callback for BluetoothAdapter.registerRFCOMMServiceByUUID().
    @@ -8776,6 +9199,8 @@

    4. Full WebIDL

    typedef (BluetoothGATTCharacteristic or BluetoothGATTServerCharacteristic) BluetoothGATTCharacteristicVariant; typedef (BluetoothGATTDescriptor or BluetoothGATTServerDescriptor) BluetoothGATTDescriptorVariant; enum BluetoothSocketState { "CLOSED", "OPEN" }; + enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" }; + enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" }; enum BluetoothAdvertisePacketType { "ADVERTISE", "SCAN_RESPONSE" }; enum BluetoothAdvertisingState { "STARTED", "STOPPED" }; enum BluetoothAdvertisingMode { "BALANCED", "LOW_LATENCY", "LOW_ENERGY" }; @@ -9022,6 +9447,11 @@

    4. Full WebIDL

    readonly attribute BluetoothUUID[] uuids; void connectToServiceByUUID(BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback) raises(WebAPIException); + void audioConnect(BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + void audioDisconnect(BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback) + raises(WebAPIException); + boolean isProfileConnected(BluetoothConnectionProfileType profileType) raises(WebAPIException); }; [NoInterfaceObject] interface BluetoothLEDevice { readonly attribute BluetoothAddress address; @@ -9174,6 +9604,9 @@

    4. Full WebIDL

    [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceSuccessCallback { void onsuccess(BluetoothDevice device); }; + [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothAudioSuccessCallback { + void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected); + }; [Callback=FunctionOnly, NoInterfaceObject] interface BluetoothDeviceArraySuccessCallback { void onsuccess(BluetoothDevice[] devices); }; diff --git a/docs/application/web/guides/connectivity/bluetooth.md b/docs/application/web/guides/connectivity/bluetooth.md index e9022ba2ef..63a48a2566 100755 --- a/docs/application/web/guides/connectivity/bluetooth.md +++ b/docs/application/web/guides/connectivity/bluetooth.md @@ -26,6 +26,10 @@ The main features of the Bluetooth API include: You can [connect to and exchange data with a remote Bluetooth device](#connect-to-and-exchange-data-with-a-bluetooth-device). +- Connect to a Bluetooth audio device + + You can [connect to and disconnect from a Bluetooth audio device](#connect-to-a-bluetooth-audio-device) using specific audio profiles (Tizen 10.1+). + The main Bluetooth (4.0) Low Energy features include: - Manage the local Bluetooth adapter @@ -425,6 +429,66 @@ To connect to services provided by a server device to the client devices, follow When an incoming message is received from the peer device, the `onmessage` event handler in the `BluetoothSocket` interface is triggered. +### Connect to a Bluetooth audio device + +> [!NOTE] +> This feature is supported since Tizen 10.1. + +You can connect to and disconnect from remote Bluetooth audio devices using specific audio profiles. The audio connection requires the remote device to be bonded beforehand. + +The following audio profile types are available: + +- `HSP_HFP` - Headset Profile/Hands-Free Profile (local device AG and remote device HF Client) +- `A2DP` - Advanced Audio Distribution Profile Source Connection (remote device is A2DP Sink) +- `AG` - Audio Gateway (local device HF Client and remote device AG) +- `A2DP_SINK` - Advanced Audio Distribution Profile Sink Connection (remote device is A2DP Source) +- `ALL` - All supported profiles related with audio (Both Host and Device role) + +To connect to a Bluetooth audio device, follow these steps: + +1. Retrieve a `BluetoothAdapter` object: + ```javascript + var adapter = tizen.bluetooth.getDefaultAdapter(); + ``` + +2. Define success and error callbacks for audio operations: + ```javascript + function onAudioConnectSuccess(address, profileType, connected) { + console.log('Connected to: ' + address + ', profile: ' + profileType + ', connected: ' + connected); + } + + function onError(e) { + console.log('Audio operation failed: ' + e.message); + } + ``` + +3. Connect to the audio device using `audioConnect()` with the desired profile type: + ```javascript + function onDeviceReady(device) { + device.audioConnect('A2DP', onAudioConnectSuccess, onError); + } + + adapter.getDevice('35:F4:59:D1:7A:03', onDeviceReady, onError); + ``` + +4. To disconnect from the audio device, use `audioDisconnect()`: + ```javascript + function onAudioDisconnectSuccess(address, profileType, connected) { + console.log('Disconnected from: ' + address + ', profile: ' + profileType + ', connected: ' + connected); + } + + device.audioDisconnect('A2DP', onAudioDisconnectSuccess, onError); + ``` + +5. To check if a specific profile is connected, use `isProfileConnected()`: + ```javascript + var isConnected = device.isProfileConnected('A2DP'); + console.log('A2DP profile connected: ' + isConnected); + ``` + +> [!NOTE] +> When connecting with `ALL` as the profile type, the success callback is invoked twice (once for `HSP_HFP` and once for `A2DP`). + ### Discover Bluetooth Low Energy devices To search for remote Bluetooth devices, follow these steps: @@ -1317,5 +1381,6 @@ To set a callback for read or write value request on a characteristic or a descr ## Related information - Dependencies - Tizen 6.0 and Higher for TV + - Tizen 10.1 and Higher for audio connection features * API References - [TV](../../api/latest/device_api/tv/tizen/bluetooth.html) From 83f3fa94190bf14b3fc2b9eef49b7e78e7c587f4 Mon Sep 17 00:00:00 2001 From: "Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics" Date: Fri, 28 Aug 2026 12:42:58 +0200 Subject: [PATCH 2/2] Fixed index unintended removal --- docs/application/web/api/10.1/device_api/tv/index.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/application/web/api/10.1/device_api/tv/index.html b/docs/application/web/api/10.1/device_api/tv/index.html index 3059b5f984..ab947b852d 100644 --- a/docs/application/web/api/10.1/device_api/tv/index.html +++ b/docs/application/web/api/10.1/device_api/tv/index.html @@ -201,6 +201,12 @@

    Security

    + + + + + +
    APIDescriptionVersion (Since)TVSupported on
    TV Emulator
    BluetoothDevice
    void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void audioConnect (BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void audioDisconnect (BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    + +
    BluetoothLEDevice
    BluetoothAudioSuccessCallback
    void onsuccess (BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected)
    BluetoothDeviceArraySuccessCallback
    void onsuccess (BluetoothDevice[] devices)
    BluetoothDevice
    void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void connectToServiceByUUID (BluetoothUUID uuid, BluetoothSocketSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void audioConnect (BluetoothAudioProfileType profileType, BluetoothAudioSuccessCallback successCallback, optional ErrorCallback? errorCallback)
    +
    void audioDisconnect (BluetoothAudioProfileType profileType, optional BluetoothAudioSuccessCallback? successCallback, optional ErrorCallback? errorCallback)
    + +
    BluetoothLEDevice
    BluetoothAudioSuccessCallback
    void onsuccess (BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected)
    BluetoothDeviceArraySuccessCallback
    void onsuccess (BluetoothDevice[] devices)
    Mandatory Yes
    PrivacyPrivilegeThis Privacy Privilege API defines a set of APIs that manage the permissions for using a privacy-related privileges of application.10.1MandatoryYes

    System

    APIDescriptionVersion (Since)TVSupported on
    TV Emulator