dlmstp statistics enhancements (#235)

- Add lost-token count
- Add invalid-frame-received count
- Add function to reset statistics
- Add function to retrieve statistics
This commit is contained in:
Nick Schaf
2022-02-28 17:40:32 -06:00
committed by GitHub
parent 728b17f11f
commit 585cdb4a7d
2 changed files with 42 additions and 13 deletions
+20
View File
@@ -44,6 +44,16 @@ typedef struct dlmstp_packet {
uint8_t pdu[DLMSTP_MPDU_MAX]; /* packet */
} DLMSTP_PACKET;
/* container for packet and token statistics */
typedef struct dlmstp_statistics {
uint32_t transmit_frame_counter;
uint32_t receive_valid_frame_counter;
uint32_t receive_invalid_frame_counter;
uint32_t transmit_pdu_counter;
uint32_t receive_pdu_counter;
uint32_t lost_token_counter;
} DLMSTP_STATISTICS;
/* callback to signify the receipt of a preamble */
typedef void (*dlmstp_hook_frame_rx_start_cb)();
@@ -172,6 +182,16 @@ extern "C" {
void dlmstp_set_frame_rx_start_callback(
dlmstp_hook_frame_rx_start_cb cb_func);
/* Reset the statistics counters on the MS/TP datalink */
BACNET_STACK_EXPORT
void dlmstp_reset_statistics(void);
/* Retrieve statistics counters from the MS/TP datalink */
/* Values for the current counters at the time this function is called */
/* will be copied into *statistics */
BACNET_STACK_EXPORT
void dlmstp_fill_statistics(struct dlmstp_statistics * statistics);
#ifdef __cplusplus
}
#endif /* __cplusplus */