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#Copypublic static class BluetoothAdapter
- Inheritance
-
System.ObjectBluetoothAdapter
Properties
Declaration
C#Copypublic static string Address { get; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
Declaration
C#Copypublic static bool IsBluetoothEnabled { get; }
Property Value
Type | Description |
---|---|
Boolean |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
IsDiscoveryInProgress
A property to check whether the device discovery process is in progress.
Declaration
C#Copypublic static bool IsDiscoveryInProgress { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
Declaration
C#Copypublic static string Name { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
RemainingTimeAsVisible
The remaining time, in seconds, until the visibility mode is changed from TimeLimitedDiscoverable to NonDiscoverable.
Declaration
C#Copypublic static int RemainingTimeAsVisible { get; }
Property Value
Type | Description |
---|---|
Int32 |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
Declaration
C#Copypublic static VisibilityMode Visibility { get; }
Property Value
Type | Description |
---|---|
VisibilityMode |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
Methods
Declaration
C#Copypublic static BluetoothServerSocket CreateServerSocket(string serviceUuid)
Parameters
Type | Name | Description |
---|---|---|
System.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.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or the socket create error occurs. |
API Level: 3
DestroyServerSocket(BluetoothServerSocket)
Removes the rfcomm server socket which was created using CreateServerSocket().
Declaration
C#Copy[Obsolete("Deprecated since API level 6. Please use Dispose() on BluetoothServerSocket.")] 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.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or the socket destroy error occurs. |
API Level: 3
Declaration
C#Copypublic static BluetoothLeAdvertiser GetBluetoothLeAdvertiser()
Returns
Type | Description |
---|---|
BluetoothLeAdvertiser | The BluetoothLeAdvertiser instance. |
Remarks
The Bluetooth must be enabled before calling this API.
API Level: 3
Declaration
C#Copypublic static BluetoothDevice GetBondedDevice(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The remote device address. |
Returns
Type | Description |
---|---|
BluetoothDevice | Information of the bonded BluetoothDeviceInfo object. |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or reading the bonded device information fails. |
API Level: 3
Declaration
C#Copypublic static IEnumerable<BluetoothDevice> GetBondedDevices()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<BluetoothDevice> | The list of the bonded BluetoothDeviceInfo objects. |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or reading the Bonded devices list is failed. |
API Level: 3
Declaration
C#Copypublic static BluetoothOobData GetLocalOobData()
Returns
Type | Description |
---|---|
BluetoothOobData | The BluetoothOobData object. |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or the read OObData procedure is failed. |
API Level: 3
Declaration
C#Copypublic static bool IsServiceUsed(string serviceUuid)
Parameters
Type | Name | Description |
---|---|---|
System.String | serviceUuid | The UUID of Service. |
Returns
Type | Description |
---|---|
Boolean |
|
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
RemoveRemoteOobData(String)
Removes the hash and the randomizer value of the OOB data from the remote device.
Declaration
C#Copypublic static void RemoveRemoteOobData(string address)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The remote device address. |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. or if the Remove Oobdata procedure is failed. |
API Level: 3
SetRemoteOobData(String, BluetoothOobData)
Sets the hash and the randmoizer value of the OOB data into the remote device.
Declaration
C#Copypublic static void SetRemoteOobData(string address, BluetoothOobData oobData)
Parameters
Type | Name | Description |
---|---|---|
System.String | address | The remote device address. |
BluetoothOobData | oobData | The BluetoothOobData object. |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or the set OobData procedure is failed. |
API Level: 3
Declaration
C#Copypublic 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.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or the start discovery fails. |
API Level: 3
Declaration
C#Copypublic static void StartLeScan()
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth LE is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth LE is not enabled or the Start LE scan is failed. |
API Level: 3
Declaration
C#Copypublic static void StartLeScan(BluetoothLeScanMode mode)
Parameters
Type | Name | Description |
---|---|---|
BluetoothLeScanMode | mode | The LE scan mode. |
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth LE is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth LE is not enabled or the Start LE scan is failed. |
API Level: 7
Feature: http://tizen.org/feature/network.bluetooth.le
Declaration
C#Copypublic static void StopDiscovery()
Remarks
The device discovery process must be in progress with StartDiscovery(). If this succeeds, the DiscoveryStateChanged event will be invoked.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled or the discovery process is not is progress. |
API Level: 3
Declaration
C#Copypublic static void StopLeScan()
Remarks
The Bluetooth must be enabled.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth LE is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth LE is not enabled or the Stop LE scan is failed. |
API Level: 3
Events
DiscoveryStateChanged
The DiscoveryStateChanged event is raised when the device discovery state is changed.
Declaration
C#Copypublic static event EventHandler<DiscoveryStateChangedEventArgs> DiscoveryStateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<DiscoveryStateChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
Declaration
C#Copypublic static event EventHandler<NameChangedEventArgs> NameChanged
Event Type
Type | Description |
---|---|
System.EventHandler<NameChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
Declaration
C#Copypublic static event EventHandler<AdapterLeScanResultChangedEventArgs> ScanResultChanged
Event Type
Type | Description |
---|---|
System.EventHandler<AdapterLeScanResultChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
StateChanged
The StateChanged event is raised when the Bluetooth adapter state is changed.
Declaration
C#Copypublic static event EventHandler<StateChangedEventArgs> StateChanged
Event Type
Type | Description |
---|---|
System.EventHandler<StateChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
VisibilityDurationChanged
The VisibilityDurationChanged event is raised very second until the visibility mode is changed to NonDiscoverable.
Declaration
C#Copypublic static event EventHandler<VisibilityDurationChangedEventArgs> VisibilityDurationChanged
Event Type
Type | Description |
---|---|
System.EventHandler<VisibilityDurationChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |
API Level: 3
VisibilityModeChanged
The VisibilityModeChanged event is raised when the Bluetooth adapter visibility mode is changed.
Declaration
C#Copypublic static event EventHandler<VisibilityModeChangedEventArgs> VisibilityModeChanged
Event Type
Type | Description |
---|---|
System.EventHandler<VisibilityModeChangedEventArgs> |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the Bluetooth is not supported. |
System.InvalidOperationException | Thrown when the Bluetooth is not enabled. |