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

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

Inheritance diagram for Arendi.BleLibrary.Service.IDescriptor:

Public Member Functions

BleResult ReadData (int timeout=Constants.ReadDataTimeout)
 Retrieves the data of a specified descriptor from peripheral (EAP). More...
 
BleResult WriteData (byte[] data, int timeout=Constants.WriteDataTimeout)
 Writes the data to a descriptor of the peripheral (EAP). More...
 
Task< byte[]> ReadDataAsync (int timeout=Constants.ReadDataTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Retrieves the value of a specified descriptor from peripheral (TAP). More...
 
Task WriteDataAsync (byte[] data, int timeout=Constants.WriteDataTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Writes the data of the descriptor to the peripheral (TAP). More...
 

Properties

DescriptorType Type [get]
 Get the descriptor type of this descriptor. More...
 
byte [] Value [get]
 Get the local value of the descriptor. The local value is not valid on all implementations. More...
 
ICharacteristic Characteristic [get]
 Get the characteristic the descriptor 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...
 

Detailed Description

Interface all platform specific implementations of the descriptors fulfill.

The descriptor 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

§ ReadData()

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

Retrieves the data of a specified descriptor 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.IDescriptor.ReadDataAsync ( int  timeout = Constants.ReadDataTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Retrieves the value of a specified descriptor 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.IDescriptor.WriteData ( byte []  data,
int  timeout = Constants.WriteDataTimeout 
)

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

Parameters
dataData to write to the descriptor.
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.IDescriptor.WriteDataAsync ( byte []  data,
int  timeout = Constants.WriteDataTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

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

Parameters
dataData to write to the descriptor.
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

§ Characteristic

ICharacteristic Arendi.BleLibrary.Service.IDescriptor.Characteristic
get

Get the characteristic the descriptor is associated to.

§ Type

DescriptorType Arendi.BleLibrary.Service.IDescriptor.Type
get

Get the descriptor type of this descriptor.

§ Value

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

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

Event Documentation

§ DataRead

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

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

§ DataWritten

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

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