kopia lustrzana https://gitlab.com/eliggett/wfview
Add widget to rhs of statusBar
rodzic
163af0be66
commit
8dd8b3a088
Plik binarny nie jest wyświetlany.
|
@ -32,6 +32,7 @@ signals:
|
|||
void sendDataOutToPort(const QByteArray &writeData); // not used
|
||||
void haveDataFromPort(QByteArray data); // emit this when we have data, connect to rigcommander
|
||||
void haveSerialPortError(const QString port, const QString error);
|
||||
void haveStatusUpdate(const QString text);
|
||||
|
||||
private:
|
||||
void setupComm();
|
||||
|
|
|
@ -118,6 +118,7 @@ rigCommander::rigCommander(unsigned char rigCivAddr, QHostAddress ip, int cport,
|
|||
|
||||
// Connect for errors/alerts
|
||||
connect(udp, SIGNAL(haveNetworkError(QString, QString)), this, SLOT(handleSerialPortError(QString, QString)));
|
||||
connect(udp, SIGNAL(haveNetworkStatus(QString)), this, SLOT(handleStatusUpdate(QString)));
|
||||
|
||||
//connect(this, SIGNAL(getMoreDebug()), comm, SLOT(debugThis()));
|
||||
pttAllowed = true; // This is for developing, set to false for "safe" debugging. Set to true for deployment.
|
||||
|
@ -146,6 +147,11 @@ void rigCommander::handleSerialPortError(const QString port, const QString error
|
|||
emit haveSerialPortError(port, errorText);
|
||||
}
|
||||
|
||||
void rigCommander::handleStatusUpdate(const QString text)
|
||||
{
|
||||
emit haveStatusUpdate(text);
|
||||
}
|
||||
|
||||
void rigCommander::findRigs()
|
||||
{
|
||||
// This function sends data to 0x00 ("broadcast") to look for any connected rig.
|
||||
|
|
|
@ -62,6 +62,7 @@ public slots:
|
|||
void setCIVAddr(unsigned char civAddr);
|
||||
void handleNewData(const QByteArray &data);
|
||||
void handleSerialPortError(const QString port, const QString errorText);
|
||||
void handleStatusUpdate(const QString text);
|
||||
void sayFrequency();
|
||||
void sayMode();
|
||||
void sayAll();
|
||||
|
@ -72,6 +73,7 @@ signals:
|
|||
void haveRigID(rigCapabilities rigCaps);
|
||||
void discoveredRigID(rigCapabilities rigCaps);
|
||||
void haveSerialPortError(const QString port, const QString errorText);
|
||||
void haveStatusUpdate(const QString text);
|
||||
void haveFrequency(double frequencyMhz);
|
||||
void haveMode(QString mode);
|
||||
void haveDataMode(bool dataModeEnabled);
|
||||
|
|
|
@ -171,6 +171,8 @@ void udpHandler::DataReceived()
|
|||
if (!serialAndAudioOpened && r.mid(0, 6) == QByteArrayLiteral("\x90\x00\x00\x00\x00\x00") && r[96] == (char)0x01)
|
||||
{
|
||||
devname = parseNullTerminatedString(r, 64);
|
||||
emit haveNetworkStatus(devname);
|
||||
|
||||
qDebug() << "Got serial and audio request success, device name: " << devname;
|
||||
|
||||
// Stuff can change in the meantime because of a previous login...
|
||||
|
@ -445,10 +447,25 @@ void udpSerial::DataReceived()
|
|||
break;
|
||||
default:
|
||||
if (r.length() > 21) {
|
||||
uint16_t gotSeq = qFromLittleEndian<quint16>(r.mid(6, 2));
|
||||
|
||||
/*
|
||||
// We should probably check for missing packets?
|
||||
//uint16_t gotSeq = qFromLittleEndian<quint16>(r.mid(6, 2));
|
||||
// First check if we are missing any packets?
|
||||
uint16_t gotSeq = qFromLittleEndian<quint16>(r.mid(6, 2));
|
||||
if (lastReceivedSeq == 0 || lastReceivedSeq > gotSeq) {
|
||||
lastReceivedSeq = gotSeq;
|
||||
}
|
||||
|
||||
for (uint16_t f = lastReceivedSeq + 1; f < gotSeq; f++) {
|
||||
// Do we need to request a retransmit?
|
||||
qDebug() << this->metaObject()->className() << ": Missing Sequence: (" << r.length() << ") " << f;
|
||||
}
|
||||
|
||||
*/
|
||||
lastReceivedSeq = gotSeq;
|
||||
|
||||
quint8 temp = r[0] - 0x15;
|
||||
|
||||
if ((quint8)r[16] == 0xc1 && (quint8)r[17] == temp)
|
||||
{
|
||||
emit Receive(r.mid(21));
|
||||
|
@ -567,40 +584,31 @@ void udpAudio::DataReceived()
|
|||
default:
|
||||
if (r.length() >= 580 && (r.mid(0, 6) == QByteArrayLiteral("\x6c\x05\x00\x00\x00\x00") || r.mid(0, 6) == QByteArrayLiteral("\x44\x02\x00\x00\x00\x00")))
|
||||
{
|
||||
// This is an audio packet!
|
||||
// First check if we are missing any packets
|
||||
// Audio stream does not send periodic pkt0 so seq "should" be sequential.
|
||||
uint16_t gotSeq = qFromLittleEndian<quint16>(r.mid(6, 2));
|
||||
|
||||
if (lastSeq > 0 && gotSeq > lastSeq + 1)
|
||||
{
|
||||
for (uint16_t f = lastSeq; f < gotSeq; f++)
|
||||
qDebug() << "Missing Audio Sequence: (" << r.length() << ") " << f;
|
||||
lastSeq = gotSeq;
|
||||
if (lastReceivedSeq == 0 || lastReceivedSeq > gotSeq) {
|
||||
lastReceivedSeq = gotSeq;
|
||||
}
|
||||
|
||||
// Actual audio data is r[24] onwards sent in two groups.
|
||||
bool duplicate = false;
|
||||
for (uint16_t f = 0; f < seqBuf.length(); f++)
|
||||
{
|
||||
if (seqBuf[f].seqNum == gotSeq)
|
||||
{
|
||||
duplicate = true;
|
||||
}
|
||||
}
|
||||
if (!duplicate)
|
||||
{
|
||||
//qDebug() << "Got Audio Sequence: (" << r.length() << ") " << gotSeq;
|
||||
// Delete contents of buffer up to existing pos()
|
||||
buffer->buffer().remove(0,buffer->pos());
|
||||
// Seek to end of curent buffer
|
||||
buffer->seek(buffer->size());
|
||||
// Append to end of buffer
|
||||
buffer->write(r.mid(24).constData(), r.mid(24).length());
|
||||
// Seek to start of buffer.
|
||||
buffer->seek(0);
|
||||
for (uint16_t f = lastReceivedSeq + 1; f < gotSeq; f++) {
|
||||
// Do we need to request a retransmit?
|
||||
qDebug() << this->metaObject()->className() << ": Missing Sequence: (" << r.length() << ") " << f;
|
||||
}
|
||||
|
||||
lastReceivedSeq = gotSeq;
|
||||
|
||||
//qDebug() << "Got Audio Sequence: (" << r.length() << ") " << gotSeq;
|
||||
// Delete contents of buffer up to existing pos()
|
||||
buffer->buffer().remove(0,buffer->pos());
|
||||
// Seek to end of curent buffer
|
||||
buffer->seek(buffer->size());
|
||||
// Append to end of buffer
|
||||
buffer->write(r.mid(24).constData(), r.mid(24).length());
|
||||
// Seek to start of buffer.
|
||||
buffer->seek(0);
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
udpBase::DataReceived(r); // Call parent function to process the rest.
|
||||
|
@ -750,8 +758,6 @@ void udpBase::SendPkt0Idle(bool tracked=true,quint16 seq=0)
|
|||
// Send periodic idle packets (every 3000ms)
|
||||
void udpBase::SendPkt7Idle()
|
||||
{
|
||||
|
||||
|
||||
QMutexLocker locker(&mutex);
|
||||
//qDebug() << this->metaObject()->className() << " tx buffer size:" << txSeqBuf.length();
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ public:
|
|||
uint16_t innerSendSeq = 0;
|
||||
uint16_t sendSeqB = 0;
|
||||
uint16_t sendSeq = 1;
|
||||
uint16_t lastReceivedSeq = 0;
|
||||
uint16_t pkt0SendSeq = 0;
|
||||
uint16_t pkt7SendSeq = 0;
|
||||
uint16_t periodicSeq = 0;
|
||||
|
@ -123,7 +124,6 @@ private:
|
|||
QAudioFormat format;
|
||||
|
||||
bool sentPacketConnect2 = false;
|
||||
uint16_t lastSeq = 0;
|
||||
uint16_t sendAudioSeq = 0;
|
||||
|
||||
};
|
||||
|
@ -155,6 +155,7 @@ signals:
|
|||
void RigConnected(const QString&);
|
||||
void haveDataFromPort(QByteArray data); // emit this when we have data, connect to rigcommander
|
||||
void haveNetworkError(QString, QString);
|
||||
void haveNetworkStatus(QString);
|
||||
|
||||
private:
|
||||
|
||||
|
|
11
wfmain.cpp
11
wfmain.cpp
|
@ -222,7 +222,8 @@ wfmain::wfmain(const QString serialPortCL, const QString hostCL, QWidget *parent
|
|||
ui->afGainSlider->setSingleStep(100);
|
||||
ui->afGainSlider->setSingleStep(100);
|
||||
|
||||
|
||||
rigStatus = new QLabel(this);
|
||||
ui->statusBar->addPermanentWidget(rigStatus);
|
||||
ui->statusBar->showMessage("Connecting to rig...", 1000);
|
||||
|
||||
delayedCommand = new QTimer(this);
|
||||
|
@ -468,7 +469,8 @@ void wfmain::openRig()
|
|||
rig->moveToThread(rigThread);
|
||||
connect(rigThread, SIGNAL(started()), rig, SLOT(process()));
|
||||
connect(rig, SIGNAL(finished()), rigThread, SLOT(quit()));
|
||||
connect(rig, SIGNAL(haveSerialPortError(QString,QString)), this, SLOT(receiveSerialPortError(QString,QString)));
|
||||
connect(rig, SIGNAL(haveSerialPortError(QString, QString)), this, SLOT(receiveSerialPortError(QString, QString)));
|
||||
connect(rig, SIGNAL(haveStatusUpdate(QString)), this, SLOT(receiveStatusUpdate(QString)));
|
||||
rigThread->start();
|
||||
connect(this, SIGNAL(getRigCIV()), rig, SLOT(findRigs()));
|
||||
connect(rig, SIGNAL(discoveredRigID(rigCapabilities)), this, SLOT(receiveFoundRigID(rigCapabilities)));
|
||||
|
@ -514,6 +516,11 @@ void wfmain::receiveSerialPortError(QString port, QString errorText)
|
|||
// TODO: Dialog box, exit, etc
|
||||
}
|
||||
|
||||
void wfmain::receiveStatusUpdate(QString text)
|
||||
{
|
||||
this->rigStatus->setText(text);
|
||||
}
|
||||
|
||||
void wfmain::setDefPrefs()
|
||||
{
|
||||
defPrefs.useFullScreen = false;
|
||||
|
|
2
wfmain.h
2
wfmain.h
|
@ -121,6 +121,7 @@ private slots:
|
|||
void receiveRigID(rigCapabilities rigCaps);
|
||||
void receiveFoundRigID(rigCapabilities rigCaps);
|
||||
void receiveSerialPortError(QString port, QString errorText);
|
||||
void receiveStatusUpdate(QString errorText);
|
||||
void handlePlotClick(QMouseEvent *);
|
||||
void handlePlotDoubleClick(QMouseEvent *);
|
||||
void handleWFClick(QMouseEvent *);
|
||||
|
@ -322,6 +323,7 @@ private:
|
|||
QStringList spans;
|
||||
QStringList edges;
|
||||
QStringList commPorts;
|
||||
QLabel* rigStatus;
|
||||
|
||||
quint16 spectWidth;
|
||||
quint16 wfLength;
|
||||
|
|
|
@ -1321,7 +1321,10 @@
|
|||
<item>
|
||||
<widget class="QLineEdit" name="passwordTxt">
|
||||
<property name="inputMethodHints">
|
||||
<set>Qt::ImhSensitiveData</set>
|
||||
<set>Qt::ImhNoAutoUppercase|Qt::ImhNoPredictiveText|Qt::ImhSensitiveData</set>
|
||||
</property>
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::PasswordEchoOnEdit</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
Ładowanie…
Reference in New Issue