From 79453ced7be5b14d294084537f590dbe4a2fde91 Mon Sep 17 00:00:00 2001 From: PianetaRadio <78976006+PianetaRadio@users.noreply.github.com> Date: Wed, 23 Nov 2022 10:23:28 +0100 Subject: [PATCH] Update dialogradioinfo.cpp #15 --- dialogradioinfo.cpp | 81 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/dialogradioinfo.cpp b/dialogradioinfo.cpp index 87662e2..a2f37fc 100644 --- a/dialogradioinfo.cpp +++ b/dialogradioinfo.cpp @@ -4,6 +4,31 @@ #include "rig.h" +struct rig_type_s +{ + int type; + char *description; +}; + +struct rig_type_s rig_type[] = +{ + {RIG_TYPE_OTHER, "Other"}, + {RIG_FLAG_RECEIVER, "Receiver"}, + {RIG_FLAG_TRANSMITTER, "Transmitter"}, + {RIG_FLAG_SCANNER, "Scanner"}, + {RIG_FLAG_MOBILE, "Mobile"}, + {RIG_FLAG_HANDHELD, "Handheld"}, + {RIG_FLAG_COMPUTER, "Computer"}, + {RIG_FLAG_TRANSCEIVER, "Transceiver"}, + {RIG_FLAG_TRUNKING, "Trunking scanner"}, + {RIG_FLAG_APRS, "APRS"}, + {RIG_FLAG_TNC, "TNC"}, + {RIG_FLAG_DXCLUSTER, "DxCluster"}, + {RIG_FLAG_TUNER, "Tuner"}, + {-1, "Unknown"} +}; + + DialogRadioInfo::DialogRadioInfo(RIG *rig, QWidget *parent) : QDialog(parent), ui(new Ui::DialogRadioInfo) @@ -29,6 +54,62 @@ DialogRadioInfo::DialogRadioInfo(RIG *rig, QWidget *parent) : text = "Backend version: "; text.append(my_rig->caps->version); ui->plainTextEdit_RadioInfo->appendPlainText(text); + + text = "Backend status: "; + text.append(rig_strstatus(caps->status)); + ui->plainTextEdit_RadioInfo->appendPlainText(text); + + text = "Rig type: "; + for (int i = 0; rig_type[i].type != -1; ++i) + { + if ((rig_type[i].type & caps->rig_type) == rig_type[i].type) text.append(rig_type[i].description); + } + ui->plainTextEdit_RadioInfo->appendPlainText(text); + + text = "Port type: "; + switch (caps->port_type) + { + case RIG_PORT_SERIAL: + text.append("RS-232"); + break; + case RIG_PORT_PARALLEL: + text.append("Parallel"); + break; + case RIG_PORT_DEVICE: + text.append("Device driver"); + break; + case RIG_PORT_USB: + text.append("USB"); + break; + case RIG_PORT_NETWORK: + text.append("Network link"); + break; + case RIG_PORT_UDP_NETWORK: + text.append("UDP Network link"); + break; + case RIG_PORT_NONE: + text.append("None"); + break; + default: + text.append("Unknown"); + } + ui->plainTextEdit_RadioInfo->appendPlainText(text); + if (caps->port_type == RIG_PORT_SERIAL) + { + text = QString("Serial speed: %1..%2 bauds, %3%4%5 %6").arg( + caps->serial_rate_min, + caps->serial_rate_max, + caps->serial_data_bits, + caps->serial_parity == RIG_PARITY_NONE ? 'N' : + caps->serial_parity == RIG_PARITY_ODD ? 'O' : + caps->serial_parity == RIG_PARITY_EVEN ? 'E' : + caps->serial_parity == RIG_PARITY_MARK ? 'M' : 'S', + caps->serial_stop_bits, + caps->serial_handshake == RIG_HANDSHAKE_NONE ? "" : + (caps->serial_handshake == RIG_HANDSHAKE_XONXOFF ? "XONXOFF" : "CTS/RTS") + ); + ui->plainTextEdit_RadioInfo->appendPlainText(text); + } } DialogRadioInfo::~DialogRadioInfo()