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 @@ -556,6 +556,16 @@ class WisunInterface : public MeshInterfaceNanostack {
556
556
* */
557
557
mesh_error_t enable_statistics (void );
558
558
559
+ /* *
560
+ * \brief Reset Wi-SUN statistics
561
+ *
562
+ * Resets MAC statistics and Wi-SUN statistics.
563
+ *
564
+ * \return MESH_ERROR_NONE on success.
565
+ * \return MESH_ERROR_UNKNOWN on error
566
+ * */
567
+ mesh_error_t reset_statistics (void );
568
+
559
569
/* *
560
570
* \brief Reads Wi-SUN network statistics
561
571
*
Original file line number Diff line number Diff line change @@ -563,6 +563,16 @@ mesh_error_t WisunInterface::enable_statistics(void)
563
563
return ret_val;
564
564
}
565
565
566
+ mesh_error_t WisunInterface::reset_statistics (void )
567
+ {
568
+ mesh_error_t ret_val = MESH_ERROR_NONE;
569
+ int status = wisun_tasklet_statistics_reset ();
570
+ if (status < 0 ) {
571
+ ret_val = MESH_ERROR_UNKNOWN;
572
+ }
573
+ return ret_val;
574
+ }
575
+
566
576
mesh_error_t WisunInterface::read_nw_statistics (mesh_nw_statistics_t *statistics)
567
577
{
568
578
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