Class BluetoothAdapter

Definition

Namespace:
Tizen.Network.Bluetooth
Assembly:
Tizen.Network.Bluetooth.dll
API Level:
3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth

This class is used to control the Bluetooth adapter and get the list of bonded devices.
The BluetoothAdapter class is used to discover neighbouring bluetooth devices.

C#
Copy
public static class BluetoothAdapter : object
Inheritance
BluetoothAdapter

Properties

View Source

Address

The local adapter address.

Declaration
C#
Copy
public static string Address { get; }
Property Value
Type Description
String
Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

IsBluetoothEnabled

A property to check whether the Bluetooth is enabled.

Declaration
C#
Copy
public static bool IsBluetoothEnabled { get; }
Property Value
Type Description
Boolean
API Level: 3
View Source

IsDiscoveryInProgress

A property to check whether the device discovery process is in progress.

Declaration
C#
Copy
public static bool IsDiscoveryInProgress { get; }
Property Value
Type Description
Boolean
Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

Name

The name of the local adapter.

Declaration
C#
Copy
public static string Name { get; set; }
Property Value
Type Description
String
Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

RemainingTimeAsVisible

The remaining time, in seconds, until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable.

Declaration
C#
Copy
public static int RemainingTimeAsVisible { get; }
Property Value
Type Description
Int32
Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

Visibility

The visibility mode of the Bluetooth adapter.

Declaration
C#
Copy
public static VisibilityMode Visibility { get; }
Property Value
Type Description
VisibilityMode
Remarks

The Bluetooth must be enabled.

API Level: 3

Methods

View Source

CreateServerSocket(String)

Registers a rfcomm server socket with a specific UUID.

Declaration
C#
Copy
public static BluetoothServerSocket CreateServerSocket(string serviceUuid)
Parameters
Type Name Description
String serviceUuid

The UUID of service to provide.

Returns
Type Description
BluetoothServerSocket

The BluetoothServerSocket instance.

Remarks

The Bluetooth must be enabled before calling this API.

API Level: 3
View Source

DestroyServerSocket(BluetoothServerSocket)

Removes the rfcomm server socket which was created using CreateServerSocket().

Declaration
C#
Copy
public static void DestroyServerSocket(BluetoothServerSocket socket)
Parameters
Type Name Description
BluetoothServerSocket socket

The server socket instance is created using CreateServerSocket().

Remarks

The socket must be created with CreateServerSocket(). The ConnectionStateChanged event is raised after this API is called.

API Level: 3
View Source

Disable()

Disables the local Bluetooth adapter asynchronously.

Declaration
C#
Copy
public static void Disable()
API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/bluetooth.admin
Feature: http://tizen.org/feature/network.bluetooth
View Source

DisableDiscoverable()

Disables the discoverable mode.

Declaration
C#
Copy
public static void DisableDiscoverable()
API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/bluetooth.admin
Feature: http://tizen.org/feature/network.bluetooth
View Source

Enable()

Enables the local Bluetooth adapter asynchronously.

Declaration
C#
Copy
public static void Enable()
API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/bluetooth.admin
Feature: http://tizen.org/feature/network.bluetooth
View Source

EnableDiscoverable()

Enables the discoverable mode.

Declaration
C#
Copy
public static void EnableDiscoverable()
API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/bluetooth.admin
Feature: http://tizen.org/feature/network.bluetooth
View Source

EnableDiscoverable(Int32)

Enables the discoverable mode for the duration.

Declaration
C#
Copy
public static void EnableDiscoverable(int duration)
Parameters
Type Name Description
Int32 duration

The duration until the discoverable mode is to be disabled(in seconds).

API Level: 6
Privilege Level: public
Privilege: http://tizen.org/privilege/bluetooth.admin
Feature: http://tizen.org/feature/network.bluetooth
View Source

GetBluetoothLeAdvertiser()

Returns the BluetoothLeAdvertiser instance.

Declaration
C#
Copy
public static BluetoothLeAdvertiser GetBluetoothLeAdvertiser()
Returns
Type Description
BluetoothLeAdvertiser

The BluetoothLeAdvertiser instance.

Remarks

The Bluetooth must be enabled before calling this API.

API Level: 3
View Source

GetBondedDevice(String)

Gets the device information of a bonded device.

Declaration
C#
Copy
public static BluetoothDevice GetBondedDevice(string address)
Parameters
Type Name Description
String address

The remote device address.

Returns
Type Description
BluetoothDevice

Information of the bonded BluetoothDeviceInfo object.

Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

GetBondedDevices()

Retrieves the device information of all bonded devices.

Declaration
C#
Copy
public static IEnumerable<BluetoothDevice> GetBondedDevices()
Returns
Type Description
IEnumerable<BluetoothDevice>

The list of the bonded BluetoothDeviceInfo objects.

Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

GetLocalOobData()

Gets the hash and the randomizer value of the local OOB data object.

Declaration
C#
Copy
public static BluetoothOobData GetLocalOobData()
Returns
Type Description
BluetoothOobData

The BluetoothOobData object.

Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

GetUuidSpecificationName(String)

Gets the name of the specification UUID.

Declaration
C#
Copy
public static string GetUuidSpecificationName(string uuid)
Parameters
Type Name Description
String uuid

The UUID.

Returns
Type Description
String
API Level: 9
View Source

IsServiceUsed(String)

Checks whether the UUID of service is used or not.

Declaration
C#
Copy
public static bool IsServiceUsed(string serviceUuid)
Parameters
Type Name Description
String serviceUuid

The UUID of Service.

Returns
Type Description
Boolean

true if the specified serviceUuid is used, otherwise false.

API Level: 3
View Source

RemoveRemoteOobData(String)

Removes the hash and the randomizer value of the OOB data from the remote device.

Declaration
C#
Copy
public static void RemoveRemoteOobData(string address)
Parameters
Type Name Description
String address

The remote device address.

Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

SelectRole(BluetoothAudioRole)

Select the A2DP source/sink role.

Declaration
C#
Copy
public static void SelectRole(BluetoothAudioRole role)
Parameters
Type Name Description
BluetoothAudioRole role

The A2DP source/sink role.

API Level: 9
Privilege Level: public
Privilege: http://tizen.org/privilege/bluetooth
Feature: http://tizen.org/feature/network.bluetoothhttp://tizen.org/feature/network.bluetooth.audio.callhttp://tizen.org/feature/network.bluetooth.audio.media
View Source

SetRemoteOobData(String, BluetoothOobData)

Sets the hash and the randmoizer value of the OOB data into the remote device.

Declaration
C#
Copy
public static void SetRemoteOobData(string address, BluetoothOobData oobData)
Parameters
Type Name Description
String address

The remote device address.

BluetoothOobData oobData

The BluetoothOobData object.

Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

StartDiscovery()

Starts the device discovery process.

Declaration
C#
Copy
public static void StartDiscovery()
Remarks

The Bluetooth must be enabled and the device discovery process can be stopped by StopDiscovery(). If this succeeds, the DiscoveryStateChanged event will be invoked.

API Level: 3
View Source

StartLeScan()

Starts the Bluetooth LE scan operation to discover BLE devices

Declaration
C#
Copy
public static void StartLeScan()
Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

StartLeScan(BluetoothLeScanMode)

Starts the Bluetooth LE scan operation with scan mode.

Declaration
C#
Copy
public static void StartLeScan(BluetoothLeScanMode mode)
Parameters
Type Name Description
BluetoothLeScanMode mode

The LE scan mode.

Remarks

The Bluetooth must be enabled.

API Level: 7
Feature: http://tizen.org/feature/network.bluetooth.le
View Source

StopDiscovery()

Stops the device discovery process.

Declaration
C#
Copy
public static void StopDiscovery()
Remarks

The device discovery process must be in progress with StartDiscovery(). If this succeeds, the DiscoveryStateChanged event will be invoked.

API Level: 3
View Source

StopLeScan()

Stops the Bluetooth LE scan operation.

Declaration
C#
Copy
public static void StopLeScan()
Remarks

The Bluetooth must be enabled.

API Level: 3

Events

View Source

DiscoveryStateChanged

The DiscoveryStateChanged event is raised when the device discovery state is changed.

Declaration
C#
Copy
public static event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
Event Type
Type Description
EventHandler<DiscoveryStateChangedEventArgs>
API Level: 3
View Source

NameChanged

The NameChanged event is raised when the Bluetooth adapter name is changed.

Declaration
C#
Copy
public static event EventHandler<NameChangedEventArgs> NameChanged
Event Type
Type Description
EventHandler<NameChangedEventArgs>
API Level: 3
View Source

ScanResultChanged

This event is called when the LE scan result is obtained.

Declaration
C#
Copy
public static event EventHandler<AdapterLeScanResultChangedEventArgs> ScanResultChanged
Event Type
Type Description
EventHandler<AdapterLeScanResultChangedEventArgs>
API Level: 3
View Source

StateChanged

The StateChanged event is raised when the Bluetooth adapter state is changed.

Declaration
C#
Copy
public static event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type Description
EventHandler<StateChangedEventArgs>
API Level: 3
View Source

VisibilityDurationChanged

The VisibilityDurationChanged event is raised very second until the visibility mode is changed to NonDiscoverable.

Declaration
C#
Copy
public static event EventHandler<VisibilityDurationChangedEventArgs> VisibilityDurationChanged
Event Type
Type Description
EventHandler<VisibilityDurationChangedEventArgs>
API Level: 3
View Source

VisibilityModeChanged

The VisibilityModeChanged event is raised when the Bluetooth adapter visibility mode is changed.

Declaration
C#
Copy
public static event EventHandler<VisibilityModeChangedEventArgs> VisibilityModeChanged
Event Type
Type Description
EventHandler<VisibilityModeChangedEventArgs>
API Level: 3