Arendi.BleLibrary  4.5.1.999
Core-Library (PCL)
Arendi.BleLibrary.Service.ICharacteristic Interface Reference

Interface all platform specific implementations of the characteristic fulfill. More...

Inheritance diagram for Arendi.BleLibrary.Service.ICharacteristic:

Public Member Functions

BleResult ReadData (int timeout=Constants.ReadDataTimeout)
 Retrieves the data of a specified characteristic from peripheral (EAP). More...
 
BleResult WriteData (byte[] data, int timeout=Constants.WriteDataTimeout)
 Writes the data to a characteristic of the peripheral (EAP). More...
 
BleResult ChangeNotification (bool enable, int timeout=Constants.ChangeNotificationTimeout)
 Changes the notifications for the value of a specified characteristic (EAP). More...
 
BleResult ChangeIndication (bool enable, int timeout=Constants.ChangeIndicationTimeout)
 Changes the indication for the value of a specified characteristic (EAP). More...
 
Task< byte[]> ReadDataAsync (int timeout=Constants.ReadDataTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Retrieves the value of a specified characteristic from peripheral (TAP). More...
 
Task WriteDataAsync (byte[] data, int timeout=Constants.WriteDataTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Writes the data of the characteristic to the peripheral (TAP). More...
 
Task ChangeNotificationAsync (bool enable, int timeout=Constants.ChangeNotificationTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Changes the notifications for the value of a specified characteristic (TAP). More...
 
Task ChangeIndicationAsync (bool enable, int timeout=Constants.ChangeIndicationTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Changes the indications for the value of a specified characteristic (TAP). More...
 

Properties

Uuid Uuid [get]
 Get the UUID identifying the characteristic. More...
 
byte [] Value [get]
 Get the local value of the characteristic. The local value is not valid on all implementations. More...
 
CharacteristicPermissions Permission [get]
 Get the permissions associated with the characteristic. More...
 
CharacteristicProperties Property [get]
 Get the properties associated with the characteristic. More...
 
Dictionary< DescriptorType, IDescriptorDescriptors [get]
 Get a dictionary with all descriptors of this characteristic. More...
 
IPeripheral Peripheral [get]
 Get the peripheral the characteristic is associated to. More...
 

Events

EventHandler< DataReadEventArgsDataRead
 Event triggered, when a read data operation initiated by the ReadData method has been completed (EAP). More...
 
EventHandler< DataWrittenEventArgsDataWritten
 Event triggered, when a write data operation initiated by the WriteData method has been completed (EAP). More...
 
EventHandler< NotificationChangedEventArgsNotificationChanged
 Event triggered, when a notification change operation initiated by the ChangeNotification method has been completed (EAP). More...
 
EventHandler< NotificationReceivedEventArgsNotificationReceived
 Event triggered, when a notification has been received. More...
 
EventHandler< IndicationChangedEventArgsIndicationChanged
 Event triggered, when a indication change operation initiated by the ChangeIndication method has been completed (EAP). More...
 
EventHandler< IndicationReceivedEventArgsIndicationReceived
 Event triggered, when a indication has been received. More...
 

Detailed Description

Interface all platform specific implementations of the characteristic fulfill.

The characteristic object supports two different ways to handle asynchronous programming: EAP: Earlier versions of the BleLibrary only supported "Event asynchronous Programming". Any asynchronous operation is initiated by a method. When the method returns BleResult.Pending the end of the asynchronous operation is signalized by events. E.g. the method ReadData will trigger the event DataRead event when done. The result of the operation is given as part of the event arguments in the event.

TAP: The newer way to handle the asynchronous part is the "Task Asynchronous Programming". The methods with the ending "Async" handle its operation in a task which can be awaited on the upper level. The TAP methods won't trigger events unless other described. Error cases in TAP events are always triggering an exception based on the type BleException.

Member Function Documentation

§ ChangeIndication()

BleResult Arendi.BleLibrary.Service.ICharacteristic.ChangeIndication ( bool  enable,
int  timeout = Constants.ChangeIndicationTimeout 
)

Changes the indication for the value of a specified characteristic (EAP).

Parameters
enableEnable or disable the indication.
timeoutOptional timeout [ms] (Default: Constants.ChangeIndicationTimeout)
Returns
Result of the initiation of the operation. If the result is BleResult.Pending or BleResult.Success the end of the operation is signalized by the event IndicationChanged.

§ ChangeIndicationAsync()

Task Arendi.BleLibrary.Service.ICharacteristic.ChangeIndicationAsync ( bool  enable,
int  timeout = Constants.ChangeIndicationTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Changes the indications for the value of a specified characteristic (TAP).

Parameters
enableEnable or disable the indication.
timeoutOptional timeout [ms] (Default: Constants.ChangeIndicationTimeout). The timeout may be set to infinite by using
Timeout.Infinite
.
cancellationTokenToken to cancel an ongoing async operation.

§ ChangeNotification()

BleResult Arendi.BleLibrary.Service.ICharacteristic.ChangeNotification ( bool  enable,
int  timeout = Constants.ChangeNotificationTimeout 
)

Changes the notifications for the value of a specified characteristic (EAP).

Parameters
enableEnable or disable the notification.
timeoutOptional timeout [ms] (Default: Constants.ChangeNotificationTimeout)
Returns
Result of the initiation of the operation. If the result is BleResult.Pending or BleResult.Success the end of the operation is signalized by the event NotificationChanged.

§ ChangeNotificationAsync()

Task Arendi.BleLibrary.Service.ICharacteristic.ChangeNotificationAsync ( bool  enable,
int  timeout = Constants.ChangeNotificationTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Changes the notifications for the value of a specified characteristic (TAP).

Parameters
enableEnable or disable the notification.
timeoutOptional timeout [ms] (Default: Constants.ChangeNotificationTimeout). The timeout may be set to infinite by using
Timeout.Infinite
.
cancellationTokenToken to cancel an ongoing async operation.

§ ReadData()

BleResult Arendi.BleLibrary.Service.ICharacteristic.ReadData ( int  timeout = Constants.ReadDataTimeout)

Retrieves the data of a specified characteristic from peripheral (EAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.ReadDataTimeout)
Returns
Result of the initiation of the operation. If the result is BleResult.Pending or BleResult.Success the end of the operation is signalized by the event DataRead.

§ ReadDataAsync()

Task<byte[]> Arendi.BleLibrary.Service.ICharacteristic.ReadDataAsync ( int  timeout = Constants.ReadDataTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Retrieves the value of a specified characteristic from peripheral (TAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.ReadDataTimeout). The timeout may be set to infinite by using
Timeout.Infinite
.
cancellationTokenToken to cancel an ongoing async operation.
Returns
Data read from the characteristic.

§ WriteData()

BleResult Arendi.BleLibrary.Service.ICharacteristic.WriteData ( byte []  data,
int  timeout = Constants.WriteDataTimeout 
)

Writes the data to a characteristic of the peripheral (EAP).

Parameters
dataData to write to the characteristic.
timeoutOptional timeout [ms] (Default: Constants.WriteDataTimeout)
Returns
Result of the initiation of the operation. If the result is BleResult.Pending or BleResult.Success the end of the operation is signalized by the event DataWritten.

§ WriteDataAsync()

Task Arendi.BleLibrary.Service.ICharacteristic.WriteDataAsync ( byte []  data,
int  timeout = Constants.WriteDataTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Writes the data of the characteristic to the peripheral (TAP).

Parameters
dataData to write to the characteristic.
timeoutOptional timeout [ms] (Default: Constants.WriteDataTimeout). The timeout may be set to infinite by using
Timeout.Infinite
.
cancellationTokenToken to cancel an ongoing async operation.

Property Documentation

§ Descriptors

Dictionary<DescriptorType, IDescriptor> Arendi.BleLibrary.Service.ICharacteristic.Descriptors
get

Get a dictionary with all descriptors of this characteristic.

§ Peripheral

IPeripheral Arendi.BleLibrary.Service.ICharacteristic.Peripheral
get

Get the peripheral the characteristic is associated to.

§ Permission

CharacteristicPermissions Arendi.BleLibrary.Service.ICharacteristic.Permission
get

Get the permissions associated with the characteristic.

§ Property

CharacteristicProperties Arendi.BleLibrary.Service.ICharacteristic.Property
get

Get the properties associated with the characteristic.

§ Uuid

Uuid Arendi.BleLibrary.Service.ICharacteristic.Uuid
get

Get the UUID identifying the characteristic.

§ Value

byte [] Arendi.BleLibrary.Service.ICharacteristic.Value
get

Get the local value of the characteristic. The local value is not valid on all implementations.

Event Documentation

§ DataRead

EventHandler<DataReadEventArgs> Arendi.BleLibrary.Service.ICharacteristic.DataRead

Event triggered, when a read data operation initiated by the ReadData method has been completed (EAP).

§ DataWritten

EventHandler<DataWrittenEventArgs> Arendi.BleLibrary.Service.ICharacteristic.DataWritten

Event triggered, when a write data operation initiated by the WriteData method has been completed (EAP).

§ IndicationChanged

EventHandler<IndicationChangedEventArgs> Arendi.BleLibrary.Service.ICharacteristic.IndicationChanged

Event triggered, when a indication change operation initiated by the ChangeIndication method has been completed (EAP).

§ IndicationReceived

EventHandler<IndicationReceivedEventArgs> Arendi.BleLibrary.Service.ICharacteristic.IndicationReceived

Event triggered, when a indication has been received.

§ NotificationChanged

EventHandler<NotificationChangedEventArgs> Arendi.BleLibrary.Service.ICharacteristic.NotificationChanged

Event triggered, when a notification change operation initiated by the ChangeNotification method has been completed (EAP).

§ NotificationReceived

EventHandler<NotificationReceivedEventArgs> Arendi.BleLibrary.Service.ICharacteristic.NotificationReceived

Event triggered, when a notification has been received.