Class BluetoothGattClient
Definition
- Assembly:
- Tizen.Network.Bluetooth.dll
The Bluetooth GATT client.
public class BluetoothGattClient : IDisposable
- Inheritance
-
objectBluetoothGattClient
Properties
View SourceRemoteAddress
The address of the remote device.
Declaration
public string RemoteAddress { get; }
Property Value
Type | Description |
---|---|
string |
Methods
View SourceConnectAsync(bool)
Connects to the remote GATT server asynchronously.
Declaration
public Task ConnectAsync(bool autoConnect)
Parameters
Type | Name | Description |
---|---|---|
bool | autoConnect | The flag for reconnecting when the connection is disconnceted. |
Returns
Type | Description |
---|---|
Task | A task indicating whether the method is done or not. |
CreateClient(string)
Creates the Bluetooth GATT client.
Declaration
public static BluetoothGattClient CreateClient(string remoteAddress)
Parameters
Type | Name | Description |
---|---|---|
string | remoteAddress | The remote device address. |
Returns
Type | Description |
---|---|
BluetoothGattClient | The BluetoothGattClient instance. |
DestroyClient()
Destroy Bluetooth GATT client
Declaration
public void DestroyClient()
DisconnectAsync()
Disconnects to the remote GATT server asynchronously.
Declaration
public Task DisconnectAsync()
Returns
Type | Description |
---|---|
Task | A task indicating whether the method is done or not. |
Dispose()
Destroys the current object.
Declaration
public void Dispose()
Dispose(bool)
Releases all the resources currently used by this instance.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
bool | disposing | true if the managed resources should be disposed, otherwise false. |
~BluetoothGattClient()
Destroys the current object.
Declaration
protected ~BluetoothGattClient()
GetAttMtu()
Gets the value of the ATT MTU(Maximum Transmission Unit) for the connection.
Declaration
public int GetAttMtu()
Returns
Type | Description |
---|---|
int | The MTU value |
GetService(string)
Gets the service with the given UUID that belongs to the remote device.
Declaration
public BluetoothGattService GetService(string uuid)
Parameters
Type | Name | Description |
---|---|---|
string | uuid | The UUID for the service to get. |
Returns
Type | Description |
---|---|
BluetoothGattService | The service with the given UUID if it exists, null otherwise. |
GetServices()
Gets list of services that belongs to the remote device.
Declaration
public IEnumerable<BluetoothGattService> GetServices()
Returns
Type | Description |
---|---|
IEnumerable<><BluetoothGattService> | The list of services that belongs to the remote device. |
ReadValueAsync(BluetoothGattCharacteristic)
Reads the value of a given characteristic from the remote device asynchronously.
Declaration
public Task<bool> ReadValueAsync(BluetoothGattCharacteristic characteristic)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattCharacteristic | characteristic | The characteristic to be read. |
Returns
Type | Description |
---|---|
Task<><bool> | true on success, false otherwise. |
ReadValueAsync(BluetoothGattDescriptor)
Reads the value of the given descriptor from the remote device asynchronously.
Declaration
public Task<bool> ReadValueAsync(BluetoothGattDescriptor descriptor)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattDescriptor | descriptor | The descriptor to be read. |
Returns
Type | Description |
---|---|
Task<><bool> | true on success, false otherwise. |
SetAttMtu(int)
Sets the value of the ATT MTU(Maximum Transmission Unit) for the connection.
Declaration
public void SetAttMtu(int mtu)
Parameters
Type | Name | Description |
---|---|---|
int | mtu | The MTU value |
WriteValueAsync(BluetoothGattCharacteristic)
Writes the value of a given characteristic to the remote device asynchronously.
Declaration
public Task<bool> WriteValueAsync(BluetoothGattCharacteristic characteristic)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattCharacteristic | characteristic | The characteristic to be written. |
Returns
Type | Description |
---|---|
Task<><bool> | true on success, false otherwise. |
WriteValueAsync(BluetoothGattDescriptor)
Writes the value of the given descriptor to the remote device asynchronously.
Declaration
public Task<bool> WriteValueAsync(BluetoothGattDescriptor descriptor)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattDescriptor | descriptor | The descriptor to be written. |
Returns
Type | Description |
---|---|
Task<><bool> | true on success, false otherwise. |
Events
View SourceAttMtuChanged
The AttMtuChanged event is raised when the MTU value changed.
Declaration
public event EventHandler<AttMtuChangedEventArgs> AttMtuChanged
Event Type
Type | Description |
---|---|
EventHandler<><AttMtuChangedEventArgs> |
ConnectionStateChanged
The ConnectionStateChanged event is raised when the gatt connection state is changed.
Declaration
public event EventHandler<GattConnectionStateChangedEventArgs> ConnectionStateChanged
Event Type
Type | Description |
---|---|
EventHandler<><GattConnectionStateChangedEventArgs> |
ServiceChanged
The ServiceChanged event is raised when the service is changed from the remote device(GATT server).
Declaration
public event EventHandler<ServiceChangedEventArgs> ServiceChanged
Event Type
Type | Description |
---|---|
EventHandler<><ServiceChangedEventArgs> |