Arendi.BleLibrary
4.5.1.999
Core-Library (PCL)
|
Interface all platform specific implementations of the descriptors fulfill. More...
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< DataReadEventArgs > | DataRead |
Event triggered, when a read data operation initiated by the ReadData method has been completed (EAP). More... | |
EventHandler< DataWrittenEventArgs > | DataWritten |
Event triggered, when a write data operation initiated by the WriteData method has been completed (EAP). More... | |
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.
BleResult Arendi.BleLibrary.Service.IDescriptor.ReadData | ( | int | timeout = Constants.ReadDataTimeout | ) |
Retrieves the data of a specified descriptor from peripheral (EAP).
timeout | Optional timeout [ms] (Default: Constants.ReadDataTimeout) |
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).
timeout | Optional timeout [ms] (Default: Constants.ReadDataTimeout). The timeout may be set to infinite by using Timeout.Infinite |
cancellationToken | Token to cancel an ongoing async operation. |
BleResult Arendi.BleLibrary.Service.IDescriptor.WriteData | ( | byte [] | data, |
int | timeout = Constants.WriteDataTimeout |
||
) |
Writes the data to a descriptor of the peripheral (EAP).
data | Data to write to the descriptor. |
timeout | Optional timeout [ms] (Default: Constants.WriteDataTimeout) |
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).
data | Data to write to the descriptor. |
timeout | Optional timeout [ms] (Default: Constants.WriteDataTimeout). The timeout may be set to infinite by using Timeout.Infinite |
cancellationToken | Token to cancel an ongoing async operation. |
|
get |
Get the characteristic the descriptor is associated to.
|
get |
Get the descriptor type of this descriptor.
|
get |
Get the local value of the descriptor. The local value is not valid on all implementations.
EventHandler<DataReadEventArgs> Arendi.BleLibrary.Service.IDescriptor.DataRead |
Event triggered, when a read data operation initiated by the ReadData method has been completed (EAP).
EventHandler<DataWrittenEventArgs> Arendi.BleLibrary.Service.IDescriptor.DataWritten |
Event triggered, when a write data operation initiated by the WriteData method has been completed (EAP).