Class BluetoothGattServer
Definition
- Namespace:
- Tizen.Network.Bluetooth
- Assembly:
- Tizen.Network.Bluetooth.dll
- API Level:
- 3
The Bluetooth GATT server.
C#Copypublic class BluetoothGattServer : IDisposable
- Inheritance
-
System.ObjectBluetoothGattServer
- Implements
-
System.IDisposable
Methods
Declaration
C#Copypublic static BluetoothGattServer CreateServer()
Returns
Type | Description |
---|---|
BluetoothGattServer | The BluetoothGattServer instance. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the create GATT server fails. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Declaration
C#Copypublic void Dispose()
API Level: 6
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Declaration
C#Copyprotected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | true if the managed resources should be disposed, otherwise false. |
API Level: 6
Declaration
C#Copyprotected void Finalize()
GetAttMtu(String)
Gets the value of the ATT MTU(Maximum Transmission Unit) for the connection.
Declaration
C#Copypublic int GetAttMtu(string clientAddress)
Parameters
Type | Name | Description |
---|---|---|
System.String | clientAddress | The remote device address. |
Returns
Type | Description |
---|---|
System.Int32 | The MTU value |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BLE is not supported. |
System.InvalidOperationException | Thrown when the BT/BLE is not enabled or when the remote device is disconnected, or when other specific error occurs. |
API Level: 9
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Declaration
C#Copypublic BluetoothGattService GetService(string uuid)
Parameters
Type | Name | Description |
---|---|---|
System.String | uuid | The UUID for the service to get. |
Returns
Type | Description |
---|---|
BluetoothGattService | The Service with the given UUID if it exists, null otherwise. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the service is not registered. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Declaration
C#Copypublic IEnumerable<BluetoothGattService> GetServices()
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<BluetoothGattService> | The list of services that belongs to this server. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the service is not registered. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Declaration
C#Copypublic void RegisterGattService(BluetoothGattService service)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattService | service | The service, which needs to be registered with this server. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the register service fails. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
SendIndicationAsync(BluetoothGattCharacteristic, String)
Sends indication for the value change of the characteristic to the remote devices.
Declaration
C#Copypublic Task<bool> SendIndicationAsync(BluetoothGattCharacteristic characteristic, string clientAddress)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattCharacteristic | characteristic | The characteristic whose the value is changed. |
System.String | clientAddress | The remote device address to send, notify, or indicate and if set to NULL, then notify/indicate all is enabled. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<System.Boolean> | true on success, false otherwise. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the BT/BTLE is not enabled or when the remote device is disconnected, or when service is not registered, or when the CCCD is not enabled. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
SendNotification(BluetoothGattCharacteristic, String)
Sends the notification for the value change of the characteristic to the remote devices.
Declaration
C#Copypublic void SendNotification(BluetoothGattCharacteristic characteristic, string clientAddress)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattCharacteristic | characteristic | The characteristic, which has a changed value. |
System.String | clientAddress | The remote device address to send, notify, or indicate and if set to NULL, then notify/indicate all is enabled. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the BT/BTLE is not enabled or when the remote device is disconnected, or when service is not registered, or when the CCCD is not enabled. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
SendResponse(Int32, BluetoothGattRequestType, Int32, Byte[], Int32)
Sends a response to the remote device as a result of a read/write request.
Declaration
C#Copypublic void SendResponse(int requestId, BluetoothGattRequestType type, int status, byte[] value, int offset)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | requestId | The identification of a read/write request. |
BluetoothGattRequestType | type | The request type for read/write. |
System.Int32 | status | The error value in case of failure, 0 for success. |
System.Byte[] | value | The value to be sent. |
System.Int32 | offset | The offset from where the value is read. |
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the BT/BTLE is not enabled or when the remote device is disconnected, or the send response procedure fails. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Start()
Registers the server along with the GATT services of the application it is hosting.
Declaration
C#Copypublic void Start()
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the register server application fails. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
UnregisterGattService(BluetoothGattService)
Unregisters a specified service from this server.
Declaration
C#Copypublic void UnregisterGattService(BluetoothGattService service)
Parameters
Type | Name | Description |
---|---|---|
BluetoothGattService | service | The service, which needs to be unregistered from this server. |
Remarks
Once unregistered, the service object will become invalid and should not be used to access sevices or any children attribute's methods/members.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the unregister service fails. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Declaration
C#Copypublic void UnregisterGattServices()
Remarks
Once unregistered, servicees will become invalid and should not be used to access sevices or any children attribute's methods/members.
Exceptions
Type | Condition |
---|---|
System.NotSupportedException | Thrown when the BT/BTLE is not supported. |
System.InvalidOperationException | Thrown when the unregister all services fail. |
API Level: 3
Feature: http://tizen.org/feature/network.bluetooth.le.gatt.server
Events
NotificationSent
(event) This event is called when the indication acknowledgement is received for each notified client.
Declaration
C#Copypublic event EventHandler<NotificationSentEventArg> NotificationSent
Event Type
Type | Description |
---|---|
System.EventHandler<NotificationSentEventArg> |