mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-23 12:48:40 -05:00
559873ea2b
r5297 | bsomervi | 2015-04-26 17:26:54 +0100 (Sun, 26 Apr 2015) | 49 lines Various defect repairs and ambigous behaviour clarifications A regression introduced in v1.5.0-rc1 where PTT on an alternate serial port when using no CAT control is resolved. A regression introduced in v1.5.0-rc1 where the network server field was not being restored in the settings dialog has been resolved. In settings the "Test PTT" button is now styled by checked state. The "Test PTT" button is enabled without needing click "Test CAT" first when no CAT rig control is selected. Various parts of the settings dialog are now disabled when no CAT rig control is selected. These are the "Mode" group, the "Split Operation" group and the "Monitor returns to last used frequency" check box. None of these have any visible impact nor make sense without CAT rig control. Initialization and teardown of rig control internals has been revised to avoid several problems related to timing and when switching between different CAT settings. This includes improvements in having the operating frequency restored between sessions when not using CAT rig control. The initialization of OmniRig connections has been improved, unfortunately it is still possible to get an exception when clicking the "Test CAT" button where just clicking "OK" and leaving the settings dialog will probably work. Some unnecessary CAT commands output during direct rig control have been elided to reduce the level of traffic a little. The handling of some automatically generated free text messages used when the station is a type 2 compound callsign or is working a type 2 compound callsign has been improved. This is related to how a double click on a message of the form "DE TI4/N0URE 73" is double clicked. The new behaviour depends on whether the current "DX Call" matches the call in the message. This resolves the ambiguity as to whether this message is a sign off at the end of a QSO with current operator (a 73 message is generated) or a tail end opportunity where the message should be treated the same as a CQ or QRZ message (WSJT-X QSYs to the frequency, generates messages and selects message one ready to call). This still leaves some potential ambiguous behaviors in this complex area but selecting "Clear DX call and grid after logging" should resolve most of them. Rig control trace messages have been cleaned up and are now more helpful, less verbose and, tidier in the source code. ------------------------------------------------------------------------ Merged from the wsjtx-1.5 branch. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5298 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
220 lines
8.0 KiB
C++
220 lines
8.0 KiB
C++
#include "TransceiverFactory.hpp"
|
|
|
|
#include <QMetaType>
|
|
|
|
#include "HamlibTransceiver.hpp"
|
|
#include "DXLabSuiteCommanderTransceiver.hpp"
|
|
#include "HRDTransceiver.hpp"
|
|
#include "EmulateSplitTransceiver.hpp"
|
|
|
|
#if defined (WIN32)
|
|
#include "OmniRigTransceiver.hpp"
|
|
#endif
|
|
|
|
#include "moc_TransceiverFactory.cpp"
|
|
|
|
// we use the hamlib "Hamlib Dummy" transceiver for non-CAT radios,
|
|
// this allows us to still use the hamlib PTT control features for a
|
|
// unified PTT control solution
|
|
|
|
char const * const TransceiverFactory::basic_transceiver_name_ = "None";
|
|
|
|
namespace
|
|
{
|
|
struct init
|
|
{
|
|
init ()
|
|
{
|
|
qRegisterMetaType<TransceiverFactory::DataBits> ("TransceiverFactory::DataBits");
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::DataBits> ("TransceiverFactory::DataBits");
|
|
qRegisterMetaType<TransceiverFactory::StopBits> ("TransceiverFactory::StopBits");
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::StopBits> ("TransceiverFactory::StopBits");
|
|
qRegisterMetaType<TransceiverFactory::Handshake> ("TransceiverFactory::Handshake");
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::Handshake> ("TransceiverFactory::Handshake");
|
|
qRegisterMetaType<TransceiverFactory::PTTMethod> ("TransceiverFactory::PTTMethod");
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::PTTMethod> ("TransceiverFactory::PTTMethod");
|
|
qRegisterMetaType<TransceiverFactory::TXAudioSource> ("TransceiverFactory::TXAudioSource");
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::TXAudioSource> ("TransceiverFactory::TXAudioSource");
|
|
qRegisterMetaType<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode");
|
|
qRegisterMetaTypeStreamOperators<TransceiverFactory::SplitMode> ("TransceiverFactory::SplitMode");
|
|
}
|
|
} static_initializer;
|
|
|
|
enum // supported non-hamlib radio interfaces
|
|
{
|
|
NonHamlibBaseId = 9899
|
|
, CommanderId
|
|
, HRDId
|
|
, OmniRigOneId
|
|
, OmniRigTwoId
|
|
};
|
|
}
|
|
|
|
TransceiverFactory::TransceiverFactory ()
|
|
{
|
|
HamlibTransceiver::register_transceivers (&transceivers_);
|
|
DXLabSuiteCommanderTransceiver::register_transceivers (&transceivers_, CommanderId);
|
|
HRDTransceiver::register_transceivers (&transceivers_, HRDId);
|
|
|
|
#if defined (WIN32)
|
|
// OmniRig is ActiveX/COM server so only on Windows
|
|
OmniRigTransceiver::register_transceivers (&transceivers_, OmniRigOneId, OmniRigTwoId);
|
|
#endif
|
|
}
|
|
|
|
auto TransceiverFactory::supported_transceivers () const -> Transceivers const&
|
|
{
|
|
return transceivers_;
|
|
}
|
|
|
|
auto TransceiverFactory::CAT_port_type (QString const& name) const -> Capabilities::PortType
|
|
{
|
|
return supported_transceivers ()[name].port_type_;
|
|
}
|
|
|
|
bool TransceiverFactory::has_CAT_PTT (QString const& name) const
|
|
{
|
|
return
|
|
supported_transceivers ()[name].has_CAT_PTT_
|
|
|| supported_transceivers ()[name].model_number_ > NonHamlibBaseId;
|
|
}
|
|
|
|
bool TransceiverFactory::has_CAT_PTT_mic_data (QString const& name) const
|
|
{
|
|
return supported_transceivers ()[name].has_CAT_PTT_mic_data_;
|
|
}
|
|
|
|
bool TransceiverFactory::has_CAT_indirect_serial_PTT (QString const& name) const
|
|
{
|
|
return supported_transceivers ()[name].has_CAT_indirect_serial_PTT_;
|
|
}
|
|
|
|
bool TransceiverFactory::has_asynchronous_CAT (QString const& name) const
|
|
{
|
|
return supported_transceivers ()[name].asynchronous_;
|
|
}
|
|
|
|
std::unique_ptr<Transceiver> TransceiverFactory::create (ParameterPack const& params, QThread * target_thread)
|
|
{
|
|
std::unique_ptr<Transceiver> result;
|
|
switch (supported_transceivers ()[params.rig_name].model_number_)
|
|
{
|
|
case CommanderId:
|
|
{
|
|
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
|
std::unique_ptr<TransceiverBase> basic_transceiver {new HamlibTransceiver {params.ptt_type, params.ptt_port}};
|
|
if (target_thread)
|
|
{
|
|
basic_transceiver.get ()->moveToThread (target_thread);
|
|
}
|
|
|
|
// wrap the basic Transceiver object instance with a decorator object that talks to DX Lab Suite Commander
|
|
result.reset (new DXLabSuiteCommanderTransceiver {std::move (basic_transceiver), params.network_port, PTT_method_CAT == params.ptt_type, params.poll_interval});
|
|
if (target_thread)
|
|
{
|
|
result.get ()->moveToThread (target_thread);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case HRDId:
|
|
{
|
|
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
|
std::unique_ptr<TransceiverBase> basic_transceiver {new HamlibTransceiver {params.ptt_type, params.ptt_port}};
|
|
if (target_thread)
|
|
{
|
|
basic_transceiver.get ()->moveToThread (target_thread);
|
|
}
|
|
|
|
// wrap the basic Transceiver object instance with a decorator object that talks to ham Radio Deluxe
|
|
result.reset (new HRDTransceiver {std::move (basic_transceiver), params.network_port, PTT_method_CAT == params.ptt_type, params.poll_interval});
|
|
if (target_thread)
|
|
{
|
|
result.get ()->moveToThread (target_thread);
|
|
}
|
|
}
|
|
break;
|
|
|
|
#if defined (WIN32)
|
|
case OmniRigOneId:
|
|
{
|
|
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
|
std::unique_ptr<TransceiverBase> basic_transceiver {new HamlibTransceiver {params.ptt_type, params.ptt_port}};
|
|
if (target_thread)
|
|
{
|
|
basic_transceiver.get ()->moveToThread (target_thread);
|
|
}
|
|
|
|
// wrap the basic Transceiver object instance with a decorator object that talks to OmniRig rig one
|
|
result.reset (new OmniRigTransceiver {std::move (basic_transceiver), OmniRigTransceiver::One, params.ptt_type, params.ptt_port});
|
|
if (target_thread)
|
|
{
|
|
result.get ()->moveToThread (target_thread);
|
|
}
|
|
}
|
|
break;
|
|
|
|
case OmniRigTwoId:
|
|
{
|
|
// we start with a dummy HamlibTransceiver object instance that can support direct PTT
|
|
std::unique_ptr<TransceiverBase> basic_transceiver {new HamlibTransceiver {params.ptt_type, params.ptt_port}};
|
|
if (target_thread)
|
|
{
|
|
basic_transceiver.get ()->moveToThread (target_thread);
|
|
}
|
|
|
|
// wrap the basic Transceiver object instance with a decorator object that talks to OmniRig rig two
|
|
result.reset (new OmniRigTransceiver {std::move (basic_transceiver), OmniRigTransceiver::Two, params.ptt_type, params.ptt_port});
|
|
if (target_thread)
|
|
{
|
|
result.get ()->moveToThread (target_thread);
|
|
}
|
|
}
|
|
break;
|
|
#endif
|
|
|
|
default:
|
|
result.reset (new HamlibTransceiver {supported_transceivers ()[params.rig_name].model_number_, params});
|
|
if (target_thread)
|
|
{
|
|
result.get ()->moveToThread (target_thread);
|
|
}
|
|
break;
|
|
}
|
|
|
|
if (split_mode_emulate == params.split_mode)
|
|
{
|
|
// wrap the Transceiver object instance with a decorator that emulates split mode
|
|
result.reset (new EmulateSplitTransceiver {std::move (result)});
|
|
if (target_thread)
|
|
{
|
|
result.get ()->moveToThread (target_thread);
|
|
}
|
|
}
|
|
|
|
return std::move (result);
|
|
}
|
|
|
|
#if !defined (QT_NO_DEBUG_STREAM)
|
|
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, DataBits);
|
|
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, StopBits);
|
|
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, Handshake);
|
|
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, PTTMethod);
|
|
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, TXAudioSource);
|
|
ENUM_QDEBUG_OPS_IMPL (TransceiverFactory, SplitMode);
|
|
#endif
|
|
|
|
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, DataBits);
|
|
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, StopBits);
|
|
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, Handshake);
|
|
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, PTTMethod);
|
|
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, TXAudioSource);
|
|
ENUM_QDATASTREAM_OPS_IMPL (TransceiverFactory, SplitMode);
|
|
|
|
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, DataBits);
|
|
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, StopBits);
|
|
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, Handshake);
|
|
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, PTTMethod);
|
|
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, TXAudioSource);
|
|
ENUM_CONVERSION_OPS_IMPL (TransceiverFactory, SplitMode);
|