From fcc7c9a5dc49a0c59e2a30bd67d5121d6c819c94 Mon Sep 17 00:00:00 2001 From: Phil Taylor Date: Fri, 21 Jan 2022 19:23:32 +0000 Subject: [PATCH] Lots of changes, mainly for multi-radio support --- packettypes.h | 99 +++++++----- rigcommander.cpp | 16 ++ rigcommander.h | 4 + selectradio.cpp | 42 +++++ selectradio.h | 36 +++++ selectradio.ui | 87 ++++++++++ servermain.cpp | 1 + udphandler.cpp | 79 ++++++--- udphandler.h | 8 +- udpserver.cpp | 79 +++++---- udpserver.h | 3 +- wfmain.cpp | 12 +- wfmain.h | 5 +- wfview.pro | 4 +- wfview.vcxproj | 357 +++++++++++------------------------------ wfview.vcxproj.filters | 56 ++----- 16 files changed, 472 insertions(+), 416 deletions(-) create mode 100644 selectradio.cpp create mode 100644 selectradio.h create mode 100644 selectradio.ui diff --git a/packettypes.h b/packettypes.h index b21a4f1..328b8df 100644 --- a/packettypes.h +++ b/packettypes.h @@ -1,6 +1,7 @@ #ifndef PACKETTYPES_H #define PACKETTYPES_H #include +#include #pragma pack(push, 1) @@ -29,7 +30,8 @@ #define LOGIN_RESPONSE_SIZE 0x60 #define LOGIN_SIZE 0x80 #define CONNINFO_SIZE 0x90 -#define CAPABILITIES_SIZE 0xA8 +#define CAPABILITIES_SIZE 0x42 +#define RADIO_CAP_SIZE 0x66 // Variable size packets + payload #define CIV_SIZE 0x15 @@ -172,9 +174,8 @@ typedef union token_packet { quint32 token; // 0x1c char unusedd[7]; // 0x20 quint16 commoncap; // 0x27 - char unuseddd[2]; // 0x29 - char identa; // 0x2b - quint32 identb; // 0x2c + char unuseddd; // 0x29 + char macaddress[6]; // 0x2a quint32 response; // 0x30 char unusede[12]; // 0x34 }; @@ -201,9 +202,8 @@ typedef union status_packet { char unusedd[6]; // 0x20 quint16 unknown; // 0x26 char unusede; // 0x28 - char unusedf[2]; // 0x29 - char identa; // 0x2b - quint32 identb; // 0x2c + char unusedf; // 0x29 + quint8 macaddress[6]; // 0x2a quint32 error; // 0x30 char unusedg[12]; // 0x34 char disc; // 0x40 @@ -286,14 +286,18 @@ typedef union conninfo_packet { char unusedb; // 0x19 quint16 tokrequest; // 0x1a quint32 token; // 0x1c - quint16 authstartid; // 0x20 - char unusedd[5]; // 0x22 - quint32 commoncap; // 0x27 - char identa; // 0x2b - quint32 identb; // 0x2c - char unusedf[16]; // 0x30 - char name[16]; // 0x40 - char unusedg[16]; // 0x50 + union { + struct { + quint16 authstartid; // 0x20 + char unusedg[5]; // 0x22 + quint16 commoncap; // 0x27 + char unusedh; // 0x29 + char macaddress[6]; // 0x2a + }; + GUID guid; // 0x20 + }; + char unusedab[16]; // 0x30 + char name[32]; // 0x40 union { // This contains differences between the send/receive packet struct { // Receive quint32 busy; // 0x60 @@ -321,6 +325,42 @@ typedef union conninfo_packet { char packet[CONNINFO_SIZE]; } *conninfo_packet_t; + +// 0x64 length radio capabilities part of cap packet. +/* + };*/ +typedef union radio_cap_packet { + struct + { + union { + struct { + char unusede[7]; // 0x0 + quint16 commoncap; // 0x0 + char unused; // 0x0 + char macaddress[6]; // 0x0 + }; + GUID guid; // 0x0 + }; + char name[32]; // 0x10 + char audio[32]; // 0x30 + quint16 conntype; // 0x50 + char civ; // 0x52 + quint16 rxsample; // 0x53 + quint16 txsample; // 0x55 + quint8 enablea; // 0x57 + quint8 enableb; // 0x58 + quint8 enablec; // 0x59 + quint32 baudrate; // 0x5a + quint16 capf; // 0x5e + char unusedi; // 0x60 + quint16 capg; // 0x61 + char unusedj[3]; // 0x66 + }; + char packet[RADIO_CAP_SIZE]; +} *radio_cap_packet_t; + + + // 0xA8 length capabilities packet typedef union capabilities_packet { struct @@ -330,41 +370,22 @@ typedef union capabilities_packet { quint16 seq; // 0x06 quint32 sentid; // 0x08 quint32 rcvdid; // 0x0c - char unuseda[3]; // 0x10 - quint16 code; // 0x13 - quint16 res; // 0x15 - quint8 innerseq; // 0x17 + char unuseda[2]; // 0x10 + quint16 payloadsize; // 0x12 + quint16 res; // 0x14 + quint16 innerseq; // 0x16 char unusedb; // 0x18 char unusedc; // 0x19 quint16 tokrequest; // 0x1a quint32 token; // 0x1c char unusedd[33]; // 0x20 - char capa; // 0x41 - char unusede[7]; // 0x42 - quint16 commoncap; // 0x49 - char unused; // 0x4b - char macaddress[6]; // 0x4c - char name[32]; // 0x52 - char audio[32]; // 0x72 - quint16 conntype; // 0x92 - char civ; // 0x94 - quint16 rxsample; // 0x95 - quint16 txsample; // 0x97 - quint8 enablea; // 0x99 - quint8 enableb; // 0x9a - quint8 enablec; // 0x9b - quint32 baudrate; // 0x9c - quint16 capf; // 0xa0 - char unusedi; // 0xa2 - quint16 capg; // 0xa3 - char unusedj[3]; // 0xa5 + char numradios; // 0x41 }; char packet[CAPABILITIES_SIZE]; } *capabilities_packet_t; - #pragma pack(pop) diff --git a/rigcommander.cpp b/rigcommander.cpp index d497c0d..bab57b4 100644 --- a/rigcommander.cpp +++ b/rigcommander.cpp @@ -138,6 +138,8 @@ void rigCommander::commSetup(unsigned char rigCivAddr, udpPreferences prefs, aud connect(this, SIGNAL(discoveredRigID(rigCapabilities)), ptty, SLOT(receiveFoundRigID(rigCapabilities))); + connect(udp, SIGNAL(requestRadioSelection(QList)), this, SLOT(radioSelection(QList))); + connect(udp, SIGNAL(setRadioUsage(int, QString, QString)), this, SLOT(radioUsage(int, QString, QString))); emit haveAfGain(rxSetup.localAFgain); localVolume = rxSetup.localAFgain; } @@ -4273,6 +4275,20 @@ void rigCommander::sendState() emit stateInfo(&state); } +void rigCommander::radioSelection(QList radios) +{ + for (const radio_cap_packet radio : radios) + { + qInfo(logSystem()) << "Radio Name" << radio.name; + } + emit requestRadioSelection(radios); +} + +void rigCommander::radioUsage(int radio, QString user, QString ip) { + emit setRadioUsage(radio, user, ip); +} + + void rigCommander::stateUpdated() { // A remote process has updated the rigState diff --git a/rigcommander.h b/rigcommander.h index 6da1744..c22c7a3 100644 --- a/rigcommander.h +++ b/rigcommander.h @@ -273,6 +273,8 @@ public slots: // Housekeeping: void handleStatusUpdate(const QString text); + void radioSelection(QList radios); + void radioUsage(int radio, QString name, QString ip); void sendState(); void getDebug(); @@ -365,6 +367,8 @@ signals: void stateInfo(rigstate* state); // Housekeeping: + void requestRadioSelection(QList radios); + void setRadioUsage(int radio, QString user, QString ip); void getMoreDebug(); void finished(); diff --git a/selectradio.cpp b/selectradio.cpp new file mode 100644 index 0000000..a815190 --- /dev/null +++ b/selectradio.cpp @@ -0,0 +1,42 @@ +#include "logcategories.h" +#include "selectradio.h" +#include "ui_selectradio.h" + + +selectRadio::selectRadio(QWidget* parent) : + QDialog(parent), + ui(new Ui::selectRadio) +{ + ui->setupUi(this); +} + +selectRadio::~selectRadio() +{ + delete ui; +} + +void selectRadio::populate(QList radios) +{ + ui->table->clearContents(); + for (int row = 0; row < radios.count(); row++) { + ui->table->insertRow(ui->table->rowCount()); + ui->table->setItem(ui->table->rowCount() - 1, 0, new QTableWidgetItem(QString(radios[row].name))); + ui->table->setItem(ui->table->rowCount() - 1, 1, new QTableWidgetItem(QString("%1").arg((unsigned char)radios[row].civ, 2, 16, QLatin1Char('0')).toUpper())); + ui->table->setItem(ui->table->rowCount() - 1, 2, new QTableWidgetItem(QString::number(qFromBigEndian(radios[row].baudrate)))); + } +} + +void selectRadio::setInUse(int radio, QString user, QString ip) +{ + ui->table->setItem(radio, 3, new QTableWidgetItem(user)); + ui->table->setItem(radio, 4, new QTableWidgetItem(ip)); +} + +void selectRadio::on_table_cellClicked(int row, int col) { + qInfo() << "Clicked on " << row << "," << col; + ui->table->selectRow(row); + emit selectedRadio(row); +} +void selectRadio::on_table_sectionClicked(int index) { + qInfo() << "Section Clicked" << index; +} diff --git a/selectradio.h b/selectradio.h new file mode 100644 index 0000000..d823670 --- /dev/null +++ b/selectradio.h @@ -0,0 +1,36 @@ +#ifndef SELECTRADIO_H +#define SELECTRADIO_H + +#include +#include +#include +#include +#include "packettypes.h" + +namespace Ui { + class selectRadio; +} + +class selectRadio : public QDialog +{ + Q_OBJECT + +public: + explicit selectRadio(QWidget* parent = 0); + ~selectRadio(); + void populate(QList radios); + +public slots: + void on_table_cellClicked(int row, int col); + void on_table_sectionClicked(int index); + void setInUse(int radio, QString user, QString ip); + +signals: + void selectedRadio(int radio); + +private: + Ui::selectRadio* ui; + +}; + +#endif // SELECTRADIO_H diff --git a/selectradio.ui b/selectradio.ui new file mode 100644 index 0000000..e73b123 --- /dev/null +++ b/selectradio.ui @@ -0,0 +1,87 @@ + + + selectRadio + + + + 0 + 0 + 680 + 498 + + + + Select Radio From List + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Cancel + + + + + + + + + + + QAbstractItemView::NoEditTriggers + + + true + + + true + + + + Rig Name + + + + + CI-V + + + + + Baud Rate + + + + + Current User + + + + + User IP Address + + + + + + + + + + + diff --git a/servermain.cpp b/servermain.cpp index 4b7774c..5e0a844 100644 --- a/servermain.cpp +++ b/servermain.cpp @@ -28,6 +28,7 @@ servermain::servermain(const QString serialPortCL, const QString hostCL, const Q qRegisterMetaType (); qRegisterMetaType (); qRegisterMetaType(); + qRegisterMetaType>() ; signal(SIGINT, handleCtrlC); diff --git a/udphandler.cpp b/udphandler.cpp index a06933b..651322a 100644 --- a/udphandler.cpp +++ b/udphandler.cpp @@ -322,8 +322,29 @@ void udpHandler::dataReceived() } case (CONNINFO_SIZE): { + // Once connected, the server will send a conninfo packet for each radio that is connected + conninfo_packet_t in = (conninfo_packet_t)r.constData(); - if (in->type != 0x01) { + QHostAddress ip = QHostAddress(qToBigEndian(in->ipaddress)); + + qInfo(logUdp()) << "Got Connection status for:" << in->name << "Computer" << in->computer << "User" << in->username << "IP" << ip.toString() << "GUID" << in->guid; + + // First we need to find this radio in our capabilities packet, there aren't many so just step through + for (int f = 0; f < radios.length(); f++) + { + if ((radios[f].commoncap == 0x8010 && + radios[f].macaddress[0] == in->macaddress[0] && + radios[f].macaddress[1] == in->macaddress[1] && + radios[f].macaddress[2] == in->macaddress[2] && + radios[f].macaddress[3] == in->macaddress[3] && + radios[f].macaddress[4] == in->macaddress[4] && + radios[f].macaddress[5] == in->macaddress[5]) || + (QUuid)radios[f].guid == (QUuid)in->guid) + { + emit setRadioUsage(f,QString(in->computer),ip.toString()); + } + } + if (in->type != 0x01 && numRadios == 1) { devName = in->name; QHostAddress ip = QHostAddress(qToBigEndian(in->ipaddress)); @@ -367,8 +388,7 @@ void udpHandler::dataReceived() { emit haveNetworkStatus(devName + " available"); - identa = in->identa; - identb = in->identb; + memcpy(macaddress, in->macaddress, 6); sendRequestStream(); } @@ -383,28 +403,50 @@ void udpHandler::dataReceived() break; } - case (CAPABILITIES_SIZE): + default: { - capabilities_packet_t in = (capabilities_packet_t)r.constData(); - if (in->type != 0x01) + if ((r.length() - CAPABILITIES_SIZE) % RADIO_CAP_SIZE != 0) { - audioType = in->audio; - devName = in->name; - civId = in->civ; - rxSampleRates = in->rxsample; - txSampleRates = in->txsample; - emit haveBaudRate(qFromBigEndian(in->baudrate)); - //replyId = r.mid(0x42, 16); - qInfo(logUdp()) << this->metaObject()->className() << "Received radio capabilities, Name:" << - devName << " Audio:" << - audioType << "CIV:" << hex << civId; + qInfo(logUdp()) << this->metaObject()->className() << "Packet received" << r.length() << "not recognised"; + break; + } - if (txSampleRates < 2) + int baudrate = 0; + + capabilities_packet_t in = (capabilities_packet_t)r.constData(); + numRadios = in->numradios; + + for (int f = CAPABILITIES_SIZE; f < r.length(); f = f + RADIO_CAP_SIZE) { + radio_cap_packet rad; + const char* tmpRad = r.constData(); + memcpy(&rad, tmpRad+f, RADIO_CAP_SIZE); + devName = rad.name; + audioType = rad.audio; + civId = rad.civ; + rxSampleRates = rad.rxsample; + txSampleRates = rad.txsample; + radios.append(rad); + } + for(const radio_cap_packet radio : radios) + { + qInfo(logUdp()) << this->metaObject()->className() << "Received radio capabilities, Name:" << + radio.name << " Audio:" << + radio.audio << "CIV:" << hex << (unsigned char)radio.civ << + "CAPF" << radio.capf; + if (radio.txsample < 2) { // TX not supported qInfo(logUdp()) << this->metaObject()->className() << "TX audio is disabled"; } + if (radio.commoncap != 0x8010) { + // GUID not MAC address + qInfo(logUdp()) << this->metaObject()->className() << "Radio GUID" << radio.guid; + } + + baudrate = qFromBigEndian(radio.baudrate); } + emit requestRadioSelection(radios); + emit haveBaudRate(baudrate); break; } @@ -432,8 +474,7 @@ void udpHandler::sendRequestStream() p.code = 0x0180; p.res = 0x03; p.commoncap = 0x8010; - p.identa = identa; - p.identb = identb; + memcpy(p.macaddress, macaddress, 6); p.innerseq = authSeq++; p.tokrequest = tokRequest; p.token = token; diff --git a/udphandler.h b/udphandler.h index 3357f32..28cbd8e 100644 --- a/udphandler.h +++ b/udphandler.h @@ -209,6 +209,8 @@ public: udpCivData* civ = Q_NULLPTR; udpAudio* audio = Q_NULLPTR; + unsigned char numRadios; + QList radios; public slots: void receiveDataFromUserToRig(QByteArray); // This slot will send data on to @@ -226,7 +228,8 @@ signals: void haveSetVolume(unsigned char value); void haveNetworkStatus(QString); void haveBaudRate(quint32 baudrate); - + void requestRadioSelection(QList radios); + void setRadioUsage(int, QString name, QString mac); private: void sendAreYouThere(); @@ -261,8 +264,7 @@ private: quint16 tokRequest; quint32 token; // These are for stream ident info. - char identa; - quint32 identb; + quint8 macaddress[8]; QByteArray usernameEncoded; QByteArray passwordEncoded; diff --git a/udpserver.cpp b/udpserver.cpp index c170917..45ac479 100644 --- a/udpserver.cpp +++ b/udpserver.cpp @@ -229,8 +229,7 @@ void udpServer::controlReceived() token_packet_t in = (token_packet_t)r.constData(); current->rxSeq = in->seq; current->authInnerSeq = in->innerseq; - current->identa = in->identa; - current->identb = in->identb; + memcpy(current->macaddress, in->macaddress, 6); if (in->res == 0x02) { // Request for new token qInfo(logUdpServer()) << current->ipAddress.toString() << ": Received create token request"; @@ -301,8 +300,8 @@ void udpServer::controlReceived() current->txSampleRate = qFromBigEndian(in->txsample); current->txBufferLen = qFromBigEndian(in->txbuffer); current->authInnerSeq = in->innerseq; - current->identa = in->identa; - current->identb = in->identb; + + memcpy(current->macaddress, in->macaddress, 6); sendStatus(current); current->authInnerSeq = 0x00; sendConnectionInfo(current); @@ -1040,7 +1039,9 @@ void udpServer::sendCapabilities(CLIENT* c) qInfo(logUdpServer()) << c->ipAddress.toString() << "(" << c->type << "): Sending Capabilities :" << c->txSeq; capabilities_packet p; + radio_cap_packet r; memset(p.packet, 0x0, sizeof(p)); // We can't be sure it is initialized with 0x00! + memset(r.packet, 0x0, sizeof(r)); // We can't be sure it is initialized with 0x00! p.len = sizeof(p); p.type = 0x00; p.seq = c->txSeq; @@ -1049,28 +1050,26 @@ void udpServer::sendCapabilities(CLIENT* c) p.innerseq = c->authInnerSeq; p.tokrequest = c->tokenRx; p.token = c->tokenTx; - p.code = 0x0298; - p.res = 0x02; - p.capa = 0x01; - p.commoncap = c->commonCap; + p.payloadsize = sizeof(p)-0x0f; + p.res = 0x0202; + p.numradios = 0x01; + r.commoncap = c->commonCap; - memcpy(p.macaddress, macAddress.toLocal8Bit(), 6); + memcpy(r.macaddress, macAddress.toLocal8Bit(), 6); // IRU seems to expect an "Icom" mac address so replace the first 3 octets of our Mac with one in their range! - memcpy(p.macaddress, QByteArrayLiteral("\x00\x90\xc7").constData(), 3); - - - memcpy(p.name, rigCaps.modelName.toLocal8Bit(), rigCaps.modelName.length()); - memcpy(p.audio, QByteArrayLiteral("ICOM_VAUDIO").constData(), 11); + memcpy(r.macaddress, QByteArrayLiteral("\x00\x90\xc7").constData(), 3); + memcpy(r.name, rigCaps.modelName.toLocal8Bit(), rigCaps.modelName.length()); + memcpy(r.audio, QByteArrayLiteral("ICOM_VAUDIO").constData(), 11); if (rigCaps.hasWiFi && !rigCaps.hasEthernet) { - p.conntype = 0x0707; // 0x0707 for wifi rig. + r.conntype = 0x0707; // 0x0707 for wifi rig. } else { - p.conntype = 0x073f; // 0x073f for ethernet rig. + r.conntype = 0x073f; // 0x073f for ethernet rig. } - p.civ = rigCaps.civ; - p.baudrate = (quint32)qToBigEndian(config.baudRate); + r.civ = rigCaps.civ; + r.baudrate = (quint32)qToBigEndian(config.baudRate); /* 0x80 = 12K only 0x40 = 44.1K only @@ -1082,49 +1081,48 @@ void udpServer::sendCapabilities(CLIENT* c) 0x01 = 8K only */ if (rxaudio == Q_NULLPTR) { - p.rxsample = 0x8b01; // all rx sample frequencies supported + r.rxsample = 0x8b01; // all rx sample frequencies supported } else { if (rxSampleRate == 48000) { - p.rxsample = 0x0800; // fixed rx sample frequency + r.rxsample = 0x0800; // fixed rx sample frequency } else if (rxSampleRate == 32000) { - p.rxsample = 0x0400; + r.rxsample = 0x0400; } else if (rxSampleRate == 24000) { - p.rxsample = 0x0001; + r.rxsample = 0x0001; } else if (rxSampleRate == 16000) { - p.rxsample = 0x0200; + r.rxsample = 0x0200; } else if (rxSampleRate == 12000) { - p.rxsample = 0x8000; + r.rxsample = 0x8000; } } if (txaudio == Q_NULLPTR) { - p.txsample = 0x8b01; // all tx sample frequencies supported - p.enablea = 0x01; // 0x01 enables TX 24K mode? + r.txsample = 0x8b01; // all tx sample frequencies supported + r.enablea = 0x01; // 0x01 enables TX 24K mode? qInfo(logUdpServer()) << c->ipAddress.toString() << "(" << c->type << "): Client will have TX audio"; } else { qInfo(logUdpServer()) << c->ipAddress.toString() << "(" << c->type << "): Disable tx audio for client"; - p.txsample = 0; + r.txsample = 0; } // I still don't know what these are? - p.enableb = 0x01; // 0x01 doesn't seem to do anything? - p.enablec = 0x01; // 0x01 doesn't seem to do anything? - p.capf = 0x5001; - p.capg = 0x0190; - - + r.enableb = 0x01; // 0x01 doesn't seem to do anything? + r.enablec = 0x01; // 0x01 doesn't seem to do anything? + r.capf = 0x5001; + r.capg = 0x0190; SEQBUFENTRY s; s.seqNum = p.seq; s.timeSent = QTime::currentTime(); s.retransmitCount = 0; s.data = QByteArray::fromRawData((const char*)p.packet, sizeof(p)); + s.data.append(QByteArray::fromRawData((const char*)r.packet, sizeof(r))); if (c->txMutex.try_lock_for(std::chrono::milliseconds(LOCK_PERIOD))) { if (c->txSeqBuf.size() > BUFSIZE) @@ -1141,7 +1139,7 @@ void udpServer::sendCapabilities(CLIENT* c) if (udpMutex.try_lock_for(std::chrono::milliseconds(LOCK_PERIOD))) { - c->socket->writeDatagram(QByteArray::fromRawData((const char*)p.packet, sizeof(p)), c->ipAddress, c->port); + c->socket->writeDatagram((const char*)s.data, s.data.length(), c->ipAddress, c->port); udpMutex.unlock(); } else { @@ -1172,8 +1170,7 @@ void udpServer::sendConnectionInfo(CLIENT* c) p.token = c->tokenTx; p.code = 0x0380; p.commoncap = c->commonCap; - p.identa = c->identa; - p.identb = c->identb; + memcpy(p.macaddress, c->macaddress, 6); // 0x1a-0x1f is authid (random number? // memcpy(p + 0x40, QByteArrayLiteral("IC-7851").constData(), 7); @@ -1185,8 +1182,7 @@ void udpServer::sendConnectionInfo(CLIENT* c) p.busy = 0x01; memcpy(p.computer, c->clientName.constData(), c->clientName.length()); p.ipaddress = qToBigEndian(c->ipAddress.toIPv4Address()); - p.identa = c->identa; - p.identb = c->identb; + memcpy(p.macaddress, c->macaddress, 6); } @@ -1242,8 +1238,7 @@ void udpServer::sendTokenResponse(CLIENT* c, quint8 type) p.tokrequest = c->tokenRx; p.token = c->tokenTx; p.code = 0x0230; - p.identa = c->identa; - p.identb = c->identb; + memcpy(p.macaddress, c->macaddress, 6); p.commoncap = c->commonCap; p.res = type; @@ -1356,8 +1351,8 @@ void udpServer::sendStatus(CLIENT* c) p.res = 0x03; p.unknown = 0x1000; p.unusede = (char)0x80; - p.identa = c->identa; - p.identb = c->identb; + memcpy(p.macaddress, c->macaddress, 6); + p.civport = qToBigEndian(c->civPort); p.audioport = qToBigEndian(c->audioPort); diff --git a/udpserver.h b/udpserver.h index e309923..a93f56e 100644 --- a/udpserver.h +++ b/udpserver.h @@ -104,8 +104,7 @@ private: quint16 authSeq; quint16 innerSeq; quint16 sendAudioSeq; - quint8 identa; - quint32 identb; + quint8 macaddress[4]; quint16 tokenRx; quint32 tokenTx; quint32 commonCap; diff --git a/wfmain.cpp b/wfmain.cpp index 53d4f79..8317676 100644 --- a/wfmain.cpp +++ b/wfmain.cpp @@ -28,6 +28,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s sat = new satelliteSetup(); trxadj = new transceiverAdjustments(); abtBox = new aboutbox(); + selRad = new selectRadio(); qRegisterMetaType(); // Needs to be registered early. qRegisterMetaType(); @@ -44,7 +45,7 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, const QString s qRegisterMetaType (); qRegisterMetaType (); qRegisterMetaType(); - + qRegisterMetaType>(); haveRigCaps = false; @@ -420,6 +421,8 @@ void wfmain::makeRig() // Rig status and Errors: connect(rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString))); connect(rig, SIGNAL(haveStatusUpdate(QString)), this, SLOT(receiveStatusUpdate(QString))); + connect(rig, SIGNAL(requestRadioSelection(QList)), this, SLOT(radioSelection(QList))); + connect(rig, SIGNAL(setRadioUsage(int, QString, QString)), selRad, SLOT(setInUse(int, QString, QString))); // Rig comm setup: connect(this, SIGNAL(sendCommSetup(unsigned char, udpPreferences, audioSetup, audioSetup, QString)), rig, SLOT(commSetup(unsigned char, udpPreferences, audioSetup, audioSetup, QString))); @@ -1156,6 +1159,7 @@ void wfmain::setSerialDevicesUI() ui->serialDeviceListCombo->addItem(QString("/dev/")+serialPortInfo.portName(), i++); #else ui->serialDeviceListCombo->addItem(serialPortInfo.portName(), i++); + qInfo(logSystem()) << "Serial Port found: " << serialPortInfo.portName() << "Manufacturer:" << serialPortInfo.manufacturer() << "Product ID" << serialPortInfo.description() << "S/N" << serialPortInfo.serialNumber(); #endif } #if defined(Q_OS_LINUX) || defined(Q_OS_MAC) @@ -5749,6 +5753,12 @@ void wfmain::on_setClockBtn_clicked() setRadioTimeDatePrep(); } +void wfmain::radioSelection(QList radios) +{ + selRad->populate(radios); + selRad->setVisible(true); +} + // --- DEBUG FUNCTION --- void wfmain::on_debugBtn_clicked() { diff --git a/wfmain.h b/wfmain.h index 34c3ea6..23c8900 100644 --- a/wfmain.h +++ b/wfmain.h @@ -31,6 +31,7 @@ #include "qledlabel.h" #include "rigctld.h" #include "aboutbox.h" +#include "selectradio.h" #include #include @@ -272,6 +273,7 @@ private slots: void sendRadioCommandLoop(); void showStatusBarText(QString text); void receiveBaudRate(quint32 baudrate); + void radioSelection(QList radios); void setRadioTimeDateSend(); @@ -842,7 +844,7 @@ private: satelliteSetup *sat; transceiverAdjustments *trxadj; aboutbox *abtBox; - + selectRadio *selRad; udpServer* udp = Q_NULLPTR; rigCtlD* rigCtl = Q_NULLPTR; @@ -890,6 +892,7 @@ Q_DECLARE_METATYPE(enum rigInput) Q_DECLARE_METATYPE(enum meterKind) Q_DECLARE_METATYPE(enum spectrumMode) Q_DECLARE_METATYPE(rigstate*) +Q_DECLARE_METATYPE(QList) #endif // WFMAIN_H diff --git a/wfview.pro b/wfview.pro index b431678..fe040fb 100644 --- a/wfview.pro +++ b/wfview.pro @@ -163,6 +163,7 @@ SOURCES += main.cpp\ rigctld.cpp \ ring/ring.cpp \ transceiveradjustments.cpp \ + selectradio.cpp \ aboutbox.cpp HEADERS += wfmain.h \ @@ -190,13 +191,14 @@ HEADERS += wfmain.h \ ring/ring.h \ transceiveradjustments.h \ audiotaper.h \ + selectradio.h \ aboutbox.h FORMS += wfmain.ui \ calibrationwindow.ui \ satellitesetup.ui \ - udpserversetup.ui \ + selectradio.ui \ repeatersetup.ui \ transceiveradjustments.ui \ aboutbox.ui diff --git a/wfview.vcxproj b/wfview.vcxproj index 0ddaebd..359ba8e 100644 --- a/wfview.vcxproj +++ b/wfview.vcxproj @@ -16,7 +16,8 @@ QtVS_v304 10.0.19041.0 10.0.19041.0 - $(MSBuildProjectDirectory)\QtMsBuild + $(MSBuildProjectDirectory)\QtMsBuild + v142 @@ -36,7 +37,10 @@ debug\ wfview - + + + + @@ -44,8 +48,34 @@ - debug\debug\wfviewtruerelease\release\wfviewtruefalsemsvc2019core;network;gui;multimedia;widgets;serialport;printsupportmsvc2019core;network;gui;multimedia;widgets;serialport;printsupport - + + + + + + debug\ + debug\ + wfview + true + + + release\ + release\ + wfview + true + false + + + msvc2019 + core;network;gui;multimedia;widgets;serialport;printsupport + + + msvc2019 + core;network;gui;multimedia;widgets;serialport;printsupport + + + + .;..\qcustomplot;..\opus\include;resampler;release;/include;%(AdditionalIncludeDirectories) @@ -59,12 +89,14 @@ MaxSpeed _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION="1.2d";BUILD_WFVIEW;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;PREFIX="/usr/local";GITSHORT="9f059c9";HOST="wfview.org";UNAME="build";NDEBUG;QT_NO_DEBUG;%(PreprocessorDefinitions) false - + + MultiThreadedDLL true true Level3 - true + true + ..\opus\win32\VS2015\Win32\Release\opus.lib;shell32.lib;%(AdditionalDependencies) ..\opus\win32\VS2015\Win32\Release;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) @@ -87,7 +119,26 @@ _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.2d\";BUILD_WFVIEW;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;PREFIX=\"/usr/local\";GITSHORT=\"9f059c9\";HOST=\"wfview.org\";UNAME=\"build\";NDEBUG;QT_NO_DEBUG;QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;%(PreprocessorDefinitions) - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h + + msvc + ./$(Configuration)/moc_predefs.h + Moc'ing %(Identity)... + output + $(Configuration) + moc_%(Filename).cpp + + + default + Rcc'ing %(Identity)... + $(Configuration) + qrc_%(Filename).cpp + + + Uic'ing %(Identity)... + $(ProjectDir) + ui_%(Filename).h + + .;..\qcustomplot;..\opus\include;resampler;debug;/include;%(AdditionalIncludeDirectories) @@ -105,7 +156,8 @@ true true Level3 - true + true + ..\opus\win32\VS2015\Win32\Debug\opus.lib;shell32.lib;%(AdditionalDependencies) ..\opus\win32\VS2015\Win32\Debug;C:\opensslx86\lib;C:\Utils\my_sql\mysql-5.7.25-win32\lib;C:\Utils\postgresqlx86\pgsql\lib;%(AdditionalLibraryDirectories) @@ -126,7 +178,26 @@ _WINDOWS;UNICODE;_UNICODE;WIN32;_ENABLE_EXTENDED_ALIGNED_STORAGE;WFVIEW_VERSION=\"1.2d\";BUILD_WFVIEW;QT_DEPRECATED_WARNINGS;QCUSTOMPLOT_COMPILE_LIBRARY;USE_SSE;USE_SSE2;OUTSIDE_SPEEX;RANDOM_PREFIX=wf;PREFIX=\"/usr/local\";GITSHORT=\"9f059c9\";HOST=\"wfview.org\";UNAME=\"build\";QT_MULTIMEDIA_LIB;QT_PRINTSUPPORT_LIB;QT_WIDGETS_LIB;QT_GUI_LIB;QT_SERIALPORT_LIB;QT_NETWORK_LIB;QT_CORE_LIB;_DEBUG;%(PreprocessorDefinitions) - msvc./$(Configuration)/moc_predefs.hMoc'ing %(Identity)...output$(Configuration)moc_%(Filename).cppdefaultRcc'ing %(Identity)...$(Configuration)qrc_%(Filename).cppUic'ing %(Identity)...$(ProjectDir)ui_%(Filename).h + + msvc + ./$(Configuration)/moc_predefs.h + Moc'ing %(Identity)... + output + $(Configuration) + moc_%(Filename).cpp + + + default + Rcc'ing %(Identity)... + $(Configuration) + qrc_%(Filename).cpp + + + Uic'ing %(Identity)... + $(ProjectDir) + ui_%(Filename).h + + @@ -146,6 +217,7 @@ + @@ -153,188 +225,51 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - Document true @@ -351,117 +286,22 @@ release\moc_predefs.h;%(Outputs) true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -495,30 +335,16 @@ - - - - - - - - - - resourcesresources + resources + resources + - - - - - - - - - - stylestyle + style + style + @@ -537,6 +363,9 @@ - + + + + \ No newline at end of file diff --git a/wfview.vcxproj.filters b/wfview.vcxproj.filters index 46000f0..d28d498 100644 --- a/wfview.vcxproj.filters +++ b/wfview.vcxproj.filters @@ -123,6 +123,9 @@ Source Files + + Generated Files + @@ -206,57 +209,17 @@ Header Files + + Generated Files + - - - - - - - - - - Generated Files Generated Files - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -280,6 +243,9 @@ Form Files + + Form Files + @@ -411,6 +377,8 @@ Resource Files + + @@ -424,6 +392,6 @@ - + \ No newline at end of file