#include <connection2.h>
Classes | |
struct | ConnectionOptions |
Represents parameters that are set on a per-connection basis. More... | |
struct | ConnectionParameters |
Actual connection parameters returned by the controller. More... | |
struct | ConnectL2capParameters |
struct | RequestedConnectionParameters |
Public Types | |
enum class | ConnectionParameterUpdateError : uint8_t { kFailure , kInvalidParameters , kRejected } |
Possible errors when updating the connection parameters. | |
enum class | DisconnectReason : uint8_t { kFailure , kRemoteUserTerminatedConnection , kConnectionTimeout } |
Possible reasons a connection was disconnected. More... | |
using | Ptr = internal::RaiiPtr< Connection2, &Connection2::Release > |
Public Member Functions | |
virtual | ~Connection2 ()=default |
virtual async2::Poll< DisconnectReason > | PendDisconnect (async2::Context &cx)=0 |
virtual gatt::Client2 * | GattClient ()=0 |
virtual uint16_t | AttMtu ()=0 |
virtual async2::Poll< uint16_t > | PendAttMtuChange (async2::Context &cx)=0 |
virtual ConnectionParameters | Parameters ()=0 |
Returns the current connection parameters. | |
virtual async2::OnceReceiver< pw::expected< void, ConnectionParameterUpdateError > > | RequestParameterUpdate (RequestedConnectionParameters parameters)=0 |
virtual async2::OnceReceiver< pw::Result< Channel::Ptr > > | ConnectL2cap (ConnectL2capParameters parameters)=0 |
Private Member Functions | |
virtual void | Release ()=0 |
Class that represents a connection to a peer. This can be used to interact with GATT services and establish LE L2CAP channels.
The lifetime of this object is tied to that of the LE connection it represents. Destroying the object results in a disconnection.
using pw::bluetooth::low_energy::Connection2::Ptr = internal::RaiiPtr<Connection2, &Connection2::Release> |
Movable Connection2
smart pointer. When Connection::Ptr
is destroyed the Connection2
will disconnect automatically.
|
strong |
|
virtualdefault |
If a disconnection has not occurred, destroying this object will result in disconnection.
|
pure virtual |
Returns the current ATT Maximum Transmission Unit. By subtracting ATT headers from the MTU, the maximum payload size of messages can be calculated.
|
pure virtual |
Connect to an L2CAP LE connection-oriented channel.
parameters | The parameters to configure the channel with. |
Channel
that can be used to exchange data.
|
pure virtual |
Returns a GATT client to the connected peer that is valid for the lifetime of this Connection2
object. Connection2
is considered alive as long as PendDisconnect()
returns pending and the object hasn't been destroyed.
|
pure virtual |
Returns Pending until the ATT MTU changes, at which point cx
will be awoken. Returns Ready with the new ATT MTU once the ATT MTU has been changed. The ATT MTU can only be changed once.
|
pure virtual |
Returns Ready after the peer disconnects or there is a connection error that caused a disconnection. Awakens cx
on disconnect.
|
privatepure virtual |
Request to destroy this connection. This method is called by the ~Connection2Ptr() when it goes out of scope, the API client should never call this method.
|
pure virtual |
Requests an update to the connection parameters.