Skip to content

Commit

Permalink
Make outInterval configurable.
Browse files Browse the repository at this point in the history
  • Loading branch information
horacekj committed Feb 3, 2024
1 parent 4dd77dd commit 90cfec6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/xn-lib-cpp-qt
Submodule xn-lib-cpp-qt updated 10 files
+2 −17 README.md
+1 −0 lib-api.cpp
+1 −0 lib-api.h
+22 −3 lib-main.cpp
+5 −4 lib-main.h
+1 −0 settings.h
+2 −2 xn-send.cpp
+15 −3 xn.cpp
+20 −6 xn.h
+1 −1 xn.pro
2 changes: 1 addition & 1 deletion rcs-xn.pro
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ QT += core gui serialport
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

VERSION_MAJOR = 1
VERSION_MINOR = 3
VERSION_MINOR = 4

DEFINES += "VERSION_MAJOR=$$VERSION_MAJOR" \
"VERSION_MINOR=$$VERSION_MINOR"
Expand Down
6 changes: 6 additions & 0 deletions src/lib-api.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,19 @@ int LoadConfig(char16_t *filename) {
try {
rx.config_filename = QString::fromUtf16(filename);
rx.loadConfig(QString::fromUtf16(filename));
} catch (const QStrException& e) {
rx.log(e.str(), RcsXnLogLevel::llError);
return RCS_FILE_CANNOT_ACCESS;
} catch (...) { return RCS_FILE_CANNOT_ACCESS; }
return 0;
}

int SaveConfig(char16_t *filename) {
try {
rx.saveConfig(QString::fromUtf16(filename));
} catch (const QStrException& e) {
rx.log(e.str(), RcsXnLogLevel::llError);
return RCS_FILE_CANNOT_ACCESS;
} catch (...) { return RCS_FILE_CANNOT_ACCESS; }
return 0;
}
Expand Down
12 changes: 11 additions & 1 deletion src/rcs-xn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,18 @@ int RcsXn::stop() {

void RcsXn::loadConfig(const QString &filename) {
s.load(filename, false); // do not load & store nonDefaults
this->loglevel = static_cast<RcsXnLogLevel>(s["XN"]["loglevel"].toInt());

bool ok;
this->loglevel = static_cast<RcsXnLogLevel>(s["XN"]["loglevel"].toInt(&ok));
this->xn.loglevel = static_cast<Xn::LogLevel>(s["XN"]["loglevel"].toInt());
if (!ok)
throw QStrException("logLevel invalid type!");

Xn::XNConfig xnconfig;
xnconfig.outInterval = s["XN"]["outIntervalMs"].toUInt(&ok);
if (!ok)
throw QStrException("outIntervalMs invalid type!");
this->xn.setConfig(xnconfig);

this->gui_config_changing = true;
try {
Expand Down
1 change: 1 addition & 0 deletions src/settings.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const Config DEFAULTS {
{"flowcontrol", 1},
{"loglevel", 1},
{"interface", "LI101"},
{"outIntervalMs", 50},
}},
{"global", {
{"addrRange", "basic"},
Expand Down

0 comments on commit 90cfec6

Please sign in to comment.