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
M2MNsdlInterface Class Reference
M2MNsdlInterface Class which interacts between mbed Client C++ Library and mbed-client-c library. More...
#include <m2mnsdlinterface.h>
Inherits M2MTimerObserver, and M2MObservationHandler.
Public Member Functions | |
| M2MNsdlInterface (M2MNsdlObserver &observer) | |
| Constructor. | |
| virtual | ~M2MNsdlInterface () |
| Destructor. | |
| void | create_endpoint (const String &endpoint_name, const String &endpoint_type, const int32_t life_time, const String &domain, const uint8_t mode, const String &context_address) |
| Creates endpoint object for the nsdl stack. | |
| void | delete_endpoint () |
| Deletes the endpoint. | |
| bool | create_nsdl_list_structure (const M2MObjectList &object_list) |
| Creates the NSDL structure for the registered objectlist. | |
| bool | delete_nsdl_resource (const String &resource_name) |
| Removed the NSDL resource for the given resource. | |
| bool | create_bootstrap_resource (sn_nsdl_addr_s *address, const String &bootstrap_endpoint_name) |
| Creates the bootstrap object. | |
| bool | send_register_message (uint8_t *address, const uint16_t port, sn_nsdl_addr_type_e address_type) |
| Sends the register message to the server. | |
| bool | send_update_registration (const uint32_t lifetime=0) |
| Sends the update registration message to the server. | |
| bool | send_unregister_message () |
| Sends unregister message to the server. | |
| void * | memory_alloc (uint16_t size) |
| Memory Allocation required for libCoap. | |
| void | memory_free (void *ptr) |
| Memory free functions required for libCoap. | |
| uint8_t | send_to_server_callback (struct nsdl_s *nsdl_handle, sn_nsdl_capab_e protocol, uint8_t *data, uint16_t data_len, sn_nsdl_addr_s *address) |
| Callback from nsdl library to inform the data is ready to be sent to server. | |
| uint8_t | received_from_server_callback (struct nsdl_s *nsdl_handle, sn_coap_hdr_s *coap_header, sn_nsdl_addr_s *address) |
| Callback from nsdl library to inform the data which is received from server for the client has been converted to coap message. | |
| uint8_t | resource_callback (struct nsdl_s *nsdl_handle, sn_coap_hdr_s *coap, sn_nsdl_addr_s *address, sn_nsdl_capab_e nsdl_capab) |
| Callback from nsdl library to inform the data which is received from server for the resources has been converted to coap message. | |
| bool | process_received_data (uint8_t *data, uint16_t data_size, sn_nsdl_addr_s *address) |
| Callback when there is data received from server and needs to be processed. | |
| void | stop_timers () |
| Stops all the timers in case there is any errors. | |
| nsdl_s * | get_nsdl_handle () |
| Returns nsdl handle. | |
| const String & | endpoint_name () const |
| Get endpoint name. | |
Protected Member Functions | |
| virtual void | timer_expired (M2MTimerObserver::Type type) |
| Indicates that the timer has expired. | |
| virtual void | observation_to_be_sent (M2MBase *object, uint16_t obs_number, m2m::Vector< uint16_t > changed_instance_ids, bool send_object=false) |
| The observation callback to be sent to the server due to a change in a parameter under observation. | |
| virtual void | resource_to_be_deleted (const String &resource_name) |
| A callback for deleting an NSDL resource. | |
| virtual void | value_updated (M2MBase *base, const String &object_name) |
| A callback indicating that the value of the resource object is updated by server. | |
| virtual void | remove_object (M2MBase *object) |
| A callback for removing an object from the list. | |
| virtual void | send_delayed_response (M2MBase *base) |
| A delayed response callback to be sent to the server due to a changed response. | |
Detailed Description
M2MNsdlInterface Class which interacts between mbed Client C++ Library and mbed-client-c library.
Definition at line 43 of file m2mnsdlinterface.h.
Constructor & Destructor Documentation
| M2MNsdlInterface | ( | M2MNsdlObserver & | observer ) |
Constructor.
- Parameters:
-
observer,Observer to pass the event callbacks from nsdl library.
Definition at line 51 of file m2mnsdlinterface.cpp.
| ~M2MNsdlInterface | ( | ) | [virtual] |
Destructor.
Definition at line 84 of file m2mnsdlinterface.cpp.
Member Function Documentation
| bool create_bootstrap_resource | ( | sn_nsdl_addr_s * | address, |
| const String & | bootstrap_endpoint_name | ||
| ) |
Creates the bootstrap object.
- Parameters:
-
address Bootstrap address.
- Returns:
- true if created and sent successfully else false.
Definition at line 242 of file m2mnsdlinterface.cpp.
| void create_endpoint | ( | const String & | endpoint_name, |
| const String & | endpoint_type, | ||
| const int32_t | life_time, | ||
| const String & | domain, | ||
| const uint8_t | mode, | ||
| const String & | context_address | ||
| ) |
Creates endpoint object for the nsdl stack.
- Parameters:
-
endpoint_name,Endpoint name of the client. endpoint_type,Endpoint type of the client. life_time,Life time of the client in seconds domain,Domain of the client. mode,Binding mode of the client, default is UDP context_address,Context address default is empty.
Definition at line 153 of file m2mnsdlinterface.cpp.
| bool create_nsdl_list_structure | ( | const M2MObjectList & | object_list ) |
Creates the NSDL structure for the registered objectlist.
- Parameters:
-
object_list,List of objects to be registered.
- Returns:
- true if structure created successfully else false.
Definition at line 216 of file m2mnsdlinterface.cpp.
| void delete_endpoint | ( | ) |
Deletes the endpoint.
Definition at line 205 of file m2mnsdlinterface.cpp.
| bool delete_nsdl_resource | ( | const String & | resource_name ) |
Removed the NSDL resource for the given resource.
- Parameters:
-
resource_name,Resource name to be removed.
- Returns:
- true if removed successfully else false.
Definition at line 233 of file m2mnsdlinterface.cpp.
| const String & endpoint_name | ( | ) | const |
| nsdl_s * get_nsdl_handle | ( | ) |
| void * memory_alloc | ( | uint16_t | size ) |
Memory Allocation required for libCoap.
- Parameters:
-
size,Size of memory to be reserved.
Definition at line 347 of file m2mnsdlinterface.cpp.
| void memory_free | ( | void * | ptr ) |
Memory free functions required for libCoap.
- Parameters:
-
ptr,Object whose memory needs to be freed.
Definition at line 355 of file m2mnsdlinterface.cpp.
| void observation_to_be_sent | ( | M2MBase * | object, |
| uint16_t | obs_number, | ||
| m2m::Vector< uint16_t > | changed_instance_ids, | ||
| bool | send_object = false |
||
| ) | [protected, virtual] |
The observation callback to be sent to the server due to a change in a parameter under observation.
- Parameters:
-
object The observed object whose information needs to be sent. obs_number The observation number. changed_instance_ids A list of changed object instance IDs. send_object Indicates whether the whole object will be sent or not.
Implements M2MObservationHandler.
Definition at line 701 of file m2mnsdlinterface.cpp.
| bool process_received_data | ( | uint8_t * | data, |
| uint16_t | data_size, | ||
| sn_nsdl_addr_s * | address | ||
| ) |
Callback when there is data received from server and needs to be processed.
- Parameters:
-
data,data received from server. data_size,data size received from server. addres,address structure of the server.
- Returns:
- true if successfully processed else false.
Definition at line 664 of file m2mnsdlinterface.cpp.
| uint8_t received_from_server_callback | ( | struct nsdl_s * | nsdl_handle, |
| sn_coap_hdr_s * | coap_header, | ||
| sn_nsdl_addr_s * | address | ||
| ) |
Callback from nsdl library to inform the data which is received from server for the client has been converted to coap message.
- Parameters:
-
nsdl_handle,Handler for the nsdl structure for this endpoint coap_header,Coap message formed from data. address,Server address from where the data is received.
- Returns:
- 1 if successful else 0.
Definition at line 384 of file m2mnsdlinterface.cpp.
| void remove_object | ( | M2MBase * | object ) | [protected, virtual] |
A callback for removing an object from the list.
- Parameters:
-
object The M2MObject to be removed.
Implements M2MObservationHandler.
Definition at line 805 of file m2mnsdlinterface.cpp.
| uint8_t resource_callback | ( | struct nsdl_s * | nsdl_handle, |
| sn_coap_hdr_s * | coap, | ||
| sn_nsdl_addr_s * | address, | ||
| sn_nsdl_capab_e | nsdl_capab | ||
| ) |
Callback from nsdl library to inform the data which is received from server for the resources has been converted to coap message.
- Parameters:
-
nsdl_handle,Handler for the nsdl resource structure for this endpoint.. coap_header,Coap message formed from data. address,Server address from where the data is received. nsdl_capab,Protocol for the message, currently only coap is supported.
- Returns:
- 1 if successful else 0.
Definition at line 568 of file m2mnsdlinterface.cpp.
| void resource_to_be_deleted | ( | const String & | resource_name ) | [protected, virtual] |
A callback for deleting an NSDL resource.
- Parameters:
-
resource_name The name of the observed object whose information needs to be deleted.
Implements M2MObservationHandler.
Definition at line 763 of file m2mnsdlinterface.cpp.
| void send_delayed_response | ( | M2MBase * | base ) | [protected, virtual] |
A delayed response callback to be sent to the server due to a changed response.
- Parameters:
-
base The resource sending the response.
Implements M2MObservationHandler.
Definition at line 724 of file m2mnsdlinterface.cpp.
| bool send_register_message | ( | uint8_t * | address, |
| const uint16_t | port, | ||
| sn_nsdl_addr_type_e | address_type | ||
| ) |
Sends the register message to the server.
- Returns:
- true if register sent successfully else false.
Definition at line 272 of file m2mnsdlinterface.cpp.
| uint8_t send_to_server_callback | ( | struct nsdl_s * | nsdl_handle, |
| sn_nsdl_capab_e | protocol, | ||
| uint8_t * | data, | ||
| uint16_t | data_len, | ||
| sn_nsdl_addr_s * | address | ||
| ) |
Callback from nsdl library to inform the data is ready to be sent to server.
- Parameters:
-
nsdl_handle,Handler for the nsdl structure for this endpoint protocol,Protocol format of the data data,Data to be sent. data_len,Size of the data to be sent address,server address where data has to be sent.
- Returns:
- 1 if successful else 0.
Definition at line 373 of file m2mnsdlinterface.cpp.
| bool send_unregister_message | ( | ) |
Sends unregister message to the server.
- Returns:
- true if unregister sent successfully else false.
Definition at line 332 of file m2mnsdlinterface.cpp.
| bool send_update_registration | ( | const uint32_t | lifetime = 0 ) |
Sends the update registration message to the server.
- Parameters:
-
lifetime,Updated lifetime value in seconds.
- Returns:
- true if sent successfully else false.
Definition at line 291 of file m2mnsdlinterface.cpp.
| void stop_timers | ( | ) |
Stops all the timers in case there is any errors.
Definition at line 675 of file m2mnsdlinterface.cpp.
| void timer_expired | ( | M2MTimerObserver::Type | type ) | [protected, virtual] |
Indicates that the timer has expired.
- Parameters:
-
type The type of the timer that has expired.
Implements M2MTimerObserver.
Definition at line 690 of file m2mnsdlinterface.cpp.
| void value_updated | ( | M2MBase * | base, |
| const String & | object_name | ||
| ) | [protected, virtual] |
A callback indicating that the value of the resource object is updated by server.
- Parameters:
-
base The object whose value is updated. object_name The name of the updated resource, default is empty.
Implements M2MObservationHandler.
Definition at line 771 of file m2mnsdlinterface.cpp.
Generated on Tue Jul 12 2022 12:29:07 by
1.7.2
