Class BluetoothAdapter
Definition
- Assembly:
- Tizen.Network.Bluetooth.dll
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.
public static class BluetoothAdapter
- Inheritance
-
objectBluetoothAdapter
Properties
View SourceAddress
The local adapter address.
Declaration
public static string Address { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The Bluetooth must be enabled.
IsBluetoothEnabled
A property to check whether the Bluetooth is enabled.
Declaration
public static bool IsBluetoothEnabled { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsDiscoveryInProgress
A property to check whether the device discovery process is in progress.
Declaration
public static bool IsDiscoveryInProgress { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Remarks
The Bluetooth must be enabled.
Name
The name of the local adapter.
Declaration
public static string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
The Bluetooth must be enabled.
RemainingTimeAsVisible
The remaining time, in seconds, until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable.
Declaration
public static int RemainingTimeAsVisible { get; }
Property Value
| Type | Description |
|---|---|
| int |
Remarks
The Bluetooth must be enabled.
Visibility
The visibility mode of the Bluetooth adapter.
Declaration
public static VisibilityMode Visibility { get; }
Property Value
| Type | Description |
|---|---|
| VisibilityMode |
Remarks
The Bluetooth must be enabled.
Methods
View SourceCreateServerSocket(string)
Registers a rfcomm server socket with a specific UUID.
Declaration
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.
DestroyServerSocket(BluetoothServerSocket)
Removes the rfcomm server socket which was created using CreateServerSocket().
Declaration
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.
Disable()
Disables the local Bluetooth adapter asynchronously.
Declaration
public static void Disable()
DisableDiscoverable()
Disables the discoverable mode.
Declaration
public static void DisableDiscoverable()
Enable()
Enables the local Bluetooth adapter asynchronously.
Declaration
public static void Enable()
EnableDiscoverable()
Enables the discoverable mode.
Declaration
public static void EnableDiscoverable()
EnableDiscoverable(int)
Enables the discoverable mode for the duration.
Declaration
public static void EnableDiscoverable(int duration)
Parameters
| Type | Name | Description |
|---|---|---|
| int | duration | The duration until the discoverable mode is to be disabled(in seconds). |
GetBluetoothLeAdvertiser()
Returns the BluetoothLeAdvertiser instance.
Declaration
public static BluetoothLeAdvertiser GetBluetoothLeAdvertiser()
Returns
| Type | Description |
|---|---|
| BluetoothLeAdvertiser | The BluetoothLeAdvertiser instance. |
Remarks
The Bluetooth must be enabled before calling this API.
GetBondedDevice(string)
Gets the device information of a bonded device.
Declaration
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.
GetBondedDevices()
Retrieves the device information of all bonded devices.
Declaration
public static IEnumerable<BluetoothDevice> GetBondedDevices()
Returns
| Type | Description |
|---|---|
| IEnumerable<><BluetoothDevice> | The list of the bonded BluetoothDeviceInfo objects. |
Remarks
The Bluetooth must be enabled.
GetLocalOobData()
Gets the hash and the randomizer value of the local OOB data object.
Declaration
public static BluetoothOobData GetLocalOobData()
Returns
| Type | Description |
|---|---|
| BluetoothOobData | The BluetoothOobData object. |
Remarks
The Bluetooth must be enabled.
GetUuidSpecificationName(string)
Gets the name of the specification UUID.
Declaration
public static string GetUuidSpecificationName(string uuid)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uuid | The UUID. |
Returns
| Type | Description |
|---|---|
| string |
IsServiceUsed(string)
Checks whether the UUID of service is used or not.
Declaration
public static bool IsServiceUsed(string serviceUuid)
Parameters
| Type | Name | Description |
|---|---|---|
| string | serviceUuid | The UUID of Service. |
Returns
| Type | Description |
|---|---|
| bool |
|
RemoveRemoteOobData(string)
Removes the hash and the randomizer value of the OOB data from the remote device.
Declaration
public static void RemoveRemoteOobData(string address)
Parameters
| Type | Name | Description |
|---|---|---|
| string | address | The remote device address. |
Remarks
The Bluetooth must be enabled.
SelectRole(BluetoothAudioRole)
Select the A2DP source/sink role.
Declaration
public static void SelectRole(BluetoothAudioRole role)
Parameters
| Type | Name | Description |
|---|---|---|
| BluetoothAudioRole | role | The A2DP source/sink role. |
SetRemoteOobData(string, BluetoothOobData)
Sets the hash and the randmoizer value of the OOB data into the remote device.
Declaration
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.
StartDiscovery()
Starts the device discovery process.
Declaration
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.
StartLeScan()
Starts the Bluetooth LE scan operation to discover BLE devices
Declaration
public static void StartLeScan()
Remarks
The Bluetooth must be enabled.
StartLeScan(BluetoothLeScanMode)
Starts the Bluetooth LE scan operation with scan mode.
Declaration
public static void StartLeScan(BluetoothLeScanMode mode)
Parameters
| Type | Name | Description |
|---|---|---|
| BluetoothLeScanMode | mode | The LE scan mode. |
Remarks
The Bluetooth must be enabled.
StopDiscovery()
Stops the device discovery process.
Declaration
public static void StopDiscovery()
Remarks
The device discovery process must be in progress with StartDiscovery(). If this succeeds, the DiscoveryStateChanged event will be invoked.
StopLeScan()
Stops the Bluetooth LE scan operation.
Declaration
public static void StopLeScan()
Remarks
The Bluetooth must be enabled.
Events
View SourceAuthenticationChanged
The AuthenticationChanged event is raised when the Bluetooth adapter authentication is changed.
Declaration
public static event EventHandler<AuthenticationRequestedEventArgs> AuthenticationChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><AuthenticationRequestedEventArgs> |
DiscoveryStateChanged
The DiscoveryStateChanged event is raised when the device discovery state is changed.
Declaration
public static event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><DiscoveryStateChangedEventArgs> |
NameChanged
The NameChanged event is raised when the Bluetooth adapter name is changed.
Declaration
public static event EventHandler<NameChangedEventArgs> NameChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><NameChangedEventArgs> |
ScanResultChanged
This event is called when the LE scan result is obtained.
Declaration
public static event EventHandler<AdapterLeScanResultChangedEventArgs> ScanResultChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><AdapterLeScanResultChangedEventArgs> |
StateChanged
The StateChanged event is raised when the Bluetooth adapter state is changed.
Declaration
public static event EventHandler<StateChangedEventArgs> StateChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><StateChangedEventArgs> |
VisibilityDurationChanged
The VisibilityDurationChanged event is raised very second until the visibility mode is changed to NonDiscoverable.
Declaration
public static event EventHandler<VisibilityDurationChangedEventArgs> VisibilityDurationChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><VisibilityDurationChangedEventArgs> |
VisibilityModeChanged
The VisibilityModeChanged event is raised when the Bluetooth adapter visibility mode is changed.
Declaration
public static event EventHandler<VisibilityModeChangedEventArgs> VisibilityModeChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><VisibilityModeChangedEventArgs> |