kopia lustrzana https://gitlab.com/eliggett/wfview
Fixed situation where broadcast commands from wfview that were echo'd
back to wfview were parsed. Minor change to udphandler.cpp to remove _sleep() calls (they can be later replaced with either qt's threading library sleep call, or the unix-native usleep/msleep calls, if windows has those. Also did a minor thing with a type conversion in udphandler.merge-requests/1/head
rodzic
3f5e7e53ce
commit
fff8a6b6a3
|
@ -531,6 +531,7 @@ void rigCommander::parseData(QByteArray dataInput)
|
|||
}
|
||||
|
||||
incomingCIVAddr = data[03]; // track the CIV of the sender.
|
||||
|
||||
switch(data[02])
|
||||
{
|
||||
// case civAddr: // can't have a variable here :-(
|
||||
|
@ -555,8 +556,18 @@ void rigCommander::parseData(QByteArray dataInput)
|
|||
case '\x00':
|
||||
// data send initiated by the rig due to user control
|
||||
// extract the payload out and parse.
|
||||
payloadIn = data.right(data.length() - 4);
|
||||
parseCommand();
|
||||
if((unsigned char)data[03]==compCivAddr)
|
||||
{
|
||||
// This is an echo of our own broadcast request.
|
||||
// The data are "to 00" and "from E1"
|
||||
// Don't use it!
|
||||
#ifdef QT_DEBUG
|
||||
qDebug() << "Caught it! Found the echo'd broadcast request from us!";
|
||||
#endif
|
||||
} else {
|
||||
payloadIn = data.right(data.length() - 4);
|
||||
parseCommand();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// could be for other equipment on the CIV network.
|
||||
|
|
|
@ -23,7 +23,7 @@ udpHandler::udpHandler(QHostAddress ip, int cport, int sport, int aport,QString
|
|||
QList<QHostAddress> hostList = QHostInfo::fromName(localhostname).addresses();
|
||||
foreach(const QHostAddress & address, hostList) {
|
||||
if (address.protocol() == QAbstractSocket::IPv4Protocol && address.isLoopback() == false) {
|
||||
localIP = address.toString();
|
||||
localIP = QHostAddress(address.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ udpHandler::~udpHandler()
|
|||
SendPacketDisconnect();
|
||||
|
||||
}
|
||||
_sleep(100);
|
||||
//msleep(100);
|
||||
udp->close();
|
||||
delete udp;
|
||||
qDebug() << "Closing udpHandler";
|
||||
|
@ -397,7 +397,7 @@ udpSerial::~udpSerial()
|
|||
qDebug() << "Closing udpSerial";
|
||||
SendPacketOpenClose(true);
|
||||
SendPacketDisconnect();
|
||||
_sleep(100);
|
||||
//_sleep(100);
|
||||
udp->close();
|
||||
delete udp;
|
||||
}
|
||||
|
@ -627,13 +627,13 @@ udpAudio::~udpAudio()
|
|||
{
|
||||
qDebug() << "Closing udpAudio";
|
||||
SendPacketDisconnect();
|
||||
_sleep(100);
|
||||
|
||||
udp->close();
|
||||
delete udp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void udpAudio::DataReceived()
|
||||
{
|
||||
while (udp->hasPendingDatagrams()) {
|
||||
|
@ -878,4 +878,4 @@ QString udpBase::parseNullTerminatedString(QByteArray c, int s)
|
|||
break;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue