File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
connectivity/nanostack/mbed-mesh-api Expand file tree Collapse file tree 4 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -508,6 +508,16 @@ class WisunInterface final : public MeshInterfaceNanostack {
508508 * */
509509 mesh_error_t enable_statistics (void );
510510
511+ /* *
512+ * \brief Reset Wi-SUN statistics
513+ *
514+ * Resets MAC statistics and Wi-SUN statistics.
515+ *
516+ * \return MESH_ERROR_NONE on success.
517+ * \return MESH_ERROR_UNKNOWN on error
518+ * */
519+ mesh_error_t reset_statistics (void );
520+
511521 /* *
512522 * \brief Reads Wi-SUN network statistics
513523 *
Original file line number Diff line number Diff line change @@ -565,6 +565,16 @@ mesh_error_t WisunInterface::enable_statistics(void)
565565 return ret_val;
566566}
567567
568+ mesh_error_t WisunInterface::reset_statistics (void )
569+ {
570+ mesh_error_t ret_val = MESH_ERROR_NONE;
571+ int status = wisun_tasklet_statistics_reset ();
572+ if (status < 0 ) {
573+ ret_val = MESH_ERROR_UNKNOWN;
574+ }
575+ return ret_val;
576+ }
577+
568578mesh_error_t WisunInterface::read_nw_statistics (mesh_nw_statistics_t *statistics)
569579{
570580 mesh_error_t ret_val = MESH_ERROR_NONE;
Original file line number Diff line number Diff line change @@ -126,6 +126,14 @@ int wisun_tasklet_remove_trusted_certificates(void);
126126 */
127127int wisun_tasklet_statistics_start (void );
128128
129+ /*
130+ * \brief Reset Wi-SUN statistics
131+ *
132+ * \return 0 Statistics start successful
133+ * \return < 0 in case of errors
134+ */
135+ int wisun_tasklet_statistics_reset (void );
136+
129137/*
130138 * \brief Reads Wi-SUN network statistics
131139 *
Original file line number Diff line number Diff line change @@ -625,6 +625,18 @@ int wisun_tasklet_statistics_start(void)
625625 return 0 ;
626626}
627627
628+ int wisun_tasklet_statistics_reset (void )
629+ {
630+ if (!statistics ) {
631+ return -1 ;
632+ }
633+
634+ memset (& statistics -> mac_statistics , 0 , sizeof (mac_statistics_t ));
635+ memset (& statistics -> ws_statistics , 0 , sizeof (ws_statistics_t ));
636+
637+ return 0 ;
638+ }
639+
628640static void wisun_tasklet_statistics_do_start (void )
629641{
630642 if (!wisun_tasklet_data_ptr || wisun_tasklet_data_ptr -> network_interface_id < 0 || !mac_api ) {
You can’t perform that action at this time.
0 commit comments