![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Example
Dependencies: FXAS21002 FXOS8700Q
simple-mbed-cloud-client/mbed-cloud-client/mbed-client/mbed-client-c/nsdl-c/sn_nsdl_lib.h@0:11cc2b7889af, 2019-11-19 (annotated)
- Committer:
- maygup01
- Date:
- Tue Nov 19 09:49:38 2019 +0000
- Revision:
- 0:11cc2b7889af
Example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maygup01 | 0:11cc2b7889af | 1 | /* |
maygup01 | 0:11cc2b7889af | 2 | * Copyright (c) 2011-2015 ARM Limited. All rights reserved. |
maygup01 | 0:11cc2b7889af | 3 | * SPDX-License-Identifier: Apache-2.0 |
maygup01 | 0:11cc2b7889af | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
maygup01 | 0:11cc2b7889af | 5 | * not use this file except in compliance with the License. |
maygup01 | 0:11cc2b7889af | 6 | * You may obtain a copy of the License at |
maygup01 | 0:11cc2b7889af | 7 | * |
maygup01 | 0:11cc2b7889af | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
maygup01 | 0:11cc2b7889af | 9 | * |
maygup01 | 0:11cc2b7889af | 10 | * Unless required by applicable law or agreed to in writing, software |
maygup01 | 0:11cc2b7889af | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
maygup01 | 0:11cc2b7889af | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
maygup01 | 0:11cc2b7889af | 13 | * See the License for the specific language governing permissions and |
maygup01 | 0:11cc2b7889af | 14 | * limitations under the License. |
maygup01 | 0:11cc2b7889af | 15 | */ |
maygup01 | 0:11cc2b7889af | 16 | |
maygup01 | 0:11cc2b7889af | 17 | /** |
maygup01 | 0:11cc2b7889af | 18 | * \file sn_nsdl_lib.h |
maygup01 | 0:11cc2b7889af | 19 | * |
maygup01 | 0:11cc2b7889af | 20 | * \brief NanoService Devices Library header file |
maygup01 | 0:11cc2b7889af | 21 | * |
maygup01 | 0:11cc2b7889af | 22 | * |
maygup01 | 0:11cc2b7889af | 23 | */ |
maygup01 | 0:11cc2b7889af | 24 | |
maygup01 | 0:11cc2b7889af | 25 | #ifndef SN_NSDL_LIB_H_ |
maygup01 | 0:11cc2b7889af | 26 | #define SN_NSDL_LIB_H_ |
maygup01 | 0:11cc2b7889af | 27 | |
maygup01 | 0:11cc2b7889af | 28 | #include "ns_list.h" |
maygup01 | 0:11cc2b7889af | 29 | #include "sn_client_config.h" |
maygup01 | 0:11cc2b7889af | 30 | |
maygup01 | 0:11cc2b7889af | 31 | #ifdef __cplusplus |
maygup01 | 0:11cc2b7889af | 32 | extern "C" { |
maygup01 | 0:11cc2b7889af | 33 | #endif |
maygup01 | 0:11cc2b7889af | 34 | |
maygup01 | 0:11cc2b7889af | 35 | #define SN_NSDL_ENDPOINT_NOT_REGISTERED 0 |
maygup01 | 0:11cc2b7889af | 36 | #define SN_NSDL_ENDPOINT_IS_REGISTERED 1 |
maygup01 | 0:11cc2b7889af | 37 | |
maygup01 | 0:11cc2b7889af | 38 | #define MAX_TOKEN_SIZE 8 |
maygup01 | 0:11cc2b7889af | 39 | #define MAX_URI_QUERY_LEN 255 |
maygup01 | 0:11cc2b7889af | 40 | |
maygup01 | 0:11cc2b7889af | 41 | #if defined MBED_CONF_MBED_CLIENT_DISABLE_INTERFACE_DESCRIPTION |
maygup01 | 0:11cc2b7889af | 42 | #define DISABLE_INTERFACE_DESCRIPTION MBED_CONF_MBED_CLIENT_DISABLE_INTERFACE_DESCRIPTION |
maygup01 | 0:11cc2b7889af | 43 | #endif |
maygup01 | 0:11cc2b7889af | 44 | |
maygup01 | 0:11cc2b7889af | 45 | #if defined MBED_CONF_MBED_CLIENT_DISABLE_RESOURCE_TYPE |
maygup01 | 0:11cc2b7889af | 46 | #define DISABLE_RESOURCE_TYPE MBED_CONF_MBED_CLIENT_DISABLE_RESOURCE_TYPE |
maygup01 | 0:11cc2b7889af | 47 | #endif |
maygup01 | 0:11cc2b7889af | 48 | |
maygup01 | 0:11cc2b7889af | 49 | /* Handle structure */ |
maygup01 | 0:11cc2b7889af | 50 | struct nsdl_s; |
maygup01 | 0:11cc2b7889af | 51 | |
maygup01 | 0:11cc2b7889af | 52 | /** |
maygup01 | 0:11cc2b7889af | 53 | * \brief Received device server security |
maygup01 | 0:11cc2b7889af | 54 | */ |
maygup01 | 0:11cc2b7889af | 55 | typedef enum omalw_server_security_ { |
maygup01 | 0:11cc2b7889af | 56 | SEC_NOT_SET = -1, |
maygup01 | 0:11cc2b7889af | 57 | PSK = 0, |
maygup01 | 0:11cc2b7889af | 58 | RPK = 1, |
maygup01 | 0:11cc2b7889af | 59 | CERTIFICATE = 2, |
maygup01 | 0:11cc2b7889af | 60 | NO_SEC = 3 |
maygup01 | 0:11cc2b7889af | 61 | } omalw_server_security_t; |
maygup01 | 0:11cc2b7889af | 62 | |
maygup01 | 0:11cc2b7889af | 63 | /** |
maygup01 | 0:11cc2b7889af | 64 | * \brief Endpoint binding and mode |
maygup01 | 0:11cc2b7889af | 65 | */ |
maygup01 | 0:11cc2b7889af | 66 | typedef enum sn_nsdl_oma_binding_and_mode_ { |
maygup01 | 0:11cc2b7889af | 67 | BINDING_MODE_NOT_SET = 0, |
maygup01 | 0:11cc2b7889af | 68 | BINDING_MODE_U = 0x01, |
maygup01 | 0:11cc2b7889af | 69 | BINDING_MODE_Q = 0x02, |
maygup01 | 0:11cc2b7889af | 70 | BINDING_MODE_S = 0x04 |
maygup01 | 0:11cc2b7889af | 71 | } sn_nsdl_oma_binding_and_mode_t; |
maygup01 | 0:11cc2b7889af | 72 | |
maygup01 | 0:11cc2b7889af | 73 | //#define RESOURCE_ATTRIBUTES_LIST |
maygup01 | 0:11cc2b7889af | 74 | #ifdef RESOURCE_ATTRIBUTES_LIST |
maygup01 | 0:11cc2b7889af | 75 | /* |
maygup01 | 0:11cc2b7889af | 76 | * \brief Resource attributes types |
maygup01 | 0:11cc2b7889af | 77 | */ |
maygup01 | 0:11cc2b7889af | 78 | typedef enum sn_nsdl_resource_attribute_ { |
maygup01 | 0:11cc2b7889af | 79 | ATTR_RESOURCE_TYPE, |
maygup01 | 0:11cc2b7889af | 80 | ATTR_INTERFACE_DESCRIPTION, |
maygup01 | 0:11cc2b7889af | 81 | ATTR_ENDPOINT_NAME, |
maygup01 | 0:11cc2b7889af | 82 | ATTR_QUEUE_MODE, |
maygup01 | 0:11cc2b7889af | 83 | ATTR_LIFETIME, |
maygup01 | 0:11cc2b7889af | 84 | ATTR_NOP, |
maygup01 | 0:11cc2b7889af | 85 | ATTR_END |
maygup01 | 0:11cc2b7889af | 86 | } sn_nsdl_resource_attribute_t; |
maygup01 | 0:11cc2b7889af | 87 | |
maygup01 | 0:11cc2b7889af | 88 | typedef struct sn_nsdl_attribute_item_ { |
maygup01 | 0:11cc2b7889af | 89 | sn_nsdl_resource_attribute_t attribute_name; |
maygup01 | 0:11cc2b7889af | 90 | char *value; |
maygup01 | 0:11cc2b7889af | 91 | } sn_nsdl_attribute_item_s; |
maygup01 | 0:11cc2b7889af | 92 | |
maygup01 | 0:11cc2b7889af | 93 | #endif |
maygup01 | 0:11cc2b7889af | 94 | |
maygup01 | 0:11cc2b7889af | 95 | /** |
maygup01 | 0:11cc2b7889af | 96 | * \brief Endpoint registration mode. |
maygup01 | 0:11cc2b7889af | 97 | * If REGISTER_WITH_RESOURCES, endpoint sends list of all resources during registration. |
maygup01 | 0:11cc2b7889af | 98 | * If REGISTER_WITH_TEMPLATE, endpoint sends registration without resource list. Device server must have |
maygup01 | 0:11cc2b7889af | 99 | * correctly configured template. |
maygup01 | 0:11cc2b7889af | 100 | */ |
maygup01 | 0:11cc2b7889af | 101 | typedef enum sn_nsdl_registration_mode_ { |
maygup01 | 0:11cc2b7889af | 102 | REGISTER_WITH_RESOURCES = 0, |
maygup01 | 0:11cc2b7889af | 103 | REGISTER_WITH_TEMPLATE |
maygup01 | 0:11cc2b7889af | 104 | } sn_nsdl_registration_mode_t; |
maygup01 | 0:11cc2b7889af | 105 | |
maygup01 | 0:11cc2b7889af | 106 | /** |
maygup01 | 0:11cc2b7889af | 107 | * \brief Endpoint registration parameters |
maygup01 | 0:11cc2b7889af | 108 | */ |
maygup01 | 0:11cc2b7889af | 109 | typedef struct sn_nsdl_ep_parameters_ { |
maygup01 | 0:11cc2b7889af | 110 | uint8_t endpoint_name_len; |
maygup01 | 0:11cc2b7889af | 111 | uint8_t domain_name_len; |
maygup01 | 0:11cc2b7889af | 112 | uint8_t type_len; |
maygup01 | 0:11cc2b7889af | 113 | uint8_t lifetime_len; |
maygup01 | 0:11cc2b7889af | 114 | uint8_t location_len; |
maygup01 | 0:11cc2b7889af | 115 | |
maygup01 | 0:11cc2b7889af | 116 | sn_nsdl_registration_mode_t ds_register_mode; /**< Defines registration mode */ |
maygup01 | 0:11cc2b7889af | 117 | sn_nsdl_oma_binding_and_mode_t binding_and_mode; /**< Defines endpoints binding and mode */ |
maygup01 | 0:11cc2b7889af | 118 | |
maygup01 | 0:11cc2b7889af | 119 | uint8_t *endpoint_name_ptr; /**< Endpoint name */ |
maygup01 | 0:11cc2b7889af | 120 | uint8_t *domain_name_ptr; /**< Domain to register. If null, NSP uses default domain */ |
maygup01 | 0:11cc2b7889af | 121 | uint8_t *type_ptr; /**< Endpoint type */ |
maygup01 | 0:11cc2b7889af | 122 | uint8_t *lifetime_ptr; /**< Endpoint lifetime in seconds. eg. "1200" = 1200 seconds */ |
maygup01 | 0:11cc2b7889af | 123 | uint8_t *location_ptr; /**< Endpoint location in server, optional parameter,default is NULL */ |
maygup01 | 0:11cc2b7889af | 124 | } sn_nsdl_ep_parameters_s; |
maygup01 | 0:11cc2b7889af | 125 | |
maygup01 | 0:11cc2b7889af | 126 | /** |
maygup01 | 0:11cc2b7889af | 127 | * \brief Resource access rights |
maygup01 | 0:11cc2b7889af | 128 | */ |
maygup01 | 0:11cc2b7889af | 129 | typedef enum sn_grs_resource_acl_ { |
maygup01 | 0:11cc2b7889af | 130 | SN_GRS_GET_ALLOWED = 0x01 , |
maygup01 | 0:11cc2b7889af | 131 | SN_GRS_PUT_ALLOWED = 0x02, |
maygup01 | 0:11cc2b7889af | 132 | SN_GRS_POST_ALLOWED = 0x04, |
maygup01 | 0:11cc2b7889af | 133 | SN_GRS_DELETE_ALLOWED = 0x08 |
maygup01 | 0:11cc2b7889af | 134 | } sn_grs_resource_acl_e; |
maygup01 | 0:11cc2b7889af | 135 | |
maygup01 | 0:11cc2b7889af | 136 | /** |
maygup01 | 0:11cc2b7889af | 137 | * \brief Defines the resource mode |
maygup01 | 0:11cc2b7889af | 138 | */ |
maygup01 | 0:11cc2b7889af | 139 | typedef enum sn_nsdl_resource_mode_ { |
maygup01 | 0:11cc2b7889af | 140 | SN_GRS_STATIC = 0, /**< Static resources have some value that doesn't change */ |
maygup01 | 0:11cc2b7889af | 141 | SN_GRS_DYNAMIC, /**< Dynamic resources are handled in application. Therefore one must give function callback pointer to them */ |
maygup01 | 0:11cc2b7889af | 142 | SN_GRS_DIRECTORY /**< Directory resources are unused and unsupported */ |
maygup01 | 0:11cc2b7889af | 143 | } sn_nsdl_resource_mode_e; |
maygup01 | 0:11cc2b7889af | 144 | |
maygup01 | 0:11cc2b7889af | 145 | /** |
maygup01 | 0:11cc2b7889af | 146 | * Enum defining an status codes that can happen when |
maygup01 | 0:11cc2b7889af | 147 | * sending notification |
maygup01 | 0:11cc2b7889af | 148 | */ |
maygup01 | 0:11cc2b7889af | 149 | typedef enum { |
maygup01 | 0:11cc2b7889af | 150 | NOTIFICATION_STATUS_INIT = 0, // Initial state. |
maygup01 | 0:11cc2b7889af | 151 | NOTIFICATION_STATUS_BUILD_ERROR, // CoAP message building fails. |
maygup01 | 0:11cc2b7889af | 152 | NOTIFICATION_STATUS_RESEND_QUEUE_FULL, // CoAP resend queue full. |
maygup01 | 0:11cc2b7889af | 153 | NOTIFICATION_STATUS_SENT, // Notification sent to the server but ACK not yet received. |
maygup01 | 0:11cc2b7889af | 154 | NOTIFICATION_STATUS_DELIVERED, // Received ACK from server. |
maygup01 | 0:11cc2b7889af | 155 | NOTIFICATION_STATUS_SEND_FAILED, // Message sending failed (retransmission completed). |
maygup01 | 0:11cc2b7889af | 156 | NOTIFICATION_STATUS_SUBSCRIBED, // Server has started the observation |
maygup01 | 0:11cc2b7889af | 157 | NOTIFICATION_STATUS_UNSUBSCRIBED // Server has stopped the observation (RESET message or GET with observe 1) |
maygup01 | 0:11cc2b7889af | 158 | } NotificationDeliveryStatus; |
maygup01 | 0:11cc2b7889af | 159 | |
maygup01 | 0:11cc2b7889af | 160 | /** |
maygup01 | 0:11cc2b7889af | 161 | * Enum defining an different download types. |
maygup01 | 0:11cc2b7889af | 162 | * This is used for 'uri-path' when sending a GET request. |
maygup01 | 0:11cc2b7889af | 163 | */ |
maygup01 | 0:11cc2b7889af | 164 | typedef enum { |
maygup01 | 0:11cc2b7889af | 165 | FIRMWARE_DOWNLOAD = 0, |
maygup01 | 0:11cc2b7889af | 166 | GENERIC_DOWNLOAD |
maygup01 | 0:11cc2b7889af | 167 | } DownloadType; |
maygup01 | 0:11cc2b7889af | 168 | |
maygup01 | 0:11cc2b7889af | 169 | /** Dummy alias to maintain compatibility with older version which had a typo in the enum name. */ |
maygup01 | 0:11cc2b7889af | 170 | typedef NotificationDeliveryStatus NoticationDeliveryStatus; |
maygup01 | 0:11cc2b7889af | 171 | |
maygup01 | 0:11cc2b7889af | 172 | |
maygup01 | 0:11cc2b7889af | 173 | /** |
maygup01 | 0:11cc2b7889af | 174 | * \brief Defines static parameters for the resource. |
maygup01 | 0:11cc2b7889af | 175 | */ |
maygup01 | 0:11cc2b7889af | 176 | typedef struct sn_nsdl_static_resource_parameters_ { |
maygup01 | 0:11cc2b7889af | 177 | #ifndef RESOURCE_ATTRIBUTES_LIST |
maygup01 | 0:11cc2b7889af | 178 | #ifndef DISABLE_RESOURCE_TYPE |
maygup01 | 0:11cc2b7889af | 179 | char *resource_type_ptr; /**< Type of the resource */ |
maygup01 | 0:11cc2b7889af | 180 | #endif |
maygup01 | 0:11cc2b7889af | 181 | #ifndef DISABLE_INTERFACE_DESCRIPTION |
maygup01 | 0:11cc2b7889af | 182 | char *interface_description_ptr; /**< Interface description */ |
maygup01 | 0:11cc2b7889af | 183 | #endif |
maygup01 | 0:11cc2b7889af | 184 | #else |
maygup01 | 0:11cc2b7889af | 185 | sn_nsdl_attribute_item_s *attributes_ptr; |
maygup01 | 0:11cc2b7889af | 186 | #endif |
maygup01 | 0:11cc2b7889af | 187 | char *path; /**< Resource path */ |
maygup01 | 0:11cc2b7889af | 188 | bool external_memory_block:1; /**< 0 means block messages are handled inside this library, |
maygup01 | 0:11cc2b7889af | 189 | otherwise block messages are passed to application */ |
maygup01 | 0:11cc2b7889af | 190 | unsigned mode:2; /**< STATIC etc.. */ |
maygup01 | 0:11cc2b7889af | 191 | bool free_on_delete:1; /**< 1 if struct is dynamic allocted --> to be freed */ |
maygup01 | 0:11cc2b7889af | 192 | } sn_nsdl_static_resource_parameters_s; |
maygup01 | 0:11cc2b7889af | 193 | |
maygup01 | 0:11cc2b7889af | 194 | /** |
maygup01 | 0:11cc2b7889af | 195 | * \brief Defines dynamic parameters for the resource. |
maygup01 | 0:11cc2b7889af | 196 | */ |
maygup01 | 0:11cc2b7889af | 197 | typedef struct sn_nsdl_resource_parameters_ { |
maygup01 | 0:11cc2b7889af | 198 | uint8_t (*sn_grs_dyn_res_callback)(struct nsdl_s *, |
maygup01 | 0:11cc2b7889af | 199 | sn_coap_hdr_s *, |
maygup01 | 0:11cc2b7889af | 200 | sn_nsdl_addr_s *, |
maygup01 | 0:11cc2b7889af | 201 | sn_nsdl_capab_e); |
maygup01 | 0:11cc2b7889af | 202 | #ifdef MEMORY_OPTIMIZED_API |
maygup01 | 0:11cc2b7889af | 203 | const sn_nsdl_static_resource_parameters_s *static_resource_parameters; |
maygup01 | 0:11cc2b7889af | 204 | #else |
maygup01 | 0:11cc2b7889af | 205 | sn_nsdl_static_resource_parameters_s *static_resource_parameters; |
maygup01 | 0:11cc2b7889af | 206 | #endif |
maygup01 | 0:11cc2b7889af | 207 | uint8_t *resource; /**< NULL if dynamic resource */ |
maygup01 | 0:11cc2b7889af | 208 | ns_list_link_t link; |
maygup01 | 0:11cc2b7889af | 209 | uint16_t resource_len; /**< 0 if dynamic resource, resource information in static resource */ |
maygup01 | 0:11cc2b7889af | 210 | uint16_t coap_content_type; /**< CoAP content type */ |
maygup01 | 0:11cc2b7889af | 211 | unsigned access:4; /**< Allowed operation mode, GET, PUT, etc, |
maygup01 | 0:11cc2b7889af | 212 | TODO! This should be in static struct but current |
maygup01 | 0:11cc2b7889af | 213 | mbed-client implementation requires this to be changed at runtime */ |
maygup01 | 0:11cc2b7889af | 214 | unsigned registered:2; /**< Is resource registered or not */ |
maygup01 | 0:11cc2b7889af | 215 | bool publish_uri:1; /**< 1 if resource to be published to server */ |
maygup01 | 0:11cc2b7889af | 216 | bool free_on_delete:1; /**< 1 if struct is dynamic allocted --> to be freed */ |
maygup01 | 0:11cc2b7889af | 217 | bool observable:1; /**< Is resource observable or not */ |
maygup01 | 0:11cc2b7889af | 218 | bool auto_observable:1; /**< Is resource auto observable or not */ |
maygup01 | 0:11cc2b7889af | 219 | bool always_publish:1; /**< 1 if resource should always be published in registration or registration update **/ |
maygup01 | 0:11cc2b7889af | 220 | unsigned publish_value:2; /**< 0 for non-publishing,1 if resource value to be published in registration message, |
maygup01 | 0:11cc2b7889af | 221 | 2 if resource value to be published in Base64 encoded format */ |
maygup01 | 0:11cc2b7889af | 222 | } sn_nsdl_dynamic_resource_parameters_s; |
maygup01 | 0:11cc2b7889af | 223 | |
maygup01 | 0:11cc2b7889af | 224 | |
maygup01 | 0:11cc2b7889af | 225 | /** |
maygup01 | 0:11cc2b7889af | 226 | * \fn struct nsdl_s *sn_nsdl_init (uint8_t (*sn_nsdl_tx_cb)(sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *), |
maygup01 | 0:11cc2b7889af | 227 | * uint8_t (*sn_nsdl_rx_cb)(sn_coap_hdr_s *, sn_nsdl_addr_s *), |
maygup01 | 0:11cc2b7889af | 228 | * sn_nsdl_mem_s *sn_memory) |
maygup01 | 0:11cc2b7889af | 229 | * |
maygup01 | 0:11cc2b7889af | 230 | * \brief Initialization function for NSDL library. Initializes NSDL, GRS, HTTP and CoAP. |
maygup01 | 0:11cc2b7889af | 231 | * |
maygup01 | 0:11cc2b7889af | 232 | * \param *sn_nsdl_tx_callback A callback function for sending messages. |
maygup01 | 0:11cc2b7889af | 233 | * |
maygup01 | 0:11cc2b7889af | 234 | * \param *sn_nsdl_rx_callback A callback function for parsed messages. If received message is not CoAP protocol message (eg. ACK), message for GRS (GET, PUT, POST, DELETE) or |
maygup01 | 0:11cc2b7889af | 235 | * reply for some DS messages (register message etc.), rx callback will be called. |
maygup01 | 0:11cc2b7889af | 236 | * |
maygup01 | 0:11cc2b7889af | 237 | * \param *sn_memory Memory structure which includes function pointers to the allocation and free functions. |
maygup01 | 0:11cc2b7889af | 238 | * |
maygup01 | 0:11cc2b7889af | 239 | * \return pointer to created handle structure. NULL if failed |
maygup01 | 0:11cc2b7889af | 240 | */ |
maygup01 | 0:11cc2b7889af | 241 | struct nsdl_s *sn_nsdl_init(uint8_t (*sn_nsdl_tx_cb)(struct nsdl_s *, sn_nsdl_capab_e , uint8_t *, uint16_t, sn_nsdl_addr_s *), |
maygup01 | 0:11cc2b7889af | 242 | uint8_t (*sn_nsdl_rx_cb)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *), |
maygup01 | 0:11cc2b7889af | 243 | void *(*sn_nsdl_alloc)(uint16_t), void (*sn_nsdl_free)(void *), |
maygup01 | 0:11cc2b7889af | 244 | uint8_t (*sn_nsdl_auto_obs_token_cb)(struct nsdl_s *, const char *, uint8_t *)); |
maygup01 | 0:11cc2b7889af | 245 | |
maygup01 | 0:11cc2b7889af | 246 | /** |
maygup01 | 0:11cc2b7889af | 247 | * \fn extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr, const char *uri_query_parameters); |
maygup01 | 0:11cc2b7889af | 248 | * |
maygup01 | 0:11cc2b7889af | 249 | * \brief Registers endpoint to mbed Device Server. |
maygup01 | 0:11cc2b7889af | 250 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 251 | * \param *endpoint_info_ptr Contains endpoint information. |
maygup01 | 0:11cc2b7889af | 252 | * \param *uri_query_parameters Uri query parameters. |
maygup01 | 0:11cc2b7889af | 253 | * |
maygup01 | 0:11cc2b7889af | 254 | * \return registration message ID, 0 if failed |
maygup01 | 0:11cc2b7889af | 255 | */ |
maygup01 | 0:11cc2b7889af | 256 | extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, |
maygup01 | 0:11cc2b7889af | 257 | sn_nsdl_ep_parameters_s *endpoint_info_ptr, |
maygup01 | 0:11cc2b7889af | 258 | const char *uri_query_parameters); |
maygup01 | 0:11cc2b7889af | 259 | |
maygup01 | 0:11cc2b7889af | 260 | /** |
maygup01 | 0:11cc2b7889af | 261 | * \fn extern int32_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 262 | * |
maygup01 | 0:11cc2b7889af | 263 | * \brief Sends unregister-message to mbed Device Server. |
maygup01 | 0:11cc2b7889af | 264 | * |
maygup01 | 0:11cc2b7889af | 265 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 266 | * |
maygup01 | 0:11cc2b7889af | 267 | * \return unregistration message ID, 0 if failed |
maygup01 | 0:11cc2b7889af | 268 | */ |
maygup01 | 0:11cc2b7889af | 269 | extern int32_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 270 | |
maygup01 | 0:11cc2b7889af | 271 | /** |
maygup01 | 0:11cc2b7889af | 272 | * \fn extern int32_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len); |
maygup01 | 0:11cc2b7889af | 273 | * |
maygup01 | 0:11cc2b7889af | 274 | * \brief Update the registration with mbed Device Server. |
maygup01 | 0:11cc2b7889af | 275 | * |
maygup01 | 0:11cc2b7889af | 276 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 277 | * \param *lt_ptr Pointer to lifetime value string in ascii form, eg. "1200" |
maygup01 | 0:11cc2b7889af | 278 | * \param lt_len Length of the lifetime string |
maygup01 | 0:11cc2b7889af | 279 | * |
maygup01 | 0:11cc2b7889af | 280 | * \return registration update message ID, <0 if failed |
maygup01 | 0:11cc2b7889af | 281 | */ |
maygup01 | 0:11cc2b7889af | 282 | extern int32_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len); |
maygup01 | 0:11cc2b7889af | 283 | |
maygup01 | 0:11cc2b7889af | 284 | /** |
maygup01 | 0:11cc2b7889af | 285 | * \fn extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len); |
maygup01 | 0:11cc2b7889af | 286 | * |
maygup01 | 0:11cc2b7889af | 287 | * \brief Sets the location receievd from Device Server. |
maygup01 | 0:11cc2b7889af | 288 | * |
maygup01 | 0:11cc2b7889af | 289 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 290 | * \param *lt_ptr Pointer to location value string , eg. "s322j4k" |
maygup01 | 0:11cc2b7889af | 291 | * \param lt_len Length of the location string |
maygup01 | 0:11cc2b7889af | 292 | * |
maygup01 | 0:11cc2b7889af | 293 | * \return success, <0 if failed |
maygup01 | 0:11cc2b7889af | 294 | */ |
maygup01 | 0:11cc2b7889af | 295 | extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len); |
maygup01 | 0:11cc2b7889af | 296 | |
maygup01 | 0:11cc2b7889af | 297 | /** |
maygup01 | 0:11cc2b7889af | 298 | * \fn extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 299 | * |
maygup01 | 0:11cc2b7889af | 300 | * \brief Checks if endpoint is registered. |
maygup01 | 0:11cc2b7889af | 301 | * |
maygup01 | 0:11cc2b7889af | 302 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 303 | * |
maygup01 | 0:11cc2b7889af | 304 | * \return 1 Endpoint registration is done successfully |
maygup01 | 0:11cc2b7889af | 305 | * \return 0 Endpoint is not registered |
maygup01 | 0:11cc2b7889af | 306 | */ |
maygup01 | 0:11cc2b7889af | 307 | extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 308 | |
maygup01 | 0:11cc2b7889af | 309 | /** |
maygup01 | 0:11cc2b7889af | 310 | * \fn extern void sn_nsdl_nsp_lost(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 311 | * |
maygup01 | 0:11cc2b7889af | 312 | * \brief A function to inform mbed Device C client library if application detects a fault in mbed Device Server registration. |
maygup01 | 0:11cc2b7889af | 313 | * |
maygup01 | 0:11cc2b7889af | 314 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 315 | * |
maygup01 | 0:11cc2b7889af | 316 | * After calling this function sn_nsdl_is_ep_registered() will return "not registered". |
maygup01 | 0:11cc2b7889af | 317 | */ |
maygup01 | 0:11cc2b7889af | 318 | extern void sn_nsdl_nsp_lost(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 319 | |
maygup01 | 0:11cc2b7889af | 320 | /** |
maygup01 | 0:11cc2b7889af | 321 | * \fn extern uint16_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len, |
maygup01 | 0:11cc2b7889af | 322 | * uint8_t *payload_ptr, uint16_t payload_len, |
maygup01 | 0:11cc2b7889af | 323 | * sn_coap_observe_e observe, |
maygup01 | 0:11cc2b7889af | 324 | * sn_coap_msg_type_e message_type, sn_coap_content_format_e content_format) |
maygup01 | 0:11cc2b7889af | 325 | * |
maygup01 | 0:11cc2b7889af | 326 | * |
maygup01 | 0:11cc2b7889af | 327 | * \brief Sends observation message to mbed Device Server |
maygup01 | 0:11cc2b7889af | 328 | * |
maygup01 | 0:11cc2b7889af | 329 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 330 | * \param *token_ptr Pointer to token to be used |
maygup01 | 0:11cc2b7889af | 331 | * \param token_len Token length |
maygup01 | 0:11cc2b7889af | 332 | * \param *payload_ptr Pointer to payload to be sent |
maygup01 | 0:11cc2b7889af | 333 | * \param payload_len Payload length |
maygup01 | 0:11cc2b7889af | 334 | * \param observe Observe option value to be sent |
maygup01 | 0:11cc2b7889af | 335 | * \param message_type Observation message type (confirmable or non-confirmable) |
maygup01 | 0:11cc2b7889af | 336 | * \param content_format Observation message payload content format |
maygup01 | 0:11cc2b7889af | 337 | * \param message_id -1 means stored value to be used otherwise new one is generated |
maygup01 | 0:11cc2b7889af | 338 | * |
maygup01 | 0:11cc2b7889af | 339 | * \return >0 Success, observation messages message ID |
maygup01 | 0:11cc2b7889af | 340 | * \return <=0 Failure |
maygup01 | 0:11cc2b7889af | 341 | */ |
maygup01 | 0:11cc2b7889af | 342 | extern int32_t sn_nsdl_send_observation_notification(struct nsdl_s *handle, uint8_t *token_ptr, uint8_t token_len, |
maygup01 | 0:11cc2b7889af | 343 | uint8_t *payload_ptr, uint16_t payload_len, |
maygup01 | 0:11cc2b7889af | 344 | sn_coap_observe_e observe, |
maygup01 | 0:11cc2b7889af | 345 | sn_coap_msg_type_e message_type, |
maygup01 | 0:11cc2b7889af | 346 | sn_coap_content_format_e content_format, |
maygup01 | 0:11cc2b7889af | 347 | const int32_t message_id); |
maygup01 | 0:11cc2b7889af | 348 | |
maygup01 | 0:11cc2b7889af | 349 | /** |
maygup01 | 0:11cc2b7889af | 350 | * \fn extern uint32_t sn_nsdl_get_version(void) |
maygup01 | 0:11cc2b7889af | 351 | * |
maygup01 | 0:11cc2b7889af | 352 | * \brief Version query function. |
maygup01 | 0:11cc2b7889af | 353 | * |
maygup01 | 0:11cc2b7889af | 354 | * Used to retrieve the version information from the mbed Device C Client library. |
maygup01 | 0:11cc2b7889af | 355 | * |
maygup01 | 0:11cc2b7889af | 356 | * \return Pointer to library version string |
maygup01 | 0:11cc2b7889af | 357 | */ |
maygup01 | 0:11cc2b7889af | 358 | extern char *sn_nsdl_get_version(void); |
maygup01 | 0:11cc2b7889af | 359 | |
maygup01 | 0:11cc2b7889af | 360 | /** |
maygup01 | 0:11cc2b7889af | 361 | * \fn extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src) |
maygup01 | 0:11cc2b7889af | 362 | * |
maygup01 | 0:11cc2b7889af | 363 | * \brief To push CoAP packet to mbed Device C Client library |
maygup01 | 0:11cc2b7889af | 364 | * |
maygup01 | 0:11cc2b7889af | 365 | * Used to push an CoAP packet to mbed Device C Client library for processing. |
maygup01 | 0:11cc2b7889af | 366 | * |
maygup01 | 0:11cc2b7889af | 367 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 368 | * |
maygup01 | 0:11cc2b7889af | 369 | * \param *packet Pointer to a uint8_t array containing the packet (including the CoAP headers). |
maygup01 | 0:11cc2b7889af | 370 | * After successful execution this array may contain the response packet. |
maygup01 | 0:11cc2b7889af | 371 | * |
maygup01 | 0:11cc2b7889af | 372 | * \param *packet_len Pointer to length of the packet. After successful execution this array may contain the length |
maygup01 | 0:11cc2b7889af | 373 | * of the response packet. |
maygup01 | 0:11cc2b7889af | 374 | * |
maygup01 | 0:11cc2b7889af | 375 | * \param *src Pointer to packet source address information. After successful execution this array may contain |
maygup01 | 0:11cc2b7889af | 376 | * the destination address of the response packet. |
maygup01 | 0:11cc2b7889af | 377 | * |
maygup01 | 0:11cc2b7889af | 378 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 379 | * \return -1 Failure |
maygup01 | 0:11cc2b7889af | 380 | */ |
maygup01 | 0:11cc2b7889af | 381 | extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src); |
maygup01 | 0:11cc2b7889af | 382 | |
maygup01 | 0:11cc2b7889af | 383 | /** |
maygup01 | 0:11cc2b7889af | 384 | * \fn extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time); |
maygup01 | 0:11cc2b7889af | 385 | * |
maygup01 | 0:11cc2b7889af | 386 | * \brief CoAP retransmission function. |
maygup01 | 0:11cc2b7889af | 387 | * |
maygup01 | 0:11cc2b7889af | 388 | * Used to give execution time for the mbed Device C Client library for retransmissions. |
maygup01 | 0:11cc2b7889af | 389 | * |
maygup01 | 0:11cc2b7889af | 390 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 391 | * |
maygup01 | 0:11cc2b7889af | 392 | * \param time Time in seconds. |
maygup01 | 0:11cc2b7889af | 393 | * |
maygup01 | 0:11cc2b7889af | 394 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 395 | * \return -1 Failure |
maygup01 | 0:11cc2b7889af | 396 | */ |
maygup01 | 0:11cc2b7889af | 397 | extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time); |
maygup01 | 0:11cc2b7889af | 398 | |
maygup01 | 0:11cc2b7889af | 399 | /** |
maygup01 | 0:11cc2b7889af | 400 | * \fn extern int8_t sn_nsdl_put_resource(struct nsdl_s *handle, const sn_nsdl_dynamic_resource_parameters_s *res); |
maygup01 | 0:11cc2b7889af | 401 | * |
maygup01 | 0:11cc2b7889af | 402 | * \brief Resource putting function. |
maygup01 | 0:11cc2b7889af | 403 | * |
maygup01 | 0:11cc2b7889af | 404 | * Used to put a static or dynamic CoAP resource without creating copy of it. |
maygup01 | 0:11cc2b7889af | 405 | * NOTE: Remember that only resource will be owned, not data that it contains |
maygup01 | 0:11cc2b7889af | 406 | * NOTE: The resource may be removed from list by sn_nsdl_pop_resource(). |
maygup01 | 0:11cc2b7889af | 407 | * |
maygup01 | 0:11cc2b7889af | 408 | * \param *res Pointer to a structure of type sn_nsdl_dynamic_resource_parameters_s that contains the information |
maygup01 | 0:11cc2b7889af | 409 | * about the resource. |
maygup01 | 0:11cc2b7889af | 410 | * |
maygup01 | 0:11cc2b7889af | 411 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 412 | * \return -1 Failure |
maygup01 | 0:11cc2b7889af | 413 | * \return -2 Resource already exists |
maygup01 | 0:11cc2b7889af | 414 | * \return -3 Invalid path |
maygup01 | 0:11cc2b7889af | 415 | * \return -4 List adding failure |
maygup01 | 0:11cc2b7889af | 416 | */ |
maygup01 | 0:11cc2b7889af | 417 | extern int8_t sn_nsdl_put_resource(struct nsdl_s *handle, sn_nsdl_dynamic_resource_parameters_s *res); |
maygup01 | 0:11cc2b7889af | 418 | |
maygup01 | 0:11cc2b7889af | 419 | /** |
maygup01 | 0:11cc2b7889af | 420 | * \fn extern int8_t sn_nsdl_pop_resource(struct nsdl_s *handle, const sn_nsdl_dynamic_resource_parameters_s *res); |
maygup01 | 0:11cc2b7889af | 421 | * |
maygup01 | 0:11cc2b7889af | 422 | * \brief Resource popping function. |
maygup01 | 0:11cc2b7889af | 423 | * |
maygup01 | 0:11cc2b7889af | 424 | * Used to remove a static or dynamic CoAP resource from lists without deleting it. |
maygup01 | 0:11cc2b7889af | 425 | * NOTE: This function is a counterpart of sn_nsdl_put_resource(). |
maygup01 | 0:11cc2b7889af | 426 | * |
maygup01 | 0:11cc2b7889af | 427 | * \param *res Pointer to a structure of type sn_nsdl_dynamic_resource_parameters_s that contains the information |
maygup01 | 0:11cc2b7889af | 428 | * about the resource. |
maygup01 | 0:11cc2b7889af | 429 | * |
maygup01 | 0:11cc2b7889af | 430 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 431 | * \return -1 Failure |
maygup01 | 0:11cc2b7889af | 432 | * \return -3 Invalid path |
maygup01 | 0:11cc2b7889af | 433 | */ |
maygup01 | 0:11cc2b7889af | 434 | extern int8_t sn_nsdl_pop_resource(struct nsdl_s *handle, sn_nsdl_dynamic_resource_parameters_s *res); |
maygup01 | 0:11cc2b7889af | 435 | |
maygup01 | 0:11cc2b7889af | 436 | /** |
maygup01 | 0:11cc2b7889af | 437 | * \fn extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, char *path) |
maygup01 | 0:11cc2b7889af | 438 | * |
maygup01 | 0:11cc2b7889af | 439 | * \brief Resource delete function. |
maygup01 | 0:11cc2b7889af | 440 | * |
maygup01 | 0:11cc2b7889af | 441 | * Used to delete a resource. If resource has a subresources, these all must also be removed. |
maygup01 | 0:11cc2b7889af | 442 | * |
maygup01 | 0:11cc2b7889af | 443 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 444 | * \param *path_ptr A pointer to an array containing the path. |
maygup01 | 0:11cc2b7889af | 445 | * |
maygup01 | 0:11cc2b7889af | 446 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 447 | * \return -1 Failure (No such resource) |
maygup01 | 0:11cc2b7889af | 448 | */ |
maygup01 | 0:11cc2b7889af | 449 | extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, const char *path); |
maygup01 | 0:11cc2b7889af | 450 | |
maygup01 | 0:11cc2b7889af | 451 | /** |
maygup01 | 0:11cc2b7889af | 452 | * \fn extern sn_nsdl_dynamic_resource_parameters_s *sn_nsdl_get_resource(struct nsdl_s *handle, char *path) |
maygup01 | 0:11cc2b7889af | 453 | * |
maygup01 | 0:11cc2b7889af | 454 | * \brief Resource get function. |
maygup01 | 0:11cc2b7889af | 455 | * |
maygup01 | 0:11cc2b7889af | 456 | * Used to get a resource. |
maygup01 | 0:11cc2b7889af | 457 | * |
maygup01 | 0:11cc2b7889af | 458 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 459 | * \param *path A pointer to an array containing the path. |
maygup01 | 0:11cc2b7889af | 460 | * |
maygup01 | 0:11cc2b7889af | 461 | * \return !NULL Success, pointer to a sn_nsdl_dynamic_resource_parameters_s that contains the resource information\n |
maygup01 | 0:11cc2b7889af | 462 | * \return NULL Failure |
maygup01 | 0:11cc2b7889af | 463 | */ |
maygup01 | 0:11cc2b7889af | 464 | extern sn_nsdl_dynamic_resource_parameters_s *sn_nsdl_get_resource(struct nsdl_s *handle, const char *path); |
maygup01 | 0:11cc2b7889af | 465 | |
maygup01 | 0:11cc2b7889af | 466 | /** |
maygup01 | 0:11cc2b7889af | 467 | * \fn extern int8_t sn_nsdl_send_coap_message(struct nsdl_s *handle, sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr); |
maygup01 | 0:11cc2b7889af | 468 | * |
maygup01 | 0:11cc2b7889af | 469 | * \brief Send an outgoing CoAP request. |
maygup01 | 0:11cc2b7889af | 470 | * |
maygup01 | 0:11cc2b7889af | 471 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 472 | * \param *address_ptr Pointer to source address struct |
maygup01 | 0:11cc2b7889af | 473 | * \param *coap_hdr_ptr Pointer to CoAP message to be sent |
maygup01 | 0:11cc2b7889af | 474 | * |
maygup01 | 0:11cc2b7889af | 475 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 476 | * \return -1 Failure |
maygup01 | 0:11cc2b7889af | 477 | */ |
maygup01 | 0:11cc2b7889af | 478 | extern int8_t sn_nsdl_send_coap_message(struct nsdl_s *handle, sn_nsdl_addr_s *address_ptr, sn_coap_hdr_s *coap_hdr_ptr); |
maygup01 | 0:11cc2b7889af | 479 | |
maygup01 | 0:11cc2b7889af | 480 | /** |
maygup01 | 0:11cc2b7889af | 481 | * \fn extern int32_t sn_nsdl_send_request(struct nsdl_s *handle, sn_coap_msg_code_e msg_code, const char *uri_path, const uint32_t token, const size_t offset, const uint16_t payload_len, const uint8_t* payload_ptr); |
maygup01 | 0:11cc2b7889af | 482 | * |
maygup01 | 0:11cc2b7889af | 483 | * \brief Send an outgoing CoAP request. |
maygup01 | 0:11cc2b7889af | 484 | * |
maygup01 | 0:11cc2b7889af | 485 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 486 | * \param msg-code CoAP message code to use for request |
maygup01 | 0:11cc2b7889af | 487 | * \param *uri_path Path to the data |
maygup01 | 0:11cc2b7889af | 488 | * \param *token Message token |
maygup01 | 0:11cc2b7889af | 489 | * \param offset Offset within response body to request |
maygup01 | 0:11cc2b7889af | 490 | * \param payload_len Message payload length, can be 0 for no payload |
maygup01 | 0:11cc2b7889af | 491 | * \param *payload_ptr Message payload pointer, can be NULL for no payload |
maygup01 | 0:11cc2b7889af | 492 | * \param type Type of the download |
maygup01 | 0:11cc2b7889af | 493 | * |
maygup01 | 0:11cc2b7889af | 494 | * \Return > 0 Success else Failure |
maygup01 | 0:11cc2b7889af | 495 | */ |
maygup01 | 0:11cc2b7889af | 496 | extern int32_t sn_nsdl_send_request(struct nsdl_s *handle, |
maygup01 | 0:11cc2b7889af | 497 | sn_coap_msg_code_e msg_code, |
maygup01 | 0:11cc2b7889af | 498 | const char *uri_path, |
maygup01 | 0:11cc2b7889af | 499 | const uint32_t token, |
maygup01 | 0:11cc2b7889af | 500 | const size_t offset, |
maygup01 | 0:11cc2b7889af | 501 | const uint16_t payload_len, |
maygup01 | 0:11cc2b7889af | 502 | uint8_t* payload_ptr, |
maygup01 | 0:11cc2b7889af | 503 | DownloadType type); |
maygup01 | 0:11cc2b7889af | 504 | |
maygup01 | 0:11cc2b7889af | 505 | /** |
maygup01 | 0:11cc2b7889af | 506 | * \fn extern 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); |
maygup01 | 0:11cc2b7889af | 507 | * |
maygup01 | 0:11cc2b7889af | 508 | * \brief This function is used to set the mbed Device Server address given by an application. |
maygup01 | 0:11cc2b7889af | 509 | * |
maygup01 | 0:11cc2b7889af | 510 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 511 | * \return 0 Success |
maygup01 | 0:11cc2b7889af | 512 | * \return -1 Failed to indicate that internal address pointer is not allocated (call nsdl_init() first). |
maygup01 | 0:11cc2b7889af | 513 | */ |
maygup01 | 0:11cc2b7889af | 514 | extern 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); |
maygup01 | 0:11cc2b7889af | 515 | |
maygup01 | 0:11cc2b7889af | 516 | /** |
maygup01 | 0:11cc2b7889af | 517 | * \fn extern int8_t sn_nsdl_destroy(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 518 | * |
maygup01 | 0:11cc2b7889af | 519 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 520 | * \brief This function releases all allocated memory in mbed Device C Client library. |
maygup01 | 0:11cc2b7889af | 521 | */ |
maygup01 | 0:11cc2b7889af | 522 | extern int8_t sn_nsdl_destroy(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 523 | |
maygup01 | 0:11cc2b7889af | 524 | /** |
maygup01 | 0:11cc2b7889af | 525 | * \fn extern 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); |
maygup01 | 0:11cc2b7889af | 526 | * |
maygup01 | 0:11cc2b7889af | 527 | * \brief Starts OMA bootstrap process |
maygup01 | 0:11cc2b7889af | 528 | * |
maygup01 | 0:11cc2b7889af | 529 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 530 | * |
maygup01 | 0:11cc2b7889af | 531 | * \return bootstrap message ID, 0 if failed |
maygup01 | 0:11cc2b7889af | 532 | */ |
maygup01 | 0:11cc2b7889af | 533 | extern uint16_t sn_nsdl_oma_bootstrap(struct nsdl_s *handle, |
maygup01 | 0:11cc2b7889af | 534 | sn_nsdl_addr_s *bootstrap_address_ptr, |
maygup01 | 0:11cc2b7889af | 535 | sn_nsdl_ep_parameters_s *endpoint_info_ptr, |
maygup01 | 0:11cc2b7889af | 536 | const char *uri_query_parameters); |
maygup01 | 0:11cc2b7889af | 537 | |
maygup01 | 0:11cc2b7889af | 538 | /** |
maygup01 | 0:11cc2b7889af | 539 | * \fn sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code) |
maygup01 | 0:11cc2b7889af | 540 | * |
maygup01 | 0:11cc2b7889af | 541 | * \brief Prepares generic response packet from a request packet. This function allocates memory for the resulting sn_coap_hdr_s |
maygup01 | 0:11cc2b7889af | 542 | * |
maygup01 | 0:11cc2b7889af | 543 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 544 | * \param *coap_packet_ptr The request packet pointer |
maygup01 | 0:11cc2b7889af | 545 | * \param msg_code response messages code |
maygup01 | 0:11cc2b7889af | 546 | * |
maygup01 | 0:11cc2b7889af | 547 | * \return *coap_packet_ptr The allocated and pre-filled response packet pointer |
maygup01 | 0:11cc2b7889af | 548 | * NULL Error in parsing the request |
maygup01 | 0:11cc2b7889af | 549 | * |
maygup01 | 0:11cc2b7889af | 550 | */ |
maygup01 | 0:11cc2b7889af | 551 | extern sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code); |
maygup01 | 0:11cc2b7889af | 552 | |
maygup01 | 0:11cc2b7889af | 553 | /** |
maygup01 | 0:11cc2b7889af | 554 | * \brief Allocates and initializes options list structure |
maygup01 | 0:11cc2b7889af | 555 | * |
maygup01 | 0:11cc2b7889af | 556 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 557 | * \param *coap_msg_ptr is pointer to CoAP message that will contain the options |
maygup01 | 0:11cc2b7889af | 558 | * |
maygup01 | 0:11cc2b7889af | 559 | * If the message already has a pointer to an option structure, that pointer |
maygup01 | 0:11cc2b7889af | 560 | * is returned, rather than a new structure being allocated. |
maygup01 | 0:11cc2b7889af | 561 | * |
maygup01 | 0:11cc2b7889af | 562 | * \return Return value is pointer to the CoAP options structure.\n |
maygup01 | 0:11cc2b7889af | 563 | * In following failure cases NULL is returned:\n |
maygup01 | 0:11cc2b7889af | 564 | * -Failure in given pointer (= NULL)\n |
maygup01 | 0:11cc2b7889af | 565 | * -Failure in memory allocation (malloc() returns NULL) |
maygup01 | 0:11cc2b7889af | 566 | */ |
maygup01 | 0:11cc2b7889af | 567 | extern sn_coap_options_list_s *sn_nsdl_alloc_options_list(struct nsdl_s *handle, sn_coap_hdr_s *coap_msg_ptr); |
maygup01 | 0:11cc2b7889af | 568 | |
maygup01 | 0:11cc2b7889af | 569 | /** |
maygup01 | 0:11cc2b7889af | 570 | * \fn void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr) |
maygup01 | 0:11cc2b7889af | 571 | * |
maygup01 | 0:11cc2b7889af | 572 | * \brief Releases memory of given CoAP message |
maygup01 | 0:11cc2b7889af | 573 | * |
maygup01 | 0:11cc2b7889af | 574 | * Note!!! Does not release Payload part |
maygup01 | 0:11cc2b7889af | 575 | * |
maygup01 | 0:11cc2b7889af | 576 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 577 | * |
maygup01 | 0:11cc2b7889af | 578 | * \param *freed_coap_msg_ptr is pointer to released CoAP message |
maygup01 | 0:11cc2b7889af | 579 | */ |
maygup01 | 0:11cc2b7889af | 580 | extern void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr); |
maygup01 | 0:11cc2b7889af | 581 | |
maygup01 | 0:11cc2b7889af | 582 | /** |
maygup01 | 0:11cc2b7889af | 583 | * \fn int8_t sn_nsdl_set_retransmission_parameters(struct nsdl_s *handle, uint8_t resending_count, uint8_t resending_intervall) |
maygup01 | 0:11cc2b7889af | 584 | * |
maygup01 | 0:11cc2b7889af | 585 | * \brief If re-transmissions are enabled, this function changes resending count and interval. |
maygup01 | 0:11cc2b7889af | 586 | * |
maygup01 | 0:11cc2b7889af | 587 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 588 | * \param uint8_t resending_count max number of resendings for message |
maygup01 | 0:11cc2b7889af | 589 | * \param uint8_t resending_intervall message resending intervall in seconds |
maygup01 | 0:11cc2b7889af | 590 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 591 | */ |
maygup01 | 0:11cc2b7889af | 592 | extern int8_t sn_nsdl_set_retransmission_parameters(struct nsdl_s *handle, uint8_t resending_count, uint8_t resending_interval); |
maygup01 | 0:11cc2b7889af | 593 | |
maygup01 | 0:11cc2b7889af | 594 | /** |
maygup01 | 0:11cc2b7889af | 595 | * \fn int8_t sn_nsdl_set_retransmission_buffer(struct nsdl_s *handle, uint8_t buffer_size_messages, uint16_t buffer_size_bytes) |
maygup01 | 0:11cc2b7889af | 596 | * |
maygup01 | 0:11cc2b7889af | 597 | * \brief If re-transmissions are enabled, this function changes message retransmission queue size. |
maygup01 | 0:11cc2b7889af | 598 | * Set size to '0' to disable feature. If both are set to '0', then re-sendings are disabled. |
maygup01 | 0:11cc2b7889af | 599 | * |
maygup01 | 0:11cc2b7889af | 600 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 601 | * \param uint8_t buffer_size_messages queue size - maximum number of messages to be saved to queue |
maygup01 | 0:11cc2b7889af | 602 | * \param uint8_t buffer_size_bytes queue size - maximum size of messages saved to queue |
maygup01 | 0:11cc2b7889af | 603 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 604 | */ |
maygup01 | 0:11cc2b7889af | 605 | extern int8_t sn_nsdl_set_retransmission_buffer(struct nsdl_s *handle, |
maygup01 | 0:11cc2b7889af | 606 | uint8_t buffer_size_messages, uint16_t buffer_size_bytes); |
maygup01 | 0:11cc2b7889af | 607 | |
maygup01 | 0:11cc2b7889af | 608 | /** |
maygup01 | 0:11cc2b7889af | 609 | * \fn int8_t sn_nsdl_set_block_size(struct nsdl_s *handle, uint16_t block_size) |
maygup01 | 0:11cc2b7889af | 610 | * |
maygup01 | 0:11cc2b7889af | 611 | * \brief If block transfer is enabled, this function changes the block size. |
maygup01 | 0:11cc2b7889af | 612 | * |
maygup01 | 0:11cc2b7889af | 613 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 614 | * \param uint16_t block_size maximum size of CoAP payload. Valid sizes are 16, 32, 64, 128, 256, 512 and 1024 bytes |
maygup01 | 0:11cc2b7889af | 615 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 616 | */ |
maygup01 | 0:11cc2b7889af | 617 | extern int8_t sn_nsdl_set_block_size(struct nsdl_s *handle, uint16_t block_size); |
maygup01 | 0:11cc2b7889af | 618 | |
maygup01 | 0:11cc2b7889af | 619 | /** |
maygup01 | 0:11cc2b7889af | 620 | * \fn int8_t sn_nsdl_set_duplicate_buffer_size(struct nsdl_s *handle,uint8_t message_count) |
maygup01 | 0:11cc2b7889af | 621 | * |
maygup01 | 0:11cc2b7889af | 622 | * \brief If dublicate message detection is enabled, this function changes buffer size. |
maygup01 | 0:11cc2b7889af | 623 | * |
maygup01 | 0:11cc2b7889af | 624 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 625 | * \param uint8_t message_count max number of messages saved for duplicate control |
maygup01 | 0:11cc2b7889af | 626 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 627 | */ |
maygup01 | 0:11cc2b7889af | 628 | extern int8_t sn_nsdl_set_duplicate_buffer_size(struct nsdl_s *handle, uint8_t message_count); |
maygup01 | 0:11cc2b7889af | 629 | |
maygup01 | 0:11cc2b7889af | 630 | /** |
maygup01 | 0:11cc2b7889af | 631 | * \fn void *sn_nsdl_set_context(const struct nsdl_s *handle, void *context) |
maygup01 | 0:11cc2b7889af | 632 | * |
maygup01 | 0:11cc2b7889af | 633 | * \brief Set the application defined context parameter for given handle. |
maygup01 | 0:11cc2b7889af | 634 | * This is useful for example when interfacing with c++ objects where a |
maygup01 | 0:11cc2b7889af | 635 | * pointer to object is set as the context, and in the callback functions |
maygup01 | 0:11cc2b7889af | 636 | * the context pointer can be used to call methods for the correct instance |
maygup01 | 0:11cc2b7889af | 637 | * of the c++ object. |
maygup01 | 0:11cc2b7889af | 638 | * |
maygup01 | 0:11cc2b7889af | 639 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 640 | * \param *context Pointer to the application defined context |
maygup01 | 0:11cc2b7889af | 641 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 642 | */ |
maygup01 | 0:11cc2b7889af | 643 | extern int8_t sn_nsdl_set_context(struct nsdl_s * const handle, void * const context); |
maygup01 | 0:11cc2b7889af | 644 | |
maygup01 | 0:11cc2b7889af | 645 | /** |
maygup01 | 0:11cc2b7889af | 646 | * \fn void *sn_nsdl_get_context(const struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 647 | * |
maygup01 | 0:11cc2b7889af | 648 | * \brief Get the application defined context parameter for given handle. |
maygup01 | 0:11cc2b7889af | 649 | * This is useful for example when interfacing with c++ objects where a |
maygup01 | 0:11cc2b7889af | 650 | * pointer to object is set as the context, and in the callback functions |
maygup01 | 0:11cc2b7889af | 651 | * the context pointer can be used to call methods for the correct instance |
maygup01 | 0:11cc2b7889af | 652 | * of the c++ object. |
maygup01 | 0:11cc2b7889af | 653 | * |
maygup01 | 0:11cc2b7889af | 654 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 655 | * \return Pointer to the application defined context |
maygup01 | 0:11cc2b7889af | 656 | */ |
maygup01 | 0:11cc2b7889af | 657 | extern void *sn_nsdl_get_context(const struct nsdl_s * const handle); |
maygup01 | 0:11cc2b7889af | 658 | |
maygup01 | 0:11cc2b7889af | 659 | /** |
maygup01 | 0:11cc2b7889af | 660 | * \fn int8_t sn_nsdl_clear_coap_resending_queue(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 661 | * |
maygup01 | 0:11cc2b7889af | 662 | * \brief Clean confirmable message list. |
maygup01 | 0:11cc2b7889af | 663 | * |
maygup01 | 0:11cc2b7889af | 664 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 665 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 666 | */ |
maygup01 | 0:11cc2b7889af | 667 | extern int8_t sn_nsdl_clear_coap_resending_queue(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 668 | |
maygup01 | 0:11cc2b7889af | 669 | /** |
maygup01 | 0:11cc2b7889af | 670 | * \fn int8_t sn_nsdl_clear_coap_sent_blockwise_messages(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 671 | * |
maygup01 | 0:11cc2b7889af | 672 | * \brief Clears the sent blockwise messages from the linked list. |
maygup01 | 0:11cc2b7889af | 673 | * |
maygup01 | 0:11cc2b7889af | 674 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 675 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 676 | */ |
maygup01 | 0:11cc2b7889af | 677 | extern int8_t sn_nsdl_clear_coap_sent_blockwise_messages(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 678 | |
maygup01 | 0:11cc2b7889af | 679 | /** |
maygup01 | 0:11cc2b7889af | 680 | * \fn int8_t sn_nsdl_clear_coap_received_blockwise_messages(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 681 | * |
maygup01 | 0:11cc2b7889af | 682 | * \brief Clears the received blockwise messages from the linked list. |
maygup01 | 0:11cc2b7889af | 683 | * |
maygup01 | 0:11cc2b7889af | 684 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 685 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 686 | */ |
maygup01 | 0:11cc2b7889af | 687 | extern int8_t sn_nsdl_clear_coap_received_blockwise_messages(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 688 | |
maygup01 | 0:11cc2b7889af | 689 | /** |
maygup01 | 0:11cc2b7889af | 690 | * \fn int8_t sn_nsdl_remove_msg_from_retransmission(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 691 | * |
maygup01 | 0:11cc2b7889af | 692 | * \brief Clears item from the resend queue. |
maygup01 | 0:11cc2b7889af | 693 | * |
maygup01 | 0:11cc2b7889af | 694 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 695 | * \param *token Token to be removed |
maygup01 | 0:11cc2b7889af | 696 | * \param token_len Length of the token |
maygup01 | 0:11cc2b7889af | 697 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 698 | */ |
maygup01 | 0:11cc2b7889af | 699 | extern int8_t sn_nsdl_remove_msg_from_retransmission(struct nsdl_s *handle, uint8_t *token, uint8_t token_len); |
maygup01 | 0:11cc2b7889af | 700 | |
maygup01 | 0:11cc2b7889af | 701 | /** |
maygup01 | 0:11cc2b7889af | 702 | * \fn int8_t sn_nsdl_handle_block2_response_internally(struct nsdl_s *handle, uint8_t handle_response) |
maygup01 | 0:11cc2b7889af | 703 | * |
maygup01 | 0:11cc2b7889af | 704 | * \brief This function change the state whether CoAP library sends the block 2 response automatically or not. |
maygup01 | 0:11cc2b7889af | 705 | * |
maygup01 | 0:11cc2b7889af | 706 | * \param *handle Pointer to NSDL library handle |
maygup01 | 0:11cc2b7889af | 707 | * \param handle_response 1 if CoAP library handles the response sending otherwise 0. |
maygup01 | 0:11cc2b7889af | 708 | * |
maygup01 | 0:11cc2b7889af | 709 | * \return 0 = success, -1 = failure |
maygup01 | 0:11cc2b7889af | 710 | */ |
maygup01 | 0:11cc2b7889af | 711 | extern int8_t sn_nsdl_handle_block2_response_internally(struct nsdl_s *handle, uint8_t handle_response); |
maygup01 | 0:11cc2b7889af | 712 | |
maygup01 | 0:11cc2b7889af | 713 | #ifdef RESOURCE_ATTRIBUTES_LIST |
maygup01 | 0:11cc2b7889af | 714 | /** |
maygup01 | 0:11cc2b7889af | 715 | * \fn int8_t sn_nsdl_free_resource_attributes_list(struct nsdl_s *handle, sn_nsdl_static_resource_parameters_s *params) |
maygup01 | 0:11cc2b7889af | 716 | * |
maygup01 | 0:11cc2b7889af | 717 | * \brief Free resource attributes list if free_on_delete is true for params. This will also free all attributes values |
maygup01 | 0:11cc2b7889af | 718 | * if they are pointer types. |
maygup01 | 0:11cc2b7889af | 719 | * |
maygup01 | 0:11cc2b7889af | 720 | * \param *params Pointer to resource static parameters |
maygup01 | 0:11cc2b7889af | 721 | */ |
maygup01 | 0:11cc2b7889af | 722 | extern void sn_nsdl_free_resource_attributes_list(sn_nsdl_static_resource_parameters_s *params); |
maygup01 | 0:11cc2b7889af | 723 | |
maygup01 | 0:11cc2b7889af | 724 | /* |
maygup01 | 0:11cc2b7889af | 725 | * \fn bool sn_nsdl_set_resource_attribute(sn_nsdl_static_resource_parameters_s *params, sn_nsdl_attribute_item_s attribute) |
maygup01 | 0:11cc2b7889af | 726 | * |
maygup01 | 0:11cc2b7889af | 727 | * \brief Set resource link-format attribute value, create if it doesn't exist yet. |
maygup01 | 0:11cc2b7889af | 728 | * |
maygup01 | 0:11cc2b7889af | 729 | * \param *params Pointer to resource static parameters |
maygup01 | 0:11cc2b7889af | 730 | * \param attribute sn_nsdl_attribute_item_s structure containing attribute to set |
maygup01 | 0:11cc2b7889af | 731 | * \return True if successful, false on error |
maygup01 | 0:11cc2b7889af | 732 | */ |
maygup01 | 0:11cc2b7889af | 733 | extern bool sn_nsdl_set_resource_attribute(sn_nsdl_static_resource_parameters_s *params, const sn_nsdl_attribute_item_s *attribute); |
maygup01 | 0:11cc2b7889af | 734 | |
maygup01 | 0:11cc2b7889af | 735 | /* |
maygup01 | 0:11cc2b7889af | 736 | * \fn bool sn_nsdl_get_resource_attribute(sn_nsdl_static_resource_parameters_s *params, sn_nsdl_resource_attribute_t attribute) |
maygup01 | 0:11cc2b7889af | 737 | * |
maygup01 | 0:11cc2b7889af | 738 | * \brief Get resource link-format attribute value |
maygup01 | 0:11cc2b7889af | 739 | * |
maygup01 | 0:11cc2b7889af | 740 | * \param *params Pointer to resource static parameters |
maygup01 | 0:11cc2b7889af | 741 | * \param attribute sn_nsdl_resource_attribute_t enum value for attribute to get |
maygup01 | 0:11cc2b7889af | 742 | * \return Pointer to value or null if attribute did not exist or had no value |
maygup01 | 0:11cc2b7889af | 743 | */ |
maygup01 | 0:11cc2b7889af | 744 | extern const char* sn_nsdl_get_resource_attribute(const sn_nsdl_static_resource_parameters_s *params, sn_nsdl_resource_attribute_t attribute); |
maygup01 | 0:11cc2b7889af | 745 | |
maygup01 | 0:11cc2b7889af | 746 | /* |
maygup01 | 0:11cc2b7889af | 747 | * \fn bool sn_nsdl_remove_resource_attribute(sn_nsdl_static_resource_parameters_s *params, sn_nsdl_resource_attribute_t attribute) |
maygup01 | 0:11cc2b7889af | 748 | * |
maygup01 | 0:11cc2b7889af | 749 | * \brief Remove resource link-format attribute value |
maygup01 | 0:11cc2b7889af | 750 | * |
maygup01 | 0:11cc2b7889af | 751 | * \param *params Pointer to resource static parameters |
maygup01 | 0:11cc2b7889af | 752 | * \param attribute sn_nsdl_resource_attribute_t enum value for attribute to remove |
maygup01 | 0:11cc2b7889af | 753 | */ |
maygup01 | 0:11cc2b7889af | 754 | extern bool sn_nsdl_remove_resource_attribute(sn_nsdl_static_resource_parameters_s *params, sn_nsdl_resource_attribute_t attribute); |
maygup01 | 0:11cc2b7889af | 755 | #endif |
maygup01 | 0:11cc2b7889af | 756 | |
maygup01 | 0:11cc2b7889af | 757 | /** |
maygup01 | 0:11cc2b7889af | 758 | * \fn bool sn_nsdl_print_coap_data(sn_coap_hdr_s *coap_header_ptr, bool outgoing) |
maygup01 | 0:11cc2b7889af | 759 | * |
maygup01 | 0:11cc2b7889af | 760 | * \brief Utility function to print all the CoAP header parameters |
maygup01 | 0:11cc2b7889af | 761 | * |
maygup01 | 0:11cc2b7889af | 762 | * \param *coap_header_ptr CoAP header |
maygup01 | 0:11cc2b7889af | 763 | * \param outgoing If True, package is going to be sent to server otherwise receiving |
maygup01 | 0:11cc2b7889af | 764 | */ |
maygup01 | 0:11cc2b7889af | 765 | extern void sn_nsdl_print_coap_data(sn_coap_hdr_s *coap_header_ptr, bool outgoing); |
maygup01 | 0:11cc2b7889af | 766 | |
maygup01 | 0:11cc2b7889af | 767 | /** |
maygup01 | 0:11cc2b7889af | 768 | * \fn uint16_t sn_nsdl_get_block_size(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 769 | * |
maygup01 | 0:11cc2b7889af | 770 | * \brief Get CoAP block size |
maygup01 | 0:11cc2b7889af | 771 | * |
maygup01 | 0:11cc2b7889af | 772 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 773 | * \return block size |
maygup01 | 0:11cc2b7889af | 774 | */ |
maygup01 | 0:11cc2b7889af | 775 | extern uint16_t sn_nsdl_get_block_size(const struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 776 | |
maygup01 | 0:11cc2b7889af | 777 | /** |
maygup01 | 0:11cc2b7889af | 778 | * \fn uint8_t sn_nsdl_get_retransmission_count(struct nsdl_s *handle) |
maygup01 | 0:11cc2b7889af | 779 | * |
maygup01 | 0:11cc2b7889af | 780 | * \brief Returns retransmission coint |
maygup01 | 0:11cc2b7889af | 781 | * |
maygup01 | 0:11cc2b7889af | 782 | * \param *handle Pointer to library handle |
maygup01 | 0:11cc2b7889af | 783 | * \return Retransmission count |
maygup01 | 0:11cc2b7889af | 784 | */ |
maygup01 | 0:11cc2b7889af | 785 | extern uint8_t sn_nsdl_get_retransmission_count(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 786 | |
maygup01 | 0:11cc2b7889af | 787 | /** |
maygup01 | 0:11cc2b7889af | 788 | * \fn extern int32_t sn_nsdl_send_coap_ping(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 789 | * |
maygup01 | 0:11cc2b7889af | 790 | * \brief Send confirmable CoAP ping message. |
maygup01 | 0:11cc2b7889af | 791 | * |
maygup01 | 0:11cc2b7889af | 792 | * \param *handle Pointer to nsdl-library handle |
maygup01 | 0:11cc2b7889af | 793 | * |
maygup01 | 0:11cc2b7889af | 794 | * \return message ID, 0 if failed |
maygup01 | 0:11cc2b7889af | 795 | */ |
maygup01 | 0:11cc2b7889af | 796 | extern int32_t sn_nsdl_send_coap_ping(struct nsdl_s *handle); |
maygup01 | 0:11cc2b7889af | 797 | |
maygup01 | 0:11cc2b7889af | 798 | #ifdef __cplusplus |
maygup01 | 0:11cc2b7889af | 799 | } |
maygup01 | 0:11cc2b7889af | 800 | #endif |
maygup01 | 0:11cc2b7889af | 801 | |
maygup01 | 0:11cc2b7889af | 802 | #endif /* SN_NSDL_LIB_H_ */ |