Friendly LWM2M client
wpp::WppClient Class Reference

Represents a client interface for Wpp library. More...

#include <WppClient.h>

+ Collaboration diagram for wpp::WppClient:

Classes

struct  ClientInfo
 Represents the information required to create a WppClient. More...
 

Public Types

using WppErrHandler = std::function< void(WppClient &client, int errCode)>
 

Public Member Functions

 ~WppClient ()
 
void giveOwnership ()
 Gives up ownership of the WppClient. More...
 
WppConnectionconnection ()
 Gets the WppConnection associated with the WppClient. More...
 
WppRegistryregistry ()
 Gets the WppRegistry associated with the WppClient. More...
 
lwm2m_client_state_t getState ()
 Gets the state of the Wakaama client. More...
 
lwm2m_context_t & getContext ()
 Gets the LwM2M context associated with the WppClient. More...
 
time_t loop ()
 Processes the state of the Wakaama core. This function performs the necessary work by the Wakaama core, such as (re)sending packets, handles received packets from servers, and created tasks. More...
 
void deregister ()
 Deregisters the client from the servers. More...
 

Static Public Member Functions

static bool create (const ClientInfo &info, WppConnection &connection, WppErrHandler errHandler=NULL)
 Creates a WppClient with the specified client information, connection, and maximum sleep time. More...
 
static void remove ()
 Removes the WppClient. More...
 
static bool isCreated ()
 Checks if the WppClient is created. More...
 
static WppClienttakeOwnership ()
 Takes ownership of the WppClient. More...
 
static WppClienttakeOwnershipBlocking ()
 Takes ownership of the WppClient, blocking until it becomes available. More...
 

Detailed Description

Represents a client interface for Wpp library.

The WppClient class provides methods for managing the Wpp library, accessing its components, and processing the state of the Wakaama core. It allows users to create, remove, and check if the WppClient is created. Users can also take ownership of the client, interact with its connection and registry, and perform server registration and deregistration.

Note
To interact with the WppClient, it is necessary to take ownership of it. Only one actor can have access to the client at a time to synchronize access to the registry and avoid simultaneous writing, reading, or deleting of Instance or Resource.

Definition at line 37 of file WppClient.h.

Member Typedef Documentation

◆ WppErrHandler

using wpp::WppClient::WppErrHandler = std::function<void(WppClient &client, int errCode)>

Definition at line 49 of file WppClient.h.

Constructor & Destructor Documentation

◆ ~WppClient()

wpp::WppClient::~WppClient ( )

Definition at line 24 of file WppClient.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ connection()

WppConnection & wpp::WppClient::connection ( )

Gets the WppConnection associated with the WppClient.

Returns
The WppConnection object.

Definition at line 89 of file WppClient.cpp.

+ Here is the caller graph for this function:

◆ create()

bool wpp::WppClient::create ( const ClientInfo info,
WppConnection connection,
WppErrHandler  errHandler = NULL 
)
static

Creates a WppClient with the specified client information, connection, and maximum sleep time.

Parameters
infoThe client information required to create the WppClient.
connectionThe WppConnection object to be associated with the client.
Returns
True if the WppClient is created successfully, false otherwise.

Definition at line 39 of file WppClient.cpp.

+ Here is the call graph for this function:

◆ deregister()

void wpp::WppClient::deregister ( )

Deregisters the client from the servers.

Definition at line 139 of file WppClient.cpp.

◆ getContext()

lwm2m_context_t & wpp::WppClient::getContext ( )

Gets the LwM2M context associated with the WppClient.

Returns
The LwM2M context object.

Definition at line 102 of file WppClient.cpp.

+ Here is the caller graph for this function:

◆ getState()

lwm2m_client_state_t wpp::WppClient::getState ( )

Gets the state of the Wakaama client.

Returns
The state of the client as lwm2m_client_state_t.

Definition at line 98 of file WppClient.cpp.

+ Here is the caller graph for this function:

◆ giveOwnership()

void wpp::WppClient::giveOwnership ( )

Gives up ownership of the WppClient.

Definition at line 81 of file WppClient.cpp.

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

◆ isCreated()

bool wpp::WppClient::isCreated ( )
static

Checks if the WppClient is created.

Returns
True if the WppClient is created, false otherwise.

Definition at line 62 of file WppClient.cpp.

+ Here is the caller graph for this function:

◆ loop()

time_t wpp::WppClient::loop ( )

Processes the state of the Wakaama core. This function performs the necessary work by the Wakaama core, such as (re)sending packets, handles received packets from servers, and created tasks.

Returns
The time interval after which the function should be called again.

Definition at line 106 of file WppClient.cpp.

+ Here is the call graph for this function:

◆ registry()

WppRegistry & wpp::WppClient::registry ( )

Gets the WppRegistry associated with the WppClient.

Returns
The WppRegistry object.

Definition at line 93 of file WppClient.cpp.

+ Here is the caller graph for this function:

◆ remove()

void wpp::WppClient::remove ( )
static

Removes the WppClient.

Definition at line 54 of file WppClient.cpp.

+ Here is the call graph for this function:

◆ takeOwnership()

WppClient * wpp::WppClient::takeOwnership ( )
static

Takes ownership of the WppClient.

Returns
A pointer to the WppClient if available, or NULL if the client is occupied by another actor or uninitialized.

Definition at line 66 of file WppClient.cpp.

+ Here is the call graph for this function:

◆ takeOwnershipBlocking()

WppClient * wpp::WppClient::takeOwnershipBlocking ( )
static

Takes ownership of the WppClient, blocking until it becomes available.

Returns
A pointer to the WppClient if available, or NULL if the client is uninitialized.

Definition at line 73 of file WppClient.cpp.

+ Here is the call graph for this function: