kopia lustrzana https://gitlab.com/eliggett/wfview
If pty connected s/w sends a disable transceive command, dont' send any transceive commands to it
rodzic
3d62fb6f08
commit
469d44d6db
|
@ -117,7 +117,7 @@ void pttyHandler::receiveDataFromRigToPtty(const QByteArray& data)
|
|||
{
|
||||
|
||||
int fePos=data.lastIndexOf((char)0xfe);
|
||||
if (fePos>0)
|
||||
if (fePos > 0 && data.length() > fePos+2)
|
||||
fePos=fePos-1;
|
||||
else
|
||||
{
|
||||
|
@ -125,6 +125,13 @@ void pttyHandler::receiveDataFromRigToPtty(const QByteArray& data)
|
|||
printHex(data,false,true);
|
||||
}
|
||||
|
||||
if (disableTransceive && ((unsigned char)data[fePos + 2] == 0x00 || (unsigned char)data[fePos + 3] == 0x00))
|
||||
{
|
||||
// Ignore data that is sent to/from transceive address as client has requested transceive disabled.
|
||||
qDebug(logSerial()) << "Transceive command filtered";
|
||||
return;
|
||||
}
|
||||
|
||||
if (isConnected && (unsigned char)data[fePos + 2] != 0xE1 && (unsigned char)data[fePos + 3] != 0xE1)
|
||||
{
|
||||
// send to the pseudo port as well
|
||||
|
@ -221,12 +228,16 @@ void pttyHandler::receiveDataIn(int fd) {
|
|||
reply[3] = inPortData[2];
|
||||
sendDataOut(inPortData); // Echo command back
|
||||
sendDataOut(reply);
|
||||
if (!disableTransceive) {
|
||||
qInfo(logSerial()) << "pty requested CI-V Transceive disable";
|
||||
disableTransceive = true;
|
||||
}
|
||||
}
|
||||
else if (inPortData.length() > lastFE + 2 && ((quint8)inPortData[lastFE + 1] == civId || (quint8)inPortData[lastFE + 2] == civId))
|
||||
{
|
||||
emit haveDataFromPort(inPortData);
|
||||
//qInfo(logSerial()) << "Data from pseudo term:";
|
||||
//printHex(inPortData, false, true);
|
||||
qDebug(logSerial()) << "Data from pseudo term:";
|
||||
printHex(inPortData, false, true);
|
||||
}
|
||||
|
||||
if (rolledBack)
|
||||
|
|
|
@ -65,7 +65,7 @@ private:
|
|||
bool isConnected=false; // port opened
|
||||
mutable QMutex mutex;
|
||||
void printHex(const QByteArray& pdata, bool printVert, bool printHoriz);
|
||||
|
||||
bool disableTransceive = false;
|
||||
QSocketNotifier *ptReader = nullptr;
|
||||
quint8 civId=0;
|
||||
};
|
||||
|
|
Ładowanie…
Reference in New Issue