Arendi.BleLibrary  4.5.1.999
Core-Library (PCL)
Arendi.BleLibrary.Remote.IPeripheral Interface Reference

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

Inheritance diagram for Arendi.BleLibrary.Remote.IPeripheral:

Public Member Functions

BleResult Connect (int timeout=Constants.ConnectTimeout)
 Tries to establish a connection to the peripheral (EAP). More...
 
BleResult Disconnect (int timeout)
 Releases the connection (EAP). More...
 
BleResult DiscoverServices (int timeout=Constants.DiscoverServicesTimeout)
 Discover all services of the peripheral (EAP). More...
 
BleResult ReadRssi (int timeout=Constants.ReadRssiTimeout)
 Retrieves the current RSSI value for the peripheral while it is connected (EAP). More...
 
BleResult Encrypt (int timeout=Constants.EncryptTimeout)
 Encrypt the current connection to the peripheral (EAP). More...
 
Task ConnectAsync (int timeout=Constants.ConnectTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Tries to establish a connection to the peripheral (TAP). More...
 
Task DisconnectAsync (int timeout=Constants.DisconnectTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Releases the connection (TAP). More...
 
Task DiscoverServicesAsync (int timeout=Constants.DiscoverServicesTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Discover all services of the peripheral (TAP). More...
 
Task< int > ReadRssiAsync (int timeout=Constants.ReadRssiTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Retrieves the current RSSI value for the peripheral while it is connected (TAP). More...
 
Task EncryptAsync (int timeout=Constants.EncryptTimeout, CancellationToken cancellationToken=default(CancellationToken))
 Encrypt the current connection to the peripheral (TAP). More...
 
IService FindService (string uuid)
 Find a service in the service list. More...
 
IService FindService (Uuid uuid)
 Find a service in the service list. More...
 
ICharacteristic FindCharacteristic (string uuid)
 Find a characteristic in the service list. More...
 
ICharacteristic FindCharacteristic (Uuid uuid)
 Find a characteristic in the service list. More...
 
void Update (IPeripheral peripheral)
 Update the static peripheral information as is connectable and it's name by later advertised peripheral. More...
 
void AuthenticationPasskeyEntryReply (string passkey)
 Method to respond to a IPeripheral.AuthenticationPasskeyEntry event. More...
 

Properties

ICentral Central [get]
 Gets the central instance the peripheral has been created by. More...
 
Uuid Uuid [get]
 Get the UUID that identifies the peripheral uniquely. More...
 
string Name [get, set]
 The name of the peripheral More...
 
BluetoothAddress Address [get]
 Get the bluetooth address of the peripheral. More...
 
bool IsConnected [get]
 Check if the peripheral is currently connected. More...
 
State State [get]
 Get the state of the peripheral. More...
 
IBond Bond [get]
 Get the bonding associated with this peripheral.
If there is no bonding with this device or if the platform doesn't support bonding handling null is returned.
More...
 
IConnectionParameter ConnectionParameter [get]
 Get the connection parameter of the connection to this device. If the peripheral is not connected or the adapter doesn't provide access to connection parameters null is returned. More...
 
IConnectionSecurity ConnectionSecurity [get]
 Get the connection security of the connection to this device. If the peripheral is not connected or the adapter doesn't provide access to connection parameters null is returned. More...
 
IEnumerable< IServiceServiceList [get]
 Get the service list of the peripheral. More...
 

Events

EventHandler< StateChangedEventArgsStateChanged
 Event triggered, when the state of the peripheral changes. More...
 
EventHandler< ConnectedEventArgsConnected
 Event triggered, when the peripheral gets connected. More...
 
EventHandler< DisconnectedEventArgsDisconnected
 Event triggered, when the peripheral gets disconnected. More...
 
EventHandler< ConnectSucceededEventArgsConnectSucceeded
 Event triggered, when a connect operation has been completed successfully. More...
 
EventHandler< ConnectFailedEventArgsConnectFailed
 Event triggered, when a connect operation has been completed failed. More...
 
EventHandler< DisconnectSucceededEventArgsDisconnectSucceeded
 Event triggered, when a disconnect operation has been completed successfully. More...
 
EventHandler< DisconnectFailedEventArgsDisconnectFailed
 Event triggered, when a disconnect operation has been completed failed. More...
 
EventHandler< ServicesDiscoveredEventArgsServicesDiscovered
 Event triggered, when the discovering of the services initiated by the DiscoverServices method has been completed (EAP). More...
 
EventHandler< RssiReadEventArgsRssiRead
 Event triggered, when the reading of the RSSI initiated by the ReadRssi method has been completed (EAP). More...
 
EventHandler< EncryptedEventArgsEncrypted
 Event triggered if the connection is encrypted. More...
 
EventHandler< AuthenticationPasskeyDisplayEventArgsAuthenticationPasskeyDisplay
 Event triggered if a passkey has to be displayed. More...
 
EventHandler< AuthenticationPasskeyEntryEventArgsAuthenticationPasskeyEntry
 Event triggered if a passkey has to be inserted. The passkey should be provided by calling AuthenticationPasskeyEntryReply. More...
 
EventHandler< AuthenticationPasskeyCompleteEventArgsAuthenticationPasskeyComplete
 Event triggered if a passkey display (see AuthenticationPasskeyDisplay) or entry (AuthenticationPasskeyEntry) may be terminated.. More...
 
EventHandler< BondChangedEventArgsBondChanged
 Event triggered, when the bond property has changed. More...
 
EventHandler< ConnectionParameterChangedEventArgsConnectionParameterChanged
 Event triggered, when the connection parameter have changed. More...
 
EventHandler< ConnectionSecurityChangedEventArgsConnectionSecurityChanged
 Event triggered, when the connection security has changed. More...
 

Detailed Description

Interface all platform specific implementations of the peripheral fulfill.

The peripheral 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.

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

§ AuthenticationPasskeyEntryReply()

void Arendi.BleLibrary.Remote.IPeripheral.AuthenticationPasskeyEntryReply ( string  passkey)

Method to respond to a IPeripheral.AuthenticationPasskeyEntry event.

Parameters
passkeyPasskey to be used for authentication.

§ Connect()

BleResult Arendi.BleLibrary.Remote.IPeripheral.Connect ( int  timeout = Constants.ConnectTimeout)

Tries to establish a connection to the peripheral (EAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.ConnectTimeout)

Calling this method with a timeout of 0 is not working properly in the current version (issue #1452). As this would require a significant change in the internal implementation and because the previous application implementations didn't use the infinite connect it has to be discussed to remove the infinite option completely. Currently a ArgumentOutOfRangeException is thrown if the timeout is given with 0.

Returns
Result of the initiation of the operation. If the result is BleResult.Pending the end of the operation is signalized by the event ConnectSucceeded or ConnectFailed.

§ ConnectAsync()

Task Arendi.BleLibrary.Remote.IPeripheral.ConnectAsync ( int  timeout = Constants.ConnectTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Tries to establish a connection to the peripheral (TAP).

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

§ Disconnect()

BleResult Arendi.BleLibrary.Remote.IPeripheral.Disconnect ( int  timeout)

Releases the connection (EAP).

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

§ DisconnectAsync()

Task Arendi.BleLibrary.Remote.IPeripheral.DisconnectAsync ( int  timeout = Constants.DisconnectTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Releases the connection (TAP).

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

§ DiscoverServices()

BleResult Arendi.BleLibrary.Remote.IPeripheral.DiscoverServices ( int  timeout = Constants.DiscoverServicesTimeout)

Discover all services of the peripheral (EAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.DiscoverServicesTimeout)
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 ServicesDiscovered.

§ DiscoverServicesAsync()

Task Arendi.BleLibrary.Remote.IPeripheral.DiscoverServicesAsync ( int  timeout = Constants.DiscoverServicesTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Discover all services of the peripheral (TAP).

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

§ Encrypt()

BleResult Arendi.BleLibrary.Remote.IPeripheral.Encrypt ( int  timeout = Constants.EncryptTimeout)

Encrypt the current connection to the peripheral (EAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.EncryptTimeout)
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 Encrypted.

§ EncryptAsync()

Task Arendi.BleLibrary.Remote.IPeripheral.EncryptAsync ( int  timeout = Constants.EncryptTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Encrypt the current connection to the peripheral (TAP).

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

§ FindCharacteristic() [1/2]

ICharacteristic Arendi.BleLibrary.Remote.IPeripheral.FindCharacteristic ( string  uuid)

Find a characteristic in the service list.

The service list is available after completing the service discovery (DiscoverServices or DiscoverServicesAsync).

Parameters
uuidThe UUID of the characteristic to search for.
Returns
The characteristic object found, or null if no service has been found.

It is not recommended to search the complete peripheral for characteristic UUID's. Some characteristic UUID's may exist in more than one service and you won't know which characteristic you get. Use FindService(BleLibrary.Uuid) or FindService(string) first to search for the service and search the characteristic in the service.

The accessible service list may be limited if you use a limited BleLibrary edition. Contact Arendi AG (www.arendi.ch) for further information.

§ FindCharacteristic() [2/2]

ICharacteristic Arendi.BleLibrary.Remote.IPeripheral.FindCharacteristic ( Uuid  uuid)

Find a characteristic in the service list.

The service list is available after completing the service discovery (DiscoverServices or DiscoverServicesAsync).

Parameters
uuidThe UUID of the characteristic to search for.
Returns
The characteristic object found, or null if no service has been found.

It is not recommended to search the complete peripheral for characteristic UUID's. Some characteristic UUID's may exist in more than one service and you won't know which characteristic you get. Use FindService(BleLibrary.Uuid) or FindService(string) first to search for the service and search the characteristic in the service.

The accessible service list may be limited if you use a limited BleLibrary edition. Contact Arendi AG (www.arendi.ch) for further information.

§ FindService() [1/2]

IService Arendi.BleLibrary.Remote.IPeripheral.FindService ( string  uuid)

Find a service in the service list.

The service list is available after completing the service discovery (DiscoverServices or DiscoverServicesAsync).

Parameters
uuidThe UUID of the service to search for.
Returns
The service object found, or null if no service has been found.

The accessible service list may be limited if you use a limited BleLibrary edition. Contact Arendi AG (www.arendi.ch) for further information.

§ FindService() [2/2]

IService Arendi.BleLibrary.Remote.IPeripheral.FindService ( Uuid  uuid)

Find a service in the service list.

The service list is available after completing the service discovery (DiscoverServices or DiscoverServicesAsync).

Parameters
uuidThe UUID of the service to search for.
Returns
The service object found, or null if no service has been found.

The accessible service list may be limited if you use a limited BleLibrary edition. Contact Arendi AG (www.arendi.ch) for further information.

§ ReadRssi()

BleResult Arendi.BleLibrary.Remote.IPeripheral.ReadRssi ( int  timeout = Constants.ReadRssiTimeout)

Retrieves the current RSSI value for the peripheral while it is connected (EAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.ReadRssiTimeout)
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 RssiRead.

§ ReadRssiAsync()

Task<int> Arendi.BleLibrary.Remote.IPeripheral.ReadRssiAsync ( int  timeout = Constants.ReadRssiTimeout,
CancellationToken  cancellationToken = default(CancellationToken) 
)

Retrieves the current RSSI value for the peripheral while it is connected (TAP).

Parameters
timeoutOptional timeout [ms] (Default: Constants.ReadRssiTimeout). The timeout may be set to infinite by using
Timeout.Infinite
.
Returns
Returns the RSSI value.
Parameters
cancellationTokenToken to cancel an ongoing async operation.

§ Update()

void Arendi.BleLibrary.Remote.IPeripheral.Update ( IPeripheral  peripheral)

Update the static peripheral information as is connectable and it's name by later advertised peripheral.

If the UUID mismatches nothing is done.

Parameters
peripheralLater advertised peripheral that should update the current peripheral.

Property Documentation

§ Address

BluetoothAddress Arendi.BleLibrary.Remote.IPeripheral.Address
get

Get the bluetooth address of the peripheral.

This information is not available on all platforms. Platforms not supporting this information will have set this property to null.

§ Bond

IBond Arendi.BleLibrary.Remote.IPeripheral.Bond
get

Get the bonding associated with this peripheral.
If there is no bonding with this device or if the platform doesn't support bonding handling null is returned.

§ Central

ICentral Arendi.BleLibrary.Remote.IPeripheral.Central
get

Gets the central instance the peripheral has been created by.

§ ConnectionParameter

IConnectionParameter Arendi.BleLibrary.Remote.IPeripheral.ConnectionParameter
get

Get the connection parameter of the connection to this device. If the peripheral is not connected or the adapter doesn't provide access to connection parameters null is returned.

§ ConnectionSecurity

IConnectionSecurity Arendi.BleLibrary.Remote.IPeripheral.ConnectionSecurity
get

Get the connection security of the connection to this device. If the peripheral is not connected or the adapter doesn't provide access to connection parameters null is returned.

§ IsConnected

bool Arendi.BleLibrary.Remote.IPeripheral.IsConnected
get

Check if the peripheral is currently connected.

§ Name

string Arendi.BleLibrary.Remote.IPeripheral.Name
getset

The name of the peripheral

§ ServiceList

IEnumerable<IService> Arendi.BleLibrary.Remote.IPeripheral.ServiceList
get

Get the service list of the peripheral.

This list may be limited if you use a limited BleLibrary edition. Contact Arendi AG (www.arendi.ch) for further information.

§ State

State Arendi.BleLibrary.Remote.IPeripheral.State
get

Get the state of the peripheral.

§ Uuid

Uuid Arendi.BleLibrary.Remote.IPeripheral.Uuid
get

Get the UUID that identifies the peripheral uniquely.

Event Documentation

§ AuthenticationPasskeyComplete

EventHandler<AuthenticationPasskeyCompleteEventArgs> Arendi.BleLibrary.Remote.IPeripheral.AuthenticationPasskeyComplete

Event triggered if a passkey display (see AuthenticationPasskeyDisplay) or entry (AuthenticationPasskeyEntry) may be terminated..

§ AuthenticationPasskeyDisplay

EventHandler<AuthenticationPasskeyDisplayEventArgs> Arendi.BleLibrary.Remote.IPeripheral.AuthenticationPasskeyDisplay

Event triggered if a passkey has to be displayed.

§ AuthenticationPasskeyEntry

EventHandler<AuthenticationPasskeyEntryEventArgs> Arendi.BleLibrary.Remote.IPeripheral.AuthenticationPasskeyEntry

Event triggered if a passkey has to be inserted. The passkey should be provided by calling AuthenticationPasskeyEntryReply.

§ BondChanged

EventHandler<BondChangedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.BondChanged

Event triggered, when the bond property has changed.

§ Connected

EventHandler<ConnectedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.Connected

Event triggered, when the peripheral gets connected.

§ ConnectFailed

EventHandler<ConnectFailedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.ConnectFailed

Event triggered, when a connect operation has been completed failed.

§ ConnectionParameterChanged

EventHandler<ConnectionParameterChangedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.ConnectionParameterChanged

Event triggered, when the connection parameter have changed.

§ ConnectionSecurityChanged

EventHandler<ConnectionSecurityChangedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.ConnectionSecurityChanged

Event triggered, when the connection security has changed.

§ ConnectSucceeded

EventHandler<ConnectSucceededEventArgs> Arendi.BleLibrary.Remote.IPeripheral.ConnectSucceeded

Event triggered, when a connect operation has been completed successfully.

§ Disconnected

EventHandler<DisconnectedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.Disconnected

Event triggered, when the peripheral gets disconnected.

§ DisconnectFailed

EventHandler<DisconnectFailedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.DisconnectFailed

Event triggered, when a disconnect operation has been completed failed.

§ DisconnectSucceeded

EventHandler<DisconnectSucceededEventArgs> Arendi.BleLibrary.Remote.IPeripheral.DisconnectSucceeded

Event triggered, when a disconnect operation has been completed successfully.

§ Encrypted

EventHandler<EncryptedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.Encrypted

Event triggered if the connection is encrypted.

§ RssiRead

EventHandler<RssiReadEventArgs> Arendi.BleLibrary.Remote.IPeripheral.RssiRead

Event triggered, when the reading of the RSSI initiated by the ReadRssi method has been completed (EAP).

§ ServicesDiscovered

EventHandler<ServicesDiscoveredEventArgs> Arendi.BleLibrary.Remote.IPeripheral.ServicesDiscovered

Event triggered, when the discovering of the services initiated by the DiscoverServices method has been completed (EAP).

§ StateChanged

EventHandler<StateChangedEventArgs> Arendi.BleLibrary.Remote.IPeripheral.StateChanged

Event triggered, when the state of the peripheral changes.