Deal with Hamlib Net rigctl backed that promises more than it delivers

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5248 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Bill Somerville 2015-04-20 13:45:55 +00:00
parent af457a096c
commit 3a6c4a3f7d
2 changed files with 20 additions and 4 deletions

View File

@ -169,6 +169,7 @@ HamlibTransceiver::HamlibTransceiver (int model_number
, is_dummy_ {RIG_MODEL_DUMMY == model_number}
, reversed_ {false}
, split_query_works_ {true}
, get_vfo_works_ {true}
{
if (!rig_)
{
@ -267,6 +268,19 @@ void HamlibTransceiver::do_start ()
error_check (rig_open (rig_.data ()), tr ("opening connection to rig"));
// the Net rigctl back end promises all functions work but we must
// test get_vfo as it determines our strategy for Icom rigs
vfo_t vfo;
int rc = rig_get_vfo (rig_.data (), &vfo);
if (-RIG_ENAVAIL == rc || -RIG_ENIMPL == rc)
{
get_vfo_works_ = false;
}
else
{
error_check (rc, "getting current VFO");
}
if (!is_dummy_ && rig_->caps->set_split_vfo) // if split is possible
// do some extra setup
{
@ -276,7 +290,8 @@ void HamlibTransceiver::do_start ()
rmode_t mb;
pbwidth_t w {RIG_PASSBAND_NORMAL};
pbwidth_t wb;
if (!rig_->caps->get_vfo && (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE)))
if ((!get_vfo_works_ || !rig_->caps->get_vfo)
&& (rig_->caps->set_vfo || rig_has_vfo_op (rig_.data (), RIG_OP_TOGGLE)))
{
// Icom have deficient CAT protocol with no way of reading which
// VFO is selected or if SPLIT is selected so we have to simply
@ -381,7 +396,7 @@ void HamlibTransceiver::do_start ()
{
vfo_t v {RIG_VFO_A}; // assume RX always on VFO A/MAIN
if (rig_->caps->get_vfo)
if (get_vfo_works_ && rig_->caps->get_vfo)
{
#if WSJT_TRACE_CAT
qDebug () << "HamlibTransceiver::init_rig rig_get_vfo current VFO";
@ -431,7 +446,7 @@ void HamlibTransceiver::do_stop ()
auto HamlibTransceiver::get_vfos () const -> std::tuple<vfo_t, vfo_t>
{
if (rig_->caps->get_vfo)
if (get_vfo_works_ && rig_->caps->get_vfo)
{
vfo_t v;
#if WSJT_TRACE_CAT
@ -697,7 +712,7 @@ void HamlibTransceiver::poll ()
pbwidth_t w;
split_t s;
if (rig_->caps->get_vfo)
if (get_vfo_works_ && rig_->caps->get_vfo)
{
#if WSJT_TRACE_CAT && WSJT_TRACE_CAT_POLLS
qDebug () << "HamlibTransceiver::poll rig_get_vfo";

View File

@ -69,6 +69,7 @@ class HamlibTransceiver final
bool tickle_hamlib_; // Hamlib requires a
// rig_set_split_vfo() call to
// establish the Tx VFO
bool get_vfo_works_; // Net rigctl promises what it can't deliver
};
#endif