translations
Phil Taylor 2024-05-20 14:35:36 +01:00
rodzic 1cf74c75e7
commit d6c0f34e68
8 zmienionych plików z 92 dodań i 52 usunięć

Wyświetl plik

@ -68,7 +68,7 @@ void cachingQueue::run()
prio = priorityLow;
else if (counter % priorityLowest == 0)
prio = priorityLowest;
}
}
counter++;
@ -89,9 +89,10 @@ void cachingQueue::run()
updateCache(false,item.command,item.param,item.receiver);
}
QCoreApplication::processEvents();
deadline.setRemainingTime(queueInterval); // reset the deadline to the poll frequency
QCoreApplication::processEvents();
}
else if (!aborted) {
// Mutex is locked
@ -101,14 +102,16 @@ void cachingQueue::run()
while (!messages.isEmpty()) {
emit sendMessage(messages.dequeue());
}
if (queueInterval != -1 && deadline.isForever())
deadline.setRemainingTime(queueInterval); // reset the deadline to the poll frequency
}
}
}
void cachingQueue::interval(quint64 val)
void cachingQueue::interval(qint64 val)
{
this->queueInterval = val;
waiting.wakeOne();
waiting.wakeAll();
qInfo() << "Changing queue interval to" << val << "ms";
}

Wyświetl plik

@ -87,7 +87,7 @@ private:
// Various other values
bool aborted=false;
QWaitCondition waiting;
quint64 queueInterval=0; // Don't start the timer!
qint64 queueInterval=-1; // Don't start the timer!
rigCapabilities* rigCaps = Q_NULLPTR; // Must be NULL until a radio is connected
@ -111,8 +111,8 @@ public:
void addUnique(queuePriority prio,queueItem item);
void del(funcs func, uchar receiver=0);
void clear();
void interval(quint64 val);
quint64 interval() {return queueInterval;}
void interval(qint64 val);
qint64 interval() {return queueInterval;}
void updateCache(bool reply, queueItem item);
void updateCache(bool reply, funcs func, QVariant value=QVariant(), uchar receiver=0);

Wyświetl plik

@ -557,7 +557,7 @@ void memories::on_group_currentIndexChanged(int index)
case 'f':
if (freqEditor != Q_NULLPTR)
delete freqEditor;
freqEditor = new tableEditor("00000.0000000",ui->table);
freqEditor = new tableEditor("00000.00000",ui->table);
ui->table->setItemDelegateForColumn(columnFrequency, freqEditor);
ui->table->showColumn(columnFrequency);
@ -566,7 +566,7 @@ void memories::on_group_currentIndexChanged(int index)
case 'F':
if (freqEditorB != Q_NULLPTR)
delete freqEditorB;
freqEditorB = new tableEditor("00000.000000",ui->table);
freqEditorB = new tableEditor("00000.00000",ui->table);
ui->table->setItemDelegateForColumn(columnFrequencyB, freqEditorB);
ui->table->showColumn(columnFrequencyB);
@ -1026,10 +1026,10 @@ void memories::receiveMemory(memoryType mem)
validData += updateCombo(scan,row,columnScan,mem.scan);
ui->table->model()->setData(ui->table->model()->index(row,columnFrequency),QString::number(double(mem.frequency.Hz/1000000.0),'f',3));
ui->table->model()->setData(ui->table->model()->index(row,columnFrequency),QString::number(double(mem.frequency.Hz/1000000.0),'f',5));
validData++;
ui->table->model()->setData(ui->table->model()->index(row,columnFrequencyB),QString::number(double(mem.frequencyB.Hz/1000000.0),'f',3));
ui->table->model()->setData(ui->table->model()->index(row,columnFrequencyB),QString::number(double(mem.frequencyB.Hz/1000000.0),'f',5));
validData++;
for (uint i=0;i<rigCaps->modes.size();i++)
@ -1205,7 +1205,6 @@ bool memories::checkASCII(QString str)
return !containsNonASCII;
}
void memories::timeout()
{
if (timeoutCount < 10 )

Wyświetl plik

@ -1103,9 +1103,9 @@ void settingswidget::setAudioDevicesUI()
serverConfig->rigs.first()->txAudioSetup.type = prefs->audioSystem;
ui->serverRXAudioInputCombo->setCurrentIndex(audioDev->findInput("Server", serverConfig->rigs.first()->rxAudioSetup.name));
serverOutputIndex = audioDev->findOutput("Server", serverConfig->rigs.first()->txAudioSetup.name);
//serverOutputIndex = audioDev->findOutput("Server", serverConfig->rigs.first()->txAudioSetup.name);
ui->serverTXAudioOutputCombo->setCurrentIndex(audioDev->findOutput("Server", serverConfig->rigs.first()->txAudioSetup.name));
serverInputIndex = audioDev->findOutput("Server", serverConfig->rigs.first()->txAudioSetup.name);
//serverInputIndex = audioDev->findOutput("Server", serverConfig->rigs.first()->txAudioSetup.name);
}
qDebug(logSystem()) << "Audio devices done.";
@ -1249,7 +1249,7 @@ void settingswidget::serverAddUserLine(int row, const QString &user, const QStri
ui->serverUsersTable->setCellWidget(ui->serverUsersTable->rowCount() - 1, 1, password);
QComboBox* comboBox = new QComboBox();
comboBox->insertItems(0, { "Full User","Full with no TX","Monitor only" });
comboBox->insertItems(0, { "Admin User", "Normal User","Normal with no TX","Monitor only" });
comboBox->setProperty("row", (int)ui->serverUsersTable->rowCount() - 1);
comboBox->setProperty("col", (int)2);
comboBox->setCurrentIndex(type);
@ -2753,12 +2753,35 @@ void settingswidget::on_satOpsBtn_clicked()
/* Beginning of UDP Server settings */
void settingswidget::on_serverRXAudioInputCombo_currentIndexChanged(int index)
{
emit changedServerRXAudioInputCombo(index);
if (index >= 0) {
if (prefs->audioSystem == qtAudio) {
serverConfig->rigs.first()->rxAudioSetup.port = audioDev->getInputDeviceInfo(index);
}
else {
serverConfig->rigs.first()->rxAudioSetup.portInt = audioDev->getInputDeviceInt(index);
}
serverConfig->rigs.first()->rxAudioSetup.name = audioDev->getInputName(index);
}
qDebug(logGui()) << "Changed server audio input to:" << serverConfig->rigs.first()->rxAudioSetup.name;
emit changedServerPref(s_audioInput);
}
void settingswidget::on_serverTXAudioOutputCombo_currentIndexChanged(int index)
{
emit changedServerTXAudioOutputCombo(index);
if (index >= 0) {
if (prefs->audioSystem == qtAudio) {
serverConfig->rigs.first()->txAudioSetup.port = audioDev->getOutputDeviceInfo(index);
}
else {
serverConfig->rigs.first()->txAudioSetup.portInt = audioDev->getOutputDeviceInt(index);
}
serverConfig->rigs.first()->txAudioSetup.name = audioDev->getOutputName(index);
}
qDebug(logGui()) << "Changed server audio output to:" << serverConfig->rigs.first()->txAudioSetup.name;
emit changedServerPref(s_audioOutput);
}
void settingswidget::on_serverEnableCheckbox_clicked(bool checked)

Wyświetl plik

@ -41,7 +41,7 @@
<item>
<widget class="QStackedWidget" name="settingsStack">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="radioAccess">
<layout class="QVBoxLayout" name="verticalLayout_21">
@ -1297,7 +1297,7 @@ ONLY use Manual CI-V when Transceive mode is not supported</string>
<x>0</x>
<y>0</y>
<width>916</width>
<height>327</height>
<height>346</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">

Wyświetl plik

@ -9,11 +9,13 @@ udpServer::udpServer(SERVERCONFIG* config, QObject* parent) :
config(config)
{
qInfo(logUdpServer()) << "Starting udp server";
queue=cachingQueue::getInstance();
}
void udpServer::init()
{
connect(queue,SIGNAL(rigCapsUpdated(rigCapabilities*)),this, SLOT(receiveRigCaps(rigCapabilities*)));
for (RIGCONFIG* rig : config->rigs)
{
qDebug(logUdpServer()) << "CIV:" << rig->civAddr;
@ -157,16 +159,19 @@ udpServer::~udpServer()
}
void udpServer::receiveRigCaps(rigCapabilities caps)
void udpServer::receiveRigCaps(rigCapabilities* caps)
{
if (caps == Q_NULLPTR)
return;
for (RIGCONFIG* rig: config->rigs) {
if (!memcmp(rig->guid, caps.guid, GUIDLEN) || config->rigs.size()==1) {
if (!memcmp(rig->guid, caps->guid, GUIDLEN) || config->rigs.size()==1) {
// Matching rig, fill-in missing details
rig->rigAvailable = true;
rig->modelName = caps.modelName;
rig->civAddr = caps.civ;
rig->modelName = caps->modelName;
rig->civAddr = caps->civ;
if (rig->rigName == "<NONE>") {
rig->rigName = caps.modelName;
rig->rigName = caps->modelName;
}
}
}
@ -360,6 +365,10 @@ void udpServer::controlReceived()
}
case (CONNINFO_SIZE):
{
//bool admin=false;
//if (in->busy && in->computer[0] != '\x0')
// admin = true;
conninfo_packet_t in = (conninfo_packet_t)r.constData();
qInfo(logUdpServer()) << current->ipAddress.toString() << ": Received request for radio connection";
// Request to start audio and civ!
@ -461,7 +470,9 @@ void udpServer::controlReceived()
if (radio->rxaudio != Q_NULLPTR)
{
// This is the first client, so stop running the queue.
radio->queueInterval = queue->interval();
queue->interval(-1);
radio->rxAudioThread = new QThread(this);
radio->rxAudioThread->setObjectName("rxAudio()");
@ -484,7 +495,6 @@ void udpServer::controlReceived()
}
}
}
break;
@ -1392,7 +1402,13 @@ void udpServer::sendConnectionInfo(CLIENT* c, quint8 guid[GUIDLEN])
// This is the current streaming client (should we support multiple clients?)
if (c->isStreaming) {
memcpy(p.computer, c->clientName.constData(), c->clientName.length());
// If not an admin user, send an empty client name.
if(c->user.userType > 0)
memcpy(p.computer, c->clientName.constData(), c->clientName.length());
else
memset(p.computer,0x0,c->clientName.length());
p.ipaddress = qToBigEndian(c->ipAddress.toIPv4Address());
}
@ -1619,6 +1635,7 @@ void udpServer::dataForServer(QByteArray d)
{
rigCommander* sender = qobject_cast<rigCommander*>(QObject::sender());
//qInfo(logUdpServer()) << "Received data for server clients";
if (sender == Q_NULLPTR)
{
return;
@ -1957,11 +1974,12 @@ void udpServer::deleteConnection(QList<CLIENT*>* l, CLIENT* c)
qInfo(logUdpServer()) << "Unable to lock connMutex()";
}
if (len == 0) {
if (l->length() == 0) {
// We have no clients connected
for (RIGCONFIG* radio : config->rigs) {
if (!memcmp(radio->guid, guid, GUIDLEN) || config->rigs.size() == 1)
{
queue->interval(radio->queueInterval);
if (radio->rxAudioThread != Q_NULLPTR) {
radio->rxAudioThread->quit();
radio->rxAudioThread->wait();

Wyświetl plik

@ -62,12 +62,12 @@ struct RIGCONFIG {
quint16 commoncap; // 0x27
quint8 unusedb; // 0x29
quint8 macaddress[6]; // 0x2a
};
};
quint8 guid[GUIDLEN]; // 0x20
};
#pragma pack(pop)
bool rigAvailable=false;
rigCapabilities rigCaps;
rigCapabilities* rigCaps = Q_NULLPTR;
rigCommander* rig = Q_NULLPTR;
QThread* rigThread = Q_NULLPTR;
audioHandler* rxaudio = Q_NULLPTR;
@ -77,6 +77,7 @@ struct RIGCONFIG {
QTimer* rxAudioTimer = Q_NULLPTR;
QTimer* connectTimer = Q_NULLPTR;
quint8 waterfallFormat;
quint64 queueInterval=0;
};
@ -122,7 +123,7 @@ public slots:
void init();
void dataForServer(QByteArray);
void receiveAudioData(const audioPacket &data);
void receiveRigCaps(rigCapabilities caps);
void receiveRigCaps(rigCapabilities* caps);
signals:
void haveDataFromServer(QByteArray);
@ -248,6 +249,7 @@ private:
QTimer* wdTimer;
networkStatus status;
cachingQueue* queue;
};

Wyświetl plik

@ -231,6 +231,8 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode
loadSettings(); // Look for saved preferences
setServerToPrefs();
//setAudioDevicesUI(); // no need to call this as it will be called by the updated() signal
setTuningSteps(); // TODO: Combine into preferences
@ -315,8 +317,6 @@ wfmain::wfmain(const QString settingsFile, const QString logFile, bool debugMode
}
emit setClusterEnableTcp(prefs.clusterTcpEnable);
setServerToPrefs();
amTransmitting = false;
connect(ui->txPowerSlider, &QSlider::sliderMoved,
@ -474,6 +474,7 @@ void wfmain::openRig()
emit sendCommSetup(rigList, prefs.radioCIVAddr, serialPortRig, prefs.serialPortBaud,prefs.virtualSerialPort, prefs.tcpPort,prefs.waterfallFormat);
ui->statusBar->showMessage(QString("Connecting to rig using serial port ").append(serialPortRig), 1000);
}
}
// Deprecated (moved to makeRig())
@ -518,7 +519,14 @@ void wfmain::makeRig()
connect(rig, SIGNAL(commReady()), this, SLOT(receiveCommReady()));
if (serverConfig.enabled) {
qInfo(logUdpServer()) << "**** Connecting rig instance to server";
connect(rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket)));
// Need to add a signal/slot for audio from the client to rig.
//connect(udp, SIGNAL(haveAudioData(audioPacket)), rig, SLOT(receiveAudioData(audioPacket)));
connect(rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray)));
connect(udp, SIGNAL(haveDataFromServer(QByteArray)), rig, SLOT(dataFromServer(QByteArray)));
}
connect(this, SIGNAL(setCIVAddr(unsigned char)), rig, SLOT(setCIVAddr(unsigned char)));
@ -950,18 +958,6 @@ void wfmain::setServerToPrefs()
udp->moveToThread(serverThread);
connect(this, SIGNAL(initServer()), udp, SLOT(init()));
connect(serverThread, SIGNAL(finished()), udp, SLOT(deleteLater()));
if (rig != Q_NULLPTR) {
connect(rig, SIGNAL(haveAudioData(audioPacket)), udp, SLOT(receiveAudioData(audioPacket)));
// Need to add a signal/slot for audio from the client to rig.
//connect(udp, SIGNAL(haveAudioData(audioPacket)), rig, SLOT(receiveAudioData(audioPacket)));
connect(rig, SIGNAL(haveDataForServer(QByteArray)), udp, SLOT(dataForServer(QByteArray)));
connect(udp, SIGNAL(haveDataFromServer(QByteArray)), rig, SLOT(dataFromServer(QByteArray)));
}
if (serverConfig.lan) {
connect(udp, SIGNAL(haveNetworkStatus(networkStatus)), this, SLOT(receiveStatusUpdate(networkStatus)));
} else {
@ -969,6 +965,9 @@ void wfmain::setServerToPrefs()
qInfo(logAudio()) << "Audio Output device " << serverConfig.rigs.first()->txAudioSetup.name;
}
connect(this, SIGNAL(initServer()), udp, SLOT(init()));
connect(serverThread, SIGNAL(finished()), udp, SLOT(deleteLater()));
serverThread->start();
emit initServer();
@ -4675,7 +4674,7 @@ void wfmain::powerRigOff()
// Clear the queue to stop sending lots of data.
queue->clear();
emit sendPowerOff();
queue->interval(0);
queue->interval(-1); // Queue Disabled
}
void wfmain::on_ritTuneDial_valueChanged(int value)
@ -5795,10 +5794,6 @@ void wfmain::receiveRigCaps(rigCapabilities* caps)
lastRequestedBand = rigCaps->bands[0].band;
}
// Added so that server receives rig capabilities.
//emit sendRigCaps(rigCaps);
foreach (auto receiver, receivers) {
// Setup various combo box up for each VFO:
receiver->clearMode();