file con versione corretta

Dependencies:   HTS221 MQTT

Files at this revision

API Documentation at this revision

Comitter:
fabio_gatti
Date:
Fri Aug 17 14:57:03 2018 +0000
Parent:
2:983b7f5dde1e
Child:
4:591b0f33f8b0
Commit message:
Primo rilascio

Changed in this revision

COAP_library/sn_client_config.h Show annotated file Show diff for this revision Revisions of this file
COAP_library/sn_nsdl.h Show annotated file Show diff for this revision Revisions of this file
COAP_library/sn_nsdl_lib.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed_app.json Show annotated file Show diff for this revision Revisions of this file
thingsboard_account.h Show annotated file Show diff for this revision Revisions of this file
wifi-ism43362.lib Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COAP_library/sn_client_config.h	Fri Aug 17 14:57:03 2018 +0000
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2016 ARM Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef SN_CLIENT_CONFIG_H
+#define SN_CLIENT_CONFIG_H
+
+/**
+* \brief Configuration options (set of defines and values)
+*
+*  This lists set of compile-time options that needs to be used to enable
+*  or disable features selectively, and set the values for the mandatory
+*  parameters.
+*/
+
+/**
+ * \def DISABLE_RESOURCE_TYPE
+ * \brief For Disabling Resource type
+ *
+ */
+#undef DISABLE_RESOURCE_TYPE
+
+/**
+ * \def DISABLE_INTERFACE_DESCRIPTION
+ * \brief For Disabling Resource type
+ *
+ */
+#undef DISABLE_INTERFACE_DESCRIPTION
+
+#ifdef MBED_CLIENT_USER_CONFIG_FILE
+#include MBED_CLIENT_USER_CONFIG_FILE
+#endif
+
+#endif // SN_CONFIG_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COAP_library/sn_nsdl.h	Fri Aug 17 14:57:03 2018 +0000
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2011-2015 ARM Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* \file sn_nsdl.h
+*
+* \brief libNsdl generic header file
+*
+*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef SN_NSDL_H_
+#define SN_NSDL_H_
+
+#define SN_NSDL_SUCCESS  0
+#define SN_NSDL_FAILURE (-1)
+
+//#include "sn_coap_header.h"
+
+#endif /* SN_NSDL_H_ */
+
+#ifdef __cplusplus
+}
+#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/COAP_library/sn_nsdl_lib.h	Fri Aug 17 14:57:03 2018 +0000
@@ -0,0 +1,646 @@
+/*
+ * Copyright (c) 2011-2015 ARM Limited. All rights reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ * Licensed under the Apache License, Version 2.0 (the License); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+* \file sn_nsdl_lib.h
+*
+* \brief NanoService Devices Library header file
+*
+*
+*/
+
+#ifndef SN_NSDL_LIB_H_
+#define SN_NSDL_LIB_H_
+
+#include "ns_list.h"
+#include "sn_client_config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define SN_NSDL_ENDPOINT_NOT_REGISTERED  0
+#define SN_NSDL_ENDPOINT_IS_REGISTERED   1
+
+#ifdef YOTTA_CFG_DISABLE_INTERFACE_DESCRIPTION
+#define DISABLE_INTERFACE_DESCRIPTION YOTTA_CFG_DISABLE_INTERFACE_DESCRIPTION 
+#elif defined MBED_CONF_MBED_CLIENT_DISABLE_INTERFACE_DESCRIPTION
+#define DISABLE_INTERFACE_DESCRIPTION MBED_CONF_MBED_CLIENT_DISABLE_INTERFACE_DESCRIPTION 
+#endif
+
+#ifdef YOTTA_CFG_DISABLE_RESOURCE_TYPE
+#define DISABLE_RESOURCE_TYPE YOTTA_CFG_DISABLE_RESOURCE_TYPE
+#elif defined MBED_CONF_MBED_CLIENT_DISABLE_RESOURCE_TYPE
+#define DISABLE_RESOURCE_TYPE MBED_CONF_MBED_CLIENT_DISABLE_RESOURCE_TYPE
+#endif
+
+/* Handle structure */
+struct nsdl_s;
+
+/**
+ * \brief Received device server security
+ */
+typedef enum omalw_server_security_ {
+    SEC_NOT_SET = -1,
+    PSK = 0,
+    RPK = 1,
+    CERTIFICATE = 2,
+    NO_SEC = 3
+} omalw_server_security_t;
+
+/**
+ * \brief Endpoint binding and mode
+ */
+typedef enum sn_nsdl_oma_binding_and_mode_ {
+    BINDING_MODE_NOT_SET = 0,
+    BINDING_MODE_U = 0x01,
+    BINDING_MODE_Q = 0x02,
+    BINDING_MODE_S = 0x04
+} sn_nsdl_oma_binding_and_mode_t;
+
+/**
+ * \brief 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_registration_mode_ {
+    REGISTER_WITH_RESOURCES = 0,
+    REGISTER_WITH_TEMPLATE
+} sn_nsdl_registration_mode_t;
+
+/**
+ * \brief Endpoint registration parameters
+ */
+typedef struct sn_nsdl_ep_parameters_ {
+    uint8_t     endpoint_name_len;
+    uint8_t     domain_name_len;
+    uint8_t     type_len;
+    uint8_t     lifetime_len;
+    uint8_t     location_len;
+
+    sn_nsdl_registration_mode_t ds_register_mode;       /**< Defines registration mode */
+    sn_nsdl_oma_binding_and_mode_t binding_and_mode;    /**< Defines endpoints binding and mode */
+
+    uint8_t     *endpoint_name_ptr;                     /**< Endpoint name */
+    uint8_t     *domain_name_ptr;                       /**< Domain to register. If null, NSP uses default domain */
+    uint8_t     *type_ptr;                              /**< Endpoint type */
+    uint8_t     *lifetime_ptr;                          /**< Endpoint lifetime in seconds. eg. "1200" = 1200 seconds */
+    uint8_t     *location_ptr;                          /**< Endpoint location in server, optional parameter,default is NULL */
+} sn_nsdl_ep_parameters_s;
+
+/**
+ * \brief For internal use
+ */
+typedef struct sn_nsdl_sent_messages_ {
+    uint8_t     message_type;
+    uint16_t    msg_id_number;
+    ns_list_link_t  link;
+} sn_nsdl_sent_messages_s;
+
+/**
+ * \brief Includes resource path
+ */
+typedef struct sn_grs_resource_ {
+    char *path;
+} sn_grs_resource_s;
+
+/**
+ * \brief Table of created resources
+ */
+typedef struct sn_grs_resource_list_ {
+    uint8_t res_count; /**< Number of resources */
+    sn_grs_resource_s *res;
+} sn_grs_resource_list_s;
+
+/**
+ * \brief Resource access rights
+ */
+typedef enum sn_grs_resource_acl_ {
+    SN_GRS_GET_ALLOWED  = 0x01 ,
+    SN_GRS_PUT_ALLOWED  = 0x02,
+    SN_GRS_POST_ALLOWED = 0x04,
+    SN_GRS_DELETE_ALLOWED   = 0x08
+} sn_grs_resource_acl_e;
+
+/**
+ * \brief Defines the resource mode
+ */
+typedef enum sn_nsdl_resource_mode_ {
+    SN_GRS_STATIC = 0,                  /**< Static resources have some value that doesn't change */
+    SN_GRS_DYNAMIC,                     /**< Dynamic resources are handled in application. Therefore one must give function callback pointer to them */
+    SN_GRS_DIRECTORY                    /**< Directory resources are unused and unsupported */
+} sn_nsdl_resource_mode_e;
+
+/**
+ * \brief Defines static parameters for the resource.
+ */
+typedef struct sn_nsdl_static_resource_parameters_ {
+#ifndef DISABLE_RESOURCE_TYPE
+    char        *resource_type_ptr;         /**< Type of the resource */
+#endif
+#ifndef DISABLE_INTERFACE_DESCRIPTION	
+    char        *interface_description_ptr; /**< Interface description */
+#endif	
+    char        *path;                      /**< Resource path */
+    bool        external_memory_block:1;    /**< 0 means block messages are handled inside this library,
+                                                 otherwise block messages are passed to application */
+    unsigned    mode:2;                     /**< STATIC etc.. */
+    bool        free_on_delete:1;           /**< 1 if struct is dynamic allocted --> to be freed */
+} sn_nsdl_static_resource_parameters_s;
+
+/**
+ * \brief Defines dynamic parameters for the resource.
+ */
+typedef struct sn_nsdl_resource_parameters_ {
+    uint8_t                                     (*sn_grs_dyn_res_callback)(struct nsdl_s *,
+                                                                       sn_coap_hdr_s *,
+                                                                       sn_nsdl_addr_s *,
+                                                                       sn_nsdl_capab_e);
+#ifdef MEMORY_OPTIMIZED_API
+    const sn_nsdl_static_resource_parameters_s  *static_resource_parameters;
+#else
+    sn_nsdl_static_resource_parameters_s        *static_resource_parameters;
+#endif
+    uint8_t                                     *resource;          /**< NULL if dynamic resource */
+    ns_list_link_t                              link;
+    uint16_t                                    resourcelen;        /**< 0 if dynamic resource, resource information in static resource */
+    uint16_t                                    coap_content_type;  /**< CoAP content type */
+    unsigned                                    access:4;           /**< Allowed operation mode, GET, PUT, etc,
+                                                                         TODO! This should be in static struct but current
+                                                                         mbed-client implementation requires this to be changed at runtime */
+    unsigned                                    registered:2;       /**< Is resource registered or not */
+    bool                                        publish_uri:1;      /**< 1 if resource to be published to server */
+    bool                                        free_on_delete:1;   /**< 1 if struct is dynamic allocted --> to be freed */
+    bool                                        observable:1;       /**< Is resource observable or not */
+} sn_nsdl_dynamic_resource_parameters_s;
+
+/**
+ * \brief Defines OMAlw server information
+ */
+typedef struct sn_nsdl_oma_server_info_ {
+    sn_nsdl_addr_s *omalw_address_ptr;
+    omalw_server_security_t omalw_server_security;
+
+} sn_nsdl_oma_server_info_t;
+
+/**
+ * \brief Defines endpoint parameters to OMA bootstrap.
+ */
+typedef struct sn_nsdl_bs_ep_info_ {
+    void (*oma_bs_status_cb)(sn_nsdl_oma_server_info_t *);  /**< Callback for OMA bootstrap status */
+
+    void (*oma_bs_status_cb_handle)(sn_nsdl_oma_server_info_t *,
+                                    struct nsdl_s *);       /**< Callback for OMA bootstrap status with nsdl handle */
+} sn_nsdl_bs_ep_info_t;
+
+/**
+ * \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 *),
+ *                          uint8_t (*sn_nsdl_rx_cb)(sn_coap_hdr_s *, sn_nsdl_addr_s *),
+ *                          sn_nsdl_mem_s *sn_memory)
+ *
+ * \brief Initialization function for NSDL library. Initializes NSDL, GRS, HTTP and CoAP.
+ *
+ * \param *sn_nsdl_tx_callback  A callback function for sending messages.
+ *
+ * \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
+ *                              reply for some DS messages (register message etc.), rx callback will be called.
+ *
+ * \param *sn_memory            Memory structure which includes function pointers to the allocation and free functions.
+ *
+ * \return  pointer to created handle structure. NULL if failed
+ */
+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 *),
+                            uint8_t (*sn_nsdl_rx_cb)(struct nsdl_s *, sn_coap_hdr_s *, sn_nsdl_addr_s *),
+                            void *(*sn_nsdl_alloc)(uint16_t), void (*sn_nsdl_free)(void *));
+
+/**
+ * \fn extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr);
+ *
+ * \brief Registers endpoint to mbed Device Server.
+ * \param *handle               Pointer to nsdl-library handle
+ * \param *endpoint_info_ptr    Contains endpoint information.
+ *
+ * \return registration message ID, 0 if failed
+ */
+extern uint16_t sn_nsdl_register_endpoint(struct nsdl_s *handle, sn_nsdl_ep_parameters_s *endpoint_info_ptr);
+
+/**
+ * \fn extern uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle)
+ *
+ * \brief Sends unregister-message to mbed Device Server.
+ *
+ * \param *handle               Pointer to nsdl-library handle
+ *
+ * \return  unregistration message ID, 0 if failed
+ */
+extern uint16_t sn_nsdl_unregister_endpoint(struct nsdl_s *handle);
+
+/**
+ * \fn extern uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len);
+ *
+ * \brief Update the registration with mbed Device Server.
+ *
+ * \param *handle   Pointer to nsdl-library handle
+ * \param *lt_ptr   Pointer to lifetime value string in ascii form, eg. "1200"
+ * \param lt_len    Length of the lifetime string
+ *
+ * \return  registration update message ID, 0 if failed
+ */
+extern uint16_t sn_nsdl_update_registration(struct nsdl_s *handle, uint8_t *lt_ptr, uint8_t lt_len);
+
+/**
+ * \fn extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len);
+ *
+ * \brief Sets the location receievd from Device Server.
+ *
+ * \param *handle   Pointer to nsdl-library handle
+ * \param *lt_ptr   Pointer to location value string , eg. "s322j4k"
+ * \param lt_len    Length of the location string
+ *
+ * \return  success, 0 if failed -1
+ */
+extern int8_t sn_nsdl_set_endpoint_location(struct nsdl_s *handle, uint8_t *location_ptr, uint8_t location_len);
+
+/**
+ * \fn extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle)
+ *
+ * \brief Checks if endpoint is registered.
+ *
+ * \param *handle   Pointer to nsdl-library handle
+ *
+ * \return 1 Endpoint registration is done successfully
+ * \return 0 Endpoint is not registered
+ */
+extern int8_t sn_nsdl_is_ep_registered(struct nsdl_s *handle);
+
+/**
+ * \fn extern void sn_nsdl_nsp_lost(struct nsdl_s *handle);
+ *
+ * \brief A function to inform mbed Device C client library if application detects a fault in mbed Device Server registration.
+ *
+ * \param *handle   Pointer to nsdl-library handle
+ *
+ * After calling this function sn_nsdl_is_ep_registered() will return "not registered".
+ */
+extern void sn_nsdl_nsp_lost(struct nsdl_s *handle);
+
+/**
+ * \fn extern 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,
+ *                                                  sn_coap_observe_e observe,
+ *                                                  sn_coap_msg_type_e message_type, sn_coap_content_format_e content_format)
+ *
+ *
+ * \brief Sends observation message to mbed Device Server
+ *
+ * \param   *handle         Pointer to nsdl-library handle
+ * \param   *token_ptr      Pointer to token to be used
+ * \param   token_len       Token length
+ * \param   *payload_ptr    Pointer to payload to be sent
+ * \param   payload_len     Payload length
+ * \param   observe         Observe option value to be sent
+ * \param   message_type    Observation message type (confirmable or non-confirmable)
+ * \param   content_format  Observation message payload content format
+ *
+ * \return  !0  Success, observation messages message ID
+ * \return  0   Failure
+ */
+extern 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,
+        sn_coap_observe_e observe,
+        sn_coap_msg_type_e message_type,
+        sn_coap_content_format_e content_format);
+
+/**
+ * \fn extern uint32_t sn_nsdl_get_version(void)
+ *
+ * \brief Version query function.
+ *
+ * Used to retrieve the version information from the mbed Device C Client library.
+ *
+ * \return Pointer to library version string
+*/
+extern char *sn_nsdl_get_version(void);
+
+/**
+ * \fn extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src)
+ *
+ * \brief To push CoAP packet to mbed Device C Client library
+ *
+ * Used to push an CoAP packet to mbed Device C Client library for processing.
+ *
+ * \param   *handle     Pointer to nsdl-library handle
+ *
+ * \param   *packet     Pointer to a uint8_t array containing the packet (including the CoAP headers).
+ *      After successful execution this array may contain the response packet.
+ *
+ * \param   *packet_len Pointer to length of the packet. After successful execution this array may contain the length
+ *      of the response packet.
+ *
+ * \param   *src        Pointer to packet source address information. After successful execution this array may contain
+ *      the destination address of the response packet.
+ *
+ * \return  0   Success
+ * \return  -1  Failure
+ */
+extern int8_t sn_nsdl_process_coap(struct nsdl_s *handle, uint8_t *packet, uint16_t packet_len, sn_nsdl_addr_s *src);
+
+/**
+ * \fn extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time);
+ *
+ * \brief CoAP retransmission function.
+ *
+ * Used to give execution time for the mbed Device C Client library for retransmissions.
+ *
+ * \param   *handle Pointer to nsdl-library handle
+ *
+ * \param  time Time in seconds.
+ *
+ * \return  0   Success
+ * \return  -1  Failure
+ */
+extern int8_t sn_nsdl_exec(struct nsdl_s *handle, uint32_t time);
+
+/**
+ * \fn  extern int8_t sn_nsdl_put_resource(struct nsdl_s *handle, const sn_nsdl_dynamic_resource_parameters_s *res);
+ *
+ * \brief Resource putting function.
+ *
+ * Used to put a static or dynamic CoAP resource without creating copy of it.
+ * NOTE: Remember that only resource will be owned, not data that it contains
+ * NOTE: The resource may be removed from list by sn_nsdl_pop_resource().
+ *
+ * \param   *res    Pointer to a structure of type sn_nsdl_dynamic_resource_parameters_s that contains the information
+ *     about the resource.
+ *
+ * \return  0   Success
+ * \return  -1  Failure
+ * \return  -2  Resource already exists
+ * \return  -3  Invalid path
+ * \return  -4  List adding failure
+ */
+extern int8_t sn_nsdl_put_resource(struct nsdl_s *handle, sn_nsdl_dynamic_resource_parameters_s *res);
+
+/**
+ * \fn  extern int8_t sn_nsdl_pop_resource(struct nsdl_s *handle, const sn_nsdl_dynamic_resource_parameters_s *res);
+ *
+ * \brief Resource popping function.
+ *
+ * Used to remove a static or dynamic CoAP resource from lists without deleting it.
+ * NOTE: This function is a counterpart of sn_nsdl_put_resource().
+ *
+ * \param   *res    Pointer to a structure of type sn_nsdl_dynamic_resource_parameters_s that contains the information
+ *     about the resource.
+ *
+ * \return  0   Success
+ * \return  -1  Failure
+ * \return  -3  Invalid path
+ */
+extern int8_t sn_nsdl_pop_resource(struct nsdl_s *handle, sn_nsdl_dynamic_resource_parameters_s *res);
+
+/**
+ * \fn extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, char *path)
+ *
+ * \brief Resource delete function.
+ *
+ * Used to delete a resource. If resource has a subresources, these all must also be removed.
+ *
+ * \param   *handle     Pointer to nsdl-library handle
+ * \param   *path_ptr   A pointer to an array containing the path.
+ *
+ * \return  0   Success
+ * \return  -1  Failure (No such resource)
+ */
+extern int8_t sn_nsdl_delete_resource(struct nsdl_s *handle, const char *path);
+
+/**
+ * \fn extern sn_nsdl_dynamic_resource_parameters_s *sn_nsdl_get_resource(struct nsdl_s *handle, char *path)
+ *
+ * \brief Resource get function.
+ *
+ * Used to get a resource.
+ *
+ * \param   *handle     Pointer to nsdl-library handle
+  * \param   *path   A pointer to an array containing the path.
+ *
+ * \return  !NULL   Success, pointer to a sn_nsdl_dynamic_resource_parameters_s that contains the resource information\n
+ * \return  NULL    Failure
+ */
+extern sn_nsdl_dynamic_resource_parameters_s *sn_nsdl_get_resource(struct nsdl_s *handle, const char *path);
+
+/**
+ * \fn extern sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, char *path)
+ *
+ * \brief Resource list function.
+ *
+ * \param   *handle Pointer to nsdl-library handle
+ * \param   *path   A pointer to an array containing the path or a NULL pointer.
+ *
+ * \return  !NULL   A pointer to a sn_grs_resource_list_s structure containing the resource listing.
+ * \return  NULL    Failure with an unspecified error
+ */
+sn_grs_resource_list_s *sn_nsdl_list_resource(struct nsdl_s *handle, const char *path);
+
+/**
+ * \fn extern void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list)
+ *
+ * \brief Free a resource list obtained from sn_nsdl_list_resource()
+ *
+ * \param   list    The list to free, or NULL.
+ */
+void sn_nsdl_free_resource_list(struct nsdl_s *handle, sn_grs_resource_list_s *list);
+
+/**
+ * \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);
+ *
+ * \brief Send an outgoing CoAP request.
+ *
+ * \param   *handle Pointer to nsdl-library handle
+ * \param   *address_ptr    Pointer to source address struct
+ * \param   *coap_hdr_ptr   Pointer to CoAP message to be sent
+ *
+ * \return  0   Success
+ * \return  -1  Failure
+ */
+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);
+
+/**
+ * \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);
+ *
+ * \brief This function is used to set the mbed Device Server address given by an application.
+ *
+ * \param   *handle Pointer to nsdl-library handle
+ * \return  0   Success
+ * \return  -1  Failed to indicate that internal address pointer is not allocated (call nsdl_init() first).
+ */
+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);
+
+/**
+ * \fn extern int8_t sn_nsdl_destroy(struct nsdl_s *handle);
+ *
+ * \param   *handle Pointer to nsdl-library handle
+ * \brief This function releases all allocated memory in mbed Device C Client library.
+ */
+extern int8_t sn_nsdl_destroy(struct nsdl_s *handle);
+
+/**
+ * \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);
+ *
+ * \brief Starts OMA bootstrap process
+ *
+ * \param   *handle Pointer to nsdl-library handle
+ *
+ * \return bootstrap message ID, 0 if failed
+ */
+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);
+
+/**
+ * \fn sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code)
+ *
+ * \brief Prepares generic response packet from a request packet. This function allocates memory for the resulting sn_coap_hdr_s
+ *
+ * \param *handle Pointer to library handle
+ * \param *coap_packet_ptr The request packet pointer
+ * \param msg_code response messages code
+ *
+ * \return *coap_packet_ptr The allocated and pre-filled response packet pointer
+ *          NULL    Error in parsing the request
+ *
+ */
+extern sn_coap_hdr_s *sn_nsdl_build_response(struct nsdl_s *handle, sn_coap_hdr_s *coap_packet_ptr, uint8_t msg_code);
+
+/**
+ * \brief Allocates and initializes options list structure
+ *
+ * \param *handle Pointer to library handle
+ * \param *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.
+ *
+ * \return Return value is pointer to the CoAP options structure.\n
+ *         In following failure cases NULL is returned:\n
+ *          -Failure in given pointer (= NULL)\n
+ *          -Failure in memory allocation (malloc() returns NULL)
+ */
+extern sn_coap_options_list_s *sn_nsdl_alloc_options_list(struct nsdl_s *handle, sn_coap_hdr_s *coap_msg_ptr);
+
+/**
+ * \fn void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr)
+ *
+ * \brief Releases memory of given CoAP message
+ *
+ *        Note!!! Does not release Payload part
+ *
+ * \param *handle Pointer to library handle
+ *
+ * \param *freed_coap_msg_ptr is pointer to released CoAP message
+ */
+extern void sn_nsdl_release_allocated_coap_msg_mem(struct nsdl_s *handle, sn_coap_hdr_s *freed_coap_msg_ptr);
+
+/**
+ * \fn int8_t sn_nsdl_set_retransmission_parameters(struct nsdl_s *handle, uint8_t resending_count, uint8_t resending_intervall)
+ *
+ * \brief  If re-transmissions are enabled, this function changes resending count and interval.
+ *
+ * \param *handle Pointer to library handle
+ * \param uint8_t resending_count max number of resendings for message
+ * \param uint8_t resending_intervall message resending intervall in seconds
+ * \return  0 = success, -1 = failure
+ */
+extern int8_t sn_nsdl_set_retransmission_parameters(struct nsdl_s *handle, uint8_t resending_count, uint8_t resending_interval);
+
+/**
+ * \fn int8_t sn_nsdl_set_retransmission_buffer(struct nsdl_s *handle, uint8_t buffer_size_messages, uint16_t buffer_size_bytes)
+ *
+ * \brief 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.
+ *
+ * \param *handle Pointer to library handle
+ * \param uint8_t buffer_size_messages queue size - maximum number of messages to be saved to queue
+ * \param uint8_t buffer_size_bytes queue size - maximum size of messages saved to queue
+ * \return  0 = success, -1 = failure
+ */
+extern int8_t sn_nsdl_set_retransmission_buffer(struct nsdl_s *handle,
+        uint8_t buffer_size_messages, uint16_t buffer_size_bytes);
+
+/**
+ * \fn int8_t sn_nsdl_set_block_size(struct nsdl_s *handle, uint16_t block_size)
+ *
+ * \brief If block transfer is enabled, this function changes the block size.
+ *
+ * \param *handle Pointer to library handle
+ * \param uint16_t block_size maximum size of CoAP payload. Valid sizes are 16, 32, 64, 128, 256, 512 and 1024 bytes
+ * \return  0 = success, -1 = failure
+ */
+extern int8_t sn_nsdl_set_block_size(struct nsdl_s *handle, uint16_t block_size);
+
+/**
+ * \fn int8_t sn_nsdl_set_duplicate_buffer_size(struct nsdl_s *handle,uint8_t message_count)
+ *
+ * \brief If dublicate message detection is enabled, this function changes buffer size.
+ *
+ * \param *handle Pointer to library handle
+ * \param uint8_t message_count max number of messages saved for duplicate control
+ * \return  0 = success, -1 = failure
+ */
+extern int8_t sn_nsdl_set_duplicate_buffer_size(struct nsdl_s *handle, uint8_t message_count);
+
+/**
+ * \fn void *sn_nsdl_set_context(const struct nsdl_s *handle, void *context)
+ *
+ * \brief Set 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.
+ *
+ * \param *handle Pointer to library handle
+ * \param *context Pointer to the application defined context
+ * \return 0 = success, -1 = failure
+ */
+extern int8_t sn_nsdl_set_context(struct nsdl_s * const handle, void * const context);
+
+/**
+ * \fn void *sn_nsdl_get_context(const struct nsdl_s *handle)
+ *
+ * \brief 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.
+ *
+ * \param *handle Pointer to library handle
+ * \return Pointer to the application defined context
+ */
+extern void *sn_nsdl_get_context(const struct nsdl_s * const handle);
+
+/**
+ * \fn int8_t sn_nsdl_clear_coap_resending_queue(struct nsdl_s *handle)
+ *
+ * \brief Clean confirmable message list.
+ *
+ * \param *handle Pointer to library handle
+ * \return  0 = success, -1 = failure
+ */
+extern int8_t sn_nsdl_clear_coap_resending_queue(struct nsdl_s *handle);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* SN_NSDL_LIB_H_ */
--- a/main.cpp	Wed Aug 01 23:01:53 2018 +0000
+++ b/main.cpp	Fri Aug 17 14:57:03 2018 +0000
@@ -1,11 +1,22 @@
 // main.cpp
+#include <string>
 
 #include "mbed.h"
 #include "ISM43362Interface.h"
 #include "TCPSocket.h"
+#include "HTS221Sensor.h"
+
+#include "thingsboard_account.h"
+
+
+// H file per MQTT
 #include "MQTTmbed.h"
 #include "MQTTClient.h"
-#include "HTS221Sensor.h"
+
+// H file per COAP
+#include "sn_nsdl.h"
+#include "sn_coap_protocol.h"
+#include "sn_coap_header.h"
 
 // Definitions ---------------------------------------------------------
 
@@ -15,9 +26,10 @@
 // Change it with your WiFi password name
 //#define WIFI_NETWORK_PASSWORD   "smartlab"
 #define WIFI_NETWORK_PASSWORD   "Rosmarino_10"
+
 #define WIFI_SECURITY           NSAPI_SECURITY_WPA_WPA2
 
-#define COMM_PROTO              0
+#define COMM_PROTO              2
 
 // scegliere il protocollo di trasporto dati
 // COMM_PROTO = 0 -> accesso MQTT (default);
@@ -27,17 +39,38 @@
 #define COMM_PROTO 0
 #endif
 
-#if COMM_PROTO==0
+// scegliere il token al device
+#define DEVICE_ID                 5
+#define DEVICE_ACCESS_TOKEN       TEAM_5_DEVICE_ACCESS_TOKEN
+
+// ciclo di frequenza lettura
+#define SENSOR_READING_PERIOD     5000 //in ms
+
+#if COMM_PROTO==0    //MQTT protocol
+
+  #define MQTT_HOST               "demo.thingsboard.io"
+  #define MQTT_PORT               1883
+  #define MQTT_TOPIC              "v1/devices/me/telemetry"
 
-#define MQTT_HOST               "demo.thingsboard.io"
-#define MQTT_PORT               1883
-#define MQTT_TOPIC              "v1/devices/me/telemetry"
-#define DEVICE_ACCESS_TOKEN     "nNcsYA9xXL8OsEmHd6Cq"
+#elif COMM_PROTO==1  //HTTP protocol
+  #define HTTP_HOST               "demo.thingsboard.io"
+  #define HTTP_PORT               80
+  #define HTTP_STR_1              "/api/v1/"
+  #define HTTP_STR_2              "/telemetry"
 
-#endif
+#elif COMM_PROTO==2  //COAP protocol
+  #define COAP_HOST               "demo.thingsboard.io"
+  #define COAP_PORT               5683
+  #define COAP_STR_1              "/api/v1/"
+  #define COAP_STR_2              "/telemetry"
+  
+  #define SHOW_COAP_RESPONSE      false
 
+#endif              //end protocol
 
-#if COMM_PROTO==0
+// strutture comuni
+
+#if COMM_PROTO == 0
 class MQTTNetwork
 {
 public:
@@ -70,12 +103,44 @@
     NetworkInterface* network;
     TCPSocket* socket;
 };
+
+#elif COMM_PROTO==2  //COAP protocol
+UDPSocket socket;           // Socket to talk CoAP over
+Thread recvfromThread;      // Thread to receive messages over CoAP
+struct coap_s* coapHandle;
+coap_version_e coapVersion = COAP_VERSION_1;
+
+// CoAP HAL
+void* coap_malloc(uint16_t size) {
+    return malloc(size);
+}
+
+void coap_free(void* addr) {
+    free(addr);
+}
+
+// tx_cb and rx_cb are not used in this program
+uint8_t coap_tx_cb(uint8_t *a, uint16_t b, sn_nsdl_addr_s *c, void *d) {
+    printf("coap tx cb\n");
+    return 0;
+}
+
+int8_t coap_rx_cb(sn_coap_hdr_s *a, sn_nsdl_addr_s *b, void *c) {
+    printf("coap rx cb\n");
+    return 0;
+}
+
+
 #endif
 
+Serial pc(USBTX, USBRX); //use these pins for serial coms.
 int main()
 {
+ 
     int count = 0;
-
+    pc.baud(115200);
+    
+    printf(" --- START SESSION ---\n");
     ISM43362Interface wifi(MBED_CONF_APP_WIFI_SPI_MOSI,
             MBED_CONF_APP_WIFI_SPI_MISO,
             MBED_CONF_APP_WIFI_SPI_SCLK,
@@ -118,7 +183,7 @@
     printf("Gateway: %s\n", wifi.get_gateway());
     printf("RSSI: %d\n\n", wifi.get_rssi());
 
-#if COMM_PROTO==0
+#if COMM_PROTO == 0  //MQTT
     printf("Collegamento MQTT server: " MQTT_HOST  "\n");
 
     MQTTNetwork network(&wifi);
@@ -140,46 +205,226 @@
     }
 
     printf("successfully connect to MQTT server!\n");
+
+#elif COMM_PROTO == 1  //HTTP
+
+    printf("Collegamento HTTP server: " HTTP_HOST  "\n");
+    TCPSocket socket;
+    nsapi_error_t response;
+
+    // Open a socket on the network interface, and create a TCP connection 
+    socket.open(&wifi);
+    response = socket.connect(HTTP_HOST, HTTP_PORT);
+    if(0 != response) {
+        printf("Error connecting: %d\n", response);
+        socket.close();
+        return -1;
+    }
+    socket.close();
+#elif COMM_PROTO == 2 // COAP
+    
+    //inserire un test di invio dati al server coap
+
+
 #endif
 
 // Initialize sensors --------------------------------------------------
 
 uint8_t id;
-DevI2C i2c_2(PB_11, PB_10);
-HTS221Sensor hum_temp(&i2c_2);
+    DevI2C i2c_2(PB_11, PB_10);
+    HTS221Sensor hum_temp(&i2c_2);
+
+    hum_temp.init(NULL);
+    hum_temp.enable();
+    hum_temp.read_id(&id);
+    printf("HTS221  humidity & temperature sensor = 0x%X\r\n", id);
 
-hum_temp.init(NULL);
-hum_temp.enable();
-hum_temp.read_id(&id);
-printf("HTS221  humidity & temperature sensor = 0x%X\r\n", id);
+// Variabili di appoggio  -----------------------------------------------
+#if COMM_PROTO == 1
+    uint8_t http_request[1024];   
+    char request_body[256];
+    static   uint8_t http_resp[512];
+    uint16_t reqLen;
+    uint16_t respLen;
 
-// Get data from sensors -----------------------------------------------
+#elif COMM_PROTO == 2 // COAP
+    char coap_body[256];
+    char coap_uri_path[256];
+    uint16_t coap_message_id;
+    coap_message_id=0;
+    
 
+#endif
+
+
+
+
+// ciclo di lettura sensori e caricamento su cloud       
 for (;;) {
     float temp, humid;
 
     hum_temp.get_temperature(&temp);
     hum_temp.get_humidity(&humid);
-    printf("HTS221:  [temp] %.2f C, [hum]   %.2f%%\r\n", temp, humid);
+    
+    printf("ID: %d HTS221:  [temp] %.2f C, [hum]   %.2f%%\r\n", DEVICE_ID,temp, humid);
 
+#if COMM_PROTO == 0
     char msg[256];
     int n = snprintf(msg, sizeof(msg),
-        "{\"temperature\":%f, \"humidity\":%f, \"active\": false}",
-        temp, humid);
+        "{\"ID\":%d,\"temperature\":%f, \"humidity\":%f}",
+        DEVICE_ID,temp, humid);
 
     void *payload = reinterpret_cast<void*>(msg);
     size_t payload_len = n;
-
+    printf("Message payload lenght: %d\r\n",payload_len);
     printf("publish to: %s %d %s\r\n", MQTT_HOST, MQTT_PORT, MQTT_TOPIC);
-#if COMM_PROTO==0
     if (client.publish(MQTT_TOPIC, payload, n) < 0) {
         printf("failed to publish MQTT message");
     }
-#endif
-    wait_ms(5000);
+    
+#elif COMM_PROTO == 1
+    // ciclo di scrittura su socket
+    // - open
+    // - connect
+    // - send 
+    // - close
+   
+    socket.open(&wifi);
+    response = socket.connect(HTTP_HOST, HTTP_PORT);
+    if(0 != response) {
+        printf("Error connecting: %d\n", response);
+        socket.close();
+        return -1;
+    }
+        
+        
+    // body of the request
+
+    sprintf(request_body, "{\"ID\":%d,\"temperature\": %f,\"humidity\": %f}\r\n",DEVICE_ID, temp, humid);
+
+    // build header of the request
+    sprintf((char *)http_request, "POST %s%s%s HTTP/1.1\r\nHost: %s \r\n", HTTP_STR_1,DEVICE_ACCESS_TOKEN,HTTP_STR_2, HTTP_HOST);
+    strcat((char *)http_request, "Accept: */*\r\n");
+    strcat((char *)http_request, "User-agent: ST-475-IOT\r\n");
+    strcat((char *)http_request, "Connection: Close\r\n"); 
+    char buffer[64];
+    strcat((char *)http_request, "Content-Type: application/json\r\n");
+    sprintf(buffer, "Content-Length: %d \r\n\r\n", strlen(request_body));
+    strcat((char *)http_request, buffer);
+
+    // append body to the header of the request
+    strcat((char *)http_request, request_body);
+    reqLen = strlen((char *)http_request);
+    printf((char *)http_request);
+
+    // Send a simple http request
+    
+    nsapi_size_t size = strlen((char *)http_request);
+    response = 0;
+    
+    while(size)
+    {
+        response = socket.send(((char *)http_request)+response, size);
+        
+        if (response < 0) {
+            printf("Error sending data: %d\n", response);
+            socket.close();
+            return -1;
+        } else {
+            size -= response;
+            // Check if entire message was sent or not
+            printf("sent %d [%.*s]\n", response, strstr((char *)http_request, "\r\n")-(char *)http_request, (char *)http_request);
+        }
+    }
+    // pulizia risorse della socket
+    socket.close();        
+        
+#elif COMM_PROTO == 2 //COAP              
+   
+
+    // Open a socket on the network interface
+    socket.open(&wifi);
+
+    // Initialize the CoAP protocol handle, pointing to local implementations on malloc/free/tx/rx functions
+    coapHandle = sn_coap_protocol_init(&coap_malloc, &coap_free, &coap_tx_cb, &coap_rx_cb);
+
+
+    // Path to the resource we want to retrieve
+    sprintf(coap_uri_path, "%s%s%s", COAP_STR_1,DEVICE_ACCESS_TOKEN,COAP_STR_2);
+    sprintf(coap_body, "{\"ID\":%d,\"temperature\": %f,\"humidity\": %f}\r\n", DEVICE_ID,temp, humid);
+
+    printf ("URI PATH: %s\n",coap_uri_path);
+    printf ("BODY: %s\n",coap_body);
+    printf ("id: %d\n",coap_message_id);
+
+    // See ns_coap_header.h
+    sn_coap_hdr_s *coap_res_ptr = (sn_coap_hdr_s*)calloc(sizeof(sn_coap_hdr_s), 1);
+    coap_res_ptr->uri_path_ptr = (uint8_t*)coap_uri_path;       // Path
+    coap_res_ptr->uri_path_len = strlen(coap_uri_path);
+    coap_res_ptr->msg_type = COAP_MSG_TYPE_NON_CONFIRMABLE;
+    coap_res_ptr->msg_code = COAP_MSG_CODE_REQUEST_POST;         // CoAP method
+    coap_res_ptr->content_format = COAP_CT_JSON;          // CoAP content type
+    coap_res_ptr->payload_len = strlen(coap_body);                              // Body length
+    coap_res_ptr->payload_ptr = (uint8_t*)coap_body;                              // Body pointer
+    coap_res_ptr->options_list_ptr = 0;                         // Optional: options list
+    coap_res_ptr->msg_id = coap_message_id;  //msg ID, don't forget to increase it
+    coap_message_id++;
+    
+    // Calculate the CoAP message size, allocate the memory and build the message
+    uint16_t message_len = sn_coap_builder_calc_needed_packet_data_size(coap_res_ptr);
+    printf("Calculated message length: %d bytes\n", message_len);
+
+    uint8_t* message_ptr = (uint8_t*)malloc(message_len);
+    sn_coap_builder(message_ptr, coap_res_ptr);
+
+    // Uncomment to see the raw buffer that will be sent...
+     printf("Message is: ");
+     for (size_t ix = 0; ix < message_len; ix++) {
+         printf("%02x ", message_ptr[ix]);
+     }
+     printf("\n");
+
+    int scount = socket.sendto(COAP_HOST, COAP_PORT, message_ptr, message_len);
+    printf("Sent %d bytes to coap://%s:%d\n", scount,COAP_HOST, COAP_PORT);
+
+// routine di ricezione    
+#if SHOW_COAP_RESPONSE == true
+    SocketAddress addr;
+    uint8_t* recv_buffer = (uint8_t*)malloc(1280); // Suggested is to keep packet size under 1280 bytes
+    
+    if ((ret = socket.recvfrom(&addr, recv_buffer, 1280)) >= 0) {
+        // to see where the message came from, inspect addr.get_addr() and addr.get_port()
+  
+        printf("Received packets from (%s,%d)\n", addr.get_ip_address(),addr.get_port());
+
+        sn_coap_hdr_s* parsed = sn_coap_parser(coapHandle, ret, recv_buffer, &coapVersion);
+
+        // We know the payload is going to be a string
+        std::string payload((const char*)parsed->payload_ptr, parsed->payload_len);
+
+        printf("\tmsg_id:           %d\n", parsed->msg_id);
+        printf("\tmsg_code:         %d\n", parsed->msg_code);
+        printf("\tcontent_format:   %d\n", parsed->content_format);
+        printf("\tpayload_len:      %d\n", parsed->payload_len);
+        printf("\tpayload:          %s\n", payload.c_str());
+        printf("\toptions_list_ptr: %p\n", parsed->options_list_ptr);
+    }
+
+    free(recv_buffer);  
+ 
+
+#endif //end SHOW_COAP_RESPONSE   
+    socket.close();
+    sn_coap_protocol_destroy(coapHandle);
+    free(coap_res_ptr);
+    free(message_ptr);
+
+     
+#endif //end protocol selection
+    wait_ms(SENSOR_READING_PERIOD);
 }
 
-
+//le disconnect non vengono raggiunte perche' rimaniamo all'interno del ciclo
 //client.disconnect();
 //wifi.disconnect();
 
--- a/mbed_app.json	Wed Aug 01 23:01:53 2018 +0000
+++ b/mbed_app.json	Fri Aug 17 14:57:03 2018 +0000
@@ -1,9 +1,5 @@
 {
-    "macros": [
-        "MBED_CONF_APP_MAIN_STACK_SIZE=6000",
-        "MBED_CONF_APP_THREAD_STACK_SIZE=6000",
-        "DEVICE_STDIO_MESSAGES=1"
-    ],
+
     "config": {
         "wifi-shield": {
             "help": "Options are internal, WIFI_IDW0XX1",
@@ -48,8 +44,11 @@
     },
     "target_overrides": {
         "*": {
+            "target.features_add": ["COMMON_PAL"],
             "platform.stdio-baud-rate": 115200,
             "platform.stdio-convert-newlines": true
+       
+       
         },
         "DISCO_L475VG_IOT1A": {
             "wifi-spi_miso": "PC_11",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/thingsboard_account.h	Fri Aug 17 14:57:03 2018 +0000
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * and Eclipse Distribution License v1.0 which accompany this distribution.
+ *
+ *
+ * Contributors:
+ *    Fabio Gatti - definizione account per accesso device
+
+ *******************************************************************************/
+
+#if !defined(THINGSBOARD_ACCOUNT_H)
+#define THINGSBOARD_ACCOUNT_H
+
+
+#define TEAM_1_DEVICE_ACCESS_TOKEN       "nNcsYA9xXL8OsEmHd6Cq"
+#define TEAM_2_DEVICE_ACCESS_TOKEN       "dLt8RY6rk17QWwHgwWRS"
+#define TEAM_3_DEVICE_ACCESS_TOKEN       "GIu9NvNDERYGznVLGafZ"
+#define TEAM_4_DEVICE_ACCESS_TOKEN       "A3f1tTvfl5thuMYg6jOI"
+#define TEAM_5_DEVICE_ACCESS_TOKEN       "EtBwphUDpzeEykeUZ0ti"
+#define TEAM_6_DEVICE_ACCESS_TOKEN       "gCRSh3cRQb1aXMM38gPa"
+#define TEAM_7_DEVICE_ACCESS_TOKEN       "MkgWJKOyqBK0VnG6qOI0"
+#define TEAM_8_DEVICE_ACCESS_TOKEN       "q1cv3rEy4cZytAJM3JiH"
+#define TEAM_9_DEVICE_ACCESS_TOKEN       "4wueets9bjqRZcLsTFh9"
+#define TEAM_10_DEVICE_ACCESS_TOKEN       "4EWepnDjyp6sop7Htmol"
+
+#define TEAM_11_DEVICE_ACCESS_TOKEN       "lV2DXfwv5lhTQwW6MzoG"
+#define TEAM_12_DEVICE_ACCESS_TOKEN       "XlTbeqQT5BKwQoAxGMo5"
+#define TEAM_13_DEVICE_ACCESS_TOKEN       "aLn2Dq7f1nV1U3BRvEx8"
+#define TEAM_14_DEVICE_ACCESS_TOKEN       "gn6Ekfs2GVgpPBbMbHXF"
+#define TEAM_15_DEVICE_ACCESS_TOKEN       "Jlc3BQeo2M1wOppcpVwj"
+#define TEAM_16_DEVICE_ACCESS_TOKEN       "7mntZH1zP8OeRVu4KD0X"
+#define TEAM_17_DEVICE_ACCESS_TOKEN       "N2nUJz893vCEvENkp61U"
+#define TEAM_18_DEVICE_ACCESS_TOKEN       "IxSysaYPNAxuPktRmHOZ"
+#define TEAM_19_DEVICE_ACCESS_TOKEN       "EUYAHoNEYAXnAn0VL8uD"
+#define TEAM_20_DEVICE_ACCESS_TOKEN       "9SNTcr66gU9R9mnt7M7W"
+
+
+#endif
\ No newline at end of file
--- a/wifi-ism43362.lib	Wed Aug 01 23:01:53 2018 +0000
+++ b/wifi-ism43362.lib	Fri Aug 17 14:57:03 2018 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/wifi-ism43362/#a6e22ee7a226fbb4f5546b6fc39620d4ecb7ec7e
+https://github.com/ARMmbed/wifi-ism43362/#9ee7fb19814e46b6e90b1eaec26ef36b523ec024