16 #ifndef M2M_RESOURCE_H 17 #define M2M_RESOURCE_H 69 const String &resource_name,
76 bool multiple_instance =
false,
77 bool external_blockwise_store =
false);
92 const String &resource_name,
94 const String &resource_type,
98 bool multiple_instance =
false,
99 bool external_blockwise_store =
false);
113 virtual M2MBase *get_parent()
const;
136 #ifndef DISABLE_DELAYED_RESPONSE 144 #ifdef ENABLE_ASYNC_REST_RESPONSE 172 #endif //DISABLE_DELAYED_RESPONSE 212 #if defined (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS) && (MBED_CONF_MBED_CLIENT_ENABLE_OBSERVATION_PARAMETERS == 1) 218 virtual bool handle_observation_attribute(
const char *query);
242 sn_coap_hdr_s *received_coap_header,
254 sn_coap_hdr_s *received_coap_header,
267 sn_coap_hdr_s *received_coap_header,
269 bool &execute_value_updated,
270 sn_nsdl_addr_s *address = NULL);
291 #ifndef DISABLE_DELAYED_RESPONSE 292 uint8_t *_delayed_token;
293 uint8_t _delayed_token_len;
294 bool _delayed_response;
297 friend class Test_M2MResource;
298 friend class Test_M2MObjectInstance;
299 friend class Test_M2MObject;
300 friend class Test_M2MDevice;
301 friend class Test_M2MSecurity;
302 friend class Test_M2MServer;
303 friend class Test_M2MNsdlInterface;
304 friend class Test_M2MInterfaceFactory;
305 friend class Test_M2MFirmware;
306 friend class Test_M2MTLVSerializer;
307 friend class Test_M2MTLVDeserializer;
308 friend class Test_M2MBase;
309 friend class Test_M2MResourceInstance;
310 friend class TestFactory;
326 #ifdef MEMORY_OPTIMIZED_API 351 #ifdef MEMORY_OPTIMIZED_API 361 #ifdef MEMORY_OPTIMIZED_API 376 #ifdef MEMORY_OPTIMIZED_API 377 const char *_object_name;
378 const char *_resource_name;
380 const String &_object_name;
381 const String &_resource_name;
384 const uint8_t *_value;
385 uint16_t _value_length;
386 uint16_t _object_instance_id;
388 friend class Test_M2MResource;
392 #endif // M2M_RESOURCE_H Mode
Enum defining a resource type.
Definition: m2mbase.h:98
Definition: m2mobservationhandler.h:31
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.
The base class based on which all LwM2M object models can be created.
Definition: m2mbase.h:63
M2MResourceBase. This class is the base class for mbed Client Resources. All defined LWM2M resource m...
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:83
M2MResourceInstance. This class is the base class for mbed Client Resources. All defined LWM2M resour...
bool remove_resource_instance(uint16_t instance_id=0)
Removes a resource with a given name.
Definition: m2mobjectinstance.h:36
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:210
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.
Definition: m2mstring.h:33
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:107
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:32
virtual void set_observation_handler(M2MObservationHandler *handler)
Sets the observation handler.
A simple C++ Vector class, used as replacement for std::vector.
bool send_delayed_post_response()
A trigger to send the delayed response for the POST request. The delayed_response flag must be set be...
bool delayed_response() const
Returns the value set for delayed response for POST requests.
Definition: m2mresourcebase.h:43
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.
The base class for Client Resources.
Definition: m2mresource.h:40
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:317
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".
uint8_t * value() const
Returns the value pointer of the object.