Friendly LWM2M client
wpp::ObjectImpl< T > Class Template Reference

The ObjectImpl class is a template class that represents an implementation of an object in the Wakaama library. More...

#include <ObjectImpl.h>

+ Inheritance diagram for wpp::ObjectImpl< T >:
+ Collaboration diagram for wpp::ObjectImpl< T >:

Public Member Functions

 ObjectImpl (lwm2m_context_t &context)
 
 ObjectImpl (lwm2m_context_t &context, const ObjectInfo &info)
 Constructs an ObjectImpl object. More...
 
 ~ObjectImpl ()
 
InstancecreateInstance (ID_T instanceID=ID_T_MAX_VAL) override
 Creates a new instance of the object. More...
 
- Public Member Functions inherited from wpp::Object
 Object (lwm2m_context_t &context)
 
 Object (lwm2m_context_t &context, const ObjectInfo &info)
 Constructs an Object instance. More...
 
virtual ~Object ()
 Destroys the Object instance. More...
 
OBJ_ID getObjectID () const
 Gets the object ID. More...
 
const ObjectInfogetObjectInfo () const
 Gets the object information. More...
 
lwm2m_object_t & getLwm2mObject ()
 Gets the lwm2m_object_t object. More...
 
lwm2m_context_t & getContext ()
 Return context that can be used by derived class. More...
 
WppClientgetClient ()
 Helpfull methods to get client instances. More...
 
WppRegistrygetRegistry ()
 Helpfull methods to get registry instances. More...
 
bool remove (ID_T instanceID)
 Removes an instance of the object. More...
 
void clear ()
 Clears the object. More...
 
Instanceinstance (ID_T instanceID=ID_T_MAX_VAL)
 Gets an instance of the object. More...
 
const std::vector< Instance * > & instances ()
 Gets all instances of the object. More...
 
size_t instanceCnt ()
 Gets the number of instances of the object. More...
 
bool isExist (ID_T instanceID)
 Checks if an instance exists. More...
 
- Public Member Functions inherited from wpp::ObjSubject
void opSubscribe (ObjOpObserver *observer)
 Subscribes an observer to receive notifications about object operations. More...
 
void opUnsubscribe (ObjOpObserver *observer)
 Unsubscribes an observer from receiving notifications about object operations. More...
 

Additional Inherited Members

- Protected Member Functions inherited from wpp::Object
std::vector< Instance * >::iterator getInstIter (ID_T instanceID)
 Gets the iterator to the instance. More...
 
ID_T getFirstAvailableInstanceID ()
 Gets the first available instance ID. More...
 
- Protected Member Functions inherited from wpp::ObjSubject
void operationNotify (Object &obj, ID_T instanceId, ItemOp::TYPE type)
 Notifies observers about object operations. More...
 
- Static Protected Member Functions inherited from wpp::Object
static uint8_t serverRead_clb (lwm2m_context_t *contextP, lwm2m_server_t *server, ID_T instanceId, int *numDataP, lwm2m_data_t **dataArrayP, lwm2m_object_t *objectP)
 The read callback function for the Lwm2m core. More...
 
static uint8_t serverWrite_clb (lwm2m_context_t *contextP, lwm2m_server_t *server, ID_T instanceId, int numData, lwm2m_data_t *dataArray, lwm2m_object_t *objectP, lwm2m_write_type_t writeType)
 The write callback function for the Lwm2m core. More...
 
static uint8_t serverExecute_clb (lwm2m_context_t *contextP, lwm2m_server_t *server, ID_T instanceId, ID_T resId, uint8_t *buffer, int length, lwm2m_object_t *objectP)
 The execute callback function for the Lwm2m core. More...
 
static uint8_t serverDiscover_clb (lwm2m_context_t *contextP, lwm2m_server_t *server, ID_T instanceId, int *numDataP, lwm2m_data_t **dataArrayP, lwm2m_object_t *objectP)
 The discover callback function for the Lwm2m core. More...
 
static uint8_t serverCreate_clb (lwm2m_context_t *contextP, lwm2m_server_t *server, ID_T instanceId, int numData, lwm2m_data_t *dataArray, lwm2m_object_t *objectP)
 The create callback function for the Lwm2m core. More...
 
static uint8_t serverDelete_clb (lwm2m_context_t *contextP, lwm2m_server_t *server, ID_T instanceId, lwm2m_object_t *objectP)
 The delete callback function for the Lwm2m core. More...
 
- Protected Attributes inherited from wpp::Object
std::vector< Instance * > _instances
 
lwm2m_context_t & _context
 
lwm2m_object_t _lwm2m_object
 
ObjectInfo _objInfo
 

Detailed Description

template<typename T>
class wpp::ObjectImpl< T >

The ObjectImpl class is a template class that represents an implementation of an object in the Wakaama library.

Template Parameters
TThe type of the object.

The ObjectImpl class provides functionality for creating and managing instances of the object. It inherits from the Object class and overrides its methods to provide the implementation specific to the object type. The ObjectImpl class is intended to be used as a base class for implementing custom objects in the Wakaama library.

Definition at line 25 of file ObjectImpl.h.

Constructor & Destructor Documentation

◆ ObjectImpl() [1/2]

template<typename T >
wpp::ObjectImpl< T >::ObjectImpl ( lwm2m_context_t &  context)
inline

Default constructor.

Definition at line 30 of file ObjectImpl.h.

◆ ObjectImpl() [2/2]

template<typename T >
wpp::ObjectImpl< T >::ObjectImpl ( lwm2m_context_t &  context,
const ObjectInfo info 
)
inline

Constructs an ObjectImpl object.

Parameters
contextThe lwm2m_context_t object.
infoThe ObjectInfo object.

Definition at line 36 of file ObjectImpl.h.

◆ ~ObjectImpl()

template<typename T >
wpp::ObjectImpl< T >::~ObjectImpl ( )
inline

Definition at line 37 of file ObjectImpl.h.

Member Function Documentation

◆ createInstance()

template<typename T >
Instance * wpp::ObjectImpl< T >::createInstance ( ID_T  instanceID = ID_T_MAX_VAL)
overridevirtual

Creates a new instance of the object.

Parameters
instanceIDThe ID of the instance to create. Defaults to ID_T_MAX_VAL.
Returns
A pointer to the created instance of general type, or nullptr if the instance could not be created.

Implements wpp::Object.

Definition at line 51 of file ObjectImpl.h.