New option SendFrameType so one can send transparent data also to the modem serial port.

If set, one then has to specify the frame type (0x80 for modem serial of 0x90 for transparent data) as first byte af the message.
This commit is contained in:
root
2018-08-13 20:39:16 +02:00
parent f58ef17eb7
commit 86fb3b6944
5 changed files with 29 additions and 4 deletions

View File

@@ -1085,7 +1085,7 @@ bool CModem::writePOCSAGData(const unsigned char* data, unsigned int length)
return true;
}
bool CModem::writeTransparentData(const unsigned char* data, unsigned int length)
bool CModem::writeTransparentData(const unsigned char* data, unsigned int length, unsigned int sendFrameType)
{
assert(data != NULL);
assert(length > 0U);
@@ -1096,7 +1096,19 @@ bool CModem::writeTransparentData(const unsigned char* data, unsigned int length
buffer[1U] = length + 3U;
buffer[2U] = MMDVM_TRANSPARENT;
::memcpy(buffer + 3U, data, length);
if (sendFrameType>0) {
::memcpy(buffer + 2U, data, length);
length--;
buffer[1U]--;
//when sendFrameType==1 , only 0x80 and 0x90 (MMDVM_SERIAL and MMDVM_TRANSPARENT) are allowed
// and reverted to default (MMDVM_TRANSPARENT) for any other value
//when >1, frame type is not checked
if (sendFrameType==1) {
if ((buffer[2U] & 0xE0) != 0x80) buffer[2U] = MMDVM_TRANSPARENT;
}
} else {
::memcpy(buffer + 3U, data, length);
}
unsigned char len = length + 3U;
m_txTransparentData.addData(&len, 1U);