16 #ifndef M2M_RESOURCE_H 17 #define M2M_RESOURCE_H 29 typedef Vector<M2MResourceInstance *> M2MResourceInstanceList;
66 const String &resource_name,
73 bool multiple_instance =
false,
74 bool external_blockwise_store =
false);
89 const String &resource_name,
91 const String &resource_type,
95 bool multiple_instance =
false,
96 bool external_blockwise_store =
false);
110 virtual M2MBase *get_parent()
const;
133 #ifndef DISABLE_DELAYED_RESPONSE 141 #ifdef ENABLE_ASYNC_REST_RESPONSE 172 void get_delayed_token(uint8_t *&token, uint8_t &token_length);
174 #endif //DISABLE_DELAYED_RESPONSE 218 #if defined (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS) && (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS == 1) 226 virtual bool handle_observation_attribute(
const char *query);
256 sn_coap_hdr_s *received_coap_header,
270 sn_coap_hdr_s *received_coap_header,
285 sn_coap_hdr_s *received_coap_header,
287 bool &execute_value_updated,
288 sn_nsdl_addr_s *address = NULL);
309 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 313 void set_manifest_check_status(
bool status);
319 bool get_manifest_check_status();
325 M2MResourceInstanceList _resource_instance_list;
327 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 331 #ifndef DISABLE_DELAYED_RESPONSE 332 uint8_t *_delayed_token;
333 uint8_t _delayed_token_len;
334 bool _delayed_response;
337 friend class Test_M2MResource;
338 friend class Test_M2MObjectInstance;
339 friend class Test_M2MObject;
340 friend class Test_M2MDevice;
341 friend class Test_M2MSecurity;
342 friend class Test_M2MServer;
343 friend class Test_M2MReportHandler;
344 friend class Test_M2MNsdlInterface;
345 friend class Test_M2MInterfaceFactory;
346 friend class Test_M2MTLVSerializer;
347 friend class Test_M2MTLVDeserializer;
348 friend class Test_M2MBase;
349 friend class Test_M2MResourceInstance;
350 friend class TestFactory;
351 friend class Test_M2MInterfaceImpl;
352 friend class Test_M2MDiscover;
353 friend class Test_M2MDynLog;
369 #ifdef MEMORY_OPTIMIZED_API 375 M2MExecuteParameter(
const String &object_name,
const String &resource_name, uint16_t object_instance_id);
395 #ifdef MEMORY_OPTIMIZED_API 405 #ifdef MEMORY_OPTIMIZED_API 417 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 434 #ifdef MEMORY_OPTIMIZED_API 435 const char *_object_name;
436 const char *_resource_name;
438 const String &_object_name;
439 const String &_resource_name;
441 const uint8_t *_value;
442 uint16_t _value_length;
443 uint16_t _object_instance_id;
444 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 448 friend class Test_M2MResource;
452 #endif // M2M_RESOURCE_H Mode
Enum defining a resource type.
Definition: m2mbase.h:89
Definition: m2mobservationhandler.h:30
void add_resource_instance(M2MResourceInstance *resource_instance)
Adds resource instances to a M2MResource.
virtual void remove_observation_level(M2MBase::Observation observation_level)
Removes the observation level from an object.
header for M2MResourceBase.
virtual const char * object_name() const
Returns the name of the object where the resource exists.
Observation
Enum to define observation level.
Definition: m2mbase.h:74
header for M2MResourceInstance.
bool remove_resource_instance(uint16_t instance_id=0)
Removes a resource with a given name.
Definition: m2mobjectinstance.h:42
M2MObjectInstance & get_parent_object_instance() const
uint32_t value_length() const
Returns the length of the value pointer.
virtual sn_coap_hdr_s * handle_get_request(nsdl_s *nsdl, sn_coap_hdr_s *received_coap_header, M2MObservationHandler *observation_handler=NULL)
Handles the GET request for registered objects.
uint16_t resource_instance_count() const
Returns the total number of resources.
LwM2M parameters.
Definition: m2mbase.h:199
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 the PUT request for registered objects.
const uint8_t * get_argument_value() const
Returns the value of an argument.
CoAP response code values.
void set_delayed_response(bool delayed_response)
Sets whether the resource should send a delayed response for a POST request. This only works for reso...
virtual uint16_t object_instance_id() const
Returns the instance ID of the object where the resource exists.
M2MResourceInstance * resource_instance(uint16_t instance_id=0) const
Returns a resource instance with a given name.
virtual void add_observation_level(M2MBase::Observation observation_level)
Adds the observation level for the object.
DataType
Enum defining a resource data type.
Definition: m2mbase.h:98
const String & get_argument_object_name() const
Returns the name of the object where the resource exists.
Mode mode() const
Returns the mode of the resource.
Definition: m2mresourceinstance.h:38
virtual void set_observation_handler(M2MObservationHandler *handler)
Sets the observation handler.
bool delayed_response() const
Check if resource is set to send delayed responses for POST request. Use set_delayed_response() for e...
Definition: m2mresourcebase.h:49
virtual M2MResource & get_parent_resource() const
const String & get_argument_resource_name() const
Returns the resource name.
const M2MResourceInstanceList & resource_instances() const
Returns a list of resources.
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 the POST request for registered objects.
Definition: m2mresource.h:38
virtual M2MObservationHandler * observation_handler() const
Returns the Observation Handler object.
uint16_t get_argument_value_length() const
Returns the length of the value argument.
M2MResource::M2MExecuteParameter. This class handles the "Execute" operation arguments.
Definition: m2mresource.h:360
const char * resource_type() const
Returns the resource type of the object.
M2MBase::Observation observation_level() const
Returns the observation level of the object.
bool supports_multiple_instances() const
Returns whether the resource has multiple resource instances or not.
uint16_t instance_id() const
Returns the object's instance ID.
uint16_t get_argument_object_instance_id() const
Returns the instance ID of the object where the resource exists.
void execute_value_updated(const String &name)
Calls the function that is set in the "set_value_updated_function".
bool send_delayed_post_response(sn_coap_msg_code_e code=COAP_MSG_CODE_RESPONSE_CHANGED)
A trigger to send the delayed response for the POST request. The delayed_response flag must be set be...
uint8_t * value() const
Returns the value pointer of the object.