Simple interface for Mbed Cloud Client
sn_nsdl_lib.h File Reference
NanoService Devices Library header file. More...
Go to the source code of this file.
Data Structures | |
struct | sn_nsdl_ep_parameters_ |
Endpoint registration parameters. More... | |
struct | sn_nsdl_sent_messages_ |
For internal use. More... | |
struct | sn_grs_resource_ |
Includes resource path. More... | |
struct | sn_grs_resource_list_ |
Table of created resources. More... | |
struct | sn_nsdl_static_resource_parameters_ |
Defines static parameters for the resource. More... | |
struct | sn_nsdl_resource_parameters_ |
Defines dynamic parameters for the resource. More... | |
struct | sn_nsdl_oma_server_info_ |
Defines OMAlw server information. More... | |
struct | sn_nsdl_bs_ep_info_ |
Defines endpoint parameters to OMA bootstrap. More... | |
Typedefs | |
typedef enum omalw_server_security_ | omalw_server_security_t |
Received device server security. | |
typedef enum sn_nsdl_oma_binding_and_mode_ | sn_nsdl_oma_binding_and_mode_t |
Endpoint binding and mode. | |
typedef enum sn_nsdl_registration_mode_ | sn_nsdl_registration_mode_t |
Endpoint registration mode. | |
typedef struct sn_nsdl_ep_parameters_ | sn_nsdl_ep_parameters_s |
Endpoint registration parameters. | |
typedef struct sn_nsdl_sent_messages_ | sn_nsdl_sent_messages_s |
For internal use. | |
typedef struct sn_grs_resource_ | sn_grs_resource_s |
Includes resource path. | |
typedef struct sn_grs_resource_list_ | sn_grs_resource_list_s |
Table of created resources. | |
typedef enum sn_grs_resource_acl_ | sn_grs_resource_acl_e |
Resource access rights. | |
typedef enum sn_nsdl_resource_mode_ | sn_nsdl_resource_mode_e |
Defines the resource mode. | |
typedef NotificationDeliveryStatus | NoticationDeliveryStatus |
Dummy alias to maintain compatibility with older version which had a typo in the enum name. | |
typedef struct sn_nsdl_static_resource_parameters_ | sn_nsdl_static_resource_parameters_s |
Defines static parameters for the resource. | |
typedef struct sn_nsdl_resource_parameters_ | sn_nsdl_dynamic_resource_parameters_s |
Defines dynamic parameters for the resource. | |
typedef struct sn_nsdl_oma_server_info_ | sn_nsdl_oma_server_info_t |
Defines OMAlw server information. | |
typedef struct sn_nsdl_bs_ep_info_ | sn_nsdl_bs_ep_info_t |
Defines endpoint parameters to OMA bootstrap. | |
Enumerations | |
enum | omalw_server_security_ |
Received device server security. More... | |
enum | sn_nsdl_oma_binding_and_mode_ |
Endpoint binding and mode. More... | |
enum | sn_nsdl_registration_mode_ |
Endpoint registration mode. More... | |
enum | sn_grs_resource_acl_ |
Resource access rights. More... | |
enum | sn_nsdl_resource_mode_ { SN_GRS_STATIC = 0, SN_GRS_DYNAMIC, SN_GRS_DIRECTORY } |
Defines the resource mode. More... | |
enum | NotificationDeliveryStatus |
Enum defining an status codes that can happen when sending notification. More... | |
Functions | |
uint16_t | sn_nsdl_register_endpoint (struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr, const char *uri_query_parameters) |
Registers endpoint to mbed Device Server. | |
int32_t | sn_nsdl_unregister_endpoint (struct nsdl_s *handle) |
Sends unregister-message to mbed Device Server. | |
int32_t | sn_nsdl_update_registration (struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len) |
Update the registration with mbed Device Server. | |
int8_t | sn_nsdl_set_endpoint_location (struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len) |
Sets the location receievd from Device Server. | |
int8_t | sn_nsdl_is_ep_registered (struct nsdl_s *handle) |
Checks if endpoint is registered. | |
void | sn_nsdl_nsp_lost (struct nsdl_s *handle) |
A function to inform mbed Device C client library if application detects a fault in mbed Device Server registration. | |
char * | sn_nsdl_get_version (void) |
Version query function. | |
int8_t | sn_nsdl_process_coap (struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src) |
To push CoAP packet to mbed Device C Client library. | |
int8_t | sn_nsdl_exec (struct nsdl_s *handle, uint32_t time) |
CoAP retransmission function. | |
void | sn_nsdl_free_resource_list (struct nsdl_s *handle, sn_grs_resource_list_s *list) |
Free a resource list obtained from sn_nsdl_list_resource() | |
int8_t | sn_nsdl_send_coap_message (struct nsdl_s *handle, sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr) |
Send an outgoing CoAP request. | |
int8_t | set_NSP_address (struct nsdl_s *handle, uint8_t *NSP_address, uint8_t address_length, uint16_t port, sn_nsdl_addr_type_e address_type) |
This function is used to set the mbed Device Server address given by an application. | |
int8_t | sn_nsdl_destroy (struct nsdl_s *handle) |
This function releases all allocated memory in mbed Device C Client library. | |
sn_coap_hdr_s * | sn_nsdl_build_response (struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code) |
Prepares generic response packet from a request packet. | |
sn_coap_options_list_s * | sn_nsdl_alloc_options_list (struct nsdl_s *handle, sn_coap_hdr_s *coap_msg_ptr) |
Allocates and initializes options list structure. | |
void | sn_nsdl_release_allocated_coap_msg_mem (struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr) |
Releases memory of given CoAP message. | |
int8_t | sn_nsdl_set_retransmission_parameters (struct nsdl_s *handle, uint8_t resending_count, uint8_t resending_interval) |
If re-transmissions are enabled, this function changes resending count and interval. | |
int8_t | sn_nsdl_set_retransmission_buffer (struct nsdl_s *handle, uint8_t buffer_size_messages, uint16_t buffer_size_bytes) |
If re-transmissions are enabled, this function changes message retransmission queue size. | |
int8_t | sn_nsdl_set_block_size (struct nsdl_s *handle, uint16_t block_size) |
If block transfer is enabled, this function changes the block size. | |
int8_t | sn_nsdl_set_duplicate_buffer_size (struct nsdl_s *handle, uint8_t message_count) |
If dublicate message detection is enabled, this function changes buffer size. | |
void * | sn_nsdl_get_context (const struct nsdl_s *const handle) |
Get the application defined context parameter for given handle. | |
int8_t | sn_nsdl_clear_coap_resending_queue (struct nsdl_s *handle) |
Clean confirmable message list. | |
int8_t | sn_nsdl_clear_coap_sent_blockwise_messages (struct nsdl_s *handle) |
Clears the sent blockwise messages from the linked list. | |
int8_t | sn_nsdl_handle_block2_response_internally (struct nsdl_s *handle, uint8_t handle_response) |
This function change the state whether CoAP library sends the block 2 response automatically or not. |
Detailed Description
NanoService Devices Library header file.
Definition in file sn_nsdl_lib.h.
Typedef Documentation
Dummy alias to maintain compatibility with older version which had a typo in the enum name.
Definition at line 189 of file sn_nsdl_lib.h.
typedef enum omalw_server_security_ omalw_server_security_t |
Received device server security.
typedef enum sn_grs_resource_acl_ sn_grs_resource_acl_e |
Resource access rights.
typedef struct sn_grs_resource_list_ sn_grs_resource_list_s |
Table of created resources.
typedef struct sn_grs_resource_ sn_grs_resource_s |
Includes resource path.
typedef struct sn_nsdl_bs_ep_info_ sn_nsdl_bs_ep_info_t |
Defines endpoint parameters to OMA bootstrap.
Defines dynamic parameters for the resource.
typedef struct sn_nsdl_ep_parameters_ sn_nsdl_ep_parameters_s |
Endpoint registration parameters.
Endpoint binding and mode.
typedef struct sn_nsdl_oma_server_info_ sn_nsdl_oma_server_info_t |
Defines OMAlw server information.
typedef enum sn_nsdl_registration_mode_ sn_nsdl_registration_mode_t |
Endpoint registration mode.
If REGISTER_WITH_RESOURCES, endpoint sends list of all resources during registration. If REGISTER_WITH_TEMPLATE, endpoint sends registration without resource list. Device server must have correctly configured template.
typedef enum sn_nsdl_resource_mode_ sn_nsdl_resource_mode_e |
Defines the resource mode.
typedef struct sn_nsdl_sent_messages_ sn_nsdl_sent_messages_s |
For internal use.
Defines static parameters for the resource.
Enumeration Type Documentation
Enum defining an status codes that can happen when sending notification.
Definition at line 177 of file sn_nsdl_lib.h.
Received device server security.
Definition at line 59 of file sn_nsdl_lib.h.
enum sn_grs_resource_acl_ |
Resource access rights.
Definition at line 157 of file sn_nsdl_lib.h.
Endpoint binding and mode.
Definition at line 70 of file sn_nsdl_lib.h.
Endpoint registration mode.
If REGISTER_WITH_RESOURCES, endpoint sends list of all resources during registration. If REGISTER_WITH_TEMPLATE, endpoint sends registration without resource list. Device server must have correctly configured template.
Definition at line 105 of file sn_nsdl_lib.h.
Defines the resource mode.
- Enumerator:
Definition at line 167 of file sn_nsdl_lib.h.
Function Documentation
int8_t set_NSP_address | ( | struct nsdl_s * | handle, |
uint8_t * | NSP_address, | ||
uint8_t | address_length, | ||
uint16_t | port, | ||
sn_nsdl_addr_type_e | address_type | ||
) |
sn_coap_options_list_s* sn_nsdl_alloc_options_list | ( | struct nsdl_s * | handle, |
sn_coap_hdr_s * | coap_msg_ptr | ||
) |
Allocates and initializes options list structure.
- Parameters:
-
*handle Pointer to library handle *coap_msg_ptr is pointer to CoAP message that will contain the options
If the message already has a pointer to an option structure, that pointer is returned, rather than a new structure being allocated.
- Returns:
- Return value is pointer to the CoAP options structure.
In following failure cases NULL is returned:
-Failure in given pointer (= NULL)
-Failure in memory allocation (malloc() returns NULL)
sn_coap_hdr_s * sn_nsdl_build_response | ( | struct nsdl_s * | handle, |
sn_coap_hdr_s * | coap_packet_ptr, | ||
uint8_t | msg_code | ||
) |
Prepares generic response packet from a request packet.
This function allocates memory for the resulting sn_coap_hdr_s
- Parameters:
-
*handle Pointer to library handle *coap_packet_ptr The request packet pointer msg_code response messages code
- Returns:
- *coap_packet_ptr The allocated and pre-filled response packet pointer NULL Error in parsing the request
int8_t sn_nsdl_clear_coap_resending_queue | ( | struct nsdl_s * | handle ) |
int8_t sn_nsdl_clear_coap_sent_blockwise_messages | ( | struct nsdl_s * | handle ) |
int8_t sn_nsdl_destroy | ( | struct nsdl_s * | handle ) |
int8_t sn_nsdl_exec | ( | struct nsdl_s * | handle, |
uint32_t | time | ||
) |
void sn_nsdl_free_resource_list | ( | struct nsdl_s * | handle, |
sn_grs_resource_list_s * | list | ||
) |
void * sn_nsdl_get_context | ( | const struct nsdl_s *const | handle ) |
Get the application defined context parameter for given handle.
This is useful for example when interfacing with c++ objects where a pointer to object is set as the context, and in the callback functions the context pointer can be used to call methods for the correct instance of the c++ object.
- Parameters:
-
*handle Pointer to library handle
- Returns:
- Pointer to the application defined context
uint32_t sn_nsdl_get_version | ( | void | ) |
int8_t sn_nsdl_handle_block2_response_internally | ( | struct nsdl_s * | handle, |
uint8_t | handle_response | ||
) |
This function change the state whether CoAP library sends the block 2 response automatically or not.
- Parameters:
-
*handle Pointer to NSDL library handle handle_response 1 if CoAP library handles the response sending otherwise 0.
- Returns:
- 0 = success, -1 = failure
int8_t sn_nsdl_is_ep_registered | ( | struct nsdl_s * | handle ) |
void sn_nsdl_nsp_lost | ( | struct nsdl_s * | handle ) |
A function to inform mbed Device C client library if application detects a fault in mbed Device Server registration.
- Parameters:
-
*handle Pointer to nsdl-library handle
After calling this function sn_nsdl_is_ep_registered() will return "not registered".
int8_t sn_nsdl_process_coap | ( | struct nsdl_s * | handle, |
uint8_t * | packet, | ||
uint16_t | packet_len, | ||
sn_nsdl_addr_s * | src | ||
) |
To push CoAP packet to mbed Device C Client library.
Used to push an CoAP packet to mbed Device C Client library for processing.
- Parameters:
-
*handle Pointer to nsdl-library handle *packet Pointer to a uint8_t array containing the packet (including the CoAP headers). After successful execution this array may contain the response packet. *packet_len Pointer to length of the packet. After successful execution this array may contain the length of the response packet. *src Pointer to packet source address information. After successful execution this array may contain the destination address of the response packet.
- Returns:
- 0 Success
- -1 Failure
uint16_t sn_nsdl_register_endpoint | ( | struct nsdl_s * | handle, |
sn_nsdl_ep_parameters_s * | endpoint_info_ptr, | ||
const char * | uri_query_parameters | ||
) |
void sn_nsdl_release_allocated_coap_msg_mem | ( | struct nsdl_s * | handle, |
sn_coap_hdr_s * | freed_coap_msg_ptr | ||
) |
int8_t sn_nsdl_send_coap_message | ( | struct nsdl_s * | handle, |
sn_nsdl_addr_s * | address_ptr, | ||
sn_coap_hdr_s * | coap_hdr_ptr | ||
) |
int8_t sn_nsdl_set_block_size | ( | struct nsdl_s * | handle, |
uint16_t | block_size | ||
) |
int8_t sn_nsdl_set_duplicate_buffer_size | ( | struct nsdl_s * | handle, |
uint8_t | message_count | ||
) |
int8_t sn_nsdl_set_endpoint_location | ( | struct nsdl_s * | handle, |
uint8_t * | location_ptr, | ||
uint8_t | location_len | ||
) |
int8_t sn_nsdl_set_retransmission_buffer | ( | struct nsdl_s * | handle, |
uint8_t | buffer_size_messages, | ||
uint16_t | buffer_size_bytes | ||
) |
If re-transmissions are enabled, this function changes message retransmission queue size.
Set size to '0' to disable feature. If both are set to '0', then re-sendings are disabled.
- Parameters:
-
*handle Pointer to library handle uint8_t buffer_size_messages queue size - maximum number of messages to be saved to queue uint8_t buffer_size_bytes queue size - maximum size of messages saved to queue
- Returns:
- 0 = success, -1 = failure
int8_t sn_nsdl_set_retransmission_parameters | ( | struct nsdl_s * | handle, |
uint8_t | resending_count, | ||
uint8_t | resending_intervall | ||
) |
If re-transmissions are enabled, this function changes resending count and interval.
- Parameters:
-
*handle Pointer to library handle uint8_t resending_count max number of resendings for message uint8_t resending_intervall message resending intervall in seconds
- Returns:
- 0 = success, -1 = failure
int32_t sn_nsdl_unregister_endpoint | ( | struct nsdl_s * | handle ) |
int32_t sn_nsdl_update_registration | ( | struct nsdl_s * | handle, |
uint8_t * | lt_ptr, | ||
uint8_t | lt_len | ||
) |
Generated on Tue Jul 12 2022 19:01:39 by 1.7.2