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: libnsdl EthernetInterface mbed-rtos
Dependents: IoT_LED_demo ServoTest uWater_Project hackathon ... more
NSDL/nsdl_support.h@1:cb681dfa1678, 2015-02-02 (annotated)
- Committer:
- ansond
- Date:
- Mon Feb 02 06:12:30 2015 +0000
- Revision:
- 1:cb681dfa1678
- Parent:
- 0:31292d956e92
- Child:
- 3:3e1ad8ab5071
updates
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ansond | 0:31292d956e92 | 1 | // Support functions for the NSDL library |
| ansond | 0:31292d956e92 | 2 | |
| ansond | 0:31292d956e92 | 3 | #ifndef __NSDL_SUPPORT_H__ |
| ansond | 0:31292d956e92 | 4 | #define __NSDL_SUPPORT_H__ |
| ansond | 0:31292d956e92 | 5 | |
| ansond | 0:31292d956e92 | 6 | #include "mbed.h" |
| ansond | 0:31292d956e92 | 7 | #include <stdint.h> |
| ansond | 0:31292d956e92 | 8 | |
| ansond | 0:31292d956e92 | 9 | #include "sn_nsdl.h" |
| ansond | 0:31292d956e92 | 10 | #include "sn_coap_header.h" |
| ansond | 0:31292d956e92 | 11 | #include "sn_coap_protocol.h" |
| ansond | 0:31292d956e92 | 12 | #include "sn_nsdl_lib.h" |
| ansond | 0:31292d956e92 | 13 | |
| ansond | 0:31292d956e92 | 14 | #include "mbedConnectorInterface.h" |
| ansond | 0:31292d956e92 | 15 | |
| ansond | 0:31292d956e92 | 16 | // ************************* MDS CONFIGURATION ********************************* |
| ansond | 0:31292d956e92 | 17 | |
| ansond | 0:31292d956e92 | 18 | extern uint8_t NSP_address_bytes[NSP_IP_ADDRESS_LENGTH]; // which MDS instance we want to bind to... |
| ansond | 0:31292d956e92 | 19 | extern uint8_t endpoint_name[NODE_NAME_LENGTH]; // our NODE name |
| ansond | 0:31292d956e92 | 20 | extern uint8_t domain_name[NSP_DOMAIN_LENGTH]; // our MDS domain name |
| ansond | 1:cb681dfa1678 | 21 | extern int nsp_port; // our MDS UDP port number |
| ansond | 0:31292d956e92 | 22 | extern uint8_t ep_type[NSP_ENDPOINT_TYPE_LENGTH]; // our NODE type |
| ansond | 0:31292d956e92 | 23 | extern uint8_t lifetime_ptr[NSP_LIFE_TIME_LENGTH]; // MDS lifetime |
| ansond | 0:31292d956e92 | 24 | |
| ansond | 0:31292d956e92 | 25 | // ************************* MDS CONFIGURATION ********************************* |
| ansond | 0:31292d956e92 | 26 | |
| ansond | 0:31292d956e92 | 27 | |
| ansond | 0:31292d956e92 | 28 | #define MAIN_LOOP_SLEEP 2000 |
| ansond | 0:31292d956e92 | 29 | |
| ansond | 0:31292d956e92 | 30 | typedef uint8_t (*sn_grs_dyn_res_callback_t)(sn_coap_hdr_s *, sn_nsdl_addr_s *, sn_proto_info_s *); |
| ansond | 0:31292d956e92 | 31 | typedef void (*sn_update_observation_t)(sn_coap_hdr_s *,sn_coap_hdr_s *); |
| ansond | 0:31292d956e92 | 32 | |
| ansond | 0:31292d956e92 | 33 | // external methods |
| ansond | 0:31292d956e92 | 34 | extern "C" void *nsdl_alloc(uint16_t size); |
| ansond | 0:31292d956e92 | 35 | extern "C" void nsdl_free(void* ptr_to_free); |
| ansond | 0:31292d956e92 | 36 | extern void nsdl_create_static_resource(sn_nsdl_resource_info_s *resource_structure, uint16_t pt_len, uint8_t *pt, uint16_t rpp_len, uint8_t *rpp_ptr, uint8_t *rsc, uint16_t rsc_len); |
| ansond | 0:31292d956e92 | 37 | extern void nsdl_create_dynamic_resource(sn_nsdl_resource_info_s *resource_structure, uint16_t pt_len, uint8_t *pt, uint16_t rpp_len, uint8_t *rpp_ptr, uint8_t is_observable, sn_grs_dyn_res_callback_t callback_ptr, int access_right); |
| ansond | 0:31292d956e92 | 38 | extern "C" sn_nsdl_ep_parameters_s* nsdl_init_register_endpoint(sn_nsdl_ep_parameters_s *endpoint_structure, uint8_t *domain, uint8_t* name, uint8_t* ypename_ptr, uint8_t *lifetime_ptr); |
| ansond | 0:31292d956e92 | 39 | extern "C" void nsdl_clean_register_endpoint(sn_nsdl_ep_parameters_s **endpoint_structure); |
| ansond | 0:31292d956e92 | 40 | extern "C" void nsdl_init(); |
| ansond | 0:31292d956e92 | 41 | extern "C" void nsdl_event_loop(); |
| ansond | 0:31292d956e92 | 42 | extern "C" void nsdl_reg_update(); |
| ansond | 0:31292d956e92 | 43 | extern "C" void configure_endpoint(); |
| ansond | 0:31292d956e92 | 44 | extern void NSP_registration(); |
| ansond | 0:31292d956e92 | 45 | extern "C" void register_endpoint(bool init); |
| ansond | 0:31292d956e92 | 46 | extern void registration_update_thread(void const *args); |
| ansond | 0:31292d956e92 | 47 | |
| ansond | 0:31292d956e92 | 48 | #include "EthernetInterface.h" |
| ansond | 0:31292d956e92 | 49 | #include "UDPSocket.h" |
| ansond | 0:31292d956e92 | 50 | #include "Endpoint.h" |
| ansond | 0:31292d956e92 | 51 | |
| ansond | 0:31292d956e92 | 52 | extern EthernetInterface ethernet; |
| ansond | 0:31292d956e92 | 53 | |
| ansond | 0:31292d956e92 | 54 | #endif // __NSDL_SUPPORT_H__ |
