27 #ifndef _COMM_BRIDGE_H
28 #define _COMM_BRIDGE_H
32 #include <unordered_map>
38 #include "model/comm_decoder.h"
39 #include "model/comm_navmsg.h"
45 std::string active_source;
46 std::string active_identifier;
47 int active_source_address;
51 int position_watchdog;
52 int variation_watchdog;
54 int velocity_watchdog;
55 int satellite_watchdog;
66 void InitCommListeners();
68 bool HandleN2K_129029(std::shared_ptr<const Nmea2000Msg> n2k_msg);
69 bool HandleN2K_129025(std::shared_ptr<const Nmea2000Msg> n2k_msg);
70 bool HandleN2K_129026(std::shared_ptr<const Nmea2000Msg> n2k_msg);
71 bool HandleN2K_127250(std::shared_ptr<const Nmea2000Msg> n2k_msg);
72 bool HandleN2K_129540(std::shared_ptr<const Nmea2000Msg> n2k_msg);
74 bool HandleN0183_RMC(std::shared_ptr<const Nmea0183Msg> n0183_msg);
75 bool HandleN0183_HDT(std::shared_ptr<const Nmea0183Msg> n0183_msg);
76 bool HandleN0183_HDG(std::shared_ptr<const Nmea0183Msg> n0183_msg);
77 bool HandleN0183_HDM(std::shared_ptr<const Nmea0183Msg> n0183_msg);
78 bool HandleN0183_VTG(std::shared_ptr<const Nmea0183Msg> n0183_msg);
79 bool HandleN0183_GSV(std::shared_ptr<const Nmea0183Msg> n0183_msg);
80 bool HandleN0183_GGA(std::shared_ptr<const Nmea0183Msg> n0183_msg);
81 bool HandleN0183_GLL(std::shared_ptr<const Nmea0183Msg> n0183_msg);
82 bool HandleN0183_AIVDO(std::shared_ptr<const Nmea0183Msg> n0183_msg);
84 bool HandleSignalK(std::shared_ptr<const SignalkMsg> sK_msg);
86 void OnDriverStateChange();
88 void OnWatchdogTimer(wxTimerEvent& event);
89 bool EvalPriority(std::shared_ptr <const NavMsg> msg,
91 std::unordered_map<std::string, int>& priority_map);
92 std::string GetPriorityKey(std::shared_ptr <const NavMsg> msg);
94 std::vector<std::string> GetPriorityMaps();
97 void UpdateAndApplyMaps(std::vector<std::string> new_maps);
98 bool LoadConfig(
void );
99 bool SaveConfig(
void );
102 wxTimer m_watchdog_timer;
128 void PresetWatchdogs();
129 void MakeHDTFromHDM();
130 void InitializePriorityContainers();
131 void PresetPriorityContainers();
133 std::string GetPriorityMap(std::unordered_map<std::string, int> &map);
134 void ApplyPriorityMap(std::unordered_map<std::string, int>& priority_map,
135 wxString &new_prio,
int category);
136 void ApplyPriorityMaps(std::vector<std::string> new_maps);
138 void ClearPriorityMaps();
140 const std::unordered_map<std::string, int> &priority_map);
141 void SelectNextLowerPriority(
const std::unordered_map<std::string, int> &map,
151 std::unordered_map<std::string, int> priority_map_position;
152 std::unordered_map<std::string, int> priority_map_velocity;
153 std::unordered_map<std::string, int> priority_map_heading;
154 std::unordered_map<std::string, int> priority_map_variation;
155 std::unordered_map<std::string, int> priority_map_satellites;
157 int n_LogWatchdogPeriod;
159 DECLARE_EVENT_TABLE()
Keeps listening over it's lifespan, removes itself on destruction.