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 {
508
508
* */
509
509
mesh_error_t enable_statistics (void );
510
510
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
+
511
521
/* *
512
522
* \brief Reads Wi-SUN network statistics
513
523
*
Original file line number Diff line number Diff line change @@ -565,6 +565,16 @@ mesh_error_t WisunInterface::enable_statistics(void)
565
565
return ret_val;
566
566
}
567
567
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
+
568
578
mesh_error_t WisunInterface::read_nw_statistics (mesh_nw_statistics_t *statistics)
569
579
{
570
580
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);
126
126
*/
127
127
int wisun_tasklet_statistics_start (void );
128
128
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
+
129
137
/*
130
138
* \brief Reads Wi-SUN network statistics
131
139
*
Original file line number Diff line number Diff line change @@ -625,6 +625,18 @@ int wisun_tasklet_statistics_start(void)
625
625
return 0 ;
626
626
}
627
627
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
+
628
640
static void wisun_tasklet_statistics_do_start (void )
629
641
{
630
642
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