diff options
| author | Christoph Berg <myon@debian.org> | 2021-03-27 10:23:34 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2021-03-27 10:23:34 +0100 |
| commit | 5c88480ddc5c5dab1f3444a8b8de9303fd6140da (patch) | |
| tree | e7073b1ff21f63e0b62c5846d849360c1a87df93 /Transceiver | |
| parent | 1c4a8c9374cacfc002e47c8e3bb824e82aa8441c (diff) | |
New upstream version 2.4.0~rc4+repackupstream/2.4.0_rc4+repack
Diffstat (limited to 'Transceiver')
| -rw-r--r-- | Transceiver/HamlibTransceiver.cpp | 101 | ||||
| -rw-r--r-- | Transceiver/HamlibTransceiver.hpp | 1 |
2 files changed, 57 insertions, 45 deletions
diff --git a/Transceiver/HamlibTransceiver.cpp b/Transceiver/HamlibTransceiver.cpp index 27fe16a6..77979edb 100644 --- a/Transceiver/HamlibTransceiver.cpp +++ b/Transceiver/HamlibTransceiver.cpp @@ -436,7 +436,11 @@ HamlibTransceiver::HamlibTransceiver (logger_type * logger, { m_->set_conf ("ptt_type", "RTS"); } + m_->set_conf ("ptt_share", "1"); } + + // do this late to allow any configuration option to be overriden + load_user_settings (); } HamlibTransceiver::HamlibTransceiver (logger_type * logger, @@ -453,51 +457,6 @@ HamlibTransceiver::HamlibTransceiver (logger_type * logger, // m_->rig_->state.obj = this; - // - // user defined Hamlib settings - // - auto settings_file_name = QStandardPaths::locate (QStandardPaths::AppConfigLocation - , "hamlib_settings.json"); - if (!settings_file_name.isEmpty ()) - { - QFile settings_file {settings_file_name}; - qDebug () << "Using Hamlib settings file:" << settings_file_name; - if (settings_file.open (QFile::ReadOnly)) - { - QJsonParseError status; - auto settings_doc = QJsonDocument::fromJson (settings_file.readAll (), &status); - if (status.error) - { - throw error {tr ("Hamlib settings file error: %1 at character offset %2") - .arg (status.errorString ()).arg (status.offset)}; - } - qDebug () << "Hamlib settings JSON:" << settings_doc.toJson (); - if (!settings_doc.isObject ()) - { - throw error {tr ("Hamlib settings file error: top level must be a JSON object")}; - } - auto const& settings = settings_doc.object (); - - // - // configuration settings - // - auto const& config = settings["config"]; - if (!config.isUndefined ()) - { - if (!config.isObject ()) - { - throw error {tr ("Hamlib settings file error: config must be a JSON object")}; - } - auto const& config_list = config.toObject (); - for (auto item = config_list.constBegin (); item != config_list.constEnd (); ++item) - { - m_->set_conf (item.key ().toLocal8Bit ().constData () - , (*item).toVariant ().toString ().toLocal8Bit ().constData ()); - } - } - } - } - if (!m_->is_dummy_) { switch (rig_get_caps_int (m_->model_, RIG_CAPS_PORT_TYPE)) @@ -592,17 +551,69 @@ HamlibTransceiver::HamlibTransceiver (logger_type * logger, { m_->set_conf ("ptt_type", "RTS"); } + m_->set_conf ("ptt_share", "1"); } // Make Icom CAT split commands less glitchy m_->set_conf ("no_xchg", "1"); + // do this late to allow any configuration option to be overriden + load_user_settings (); + // would be nice to get events but not supported on Windows and also not on a lot of rigs // rig_set_freq_callback (m_->rig_.data (), &frequency_change_callback, this); } HamlibTransceiver::~HamlibTransceiver () = default; +void HamlibTransceiver::load_user_settings () +{ + // + // user defined Hamlib settings + // + auto settings_file_name = QStandardPaths::locate (QStandardPaths::AppConfigLocation + , "hamlib_settings.json"); + if (!settings_file_name.isEmpty ()) + { + QFile settings_file {settings_file_name}; + qDebug () << "Using Hamlib settings file:" << settings_file_name; + if (settings_file.open (QFile::ReadOnly)) + { + QJsonParseError status; + auto settings_doc = QJsonDocument::fromJson (settings_file.readAll (), &status); + if (status.error) + { + throw error {tr ("Hamlib settings file error: %1 at character offset %2") + .arg (status.errorString ()).arg (status.offset)}; + } + qDebug () << "Hamlib settings JSON:" << settings_doc.toJson (); + if (!settings_doc.isObject ()) + { + throw error {tr ("Hamlib settings file error: top level must be a JSON object")}; + } + auto const& settings = settings_doc.object (); + + // + // configuration settings + // + auto const& config = settings["config"]; + if (!config.isUndefined ()) + { + if (!config.isObject ()) + { + throw error {tr ("Hamlib settings file error: config must be a JSON object")}; + } + auto const& config_list = config.toObject (); + for (auto item = config_list.constBegin (); item != config_list.constEnd (); ++item) + { + m_->set_conf (item.key ().toLocal8Bit ().constData () + , (*item).toVariant ().toString ().toLocal8Bit ().constData ()); + } + } + } + } +} + int HamlibTransceiver::do_start () { CAT_TRACE ("starting: " << rig_get_caps_cptr (m_->model_, RIG_CAPS_MFG_NAME_CPTR) diff --git a/Transceiver/HamlibTransceiver.hpp b/Transceiver/HamlibTransceiver.hpp index 9548fe65..37765785 100644 --- a/Transceiver/HamlibTransceiver.hpp +++ b/Transceiver/HamlibTransceiver.hpp @@ -24,6 +24,7 @@ public: ~HamlibTransceiver (); private: + void load_user_settings (); int do_start () override; void do_stop () override; void do_frequency (Frequency, MODE, bool no_ignore) override; |
