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: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
M2MDevice Class Reference
#include <m2mdevice.h>
Inherits M2MObject.
Public Types | |
enum | DeviceResource |
Enum defining all the resources associated with the Device Object in the LWM2M framework. More... | |
enum | BaseType |
Enum to define the type of object. More... | |
enum | Observation |
Enum to define observation level. More... | |
enum | Mode |
Enum defining an operation that can be supported by a given resource. More... | |
enum | Operation |
Enum defining an operation that can be supported by a given resource. More... | |
Public Member Functions | |
M2MResource * | create_resource (DeviceResource resource, const String &value) |
Creates a new resource for the given resource enum. | |
M2MResource * | create_resource (DeviceResource resource, int64_t value) |
Creates a new resource for given resource enum. | |
M2MResourceInstance * | create_resource_instance (DeviceResource resource, int64_t value, uint16_t instance_id) |
Creates a new resource instance for given resource enum. | |
M2MResource * | create_resource (DeviceResource resource) |
Creates a new resource for given resource name. | |
bool | delete_resource (DeviceResource resource) |
Deletes the resource with the given resource enum. | |
bool | delete_resource_instance (DeviceResource resource, uint16_t instance_id) |
Deletes the resource with the given resource enum. | |
bool | set_resource_value (DeviceResource resource, const String &value, uint16_t instance_id=0) |
Sets the value of the given resource enum. | |
bool | set_resource_value (DeviceResource resource, int64_t value, uint16_t instance_id=0) |
Sets the value of the given resource enum. | |
String | resource_value_string (DeviceResource resource, uint16_t instance_id=0) const |
Returns the value of the given resource enum, in String. | |
int64_t | resource_value_int (DeviceResource resource, uint16_t instance_id=0) const |
Returns the value of the given resource key name, in Integer. | |
bool | is_resource_present (DeviceResource resource) const |
Indicates whether the resource instance with given resource enum exists or not. | |
uint16_t | total_resource_count () const |
Returns the number of resources for the whole device object. | |
uint16_t | per_resource_count (DeviceResource resource) const |
Returns the number of resources for a given resource enum. | |
M2MObjectInstance * | create_object_instance (uint16_t instance_id=0) |
Creates a new object instance for a given mbed Client Interface object. | |
virtual bool | remove_object_instance (uint16_t instance_id=0) |
Removes the object instance resource with the given instance id. | |
virtual M2MObjectInstance * | object_instance (uint16_t instance_id=0) const |
Returns the object instance with the the given instance ID. | |
virtual const M2MObjectInstanceList & | instances () const |
Returns a list of object instances. | |
virtual uint16_t | instance_count () const |
Returns the total number of object instances-. | |
virtual M2MBase::BaseType | base_type () const |
Returns the object type. | |
virtual void | add_observation_level (M2MBase::Observation observation_level) |
Adds the observation level for the object. | |
virtual void | remove_observation_level (M2MBase::Observation observation_level) |
Removes the observation level from the object. | |
virtual sn_coap_hdr_s * | handle_get_request (nsdl_s *nsdl, sn_coap_hdr_s *received_coap_header, M2MObservationHandler *observation_handler=NULL) |
Handles GET request for the registered objects. | |
virtual sn_coap_hdr_s * | handle_put_request (nsdl_s *nsdl, sn_coap_hdr_s *received_coap_header, M2MObservationHandler *observation_handler, bool &execute_value_updated) |
Handles PUT request for the registered objects. | |
virtual sn_coap_hdr_s * | handle_post_request (nsdl_s *nsdl, sn_coap_hdr_s *received_coap_header, M2MObservationHandler *observation_handler, bool &execute_value_updated) |
Handles GET request for the registered objects. | |
virtual void | set_operation (M2MBase::Operation operation) |
Sets the operation type for an object. | |
virtual void | set_interface_description (const String &description) |
Sets the interface description of the object. | |
virtual void | set_resource_type (const String &resource_type) |
Sets the resource type of the object. | |
virtual void | set_coap_content_type (const uint8_t content_type) |
Sets the CoAP content type of the object. | |
virtual void | set_observable (bool observable) |
Sets the observable mode for the object. | |
virtual void | set_under_observation (bool observed, M2MObservationHandler *handler) |
Sets the object under observation. | |
virtual void | set_observation_token (const uint8_t *token, const uint8_t length) |
Sets the observation token value. | |
virtual void | set_instance_id (const uint16_t instance_id) |
Sets the instance ID of the object. | |
virtual void | set_observation_number (const uint16_t observation_number) m2m_deprecated |
Function is deprecated. | |
virtual void | set_max_age (const uint32_t max_age) |
Sets the max age for the resource value to be cached. | |
virtual M2MBase::Operation | operation () const |
Returns the operation type of the object. | |
virtual const String & | name () const |
Returns the object name. | |
virtual int32_t | name_id () const |
Returns the object name in integer. | |
virtual uint16_t | instance_id () const |
Returns the object's Instance ID. | |
virtual const String & | interface_description () const |
Returns the interface description of the object. | |
virtual const String & | resource_type () const |
Returns the resource type of the object. | |
virtual uint8_t | coap_content_type () const |
Returns the CoAP content type of the object. | |
virtual bool | is_observable () const |
Returns the observation status of the object. | |
virtual M2MBase::Observation | observation_level () const |
Returns the observation level of the object. | |
virtual void | get_observation_token (uint8_t *&token, uint32_t &token_length) |
Provides the observation token of the object. | |
virtual Mode | mode () const |
Returns the mode of the resource. | |
virtual uint16_t | observation_number () const |
Returns the observation number. | |
virtual uint32_t | max_age () const |
Returns max age for the resource value to be cached. | |
virtual bool | handle_observation_attribute (char *&query) |
Parses the received query for the notification attribute. | |
virtual void | set_register_uri (bool register_uri) |
Sets whether this resource will be published to server or not. | |
virtual bool | register_uri () |
Returns whether this resource will be published to server or not. | |
virtual void | set_uri_path (const String &path) |
Sets object URI path. | |
virtual const String & | uri_path () const |
Returns the URI path of the object. | |
virtual bool | is_under_observation () const |
Returns whether this resource is under observation or not. | |
virtual void | set_value_updated_function (value_updated_callback callback) |
Sets the function that is executed when this object receives a PUT or POST command. | |
virtual void | set_value_updated_function (value_updated_callback2 callback) |
Sets the function that is executed when this object receives a PUT or POST command. | |
virtual bool | is_value_updated_function_set () |
Returns whether callback function is set or not. | |
virtual void | execute_value_updated (const String &name) |
Calls the function that is set in "set_value_updated_function". | |
Static Public Member Functions | |
static void | delete_instance () |
Deletes the M2MDevice instance. | |
Protected Member Functions | |
virtual void | observation_to_be_sent (m2m::Vector< uint16_t > changed_instance_ids, bool send_object=false) |
An observation callback to be sent to the server due to a change in the observed parameter. | |
virtual void | set_base_type (M2MBase::BaseType type) |
Sets the Base type for object. | |
virtual void | remove_resource_from_coap (const String &resource_name) |
Removes the resource from the CoAP structure. | |
virtual void | remove_object_from_coap () |
Removes an object from the NSDL list. | |
virtual void * | memory_alloc (uint32_t size) |
Memory allocation required for libCoap. | |
virtual void | memory_free (void *ptr) |
Memory free functions required for libCoap. | |
virtual uint8_t * | alloc_string_copy (const uint8_t *source, uint32_t size) |
Allocate (size + 1) amount of memory, copy size bytes into it and add zero termination. | |
virtual uint8_t * | alloc_copy (const uint8_t *source, uint32_t size) |
Allocate (size) amount of memory, copy size bytes into it. | |
M2MReportHandler * | report_handler () |
Returns the Report Handler object. | |
M2MObservationHandler * | observation_handler () |
Returns the Observation Handler object. | |
Friends | |
class | M2MInterfaceFactory |
Detailed Description
This class represents the Device Object model of the LWM2M framework. It provides an interface for handling the device object and all its corresponding resources. There can be only one instance of a Device Object.
Definition at line 32 of file m2mdevice.h.
Member Enumeration Documentation
enum BaseType [inherited] |
enum DeviceResource |
Enum defining all the resources associated with the Device Object in the LWM2M framework.
Definition at line 42 of file m2mdevice.h.
enum Mode [inherited] |
enum Observation [inherited] |
enum Operation [inherited] |
Member Function Documentation
void add_observation_level | ( | M2MBase::Observation | observation_level ) | [virtual, inherited] |
Adds the observation level for the object.
- Parameters:
-
observation_level The level of observation.
Reimplemented from M2MBase.
Definition at line 157 of file m2mobject.cpp.
uint8_t * alloc_copy | ( | const uint8_t * | source, |
uint32_t | size | ||
) | [protected, virtual, inherited] |
Allocate (size) amount of memory, copy size bytes into it.
- Parameters:
-
source Source buffer to copy, may not be NULL. size The size of memory to be reserved.
Definition at line 400 of file m2mbase.cpp.
uint8_t * alloc_string_copy | ( | const uint8_t * | source, |
uint32_t | size | ||
) | [protected, virtual, inherited] |
Allocate (size + 1) amount of memory, copy size bytes into it and add zero termination.
- Parameters:
-
source Source string to copy, may not be NULL. size The size of memory to be reserved.
Definition at line 388 of file m2mbase.cpp.
M2MBase::BaseType base_type | ( | ) | const [virtual, inherited] |
Returns the object type.
- Returns:
- BaseType.
Reimplemented from M2MBase.
Definition at line 152 of file m2mobject.cpp.
uint8_t coap_content_type | ( | ) | const [virtual, inherited] |
Returns the CoAP content type of the object.
- Returns:
- Content type of the object.
Definition at line 260 of file m2mbase.cpp.
M2MObjectInstance * create_object_instance | ( | uint16_t | instance_id = 0 ) |
[inherited] |
Creates a new object instance for a given mbed Client Interface object.
With this, the client can respond to server's GET methods with the provided value.
- Returns:
- M2MObjectInstance. An object instance for managing other client operations.
Definition at line 79 of file m2mobject.cpp.
M2MResource * create_resource | ( | DeviceResource | resource ) |
Creates a new resource for given resource name.
- Parameters:
-
resource With this function, the following resources can be created: 'ResetErrorCode','FactoryReset'.
- Returns:
- M2MResource if created successfully, else NULL.
Definition at line 255 of file m2mdevice.cpp.
M2MResource * create_resource | ( | DeviceResource | resource, |
const String & | value | ||
) |
Creates a new resource for the given resource enum.
- Parameters:
-
resource With this function, the following resources can be created: 'Manufacturer', 'DeviceType','ModelNumber','SerialNumber', 'HardwareVersion', 'FirmwareVersion', 'SoftwareVersion', 'UTCOffset', 'Timezone', 'SupportedBindingMode'. value The value to be set on the resource, in String format.
- Returns:
- M2MResource if created successfully, else NULL.
Definition at line 94 of file m2mdevice.cpp.
M2MResource * create_resource | ( | DeviceResource | resource, |
int64_t | value | ||
) |
Creates a new resource for given resource enum.
- Parameters:
-
resource With this function, the following resources can be created: 'AvailablePowerSources','PowerSourceVoltage','PowerSourceCurrent', 'BatteryLevel', 'BatteryStatus', 'MemoryFree', 'MemoryTotal', 'ErrorCode', 'CurrentTime'. For 'CurrentTime', pass the time value in EPOCH format, for example 1438944683. value The value to be set on the resource, in Integer format.
- Returns:
- M2MResource if created successfully, else NULL.
Definition at line 158 of file m2mdevice.cpp.
M2MResourceInstance * create_resource_instance | ( | DeviceResource | resource, |
int64_t | value, | ||
uint16_t | instance_id | ||
) |
Creates a new resource instance for given resource enum.
- Parameters:
-
resource With this function, the following resources can be created: 'AvailablePowerSources','PowerSourceVoltage','PowerSourceCurrent', 'ErrorCode'. value The value to be set on the resource, in Integer format.
- Returns:
- M2MResourceInstance if created successfully, else NULL.
Definition at line 212 of file m2mdevice.cpp.
void delete_instance | ( | ) | [static] |
Deletes the M2MDevice instance.
Definition at line 37 of file m2mdevice.cpp.
bool delete_resource | ( | DeviceResource | resource ) |
Deletes the resource with the given resource enum.
Mandatory resources cannot be deleted.
- Parameters:
-
resource The name of the resource to be deleted.
- Returns:
- True if deleted, else false.
Definition at line 285 of file m2mdevice.cpp.
bool delete_resource_instance | ( | DeviceResource | resource, |
uint16_t | instance_id | ||
) |
Deletes the resource with the given resource enum.
Mandatory resources cannot be deleted.
- Parameters:
-
resource The name of the resource to be deleted. instance_id The instance ID of the resource.
- Returns:
- True if deleted, else false.
Definition at line 298 of file m2mdevice.cpp.
void execute_value_updated | ( | const String & | name ) | [virtual, inherited] |
Calls the function that is set in "set_value_updated_function".
- Parameters:
-
name Name of the object.
Definition at line 474 of file m2mbase.cpp.
void get_observation_token | ( | uint8_t *& | token, |
uint32_t & | token_length | ||
) | [virtual, inherited] |
Provides the observation token of the object.
- Parameters:
-
value[OUT] A pointer to the value of the token. value_length[OUT] Length of the token pointer.
Definition at line 275 of file m2mbase.cpp.
sn_coap_hdr_s * handle_get_request | ( | nsdl_s * | nsdl, |
sn_coap_hdr_s * | received_coap_header, | ||
M2MObservationHandler * | observation_handler = NULL |
||
) | [virtual, inherited] |
Handles GET request for the registered objects.
- Parameters:
-
nsdl The NSDL handler for the CoAP library. received_coap_header The CoAP message received from the server. observation_handler The handler object for sending observation callbacks.
- Returns:
- sn_coap_hdr_s The message that needs to be sent to server.
Reimplemented from M2MBase.
Definition at line 181 of file m2mobject.cpp.
bool handle_observation_attribute | ( | char *& | query ) | [virtual, inherited] |
Parses the received query for the notification attribute.
- Parameters:
-
query The query that needs to be parsed.
- Returns:
- True if required attributes are present, else false.
Reimplemented in M2MResource.
Definition at line 301 of file m2mbase.cpp.
sn_coap_hdr_s * handle_post_request | ( | nsdl_s * | nsdl, |
sn_coap_hdr_s * | received_coap_header, | ||
M2MObservationHandler * | observation_handler, | ||
bool & | execute_value_updated | ||
) | [virtual, inherited] |
Handles GET request for the registered objects.
- Parameters:
-
nsdl The NSDL handler for the CoAP library. received_coap_header The received CoAP message from the server. observation_handler The handler object for sending observation callbacks. execute_value_updated True will execute the "value_updated" callback.
- Returns:
- sn_coap_hdr_s The message that needs to be sent to server.
Reimplemented from M2MBase.
Definition at line 347 of file m2mobject.cpp.
sn_coap_hdr_s * handle_put_request | ( | nsdl_s * | nsdl, |
sn_coap_hdr_s * | received_coap_header, | ||
M2MObservationHandler * | observation_handler, | ||
bool & | execute_value_updated | ||
) | [virtual, inherited] |
Handles PUT request for the registered objects.
- Parameters:
-
nsdl The NSDL handler for the CoAP library. received_coap_header The received CoAP message from the server. observation_handler The handler object for sending observation callbacks. execute_value_updated True will execute the "value_updated" callback.
- Returns:
- sn_coap_hdr_s The message that needs to be sent to server.
Reimplemented from M2MBase.
Definition at line 309 of file m2mobject.cpp.
uint16_t instance_count | ( | ) | const [virtual, inherited] |
Returns the total number of object instances-.
- Returns:
- The total number of the object instances.
Definition at line 147 of file m2mobject.cpp.
uint16_t instance_id | ( | ) | const [virtual, inherited] |
Returns the object's Instance ID.
- Returns:
- Instance ID of the object.
Definition at line 245 of file m2mbase.cpp.
const M2MObjectInstanceList & instances | ( | ) | const [virtual, inherited] |
Returns a list of object instances.
- Returns:
- A list of object instances.
Definition at line 142 of file m2mobject.cpp.
const String & interface_description | ( | ) | const [virtual, inherited] |
Returns the interface description of the object.
- Returns:
- Description of the object.
Definition at line 250 of file m2mbase.cpp.
bool is_observable | ( | ) | const [virtual, inherited] |
Returns the observation status of the object.
- Returns:
- True if observable, else false.
Definition at line 265 of file m2mbase.cpp.
bool is_resource_present | ( | DeviceResource | resource ) | const |
Indicates whether the resource instance with given resource enum exists or not.
- Parameters:
-
resource Resource enum.
- Returns:
- True if at least one instance exists, else false.
Definition at line 412 of file m2mdevice.cpp.
bool is_under_observation | ( | ) | const [virtual, inherited] |
Returns whether this resource is under observation or not.
- Returns:
- True if the resource is under observation, else false,
Definition at line 452 of file m2mbase.cpp.
bool is_value_updated_function_set | ( | ) | [virtual, inherited] |
Returns whether callback function is set or not.
- Returns:
- True if the callback function is set, else false.
Definition at line 469 of file m2mbase.cpp.
uint32_t max_age | ( | ) | const [virtual, inherited] |
Returns max age for the resource value to be cached.
- Returns:
- Max age in seconds.
Definition at line 296 of file m2mbase.cpp.
void * memory_alloc | ( | uint32_t | size ) | [protected, virtual, inherited] |
Memory allocation required for libCoap.
- Parameters:
-
size The size of memory to be reserved.
Definition at line 375 of file m2mbase.cpp.
void memory_free | ( | void * | ptr ) | [protected, virtual, inherited] |
Memory free functions required for libCoap.
- Parameters:
-
ptr The Object whose memory needs to be freed.
Definition at line 383 of file m2mbase.cpp.
M2MBase::Mode mode | ( | ) | const [virtual, inherited] |
Returns the mode of the resource.
- Returns:
- Mode of the resource.
Definition at line 286 of file m2mbase.cpp.
const String & name | ( | ) | const [virtual, inherited] |
int32_t name_id | ( | ) | const [virtual, inherited] |
Returns the object name in integer.
- Returns:
- Name of the object in integer.
Definition at line 240 of file m2mbase.cpp.
M2MObjectInstance * object_instance | ( | uint16_t | instance_id = 0 ) |
const [virtual, inherited] |
Returns the object instance with the the given instance ID.
- Parameters:
-
instance_id The instance ID of the requested object instance ID, default is 0.
- Returns:
- Object instance reference if found, else NULL.
Definition at line 124 of file m2mobject.cpp.
M2MObservationHandler * observation_handler | ( | ) | [protected, inherited] |
Returns the Observation Handler object.
- Returns:
- M2MObservationHandler object.
Definition at line 416 of file m2mbase.cpp.
M2MBase::Observation observation_level | ( | ) | const [virtual, inherited] |
Returns the observation level of the object.
- Returns:
- Observation level of the object.
Definition at line 270 of file m2mbase.cpp.
uint16_t observation_number | ( | ) | const [virtual, inherited] |
Returns the observation number.
- Returns:
- Observation number of the object.
Definition at line 291 of file m2mbase.cpp.
void observation_to_be_sent | ( | m2m::Vector< uint16_t > | changed_instance_ids, |
bool | send_object = false |
||
) | [protected, virtual, inherited] |
An observation callback to be sent to the server due to a change in the observed parameter.
- Parameters:
-
changed_instance_ids A list of changed object instance IDs. send_object Indicates whether the whole object will be sent or not.
Implements M2MReportObserver.
Definition at line 318 of file m2mbase.cpp.
M2MBase::Operation operation | ( | ) | const [virtual, inherited] |
Returns the operation type of the object.
- Returns:
- Operation Supported operation on the object.
Definition at line 230 of file m2mbase.cpp.
uint16_t per_resource_count | ( | DeviceResource | resource ) | const |
Returns the number of resources for a given resource enum.
- Parameters:
-
resource Resource enum.
- Returns:
- The number of resources for a given resource enum. Returns 1 for the mandatory resources. Can be 0 as well if no instances exist for an optional resource.
Definition at line 422 of file m2mdevice.cpp.
bool register_uri | ( | ) | [virtual, inherited] |
Returns whether this resource will be published to server or not.
- Returns:
- True if the resource is part of the registration message, else false.
Definition at line 426 of file m2mbase.cpp.
void remove_object_from_coap | ( | ) | [protected, virtual, inherited] |
Removes an object from the NSDL list.
Definition at line 342 of file m2mbase.cpp.
bool remove_object_instance | ( | uint16_t | instance_id = 0 ) |
[virtual, inherited] |
Removes the object instance resource with the given instance id.
- Parameters:
-
instance_id The instance ID of the object instance to be removed, default is 0.
- Returns:
- True if removed, else false.
Definition at line 97 of file m2mobject.cpp.
void remove_observation_level | ( | M2MBase::Observation | observation_level ) | [virtual, inherited] |
Removes the observation level from the object.
- Parameters:
-
observation_level The level of observation.
Reimplemented from M2MBase.
Definition at line 169 of file m2mobject.cpp.
void remove_resource_from_coap | ( | const String & | resource_name ) | [protected, virtual, inherited] |
Removes the resource from the CoAP structure.
- Parameters:
-
resource_name The name of the resource.
Definition at line 335 of file m2mbase.cpp.
M2MReportHandler * report_handler | ( | ) | [protected, inherited] |
Returns the Report Handler object.
- Returns:
- M2MReportHandler object.
Definition at line 411 of file m2mbase.cpp.
const String & resource_type | ( | ) | const [virtual, inherited] |
Returns the resource type of the object.
- Returns:
- Resource type of the object.
Definition at line 255 of file m2mbase.cpp.
int64_t resource_value_int | ( | DeviceResource | resource, |
uint16_t | instance_id = 0 |
||
) | const |
Returns the value of the given resource key name, in Integer.
- Parameters:
-
resource With this function, the following resources can return a value: 'AvailablePowerSources','PowerSourceVoltage','PowerSourceCurrent', 'BatteryLevel', 'BatteryStatus', 'MemoryFree', 'MemoryTotal', 'ErrorCode', 'CurrentTime'. instance_id The instance ID of the resource, default is 0
- Returns:
- The value associated with that resource. If the resource is not valid -1 is returned.
Definition at line 389 of file m2mdevice.cpp.
String resource_value_string | ( | DeviceResource | resource, |
uint16_t | instance_id = 0 |
||
) | const |
Returns the value of the given resource enum, in String.
- Parameters:
-
resource With this function, the following resources can return a value: 'Manufacturer', 'DeviceType','ModelNumber','SerialNumber', 'HardwareVersion', 'FirmwareVersion', 'SoftwareVersion', 'UTCOffset', 'Timezone', 'SupportedBindingMode'. instance_id The instance ID of the resource, default is 0.
- Returns:
- The value associated with that resource. If the resource is not valid NULL is returned.
Definition at line 366 of file m2mdevice.cpp.
void set_base_type | ( | M2MBase::BaseType | type ) | [protected, virtual, inherited] |
Sets the Base type for object.
- Parameters:
-
type The type of the base object.
Definition at line 330 of file m2mbase.cpp.
void set_coap_content_type | ( | const uint8_t | content_type ) | [virtual, inherited] |
Sets the CoAP content type of the object.
- Parameters:
-
content_type Content Type to be set based on CoAP specifications.
Definition at line 155 of file m2mbase.cpp.
void set_instance_id | ( | const uint16_t | instance_id ) | [virtual, inherited] |
Sets the instance ID of the object.
- Parameters:
-
instance_id Instance ID of the object.
Definition at line 210 of file m2mbase.cpp.
void set_interface_description | ( | const String & | description ) | [virtual, inherited] |
Sets the interface description of the object.
- Parameters:
-
description Description to be set.
Definition at line 145 of file m2mbase.cpp.
void set_max_age | ( | const uint32_t | max_age ) | [virtual, inherited] |
Sets the max age for the resource value to be cached.
- Parameters:
-
max_age Max age in seconds.
Definition at line 220 of file m2mbase.cpp.
void set_observable | ( | bool | observable ) | [virtual, inherited] |
Sets the observable mode for the object.
- Parameters:
-
observable Value for the observation.
Definition at line 160 of file m2mbase.cpp.
void set_observation_number | ( | const uint16_t | observation_number ) | [virtual, inherited] |
Function is deprecated.
Increment of observation number is done internally. Sets the observation number of the object.
- Parameters:
-
observation_number Observation number of the object.
Definition at line 216 of file m2mbase.cpp.
void set_observation_token | ( | const uint8_t * | token, |
const uint8_t | length | ||
) | [virtual, inherited] |
Sets the observation token value.
- Parameters:
-
token Pointer to the token of the resource. length Length of the token pointer.
Definition at line 196 of file m2mbase.cpp.
void set_operation | ( | M2MBase::Operation | operation ) | [virtual, inherited] |
Sets the operation type for an object.
- Parameters:
-
operation Operation to be set.
Definition at line 134 of file m2mbase.cpp.
void set_register_uri | ( | bool | register_uri ) | [virtual, inherited] |
Sets whether this resource will be published to server or not.
- Parameters:
-
register_uri True sets the resource as part of registration message.
Definition at line 421 of file m2mbase.cpp.
void set_resource_type | ( | const String & | resource_type ) | [virtual, inherited] |
Sets the resource type of the object.
- Parameters:
-
resource_type Resource type to be set.
Definition at line 150 of file m2mbase.cpp.
bool set_resource_value | ( | DeviceResource | resource, |
int64_t | value, | ||
uint16_t | instance_id = 0 |
||
) |
Sets the value of the given resource enum.
- Parameters:
-
resource With this function, a value can be set for the following resources: 'AvailablePowerSources','PowerSourceVoltage','PowerSourceCurrent', 'BatteryLevel', 'BatteryStatus', 'MemoryFree', 'MemoryTotal', 'ErrorCode', 'CurrentTime'. value The value to be set on the resource, in Integer format. instance_id The instance ID of the resource, default is 0.
- Returns:
- True if successfully set, else false.
Definition at line 339 of file m2mdevice.cpp.
bool set_resource_value | ( | DeviceResource | resource, |
const String & | value, | ||
uint16_t | instance_id = 0 |
||
) |
Sets the value of the given resource enum.
- Parameters:
-
resource With this function, a value can be set for the following resources: 'Manufacturer', 'DeviceType','ModelNumber','SerialNumber', 'HardwareVersion', 'FirmwareVersion', 'SoftwareVersion', 'UTCOffset', 'Timezone', 'SupportedBindingMode'. value The value to be set on the resource, in String format. instance_id The instance ID of the resource, default is 0.
- Returns:
- True if successfully set, else false.
Definition at line 312 of file m2mdevice.cpp.
void set_under_observation | ( | bool | observed, |
M2MObservationHandler * | handler | ||
) | [virtual, inherited] |
Sets the object under observation.
- Parameters:
-
observed Value for the observation. When true, starts observing. When false, ongoing observation is cancelled. handler Handler object for sending observation callbacks.
Definition at line 175 of file m2mbase.cpp.
void set_uri_path | ( | const String & | path ) | [virtual, inherited] |
void set_value_updated_function | ( | value_updated_callback2 | callback ) | [virtual, inherited] |
Sets the function that is executed when this object receives a PUT or POST command.
- Parameters:
-
callback The function pointer that is called.
Definition at line 462 of file m2mbase.cpp.
void set_value_updated_function | ( | value_updated_callback | callback ) | [virtual, inherited] |
Sets the function that is executed when this object receives a PUT or POST command.
- Parameters:
-
callback The function pointer that is called.
Definition at line 457 of file m2mbase.cpp.
uint16_t total_resource_count | ( | ) | const |
Returns the number of resources for the whole device object.
- Returns:
- Total number of resources belonging to the device object.
Definition at line 431 of file m2mdevice.cpp.
const String & uri_path | ( | ) | const [virtual, inherited] |
Returns the URI path of the object.
- Returns:
- URI path of the object.
Definition at line 447 of file m2mbase.cpp.
Generated on Tue Jul 12 2022 12:29:07 by
