diff --git a/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunInterface.h b/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunInterface.h index 0c0407c..189c832 100644 --- a/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunInterface.h +++ b/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/WisunInterface.h @@ -67,6 +67,37 @@ const int8_t *cca_threshold_table; } ws_cca_threshold_table_t; +typedef enum { + WISUN_OTHER = 0, /**< temporary or soon to be removed neighbor*/ + WISUN_PRIMARY_PARENT, /**< Primary parent used for upward packets and used from Border router downwards*/ + WISUN_SECONDARY_PARENT, /**< Secondary parent reported to border router and might be used as alternate route*/ + WISUN_CANDIDATE_PARENT, /**< Candidate neighbor that is considered as parent if there is problem with active parents*/ + WISUN_CHILD /**< Child with registered address*/ +} ws_nbr_type_e; + +/** + * \brief Struct ws_nbr_info_t Gives the neighbor information. + */ +typedef struct ws_nbr_info { + /** Link local address*/ + uint8_t link_local_address[16]; + /** Global address if it is known set to 0 if not available*/ + uint8_t global_address[16]; + /** parent RSSI Out measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/ + uint8_t rsl_out; + /** parent RSSI in measured RSSI value calculated using EWMA specified by Wi-SUN from range of -174 (0) to +80 (254) dBm.*/ + uint8_t rsl_in; + /** RPL Rank value for parents 0xffff for neighbors RANK is unknown*/ + uint16_t rpl_rank; + /** Measured ETX value if known set to 0xFFFF if not known or Child*/ + uint16_t etx; + /** Remaining lifetime Link lifetime for parents and ARO lifetime for children*/ + uint32_t lifetime; + /** Neighbour type (Primary Parent, Secondary Parent, Candidate parent, child, other(Temporary neighbours))*/ + ws_nbr_type_e type; +} ws_nbr_info_t; + + /** Wi-SUN mesh network interface class * * Configure Nanostack to use Wi-SUN protocol. @@ -578,6 +609,20 @@ * */ mesh_error_t cca_threshold_table_get(ws_cca_threshold_table_t *table); + /** + * \brief Get Wi-SUN Neighbor table information. + * + * To allocate correct amount of memory first use the API with nbr_ptr = NULL to get current amount + * of neighbors in count pointer. Then Allocate the memory and call the function to fill the table. + * + * \param nbr_ptr Pointer to memory where Neighbor table entries can be written. + * \param count amount of neighbor table entries allocated to memory. + * + * \return MESH_ERROR_NONE on success. + * \return MESH_ERROR_UNKNOWN in case of failure. + * */ + mesh_error_t nbr_info_get(ws_nbr_info_t *nbr_ptr, uint16_t *count); + protected: Nanostack::WisunInterface *get_interface() const; nsapi_error_t do_initialize() override; diff --git a/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/mesh_interface_types.h b/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/mesh_interface_types.h index d2e89d2..f60d216 100644 --- a/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/mesh_interface_types.h +++ b/connectivity/nanostack/mbed-mesh-api/mbed-mesh-api/mesh_interface_types.h @@ -83,6 +83,23 @@ uint16_t etx_2nd_parent; /*etx_2nd_parent = statistics->nwk_stats.etx_2nd_parent; stats->asynch_tx_count = statistics->ws_statistics.asynch_tx_count; stats->asynch_rx_count = statistics->ws_statistics.asynch_rx_count; + stats->join_state_1 = statistics->ws_statistics.join_state_1; + stats->join_state_2 = statistics->ws_statistics.join_state_2; + stats->join_state_3 = statistics->ws_statistics.join_state_3; + stats->join_state_4 = statistics->ws_statistics.join_state_4; + stats->join_state_5 = statistics->ws_statistics.join_state_5; + stats->sent_PAS = statistics->ws_statistics.sent_PAS; + stats->sent_PA = statistics->ws_statistics.sent_PA; + stats->sent_PCS = statistics->ws_statistics.sent_PCS; + stats->sent_PC = statistics->ws_statistics.sent_PC; + stats->recv_PAS = statistics->ws_statistics.recv_PAS; + stats->recv_PA = statistics->ws_statistics.recv_PA; + stats->recv_PCS = statistics->ws_statistics.recv_PCS; + stats->recv_PC = statistics->ws_statistics.recv_PC; + stats->Neighbour_add = statistics->ws_statistics.Neighbour_add; + stats->Neighbour_remove = statistics->ws_statistics.Neighbour_remove; + stats->Child_add = statistics->ws_statistics.Child_add; + stats->child_remove = statistics->ws_statistics.child_remove; return 0; }