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 {
559559 * */
560560 mesh_error_t enable_statistics (void );
561561
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+
562572 /* *
563573 * \brief Reads Wi-SUN network statistics
564574 *
Original file line number Diff line number Diff line change @@ -603,6 +603,16 @@ mesh_error_t WisunInterface::enable_statistics(void)
603603 return ret_val;
604604}
605605
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+
606616mesh_error_t WisunInterface::read_nw_statistics (mesh_nw_statistics_t *statistics)
607617{
608618 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);
125125 */
126126int wisun_tasklet_statistics_start (void );
127127
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+
128136/*
129137 * \brief Reads Wi-SUN network statistics
130138 *
Original file line number Diff line number Diff line change @@ -624,6 +624,18 @@ int wisun_tasklet_statistics_start(void)
624624 return 0 ;
625625}
626626
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+
627639static void wisun_tasklet_statistics_do_start (void )
628640{
629641 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