From db5a2310a4f8c881a066cf838b15b8350837fa0d Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Sat, 15 Mar 2025 23:44:08 -0400 Subject: [PATCH] send a return ACK on reception of a Start of Stream; --- src/common/p25/dfsi/frames/FrameDefines.h | 2 ++ src/host/modem/ModemV24.cpp | 30 +++++++++++++++++++++++ src/host/modem/ModemV24.h | 4 +++ 3 files changed, 36 insertions(+) diff --git a/src/common/p25/dfsi/frames/FrameDefines.h b/src/common/p25/dfsi/frames/FrameDefines.h index 890c2671..a2db0b9e 100644 --- a/src/common/p25/dfsi/frames/FrameDefines.h +++ b/src/common/p25/dfsi/frames/FrameDefines.h @@ -85,6 +85,8 @@ namespace p25 START_OF_STREAM = 9, //! Start of Stream END_OF_STREAM = 10, //! End of Stream + START_OF_STREAM_ACK = 14, //! Start of Stream Ack + UNDEFINED = 127 //! Undefined }; } diff --git a/src/host/modem/ModemV24.cpp b/src/host/modem/ModemV24.cpp index c2e41e89..d3b8527b 100644 --- a/src/host/modem/ModemV24.cpp +++ b/src/host/modem/ModemV24.cpp @@ -1140,6 +1140,10 @@ void ModemV24::convertToAirTIA(const uint8_t *data, uint32_t length) // bryanb: maybe compare the NACs? dataOffs += StartOfStream::LENGTH; + + // ack start of stream + // bryanb: is this really the right place to be doing this... + ackStartOfStreamTIA(); } break; case BlockType::END_OF_STREAM: @@ -1895,6 +1899,32 @@ void ModemV24::endOfStreamTIA() m_txCallInProgress = false; } +/* Send a start of stream ACK. */ + +void ModemV24::ackStartOfStreamTIA() +{ + uint16_t length = 0U; + uint8_t buffer[P25_HDU_LENGTH_BYTES]; + ::memset(buffer, 0x00U, P25_HDU_LENGTH_BYTES); + + // generate control octet + ControlOctet ctrl = ControlOctet(); + ctrl.setBlockHeaderCnt(1U); + ctrl.encode(buffer); + length += ControlOctet::LENGTH; + + // generate block header + BlockHeader hdr = BlockHeader(); + hdr.setBlockType(BlockType::START_OF_STREAM_ACK); + hdr.encode(buffer + 1U); + length += BlockHeader::LENGTH; + + if (m_trace) + Utils::dump(1U, "ModemV24::ackStartOfStreamTIA() Ack StartOfStream", buffer, length); + + queueP25Frame(buffer, length, STT_NON_IMBE); +} + /* Internal helper to convert from TIA-102 air interface to V.24/DFSI. */ void ModemV24::convertFromAir(uint8_t* data, uint32_t length) diff --git a/src/host/modem/ModemV24.h b/src/host/modem/ModemV24.h index cb48e31a..f4069f91 100644 --- a/src/host/modem/ModemV24.h +++ b/src/host/modem/ModemV24.h @@ -391,6 +391,10 @@ namespace modem * @brief Send an end of stream sequence (TDU, etc) to the connected UDP TIA-102 device. */ void endOfStreamTIA(); + /** + * @brief Send a start of stream ACK. + */ + void ackStartOfStreamTIA(); /** * @brief Internal helper to convert from TIA-102 air interface to V.24/DFSI.