Class BluetoothDevice
Definition
- Assembly:
- Tizen.Network.Bluetooth.dll
This class is used to handle the remote Bluetooth device. This class lets you create a connection or query information about it, such as the name, address, class and service UUIDs. To get a BluetoothDevice, use BluetoothAdapter.StartDiscovery() to create one representing a device.
public class BluetoothDevice
- Inheritance
-
objectBluetoothDevice
Constructors
View SourceBluetoothDevice(string)
Constructor with remote address of the device
Declaration
public BluetoothDevice(string remoteAddress)
Parameters
| Type | Name | Description |
|---|---|---|
| string | remoteAddress |
BluetoothDevice(BluetoothLeDevice)
The constructor
Declaration
public BluetoothDevice(BluetoothLeDevice leDevice)
Parameters
| Type | Name | Description |
|---|---|---|
| BluetoothLeDevice | leDevice |
Properties
View SourceAddress
The address of the device.
Declaration
public string Address { get; }
Property Value
| Type | Description |
|---|---|
| string |
AppearanceType
The Bluetooth appearance.
Declaration
public BluetoothAppearanceType AppearanceType { get; }
Property Value
| Type | Description |
|---|---|
| BluetoothAppearanceType |
Class
The class of the device.
Declaration
public BluetoothClass Class { get; }
Property Value
| Type | Description |
|---|---|
| BluetoothClass |
IsAuthorized
The authorization state of the device.
Declaration
public bool IsAuthorized { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsConnected
The connection state of the device.
Declaration
public bool IsConnected { get; }
Property Value
| Type | Description |
|---|---|
| bool |
IsPaired
The paired state of the device.
Declaration
public bool IsPaired { get; }
Property Value
| Type | Description |
|---|---|
| bool |
ManufacturerData
The manufacturer data.
Declaration
public string ManufacturerData { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
ManufacturerDataLength
The length of the manufacturer data.
Declaration
public int ManufacturerDataLength { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Name
The name of the device.
Declaration
public string Name { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
Rssi
The strength indicator of received signal of the device.
Declaration
public int Rssi { get; }
Property Value
| Type | Description |
|---|---|
| int |
ServiceCount
The number of services.
Declaration
public int ServiceCount { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
ServiceUuidList
The service UUID list of the device.
Declaration
public IEnumerable<string> ServiceUuidList { get; set; }
Property Value
| Type | Description |
|---|---|
| IEnumerable<><string> |
Methods
View SourceCancelBonding()
Cancels the bonding process.
Declaration
public void CancelBonding()
Remarks
Bonding must be in progress by CreateBond().
CreateBond()
Creates a bond with the remote Bluetooth device.
Declaration
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.
CreateSocket(string)
Creates the client socket.
Declaration
public IBluetoothClientSocket CreateSocket(string serviceUuid)
Parameters
| Type | Name | Description |
|---|---|---|
| string | serviceUuid | The UUID of the service. |
Returns
| Type | Description |
|---|---|
| IBluetoothClientSocket | The IBluetoothClientSocket instance. |
DestroyBond()
Destroys the bond.
Declaration
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.
GetConnectedProfiles()
Gets the connected profiles.
Declaration
public IEnumerable<BluetoothProfileType> GetConnectedProfiles()
Returns
| Type | Description |
|---|---|
| IEnumerable<><BluetoothProfileType> | The connected Bluetooth profiles. |
Remarks
The Bluetooth must be enabled.
GetMaskFromUuid(string[])
Gets the mask from the UUID.
Declaration
public BluetoothServiceClassType GetMaskFromUuid(string[] uuids)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | uuids | The UUID list of the device. |
Returns
| Type | Description |
|---|---|
| BluetoothServiceClassType | The service mask list converted from the given UUID list. |
GetProfile<T>()
Returns the instance of the Bluetooth profile type.
Declaration
public T GetProfile<T>() where T : BluetoothProfile
Returns
| Type | Description |
|---|---|
| T | The profile instance. |
Type Parameters
| Name | Description |
|---|---|
| T |
Remarks
The Bluetooth must be enabled.
IsProfileConnected(BluetoothProfileType)
Determines if profile is connected to the specified remote device.
Declaration
public bool IsProfileConnected(BluetoothProfileType profileType)
Parameters
| Type | Name | Description |
|---|---|---|
| BluetoothProfileType | profileType | The Bluetooth profile type. |
Returns
| Type | Description |
|---|---|
| bool |
|
Remarks
The Bluetooth must be enabled.
SetAlias(string)
Sets an alias for the bonded device.
Declaration
public void SetAlias(string aliasName)
Parameters
| Type | Name | Description |
|---|---|---|
| string | aliasName | The alias name of the remote device. |
Remarks
The Bluetooth must be enabled and the bond must be created by CreateBond().
SetAuthorization(BluetoothAuthorizationType)
Sets the authorization of a bonded device.
Declaration
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.
StartServiceSearch()
Starts the search for services supported by the specified device.
Declaration
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.
Events
View SourceAuthorizationChanged
The AuthorizationChanged event is raised when the authorization of the device is changed.
Declaration
public event EventHandler<AuthorizationChangedEventArgs> AuthorizationChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><AuthorizationChangedEventArgs> |
BondCreated
The BondCreated event is raised when the process of creating the bond is finished.
Declaration
public event EventHandler<BondCreatedEventArgs> BondCreated
Event Type
| Type | Description |
|---|---|
| EventHandler<><BondCreatedEventArgs> |
BondDestroyed
The BondDestroyed event is raised when the bond is destroyed.
Declaration
public event EventHandler<BondDestroyedEventArgs> BondDestroyed
Event Type
| Type | Description |
|---|---|
| EventHandler<><BondDestroyedEventArgs> |
ConnectionStateChanged
The ConnectionStateChanged event is raised when the connection state is changed.
Declaration
public event EventHandler<DeviceConnectionStateChangedEventArgs> ConnectionStateChanged
Event Type
| Type | Description |
|---|---|
| EventHandler<><DeviceConnectionStateChangedEventArgs> |
ServiceSearched
The ServiceSearched event is raised when the process of service searched is finished.
Declaration
public event EventHandler<ServiceSearchedEventArgs> ServiceSearched
Event Type
| Type | Description |
|---|---|
| EventHandler<><ServiceSearchedEventArgs> |