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
34#include "data_monitor_src.h"
35#include "std_filesystem.h"
36
38public:
39 enum class Format { kVdr, kDefault, kCsv };
40
41 DataLogger(wxWindow* parent, const fs::path& path);
42
43 DataLogger(wxWindow* parent);
44
45 void SetLogging(bool logging);
46
47 void SetLogfile(const fs::path& path);
48
49 void Add(const Logline& ll);
50
51 void SetFormat(Format format);
52
53 fs::path GetLogfile() { return m_path; }
54
55private:
56 wxWindow* m_parent;
57 fs::path m_path;
58 std::ofstream m_stream;
59 bool m_is_logging;
60 Format m_format;
61
62 fs::path DefaultLogfile();
63};
64
66class DataMonitor : public wxFrame, public NmeaLog {
67public:
68 DataMonitor(wxWindow* parent);
69
71 void Add(std::string msg);
72
73 void Add(const Logline& ll) override;
74
75 bool IsActive() const override;
76
77private:
78 void OnFilterListChange();
79 void OnFilterUpdate(const std::string& name);
80 void OnFilterApply(const std::string& name);
81
82 DataMonitorSrc m_monitor_src;
83 wxWindow* m_quick_filter;
84 DataLogger m_logger;
85 ObsListener m_filter_list_lstnr;
86 ObsListener m_filter_update_lstnr;
87 ObsListener m_filter_apply_lstnr;
88};
89
90#endif // DATA_MONITOR_DLG__
Create a stream of input messages.
Overall logging handler, outputs to screen and log file.
bool IsActive() const override
Return true if log is visible i.
void Add(std::string msg)
Add an input line to log output.
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