OpenCPN Partial API docs
Loading...
Searching...
No Matches
comm_decoder.h
1/***************************************************************************
2 *
3 * Project: OpenCPN
4 * Purpose:
5 *
6 * Author: David Register, Alec Leamas
7 *
8 ***************************************************************************
9 * Copyright (C) 2022 by David Register, Alec Leamas *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * GNU General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU General Public License *
22 * along with this program; if not, write to the *
23 * Free Software Foundation, Inc., *
24 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
25 **************************************************************************/
26
27#ifndef _COMM_DECODER_H
28#define _COMM_DECODER_H
29
30#include <memory>
31#include <string>
32
33#include "rapidjson/fwd.h"
34#include <wx/string.h>
35
36#include "comm_appmsg.h"
37#include "nmea0183.h"
38#include "N2KParser.h"
39
40
42typedef struct{
43 double gLat;
44 double gLon;
45 double gSog;
46 double gCog;
47 double gHdt;
48 double gHdm;
49 double gVar;
50 int n_satellites;
51 int SID;
52} NavData;
53
59public:
60 CommDecoder(){};
61 ~CommDecoder(){};
62
63 // NMEA0183 decoding, by sentence.
64 bool DecodeRMC(std::string s, NavData& temp_data);
65 bool DecodeHDM(std::string s, NavData& temp_data);
66 bool DecodeHDT(std::string s, NavData& temp_data);
67 bool DecodeHDG(std::string s, NavData& temp_data);
68 bool DecodeVTG(std::string s, NavData& temp_data);
69 bool DecodeGSV(std::string s, NavData& temp_data);
70 bool DecodeGGA(std::string s, NavData& temp_data);
71 bool DecodeGLL(std::string s, NavData& temp_data);
72
73 bool ParsePosition(const LATLONG& Position, double& lat, double& lon);
74
75 NMEA0183 m_NMEA0183; // Used to parse messages from NMEA threads
76
77 // NMEA2000 decoding, by PGN
78 bool DecodePGN129025(std::vector<unsigned char> v, NavData& temp_data);
79 bool DecodePGN129026(std::vector<unsigned char> v, NavData& temp_data);
80 bool DecodePGN129029(std::vector<unsigned char> v, NavData& temp_data);
81 bool DecodePGN127250(std::vector<unsigned char> v, NavData& temp_data);
82 bool DecodePGN129540(std::vector<unsigned char> v, NavData& temp_data);
83
84 // SignalK
85 bool DecodeSignalK(std::string s, NavData& temp_data);
86 void handleUpdate(const rapidjson::Value &update, NavData& temp_data);
87 void updateItem(const rapidjson::Value &item, wxString &sfixtime, NavData& temp_data);
88 bool updateNavigationPosition(const rapidjson::Value &value,
89 const wxString &sfixtime, NavData& temp_data);
90 void updateNavigationSpeedOverGround(const rapidjson::Value &value,
91 const wxString &sfixtime, NavData& temp_data);
92 void updateNavigationCourseOverGround(const rapidjson::Value &value,
93 const wxString &sfixtime, NavData& temp_data);
94 void updateGnssSatellites(const rapidjson::Value &value, const wxString &sfixtime, NavData& temp_data);
95 void updateHeadingTrue(const rapidjson::Value &value, const wxString &sfixtime, NavData& temp_data);
96 void updateHeadingMagnetic(const rapidjson::Value &value,
97 const wxString &sfixtime, NavData& temp_data);
98 void updateMagneticVariance(const rapidjson::Value &value,
99 const wxString &sfixtime, NavData& temp_data);
100
101
102};
103
104#endif // _COMM_DECODER_H
Decode received NMEA messages and update global values from comm_vars.h and own_ship....
Definition: comm_decoder.h:58
GNSS Lat/Long container.
Definition: comm_appmsg.h:45
Actual own ship state.
Definition: comm_decoder.h:42