Lots more fixes and tweaks

merge-requests/9/merge
Phil Taylor 2022-01-29 22:50:58 +00:00
rodzic dd9be7c99c
commit 9ae8bc660c
13 zmienionych plików z 140 dodań i 74 usunięć

Wyświetl plik

@ -25,6 +25,9 @@
#include <QIODevice>
#endif
#include "packettypes.h"
typedef signed short MY_TYPE;
#define FORMAT RTAUDIO_SINT16
#define SCALE 32767.0
@ -61,6 +64,7 @@ struct audioPacket {
QTime time;
quint16 sent;
QByteArray data;
quint8 guid[GUIDLEN];
};
struct audioSetup {

Wyświetl plik

@ -60,7 +60,10 @@ commHandler::commHandler(QString portName, quint32 baudRate)
commHandler::~commHandler()
{
this->closePort();
if (isConnected) {
this->closePort();
}
delete port;
}
void commHandler::setupComm()
@ -78,9 +81,16 @@ void commHandler::receiveDataFromUserToRig(const QByteArray &data)
void commHandler::sendDataOut(const QByteArray &writeData)
{
mutex.lock();
// Recycle port to attempt reconnection.
if (!this->isConnected) {
closePort();
openPort();
}
if (!this->isConnected) {
return;
}
qint64 bytesWritten;
if(PTTviaRTS)
@ -230,7 +240,6 @@ void commHandler::setUseRTSforPTT(bool PTTviaRTS)
void commHandler::openPort()
{
bool success;
// port->open();
success = port->open(QIODevice::ReadWrite);
if(success)
{
@ -253,7 +262,7 @@ void commHandler::closePort()
if(port)
{
port->close();
delete port;
//delete port;
}
isConnected = false;
}

Wyświetl plik

@ -15,8 +15,9 @@
#define LOCK_PERIOD 10 // How long to try to lock mutex (ms)
#define STALE_CONNECTION 15 // Not heard from in this many seconds
#define BUFSIZE 500 // Number of packets to buffer
#define MAX_MISSING 100 // Make the maximum number of possible missing packets much less than total buffer size!
#define MAX_MISSING 50 // Make the maximum number of possible missing packets much less than total buffer size!
#define TXAUDIO_PERIOD 20
#define GUIDLEN 16
// Fixed Size Packets
@ -294,7 +295,7 @@ typedef union conninfo_packet {
char unusedh; // 0x29
char macaddress[6]; // 0x2a
};
quint8 guid[16]; // 0x20
quint8 guid[GUIDLEN]; // 0x20
};
char unusedab[16]; // 0x30
char name[32]; // 0x40
@ -339,7 +340,7 @@ typedef union radio_cap_packet {
char unused; // 0x0
char macaddress[6]; // 0x0
};
quint8 guid[16]; // 0x0
quint8 guid[GUIDLEN]; // 0x0
};
char name[32]; // 0x10
char audio[32]; // 0x30

Wyświetl plik

@ -26,11 +26,11 @@ rigCommander::rigCommander()
state.set(SCOPEFUNC, true, false);
}
rigCommander::rigCommander(quint8 guid[16])
rigCommander::rigCommander(quint8 guid[GUIDLEN])
{
qInfo(logRig()) << "creating instance of rigCommander()";
state.set(SCOPEFUNC, true, false);
memcpy(this->guid, guid, sizeof(this->guid));
memcpy(this->guid, guid, GUIDLEN);
}
rigCommander::~rigCommander()
@ -3624,7 +3624,7 @@ void rigCommander::determineRigCaps()
haveRigCaps = true;
// Copy received guid so we can recognise this radio.
memcpy(rigCaps.guid, this->guid, sizeof(rigCaps.guid));
memcpy(rigCaps.guid, this->guid, GUIDLEN);
if(!usingNativeLAN)
{

Wyświetl plik

@ -69,7 +69,7 @@ class rigCommander : public QObject
public:
rigCommander();
rigCommander(quint8 guid[16]);
rigCommander(quint8 guid[GUIDLEN]);
~rigCommander();
bool usingLAN();
@ -478,7 +478,7 @@ private:
QString serialPortError;
unsigned char localVolume=0;
quint8 guid[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
quint8 guid[GUIDLEN] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
};

Wyświetl plik

@ -7,6 +7,7 @@
#include <vector>
#include "freqmemory.h"
#include "packettypes.h"
// Credit for parts of CIV list:
// http://www.docksideradio.com/Icom%20Radio%20Hex%20Addresses.htm
@ -138,7 +139,7 @@ struct rigCapabilities {
std::vector <mode_info> modes;
QByteArray transceiveCommand;
quint8 guid[16] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
quint8 guid[GUIDLEN] = { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 };
quint32 baudRate;
};

Wyświetl plik

@ -234,7 +234,7 @@ void servermain::receiveCommReady()
for (RIGCONFIG* radio : serverConfig.rigs)
{
if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, sizeof(radio->guid)))
if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !memcmp(sender->getGUID(), radio->guid, GUIDLEN))
{
qInfo(logSystem()) << "Received CommReady!! ";
@ -243,9 +243,11 @@ void servermain::receiveCommReady()
// tell rigCommander to broadcast a request for all rig IDs.
// qInfo(logSystem()) << "Beginning search from wfview for rigCIV (auto-detection broadcast)";
if (!radio->rigAvailable) {
QMetaObject::invokeMethod(radio->rig, [=]() {
radio->rig->findRigs();
}, Qt::QueuedConnection);
if (radio->connectTimer == Q_NULLPTR) {
radio->connectTimer = new QTimer();
connect(radio->connectTimer, &QTimer::timeout, this, std::bind(&servermain::connectToRig, this, radio));
}
radio->connectTimer->start(500);
}
}
else {
@ -260,6 +262,18 @@ void servermain::receiveCommReady()
}
}
void servermain::connectToRig(RIGCONFIG* rig)
{
if (!rig->rigAvailable) {
//qDebug(logSystem()) << "Searching for rig on" << rig->serialPort;
QMetaObject::invokeMethod(rig->rig, [=]() {
rig->rig->findRigs();
}, Qt::QueuedConnection);
}
else {
rig->connectTimer->stop();
}
}
void servermain::receiveFoundRigID(rigCapabilities rigCaps)
{
@ -272,7 +286,7 @@ void servermain::receiveFoundRigID(rigCapabilities rigCaps)
for (RIGCONFIG* radio : serverConfig.rigs)
{
if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, sizeof(radio->guid)))
if (sender != Q_NULLPTR && radio->rig != Q_NULLPTR && !radio->rigAvailable && !memcmp(sender->getGUID(), radio->guid, GUIDLEN))
{
qDebug(logSystem()) << "Rig name: " << rigCaps.modelName;
@ -521,7 +535,7 @@ void servermain::loadSettings()
guid = QUuid::createUuid().toString();
settings->setValue("GUID", guid);
}
memcpy(tempPrefs->guid, QUuid::fromString(guid).toRfc4122().constData(), sizeof(tempPrefs->guid));
memcpy(tempPrefs->guid, QUuid::fromString(guid).toRfc4122().constData(), GUIDLEN);
tempPrefs->rxAudioSetup.isinput = true;
tempPrefs->txAudioSetup.isinput = false;
@ -576,7 +590,12 @@ void servermain::loadSettings()
//qInfo(logAudio()) << "Looking for audio output devices";
for (const QAudioDeviceInfo& deviceInfo : audioOutputs) {
if (deviceInfo.deviceName() == tempPrefs->txAudioSetup.name) {
if (deviceInfo.deviceName() == tempPrefs->txAudioSetup.name
#ifdef Q_OS_WIN
&& deviceInfo.realm() == "wasapi"
#endif
) {
qDebug(logSystem()) << "Audio output: " << deviceInfo.deviceName() << "Realm:" << deviceInfo.realm();
tempPrefs->txAudioSetup.port = deviceInfo;
txDeviceFound = true;
}
@ -584,7 +603,12 @@ void servermain::loadSettings()
//qInfo(logAudio()) << "Looking for audio input devices";
for (const QAudioDeviceInfo& deviceInfo : audioInputs) {
if (deviceInfo.deviceName() == tempPrefs->rxAudioSetup.name) {
if (deviceInfo.deviceName() == tempPrefs->rxAudioSetup.name
#ifdef Q_OS_WIN
&& deviceInfo.realm() == "wasapi"
#endif
) {
qDebug(logSystem()) << "Audio input: " << deviceInfo.deviceName() << "Realm:" << deviceInfo.realm();
tempPrefs->rxAudioSetup.port = deviceInfo;
rxDeviceFound = true;
}

Wyświetl plik

@ -175,6 +175,7 @@ private slots:
void handlePttLimit();
void receiveStatusUpdate(networkStatus status);
void receiveStateInfo(rigstate* state);
void connectToRig(RIGCONFIG* rig);
private:
QSettings *settings=Q_NULLPTR;

Wyświetl plik

@ -198,7 +198,7 @@ void udpHandler::dataReceived()
if (txSetup.codec == 0) {
txString = "(no tx)";
}
status.message = QString("<pre>%1 rx latency: %2 / rtt: %3 ms / loss: %4/%5</pre>").arg(txString).arg(tempLatency).arg(latency, 3).arg(status.packetsLost, 3).arg(status.packetsSent, 3);
status.message = QString("<pre>%1 rx latency: %2 / rtt: %3 ms / loss: %4/%5</pre>").arg(txString).arg(tempLatency).arg(status.networkLatency, 3).arg(status.packetsLost, 3).arg(status.packetsSent, 3);
if (audio != Q_NULLPTR) {
status.rxAudioLevel = audio->getRxAmplitude();
@ -370,7 +370,7 @@ void udpHandler::dataReceived()
radios[f].macaddress[3] == in->macaddress[3] &&
radios[f].macaddress[4] == in->macaddress[4] &&
radios[f].macaddress[5] == in->macaddress[5]) ||
!memcmp(radios[f].guid,in->guid,sizeof(in->guid)))
!memcmp(radios[f].guid,in->guid, GUIDLEN))
{
emit setRadioUsage(f, in->busy, QString(in->computer), ip.toString());
}
@ -408,7 +408,7 @@ void udpHandler::dataReceived()
{
if ((r.length() - CAPABILITIES_SIZE) % RADIO_CAP_SIZE != 0)
{
qInfo(logUdp()) << this->metaObject()->className() << "Packet received" << r.length() << "not recognised";
// Likely a retransmit request?
break;
}
@ -468,7 +468,7 @@ void udpHandler::setCurrentRadio(quint8 radio) {
}
else {
useGuid = true;
memcpy(&guid, radios[radio].guid, sizeof(guid));
memcpy(&guid, radios[radio].guid, GUIDLEN);
}
devName =radios[radio].name;
@ -499,7 +499,7 @@ void udpHandler::sendRequestStream()
memcpy(&p.macaddress, macaddress, 6);
}
else {
memcpy(&p.guid, guid, sizeof(p.guid));
memcpy(&p.guid, guid, GUIDLEN);
}
p.innerseq = authSeq++;
p.tokrequest = tokRequest;
@ -1265,10 +1265,10 @@ void udpBase::dataReceived(QByteArray r)
if (in->seq > rxSeqBuf.lastKey() + 1) {
// We are likely missing packets then!
missingMutex.lock();
int missCounter = 0;
//int missCounter = 0;
for (quint16 f = rxSeqBuf.lastKey() + 1; f < in->seq; f++)
{
qDebug(logUdp()) << "Detected missing packet" << f;
//qDebug(logUdp()) << "Detected missing packet" << f;
if (rxSeqBuf.size() > BUFSIZE)
{

Wyświetl plik

@ -43,10 +43,10 @@ struct networkStatus {
quint8 txAudioLevel;
quint16 rxLatency;
quint16 txLatency;
quint32 packetsSent;
quint32 packetsLost;
quint16 rtt;
quint32 networkLatency;
quint32 packetsSent=0;
quint32 packetsLost=0;
quint16 rtt=0;
quint32 networkLatency=0;
QString message;
};
@ -289,7 +289,7 @@ private:
quint32 token;
// These are for stream ident info.
quint8 macaddress[8];
quint8 guid[16];
quint8 guid[GUIDLEN];
bool useGuid = false;
QByteArray usernameEncoded;
QByteArray passwordEncoded;

Wyświetl plik

@ -40,7 +40,7 @@ void udpServer::init()
.arg(rig->guid[15], 2, 16, QLatin1Char('0'))
;
}
srand(time(NULL)); // Generate random key
srand(time(NULL)); // Generate random
timeStarted.start();
// Convoluted way to find the external IP address, there must be a better way????
QString localhostname = QHostInfo::localHostName();
@ -109,7 +109,7 @@ udpServer::~udpServer()
deleteConnection(&audioClients, client);
}
// Now all connections are deleted, close and delete the sockets.
// Now all connections are deleted, close and delete the sockets
if (udpControl != Q_NULLPTR) {
udpControl->close();
delete udpControl;
@ -131,18 +131,19 @@ udpServer::~udpServer()
void udpServer::receiveRigCaps(rigCapabilities caps)
{
for (RIGCONFIG* rig: config.rigs) {
if (!memcmp(rig->guid, caps.guid, sizeof(rig->guid))) {
if (!memcmp(rig->guid, caps.guid, GUIDLEN)) {
// Matching rig, fill-in missing details
rig->rigAvailable = true;
rig->modelName = caps.modelName;
rig->civAddr = caps.civ;
if (rig->rigName=="<NONE>") {
if (rig->rigName == "<NONE>") {
rig->rigName = caps.modelName;
}
}
}
}
void udpServer::controlReceived()
{
// Received data on control port.
@ -274,7 +275,7 @@ void udpServer::controlReceived()
sendTokenResponse(current, in->res);
current->isStreaming = false;
for (RIGCONFIG* radio : config.rigs) {
if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)))
if (!memcmp(radio->guid, current->guid, GUIDLEN))
{
sendConnectionInfo(current, radio->guid);
}
@ -334,7 +335,7 @@ void udpServer::controlReceived()
current->txBufferLen = qFromBigEndian<quint32>(in->txbuffer);
current->authInnerSeq = in->innerseq;
memcpy(current->guid, in->guid, sizeof(in->guid));
memcpy(current->guid, in->guid, GUIDLEN);
sendStatus(current);
current->authInnerSeq = 0x00;
sendConnectionInfo(current,in->guid);
@ -347,7 +348,7 @@ void udpServer::controlReceived()
audioSetup setup;
setup.resampleQuality = config.resampleQuality;
for (RIGCONFIG* radio : config.rigs) {
if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) && radio->txaudio == Q_NULLPTR)
if (!memcmp(radio->guid, current->guid, GUIDLEN) && radio->txaudio == Q_NULLPTR)
{
radio->txAudioSetup.codec = current->txCodec;
radio->txAudioSetup.samplerate = current->txSampleRate;
@ -380,7 +381,7 @@ void udpServer::controlReceived()
connect(this, SIGNAL(haveAudioData(audioPacket)), radio->txaudio, SLOT(incomingAudio(audioPacket)));
}
if (!memcmp(radio->guid, current->guid, sizeof(radio->guid)) && radio->rxaudio == Q_NULLPTR)
if (!memcmp(radio->guid, current->guid, GUIDLEN) && radio->rxaudio == Q_NULLPTR)
{
#if !defined(PORTAUDIO) && !defined(RTAUDIO)
qInfo(logUdpServer()) << "Radio" << radio->rigName << "audio input(RX) :" << radio->rxAudioSetup.port.deviceName();
@ -472,7 +473,7 @@ void udpServer::civReceived()
{
current->controlClient = client;
client->civClient = current;
memcpy(current->guid, client->guid, sizeof(current->guid));
memcpy(current->guid, client->guid, GUIDLEN);
}
}
}
@ -639,7 +640,7 @@ void udpServer::audioReceived()
{
current->controlClient = client;
client->audioClient = current;
memcpy(current->guid, client->guid, sizeof(current->guid));
memcpy(current->guid, client->guid, GUIDLEN);
}
}
}
@ -901,7 +902,7 @@ void udpServer::commonReceived(QList<CLIENT*>* l, CLIENT* current, QByteArray r)
if (current->rxMutex.try_lock_for(std::chrono::milliseconds(LOCK_PERIOD)))
{
// Add incoming packet to the received buffer and if it is in the missing buffer, remove it.
int missCounter = 0;
//int missCounter = 0;
if (in->seq > current->rxSeqBuf.lastKey() + 1) {
// We are likely missing packets then!
if (current->missMutex.try_lock_for(std::chrono::milliseconds(LOCK_PERIOD)))
@ -1169,7 +1170,7 @@ void udpServer::sendCapabilities(CLIENT* c)
radio_cap_packet r;
memset(r.packet, 0x0, sizeof(r)); // We can't be sure it is initialized with 0x00!
memcpy(r.guid, rig->guid, sizeof(r.guid));
memcpy(r.guid, rig->guid, GUIDLEN);
memcpy(r.name, rig->rigName.toLocal8Bit(), sizeof(r.name));
memcpy(r.audio, QByteArrayLiteral("ICOM_VAUDIO").constData(), 11);
@ -1268,10 +1269,10 @@ void udpServer::sendCapabilities(CLIENT* c)
// When client has requested civ/audio connection, this will contain their details
// Also used to display currently connected used information.
void udpServer::sendConnectionInfo(CLIENT* c, quint8 guid[16])
void udpServer::sendConnectionInfo(CLIENT* c, quint8 guid[GUIDLEN])
{
for (RIGCONFIG* radio : config.rigs) {
if (!memcmp(guid, radio->guid, sizeof(guid)))
if (!memcmp(guid, radio->guid, GUIDLEN))
{
qInfo(logUdpServer()) << c->ipAddress.toString() << "(" << c->type << "): Sending ConnectionInfo :" << c->txSeq;
conninfo_packet p;
@ -1285,7 +1286,7 @@ void udpServer::sendConnectionInfo(CLIENT* c, quint8 guid[16])
p.tokrequest = c->tokenRx;
p.token = c->tokenTx;
p.code = 0x0380;
memcpy(p.guid, radio->guid, sizeof(p.guid));
memcpy(p.guid, radio->guid, GUIDLEN);
memcpy(p.name, radio->rigName.toLocal8Bit(), sizeof(p.name));
if (radio->rigAvailable) {
@ -1532,7 +1533,7 @@ void udpServer::dataForServer(QByteArray d)
continue;
}
// Use the GUID to determine which radio the response is from
if (memcmp(sender->getGUID(), client->guid, sizeof(client->guid)))
if (memcmp(sender->getGUID(), client->guid, GUIDLEN))
{
continue; // Rig guid doesn't match the one requested by the client.
}
@ -1606,6 +1607,7 @@ void udpServer::sendRxAudio()
int len = 0;
while (len < audio.length()) {
audioPacket partial;
memcpy(partial.guid, rig->guid, GUIDLEN);
partial.data = audio.mid(len, 1364);
receiveAudioData(partial);
len = len + partial.data.length();
@ -1624,10 +1626,19 @@ void udpServer::sendRxAudio()
void udpServer::receiveAudioData(const audioPacket& d)
{
rigCommander* sender = qobject_cast<rigCommander*>(QObject::sender());
quint8 guid[GUIDLEN];
if (sender != Q_NULLPTR)
{
memcpy(guid, sender->getGUID(), GUIDLEN);
}
else {
memcpy(guid, d.guid, GUIDLEN);
}
//qInfo(logUdpServer()) << "Server got:" << d.data.length();
foreach(CLIENT * client, audioClients)
{
if (client != Q_NULLPTR && client->connected) {
if (client != Q_NULLPTR && client->connected && !memcmp(client->guid,guid, GUIDLEN)) {
audio_packet p;
memset(p.packet, 0x0, sizeof(p)); // We can't be sure it is initialized with 0x00!
p.len = sizeof(p) + d.data.length();
@ -1782,8 +1793,8 @@ void udpServer::sendRetransmitRequest(CLIENT* c)
void udpServer::deleteConnection(QList<CLIENT*>* l, CLIENT* c)
{
quint8 guid[16];
memcpy(guid, c->guid, sizeof(guid));
quint8 guid[GUIDLEN];
memcpy(guid, c->guid, GUIDLEN);
int len = l->length();
qInfo(logUdpServer()) << "Deleting" << c->type << "connection to: " << c->ipAddress.toString() << ":" << QString::number(c->port);
@ -1856,7 +1867,7 @@ void udpServer::deleteConnection(QList<CLIENT*>* l, CLIENT* c)
if (len == 0) {
for (RIGCONFIG* radio : config.rigs) {
if (!memcmp(radio->guid, guid, sizeof(radio->guid)))
if (!memcmp(radio->guid, guid, GUIDLEN))
{
if (radio->rxAudioTimer != Q_NULLPTR) {
radio->rxAudioTimer->stop();

Wyświetl plik

@ -54,7 +54,7 @@ struct RIGCONFIG {
audioSetup txAudioSetup;
QString modelName;
QString rigName;
quint8 guid[16];
quint8 guid[GUIDLEN];
bool rigAvailable=false;
rigCapabilities rigCaps;
rigCommander* rig = Q_NULLPTR;
@ -64,7 +64,7 @@ struct RIGCONFIG {
audioHandler* txaudio = Q_NULLPTR;
QThread* txAudioThread = Q_NULLPTR;
QTimer* rxAudioTimer = Q_NULLPTR;
QTimer* connectTimer = Q_NULLPTR;
};
@ -167,7 +167,7 @@ private:
CLIENT* controlClient = Q_NULLPTR;
CLIENT* civClient = Q_NULLPTR;
CLIENT* audioClient = Q_NULLPTR;
quint8 guid[16];
quint8 guid[GUIDLEN];
};
void controlReceived();
@ -179,7 +179,7 @@ private:
void sendControl(CLIENT* c, quint8 type, quint16 seq);
void sendLoginResponse(CLIENT* c, bool allowed);
void sendCapabilities(CLIENT* c);
void sendConnectionInfo(CLIENT* c,quint8 guid[16]);
void sendConnectionInfo(CLIENT* c,quint8 guid[GUIDLEN]);
void sendTokenResponse(CLIENT* c,quint8 type);
void sendStatus(CLIENT* c);
void sendRetransmitRequest(CLIENT* c);

Wyświetl plik

@ -446,6 +446,11 @@ void wfmain::makeRig()
connect(rig, SIGNAL(stateInfo(rigstate*)), rigCtl, SLOT(receiveStateInfo(rigstate*)));
connect(rigCtl, SIGNAL(stateUpdated()), rig, SLOT(stateUpdated()));
}
// Create link for server so it can have easy access to rig.
if (serverConfig.rigs.first() != Q_NULLPTR) {
serverConfig.rigs.first()->rig = rig;
serverConfig.rigs.first()->rigThread = rigThread;
}
}
}
@ -1163,7 +1168,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();
//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)
@ -1659,18 +1664,29 @@ void wfmain::loadSettings()
ui->serverCivPortText->setText(QString::number(serverConfig.civPort));
ui->serverAudioPortText->setText(QString::number(serverConfig.audioPort));
serverRxSetup.isinput = true;
RIGCONFIG* rigTemp = new RIGCONFIG();
rigTemp->rxAudioSetup.isinput = true;
rigTemp->txAudioSetup.isinput = true;
rigTemp->rxAudioSetup.localAFgain = 255;
rigTemp->txAudioSetup.localAFgain = 255;
rigTemp->rxAudioSetup.resampleQuality = 4;
rigTemp->txAudioSetup.resampleQuality = 4;
serverTxSetup.isinput = false;
rigTemp->baudRate = prefs.serialPortBaud;
rigTemp->civAddr = prefs.radioCIVAddr;
rigTemp->serialPort = prefs.serialPortBaud;
serverRxSetup.localAFgain = 255;
serverTxSetup.localAFgain = 255;
QString guid = settings->value("GUID", "").toString();
if (guid.isEmpty()) {
guid = QUuid::createUuid().toString();
settings->setValue("GUID", guid);
}
memcpy(rigTemp->guid, QUuid::fromString(guid).toRfc4122().constData(), GUIDLEN);
ui->serverRXAudioInputCombo->blockSignals(true);
serverRxSetup.name = settings->value("ServerAudioInput", "").toString();
qInfo(logGui()) << "Got Server Audio Input: " << serverRxSetup.name;
int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(serverRxSetup.name);
rigTemp->rxAudioSetup.name = settings->value("ServerAudioInput", "").toString();
qInfo(logGui()) << "Got Server Audio Input: " << rigTemp->rxAudioSetup.name;
int serverAudioInputIndex = ui->serverRXAudioInputCombo->findText(rigTemp->rxAudioSetup.name);
if (serverAudioInputIndex != -1) {
ui->serverRXAudioInputCombo->setCurrentIndex(serverAudioInputIndex);
#if defined(RTAUDIO)
@ -1679,18 +1695,15 @@ void wfmain::loadSettings()
serverRxSetup.port = ui->serverRXAudioInputCombo->itemData(serverAudioInputIndex).toInt();
#else
QVariant v = ui->serverRXAudioInputCombo->currentData();
serverRxSetup.port = v.value<QAudioDeviceInfo>();
rigTemp->rxAudioSetup.port = v.value<QAudioDeviceInfo>();
#endif
}
ui->serverRXAudioInputCombo->blockSignals(false);
serverRxSetup.resampleQuality = rxSetup.resampleQuality;
serverTxSetup.resampleQuality = serverRxSetup.resampleQuality;
ui->serverTXAudioOutputCombo->blockSignals(true);
serverTxSetup.name = settings->value("ServerAudioOutput", "").toString();
qInfo(logGui()) << "Got Server Audio Output: " << serverTxSetup.name;
int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(serverTxSetup.name);
rigTemp->txAudioSetup.name = settings->value("ServerAudioOutput", "").toString();
qInfo(logGui()) << "Got Server Audio Output: " << rigTemp->txAudioSetup.name;
int serverAudioOutputIndex = ui->serverTXAudioOutputCombo->findText(rigTemp->txAudioSetup.name);
if (serverAudioOutputIndex != -1) {
ui->serverTXAudioOutputCombo->setCurrentIndex(serverAudioOutputIndex);
#if defined(RTAUDIO)
@ -1699,11 +1712,13 @@ void wfmain::loadSettings()
serverTxSetup.port = ui->serverTXAudioOutputCombo->itemData(serverAudioOutputIndex).toInt();
#else
QVariant v = ui->serverTXAudioOutputCombo->currentData();
serverTxSetup.port = v.value<QAudioDeviceInfo>();
rigTemp->txAudioSetup.port = v.value<QAudioDeviceInfo>();
#endif
}
ui->serverTXAudioOutputCombo->blockSignals(false);
serverConfig.rigs.append(rigTemp);
int row = 0;
ui->serverUsersTable->setRowCount(0);