mirror of https://github.com/ARMmbed/mbed-os.git
Added API to reset MAC statistics and Wi-SUN statistics.
parent
769fc9da70
commit
41ddf0ed64
|
@ -526,6 +526,16 @@ public:
|
||||||
* */
|
* */
|
||||||
mesh_error_t enable_statistics(void);
|
mesh_error_t enable_statistics(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Reset Wi-SUN statistics
|
||||||
|
*
|
||||||
|
* Resets MAC statistics and Wi-SUN statistics.
|
||||||
|
*
|
||||||
|
* \return MESH_ERROR_NONE on success.
|
||||||
|
* \return MESH_ERROR_UNKNOWN on error
|
||||||
|
* */
|
||||||
|
mesh_error_t reset_statistics(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief Reads Wi-SUN network statistics
|
* \brief Reads Wi-SUN network statistics
|
||||||
*
|
*
|
||||||
|
|
|
@ -563,6 +563,16 @@ mesh_error_t WisunInterface::enable_statistics(void)
|
||||||
return ret_val;
|
return ret_val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mesh_error_t WisunInterface::reset_statistics(void)
|
||||||
|
{
|
||||||
|
mesh_error_t ret_val = MESH_ERROR_NONE;
|
||||||
|
int status = wisun_tasklet_statistics_reset();
|
||||||
|
if (status < 0) {
|
||||||
|
ret_val = MESH_ERROR_UNKNOWN;
|
||||||
|
}
|
||||||
|
return ret_val;
|
||||||
|
}
|
||||||
|
|
||||||
mesh_error_t WisunInterface::read_nw_statistics(mesh_nw_statistics_t *statistics)
|
mesh_error_t WisunInterface::read_nw_statistics(mesh_nw_statistics_t *statistics)
|
||||||
{
|
{
|
||||||
mesh_error_t ret_val = MESH_ERROR_NONE;
|
mesh_error_t ret_val = MESH_ERROR_NONE;
|
||||||
|
|
|
@ -125,6 +125,14 @@ int wisun_tasklet_remove_trusted_certificates(void);
|
||||||
*/
|
*/
|
||||||
int wisun_tasklet_statistics_start(void);
|
int wisun_tasklet_statistics_start(void);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \brief Reset Wi-SUN statistics
|
||||||
|
*
|
||||||
|
* \return 0 Statistics start successful
|
||||||
|
* \return < 0 in case of errors
|
||||||
|
*/
|
||||||
|
int wisun_tasklet_statistics_reset(void);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Reads Wi-SUN network statistics
|
* \brief Reads Wi-SUN network statistics
|
||||||
*
|
*
|
||||||
|
|
|
@ -624,6 +624,18 @@ int wisun_tasklet_statistics_start(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int wisun_tasklet_statistics_reset(void)
|
||||||
|
{
|
||||||
|
if (!statistics) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(&statistics->mac_statistics, 0, sizeof(mac_statistics_t));
|
||||||
|
memset(&statistics->ws_statistics, 0, sizeof(ws_statistics_t));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void wisun_tasklet_statistics_do_start(void)
|
static void wisun_tasklet_statistics_do_start(void)
|
||||||
{
|
{
|
||||||
if (!wisun_tasklet_data_ptr || wisun_tasklet_data_ptr->network_interface_id < 0 || !mac_api) {
|
if (!wisun_tasklet_data_ptr || wisun_tasklet_data_ptr->network_interface_id < 0 || !mac_api) {
|
||||||
|
|
Loading…
Reference in New Issue