Simulated product dispenser
Fork of mbed-cloud-workshop-connect-HTS221 by
SimpleM2MResourceInt Class Reference
#include <SimpleM2MResource.h>
Inherits SimpleM2MResourceBase.
Public Member Functions | |
SimpleM2MResourceInt (MbedCloudClient *client, const char *route, int v, M2MBase::Operation opr=M2MBase::GET_PUT_ALLOWED, bool observable=true, FP1< void, int > on_update=NULL) | |
Constructor. | |
SimpleM2MResourceInt (MbedCloudClient *client, const char *route, int v, M2MBase::Operation opr, bool observable, void(*on_update)(int)) | |
Constructor. | |
virtual | ~SimpleM2MResourceInt () |
Destructor. | |
int | operator= (int new_value) |
Overloaded operator for = operation. | |
operator int () const | |
Overloaded operator for int() 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 integer values. This class provides easy access to M2MResource objects without the application requiring to create Objects and Object Instances.
Definition at line 214 of file SimpleM2MResource.h.
Constructor & Destructor Documentation
SimpleM2MResourceInt | ( | MbedCloudClient * | client, |
const char * | route, | ||
int | v, | ||
M2MBase::Operation | opr = M2MBase::GET_PUT_ALLOWED , |
||
bool | observable = true , |
||
FP1< void, int > | 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, else false. 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 262 of file SimpleM2MResource.cpp.
SimpleM2MResourceInt | ( | MbedCloudClient * | client, |
const char * | route, | ||
int | v, | ||
M2MBase::Operation | opr, | ||
bool | observable, | ||
void(*)(int) | on_update | ||
) |
Constructor.
This is an 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 the resource is observable, else false. 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 277 of file SimpleM2MResource.cpp.
~SimpleM2MResourceInt | ( | ) | [virtual] |
Destructor.
Definition at line 295 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 int | ( | ) | const |
Overloaded operator for int() operation.
Definition at line 305 of file SimpleM2MResource.cpp.
int operator= | ( | int | new_value ) |
Overloaded operator for = operation.
Definition at line 299 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 313 of file SimpleM2MResource.cpp.
Generated on Tue Jul 12 2022 19:12:20 by 1.7.2