Improved DTR and RTS line control

Made  the  force control  lines  group  box  in the  Configuration  UI
checkable which allows the DTR and RTS checkboxes to mean either force
low or force high.

Also  improved   UI  control  logic   to  only  allow   valid  setting
combintions.  Disabled network  port  text edit  for OmniRig.  Cleared
network port combo box list for  network interfaces like HRD and DXLab
Commander, was erroneously showing COM ports.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5222 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-04-14 10:54:14 +00:00
parent 6d65f4b1b6
commit bbc359d043
6 changed files with 127 additions and 95 deletions

View File

@ -347,8 +347,9 @@ struct RigParams
TransceiverFactory::DataBits CAT_data_bits_; TransceiverFactory::DataBits CAT_data_bits_;
TransceiverFactory::StopBits CAT_stop_bits_; TransceiverFactory::StopBits CAT_stop_bits_;
TransceiverFactory::Handshake CAT_handshake_; TransceiverFactory::Handshake CAT_handshake_;
bool CAT_DTR_always_on_; bool CAT_force_control_lines_;
bool CAT_RTS_always_on_; bool CAT_DTR_high_;
bool CAT_RTS_high_;
qint32 CAT_poll_interval_; qint32 CAT_poll_interval_;
TransceiverFactory::PTTMethod PTT_method_; TransceiverFactory::PTTMethod PTT_method_;
QString PTT_port_; QString PTT_port_;
@ -424,6 +425,7 @@ private:
Q_SLOT void on_split_mode_button_group_buttonClicked (int); Q_SLOT void on_split_mode_button_group_buttonClicked (int);
Q_SLOT void on_test_CAT_push_button_clicked (); Q_SLOT void on_test_CAT_push_button_clicked ();
Q_SLOT void on_test_PTT_push_button_clicked (); Q_SLOT void on_test_PTT_push_button_clicked ();
Q_SLOT void on_CAT_control_lines_group_box_toggled (bool);
Q_SLOT void on_CAT_DTR_check_box_toggled (bool); Q_SLOT void on_CAT_DTR_check_box_toggled (bool);
Q_SLOT void on_CAT_RTS_check_box_toggled (bool); Q_SLOT void on_CAT_RTS_check_box_toggled (bool);
Q_SLOT void on_rig_combo_box_currentIndexChanged (int); Q_SLOT void on_rig_combo_box_currentIndexChanged (int);
@ -1028,8 +1030,9 @@ void Configuration::impl::initialise_models ()
ui_->CAT_data_bits_button_group->button (rig_params_.CAT_data_bits_)->setChecked (true); ui_->CAT_data_bits_button_group->button (rig_params_.CAT_data_bits_)->setChecked (true);
ui_->CAT_stop_bits_button_group->button (rig_params_.CAT_stop_bits_)->setChecked (true); ui_->CAT_stop_bits_button_group->button (rig_params_.CAT_stop_bits_)->setChecked (true);
ui_->CAT_handshake_button_group->button (rig_params_.CAT_handshake_)->setChecked (true); ui_->CAT_handshake_button_group->button (rig_params_.CAT_handshake_)->setChecked (true);
ui_->CAT_DTR_check_box->setChecked (rig_params_.CAT_DTR_always_on_); ui_->CAT_control_lines_group_box->setChecked (rig_params_.CAT_force_control_lines_);
ui_->CAT_RTS_check_box->setChecked (rig_params_.CAT_RTS_always_on_); ui_->CAT_DTR_check_box->setChecked (rig_params_.CAT_DTR_high_);
ui_->CAT_RTS_check_box->setChecked (rig_params_.CAT_RTS_high_);
ui_->TX_audio_source_button_group->button (rig_params_.TX_audio_source_)->setChecked (true); ui_->TX_audio_source_button_group->button (rig_params_.TX_audio_source_)->setChecked (true);
ui_->CAT_poll_interval_spin_box->setValue (rig_params_.CAT_poll_interval_); ui_->CAT_poll_interval_spin_box->setValue (rig_params_.CAT_poll_interval_);
@ -1190,8 +1193,9 @@ void Configuration::impl::read_settings ()
rig_params_.CAT_data_bits_ = settings_->value ("CATDataBits", QVariant::fromValue (TransceiverFactory::eight_data_bits)).value<TransceiverFactory::DataBits> (); rig_params_.CAT_data_bits_ = settings_->value ("CATDataBits", QVariant::fromValue (TransceiverFactory::eight_data_bits)).value<TransceiverFactory::DataBits> ();
rig_params_.CAT_stop_bits_ = settings_->value ("CATStopBits", QVariant::fromValue (TransceiverFactory::two_stop_bits)).value<TransceiverFactory::StopBits> (); rig_params_.CAT_stop_bits_ = settings_->value ("CATStopBits", QVariant::fromValue (TransceiverFactory::two_stop_bits)).value<TransceiverFactory::StopBits> ();
rig_params_.CAT_handshake_ = settings_->value ("CATHandshake", QVariant::fromValue (TransceiverFactory::handshake_none)).value<TransceiverFactory::Handshake> (); rig_params_.CAT_handshake_ = settings_->value ("CATHandshake", QVariant::fromValue (TransceiverFactory::handshake_none)).value<TransceiverFactory::Handshake> ();
rig_params_.CAT_DTR_always_on_ = settings_->value ("DTR", false).toBool (); rig_params_.CAT_force_control_lines_ = settings_->value ("CATForceControlLines", false).toBool ();
rig_params_.CAT_RTS_always_on_ = settings_->value ("RTS", false).toBool (); rig_params_.CAT_DTR_high_ = settings_->value ("DTR", false).toBool ();
rig_params_.CAT_RTS_high_ = settings_->value ("RTS", false).toBool ();
rig_params_.PTT_method_ = settings_->value ("PTTMethod", QVariant::fromValue (TransceiverFactory::PTT_method_VOX)).value<TransceiverFactory::PTTMethod> (); rig_params_.PTT_method_ = settings_->value ("PTTMethod", QVariant::fromValue (TransceiverFactory::PTT_method_VOX)).value<TransceiverFactory::PTTMethod> ();
rig_params_.TX_audio_source_ = settings_->value ("TXAudioSource", QVariant::fromValue (TransceiverFactory::TX_audio_source_front)).value<TransceiverFactory::TXAudioSource> (); rig_params_.TX_audio_source_ = settings_->value ("TXAudioSource", QVariant::fromValue (TransceiverFactory::TX_audio_source_front)).value<TransceiverFactory::TXAudioSource> ();
rig_params_.PTT_port_ = settings_->value ("PTTport").toString (); rig_params_.PTT_port_ = settings_->value ("PTTport").toString ();
@ -1278,8 +1282,9 @@ void Configuration::impl::write_settings ()
settings_->setValue ("73TxDisable", disable_TX_on_73_); settings_->setValue ("73TxDisable", disable_TX_on_73_);
settings_->setValue ("Runaway", watchdog_); settings_->setValue ("Runaway", watchdog_);
settings_->setValue ("Tx2QSO", TX_messages_); settings_->setValue ("Tx2QSO", TX_messages_);
settings_->setValue ("DTR", rig_params_.CAT_DTR_always_on_); settings_->setValue ("CATForceControlLines", rig_params_.CAT_force_control_lines_);
settings_->setValue ("RTS", rig_params_.CAT_RTS_always_on_); settings_->setValue ("DTR", rig_params_.CAT_DTR_high_);
settings_->setValue ("RTS", rig_params_.CAT_RTS_high_);
settings_->setValue ("TXAudioSource", QVariant::fromValue (rig_params_.TX_audio_source_)); settings_->setValue ("TXAudioSource", QVariant::fromValue (rig_params_.TX_audio_source_));
settings_->setValue ("Polling", rig_params_.CAT_poll_interval_); settings_->setValue ("Polling", rig_params_.CAT_poll_interval_);
settings_->setValue ("SplitMode", QVariant::fromValue (rig_params_.split_mode_)); settings_->setValue ("SplitMode", QVariant::fromValue (rig_params_.split_mode_));
@ -1294,6 +1299,8 @@ void Configuration::impl::set_rig_invariants ()
auto CAT_PTT_enabled = transceiver_factory_.has_CAT_PTT (rig); auto CAT_PTT_enabled = transceiver_factory_.has_CAT_PTT (rig);
auto CAT_indirect_serial_PTT = transceiver_factory_.has_CAT_indirect_serial_PTT (rig); auto CAT_indirect_serial_PTT = transceiver_factory_.has_CAT_indirect_serial_PTT (rig);
auto asynchronous_CAT = transceiver_factory_.has_asynchronous_CAT (rig); auto asynchronous_CAT = transceiver_factory_.has_asynchronous_CAT (rig);
auto is_hw_handshake = ui_->CAT_handshake_group_box->isEnabled ()
&& TransceiverFactory::handshake_hardware == static_cast<TransceiverFactory::Handshake> (ui_->CAT_handshake_button_group->checkedId ());
ui_->test_CAT_push_button->setStyleSheet ({}); ui_->test_CAT_push_button->setStyleSheet ({});
@ -1305,52 +1312,55 @@ void Configuration::impl::set_rig_invariants ()
bool is_serial_CAT (TransceiverFactory::Capabilities::serial == port_type); bool is_serial_CAT (TransceiverFactory::Capabilities::serial == port_type);
if (port_type != last_port_type) if (TransceiverFactory::basic_transceiver_name_ == rig)
{ {
last_port_type = port_type; ui_->CAT_control_group_box->setEnabled (false);
}
switch (port_type) else
{
ui_->CAT_control_group_box->setEnabled (true);
if (port_type != last_port_type)
{ {
case TransceiverFactory::Capabilities::serial: last_port_type = port_type;
fill_port_combo_box (ui_->CAT_port_combo_box); switch (port_type)
ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_serial_port_);
if (ui_->CAT_port_combo_box->currentText ().isEmpty () && ui_->CAT_port_combo_box->count ())
{ {
ui_->CAT_port_combo_box->setCurrentText (ui_->CAT_port_combo_box->itemText (0)); case TransceiverFactory::Capabilities::serial:
fill_port_combo_box (ui_->CAT_port_combo_box);
ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_serial_port_);
if (ui_->CAT_port_combo_box->currentText ().isEmpty () && ui_->CAT_port_combo_box->count ())
{
ui_->CAT_port_combo_box->setCurrentText (ui_->CAT_port_combo_box->itemText (0));
}
ui_->CAT_port_label->setText (tr ("Serial Port:"));
ui_->CAT_port_combo_box->setToolTip (tr ("Serial port used for CAT control"));
ui_->CAT_port_combo_box->setEnabled (true);
break;
case TransceiverFactory::Capabilities::network:
ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_network_port_);
ui_->CAT_port_label->setText (tr ("Network Server:"));
ui_->CAT_port_combo_box->setToolTip (tr ("Optional hostname and port of network service.\n"
"Leave blank for a sensible default on this machine.\n"
"Formats:\n"
"\thostname:port\n"
"\tIPv4-address:port\n"
"\t[IPv6-address]:port"));
ui_->CAT_port_combo_box->clear ();
ui_->CAT_port_combo_box->setEnabled (true);
break;
default:
ui_->CAT_port_combo_box->clear ();
ui_->CAT_port_combo_box->setEnabled (false);
break;
} }
ui_->CAT_control_group_box->setEnabled (true);
ui_->CAT_port_label->setText (tr ("Serial Port:"));
ui_->CAT_port_combo_box->setToolTip (tr ("Serial port used for CAT control"));
break;
case TransceiverFactory::Capabilities::network:
ui_->CAT_port_combo_box->setCurrentText (rig_params_.CAT_network_port_);
ui_->CAT_control_group_box->setEnabled (true);
ui_->CAT_port_label->setText (tr ("Network Server:"));
ui_->CAT_port_combo_box->setToolTip (tr ("Optional hostname and port of network service.\n"
"Leave blank for a sensible default on this machine.\n"
"Formats:\n"
"\thostname:port\n"
"\tIPv4-address:port\n"
"\t[IPv6-address]:port"));
break;
default:
ui_->CAT_port_combo_box->clear ();
ui_->CAT_control_group_box->setEnabled (false);
break;
} }
ui_->CAT_serial_port_parameters_group_box->setEnabled (is_serial_CAT);
ui_->CAT_control_lines_group_box->setEnabled (is_serial_CAT && !is_hw_handshake);
} }
auto const& cat_port = ui_->CAT_port_combo_box->currentText (); auto const& cat_port = ui_->CAT_port_combo_box->currentText ();
ui_->CAT_serial_port_parameters_group_box->setEnabled (is_serial_CAT);
auto is_hw_handshake = TransceiverFactory::handshake_hardware == static_cast<TransceiverFactory::Handshake> (ui_->CAT_handshake_button_group->checkedId ());
ui_->CAT_RTS_check_box->setEnabled (is_serial_CAT && !is_hw_handshake);
ui_->TX_audio_source_group_box->setEnabled (transceiver_factory_.has_CAT_PTT_mic_data (rig) && TransceiverFactory::PTT_method_CAT == ptt_method); ui_->TX_audio_source_group_box->setEnabled (transceiver_factory_.has_CAT_PTT_mic_data (rig) && TransceiverFactory::PTT_method_CAT == ptt_method);
// if (ui_->test_PTT_push_button->isEnabled ()) // don't enable if disabled - "Test CAT" must succeed first // if (ui_->test_PTT_push_button->isEnabled ()) // don't enable if disabled - "Test CAT" must succeed first
@ -1372,13 +1382,15 @@ void Configuration::impl::set_rig_invariants ()
, CAT_indirect_serial_PTT ? combo_box_item_enabled : combo_box_item_disabled , CAT_indirect_serial_PTT ? combo_box_item_enabled : combo_box_item_disabled
, Qt::UserRole - 1); , Qt::UserRole - 1);
ui_->PTT_DTR_radio_button->setEnabled (!(ui_->CAT_DTR_check_box->isChecked () auto control_lines_available = !ui_->CAT_control_lines_group_box->isEnabled ()
&& ((is_serial_CAT && ptt_port == cat_port) || !ui_->CAT_control_lines_group_box->isChecked ();
|| ("CAT" == ptt_port && !CAT_indirect_serial_PTT)))); ui_->PTT_DTR_radio_button->setEnabled (!(((is_serial_CAT && ptt_port == cat_port)
&& !control_lines_available)
|| ("CAT" == ptt_port && !CAT_indirect_serial_PTT)));
ui_->PTT_RTS_radio_button->setEnabled (!((ui_->CAT_RTS_check_box->isChecked () || is_hw_handshake) ui_->PTT_RTS_radio_button->setEnabled (!(((is_serial_CAT && ptt_port == cat_port)
&& ((ptt_port == cat_port && is_serial_CAT) && (!control_lines_available || is_hw_handshake))
|| ("CAT" == ptt_port && !CAT_indirect_serial_PTT)))); || ("CAT" == ptt_port && !CAT_indirect_serial_PTT)));
} }
bool Configuration::impl::validate () bool Configuration::impl::validate ()
@ -1476,8 +1488,9 @@ void Configuration::impl::accept ()
temp_rig_params.CAT_data_bits_ = static_cast<TransceiverFactory::DataBits> (ui_->CAT_data_bits_button_group->checkedId ()); temp_rig_params.CAT_data_bits_ = static_cast<TransceiverFactory::DataBits> (ui_->CAT_data_bits_button_group->checkedId ());
temp_rig_params.CAT_stop_bits_ = static_cast<TransceiverFactory::StopBits> (ui_->CAT_stop_bits_button_group->checkedId ()); temp_rig_params.CAT_stop_bits_ = static_cast<TransceiverFactory::StopBits> (ui_->CAT_stop_bits_button_group->checkedId ());
temp_rig_params.CAT_handshake_ = static_cast<TransceiverFactory::Handshake> (ui_->CAT_handshake_button_group->checkedId ()); temp_rig_params.CAT_handshake_ = static_cast<TransceiverFactory::Handshake> (ui_->CAT_handshake_button_group->checkedId ());
temp_rig_params.CAT_DTR_always_on_ = ui_->CAT_DTR_check_box->isChecked (); temp_rig_params.CAT_force_control_lines_ = ui_->CAT_control_lines_group_box->isChecked ();
temp_rig_params.CAT_RTS_always_on_ = ui_->CAT_RTS_check_box->isChecked (); temp_rig_params.CAT_DTR_high_ = ui_->CAT_DTR_check_box->isChecked ();
temp_rig_params.CAT_RTS_high_ = ui_->CAT_RTS_check_box->isChecked ();
temp_rig_params.CAT_poll_interval_ = ui_->CAT_poll_interval_spin_box->value (); temp_rig_params.CAT_poll_interval_ = ui_->CAT_poll_interval_spin_box->value ();
temp_rig_params.PTT_method_ = static_cast<TransceiverFactory::PTTMethod> (ui_->PTT_method_button_group->checkedId ()); temp_rig_params.PTT_method_ = static_cast<TransceiverFactory::PTTMethod> (ui_->PTT_method_button_group->checkedId ());
temp_rig_params.PTT_port_ = ui_->PTT_port_combo_box->currentText (); temp_rig_params.PTT_port_ = ui_->PTT_port_combo_box->currentText ();
@ -1825,6 +1838,11 @@ void Configuration::impl::on_test_PTT_push_button_clicked ()
: ""); : "");
} }
void Configuration::impl::on_CAT_control_lines_group_box_toggled (bool /* checked */)
{
set_rig_invariants ();
}
void Configuration::impl::on_CAT_DTR_check_box_toggled (bool /* checked */) void Configuration::impl::on_CAT_DTR_check_box_toggled (bool /* checked */)
{ {
set_rig_invariants (); set_rig_invariants ();
@ -1984,14 +2002,21 @@ bool Configuration::impl::open_rig ()
close_rig (); close_rig ();
// create a new Transceiver object // create a new Transceiver object
TransceiverFactory::LineControl DTR {TransceiverFactory::no_control};
TransceiverFactory::LineControl RTS {TransceiverFactory::no_control};
if (ui_->CAT_control_lines_group_box->isChecked ())
{
DTR = ui_->CAT_DTR_check_box->isEnabled () && ui_->CAT_DTR_check_box->isChecked () ? TransceiverFactory::force_high : TransceiverFactory::force_low;
RTS = ui_->CAT_RTS_check_box->isEnabled () && ui_->CAT_RTS_check_box->isChecked () ? TransceiverFactory::force_high : TransceiverFactory::force_low;
}
auto rig = transceiver_factory_.create (ui_->rig_combo_box->currentText () auto rig = transceiver_factory_.create (ui_->rig_combo_box->currentText ()
, ui_->CAT_port_combo_box->currentText () , ui_->CAT_port_combo_box->currentText ()
, ui_->CAT_serial_baud_combo_box->currentText ().toInt () , ui_->CAT_serial_baud_combo_box->currentText ().toInt ()
, static_cast<TransceiverFactory::DataBits> (ui_->CAT_data_bits_button_group->checkedId ()) , static_cast<TransceiverFactory::DataBits> (ui_->CAT_data_bits_button_group->checkedId ())
, static_cast<TransceiverFactory::StopBits> (ui_->CAT_stop_bits_button_group->checkedId ()) , static_cast<TransceiverFactory::StopBits> (ui_->CAT_stop_bits_button_group->checkedId ())
, static_cast<TransceiverFactory::Handshake> (ui_->CAT_handshake_button_group->checkedId ()) , static_cast<TransceiverFactory::Handshake> (ui_->CAT_handshake_button_group->checkedId ())
, ui_->CAT_DTR_check_box->isChecked () , DTR
, ui_->CAT_RTS_check_box->isChecked () , RTS
, static_cast<TransceiverFactory::PTTMethod> (ui_->PTT_method_button_group->checkedId ()) , static_cast<TransceiverFactory::PTTMethod> (ui_->PTT_method_button_group->checkedId ())
, static_cast<TransceiverFactory::TXAudioSource> (ui_->TX_audio_source_button_group->checkedId ()) , static_cast<TransceiverFactory::TXAudioSource> (ui_->TX_audio_source_button_group->checkedId ())
, static_cast<TransceiverFactory::SplitMode> (ui_->split_mode_button_group->checkedId ()) , static_cast<TransceiverFactory::SplitMode> (ui_->split_mode_button_group->checkedId ())
@ -2412,8 +2437,9 @@ bool operator != (RigParams const& lhs, RigParams const& rhs)
|| lhs.CAT_data_bits_ != rhs.CAT_data_bits_ || lhs.CAT_data_bits_ != rhs.CAT_data_bits_
|| lhs.CAT_stop_bits_ != rhs.CAT_stop_bits_ || lhs.CAT_stop_bits_ != rhs.CAT_stop_bits_
|| lhs.CAT_handshake_ != rhs.CAT_handshake_ || lhs.CAT_handshake_ != rhs.CAT_handshake_
|| lhs.CAT_DTR_always_on_ != rhs.CAT_DTR_always_on_ || lhs.CAT_force_control_lines_ != rhs.CAT_force_control_lines_
|| lhs.CAT_RTS_always_on_ != rhs.CAT_RTS_always_on_ || lhs.CAT_DTR_high_ != rhs.CAT_DTR_high_
|| lhs.CAT_RTS_high_ != rhs.CAT_RTS_high_
|| lhs.CAT_poll_interval_ != rhs.CAT_poll_interval_ || lhs.CAT_poll_interval_ != rhs.CAT_poll_interval_
|| lhs.PTT_method_ != rhs.PTT_method_ || lhs.PTT_method_ != rhs.PTT_method_
|| lhs.PTT_port_ != rhs.PTT_port_ || lhs.PTT_port_ != rhs.PTT_port_

View File

@ -673,14 +673,17 @@ a few, particularly some Kenwood rigs, require it).</string>
<property name="title"> <property name="title">
<string>Force Control Lines</string> <string>Force Control Lines</string>
</property> </property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_8"> <layout class="QHBoxLayout" name="horizontalLayout_8">
<item> <item>
<widget class="QCheckBox" name="CAT_DTR_check_box"> <widget class="QCheckBox" name="CAT_DTR_check_box">
<property name="toolTip"> <property name="toolTip">
<string>Force the DTR control line high on the CAT serial port. <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force the DTR control linelow or high on the CAT serial port.&lt;/p&gt;&lt;p&gt;This is required for a few CAT interfaces that are powered&lt;/p&gt;&lt;p&gt;from the DTR control line.&lt;/p&gt;&lt;p&gt;Normally you should leave this unchecked.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
This is required for a few CAT interfaces that are powered
from the DTR control line.
Normally you should leave this unchecked.</string>
</property> </property>
<property name="text"> <property name="text">
<string>DTR</string> <string>DTR</string>
@ -690,12 +693,7 @@ Normally you should leave this unchecked.</string>
<item> <item>
<widget class="QCheckBox" name="CAT_RTS_check_box"> <widget class="QCheckBox" name="CAT_RTS_check_box">
<property name="toolTip"> <property name="toolTip">
<string>Force the RTS control line high on the CAT serial port. <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Force the RTS control line low or high on the CAT serial port.&lt;/p&gt;&lt;p&gt;This is required for a few CAT interfaces that are powered&lt;/p&gt;&lt;p&gt;from the RTS control line.&lt;/p&gt;&lt;p&gt;Normally you should leave this unchecked.&lt;/p&gt;&lt;p&gt;This option is only available if Hardware handshaking is not&lt;/p&gt;&lt;p&gt;selected above.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
This is required for a few CAT interfaces that are powered
from the RTS control line.
Normally you should leave this unchecked.
This option is only available if Hardware handshaking is not
selected above.</string>
</property> </property>
<property name="text"> <property name="text">
<string>RTS</string> <string>RTS</string>
@ -2116,12 +2114,12 @@ soundcard changes</string>
</connection> </connection>
</connections> </connections>
<buttongroups> <buttongroups>
<buttongroup name="TX_mode_button_group"/>
<buttongroup name="PTT_method_button_group"/> <buttongroup name="PTT_method_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="split_mode_button_group"/> <buttongroup name="split_mode_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="TX_audio_source_button_group"/> <buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/> <buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="TX_mode_button_group"/> <buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
</buttongroups> </buttongroups>
</ui> </ui>

View File

@ -157,8 +157,8 @@ HamlibTransceiver::HamlibTransceiver (int model_number
, TransceiverFactory::DataBits cat_data_bits , TransceiverFactory::DataBits cat_data_bits
, TransceiverFactory::StopBits cat_stop_bits , TransceiverFactory::StopBits cat_stop_bits
, TransceiverFactory::Handshake cat_handshake , TransceiverFactory::Handshake cat_handshake
, bool cat_dtr_always_on , TransceiverFactory::LineControl cat_dtr_control
, bool cat_rts_always_on , TransceiverFactory::LineControl cat_rts_control
, TransceiverFactory::PTTMethod ptt_type , TransceiverFactory::PTTMethod ptt_type
, TransceiverFactory::TXAudioSource back_ptt_port , TransceiverFactory::TXAudioSource back_ptt_port
, QString const& ptt_port , QString const& ptt_port
@ -193,13 +193,14 @@ HamlibTransceiver::HamlibTransceiver (int model_number
case TransceiverFactory::handshake_hardware: set_conf ("serial_handshake", "Hardware"); break; case TransceiverFactory::handshake_hardware: set_conf ("serial_handshake", "Hardware"); break;
} }
if (cat_dtr_always_on) if (TransceiverFactory::no_control != cat_dtr_control)
{ {
set_conf ("dtr_state", "ON"); set_conf ("dtr_state", TransceiverFactory::force_high == cat_dtr_control ? "ON" : "OFF");
} }
if (TransceiverFactory::handshake_hardware != cat_handshake && cat_rts_always_on) if (TransceiverFactory::handshake_hardware != cat_handshake
&& TransceiverFactory::no_control != cat_rts_control)
{ {
set_conf ("rts_state", "ON"); set_conf ("rts_state", TransceiverFactory::force_high == cat_rts_control ? "ON" : "OFF");
} }
switch (ptt_type) switch (ptt_type)

View File

@ -32,8 +32,8 @@ class HamlibTransceiver final
, TransceiverFactory::DataBits cat_data_bits , TransceiverFactory::DataBits cat_data_bits
, TransceiverFactory::StopBits cat_stop_bits , TransceiverFactory::StopBits cat_stop_bits
, TransceiverFactory::Handshake cat_handshake , TransceiverFactory::Handshake cat_handshake
, bool cat_dtr_always_on , TransceiverFactory::LineControl cat_dtr_control
, bool cat_rts_always_on , TransceiverFactory::LineControl cat_rts_control
, TransceiverFactory::PTTMethod ptt_type , TransceiverFactory::PTTMethod ptt_type
, TransceiverFactory::TXAudioSource back_ptt_port , TransceiverFactory::TXAudioSource back_ptt_port
, QString const& ptt_port , QString const& ptt_port

View File

@ -100,8 +100,8 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
, DataBits cat_data_bits , DataBits cat_data_bits
, StopBits cat_stop_bits , StopBits cat_stop_bits
, Handshake cat_handshake , Handshake cat_handshake
, bool cat_dtr_always_on , LineControl cat_dtr_control
, bool cat_rts_always_on , LineControl cat_rts_control
, PTTMethod ptt_type , PTTMethod ptt_type
, TXAudioSource ptt_use_data_ptt , TXAudioSource ptt_use_data_ptt
, SplitMode split_mode , SplitMode split_mode
@ -124,8 +124,8 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
, cat_data_bits , cat_data_bits
, cat_stop_bits , cat_stop_bits
, cat_handshake , cat_handshake
, cat_dtr_always_on , force_low
, cat_rts_always_on , force_low
, ptt_type , ptt_type
, ptt_use_data_ptt , ptt_use_data_ptt
, "CAT" == ptt_port ? "" : ptt_port , "CAT" == ptt_port ? "" : ptt_port
@ -156,8 +156,8 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
, cat_data_bits , cat_data_bits
, cat_stop_bits , cat_stop_bits
, cat_handshake , cat_handshake
, cat_dtr_always_on , cat_dtr_control
, cat_rts_always_on , cat_rts_control
, ptt_type , ptt_type
, ptt_use_data_ptt , ptt_use_data_ptt
, "CAT" == ptt_port ? "" : ptt_port , "CAT" == ptt_port ? "" : ptt_port
@ -189,8 +189,8 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
, cat_data_bits , cat_data_bits
, cat_stop_bits , cat_stop_bits
, cat_handshake , cat_handshake
, cat_dtr_always_on , cat_dtr_control
, cat_rts_always_on , cat_rts_control
, ptt_type , ptt_type
, ptt_use_data_ptt , ptt_use_data_ptt
, "CAT" == ptt_port ? "" : ptt_port , "CAT" == ptt_port ? "" : ptt_port
@ -221,8 +221,8 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
, cat_data_bits , cat_data_bits
, cat_stop_bits , cat_stop_bits
, cat_handshake , cat_handshake
, cat_dtr_always_on , cat_dtr_control
, cat_rts_always_on , cat_rts_control
, ptt_type , ptt_type
, ptt_use_data_ptt , ptt_use_data_ptt
, "CAT" == ptt_port ? "" : ptt_port , "CAT" == ptt_port ? "" : ptt_port
@ -251,8 +251,8 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
, cat_data_bits , cat_data_bits
, cat_stop_bits , cat_stop_bits
, cat_handshake , cat_handshake
, cat_dtr_always_on , cat_dtr_control
, cat_rts_always_on , cat_rts_control
, ptt_type , ptt_type
, ptt_use_data_ptt , ptt_use_data_ptt
, "CAT" == ptt_port ? cat_port : ptt_port , "CAT" == ptt_port ? cat_port : ptt_port
@ -282,6 +282,7 @@ std::unique_ptr<Transceiver> TransceiverFactory::create (QString const& name
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, DataBits); ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, DataBits);
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, StopBits); ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, StopBits);
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, Handshake); ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, Handshake);
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, LineControl);
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, PTTMethod); ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, PTTMethod);
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, TXAudioSource); ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, TXAudioSource);
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, SplitMode); ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, SplitMode);
@ -290,6 +291,7 @@ ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, SplitMode);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, DataBits); ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, DataBits);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, StopBits); ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, StopBits);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, Handshake); ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, Handshake);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, LineControl);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, PTTMethod); ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, PTTMethod);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, TXAudioSource); ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, TXAudioSource);
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, SplitMode); ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, SplitMode);
@ -297,6 +299,7 @@ ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, SplitMode);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, DataBits); ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, DataBits);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, StopBits); ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, StopBits);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, Handshake); ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, Handshake);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, LineControl);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, PTTMethod); ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, PTTMethod);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, TXAudioSource); ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, TXAudioSource);
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, SplitMode); ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, SplitMode);

View File

@ -21,7 +21,7 @@ class TransceiverFactory
: public QObject : public QObject
{ {
Q_OBJECT; Q_OBJECT;
Q_ENUMS (DataBits StopBits Handshake PTTMethod TXAudioSource SplitMode); Q_ENUMS (DataBits StopBits Handshake LineControl PTTMethod TXAudioSource SplitMode);
private: private:
Q_DISABLE_COPY (TransceiverFactory); Q_DISABLE_COPY (TransceiverFactory);
@ -70,6 +70,7 @@ public:
enum DataBits {seven_data_bits = 7, eight_data_bits}; enum DataBits {seven_data_bits = 7, eight_data_bits};
enum StopBits {one_stop_bit = 1, two_stop_bits}; enum StopBits {one_stop_bit = 1, two_stop_bits};
enum Handshake {handshake_none, handshake_XonXoff, handshake_hardware}; enum Handshake {handshake_none, handshake_XonXoff, handshake_hardware};
enum LineControl {no_control, force_low, force_high};
enum PTTMethod {PTT_method_VOX, PTT_method_CAT, PTT_method_DTR, PTT_method_RTS}; enum PTTMethod {PTT_method_VOX, PTT_method_CAT, PTT_method_DTR, PTT_method_RTS};
enum TXAudioSource {TX_audio_source_front, TX_audio_source_rear}; enum TXAudioSource {TX_audio_source_front, TX_audio_source_rear};
enum SplitMode {split_mode_none, split_mode_rig, split_mode_emulate}; enum SplitMode {split_mode_none, split_mode_rig, split_mode_emulate};
@ -93,8 +94,8 @@ public:
// make a new Transceiver instance // make a new Transceiver instance
// //
// cat_port, cat_baud, cat_data_bits, cat_stop_bits, cat_handshake, // cat_port, cat_baud, cat_data_bits, cat_stop_bits, cat_handshake,
// cat_dtr_alway_on, cat_rts_always_on are only relevant to // cat_dtr_control, cat_rts_control are only relevant to interfaces
// interfaces that are served by hamlib // that are served by Hamlib
// //
// PTT port and to some extent ptt_type are independent of interface // PTT port and to some extent ptt_type are independent of interface
// type // type
@ -105,8 +106,8 @@ public:
, DataBits cat_data_bits , DataBits cat_data_bits
, StopBits cat_stop_bits , StopBits cat_stop_bits
, Handshake cat_handshake , Handshake cat_handshake
, bool cat_dtr_always_on // to power interface , LineControl cat_dtr_control // to power interface
, bool cat_rts_always_on // to power inteface , LineControl cat_rts_control // to power inteface
, PTTMethod ptt_type // "CAT" | "DTR" | "RTS" | "VOX" , PTTMethod ptt_type // "CAT" | "DTR" | "RTS" | "VOX"
, TXAudioSource ptt_use_data_ptt // some rigs allow audio routing to Mic/Data connector , TXAudioSource ptt_use_data_ptt // some rigs allow audio routing to Mic/Data connector
, SplitMode split_mode // how to support split TX mode , SplitMode split_mode // how to support split TX mode
@ -134,6 +135,7 @@ Q_DECLARE_METATYPE (TransceiverFactory::SplitMode);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, DataBits); ENUM_QDEBUG_OPS_DECL (TransceiverFactory, DataBits);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, StopBits); ENUM_QDEBUG_OPS_DECL (TransceiverFactory, StopBits);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, Handshake); ENUM_QDEBUG_OPS_DECL (TransceiverFactory, Handshake);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, LineControl);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, PTTMethod); ENUM_QDEBUG_OPS_DECL (TransceiverFactory, PTTMethod);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, TXAudioSource); ENUM_QDEBUG_OPS_DECL (TransceiverFactory, TXAudioSource);
ENUM_QDEBUG_OPS_DECL (TransceiverFactory, SplitMode); ENUM_QDEBUG_OPS_DECL (TransceiverFactory, SplitMode);
@ -142,6 +144,7 @@ ENUM_QDEBUG_OPS_DECL (TransceiverFactory, SplitMode);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, DataBits); ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, DataBits);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, StopBits); ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, StopBits);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, Handshake); ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, Handshake);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, LineControl);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, PTTMethod); ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, PTTMethod);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, TXAudioSource); ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, TXAudioSource);
ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, SplitMode); ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, SplitMode);
@ -149,6 +152,7 @@ ENUM_QDATASTREAM_OPS_DECL (TransceiverFactory, SplitMode);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, DataBits); ENUM_CONVERSION_OPS_DECL (TransceiverFactory, DataBits);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, StopBits); ENUM_CONVERSION_OPS_DECL (TransceiverFactory, StopBits);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, Handshake); ENUM_CONVERSION_OPS_DECL (TransceiverFactory, Handshake);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, LineControl);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, PTTMethod); ENUM_CONVERSION_OPS_DECL (TransceiverFactory, PTTMethod);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, TXAudioSource); ENUM_CONVERSION_OPS_DECL (TransceiverFactory, TXAudioSource);
ENUM_CONVERSION_OPS_DECL (TransceiverFactory, SplitMode); ENUM_CONVERSION_OPS_DECL (TransceiverFactory, SplitMode);