Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FXAS21002 FXOS8700Q
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) m2m_deprecated | |
Constructor. | |
SimpleM2MResourceInt (MbedCloudClient *client, const char *route, int v, M2MBase::Operation opr, bool observable, void(*on_update)(int)) m2m_deprecated | |
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 222 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.
- Note:
- This class is deprecated and may be removed in future releases.
- 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 264 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
- Note:
- This class is deprecated and may be removed in future releases.
- 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 279 of file SimpleM2MResource.cpp.
~SimpleM2MResourceInt | ( | ) | [virtual] |
Destructor.
Definition at line 297 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 125 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 203 of file SimpleM2MResource.cpp.
operator int | ( | ) | const |
Overloaded operator for int() operation.
Definition at line 307 of file SimpleM2MResource.cpp.
int operator= | ( | int | new_value ) |
Overloaded operator for = operation.
Definition at line 301 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 163 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 144 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 172 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 187 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 315 of file SimpleM2MResource.cpp.
Generated on Tue Jul 12 2022 20:21:06 by
