Skyward boardcore
Loading...
Searching...
No Matches
XbeeStatus.h
Go to the documentation of this file.
1/* Copyright (c) 2019 Skyward Experimental Rocketry
2 * Author: Luca Erbetta
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 * THE SOFTWARE.
21 */
22
23#pragma once
24
25#include <utils/Stats/Stats.h>
26
27#include <cstdint>
28#include <cstdio>
29#include <ostream>
30#include <string>
31
32namespace Boardcore
33{
34
35namespace Xbee
36{
37
39{
40 long long timestamp = 0LL;
41
42 uint8_t lastTxStatusError = 0;
43 uint8_t lastTxStatus = 0;
44
46
47 unsigned int txTimeoutCount = 0;
48
49 unsigned int rxDroppedBuffers = 0;
50
51 unsigned int frameBufMaxLength = 0;
52
53 static std::string header()
54 {
55 return "timestamp,last_tx_status_error,last_tx_status,tts_stats.min,"
56 "tts_stats.max,tts_stats.mean,tts_stats.stddev,tts_stats.n_"
57 "samples,tx_timeout_count,rx_dropped_buffers,frame_buf_max_"
58 "length\n";
59 }
60
61 void print(std::ostream& os) const
62 {
63 os << timestamp << "," << (int)lastTxStatusError << ","
64 << (int)lastTxStatus << "," << timeToSendStats.minValue << ","
67 << txTimeoutCount << "," << rxDroppedBuffers << ","
68 << frameBufMaxLength << "\n";
69 }
70};
71
72} // namespace Xbee
73
74} // namespace Boardcore
This file includes all the types the logdecoder script will decode.
Statistics computed by the Stats class.
Definition Stats.h:35
float maxValue
Max value found so far.
Definition Stats.h:37
float stdDev
Standard deviation of dataset.
Definition Stats.h:39
uint32_t nSamples
Number of samples.
Definition Stats.h:40
float mean
Mean of dataset.
Definition Stats.h:38
float minValue
Min value found so far.
Definition Stats.h:36
unsigned int frameBufMaxLength
Definition XbeeStatus.h:51
unsigned int rxDroppedBuffers
Definition XbeeStatus.h:49
static std::string header()
Definition XbeeStatus.h:53
void print(std::ostream &os) const
Definition XbeeStatus.h:61