Friendly LWM2M client
wpp::WppConnection Class Referenceabstract

#include <WppConnection.h>

+ Collaboration diagram for wpp::WppConnection:

Classes

struct  Packet
 

Public Types

using SESSION_T = void *
 

Public Member Functions

 WppConnection ()
 
virtual ~WppConnection ()
 
 WppConnection (const WppConnection &)=delete
 
 WppConnection (WppConnection &&)=delete
 
WppConnectionoperator= (const WppConnection &)=delete
 
WppConnectionoperator= (WppConnection &&)=delete
 
virtual SESSION_T connect (Lwm2mSecurity &security)=0
 Establishes a connection using the provided Lwm2mSecurity object. More...
 
virtual void disconnect (SESSION_T session)=0
 Disconnects from the specified session. More...
 
virtual bool sessionCmp (SESSION_T session1, SESSION_T session2)=0
 Compares two session identifiers. More...
 
virtual bool sendPacket (const Packet &packet)=0
 Sends a packet over the connection. More...
 
bool addPacketToQueue (const Packet &packet)
 Adds a packet to the packet queue. More...
 
uint8_t getPacketQueueSize ()
 Retrieves the size of the packet queue. More...
 
void clearPacketQueue ()
 Clears the packet queue. More...
 
bool setDataBlockSize (uint16_t size)
 Sets the COAP block size. More...
 
uint16_t getDataBlockSize ()
 Retrieves the COAP block size. More...
 
void handlePacketsInQueue (WppClient &client)
 Processes the packets in the packet queue. More...
 

Detailed Description

Definition at line 35 of file WppConnection.h.

Member Typedef Documentation

◆ SESSION_T

Definition at line 37 of file WppConnection.h.

Constructor & Destructor Documentation

◆ WppConnection() [1/3]

wpp::WppConnection::WppConnection ( )

Definition at line 16 of file WppConnection.cpp.

◆ ~WppConnection()

wpp::WppConnection::~WppConnection ( )
virtual

Definition at line 18 of file WppConnection.cpp.

+ Here is the call graph for this function:

◆ WppConnection() [2/3]

wpp::WppConnection::WppConnection ( const WppConnection )
delete

◆ WppConnection() [3/3]

wpp::WppConnection::WppConnection ( WppConnection &&  )
delete

Member Function Documentation

◆ addPacketToQueue()

bool wpp::WppConnection::addPacketToQueue ( const Packet packet)

Adds a packet to the packet queue.

This method adds a packet to the packet queue for processing by the WppClient::loop() method. The packet will be copied into the queue, so the user is responsible for deleting the memory occupied by the packet.

Parameters
packetThe packet to be added to the queue.
Returns
true if the packet was successfully added to the queue, false otherwise.

Definition at line 24 of file WppConnection.cpp.

+ Here is the call graph for this function:

◆ clearPacketQueue()

void wpp::WppConnection::clearPacketQueue ( )

Clears the packet queue.

This method clears the packet queue, deleting all the packets in the queue.

Definition at line 44 of file WppConnection.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ connect()

virtual SESSION_T wpp::WppConnection::connect ( Lwm2mSecurity security)
pure virtual

Establishes a connection using the provided Lwm2mSecurity object.

This method must be implemented by the user to establish a connection using the provided Lwm2mSecurity object. The method should return a session identifier that represents the established connection.

Parameters
securityThe Lwm2mSecurity object used to establish the connection.
Returns
The session identifier representing the established connection.
+ Here is the caller graph for this function:

◆ disconnect()

virtual void wpp::WppConnection::disconnect ( SESSION_T  session)
pure virtual

Disconnects from the specified session.

This method must be implemented by the user to disconnect from the specified session.

Parameters
sessionThe session identifier representing the connection to disconnect from.
+ Here is the caller graph for this function:

◆ getDataBlockSize()

uint16_t wpp::WppConnection::getDataBlockSize ( )

Retrieves the COAP block size.

This method retrieves the currently set COAP block size.

Returns
The currently set COAP block size.

Definition at line 60 of file WppConnection.cpp.

◆ getPacketQueueSize()

uint8_t wpp::WppConnection::getPacketQueueSize ( )

Retrieves the size of the packet queue.

This method returns the size of the packet queue.

Returns
The size of the packet queue.

Definition at line 40 of file WppConnection.cpp.

+ Here is the caller graph for this function:

◆ handlePacketsInQueue()

void wpp::WppConnection::handlePacketsInQueue ( WppClient client)

Processes the packets in the packet queue.

This method is called by the WppClient in its loop() method if the packet queue contains at least one packet. It processes all the packets found in the queue. If an error occurs during the processing of a packet, it is deleted. But it can be also called by the user if he wants to process immediately.

Parameters
clientThe WppClient object used for packet processing.

Definition at line 64 of file WppConnection.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator=() [1/2]

WppConnection& wpp::WppConnection::operator= ( const WppConnection )
delete

◆ operator=() [2/2]

WppConnection& wpp::WppConnection::operator= ( WppConnection &&  )
delete

◆ sendPacket()

virtual bool wpp::WppConnection::sendPacket ( const Packet packet)
pure virtual

Sends a packet over the connection.

This method must be implemented by the user to send a packet over the connection. The method should return true if the packet was successfully sent, and false otherwise.

Parameters
packetThe packet to be sent over the connection.
Returns
true if the packet was successfully sent, false otherwise.
+ Here is the caller graph for this function:

◆ sessionCmp()

virtual bool wpp::WppConnection::sessionCmp ( SESSION_T  session1,
SESSION_T  session2 
)
pure virtual

Compares two session identifiers.

This method must be implemented by the user to compare two session identifiers. It should return true if the session identifiers are equal, and false otherwise.

Parameters
session1The first session identifier to compare.
session2The second session identifier to compare.
Returns
true if the session identifiers are equal, false otherwise.
+ Here is the caller graph for this function:

◆ setDataBlockSize()

bool wpp::WppConnection::setDataBlockSize ( uint16_t  size)

Sets the COAP block size.

This method sets the COAP block size to the specified value.

Parameters
sizeThe COAP block size to set.
Returns
true if the COAP block size was successfully set, false otherwise.

Definition at line 55 of file WppConnection.cpp.