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
M2MBase Class Reference
The base class based on which all LwM2M object models can be created. More...
#include <m2mbase.h>
Inherits M2MReportObserver.
Inherited by M2MEndpoint, M2MObject, M2MObjectInstance, and M2MResourceBase.
Data Structures | |
struct | lwm2m_parameters |
LwM2M parameters. More... | |
Public Types | |
enum | BaseType |
Enum to define the type of object. More... | |
enum | Observation |
Enum to define observation level. More... | |
enum | Mode |
Enum defining a resource type. More... | |
enum | DataType |
Enum defining a resource data type. More... | |
enum | Operation |
Enum defining an operation that can be supported by a given resource. More... | |
enum | MessageDeliveryStatus |
Enum defining an status codes that can happen when sending confirmable message. More... | |
typedef void(* | handle_async_coap_request_cb )(const M2MBase &base, M2MBase::Operation operation, const uint8_t *token, const uint8_t token_len, const uint8_t *buffer, size_t buffer_size, void *client_args) |
Type definition for an asynchronous CoAP request callback function. | |
typedef struct M2MBase::lwm2m_parameters | lwm2m_parameters_s |
LwM2M parameters. | |
Public Member Functions | |
virtual | ~M2MBase () |
Destructor. | |
void | set_operation (M2MBase::Operation operation) |
Sets the operation type for an object. | |
void | set_interface_description (const String &description) |
Sets the interface description of the object. | |
void | set_interface_description (const char *description) |
Sets the interface description of the object. | |
const char * | interface_description () const |
Returns 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_resource_type (const char *resource_type) |
Sets the resource type of the object. | |
const char * | resource_type () const |
Returns the resource type of the object. | |
void | set_coap_content_type (const uint16_t content_type) |
Sets the CoAP content type of the object. | |
void | set_observable (bool observable) |
Sets the observable mode for the object. | |
void | set_auto_observable (bool auto_observable) |
Sets the object to be auto-observable. | |
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 for the object. | |
void | set_under_observation (bool observed, M2MObservationHandler *handler) |
Sets the object under observation. | |
virtual M2MObservationHandler * | observation_handler () const =0 |
Returns the Observation Handler object. | |
virtual void | set_observation_handler (M2MObservationHandler *handler)=0 |
Sets the observation handler. | |
void | set_instance_id (const uint16_t instance_id) |
Sets the instance ID of the object. | |
void | set_max_age (const uint32_t max_age) |
Sets the max age for the resource value to be cached. | |
M2MBase::BaseType | base_type () const |
Returns the object type. | |
M2MBase::Operation | operation () const |
Returns the operation type of the object. | |
const char * | name () const |
Returns the object name. | |
int32_t | name_id () const |
Returns the object name in integer. | |
uint16_t | instance_id () const |
Returns the object's instance ID. | |
const char * | uri_path () const |
Returns the path of the object. | |
uint16_t | coap_content_type () const |
Returns the CoAP content type of the object. | |
bool | is_observable () const |
Returns the observation status of the object. | |
bool | is_auto_observable () const |
Returns the auto observation status of the object. | |
M2MBase::Observation | observation_level () const |
Returns the observation level of the object. | |
Mode | mode () const |
Returns the mode of the resource. | |
uint16_t | observation_number () const |
Returns the observation number. | |
uint32_t | max_age () const |
Returns the max age for the resource value to be cached. | |
virtual bool | handle_observation_attribute (const char *query) |
Parses the received query for the notification attribute. | |
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, sn_nsdl_addr_s *address=NULL) |
Handles GET request for the registered objects. | |
void | send_notification_delivery_status (const M2MBase &object, const NotificationDeliveryStatus status) |
Executes the function that is set in "set_notification_delivery_status_cb". | |
void | send_message_delivery_status (const M2MBase &object, const MessageDeliveryStatus status, const MessageType type) |
Executes the function that is set in "set_message_delivery_status_cb". | |
void | set_register_uri (bool register_uri) |
Sets whether this resource is published to server or not. | |
bool | register_uri () |
Returns whether this resource is published to server or not. | |
bool | is_under_observation () const |
Returns whether this resource is under observation or not. | |
bool | set_value_updated_function (value_updated_callback callback) |
Sets the function that is executed when this object receives a PUT or POST command. | |
bool | set_value_updated_function (value_updated_callback2 callback) |
Sets the function that is executed when this object receives a PUT or POST command. | |
bool | is_value_updated_function_set () const |
Returns whether a callback function is set or not. | |
void | execute_value_updated (const String &name) |
Calls the function that is set in the "set_value_updated_function". | |
size_t | resource_name_length () const |
Returns length of the object name. | |
sn_nsdl_dynamic_resource_parameters_s * | get_nsdl_resource () const |
Returns the resource information. | |
M2MBase::lwm2m_parameters_s * | get_lwm2m_parameters () const |
Returns the resource structure. | |
bool | send_async_response_with_code (const uint8_t *payload, size_t payload_len, const uint8_t *token, const uint8_t token_len, coap_response_code_e code=COAP_RESPONSE_CHANGED) |
A trigger to send the async response for the CoAP request. | |
bool | set_async_coap_request_cb (handle_async_coap_request_cb callback, void *client_args) |
Sets the function that is executed when CoAP request arrives. | |
uint16_t | get_notification_msgid () const m2m_deprecated |
Returns the notification message id. | |
void | set_notification_msgid (uint16_t msgid) m2m_deprecated |
Sets the notification message id. | |
bool | set_notification_delivery_status_cb (notification_delivery_status_cb callback, void *client_args) m2m_deprecated |
Sets the function that is executed when notification message state changes. | |
bool | set_message_delivery_status_cb (message_delivery_status_cb callback, void *client_args) |
Sets the function that is executed when message state changes. | |
virtual void | set_deleted () |
The data is set deleted and it needs to be updated into Device Management. | |
virtual bool | is_deleted () |
The deleted state check function. | |
Protected Member Functions | |
M2MBase (const String &name, M2MBase::Mode mode,#ifndef DISABLE_RESOURCE_TYPE const String &resource_type,#endif char *path, bool external_blockwise_store, bool multiple_instance, M2MBase::DataType type=M2MBase::OBJLINK) | |
Constructor. | |
void | set_base_type (M2MBase::BaseType type) |
Sets the base type for an object. | |
M2MReportHandler * | create_report_handler () |
Create Report Handler object. | |
M2MReportHandler * | report_handler () const |
Returns the Report Handler object. | |
void | free_resources () |
Delete the resource structures owned by this object. | |
NotificationDeliveryStatus | get_notification_delivery_status () const m2m_deprecated |
Returns notification send status. | |
void | clear_notification_delivery_status () m2m_deprecated |
Clears the notification send status to initial state. | |
void | get_observation_token (uint8_t *token, uint8_t &token_length) const |
Provides the observation token of the object. | |
void | set_observation_token (const uint8_t *token, const uint8_t length) |
Sets the observation token value. | |
virtual void | set_changed () |
The data has changed and it needs to be updated into Mbed Cloud. | |
virtual M2MBase * | get_parent () const |
Returns the owner object. | |
void | handle_observation (nsdl_s *nsdl, const sn_coap_hdr_s &received_coap_header, sn_coap_hdr_s &coap_response, M2MObservationHandler *observation_handler, sn_coap_msg_code_e &response_code) |
Handles subscription request. | |
void | start_observation (const sn_coap_hdr_s &received_coap_header, M2MObservationHandler *observation_handler) |
Start the observation. | |
void | call_async_coap_request_callback (sn_coap_hdr_s *coap_request, M2MBase::Operation operation, bool &handled) |
Executes the callback set in 'set_async_coap_request_cb'. | |
bool | is_async_coap_request_callback_set () |
Returns whether asynchronous callback is set or not. | |
Static Protected Member Functions | |
static void * | memory_alloc (uint32_t size) |
Memory allocation required for libCoap. | |
static void | memory_free (void *ptr) |
Memory free functions required for libCoap. | |
static char * | alloc_string_copy (const char *source) |
Allocate and make a copy of given zero terminated string. | |
static 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. | |
static uint8_t * | alloc_copy (const uint8_t *source, uint32_t size) |
Allocate (size) amount of memory, copy size bytes into it. | |
static bool | is_blockwise_needed (const nsdl_s *nsdl, uint32_t payload_len) |
Checks whether blockwise is needed to send resource value to server. | |
Friends | |
class | M2MNsdlInterface |
class | M2MObject |
Detailed Description
The base class based on which all LwM2M object models can be created.
It serves as the base class for Objects, ObjectInstances and Resources.
Definition at line 63 of file m2mbase.h.
Member Typedef Documentation
typedef void(* handle_async_coap_request_cb)(const M2MBase &base, M2MBase::Operation operation, const uint8_t *token, const uint8_t token_len, const uint8_t *buffer, size_t buffer_size, void *client_args) |
Type definition for an asynchronous CoAP request callback function.
- Parameters:
-
operation The operation, for example M2MBase::PUT_ALLOWED. token The token. Client needs to copy this if it cannot respond immediately. token_len The length of the token. buffer The payload of the request. Client needs to copy this if it cannot respond immediately. buffer_size The size of the payload. client_args Some pointer given by client when requesting asynchronus request callback using set_async_coap_request_cb.
typedef struct M2MBase::lwm2m_parameters lwm2m_parameters_s |
LwM2M parameters.
Member Enumeration Documentation
enum Observation |
enum Operation |
Constructor & Destructor Documentation
M2MBase | ( | const String & | name, |
M2MBase::Mode | mode, | ||
#ifndef DISABLE_RESOURCE_TYPE const String & | resource_type, | ||
#endif char * | path, | ||
bool | external_blockwise_store, | ||
bool | multiple_instance, | ||
M2MBase::DataType | type = M2MBase::OBJLINK |
||
) | [protected] |
Constructor.
- Parameters:
-
name Name of the object created. mode Type of the resource. resource_type Textual information of resource. path Path of the object like 3/0/1 external_blockwise_store If true CoAP blocks are passed to application through callbacks otherwise handled in mbed-client-c.
Definition at line 41 of file m2mbase.cpp.
~M2MBase | ( | ) | [virtual] |
Destructor.
Definition at line 125 of file m2mbase.cpp.
Member Function Documentation
void add_observation_level | ( | M2MBase::Observation | observation_level ) | [virtual] |
Adds the observation level for the object.
- Parameters:
-
observation_level The level of observation.
Reimplemented in M2MObject, and M2MResource.
Definition at line 303 of file m2mbase.cpp.
uint8_t * alloc_copy | ( | const uint8_t * | source, |
uint32_t | size | ||
) | [static, protected] |
Allocate (size) amount of memory, copy size bytes into it.
- Parameters:
-
source The source buffer to copy, may not be NULL. size The size of memory to be reserved.
Definition at line 598 of file m2mbase.cpp.
char * alloc_string_copy | ( | const char * | source ) | [static, protected] |
Allocate and make a copy of given zero terminated string.
This is functionally equivalent with strdup().
- Parameters:
-
source The source string to copy, may not be NULL.
Definition at line 576 of file m2mbase.cpp.
uint8_t * alloc_string_copy | ( | const uint8_t * | source, |
uint32_t | size | ||
) | [static, protected] |
Allocate (size + 1) amount of memory, copy size bytes into it and add zero termination.
- Parameters:
-
source The source string to copy, may not be NULL. size The size of memory to be reserved.
Definition at line 586 of file m2mbase.cpp.
M2MBase::BaseType base_type | ( | ) | const |
Returns the object type.
- Returns:
- The base type of the object.
Definition at line 368 of file m2mbase.cpp.
void call_async_coap_request_callback | ( | sn_coap_hdr_s * | coap_request, |
M2MBase::Operation | operation, | ||
bool & | handled | ||
) | [protected] |
Executes the callback set in 'set_async_coap_request_cb'.
- Parameters:
-
coap_request CoAP request containing the requesting payload and payload size. operation Operation mode to be passed to the application. handled Caller to know whether callback is processed or not.
Definition at line 898 of file m2mbase.cpp.
void clear_notification_delivery_status | ( | ) | [protected] |
Clears the notification send status to initial state.
uint16_t coap_content_type | ( | ) | const |
Returns the CoAP content type of the object.
- Returns:
- The CoAP content type of the object.
Definition at line 444 of file m2mbase.cpp.
M2MReportHandler * create_report_handler | ( | ) | [protected] |
Create Report Handler object.
- Returns:
- M2MReportHandler object.
Definition at line 634 of file m2mbase.cpp.
void execute_value_updated | ( | const String & | name ) |
Calls the function that is set in the "set_value_updated_function".
- Parameters:
-
name The name of the object.
Definition at line 718 of file m2mbase.cpp.
void free_resources | ( | ) | [protected] |
Delete the resource structures owned by this object.
Note: this needs to be called separately from each subclass' destructor as this method uses a virtual method and the call needs to be done at same class which has the implementation of the pure virtual method.
Definition at line 810 of file m2mbase.cpp.
M2MBase::lwm2m_parameters_s * get_lwm2m_parameters | ( | ) | const |
Returns the resource structure.
- Returns:
- Resource structure.
Definition at line 862 of file m2mbase.cpp.
NotificationDeliveryStatus get_notification_delivery_status | ( | ) | const [protected] |
Returns notification send status.
- Returns:
- Notification status.
uint16_t get_notification_msgid | ( | ) | const |
Returns the notification message id.
- Returns:
- Message id.
Definition at line 927 of file m2mbase.cpp.
sn_nsdl_dynamic_resource_parameters_s * get_nsdl_resource | ( | ) | const |
Returns the resource information.
- Returns:
- Resource information.
Definition at line 857 of file m2mbase.cpp.
void get_observation_token | ( | uint8_t * | token, |
uint8_t & | token_length | ||
) | const [protected] |
Provides the observation token of the object.
- Parameters:
-
[out] token A pointer to the value of the token. [out] token_length The length of the token pointer.
Definition at line 468 of file m2mbase.cpp.
M2MBase * get_parent | ( | ) | const [protected, virtual] |
Returns the owner object.
Can return NULL if the object has no parent.
Reimplemented in M2MObject.
Definition at line 992 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] |
Handles GET request for the registered objects.
- Parameters:
-
nsdl An NSDL handler for the CoAP library. received_coap_header The received CoAP message from the server. observation_handler A handler object for sending observation callbacks.
- Returns:
- sn_coap_hdr_s The message that needs to be sent to server.
Reimplemented in M2MObject, and M2MResource.
Definition at line 536 of file m2mbase.cpp.
void handle_observation | ( | nsdl_s * | nsdl, |
const sn_coap_hdr_s & | received_coap_header, | ||
sn_coap_hdr_s & | coap_response, | ||
M2MObservationHandler * | observation_handler, | ||
sn_coap_msg_code_e & | response_code | ||
) | [protected] |
Handles subscription request.
- Parameters:
-
nsdl An NSDL handler for the CoAP library. received_coap_header The received CoAP message from the server. coap_response The CoAP response to be sent to server. observation_handler A handler object for sending observation callbacks.
Definition at line 1009 of file m2mbase.cpp.
bool handle_observation_attribute | ( | const char * | query ) | [virtual] |
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 494 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, | ||
sn_nsdl_addr_s * | address = NULL |
||
) | [virtual] |
Handles GET request for the registered objects.
- Parameters:
-
nsdl An NSDL handler for the CoAP library. received_coap_header The received CoAP message from the server. observation_handler A handler object for sending observation callbacks. execute_value_updated True executes the "value_updated" callback.
- Returns:
- sn_coap_hdr_s The message that needs to be sent to server.
Reimplemented in M2MObject, and M2MResource.
Definition at line 553 of file m2mbase.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] |
Handles PUT request for the registered objects.
- Parameters:
-
nsdl An NSDL handler for the CoAP library. received_coap_header The received CoAP message from the server. observation_handler A handler object for sending observation callbacks. execute_value_updated True executes the "value_updated" callback.
- Returns:
- sn_coap_hdr_s The message that needs to be sent to server.
Reimplemented in M2MObject, and M2MResource.
Definition at line 544 of file m2mbase.cpp.
uint16_t instance_id | ( | ) | const |
Returns the object's instance ID.
- Returns:
- The instance ID of the object.
Definition at line 397 of file m2mbase.cpp.
const char * interface_description | ( | ) | const |
Returns the interface description of the object.
- Returns:
- The interface description of the object.
Definition at line 406 of file m2mbase.cpp.
bool is_async_coap_request_callback_set | ( | ) | [protected] |
Returns whether asynchronous callback is set or not.
- Returns:
- True if set otherwise False.
Definition at line 919 of file m2mbase.cpp.
bool is_auto_observable | ( | ) | const |
Returns the auto observation status of the object.
- Returns:
- True if observable, else false.
Definition at line 454 of file m2mbase.cpp.
bool is_blockwise_needed | ( | const nsdl_s * | nsdl, |
uint32_t | payload_len | ||
) | [static, protected] |
Checks whether blockwise is needed to send resource value to server.
- Parameters:
-
nsdl An NSDL handler for the CoAP library. payload_len Length of the CoAP payload.
- Returns:
- True if blockwise transfer is needed, else false.
Definition at line 997 of file m2mbase.cpp.
bool is_deleted | ( | ) | [virtual] |
The deleted state check function.
- Returns:
- True if the deleted state is set, else false.
Definition at line 1119 of file m2mbase.cpp.
bool is_observable | ( | ) | const |
Returns the observation status of the object.
- Returns:
- True if observable, else false.
Definition at line 449 of file m2mbase.cpp.
bool is_under_observation | ( | ) | const |
Returns whether this resource is under observation or not.
- Returns:
- True if the resource is under observation, else false,
Definition at line 680 of file m2mbase.cpp.
bool is_value_updated_function_set | ( | ) | const |
Returns whether a callback function is set or not.
- Returns:
- True if the callback function is set, else false.
Definition at line 707 of file m2mbase.cpp.
uint32_t max_age | ( | ) | const |
Returns the max age for the resource value to be cached.
- Returns:
- The maax age in seconds.
Definition at line 489 of file m2mbase.cpp.
void * memory_alloc | ( | uint32_t | size ) | [static, protected] |
Memory allocation required for libCoap.
- Parameters:
-
size The size of memory to be reserved.
Definition at line 563 of file m2mbase.cpp.
void memory_free | ( | void * | ptr ) | [static, protected] |
Memory free functions required for libCoap.
- Parameters:
-
ptr The object whose memory needs to be freed.
Definition at line 571 of file m2mbase.cpp.
M2MBase::Mode mode | ( | ) | const |
Returns the mode of the resource.
- Returns:
- The mode of the resource.
Definition at line 475 of file m2mbase.cpp.
const char * name | ( | ) | const |
Returns the object name.
- Returns:
- The name of the object.
Definition at line 378 of file m2mbase.cpp.
int32_t name_id | ( | ) | const |
Returns the object name in integer.
- Returns:
- The name of the object in integer.
Definition at line 384 of file m2mbase.cpp.
virtual M2MObservationHandler* observation_handler | ( | ) | const [pure virtual] |
Returns the Observation Handler object.
- Returns:
- M2MObservationHandler object.
Implemented in M2MObject, and M2MResource.
M2MBase::Observation observation_level | ( | ) | const |
Returns the observation level of the object.
- Returns:
- The observation level of the object.
Definition at line 459 of file m2mbase.cpp.
uint16_t observation_number | ( | ) | const |
Returns the observation number.
- Returns:
- The observation number of the object.
Definition at line 480 of file m2mbase.cpp.
M2MBase::Operation operation | ( | ) | const |
Returns the operation type of the object.
- Returns:
- The supported operation on the object.
Definition at line 373 of file m2mbase.cpp.
bool register_uri | ( | ) |
Returns whether this resource is published to server or not.
- Returns:
- True if the resource is a part of the registration message, else false.
Definition at line 652 of file m2mbase.cpp.
void remove_observation_level | ( | M2MBase::Observation | observation_level ) | [virtual] |
Removes the observation level for the object.
- Parameters:
-
observation_level The level of observation.
Reimplemented in M2MObject, and M2MResource.
Definition at line 310 of file m2mbase.cpp.
M2MReportHandler * report_handler | ( | ) | const [protected] |
Returns the Report Handler object.
- Returns:
- M2MReportHandler object.
Definition at line 642 of file m2mbase.cpp.
size_t resource_name_length | ( | ) | const |
Returns length of the object name.
- Returns:
- Length of the object name.
Definition at line 851 of file m2mbase.cpp.
const char * resource_type | ( | ) | const |
Returns the resource type of the object.
- Returns:
- The resource type of the object.
Definition at line 416 of file m2mbase.cpp.
bool send_async_response_with_code | ( | const uint8_t * | payload, |
size_t | payload_len, | ||
const uint8_t * | token, | ||
const uint8_t | token_len, | ||
coap_response_code_e | code = COAP_RESPONSE_CHANGED |
||
) |
A trigger to send the async response for the CoAP request.
- Parameters:
-
code The code for the response, for example: 'COAP_RESPONSE_CHANGED'. payload Payload for the resource. payload_len Length of the payload. token Token for the incoming CoAP request. token_len Token length for the incoming CoAP request.
- Returns:
- True if a response is sent, else False.
Definition at line 868 of file m2mbase.cpp.
void send_message_delivery_status | ( | const M2MBase & | object, |
const MessageDeliveryStatus | status, | ||
const MessageType | type | ||
) |
Executes the function that is set in "set_message_delivery_status_cb".
Definition at line 970 of file m2mbase.cpp.
void send_notification_delivery_status | ( | const M2MBase & | object, |
const NotificationDeliveryStatus | status | ||
) |
Executes the function that is set in "set_notification_delivery_status_cb".
Note: the setter for this callback is marked as m2m_deprecated, but there is no point having it here, as then the code will always give warnings. This simply must be there until the set_notification_delivery_status_cb() is removed.
Definition at line 958 of file m2mbase.cpp.
bool set_async_coap_request_cb | ( | handle_async_coap_request_cb | callback, |
void * | client_args | ||
) |
Sets the function that is executed when CoAP request arrives.
Callback is not called if the request are invalid, for example content-type is not matching. In that case the error response is sent by the client itself.
- Parameters:
-
callback The function pointer that is called. client_args The argument which is passed to the callback function.
Definition at line 887 of file m2mbase.cpp.
void set_auto_observable | ( | bool | auto_observable ) |
Sets the object to be auto-observable.
- Note:
- This is not a standard CoAP or LWM2M feature and it only works in mbed Cloud.
- This must be called before registration process, since this info must be in a registration message.
- Auto-observable will take higher precedence if both observable methods are set.
- Parameters:
-
auto_observable Is auto-obs feature enabled or not.
Definition at line 297 of file m2mbase.cpp.
void set_base_type | ( | M2MBase::BaseType | type ) | [protected] |
Sets the base type for an object.
- Parameters:
-
type The base type of the object.
Definition at line 530 of file m2mbase.cpp.
void set_changed | ( | ) | [protected, virtual] |
The data has changed and it needs to be updated into Mbed Cloud.
Current implementation maintains the changed state only in M2MEndpoint. If any of the changes in an object changes the M2M registration structure, the information is propagated to M2MEndpoint using this interface.
Definition at line 982 of file m2mbase.cpp.
void set_coap_content_type | ( | const uint16_t | content_type ) |
Sets the CoAP content type of the object.
- Parameters:
-
content_type The content type to be set based on CoAP specifications.
Definition at line 285 of file m2mbase.cpp.
void set_deleted | ( | ) | [virtual] |
The data is set deleted and it needs to be updated into Device Management.
Current implementation maintains the deleted state only in M2MEndpoint. The deleted state is `false` for every other M2M class.
Definition at line 1114 of file m2mbase.cpp.
void set_instance_id | ( | const uint16_t | instance_id ) |
Sets the instance ID of the object.
- Parameters:
-
instance_id The instance ID of the object.
Definition at line 357 of file m2mbase.cpp.
void set_interface_description | ( | const char * | description ) |
Sets the interface description of the object.
- Parameters:
-
description The description to be set.
Definition at line 204 of file m2mbase.cpp.
void set_interface_description | ( | const String & | description ) |
Sets the interface description of the object.
- Parameters:
-
description The description to be set.
Definition at line 217 of file m2mbase.cpp.
void set_max_age | ( | const uint32_t | max_age ) |
Sets the max age for the resource value to be cached.
- Parameters:
-
max_age The max age in seconds.
Definition at line 363 of file m2mbase.cpp.
bool set_message_delivery_status_cb | ( | message_delivery_status_cb | callback, |
void * | client_args | ||
) |
Sets the function that is executed when message state changes.
Currently this is used to track notifications and delayed response delivery statuses.
- Parameters:
-
callback The function pointer that is called. client_args The argument which is passed to the callback function.
Definition at line 948 of file m2mbase.cpp.
bool set_notification_delivery_status_cb | ( | notification_delivery_status_cb | callback, |
void * | client_args | ||
) |
Sets the function that is executed when notification message state changes.
- Parameters:
-
callback The function pointer that is called. client_args The argument which is passed to the callback function.
Definition at line 937 of file m2mbase.cpp.
void set_notification_msgid | ( | uint16_t | msgid ) |
Sets the notification message id.
This is used to map RESET and EMPTY ACK messages.
- Parameters:
-
msgid The message id.
Definition at line 932 of file m2mbase.cpp.
void set_observable | ( | bool | observable ) |
Sets the observable mode for the object.
- Parameters:
-
observable A value for the observation.
Definition at line 291 of file m2mbase.cpp.
virtual void set_observation_handler | ( | M2MObservationHandler * | handler ) | [pure virtual] |
Sets the observation handler.
- Parameters:
-
handler Observation handler
Implemented in M2MObject, and M2MResource.
void set_observation_token | ( | const uint8_t * | token, |
const uint8_t | length | ||
) | [protected] |
Sets the observation token value.
- Parameters:
-
token A pointer to the token of the resource. length The length of the token pointer.
Definition at line 348 of file m2mbase.cpp.
void set_operation | ( | M2MBase::Operation | operation ) |
Sets the operation type for an object.
- Parameters:
-
operation The operation to be set.
Definition at line 191 of file m2mbase.cpp.
void set_register_uri | ( | bool | register_uri ) |
Sets whether this resource is published to server or not.
- Parameters:
-
register_uri True sets the resource as part of registration message.
Definition at line 647 of file m2mbase.cpp.
void set_resource_type | ( | const String & | resource_type ) | [virtual] |
Sets the resource type of the object.
- Parameters:
-
resource_type The resource type to be set.
Definition at line 225 of file m2mbase.cpp.
void set_resource_type | ( | const char * | resource_type ) | [virtual] |
Sets the resource type of the object.
- Parameters:
-
resource_type The resource type to be set.
Definition at line 231 of file m2mbase.cpp.
void set_under_observation | ( | bool | observed, |
M2MObservationHandler * | handler | ||
) |
Sets the object under observation.
- Parameters:
-
observed The value for observation. When true, starts observing. When false, the ongoing observation is cancelled. handler A handler object for sending observation callbacks.
Definition at line 318 of file m2mbase.cpp.
bool set_value_updated_function | ( | value_updated_callback | callback ) |
Sets the function that is executed when this object receives a PUT or POST command.
- Parameters:
-
callback The function pointer that is called.
- Returns:
- True, if callback could be set, false otherwise.
Definition at line 689 of file m2mbase.cpp.
bool set_value_updated_function | ( | value_updated_callback2 | callback ) |
Sets the function that is executed when this object receives a PUT or POST command.
- Parameters:
-
callback The function pointer that is called.
- Returns:
- True, if callback could be set, false otherwise.
Definition at line 700 of file m2mbase.cpp.
void start_observation | ( | const sn_coap_hdr_s & | received_coap_header, |
M2MObservationHandler * | observation_handler | ||
) | [protected] |
Start the observation.
- Parameters:
-
received_coap_header An NSDL handler for the CoAP library. observation_handler A handler object for sending observation callbacks.
Definition at line 1080 of file m2mbase.cpp.
const char * uri_path | ( | ) | const |
Returns the path of the object.
- Returns:
- The path of the object (eg. 3/0/1).
Definition at line 438 of file m2mbase.cpp.
Generated on Tue Jul 12 2022 20:21:05 by
