CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
Ardupilot

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: Ardupilot/ardupilot
Path: blob/master/libraries/AP_GPS/RTCM3_Parser.h
Views: 1798
1
/*
2
This program is free software: you can redistribute it and/or modify
3
it under the terms of the GNU General Public License as published by
4
the Free Software Foundation, either version 3 of the License, or
5
(at your option) any later version.
6
7
This program is distributed in the hope that it will be useful,
8
but WITHOUT ANY WARRANTY; without even the implied warranty of
9
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
GNU General Public License for more details.
11
12
You should have received a copy of the GNU General Public License
13
along with this program. If not, see <http://www.gnu.org/licenses/>.
14
*/
15
/*
16
RTCMv3 parser, used to support moving baseline RTK mode between two
17
GPS modules
18
*/
19
#pragma once
20
#include <stdint.h>
21
22
// maximum packet length with MAVLink GPS_RTCM_DATA is 4*180 as we
23
// handle up to 4 fragments
24
#define RTCM3_MAX_PACKET_LEN 720
25
26
class RTCM3_Parser {
27
public:
28
// process one byte, return true if packet found
29
bool read(uint8_t b);
30
31
// reset internal state
32
void reset(void);
33
34
// clear previous packet
35
void clear_packet(void);
36
37
// return length of found packet
38
uint16_t get_len(const uint8_t *&bytes) const;
39
40
// return ID of found packet
41
uint16_t get_id(void) const;
42
43
private:
44
const uint8_t RTCMv3_PREAMBLE = 0xD3;
45
46
// raw packet, we shouldn't need over 600 bytes for the MB configs we use
47
uint8_t pkt[RTCM3_MAX_PACKET_LEN];
48
49
// number of bytes in pkt[]
50
uint16_t pkt_bytes;
51
52
// length from header
53
uint16_t pkt_len;
54
55
// length of found packet
56
uint16_t found_len;
57
58
bool parse(void);
59
void resync(void);
60
};
61
62
63