Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

SimpleM2MResourceString Class Reference

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) m2m_deprecated
 Constructor.
 SimpleM2MResourceString (MbedCloudClient *client, const char *route, string v, M2MBase::Operation opr, bool observable, void(*on_update)(string)) m2m_deprecated
 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.
M2MResourceget_resource ()
 Returns the M2MResource object of the registered object through the SimpleM2MResourceBase objects.

Detailed Description

SimpleM2MResourceString.

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 147 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.

Note:
This class is deprecated and may be removed in future releases.
Parameters:
clientA handler for MbedCloudClient.
routeThe route for the resource such as "Test/0/res".
vThe value of the resource.
oprAn operation that can be supported by the resource.
observableTrue if the resource is observable.
on_updateIf 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 212 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.

Note:
This class is deprecated and may be removed in future releases.
Parameters:
clientA handler for MbedCloudClient.
routeThe route for the resource such as "Test/0/res".
vThe value of the resource.
oprAn operation that can be supported by the resource.
observableTrue if resource is observable.
on_updateIf 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 224 of file SimpleM2MResource.cpp.

~SimpleM2MResourceString (  ) [virtual]

Destructor.

Definition at line 240 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:
vThe URI path for the resource "Test/0/res" in this format.
oprAn operation to be set for the resource.
observableTrue 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 string (  ) const

Overloaded operator for string() operation.

Definition at line 251 of file SimpleM2MResource.cpp.

string operator= ( const string &  new_value )

Overloaded operator for = operation.

Definition at line 244 of file SimpleM2MResource.cpp.

bool set ( const int &  v ) [inherited]

Sets the value in a resource in integer format.

Parameters:
vThe 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:
vThe 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:
fnA 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:
fnA 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 258 of file SimpleM2MResource.cpp.