Skip to content

Commit

Permalink
Removed all hamlib get caps from code - hopefully
Browse files Browse the repository at this point in the history
  • Loading branch information
foldynl committed Feb 9, 2024
1 parent 21a288e commit 8ecbd90
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
2 changes: 2 additions & 0 deletions rig/RigCaps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ RigCaps::RigCaps(bool canGetFreq,
bool canGetXIT,
bool canGetPTT,
bool canGetKeySpeed,
bool canSendMorse,
bool isNetworkOnly,
bool needPolling,
int serial_data_bits,
Expand All @@ -21,6 +22,7 @@ RigCaps::RigCaps(bool canGetFreq,
canGetXIT(canGetXIT),
canGetPTT(canGetPTT),
canGetKeySpeed(canGetKeySpeed),
canSendMorse(canSendMorse),
serialDataBits(serial_data_bits),
serialStopBits(serial_stop_bits),
isNetworkOnly(isNetworkOnly),
Expand Down
2 changes: 2 additions & 0 deletions rig/RigCaps.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class RigCaps
bool canGetXIT = false,
bool canGetPTT = false,
bool canGetKeySpeed = false,
bool canSendMorse = false,
bool isNetworkOnly = false,
bool needPolling = false,
int serial_data_bits = 8,
Expand All @@ -27,6 +28,7 @@ class RigCaps
bool canGetXIT;
bool canGetPTT;
bool canGetKeySpeed;
bool canSendMorse;
int serialDataBits;
int serialStopBits;
bool isNetworkOnly;
Expand Down
1 change: 1 addition & 0 deletions rig/drivers/HamlibDrv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ RigCaps HamlibDrv::getCaps(int model)

//currently only CAT PTT is supported
ret.canGetPTT = ( caps->get_ptt && (caps->ptt_type == RIG_PTT_RIG || caps->ptt_type == RIG_PTT_RIG_MICDATA));
ret.canSendMorse = ( caps->send_morse != nullptr );

/* due to a hamlib issue #855 (https://github.com/Hamlib/Hamlib/issues/855)
* the PWR will be disabled for 4.2.x and 4.3.x for NETRIG
Expand Down
27 changes: 12 additions & 15 deletions ui/SettingsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1083,19 +1083,17 @@ void SettingsDialog::addCWKeyProfile()
{
// changing Key to Morse Over CAT model
// needed to verify if all rigs where the key is assigned, supports Morse over CAT
QStringList availableRigProfileNames = rigProfManager->profileNameList();
const QStringList &availableRigProfileNames = rigProfManager->profileNameList();

for ( const QString &rigProfileName : qAsConst(availableRigProfileNames) )
for ( const QString &rigProfileName : availableRigProfileNames )
{
qCDebug(runtime) << "Checking Rig Profile" << rigProfileName;
RigProfile testedRig = rigProfManager->getProfile(rigProfileName);
const RigProfile &testedRig = rigProfManager->getProfile(rigProfileName);

if ( testedRig.assignedCWKey == cwKeyNewProfile.profileName )
{
const struct rig_caps *caps;
caps = rig_get_caps(testedRig.model);

if ( caps && caps->send_morse )
if ( Rig::instance()->getRigCaps(static_cast<Rig::DriverID>(testedRig.driver),
testedRig.model).canSendMorse )
{
qCDebug(runtime) << testedRig.profileName << " has morse support - OK";
}
Expand Down Expand Up @@ -2360,26 +2358,25 @@ void SettingsDialog::refreshRigAssignedCWKeyCombo()
{
FCT_IDENTIFICATION;

QString cwKeyName = ui->rigAssignedCWKeyCombo->currentText();
QStringList availableCWProfileNames = cwKeyProfManager->profileNameList();
const QString &cwKeyName = ui->rigAssignedCWKeyCombo->currentText();
const QStringList &availableCWProfileNames = cwKeyProfManager->profileNameList();
QStringList approvedCWProfiles;
const struct rig_caps *selectedRigCaps;
int rigID = ui->rigModelSelect->currentData().toInt();

selectedRigCaps = rig_get_caps(rigID);
const RigCaps &caps = Rig::instance()->getRigCaps(static_cast<Rig::DriverID>(ui->rigInterfaceCombo->currentData().toInt()),
ui->rigModelSelect->currentData().toInt());

approvedCWProfiles << EMPTY_CWKEY_PROFILE; // add empty profile (like NONE)

if ( selectedRigCaps && selectedRigCaps->send_morse )
if ( caps.canSendMorse )
{
approvedCWProfiles << availableCWProfileNames;
}
else
{
// remove unsupported Morse Over CAT Profile Names
for (const QString &cwProfileName : qAsConst(availableCWProfileNames))
for ( const QString &cwProfileName : availableCWProfileNames )
{
CWKeyProfile testedKey = cwKeyProfManager->getProfile(cwProfileName);
const CWKeyProfile &testedKey = cwKeyProfManager->getProfile(cwProfileName);
if ( testedKey.model != CWKey::MORSEOVERCAT )
{
approvedCWProfiles << cwProfileName;
Expand Down

0 comments on commit 8ecbd90

Please sign in to comment.