esp-nimble-cpp 2.3.0
|
Encapsulates a L2CAP channel. More...
#include <NimBLEL2CAPChannel.h>
Public Member Functions | |
bool | write (const std::vector< uint8_t > &bytes) |
Write data to the channel. | |
bool | isConnected () const |
Static Public Member Functions | |
static NimBLEL2CAPChannel * | connect (NimBLEClient *client, uint16_t psm, uint16_t mtu, NimBLEL2CAPChannelCallbacks *callbacks) |
Open an L2CAP channel via the specified PSM and MTU. | |
Encapsulates a L2CAP channel.
This class is used to encapsulate a L2CAP connection oriented channel, both from the "server" (which waits for the connection to be opened) and the "client" (which opens the connection) point of view.
|
static |
Open an L2CAP channel via the specified PSM and MTU.
[in] | psm | The PSM to use. |
[in] | mtu | The MTU to use. Note that this is the local MTU. Upon opening the channel, the final MTU will be negotiated to be the minimum of local and remote. |
[in] | callbacks | The callbacks to use. NOTE that these callbacks are called from the context of the NimBLE bluetooth task (nimble_host ) and MUST be handled as fast as possible. |
|
inline |
bool NimBLEL2CAPChannel::write | ( | const std::vector< uint8_t > & | bytes | ) |
Write data to the channel.
If the size of the data exceeds the MTU, the data will be split into multiple fragments.
NOTE: This function will block until the data has been sent or an error occurred.