Simple interface for Mbed Cloud Client
SimpleM2MResourceString Class Reference
SimpleM2MResourceString. More...
#include <SimpleM2MResource.h>
Inherits SimpleM2MResourceBase.
Public Member Functions | |
SimpleM2MResourceString (MbedCloudClient *client, const char *route, string v, M2MBase::Operation opr=M2MBase::GET_PUT_ALLOWED, bool observable=true, FP1< void, string > on_update=NULL) | |
Constructor. | |
SimpleM2MResourceString (MbedCloudClient *client, const char *route, string v, M2MBase::Operation opr, bool observable, void(*on_update)(string)) | |
Constructor. | |
virtual | ~SimpleM2MResourceString () |
Destructor. | |
string | operator= (const string &new_value) |
Overloaded operator for = operation. | |
operator string () const | |
Overloaded operator for string() operation. | |
virtual void | update () |
Calls when there is an indication that the value of the resource object is updated by the LWM2M Cloud server. | |
bool | define_resource_internal (string v, M2MBase::Operation opr, bool observable) |
Defines M2MResource internally and creates a necessary LWM2M structure like object and object instance based on the given string URI path and sets the right M2M operation to the resource. | |
string | get () const |
Gets the value set in a resource in text format. | |
bool | set (string v) |
Sets the value in a resource in text format. | |
bool | set (const int &v) |
Sets the value in a resource in integer format. | |
bool | set_post_function (void(*fn)(void *)) |
Sets the callback function to be called when the resource received a POST command. | |
bool | set_post_function (execute_callback fn) |
Sets the callback function to be called when a resource received the POST command. | |
M2MResource * | get_resource () |
Returns the M2MResource object of the registered object through the SimpleM2MResourceBase objects. |
Detailed Description
This class provides an easy wrapper base class for creating a simple M2MResource based on string values. This class provides an easy access to the M2MResource objects without the application requiring to create Objects and Object Instances.
Definition at line 141 of file SimpleM2MResource.h.
Constructor & Destructor Documentation
SimpleM2MResourceString | ( | MbedCloudClient * | client, |
const char * | route, | ||
string | v, | ||
M2MBase::Operation | opr = M2MBase::GET_PUT_ALLOWED , |
||
bool | observable = true , |
||
FP1< void, string > | on_update = NULL |
||
) |
Constructor.
- Parameters:
-
client A handler for MbedCloudClient. route The route for the resource such as "Test/0/res". v The value of the resource. opr An operation that can be supported by the resource. observable True if the resource is observable. on_update If the resource supports the PUT operation, a function pointer for the callback function that is called when the client receives an updated value for this resource.
Definition at line 210 of file SimpleM2MResource.cpp.
SimpleM2MResourceString | ( | MbedCloudClient * | client, |
const char * | route, | ||
string | v, | ||
M2MBase::Operation | opr, | ||
bool | observable, | ||
void(*)(string) | on_update | ||
) |
Constructor.
This is overloaded function.
- Parameters:
-
client A handler for MbedCloudClient. route The route for the resource such as "Test/0/res". v The value of the resource. opr An operation that can be supported by the resource. observable True if resource is observable. on_update If the resource supports the PUT operation, a function pointer for the callback function that is called when the client receives an updated value for this resource.
Definition at line 222 of file SimpleM2MResource.cpp.
~SimpleM2MResourceString | ( | ) | [virtual] |
Destructor.
Definition at line 238 of file SimpleM2MResource.cpp.
Member Function Documentation
bool define_resource_internal | ( | string | v, |
M2MBase::Operation | opr, | ||
bool | observable | ||
) | [inherited] |
Defines M2MResource internally and creates a necessary LWM2M structure like object and object instance based on the given string URI path and sets the right M2M operation to the resource.
- Parameters:
-
v The URI path for the resource "Test/0/res" in this format. opr An operation to be set for the resource. observable True if the resource is observable, else false.
- Returns:
- True if resource is created, else false.
string get | ( | ) | const [inherited] |
Gets the value set in a resource in text format.
- Returns:
- The value set in the resource.
Definition at line 123 of file SimpleM2MResource.cpp.
M2MResource * get_resource | ( | ) | [inherited] |
Returns the M2MResource object of the registered object through the SimpleM2MResourceBase objects.
- Returns:
- The object of the M2MResource.
Definition at line 201 of file SimpleM2MResource.cpp.
operator string | ( | ) | const |
Overloaded operator for string() operation.
Definition at line 249 of file SimpleM2MResource.cpp.
string operator= | ( | const string & | new_value ) |
Overloaded operator for = operation.
Definition at line 242 of file SimpleM2MResource.cpp.
bool set | ( | const int & | v ) | [inherited] |
Sets the value in a resource in integer format.
- Parameters:
-
v The value to be set.
- Returns:
- True if set successfully, else false.
Definition at line 161 of file SimpleM2MResource.cpp.
bool set | ( | string | v ) | [inherited] |
Sets the value in a resource in text format.
- Parameters:
-
v The value to be set.
- Returns:
- True if set successfully, else false.
Definition at line 142 of file SimpleM2MResource.cpp.
bool set_post_function | ( | void(*)(void *) | fn ) | [inherited] |
Sets the callback function to be called when the resource received a POST command.
- Parameters:
-
fn A function to be called. This is used for a statically defined function.
- Returns:
- True if set successfully, else false.
Definition at line 170 of file SimpleM2MResource.cpp.
bool set_post_function | ( | execute_callback | fn ) | [inherited] |
Sets the callback function to be called when a resource received the POST command.
- Parameters:
-
fn A function to be called. This is an overloaded function for a class function.
- Returns:
- True if set successfully, else false.
Definition at line 185 of file SimpleM2MResource.cpp.
void update | ( | ) | [virtual] |
Calls when there is an indication that the value of the resource object is updated by the LWM2M Cloud server.
Definition at line 256 of file SimpleM2MResource.cpp.
Generated on Tue Jul 12 2022 19:01:39 by 1.7.2