NSDL C library

Dependents:   NSDL_HelloWorld_WiFi UbloxModemNanoServiceClient IOT-NSDL_HelloWorld LWM2M_NanoService_Ethernet ... more

Fork of nsdl_lib by Tero Heinonen

Note that use of this software requires acceptance of the Sensinode EULA: http://mbed.org/teams/Sensinode/code/nsdl_lib/wiki/EULA

Revision:
3:d8cb1afd7285
Parent:
2:ab50a2ab6ec9
Child:
4:0f845ba8adff
--- a/sn_nsdl_lib.h	Wed Oct 09 14:57:33 2013 +0000
+++ b/sn_nsdl_lib.h	Thu Oct 10 10:24:59 2013 +0000
@@ -58,21 +58,24 @@
 #define SN_NSDL_ENDPOINT_NOT_REGISTERED  0
 #define SN_NSDL_ENDPOINT_IS_REGISTERED   1
 
+/**
+ * \brief Endpoint registration parameters
+ */
 typedef struct sn_nsdl_ep_parameters_
 {
-	uint8_t 	*endpoint_name_ptr;
+	uint8_t 	*endpoint_name_ptr;		/**< Endpoint name */
 	uint8_t  	endpoint_name_len;
 
-	uint8_t		*domain_name_ptr;
+	uint8_t		*domain_name_ptr;		/**< Domain to register. If null, NSP uses default domain */
 	uint8_t		domain_name_len;
 
-	uint8_t 	*type_ptr;
+	uint8_t 	*type_ptr;				/**< Endpoint type */
 	uint8_t 	type_len;
 
 	uint8_t 	*contex_ptr;
 	uint8_t 	contex_len;
 
-	uint8_t		*lifetime_ptr;
+	uint8_t		*lifetime_ptr;			/**< Endpoint lifetime in seconds. eg. "1200" = 1200 seconds */
 	uint8_t		lifetime_len;
 
 } sn_nsdl_ep_parameters_s;
@@ -81,54 +84,55 @@
 {
 	uint16_t	msg_id_number;
 	uint8_t		message_type;
-}sn_nsdl_sent_messages_s;
+} sn_nsdl_sent_messages_s;
 
 typedef struct sn_nsdl_mem_
 {
 	void *(*sn_nsdl_alloc)(uint16_t);
 	void (*sn_nsdl_free)(void *);
-}sn_nsdl_mem_s;
+} sn_nsdl_mem_s;
 
 typedef struct sn_grs_resource_
 {
 	uint8_t pathlen;
 	uint8_t *path;
-}sn_grs_resource_s;
+} sn_grs_resource_s;
 
 typedef struct sn_grs_resource_list_
 {
-	uint8_t res_count;				/**< Number of resources */
+	uint8_t res_count;					/**< Number of resources */
 	sn_grs_resource_s *res;
-}sn_grs_resource_list_s;
+} sn_grs_resource_list_s;
 
-typedef enum sn_nsdl_resource_mode_
-{
-	SN_GRS_STATIC,
-	SN_GRS_DYNAMIC,
-	SN_GRS_DIRECTORY
-}sn_nsdl_resource_mode_e;
-
-typedef enum sn_grs_resource_mutable_
-{
-	SN_GRS_GET		= 0x01,
-	SN_GRS_POST		= 0x02,
-	SN_GRS_PUT		= 0x04,
-	SN_GRS_DELETE	= 0x08
-}sn_grs_resource_mutable_e;
-
+/**
+ * \brief Resource access rights
+ */
 typedef enum sn_grs_resource_acl_
 {
 	SN_GRS_GET_ALLOWED 	= 0x01 ,
 	SN_GRS_PUT_ALLOWED 	= 0x02,
 	SN_GRS_POST_ALLOWED	= 0x04,
 	SN_GRS_DELETE_ALLOWED 	= 0x08
-}sn_grs_resource_acl_e;
+} sn_grs_resource_acl_e;
 
 typedef struct sn_proto_info_
 {
 	sn_nsdl_capab_e proto;
-}sn_proto_info_s;
+} sn_proto_info_s;
 
+/**
+ * \brief Defines the resource mode
+ */
+typedef enum sn_nsdl_resource_mode_
+{
+	SN_GRS_STATIC,						/**< Static resources have some value that does not change. */
+	SN_GRS_DYNAMIC,						/**< Dynamic resources are handled in application. Therefore one must give function callback pointer to them. */
+	SN_GRS_DIRECTORY					/**< Directory resources are unused and unsupported. */
+} sn_nsdl_resource_mode_e;
+
+/**
+ * \brief Resource registration parameters
+ */
 typedef struct sn_nsdl_resource_parameters_
 {
 	uint8_t		*resource_type_ptr;
@@ -147,17 +151,20 @@
 
 }sn_nsdl_resource_parameters_s;
 
+/**
+ * \brief Defines parameters for the resource.
+ */
 typedef struct sn_nsdl_resource_info_
 {
 	sn_nsdl_resource_parameters_s 	*resource_parameters_ptr;
 
-	sn_nsdl_resource_mode_e			mode;						//< STATIC etc..
+	sn_nsdl_resource_mode_e			mode;						/**< STATIC etc.. */
 
-	uint16_t 						pathlen;					//< Address
+	uint16_t 						pathlen;					/**< Address */
 	uint8_t 						*path;
 
-	uint16_t 						resourcelen;				//< 0 if dynamic resource, resource information in static resource
-	uint8_t 						*resource;					//< NULL if dynamic resource
+	uint16_t 						resourcelen;				/**< 0 if dynamic resource, resource information in static resource */
+	uint8_t 						*resource;					/**< NULL if dynamic resource */
 
 	sn_grs_resource_acl_e 			access;
 
@@ -261,27 +268,27 @@
 int8_t sn_nsdl_process_http(uint8_t *packet, uint16_t *packet_len, sn_nsdl_addr_s *src);
 
 /**
- * Process an incoming CoAP message.
+ * \brief Process an incoming CoAP message.
  */
 int8_t sn_nsdl_process_coap(uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src);
 
 /**
- * Must be called periodically for the library to update retransmissions.
+ * \brief Must be called periodically for the library to update retransmissions.
  */
 int8_t sn_nsdl_exec(uint32_t time);
 
 /**
- * Adds a resource to the server.
+ * \brief Adds a resource to the server.
  */
 int8_t sn_nsdl_create_resource(sn_nsdl_resource_info_s *res);
 
 /**
- * Updates a resource on the server.
+ * \brief Updates a resource on the server.
  */
 int8_t sn_nsdl_update_resource(sn_nsdl_resource_info_s *res);
 
 /**
- * Removes a resource from the resource server.
+ * \brief Removes a resource from the resource server.
  */
 int8_t sn_nsdl_delete_resource(uint8_t pathlen, uint8_t *path);
 
@@ -290,7 +297,7 @@
 sn_grs_resource_list_s *sn_nsdl_list_resource(uint8_t pathlen, uint8_t *path);
 
 /**
- * Send an outgoing CoAP request.
+ * \brief Send an outgoing CoAP request.
  */
 int8_t sn_nsdl_send_coap_message(sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr);