session file records how the source was reached
A session is named <host>_<port>.toml, which cannot say whether that source was multicast or which interface it joined on, so a chooser row could not reconnect to one. Both go in the top block: a bare key after a [[table]] header belongs to that table, which is how the enabled key was lost once.
This commit is contained in:
1 parent
a066d48a3a
commit
c604d62917
2 files changed
+15
No files matched your search
@@ -242,6 +242,10 @@ bool load_layout(const std::string& path, LayoutState& out) {
|
|||||||
plot_count = std::max(0, std::stoi(value));
|
plot_count = std::max(0, std::stoi(value));
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
}
|
}
|
||||||
|
} else if (key == "multicast") {
|
||||||
|
st.multicast = strip_quote(value);
|
||||||
|
} else if (key == "interface") {
|
||||||
|
st.interface_addr = strip_quote(value);
|
||||||
}
|
}
|
||||||
} else if (section == Section::Plot && !st.rows.empty()) {
|
} else if (section == Section::Plot && !st.rows.empty()) {
|
||||||
if (key == "signals") {
|
if (key == "signals") {
|
||||||
@@ -325,6 +329,11 @@ bool save_layout(const std::string& path, const LayoutState& state) {
|
|||||||
o << "# udpscope session layout (written by the app; safe to edit)\n";
|
o << "# udpscope session layout (written by the app; safe to edit)\n";
|
||||||
if (state.window_s > 0.0) o << "window_s = " << state.window_s << "\n";
|
if (state.window_s > 0.0) o << "window_s = " << state.window_s << "\n";
|
||||||
o << "plots = " << state.rows.size() << "\n";
|
o << "plots = " << state.rows.size() << "\n";
|
||||||
|
// Top level, before any table, for the same reason as `enabled` below.
|
||||||
|
if (!state.multicast.empty()) o << "multicast = " << toml_escape(state.multicast) << "\n";
|
||||||
|
if (!state.interface_addr.empty()) {
|
||||||
|
o << "interface = " << toml_escape(state.interface_addr) << "\n";
|
||||||
|
}
|
||||||
// Top level, before any table. Emitted after the `[[calibration]]` tables it belonged to the last
|
// Top level, before any table. Emitted after the `[[calibration]]` tables it belonged to the last
|
||||||
// of them -- a bare key after a header is that table's key in TOML -- so the parser, correctly,
|
// of them -- a bare key after a header is that table's key in TOML -- so the parser, correctly,
|
||||||
// never saw it and a session's enable state was silently lost.
|
// never saw it and a session's enable state was silently lost.
|
||||||
|
|||||||
@@ -37,6 +37,12 @@ struct LayoutState {
|
|||||||
/// identity here, because a CONFIG renumbers the channels.
|
/// identity here, because a CONFIG renumbers the channels.
|
||||||
std::vector<std::string> enabled;
|
std::vector<std::string> enabled;
|
||||||
|
|
||||||
|
/// How this source was reached, so the startup chooser can reconnect to it exactly. The file is
|
||||||
|
/// named `<host>_<port>.toml` and that name can say neither of these. Empty `multicast` is
|
||||||
|
/// unicast; empty `interface_addr` is the default route.
|
||||||
|
std::string multicast;
|
||||||
|
std::string interface_addr;
|
||||||
|
|
||||||
/// The derived channels, graphs and all: the editor's work is part of the session, not of the
|
/// The derived channels, graphs and all: the editor's work is part of the session, not of the
|
||||||
/// process. A graph is stored as one string per node so the file stays in this store's TOML
|
/// process. A graph is stored as one string per node so the file stays in this store's TOML
|
||||||
/// subset (tables, string arrays, scalars) rather than growing a nested-table parser for it; see
|
/// subset (tables, string arrays, scalars) rather than growing a nested-table parser for it; see
|
||||||
|
|||||||
Reference in new issue
Block a user