Class BluetoothDevice

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 handle the connection with other devices and set authorization of other devices.
The BluetoothDevice class is used to search for services available on remote devices.

C#
Copy
public class BluetoothDevice
Inheritance
BluetoothDevice

Properties

View Source

Address

The address of the device.

Declaration
C#
Copy
public string Address { get; }
Property Value
Type Description
System.String
API Level: 3
View Source

AppearanceType

The Bluetooth appearance.

Declaration
C#
Copy
public BluetoothAppearanceType AppearanceType { get; }
Property Value
Type Description
BluetoothAppearanceType
API Level: 3
View Source

Class

The class of the device.

Declaration
C#
Copy
public BluetoothClass Class { get; }
Property Value
Type Description
BluetoothClass
API Level: 3
View Source

IsAuthorized

The authorization state of the device.

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

IsConnected

The connection state of the device.

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

IsPaired

The paired state of the device.

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

ManufacturerData

The manufacturer data.

Declaration
C#
Copy
public string ManufacturerData { get; }
Property Value
Type Description
System.String
API Level: 3
View Source

ManufacturerDataLength

The length of the manufacturer data.

Declaration
C#
Copy
public int ManufacturerDataLength { get; }
Property Value
Type Description
System.Int32
API Level: 3
View Source

Name

The name of the device.

Declaration
C#
Copy
public string Name { get; }
Property Value
Type Description
System.String
API Level: 3
View Source

Rssi

The strength indicator of received signal of the device.

Declaration
C#
Copy
public int Rssi { get; }
Property Value
Type Description
System.Int32
API Level: 3
View Source

ServiceCount

The number of services.

Declaration
C#
Copy
public int ServiceCount { get; }
Property Value
Type Description
System.Int32
API Level: 3
View Source

ServiceUuidList

The service UUID list of the device.

Declaration
C#
Copy
public IEnumerable<string> ServiceUuidList { get; }
Property Value
Type Description
System.Collections.Generic.IEnumerable<System.String>
API Level: 3

Methods

View Source

CancelBonding()

Cancels the bonding process.

Declaration
C#
Copy
public void CancelBonding()
Remarks

Bonding must be in progress by CreateBond().

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the cancel bonding procedure to remote device fails.

API Level: 3
View Source

CreateBond()

Creates a bond with the remote Bluetooth device.

Declaration
C#
Copy
public void CreateBond()
Remarks

The Bluetooth must be enabled and the remote device must be discoverable by StartDiscovery(). The bond can be destroyed by DestroyBond(). The bonding request can be cancelled by CancelBonding(). If this succeeds, the BondCreated event will be invoked.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the create bonding process to the remote device fails.

API Level: 3
View Source

CreateSocket(String)

Creates the client socket.

Declaration
C#
Copy
public IBluetoothClientSocket CreateSocket(string serviceUuid)
Parameters
Type Name Description
System.String serviceUuid

The UUID of the service.

Returns
Type Description
IBluetoothClientSocket

The IBluetoothClientSocket instance.

API Level: 3
View Source

DestroyBond()

Destroys the bond.

Declaration
C#
Copy
public void DestroyBond()
Remarks

The Bluetooth must be enabled and the bond must be created by CreateBond(). If this succeeds, the BondDestroyed event will be invoked.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the destroy bonding procedure fails.

API Level: 3
View Source

GetConnectedProfiles()

Gets the connected profiles.

Declaration
C#
Copy
public IEnumerable<BluetoothProfileType> GetConnectedProfiles()
Returns
Type Description
System.Collections.Generic.IEnumerable<BluetoothProfileType>

The connected Bluetooth profiles.

Remarks

The Bluetooth must be enabled.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when there is no BT connection.

API Level: 3
View Source

GetMaskFromUuid(String[])

Gets the mask from the UUID.

Declaration
C#
Copy
public BluetoothServiceClassType GetMaskFromUuid(string[] uuids)
Parameters
Type Name Description
System.String[] uuids

The UUID list of the device.

Returns
Type Description
BluetoothServiceClassType

The service mask list converted from the given UUID list.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the get Mask from UUID fails.

API Level: 3
View Source

GetProfile<T>()

Returns the instance of the Bluetooth profile type.

Declaration
C#
Copy
public T GetProfile<T>() where T : BluetoothProfile
Returns
Type Description
T
Type Parameters
Name Description
T
Remarks

The Bluetooth must be enabled.

API Level: 3
View Source

IsProfileConnected(BluetoothProfileType)

Determines if profile is connected to the specified remote device.

Declaration
C#
Copy
public bool IsProfileConnected(BluetoothProfileType profileType)
Parameters
Type Name Description
BluetoothProfileType profileType

The Bluetooth profile type.

Returns
Type Description
Boolean

true if profile is connected, otherwise false.

Remarks

The Bluetooth must be enabled.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when there is no BT connection.

API Level: 3
View Source

SetAlias(String)

Sets an alias for the bonded device.

Declaration
C#
Copy
public void SetAlias(string aliasName)
Parameters
Type Name Description
System.String aliasName

The alias name of the remote device.

Remarks

The Bluetooth must be enabled and the bond must be created by CreateBond().

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the set alias name to remote device fails.

API Level: 3
View Source

SetAuthorization(BluetoothAuthorizationType)

Sets the authorization of a bonded device.

Declaration
C#
Copy
public void SetAuthorization(BluetoothAuthorizationType authorizationState)
Parameters
Type Name Description
BluetoothAuthorizationType authorizationState

The authorization state.

Remarks

The Bluetooth must be enabled and the bond must be created by CreateBond(). If this succeeds, the AuthorizationChanged event will be invoked.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the set authorization to remote device fails.

API Level: 3
View Source

StartServiceSearch()

Starts the search for services supported by the specified device.

Declaration
C#
Copy
public void StartServiceSearch()
Remarks

The Bluetooth must be enabled and remote device must be discoverable by StartDiscovery(). The bond must be created by CreateBond(). If this succeeds, the ServiceSearched event will be invoked.

Exceptions
Type Condition
System.InvalidOperationException

Thrown when the BT/BTLE is not enabled or when the remote device service search fails.

API Level: 3

Events

View Source

AuthorizationChanged

The AuthorizationChanged event is raised when the authorization of the device is changed.

Declaration
C#
Copy
public event EventHandler<AuthorizationChangedEventArgs> AuthorizationChanged
Event Type
Type Description
System.EventHandler<AuthorizationChangedEventArgs>
API Level: 3
View Source

BondCreated

The BondCreated event is raised when the process of creating the bond is finished.

Declaration
C#
Copy
public event EventHandler<BondCreatedEventArgs> BondCreated
Event Type
Type Description
System.EventHandler<BondCreatedEventArgs>
API Level: 3
View Source

BondDestroyed

The BondDestroyed event is raised when the bond is destroyed.

Declaration
C#
Copy
public event EventHandler<BondDestroyedEventArgs> BondDestroyed
Event Type
Type Description
System.EventHandler<BondDestroyedEventArgs>
API Level: 3
View Source

ConnectionStateChanged

The ConnectionStateChanged event is raised when the connection state is changed.

Declaration
C#
Copy
public event EventHandler<DeviceConnectionStateChangedEventArgs> ConnectionStateChanged
Event Type
Type Description
System.EventHandler<DeviceConnectionStateChangedEventArgs>
API Level: 3
View Source

ServiceSearched

The ServiceSearched event is raised when the process of service searched is finished.

Declaration
C#
Copy
public event EventHandler<ServiceSearchedEventArgs> ServiceSearched
Event Type
Type Description
System.EventHandler<ServiceSearchedEventArgs>
API Level: 3