|
Friendly LWM2M client
|
#include <Device.h>
Inheritance diagram for wpp::Device:
Collaboration diagram for wpp::Device:Public Types | |
| enum | ID : ID_T { MANUFACTURER_0 = 0 , MODEL_NUMBER_1 = 1 , SERIAL_NUMBER_2 = 2 , FIRMWARE_VERSION_3 = 3 , REBOOT_4 = 4 , ERROR_CODE_11 = 11 , CURRENT_TIME_13 = 13 , SUPPORTED_BINDING_AND_MODES_16 = 16 } |
| enum | ErrCode : uint8_t { NO_ERROR = 0 , LOW_BAT = 1 , EXT_PWR_SUPP_OFF = 2 , GPS_FAIL = 3 , LOW_SIG_STRENGTH = 4 , OUT_OF_MEM = 5 , SMS_FAIL = 6 , IP_CONN_FAIL = 7 , PERIPH_FAIL = 8 , ERR_CODE_MAX } |
Public Member Functions | |
| Device (lwm2m_context_t &context, const OBJ_LINK_T &id) | |
| ~Device () | |
Public Member Functions inherited from wpp::Instance | |
| Instance (lwm2m_context_t &context, const OBJ_LINK_T &id) | |
| virtual | ~Instance () |
| Instance (const Instance &)=delete | |
| Instance (Instance &&)=delete | |
| Instance & | operator= (const Instance &)=delete |
| Instance & | operator= (Instance &&)=delete |
| OBJ_LINK_T | getLink () const |
| OBJ_ID | getObjectID () const |
| ID_T | getInstanceID () const |
| lwm2m_context_t & | getContext () |
| Return context that can be used by derived class. More... | |
| WppClient & | getClient () |
| Helpfull methods to get client instances. More... | |
| WppRegistry & | getRegistry () |
| Helpfull methods to get registry instances. More... | |
| uint8_t | readAsServer (lwm2m_server_t *server, int *numDataP, lwm2m_data_t **dataArray) |
| This methods is called by the core when the server wants to read, write, discover, execute the value of the resource. User should not call this methods directly. More... | |
| uint8_t | writeAsServer (lwm2m_server_t *server, int numData, lwm2m_data_t *dataArray, lwm2m_write_type_t writeType) |
| uint8_t | executeAsServer (lwm2m_server_t *server, ID_T resId, uint8_t *buffer, int length) |
| uint8_t | discoverAsServer (lwm2m_server_t *server, int *numDataP, lwm2m_data_t **dataArray) |
Public Member Functions inherited from wpp::InstSubject | |
| void | opSubscribe (InstOpObserver *observer) |
| Subscribes an observer to receive notifications about instance resource operations. More... | |
| void | opUnsubscribe (InstOpObserver *observer) |
| Unsubscribes an observer from receiving notifications about instance resource operations. More... | |
| void | eventSubscribe (InstEventObserver *observer) |
| Subscribes an observer to receive notifications about custom instance events. More... | |
| void | eventUnsubscribe (InstEventObserver *observer) |
| Unsubscribes an observer from receiving notifications about custom instance events. More... | |
Public Member Functions inherited from wpp::ResourceContainer | |
| ResourceContainer ()=default | |
| virtual | ~ResourceContainer ()=default |
| bool | isSingle (ID_T resId) |
| Check if the resource is SINGLE. More... | |
| bool | isMultiple (ID_T resId) |
| Check if the resource is MULTIPLE. More... | |
| bool | isExist (ID_T resId) |
| Check if the instance ID is exist. More... | |
| bool | isExist (ID_T resId, ID_T resInstId) |
| Check if the instance ID is exist. More... | |
| size_t | instCount (ID_T resId) |
| Get the number of resource instances. More... | |
| std::vector< ID_T > | instIds (ID_T resId) |
| Returns vector with available ids of resource instances. More... | |
| ID_T | newInstId (ID_T resId) |
| Find first available instance ID that is not used. More... | |
| template<typename T > | |
| bool | set (ID_T resId, const T &value) |
| Set data value by copy for the resource. More... | |
| template<typename T > | |
| bool | set (ID_T resId, ID_T resInstId, const T &value) |
| Set data value by copy for the resource instance. More... | |
| template<typename T > | |
| bool | set (ID_T resId, T &&value) |
| Set data value by move for the resource. More... | |
| template<typename T > | |
| bool | set (ID_T resId, ID_T resInstId, T &&value) |
| Set data value by move for the resource instance. More... | |
| template<typename T > | |
| const T & | get (ID_T resId, ID_T resInstId=SINGLE_INSTANCE_ID) |
| template<typename T > | |
| bool | add (ID_T resId, const T &value) |
| Add new instance with data value by copy for the MULTIPLE resource. More... | |
| template<typename T > | |
| bool | add (ID_T resId, T &&value) |
| Add new instance with data value by move for the MULTIPLE resource. More... | |
| bool | removeRes (ID_T resId, ID_T resInstId) |
| Remove resource instance if resource is MULTIPLE and instance exists, if the resource is SINGLE remove is not possible. More... | |
| bool | clearRes (ID_T resId) |
| Remove all instances. More... | |
Static Public Member Functions | |
| static Object & | object (WppClient &ctx) |
| Gets the Object reference. More... | |
| static Device * | instance (WppClient &ctx, ID_T instId=ID_T_MAX_VAL) |
| Gets an instance of the object. More... | |
| static Device * | createInst (WppClient &ctx, ID_T instId=ID_T_MAX_VAL) |
| Creates an instance of the object. More... | |
| static bool | removeInst (WppClient &ctx, ID_T instId) |
| Removes an instance of the object. More... | |
Protected Member Functions | |
| void | serverOperationNotifier (Instance *securityInst, ItemOp::TYPE type, const ResLink &resLink) override |
| This method must be implemented by the derived class, and handle information about resource operation (WRITE, EXECUTE). Called by Instance after resource operation performed by SERVER if the operation is WRITE, if the operation is EXECUTE then called before this operation. When the EXECUTE operation, the handler that was set before the serverOperationNotifier() call is used. More... | |
| void | userOperationNotifier (ItemOp::TYPE type, const ResLink &resLink) override |
| This method must be implemented by the derived class, and handle information about resource operation (WRITE, DELETE). Called by Instance after resource operation performed by the USER. More... | |
Protected Member Functions inherited from wpp::Instance | |
| void | notifyResChanged (ID_T resId, ID_T resInstId=ID_T_MAX_VAL) |
| Notify server about resource value change. More... | |
| std::vector< Resource * > | getInstantiatedResList () |
| This method return list with resources that has been instantiated. If resources does not exist then return empty list. More... | |
| std::vector< Resource * > | getInstantiatedResList (const ItemOp &filter) |
| std::vector< Resource * > | getResList () |
| This method return list with all resources that has been defined. If resources does not exist then return empty list. More... | |
| void | resourceOperationNotifier (ItemOp::TYPE type, ID_T resId, ID_T resInstId) override |
| Handle information about resource operation (WRITE, DELETE). Called by ResourceContainer after resource operation performed. More... | |
Protected Member Functions inherited from wpp::InstSubject | |
| void | operationNotify (Instance &inst, const ResLink &resLink, ItemOp::TYPE type) |
| Notifies the observers about an operation on an instance resource. More... | |
| void | eventNotify (Instance &inst, EVENT_ID_T eventId) |
| Notifies the observers about a custom instance event. More... | |
Protected Member Functions inherited from wpp::ResourceContainer | |
| void | setupResources (const std::vector< Resource > &resources) |
| This methods setup resources list. More... | |
| void | setupResources (std::vector< Resource > &&resources) |
| Resource * | resource (ID_T resId) |
| This method return resource ptr if it exists. If resources does not exist then return NULL. More... | |
| std::vector< Resource > & | resources () |
| This method return list with all resources that has been defined. More... | |
| enum wpp::Device::ErrCode : uint8_t |
| enum wpp::Device::ID : ID_T |
| wpp::Device::Device | ( | lwm2m_context_t & | context, |
| const OBJ_LINK_T & | id | ||
| ) |
Definition at line 26 of file Device.cpp.
| wpp::Device::~Device | ( | ) |
|
static |
Creates an instance of the object.
| ctx | - WppClient context |
| instanceID | The instance ID. |
Definition at line 59 of file Device.cpp.
Here is the call graph for this function:
|
static |
Gets an instance of the object.
| ctx | - WppClient context. |
| instId | The instance ID. If not provided, the first available instance is returned. |
Definition at line 53 of file Device.cpp.
Here is the call graph for this function:Gets the Object reference.
| ctx | - WppClient context. |
Definition at line 49 of file Device.cpp.
Here is the call graph for this function:Removes an instance of the object.
| ctx | - WppClient context. |
| instId | The instance ID. |
Definition at line 65 of file Device.cpp.
Here is the call graph for this function:
|
overrideprotectedvirtual |
This method must be implemented by the derived class, and handle information about resource operation (WRITE, EXECUTE). Called by Instance after resource operation performed by SERVER if the operation is
WRITE, if the operation is EXECUTE then called before this operation. When the EXECUTE operation, the handler that was set before the serverOperationNotifier() call is used.
| securityInst | - Contains security instance when the request received from the server or NULL if the request is initiated by the core. |
Implements wpp::Instance.
Definition at line 69 of file Device.cpp.
Here is the call graph for this function:
|
overrideprotectedvirtual |
This method must be implemented by the derived class, and handle information about resource operation (WRITE, DELETE). Called by Instance after resource operation performed by the USER.
Implements wpp::Instance.
Definition at line 79 of file Device.cpp.
Here is the call graph for this function: