Arendi.BleLibrary
4.5.1.999
Core-Library (PCL)
|
Abstract class representing an enhanced peripheral. More...
Public Member Functions | |
void | Establish () |
Initiate the establishment of a connection. This is not allowed if peripheral mode is set to PeripheralMode.Inactive. | |
async Task | EstablishAsync (int timeout=Constants.EnhancedPeripheralEstablishTimeout) |
Execute the establishment of a connection. This is not allowed if peripheral mode is set to PeripheralMode.Inactive. | |
void | Teardown () |
Initiate the teardown of a connection. This is not allowed if peripheral mode is set to PeripheralMode.Inactive. | |
async Task | TeardownAsync (int timeout=Constants.EnhancedPeripheralTeardownTimeout) |
Execute the teardown of a connection. This is not allowed if peripheral mode is set to PeripheralMode.Inactive. | |
void | Update (UpdateSetup updateSetup) |
Start an update process When the enhanced peripheral is in a stable state as PeripheralState.Idle or PeripheralState.Ready the update will be initiated immediately. In transition states the update will be initiated after completion of the state. | |
async Task | UpdateAsync (UpdateSetup updateSetup, int timeout=Constants.EnhancedPeripheralUpdateTimeout) |
Execute an update process asynchronously. When the enhanced peripheral is in a stable state as PeripheralState.Idle or PeripheralState.Ready the update will be initiated immediately. In transition states the update will be initiated after completion of the state. | |
override void | Dispose () |
Dispose the peripheral. A disposed enhanced peripheral is disconnected. More... | |
override string | ToString () |
Returns a string that represents the current object. More... | |
Public Member Functions inherited from Arendi.BleLibrary.Extention.ManagedPeripheral | |
ManagedPeripheral (Uuid uuid) | |
Create a virtual managed peripheral with a specific UUID if the real peripheral is not known. A connection to this peripheral can not be established until the peripheral is found by the PeripheralManager<TPeripheral> More... | |
ManagedPeripheral (IPeripheral peripheral) | |
Create a managed peripheral with a peripheral object More... | |
Public Attributes | |
int | ReconnectAfterFailedConnectTimeoutDefault => 5000 |
int | ReconnectAfterDisconnectTimeoutDefault => 0 |
int | RssiIntervalDefault => 1000 |
Public Attributes inherited from Arendi.BleLibrary.Extention.ManagedPeripheral | |
const int | RssiNotAvailable = int.MinValue |
RSSI value that indicates, that no value is known. More... | |
Protected Member Functions | |||
EnhancedPeripheral (Uuid uuid) | |||
Create enhanced peripheral based on an UUID and an optional name. The resulting object represents a virtual peripheral. More... | |||
EnhancedPeripheral (IPeripheral peripheral) | |||
Create enhanced peripheral based on an peripheral. More... | |||
void | CheckReady () | ||
Check if state of the peripheral is ready. If not in Ready state an
is thrown. More... | |||
virtual async Task< UpdateSetup > | InitializeAsync (CancellationToken cancellationToken=default(CancellationToken)) | ||
Empty initialize method that can be overwritten in the derived class. This method is called in Initialize state after detection services of the peripheral. The method may be used to check the detected services and read/write some initial values. More... | |||
virtual void | Activate () | ||
This method is called after the standard peripheral object for this peripheral is set. If a constructor with the standard peripheral object is called, that method will be called in the constructor. On virtual devices (no standard peripheral object on object creation) the method may be called later, when the virtual device is converted to a real peripheral. More... | |||
Properties | |
PeripheralState | State [get] |
PeripheralMode | Mode [get, set] |
int | ConnectTimeout [get, set] |
int | DiscoverServicesTimeout [get, set] |
int | DisconnectTimeout [get, set] |
int | ReconnectAfterDisconnectTimeout [get, set] |
int | ReconnectAfterFailedConnectTimeout [get, set] |
int | RssiInterval [get, set] |
new bool | IsDisposed [get] |
Properties inherited from Arendi.BleLibrary.Extention.ManagedPeripheral | |
IPeripheral | Peripheral [get, set] |
Uuid | Uuid [get] |
string | Name [get, set] |
int | Rssi [get, set] |
bool | IsConnectable [get, set] |
DateTime | LastSeen [get, set] |
bool | IsDisposed [get] |
Properties inherited from Arendi.BleLibrary.Extention.IManagedPeripheral | |
IPeripheral | Peripheral [get, set] |
Get/Set the used standard peripheral object. More... | |
Uuid | Uuid [get] |
Get the UUID uniquely identifying an peripheral. More... | |
string | Name [get, set] |
Get the name of the enhanced peripheral. More... | |
int | Rssi [get, set] |
Get the last set RSSI value. The returned value was update when the peripheral was last seen (see Rssi). More... | |
bool | IsConnectable [get, set] |
Is the device is connectable or not. More... | |
DateTime | LastSeen [get, set] |
Time the peripheral was last seen. More... | |
bool | IsDisposed [get] |
Check if the peripheral object is already disposed. More... | |
Properties inherited from Arendi.BleLibrary.Extention.IEnhancedPeripheral | |
int | ReconnectAfterFailedConnectTimeoutDefault [get] |
Default timeout after a failed connect [ms]. More... | |
int | ReconnectAfterDisconnectTimeoutDefault [get] |
Default timeout after a disconnect [ms]. More... | |
int | RssiIntervalDefault [get] |
Get the default interval for RSSI measurements [ms]. More... | |
PeripheralState | State [get] |
Get the state of the peripheral. More... | |
PeripheralMode | Mode [get, set] |
Get/Set the mode the peripheral is used. More... | |
int | ConnectTimeout [get, set] |
Get/Set the connect timeout [ms]. By default the value is set to Constants.ConnectTimeout. It is allowed to set this value to Timeout.Infinite to keep trying to connect to a device. More... | |
int | DiscoverServicesTimeout [get, set] |
Get/Set the discover services timeout [ms]. By default the value is set to Constants.DiscoverServicesTimeout. More... | |
int | DisconnectTimeout [get, set] |
Get/Set the disconnect timeout [ms]. By default the value is set to Constants.DisconnectTimeout. More... | |
int | ReconnectAfterDisconnectTimeout [get, set] |
Get/Set the reconnect timeout [ms] after a disconnect. This timeout is used after a peripheral has been disconnected. This value may be set to 0 to immediately retry to establish a connection. By default the value is set to ReconnectAfterDisconnectTimeoutDefault. More... | |
int | ReconnectAfterFailedConnectTimeout [get, set] |
Get/Set the reconnect timeout [ms] after a failed connect. This timeout is used after a peripheral couldn't be connected to try next time. It is not recommended, to set this duration to a value of 0. By default the value is set to ReconnectAfterFailedConnectTimeoutDefault. More... | |
int | RssiInterval [get, set] |
Get/Set the interval the RSSI is measured when the peripheral is connected [ms]. A value of 0 means, that no RSSI is measured. By default the value is set to RssiIntervalDefault. More... | |
Events | |
EventHandler< PeripheralStateChangedEventArgs > | StateChanged = delegate { } |
EventHandler< EstablishStartedEventArgs > | EstablishStarted = delegate { } |
EventHandler< EstablishSucceededEventArgs > | EstablishSucceeded = delegate { } |
EventHandler< EstablishFailedEventArgs > | EstablishFailed = delegate { } |
EventHandler< TeardownStartedEventArgs > | TeardownStarted = delegate { } |
EventHandler< TeardownSucceededEventArgs > | TeardownSucceeded = delegate { } |
EventHandler< TeardownFailedEventArgs > | TeardownFailed = delegate { } |
EventHandler< UpdateStartedEventArgs > | UpdateStarted = delegate { } |
EventHandler< UpdateSucceededEventArgs > | UpdateSucceeded = delegate { } |
EventHandler< UpdateFailedEventArgs > | UpdateFailed = delegate { } |
Events inherited from Arendi.BleLibrary.Extention.ManagedPeripheral | |
EventHandler | PeripheralUpdated = delegate { } |
Standard peripheral object of the peripheral has been set. More... | |
EventHandler< NameUpdatedEventArgs > | NameUpdated = delegate { } |
Name of the peripheral has changed. More... | |
EventHandler< RssiUpdatedEventArgs > | RssiUpdated = delegate { } |
RSSI level of the peripheral has changed. More... | |
EventHandler< IsConnectableUpdatedEventArgs > | IsConnectableUpdated = delegate { } |
Property if the peripheral may be connected has been updated. More... | |
Events inherited from Arendi.BleLibrary.Extention.IEnhancedPeripheral | |
EventHandler< PeripheralStateChangedEventArgs > | StateChanged |
State of the peripheral changed. More... | |
EventHandler | PeripheralUpdated |
Standard peripheral object of the peripheral has been set. More... | |
EventHandler< NameUpdatedEventArgs > | NameUpdated |
Name of the peripheral has changed. More... | |
EventHandler< RssiUpdatedEventArgs > | RssiUpdated |
RSSI level of the peripheral has changed. More... | |
EventHandler< IsConnectableUpdatedEventArgs > | IsConnectableUpdated |
Property if the peripheral may be connected has been updated. More... | |
EventHandler< EstablishStartedEventArgs > | EstablishStarted |
An establish operation has been started. The establish operation may be initiated by enhanced peripheral mode PeripheralMode.Active or by the methods Establish and EstablishAsync. More... | |
EventHandler< EstablishSucceededEventArgs > | EstablishSucceeded |
An establish operation has succeeded. The establish operation may be initiated by enhanced peripheral mode PeripheralMode.Active or by the methods Establish and EstablishAsync. More... | |
EventHandler< EstablishFailedEventArgs > | EstablishFailed |
An establish operation has failed. The establish operation may be initiated by enhanced peripheral mode PeripheralMode.Active or by the methods Establish and EstablishAsync. More... | |
EventHandler< TeardownStartedEventArgs > | TeardownStarted |
A teardown operation has been started. The teardown operation may have been initiated by enhanced peripheral mode PeripheralMode.Active or by the methods Teardown and TeardownAsync. More... | |
EventHandler< TeardownSucceededEventArgs > | TeardownSucceeded |
A teardown operation has succeeded. The teardown operation may be initiated by enhanced peripheral mode PeripheralMode.Active or by the methods Teardown and TeardownAsync. More... | |
EventHandler< TeardownFailedEventArgs > | TeardownFailed |
A teardown operation has failed. The tear down operation may be initiated by enhanced peripheral mode PeripheralMode.Active or by the methods Teardown and TeardownAsync. More... | |
EventHandler< UpdateStartedEventArgs > | UpdateStarted |
An update operation has been started. The update operation may be initiated by the methods Update and UpdateAsync. Additionally the establish operation may include an update operation. More... | |
EventHandler< UpdateSucceededEventArgs > | UpdateSucceeded |
An update operation has succeeded. The update operation may be initiated by the methods Update and UpdateAsync. More... | |
EventHandler< UpdateFailedEventArgs > | UpdateFailed |
An update operation has succeeded. The update operation may be initiated by the methods Update and UpdateAsync. More... | |
Additional Inherited Members | |
Protected Attributes inherited from Arendi.BleLibrary.Extention.ManagedPeripheral | |
const string | PeripheralDisposedExceptionText = "The peripheral was already disposed by the peripheral manager. \nOverride the method \"bool CheckRemove()\" to prevent that a peripheral in use is removed by the peripheral manager" |
This text is used as object disposed exception message More... | |
Abstract class representing an enhanced peripheral.
The enhanced peripheral class adds the ability to automatically connect disconnect a peripheral. The object will autonomously act according to the mode set for the peripheral.
|
protected |
Create enhanced peripheral based on an UUID and an optional name. The resulting object represents a virtual peripheral.
uuid | UUID identifying the peripheral. |
|
protected |
Create enhanced peripheral based on an peripheral.
peripheral | Standard peripheral object the enhanced peripheral should use. |
|
protectedvirtual |
This method is called after the standard peripheral object for this peripheral is set. If a constructor with the standard peripheral object is called, that method will be called in the constructor. On virtual devices (no standard peripheral object on object creation) the method may be called later, when the virtual device is converted to a real peripheral.
|
protected |
Check if state of the peripheral is ready. If not in Ready state an
PeripheralNotReadyException |
is thrown.
|
virtual |
Dispose the peripheral. A disposed enhanced peripheral is disconnected.
Reimplemented from Arendi.BleLibrary.Extention.ManagedPeripheral.
|
protectedvirtual |
Empty initialize method that can be overwritten in the derived class. This method is called in Initialize state after detection services of the peripheral. The method may be used to check the detected services and read/write some initial values.
If an exception is thrown in this method the peripheral will be disconnected.
cancellationToken | Token to cancel an ongoing async operation. |
override string Arendi.BleLibrary.Extention.EnhancedPeripheral.ToString | ( | ) |
Returns a string that represents the current object.