mbed client lightswitch demo
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Fork of mbed-client-classic-example-lwip by
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_resource_parameters_ |
Resource registration parameters. More... | |
struct | sn_nsdl_resource_info_ |
Defines parameters for the resource. More... | |
struct | sn_nsdl_oma_device_ |
Defines OMA device object parameters. 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 struct sn_nsdl_resource_parameters_ | sn_nsdl_resource_parameters_s |
Resource registration parameters. | |
typedef struct sn_nsdl_resource_info_ | sn_nsdl_resource_info_s |
Defines parameters for the resource. | |
typedef struct sn_nsdl_oma_device_ | sn_nsdl_oma_device_t |
Defines OMA device object parameters. | |
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, SN_GRS_DYNAMIC, SN_GRS_DIRECTORY } |
Defines the resource mode. More... | |
Functions | |
uint16_t | sn_nsdl_register_endpoint (struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr) |
Registers endpoint to mbed Device Server. | |
uint16_t | sn_nsdl_unregister_endpoint (struct nsdl_s *handle) |
Sends unregister-message to mbed Device Server. | |
uint16_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. | |
uint16_t | sn_nsdl_send_observation_notification (struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len, uint8_t *payload_ptr, uint16_t payload_len, uint8_t *observe_ptr, uint8_t observe_len, sn_coap_msg_type_e message_type, uint8_t content_type) |
Sends observation message to mbed Device Server. | |
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. | |
int8_t | sn_nsdl_create_resource (struct nsdl_s *handle, sn_nsdl_resource_info_s *res) |
Resource creating function. | |
sn_nsdl_resource_info_s * | sn_nsdl_get_resource (struct nsdl_s *handle, uint16_t pathlen, uint8_t *path) |
Resource get function. | |
sn_grs_resource_list_s * | sn_nsdl_list_resource (struct nsdl_s *handle, uint16_t pathlen, uint8_t *path) |
Resource list 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, 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. | |
uint16_t | sn_nsdl_oma_bootstrap (struct nsdl_s *handle, sn_nsdl_addr_s *bootstrap_address_ptr, sn_nsdl_ep_parameters_s *endpoint_info_ptr, sn_nsdl_bs_ep_info_t *bootstrap_endpoint_info_ptr) |
Starts OMA bootstrap process. | |
omalw_certificate_list_t * | sn_nsdl_get_certificates (struct nsdl_s *handle) |
Get pointer to received device server certificates. | |
int8_t | sn_nsdl_update_certificates (struct nsdl_s *handle, omalw_certificate_list_t *certificate_ptr, uint8_t certificate_chain) |
Updates certificate pointers to resource server. | |
int8_t | sn_nsdl_create_oma_device_object (struct nsdl_s *handle, sn_nsdl_oma_device_t *device_object_ptr) |
Creates new device object resource. | |
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. | |
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. |
Detailed Description
NanoService Devices Library header file.
Definition in file sn_nsdl_lib.h.
Typedef Documentation
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.
typedef struct sn_nsdl_ep_parameters_ sn_nsdl_ep_parameters_s |
Endpoint registration parameters.
Endpoint binding and mode.
typedef struct sn_nsdl_oma_device_ sn_nsdl_oma_device_t |
Defines OMA device object parameters.
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 struct sn_nsdl_resource_info_ sn_nsdl_resource_info_s |
Defines parameters for the resource.
typedef enum sn_nsdl_resource_mode_ sn_nsdl_resource_mode_e |
Defines the resource mode.
typedef struct sn_nsdl_resource_parameters_ sn_nsdl_resource_parameters_s |
Resource registration parameters.
typedef struct sn_nsdl_sent_messages_ sn_nsdl_sent_messages_s |
For internal use.
Enumeration Type Documentation
Received device server security.
Definition at line 43 of file sn_nsdl_lib.h.
enum sn_grs_resource_acl_ |
Resource access rights.
Definition at line 133 of file sn_nsdl_lib.h.
Endpoint binding and mode.
Definition at line 54 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 67 of file sn_nsdl_lib.h.
Defines the resource mode.
- Enumerator:
Definition at line 156 of file sn_nsdl_lib.h.
Function Documentation
int8_t set_NSP_address | ( | struct nsdl_s * | handle, |
uint8_t * | NSP_address, | ||
uint16_t | port, | ||
sn_nsdl_addr_type_e | address_type | ||
) |
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_create_oma_device_object | ( | struct nsdl_s * | handle, |
sn_nsdl_oma_device_t * | device_object_ptr | ||
) |
int8_t sn_nsdl_create_resource | ( | struct nsdl_s * | handle, |
sn_nsdl_resource_info_s * | res | ||
) |
Resource creating function.
Used to create a static or dynamic CoAP resource.
- Parameters:
-
*res Pointer to a structure of type sn_nsdl_resource_info_t that contains the information about the resource.
- Returns:
- 0 Success
- -1 Failure
- -2 Resource already exists
- -3 Invalid path
- -4 List adding failure
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 | ||
) |
Free a resource list obtained from sn_nsdl_list_resource()
- Parameters:
-
list The list to free, or NULL.
omalw_certificate_list_t * sn_nsdl_get_certificates | ( | struct nsdl_s * | handle ) |
sn_nsdl_resource_info_s * sn_nsdl_get_resource | ( | struct nsdl_s * | handle, |
uint16_t | pathlen, | ||
uint8_t * | path | ||
) |
Resource get function.
Used to get a resource.
- Parameters:
-
*handle Pointer to nsdl-library handle pathlen Contains the length of the path that is to be returned (excluding possible trailing '\0'). *path A pointer to an array containing the path.
- Returns:
- !NULL Success, pointer to a sn_nsdl_resource_info_s that contains the resource information
- NULL Failure
uint32_t sn_nsdl_get_version | ( | void | ) |
int8_t sn_nsdl_is_ep_registered | ( | struct nsdl_s * | handle ) |
sn_grs_resource_list_s * sn_nsdl_list_resource | ( | struct nsdl_s * | handle, |
uint16_t | pathlen, | ||
uint8_t * | path | ||
) |
Resource list function.
- Parameters:
-
*handle Pointer to nsdl-library handle pathlen Contains the length of the target path (excluding possible trailing '\0'). The length value is not examined if the path itself is a NULL pointer. *path A pointer to an array containing the path or a NULL pointer.
- Returns:
- !NULL A pointer to a sn_grs_resource_list_s structure containing the resource listing.
- NULL Failure with an unspecified error
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".
uint16_t sn_nsdl_oma_bootstrap | ( | struct nsdl_s * | handle, |
sn_nsdl_addr_s * | bootstrap_address_ptr, | ||
sn_nsdl_ep_parameters_s * | endpoint_info_ptr, | ||
sn_nsdl_bs_ep_info_t * | bootstrap_endpoint_info_ptr | ||
) |
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 | ||
) |
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 | ||
) |
uint16_t sn_nsdl_send_observation_notification | ( | struct nsdl_s * | handle, |
uint8_t * | token_ptr, | ||
uint8_t | token_len, | ||
uint8_t * | payload_ptr, | ||
uint16_t | payload_len, | ||
uint8_t * | observe_ptr, | ||
uint8_t | observe_len, | ||
sn_coap_msg_type_e | message_type, | ||
uint8_t | content_type | ||
) |
Sends observation message to mbed Device Server.
- Parameters:
-
*handle Pointer to nsdl-library handle *token_ptr Pointer to token to be used token_len Token length *payload_ptr Pointer to payload to be sent payload_len Payload length *observe_ptr Pointer to observe number to be sent observe_len Observe number len message_type Observation message type (confirmable or non-confirmable) contetnt_type Observation message payload contetnt type
- Returns:
- !0 Success, observation messages message ID
- 0 Failure
int8_t sn_nsdl_set_endpoint_location | ( | struct nsdl_s * | handle, |
uint8_t * | location_ptr, | ||
uint8_t | location_len | ||
) |
uint16_t sn_nsdl_unregister_endpoint | ( | struct nsdl_s * | handle ) |
int8_t sn_nsdl_update_certificates | ( | struct nsdl_s * | handle, |
omalw_certificate_list_t * | certificate_ptr, | ||
uint8_t | certificate_chain | ||
) |
uint16_t sn_nsdl_update_registration | ( | struct nsdl_s * | handle, |
uint8_t * | lt_ptr, | ||
uint8_t | lt_len | ||
) |
Generated on Tue Jul 12 2022 18:27:28 by 1.7.2