16 #ifndef M2M_RESOURCE_H 17 #define M2M_RESOURCE_H 29 typedef Vector<M2MResourceInstance *> M2MResourceInstanceList;
67 const String &resource_name,
74 bool multiple_instance =
false,
75 bool external_blockwise_store =
false);
90 const String &resource_name,
92 const String &resource_type,
96 bool multiple_instance =
false,
97 bool external_blockwise_store =
false);
111 virtual M2MBase *get_parent()
const;
134 #ifndef DISABLE_DELAYED_RESPONSE 142 #ifdef ENABLE_ASYNC_REST_RESPONSE 171 #endif //DISABLE_DELAYED_RESPONSE 211 #if defined (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS) && (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS == 1) 217 virtual bool handle_observation_attribute(
const char *query);
241 sn_coap_hdr_s *received_coap_header,
253 sn_coap_hdr_s *received_coap_header,
266 sn_coap_hdr_s *received_coap_header,
268 bool &execute_value_updated,
269 sn_nsdl_addr_s *address = NULL);
287 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 291 void set_manifest_check_status(
bool status);
297 bool get_manifest_check_status();
303 M2MResourceInstanceList _resource_instance_list;
305 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 309 #ifndef DISABLE_DELAYED_RESPONSE 310 uint8_t *_delayed_token;
311 uint8_t _delayed_token_len;
312 bool _delayed_response;
315 friend class Test_M2MResource;
316 friend class Test_M2MObjectInstance;
317 friend class Test_M2MObject;
318 friend class Test_M2MDevice;
319 friend class Test_M2MSecurity;
320 friend class Test_M2MServer;
321 friend class Test_M2MReportHandler;
322 friend class Test_M2MNsdlInterface;
323 friend class Test_M2MInterfaceFactory;
324 friend class Test_M2MTLVSerializer;
325 friend class Test_M2MTLVDeserializer;
326 friend class Test_M2MBase;
327 friend class Test_M2MResourceInstance;
328 friend class TestFactory;
344 #ifdef MEMORY_OPTIMIZED_API 348 M2MExecuteParameter(
const String &object_name,
const String &resource_name, uint16_t object_instance_id);
368 #ifdef MEMORY_OPTIMIZED_API 378 #ifdef MEMORY_OPTIMIZED_API 390 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 407 #ifdef MEMORY_OPTIMIZED_API 408 const char *_object_name;
409 const char *_resource_name;
411 const String &_object_name;
412 const String &_resource_name;
414 const uint8_t *_value;
415 uint16_t _value_length;
416 uint16_t _object_instance_id;
417 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 421 friend class Test_M2MResource;
425 #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
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
Returns the value set for delayed response for POST requests.
Definition: m2mresourcebase.h:47
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:335
const char * resource_type() const
Returns the resource type of the object.
void get_delayed_token(uint8_t *&token, uint8_t &token_length)
Provides the value of the token of the delayed post response.
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.