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.
Fork of mbedConnectorInterfaceWithDM by
DynamicResource Class Reference
DynamicResource class. More...
#include <DynamicResource.h>
Inherits Resource< string >.
Inherited by DeviceDeRegisterResource.
Public Member Functions | |
| DynamicResource (const Logger *logger, const char *obj_name, const char *res_name, const char *res_type, uint8_t res_mask, const bool observable=false, const ResourceType type=STRING) | |
| Default constructor (char strings) | |
| DynamicResource (const Logger *logger, const char *obj_name, const char *res_name, const char *res_type, const string value, uint8_t res_mask, const bool observable=false, const ResourceType type=STRING) | |
| Default constructor (char strings) | |
| DynamicResource (const Logger *logger, const string obj_name, const string res_name, const string res_type, const string value, uint8_t res_mask, const bool observable=false, const ResourceType type=STRING) | |
| constructor with string buffer for name | |
| DynamicResource (const DynamicResource &resource) | |
| Copy constructor. | |
| virtual | ~DynamicResource () |
| Destructor. | |
| virtual void | bind (void *ep) |
| Bind resource to endpoint. | |
| uint8_t | process (M2MBase::Operation op, M2MBase::BaseType type, void *args=NULL) |
| Process the CoAP message. | |
| virtual string | get () |
| Resource value getter (REQUIRED: must be implemented in derived class as all Binders MUST support and implement GET) | |
| virtual void | put (const string value) |
| Resource value setter (PUT) (OPTIONAL: defaulted noop if not derived. | |
| virtual void | post (void *args) |
| Resource value setter (POST) (OPTIONAL: defaulted noop if not derived. | |
| virtual void | del (void *args) |
| Resource value deleter (OPTIONAL: defaulted noop if not derived. | |
| int | notify (const string data) |
| Send notification of new data. | |
| bool | isObservable () |
| Determine whether this dynamic resource is observable or not. | |
| void | setObserver (void *observer) |
| Set the observer pointer. | |
| void | setContentFormat (uint8_t content_format) |
| Set the content format for responses. | |
| void | setMaxAge (uint8_t maxage) |
| Set the max-age for cache control of responses in a proxy cache. | |
| void | setDataWrapper (DataWrapper *data_wrapper) |
| Set the data wrapper. | |
| virtual void | observe () |
| observe the resource | |
| M2MResource * | getResource () |
| get the base resource representation | |
| void | process_resource_post (void *args) |
| Process a POST message for Resources. | |
| bool | isConnected () |
| Determine if we are connected or not. | |
| bool | isRegistered () |
| Determine if we are registered or not. | |
| void * | getObserver () |
| Get our Observer. | |
| string | getObjName () |
| Get the Object name. | |
| string | getResName () |
| Get the Resource name. | |
| string | getFullName () |
| Get the Full name. | |
| string | getValue () |
| Get the resource value. | |
| void | setName (const string name) |
| Set the resource name. | |
| void | setValue (const stringvalue) |
| Set the resource value. | |
| void | setOptions (const void *options) |
| set the options | |
| void | setEndpoint (const void *endpoint) |
| set the endpoint | |
| int | getInstanceNumber () |
| Get our Instance Number. | |
| void | setInstanceNumber (int instance_number) |
| Set our Instance Number. | |
Detailed Description
DynamicResource class.
Definition at line 34 of file DynamicResource.h.
Constructor & Destructor Documentation
| DynamicResource | ( | const Logger * | logger, |
| const char * | obj_name, | ||
| const char * | res_name, | ||
| const char * | res_type, | ||
| uint8_t | res_mask, | ||
| const bool | observable = false, |
||
| const ResourceType | type = STRING |
||
| ) |
Default constructor (char strings)
- Parameters:
-
logger input logger instance for this resource obj_name input the Object name input the Resource URI/Name res_type input type for the Resource res_mask input the resource enablement mask (GET, PUT, etc...) observable input the resource is Observable (default: FALSE)
Definition at line 46 of file DynamicResource.cpp.
| DynamicResource | ( | const Logger * | logger, |
| const char * | obj_name, | ||
| const char * | res_name, | ||
| const char * | res_type, | ||
| const string | value, | ||
| uint8_t | res_mask, | ||
| const bool | observable = false, |
||
| const ResourceType | type = STRING |
||
| ) |
Default constructor (char strings)
- Parameters:
-
logger input logger instance for this resource obj_name input the Object name input the Resource URI/Name res_type input type for the Resource value input initial value for the Resource res_mask input the resource enablement mask (GET, PUT, etc...) observable input the resource is Observable (default: FALSE)
Definition at line 62 of file DynamicResource.cpp.
| DynamicResource | ( | const Logger * | logger, |
| const string | obj_name, | ||
| const string | res_name, | ||
| const string | res_type, | ||
| const string | value, | ||
| uint8_t | res_mask, | ||
| const bool | observable = false, |
||
| const ResourceType | type = STRING |
||
| ) |
constructor with string buffer for name
- Parameters:
-
logger input logger instance for this resource obj_name input the Object name input the Resource URI/Name res_type input type for the Resource value input initial value for the Resource res_mask input the resource enablement mask (GET, PUT, etc...) observable input the resource is Observable (default: FALSE)
Definition at line 78 of file DynamicResource.cpp.
| DynamicResource | ( | const DynamicResource & | resource ) |
Copy constructor.
- Parameters:
-
resource input the DynamicResource that is to be deep copied
Definition at line 94 of file DynamicResource.cpp.
| ~DynamicResource | ( | ) | [virtual] |
Destructor.
Definition at line 110 of file DynamicResource.cpp.
Member Function Documentation
| void bind | ( | void * | ep ) | [virtual] |
Bind resource to endpoint.
- Parameters:
-
ep input endpoint instance pointer
Implements Resource< string >.
Definition at line 114 of file DynamicResource.cpp.
| void del | ( | void * | args ) | [virtual] |
Resource value deleter (OPTIONAL: defaulted noop if not derived.
Binders MAY implement DELETE if needed)
- Parameters:
-
void * args for the del() operation
Definition at line 337 of file DynamicResource.cpp.
| string get | ( | ) | [virtual] |
Resource value getter (REQUIRED: must be implemented in derived class as all Binders MUST support and implement GET)
- Returns:
- string value of the resource
Definition at line 315 of file DynamicResource.cpp.
| string getFullName | ( | ) | [inherited] |
| int getInstanceNumber | ( | ) | [inherited] |
| string getObjName | ( | ) | [inherited] |
| void * getObserver | ( | ) |
Get our Observer.
Definition at line 482 of file DynamicResource.cpp.
| string getResName | ( | ) | [inherited] |
| M2MResource * getResource | ( | ) |
get the base resource representation
Definition at line 164 of file DynamicResource.cpp.
| string getValue | ( | ) | [inherited] |
Get the resource value.
- Returns:
- the value of the resource
Definition at line 124 of file Resource.h.
| bool isConnected | ( | ) |
Determine if we are connected or not.
Definition at line 434 of file DynamicResource.cpp.
| bool isObservable | ( | ) |
Determine whether this dynamic resource is observable or not.
- Returns:
- true - is observable, false - otherwise
Definition at line 133 of file DynamicResource.h.
| bool isRegistered | ( | ) |
Determine if we are registered or not.
Definition at line 457 of file DynamicResource.cpp.
| int notify | ( | const string | data ) |
Send notification of new data.
- Parameters:
-
data input the new data to update
- Returns:
- 1 - success, 0 - failure
Definition at line 276 of file DynamicResource.cpp.
| void observe | ( | ) | [virtual] |
observe the resource
Definition at line 344 of file DynamicResource.cpp.
| void post | ( | void * | args ) | [virtual] |
Resource value setter (POST) (OPTIONAL: defaulted noop if not derived.
Binders MAY implement POST if needed)
- Parameters:
-
void * args for the post() operation
Reimplemented in DeviceDeRegisterResource.
Definition at line 330 of file DynamicResource.cpp.
| uint8_t process | ( | M2MBase::Operation | op, |
| M2MBase::BaseType | type, | ||
| void * | args = NULL |
||
| ) |
Process the CoAP message.
- Parameters:
-
op input the CoAP Verb (operation) type input clarification of the M2MBase instance being passed in (Object vs. ObjectInstance vs. Resource vs. ResourceInstance) args input arguments (unused)
- Returns:
- 0 - success, 1 - failure
Definition at line 176 of file DynamicResource.cpp.
| void process_resource_post | ( | void * | args ) |
Process a POST message for Resources.
Definition at line 169 of file DynamicResource.cpp.
| void put | ( | const string | value ) | [virtual] |
Resource value setter (PUT) (OPTIONAL: defaulted noop if not derived.
Binders MAY implement PUT if needed)
- Parameters:
-
string value of the resource
Definition at line 323 of file DynamicResource.cpp.
| void setContentFormat | ( | uint8_t | content_format ) |
Set the content format for responses.
- Parameters:
-
content_format short integer CoAP content-format ID
Definition at line 356 of file DynamicResource.cpp.
| void setDataWrapper | ( | DataWrapper * | data_wrapper ) |
Set the data wrapper.
- Parameters:
-
data_wrapper input the data wrapper instance
Definition at line 157 of file DynamicResource.h.
| void setEndpoint | ( | const void * | endpoint ) | [inherited] |
set the endpoint
Definition at line 165 of file Resource.h.
| void setInstanceNumber | ( | int | instance_number ) | [inherited] |
Set our Instance Number.
- Parameters:
-
instance_number input our designated instance number
Definition at line 182 of file Resource.h.
| void setMaxAge | ( | uint8_t | maxage ) |
Set the max-age for cache control of responses in a proxy cache.
- Parameters:
-
maxage short integer CoAP max-age in seconds
Definition at line 361 of file DynamicResource.cpp.
| void setName | ( | const string | name ) | [inherited] |
Set the resource name.
- Parameters:
-
name input the resource name
Definition at line 132 of file Resource.h.
| void setObserver | ( | void * | observer ) |
Set the observer pointer.
- Parameters:
-
observer input the pointer to the ResourceObserver observing this resource
Definition at line 351 of file DynamicResource.cpp.
| void setOptions | ( | const void * | options ) | [inherited] |
set the options
Definition at line 158 of file Resource.h.
| void setValue | ( | const string | value ) | [inherited] |
Set the resource value.
- Parameters:
-
value input the resource value
Definition at line 140 of file Resource.h.
Generated on Wed Jul 13 2022 01:24:03 by
1.7.2
