forked from projecthorus/radiosonde_auto_rx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathM10GeneralParser.cpp
108 lines (85 loc) · 2 KB
/
M10GeneralParser.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
/*
* File: M10GeneralParser.cpp
* Author: Viproz
* Used code from rs1729
* Created on December 12, 2018, 10:52 PM
*/
#include <string>
#include <sstream>
#include <iostream>
#include "M10GeneralParser.h"
#include "M10TrimbleParser.h"
M10GeneralParser::M10GeneralParser() {
}
M10GeneralParser::~M10GeneralParser() {
}
void M10GeneralParser::changeData(std::array<unsigned char, DATA_LENGTH> data, bool good) {
correctCRC = good;
frame_bytes = data;
frameLength = frame_bytes[0];
}
double M10GeneralParser::getLatitude() {
return 0;
}
double M10GeneralParser::getLongitude() {
return 0;
}
double M10GeneralParser::getAltitude() {
return 0;
}
int M10GeneralParser::getDay() {
return 0;
}
int M10GeneralParser::getMonth() {
return 0;
}
int M10GeneralParser::getYear() {
return 0;
}
int M10GeneralParser::getHours() {
return 0;
}
int M10GeneralParser::getMinutes() {
return 0;
}
int M10GeneralParser::getSeconds() {
return 0;
}
double M10GeneralParser::getVerticalSpeed() {
return 0;
}
double M10GeneralParser::getHorizontalSpeed() {
return 0;
}
double M10GeneralParser::getDirection() {
return 0;
}
std::string M10GeneralParser::getSerialNumber() {
return "";
}
std::array<unsigned char, DATA_LENGTH> M10GeneralParser::replaceWithPrevious(std::array<unsigned char, DATA_LENGTH> data) {
return data;
}
void M10GeneralParser::addToStats() {
for (int i = 0; i < DATA_LENGTH; ++i) {
++statValues[i][frame_bytes[i]];
}
}
void M10GeneralParser::printStatsFrame() {
unsigned short valMax;
unsigned short posMax;
for (int i = 0; i < FRAME_LEN; ++i) {
valMax = 0;
posMax = 0;
for (unsigned short k = 0; k < 0xFF+1; ++k) { // Find maximum
if (statValues[i][k] > valMax) {
valMax = statValues[i][k];
posMax = k;
}
}
frame_bytes[i] = posMax;
}
changeData(frame_bytes, false);
printf("Stats frame:\n");
printFrame();
}