OpenCPN Partial API docs
Loading...
Searching...
No Matches
data_monitor.h
Go to the documentation of this file.
1/***************************************************************************
2 * Copyright (C) 2025 Alec Leamas *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
18 **************************************************************************/
19
25#ifndef DATA_MONITOR_DLG__
26#define DATA_MONITOR_DLG__
27
28#include <iostream> // debug junk
29#include <functional>
30#include <fstream>
31
32#include <wx/frame.h>
33
35#include "tty_scroll.h"
36#include "std_filesystem.h"
42public:
43 enum class Format { kVdr, kDefault, kCsv };
44
45 DataLogger(wxWindow* parent, const fs::path& path);
46
47 DataLogger(wxWindow* parent);
48
49 void SetLogging(bool logging);
50
51 void SetLogfile(const fs::path& path);
52
53 fs::path GetLogfile() const { return m_path; }
54
55 void Add(const Logline& ll);
56
57 void SetFormat(Format format);
58
59 fs::path NullLogfile();
60
61 std::string GetFileDlgTypes();
62
63 fs::path GetDefaultLogfile();
64
67
68private:
69 wxWindow* m_parent;
70 fs::path m_path;
71 std::ofstream m_stream;
72 bool m_is_logging;
73 Format m_format;
74 const NavmsgTimePoint m_log_start;
75};
76
78class DataMonitor : public wxFrame, public NmeaLog {
79public:
80 DataMonitor(wxWindow* parent);
81
83 void Add(const Logline& ll) override;
84
85 virtual bool IsVisible() const override;
86
87private:
88 void OnFilterListChange();
89 void OnFilterUpdate(const std::string& name);
90 void OnFilterApply(const std::string& name);
91
92 DataMonitorSrc m_monitor_src;
93 wxWindow* m_quick_filter;
94 DataLogger m_logger;
95 ObsListener m_filter_list_lstnr;
96 ObsListener m_filter_update_lstnr;
97 ObsListener m_filter_apply_lstnr;
98 std::string m_current_filter;
99};
100
101#endif // DATA_MONITOR_DLG__
Internal helper class.
EventVar OnNewLogfile
Notified with new path on filename change.
Create a stream of input messages.
Overall logging handler, outputs to screen and log file.
void Add(const Logline &ll) override
Add an input line to log output.
virtual bool IsVisible() const override
Return true if log is visible i.
Generic event handling between MVC Model and Controller based on a shared EventVar variable.
Define an action to be performed when a KeyProvider is notified.
Definition observable.h:228
Provide a data stream of input messages for the Data Monitor.
Item in the log window.
Definition nmea_log.h:10
Scrolled TTY-like window for logging, related utilities.