From 05cd9bed106164810b92cc072efd389836083750 Mon Sep 17 00:00:00 2001 From: "Piotr Kosko/Tizen API (PLT) /SRPOL/Engineer/Samsung Electronics"
enum BluetoothAudioProfileType { "HSP_HFP", "A2DP", "AG", "A2DP_SINK", "ALL" };
+Since: + 1.0 +
+ enum BluetoothConnectionProfileType { "RFCOMM", "A2DP", "HSP", "HID", "NAP", "AG", "GATT", "NAP_SERVER", "A2DP_SINK" };
+Since: + 10.1 +
+Since: 1.0 @@ -6270,6 +6348,302 @@
audioConnect
+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: +
+Privilege level: + public +
+Privilege: + http://tizen.org/privilege/bluetooth +
+Parameters:
+Exceptions:
++ 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
+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: +
+Privilege level: + public +
+Privilege: + http://tizen.org/privilege/bluetooth +
+Parameters:
+Exceptions:
++ 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
+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:
+Return value:
+Exceptions:
++ 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
[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. +
+onsuccess
+void onsuccess(BluetoothAddress address, BluetoothAudioProfileType profileType, boolean connected);
Since: + 1.0 +
+Parameters:
+| API | Description | Version (Since) | TV | Supported 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)
+boolean isProfileConnected (BluetoothConnectionProfileType profileType)
+ |
||
| BluetoothLEDevice | @@ -414,6 +427,10 @@void onsuccess (BluetoothDevice device) |
|||
| BluetoothAudioSuccessCallback | ++ | |||
| 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)
+boolean isProfileConnected (BluetoothConnectionProfileType profileType)
+ |
||
| BluetoothLEDevice | @@ -414,6 +427,10 @@void onsuccess (BluetoothDevice device) |
|||
| BluetoothAudioSuccessCallback | ++ | |||
| BluetoothDeviceArraySuccessCallback | void onsuccess (BluetoothDevice[] devices) |
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 | +
| API | Description | Version (Since) | TV | Supported on TV Emulator |
|---|