File tree Expand file tree Collapse file tree 4 files changed +40
-0
lines changed
features/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 @@ -559,6 +559,16 @@ class WisunInterface : public MeshInterfaceNanostack {
559
559
* */
560
560
mesh_error_t enable_statistics (void );
561
561
562
+ /* *
563
+ * \brief Reset Wi-SUN statistics
564
+ *
565
+ * Resets MAC statistics and Wi-SUN statistics.
566
+ *
567
+ * \return MESH_ERROR_NONE on success.
568
+ * \return MESH_ERROR_UNKNOWN on error
569
+ * */
570
+ mesh_error_t reset_statistics (void );
571
+
562
572
/* *
563
573
* \brief Reads Wi-SUN network statistics
564
574
*
Original file line number Diff line number Diff line change @@ -603,6 +603,16 @@ mesh_error_t WisunInterface::enable_statistics(void)
603
603
return ret_val;
604
604
}
605
605
606
+ mesh_error_t WisunInterface::reset_statistics (void )
607
+ {
608
+ mesh_error_t ret_val = MESH_ERROR_NONE;
609
+ int status = wisun_tasklet_statistics_reset ();
610
+ if (status < 0 ) {
611
+ ret_val = MESH_ERROR_UNKNOWN;
612
+ }
613
+ return ret_val;
614
+ }
615
+
606
616
mesh_error_t WisunInterface::read_nw_statistics (mesh_nw_statistics_t *statistics)
607
617
{
608
618
mesh_error_t ret_val = MESH_ERROR_NONE;
Original file line number Diff line number Diff line change @@ -125,6 +125,14 @@ int wisun_tasklet_remove_trusted_certificates(void);
125
125
*/
126
126
int wisun_tasklet_statistics_start (void );
127
127
128
+ /*
129
+ * \brief Reset Wi-SUN statistics
130
+ *
131
+ * \return 0 Statistics start successful
132
+ * \return < 0 in case of errors
133
+ */
134
+ int wisun_tasklet_statistics_reset (void );
135
+
128
136
/*
129
137
* \brief Reads Wi-SUN network statistics
130
138
*
Original file line number Diff line number Diff line change @@ -624,6 +624,18 @@ int wisun_tasklet_statistics_start(void)
624
624
return 0 ;
625
625
}
626
626
627
+ int wisun_tasklet_statistics_reset (void )
628
+ {
629
+ if (!statistics ) {
630
+ return -1 ;
631
+ }
632
+
633
+ memset (& statistics -> mac_statistics , 0 , sizeof (mac_statistics_t ));
634
+ memset (& statistics -> ws_statistics , 0 , sizeof (ws_statistics_t ));
635
+
636
+ return 0 ;
637
+ }
638
+
627
639
static void wisun_tasklet_statistics_do_start (void )
628
640
{
629
641
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