version of nsdl to work with lwm2m, updated RD parameters and location option handling

Dependents:   ArchPro_LWM2M_LED_Client Weather_Station_LWM2M mbedEndpointNetwork

Fork of nanoservice_client_1_12 by Zach Shelby

Committer:
michaeljkoster
Date:
Mon Apr 13 22:13:40 2015 +0000
Revision:
10:b5ecd6660d71
Parent:
0:aafd54b05111
Add error return from sn_nsdl_register_endpoint() in sn_nsdl.c

Who changed what in which revision?

UserRevisionLine numberNew contents of line
zdshelby 0:aafd54b05111 1 /*
zdshelby 0:aafd54b05111 2 * sn_linked_list.h
zdshelby 0:aafd54b05111 3 *
zdshelby 0:aafd54b05111 4 * Created on: 9.8.2011
zdshelby 0:aafd54b05111 5 * Author:
zdshelby 0:aafd54b05111 6 */
zdshelby 0:aafd54b05111 7
zdshelby 0:aafd54b05111 8 #ifdef __cplusplus
zdshelby 0:aafd54b05111 9 extern "C" {
zdshelby 0:aafd54b05111 10 #endif
zdshelby 0:aafd54b05111 11
zdshelby 0:aafd54b05111 12 #include <stdint.h>
zdshelby 0:aafd54b05111 13
zdshelby 0:aafd54b05111 14 #ifndef SN_LINKED_LIST_H_
zdshelby 0:aafd54b05111 15 #define SN_LINKED_LIST_H_
zdshelby 0:aafd54b05111 16
zdshelby 0:aafd54b05111 17 #define SN_LINKED_LIST_ERROR_NO_ERROR 0
zdshelby 0:aafd54b05111 18 #define SN_LINKED_LIST_ERROR_INVALID_LIST_POINTER 1
zdshelby 0:aafd54b05111 19 #define SN_LINKED_LIST_ERROR_LIST_NOT_EMPTY 2
zdshelby 0:aafd54b05111 20 #define SN_LINKED_LIST_ERROR_NO_DATA_TO_ADD 3
zdshelby 0:aafd54b05111 21 #define SN_LINKED_LIST_ERROR_DATA_ALLOCATOIN_FAILED 4
zdshelby 0:aafd54b05111 22 #define SN_LINKED_LIST_ERROR_NOTHING_TO_REMOVE 5
zdshelby 0:aafd54b05111 23
zdshelby 0:aafd54b05111 24 struct sn_linked_list_node
zdshelby 0:aafd54b05111 25 {
zdshelby 0:aafd54b05111 26 struct sn_linked_list_node *next_node;
zdshelby 0:aafd54b05111 27 struct sn_linked_list_node *previous_node;
zdshelby 0:aafd54b05111 28 void *data;
zdshelby 0:aafd54b05111 29 };
zdshelby 0:aafd54b05111 30
zdshelby 0:aafd54b05111 31 typedef struct sn_linked_list_t_
zdshelby 0:aafd54b05111 32 {
zdshelby 0:aafd54b05111 33 struct sn_linked_list_node *first_node;
zdshelby 0:aafd54b05111 34 struct sn_linked_list_node *current_node;
zdshelby 0:aafd54b05111 35 uint16_t node_count;
zdshelby 0:aafd54b05111 36 }sn_linked_list_t;
zdshelby 0:aafd54b05111 37
zdshelby 0:aafd54b05111 38 /* \brief This function MUST be called once before starting to use other functionalities in this file. */
zdshelby 0:aafd54b05111 39 extern void sn_linked_list_init(void *(*linked_list_alloc_function)(uint16_t), void (*linked_list_free_function)(void*));
zdshelby 0:aafd54b05111 40
zdshelby 0:aafd54b05111 41 /* \brief Creates a new linked list and returns a pointer to it, returns value NULL on allocation error */
zdshelby 0:aafd54b05111 42 extern sn_linked_list_t *sn_linked_list_create(void);
zdshelby 0:aafd54b05111 43
zdshelby 0:aafd54b05111 44 /* \brief Removes empty linked list.
zdshelby 0:aafd54b05111 45 * Note that the list will NOT be removed unless it is empty */
zdshelby 0:aafd54b05111 46 extern int8_t sn_linked_list_free(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 47
zdshelby 0:aafd54b05111 48 /* \brief Adds node to a linked list */
zdshelby 0:aafd54b05111 49 extern int8_t sn_linked_list_add_node(sn_linked_list_t *linked_list, void *data);
zdshelby 0:aafd54b05111 50
zdshelby 0:aafd54b05111 51 /* \brief Returns a pointer to data on first node and sets it as a current node.
zdshelby 0:aafd54b05111 52 * Returns NULL pointer if list is empty
zdshelby 0:aafd54b05111 53 * Note that node first added to list is the last node on list and first node on list is the most recently added. */
zdshelby 0:aafd54b05111 54 extern void *sn_linked_list_get_first_node(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 55
zdshelby 0:aafd54b05111 56 /* \brief Returns a pointer to next node and a NULL pointer if next node does not exist
zdshelby 0:aafd54b05111 57 * Note that you need to call sn_linked_list_get_first_node or
zdshelby 0:aafd54b05111 58 * sn_linked_list_get_last_node and sn_linked_list_get_previous_node before using this function */
zdshelby 0:aafd54b05111 59 extern void *sn_linked_list_get_next_node(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 60
zdshelby 0:aafd54b05111 61 /* \brief Returns a pointer to current node and a NULL pointer if current node does not exist */
zdshelby 0:aafd54b05111 62 extern void *sn_linked_list_get_current_node(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 63
zdshelby 0:aafd54b05111 64 /* \brief Returns a pointer to next node and a NULL pointer if next node does not exist
zdshelby 0:aafd54b05111 65 * * Note that you need to call sn_linked_list_get_last_node or
zdshelby 0:aafd54b05111 66 * sn_linked_list_get_first_node and sn_linked_list_get_next_node before using this function */
zdshelby 0:aafd54b05111 67 extern void *sn_linked_list_get_previous_node(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 68
zdshelby 0:aafd54b05111 69 /* \brief Returns a pointer to last node on list and a NULL pointer if list is empty or error occurs.
zdshelby 0:aafd54b05111 70 * Sets last node as current node. */
zdshelby 0:aafd54b05111 71 extern void *sn_linked_list_get_last_node(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 72
zdshelby 0:aafd54b05111 73 /* \brief Removes current node from list. Sets next node as current node or
zdshelby 0:aafd54b05111 74 * if next node is null sets pointer to previous node.
zdshelby 0:aafd54b05111 75 * Returns data pointer from removed node or NULL pointer if there is no current node.
zdshelby 0:aafd54b05111 76 * Note that linked list does NOT free the data in current node. */
zdshelby 0:aafd54b05111 77 extern void *sn_linked_list_remove_current_node(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 78
zdshelby 0:aafd54b05111 79 /* \brief Updates current node to contain data given in the data parameter.
zdshelby 0:aafd54b05111 80 * Note that this function does NOT free data that current node held before this function call.
zdshelby 0:aafd54b05111 81 * If error is returned, nothing has been done. */
zdshelby 0:aafd54b05111 82 extern int8_t sn_linked_list_update_current_node(sn_linked_list_t *linked_list, void *data);
zdshelby 0:aafd54b05111 83
zdshelby 0:aafd54b05111 84 /* \brief Returns number of nodes that are currently stored in list.
zdshelby 0:aafd54b05111 85 * Note: if list contains over 65535 nodes, this function can NOT be used */
zdshelby 0:aafd54b05111 86 extern uint16_t sn_linked_list_count_nodes(sn_linked_list_t *linked_list);
zdshelby 0:aafd54b05111 87
zdshelby 0:aafd54b05111 88 #endif /* SN_LINKED_LIST_H_ */
zdshelby 0:aafd54b05111 89
zdshelby 0:aafd54b05111 90 #ifdef __cplusplus
zdshelby 0:aafd54b05111 91 }
zdshelby 0:aafd54b05111 92 #endif