-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathdecodertab.cpp
114 lines (95 loc) · 3.75 KB
/
decodertab.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#include "decodertab.h"
#include <QtGui>
#include <QGroupBox>
#include <QLabel>
#include <QGridLayout>
#include <QVBoxLayout>
DecoderTab::DecoderTab(QWidget *parent) :
QWidget(parent)
{
//group box for decoder statistics
QGroupBox *decoderStatsGroup = new QGroupBox("Decoder Statistics");
//labels
QLabel *inputBytesLabel = new QLabel("Number of input bytes");
QLabel *candidateMessagesLabel = new QLabel("Number of candidate payloads");
QLabel *overLengthMessagesLabel = new QLabel("Number of overlength messages");
QLabel *lengthOddPayloadsLabel = new QLabel("Number of odd length messages");
QLabel *manchesterInvalidLabel = new QLabel("Number of Manchester errors");
QLabel *checkSumErrorsLabel = new QLabel("Number of checksum errors");
QLabel *validMessagesLabel = new QLabel("Number of valid messages");
QLabel *seventyLabel = new QLabel("Number of messages containing 0x70");
QLabel *collisionsLabel = new QLabel("Number of message collisions");
//grid layout for stats labels and values
QGridLayout *decoderStatsLayout = new QGridLayout();
decoderStatsLayout->addWidget(inputBytesLabel, 0, 0);
decoderStatsLayout->addWidget(candidateMessagesLabel, 1, 0);
decoderStatsLayout->addWidget(overLengthMessagesLabel, 2, 0);
decoderStatsLayout->addWidget(lengthOddPayloadsLabel, 3, 0);
decoderStatsLayout->addWidget(manchesterInvalidLabel, 4, 0);
decoderStatsLayout->addWidget(checkSumErrorsLabel, 5, 0);
decoderStatsLayout->addWidget(validMessagesLabel, 6, 0);
decoderStatsLayout->addWidget(seventyLabel, 7, 0);
decoderStatsLayout->addWidget(collisionsLabel, 8, 0);
//values
numInputBytesLabel = new QLabel("0");
numCandidateMessagesLabel = new QLabel("0");
numOverLengthMessagesLabel = new QLabel("0");
numLengthOddPayloadsLabel = new QLabel("0");
numManchesterInvalidLabel = new QLabel("0");
numCheckSumErrorsLabel = new QLabel("0");
numValidMessagesLabel = new QLabel("0");
numSeventyLabel = new QLabel("0");
numCollisionLabel = new QLabel("0");
decoderStatsLayout->addWidget(numInputBytesLabel, 0, 1);
decoderStatsLayout->addWidget(numCandidateMessagesLabel, 1, 1);
decoderStatsLayout->addWidget(numOverLengthMessagesLabel, 2, 1);
decoderStatsLayout->addWidget(numLengthOddPayloadsLabel, 3, 1);
decoderStatsLayout->addWidget(numManchesterInvalidLabel, 4, 1);
decoderStatsLayout->addWidget(numCheckSumErrorsLabel, 5, 1);
decoderStatsLayout->addWidget(numValidMessagesLabel, 6, 1);
decoderStatsLayout->addWidget(numSeventyLabel, 7, 1);
decoderStatsLayout->addWidget(numCollisionLabel, 8, 1);
decoderStatsGroup->setLayout(decoderStatsLayout);
//vertical layout down the tab
QVBoxLayout *vlayout = new QVBoxLayout();
vlayout->addWidget(decoderStatsGroup);
vlayout->addStretch();
//set the layout for the whole tab
this->setLayout(vlayout);
}
void DecoderTab::inputByteCount(quint32 n)
{
numInputBytesLabel->setNum((int)n);
}
void DecoderTab::candidatePayloadCount(quint32 n)
{
numCandidateMessagesLabel->setNum((int)n);
}
void DecoderTab::overLengthMessageCount(quint32 n)
{
numOverLengthMessagesLabel->setNum((int)n);
}
void DecoderTab::lengthOddCount(quint32 n)
{
numLengthOddPayloadsLabel->setNum((int)n);
}
void DecoderTab::manchesterInvalidCount(quint32 n)
{
numManchesterInvalidLabel->setNum((int)n);
}
void DecoderTab::checkSumErrorCount(quint32 n)
{
numCheckSumErrorsLabel->setNum((int)n);
}
void DecoderTab::validMessageCount(quint32 n)
{
numValidMessagesLabel->setNum((int)n);
}
void DecoderTab::seventyCount(quint32 n)
{
numSeventyLabel->setNum((int)n);
}
void DecoderTab::collisionCount(quint32 n)
{
numCollisionLabel->setNum((int)n);
}