[KEEP CALM AND RELAX] remove some deprecated DFSI support code (this is going to be done in a different way and this code is essentially abandonded);

pull/32/head
Bryan Biedenkapp 3 years ago
parent cdce663a55
commit 412d6cfc7c

@ -55,8 +55,6 @@ file(GLOB dvmhost_SRC
"src/p25/data/*.cpp"
"src/p25/dfsi/*.h"
"src/p25/dfsi/*.cpp"
"src/p25/dfsi/packet/*.h"
"src/p25/dfsi/packet/*.cpp"
"src/p25/edac/*.h"
"src/p25/edac/*.cpp"
"src/p25/lc/*.h"
@ -171,12 +169,6 @@ else ()
message(CHECK_START "NXDN Digital Mode - disabled")
endif (ENABLE_NXDN)
option(ENABLE_DFSI_SUPPORT "Enable P25 DFSI Transport Support" off)
if (ENABLE_DFSI_SUPPORT)
add_definitions(-DENABLE_DFSI_SUPPORT)
message(CHECK_START "P25 DFSI Support - enabled")
endif (ENABLE_DFSI_SUPPORT)
if (ENABLE_TUI_SUPPORT)
option(ENABLE_SETUP_TUI "Enable interactive setup TUI" on)
if (ENABLE_SETUP_TUI)

@ -596,19 +596,6 @@ int Host::run()
g_killed = true;
}
#if defined(ENABLE_P25) && defined(ENABLE_DFSI)
// DFSI checks
if (m_useDFSI && m_dmrEnabled) {
::LogError(LOG_HOST, "Cannot have DMR enabled when using DFSI!");
g_killed = true;
}
if (m_useDFSI && m_nxdnEnabled) {
::LogError(LOG_HOST, "Cannot have NXDN enabled when using DFSI!");
g_killed = true;
}
#endif // defined(ENABLE_P25) && defined(ENABLE_DFSI)
// P25 CC checks
if (m_dmrEnabled && m_p25CtrlChannel) {
::LogError(LOG_HOST, "Cannot have DMR enabled when using dedicated P25 control!");
@ -2032,12 +2019,6 @@ bool Host::createModem()
yaml::Node modemProtocol = modemConf["protocol"];
std::string portType = modemProtocol["type"].as<std::string>("null");
#if defined(ENABLE_P25) && defined(ENABLE_DFSI)
m_useDFSI = modemProtocol["dfsi"].as<bool>(false);
#else
m_useDFSI = false;
#endif // defined(ENABLE_P25) && defined(ENABLE_DFSI)
yaml::Node uartProtocol = modemProtocol["uart"];
std::string uartPort = uartProtocol["port"].as<std::string>();
uint32_t uartSpeed = uartProtocol["speed"].as<uint32_t>(115200);
@ -2224,10 +2205,6 @@ bool Host::createModem()
LogInfo(" P25 FIFO Size: %u bytes", p25FifoLength);
LogInfo(" NXDN FIFO Size: %u bytes", nxdnFifoLength);
if (m_useDFSI) {
LogInfo(" Digital Fixed Station Interface: yes");
}
if (ignoreModemConfigArea) {
LogInfo(" Ignore Modem Configuration Area: yes");
}
@ -2253,9 +2230,6 @@ bool Host::createModem()
m_modem->setSoftPot(rxCoarse, rxFine, txCoarse, txFine, rssiCoarse, rssiFine);
m_modem->setDMRColorCode(m_dmrColorCode);
m_modem->setP25NAC(m_p25NAC);
#if defined(ENABLE_P25) && defined(ENABLE_DFSI)
m_modem->setP25DFSI(m_useDFSI);
#endif // defined(ENABLE_P25) && defined(ENABLE_DFSI)
}
if (m_modemRemote) {

@ -93,7 +93,6 @@ private:
bool m_duplex;
bool m_fixedMode;
bool m_useDFSI;
uint32_t m_timeout;
uint32_t m_rfModeHang;

@ -183,7 +183,6 @@ Modem::Modem(port::IModemPort* port, bool duplex, bool rxInvert, bool txInvert,
m_rxDMRQueue2(dmrQueueSize, "Modem RX DMR2"),
m_rxP25Queue(p25QueueSize, "Modem RX P25"),
m_rxNXDNQueue(nxdnQueueSize, "Modem RX NXDN"),
m_useDFSI(false),
m_statusTimer(1000U, 0U, 250U),
m_inactivityTimer(1000U, 8U),
m_dmrSpace1(0U),
@ -389,15 +388,6 @@ void Modem::setP25NAC(uint32_t nac)
m_p25NAC = nac;
}
/// <summary>
/// Sets the P25 DFSI data mode.
/// </summary>
/// <param name="nac"></param>
void Modem::setP25DFSI(bool dfsi)
{
m_useDFSI = dfsi;
}
/// <summary>
/// Sets the RF receive deviation levels.
/// </summary>
@ -1129,15 +1119,6 @@ bool Modem::isHotspot() const
return m_isHotspot;
}
/// <summary>
/// Helper to test if the modem is in P25 DFSI data mode.
/// </summary>
/// <returns>True, if the modem is in P25 DFSI data mode, otherwise false.</returns>
bool Modem::isP25DFSI() const
{
return m_useDFSI;
}
/// <summary>
/// Flag indicating whether or not the air interface modem is transmitting.
/// </summary>
@ -1253,11 +1234,6 @@ void Modem::injectDMRFrame1(const uint8_t* data, uint32_t length)
assert(data != nullptr);
assert(length > 0U);
if (m_useDFSI) {
LogWarning(LOG_MODEM, "Cannot inject DMR Slot 1 Data in DFSI mode");
return;
}
if (m_trace)
Utils::dump(1U, "Injected DMR Slot 1 Data", data, length);
@ -1284,11 +1260,6 @@ void Modem::injectDMRFrame2(const uint8_t* data, uint32_t length)
assert(data != nullptr);
assert(length > 0U);
if (m_useDFSI) {
LogWarning(LOG_MODEM, "Cannot inject DMr Slot 2 Data in DFSI mode");
return;
}
if (m_trace)
Utils::dump(1U, "Injected DMR Slot 2 Data", data, length);

@ -271,8 +271,6 @@ namespace modem
void setDMRColorCode(uint32_t colorCode);
/// <summary>Sets the P25 NAC.</summary>
void setP25NAC(uint32_t nac);
/// <summary>Sets the P25 DFSI data mode.</summary>
void setP25DFSI(bool dfsi);
/// <summary>Sets the RF receive deviation levels.</summary>
void setRXLevel(float rxLevel);
/// <summary>Sets the modem transmit FIFO buffer lengths.</summary>
@ -318,9 +316,6 @@ namespace modem
/// <summary>Helper to test if the modem is a hotspot.</summary>
bool isHotspot() const;
/// <summary>Helper to test if the modem is in P25 DFSI data mode.</summary>
bool isP25DFSI() const;
/// <summary>Flag indicating whether or not the air interface modem is transmitting.</summary>
bool hasTX() const;
/// <summary>Flag indicating whether or not the air interface modem has carrier detect.</summary>
@ -493,8 +488,6 @@ namespace modem
RingBuffer<uint8_t> m_rxP25Queue;
RingBuffer<uint8_t> m_rxNXDNQueue;
bool m_useDFSI;
Timer m_statusTimer;
Timer m_inactivityTimer;

@ -32,8 +32,6 @@
#include "p25/P25Defines.h"
#include "p25/Control.h"
#include "p25/acl/AccessControl.h"
#include "p25/dfsi/packet/DFSITrunk.h"
#include "p25/dfsi/packet/DFSIVoice.h"
#include "p25/P25Utils.h"
#include "p25/Sync.h"
#include "edac/CRC.h"
@ -156,22 +154,9 @@ Control::Control(bool authoritative, uint32_t nac, uint32_t callHang, uint32_t q
m_hangCount = callHang * 4U;
#if ENABLE_DFSI_SUPPORT
if (m_modem->isP25DFSI()) {
LogMessage(LOG_P25, "DFSI protocol mode is enabled.");
m_voice = new dfsi::packet::DFSIVoice(this, network, debug, verbose);
m_trunk = new dfsi::packet::DFSITrunk(this, network, dumpTSBKData, debug, verbose);
}
else {
m_voice = new Voice(this, network, debug, verbose);
m_trunk = new Trunk(this, network, dumpTSBKData, debug, verbose);
m_data = new Data(this, network, dumpPDUData, repeatPDU, debug, verbose);
}
#else
m_voice = new Voice(this, network, debug, verbose);
m_trunk = new Trunk(this, network, dumpTSBKData, debug, verbose);
m_data = new Data(this, network, dumpPDUData, repeatPDU, debug, verbose);
#endif
}
/// <summary>
@ -271,12 +256,6 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw
m_trunk->m_ctrlTimeDateAnn = control["enableTimeDateAnn"].as<bool>(false);
m_trunk->m_redundantGrant = control["redundantGrantTransmit"].as<bool>(false);
#if ENABLE_DFSI_SUPPORT
if (m_modem->isP25DFSI()) {
m_trunk->m_ctrlTSDUMBF = false; // force SBF for TSDUs when using DFSI
}
#endif
m_voice->m_silenceThreshold = p25Protocol["silenceThreshold"].as<uint32_t>(p25::DEFAULT_SILENCE_THRESHOLD);
if (m_voice->m_silenceThreshold > MAX_P25_VOICE_ERRORS) {
LogWarning(LOG_P25, "Silence threshold > %u, defaulting to %u", p25::MAX_P25_VOICE_ERRORS, p25::DEFAULT_SILENCE_THRESHOLD);
@ -436,12 +415,6 @@ bool Control::processFrame(uint8_t* data, uint32_t len)
{
assert(data != nullptr);
#if ENABLE_DFSI_SUPPORT
if (m_modem->isP25DFSI()) {
return processDFSI(data, len);
}
#endif
bool sync = data[1U] == 0x01U;
if (data[0U] == modem::TAG_LOST) {
@ -958,160 +931,6 @@ void Control::addFrame(const uint8_t* data, uint32_t length, bool net, bool imm)
m_txQueue.addData(data, len);
}
#if ENABLE_DFSI_SUPPORT
/// <summary>
/// Process a DFSI data frame from the RF interface.
/// </summary>
/// <param name="data">Buffer containing data frame.</param>
/// <param name="len">Length of data frame.</param>
/// <returns></returns>
bool Control::processDFSI(uint8_t* data, uint32_t len)
{
assert(data != nullptr);
dfsi::LC dfsiLC = dfsi::LC();
if (data[0U] == modem::TAG_LOST && m_rfState == RS_RF_AUDIO) {
if (m_rssi != 0U) {
::ActivityLog("P25", true, "transmission lost, %.1f seconds, BER: %.1f%%, RSSI: -%u/-%u/-%u dBm",
float(m_voice->m_rfFrames) / 5.56F, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits), m_minRSSI, m_maxRSSI, m_aveRSSI / m_rssiCount);
}
else {
::ActivityLog("P25", true, "transmission lost, %.1f seconds, BER: %.1f%%",
float(m_voice->m_rfFrames) / 5.56F, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits));
}
LogMessage(LOG_RF, P25_TDU_STR ", total frames: %d, bits: %d, undecodable LC: %d, errors: %d, BER: %.4f%%",
m_voice->m_rfFrames, m_voice->m_rfBits, m_voice->m_rfUndecodableLC, m_voice->m_rfErrs, float(m_voice->m_rfErrs * 100U) / float(m_voice->m_rfBits));
if (m_control) {
m_trunk->releaseDstIdGrant(m_voice->m_rfLC.getDstId(), false);
}
writeRF_TDU(false);
m_voice->m_lastDUID = P25_DUID_TDU;
m_voice->writeNetworkRF(data + 2U, P25_DUID_TDU);
m_rfState = RS_RF_LISTENING;
m_rfLastDstId = 0U;
m_rfTGHang.stop();
m_tailOnIdle = true;
m_rfTimeout.stop();
m_queue.clear();
if (m_network != nullptr)
m_network->resetP25();
return false;
}
if (data[0U] == modem::TAG_LOST && m_rfState == RS_RF_DATA) {
m_rfState = RS_RF_LISTENING;
m_rfLastDstId = 0U;
m_rfTGHang.stop();
m_tailOnIdle = true;
m_data->resetRF();
m_rfTimeout.stop();
m_queue.clear();
return false;
}
if (data[0U] == modem::TAG_LOST) {
m_rfState = RS_RF_LISTENING;
m_voice->resetRF();
m_data->resetRF();
m_trunk->m_rfTSBK = lc::TSBK(m_siteData, m_idenEntry);
return false;
}
// Decode the NID
bool valid = dfsiLC.decodeNID(data + 2U);
if (!valid && m_rfState == RS_RF_LISTENING)
return false;
uint8_t duid = 0xFFU; // a very invalid DUID
uint8_t frameType = dfsiLC.getFrameType();
if (m_debug) {
LogDebug(LOG_RF, "P25 DFSI, rfState = %u, netState = %u, frameType = %u", m_rfState, m_netState, dfsiLC.getFrameType());
}
// are we interrupting a running CC?
if (m_ccRunning) {
if (duid != P25_DUID_TSDU) {
g_interruptP25Control = true;
}
}
// convert DFSI frame-types to DUIDs (this doesn't 100% line up)
if (frameType == dfsi::P25_DFSI_START_STOP || frameType == dfsi::P25_DFSI_VHDR1 ||
frameType == dfsi::P25_DFSI_VHDR2) {
duid = P25_DUID_HDU;
}
else if (frameType >= dfsi::P25_DFSI_LDU1_VOICE1 && frameType <= dfsi::P25_DFSI_LDU1_VOICE9) {
duid = P25_DUID_LDU1;
}
else if (frameType >= dfsi::P25_DFSI_LDU2_VOICE10 && frameType <= dfsi::P25_DFSI_LDU2_VOICE18) {
duid = P25_DUID_LDU2;
}
else if (frameType == dfsi::P25_DFSI_TSBK) {
duid = P25_DUID_TSDU;
}
bool ret = false;
// handle individual DUIDs
switch (duid) {
case P25_DUID_HDU:
case P25_DUID_LDU1:
case P25_DUID_LDU2:
if (!m_dedicatedControl)
ret = m_voice->process(data, len);
else {
if (m_voiceOnControl && m_trunk->isChBusy(m_siteData.channelNo())) {
ret = m_voice->process(data, len);
}
}
break;
case P25_DUID_TDU:
case P25_DUID_TDULC:
ret = m_voice->process(data, len);
break;
case P25_DUID_PDU:
if (!m_dedicatedControl)
ret = m_data->process(data, len);
else {
if (m_voiceOnControl && m_trunk->isChBusy(m_siteData.channelNo())) {
ret = m_data->process(data, len);
}
}
break;
case P25_DUID_TSDU:
ret = m_trunk->process(data, len);
break;
default:
LogError(LOG_RF, "P25 unhandled DUID, duid = $%02X", duid);
return false;
}
return ret;
}
#endif
/// <summary>
/// Process a data frames from the network.
/// </summary>
@ -1492,13 +1311,6 @@ void Control::writeRF_Preamble(uint32_t preambleCount, bool force)
/// <param name="noNetwork"></param>
void Control::writeRF_TDU(bool noNetwork)
{
#ifdef ENABLE_DFSI_SUPPORT
// for now abort out of this...
if (m_modem->isP25DFSI()) {
return;
}
#endif
uint8_t data[P25_TDU_FRAME_LENGTH_BYTES + 2U];
::memset(data + 2U, 0x00U, P25_TDU_FRAME_LENGTH_BYTES);

@ -59,10 +59,8 @@ namespace p25
// ---------------------------------------------------------------------------
namespace packet { class HOST_SW_API Voice; }
namespace dfsi { namespace packet { class HOST_SW_API DFSIVoice; } }
namespace packet { class HOST_SW_API Data; }
namespace packet { class HOST_SW_API Trunk; }
namespace dfsi { namespace packet { class HOST_SW_API DFSITrunk; } }
namespace lookups { class HOST_SW_API P25AffiliationLookup; }
// ---------------------------------------------------------------------------
@ -143,12 +141,10 @@ namespace p25
private:
friend class packet::Voice;
friend class dfsi::packet::DFSIVoice;
packet::Voice* m_voice;
friend class packet::Data;
packet::Data* m_data;
friend class packet::Trunk;
friend class dfsi::packet::DFSITrunk;
packet::Trunk* m_trunk;
friend class lookups::P25AffiliationLookup;
@ -230,11 +226,6 @@ namespace p25
/// <summary>Add data frame to the data ring buffer.</summary>
void addFrame(const uint8_t* data, uint32_t length, bool net = false, bool imm = false);
#if ENABLE_DFSI_SUPPORT
/// <summary>Process a DFSI data frame from the RF interface.</summary>
bool processDFSI(uint8_t* data, uint32_t len);
#endif
/// <summary>Process a data frames from the network.</summary>
void processNetwork();
/// <summary>Helper to process loss of frame stream from modem.</summary>

@ -1,271 +0,0 @@
/**
* Digital Voice Modem - Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / Host Software
*
*/
/*
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "Defines.h"
#include "p25/P25Defines.h"
#include "p25/dfsi/DFSIDefines.h"
#include "p25/packet/Trunk.h"
#include "p25/dfsi/packet/DFSITrunk.h"
#include "p25/P25Utils.h"
#include "p25/Sync.h"
#include "Log.h"
#include "Utils.h"
using namespace p25;
using namespace p25::dfsi;
using namespace p25::dfsi::packet;
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Process a data frame from the RF interface.
/// </summary>
/// <param name="data">Buffer containing data frame.</param>
/// <param name="len">Length of data frame.</param>
/// <param name="preDecodedTSBK">Pre-decoded TSBK.</param>
/// <returns></returns>
bool DFSITrunk::process(uint8_t* data, uint32_t len, std::unique_ptr<lc::TSBK> preDecodedTSBK)
{
assert(data != nullptr);
uint8_t tsbk[P25_TSBK_LENGTH_BYTES];
::memset(tsbk, 0x00U, P25_TSBK_LENGTH_BYTES);
if (!m_p25->m_control)
return false;
if (preDecodedTSBK != nullptr) {
return Trunk::process(data + 2U, len, std::move(preDecodedTSBK));
}
else {
if (m_rfDFSILC.decodeTSBK(data + 2U)) {
return Trunk::process(tsbk, P25_TSBK_LENGTH_BYTES, std::unique_ptr<lc::TSBK>(m_rfDFSILC.tsbk()));
}
}
return false;
}
// ---------------------------------------------------------------------------
// Protected Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the DFSITrunk class.
/// </summary>
/// <param name="p25">Instance of the Control class.</param>
/// <param name="network">Instance of the BaseNetwork class.</param>
/// <param name="dumpTSBKData">Flag indicating whether TSBK data is dumped to the log.</param>
/// <param name="debug">Flag indicating whether P25 debug is enabled.</param>
/// <param name="verbose">Flag indicating whether P25 verbose logging is enabled.</param>
DFSITrunk::DFSITrunk(Control* p25, network::BaseNetwork* network, bool dumpTSBKData, bool debug, bool verbose) :
Trunk(p25, network, dumpTSBKData, debug, verbose)
{
/* stub */
}
/// <summary>
/// Finalizes a instance of the DFSITrunk class.
/// </summary>
DFSITrunk::~DFSITrunk()
{
/* stub */
}
/// <summary>
/// Helper to write a P25 TDU w/ link control packet.
/// </summary>
/// <param name="lc"></param>
/// <param name="noNetwork"></param>
void DFSITrunk::writeRF_TDULC(lc::TDULC* lc, bool noNetwork)
{
// for now this is ignored...
}
/// <summary>
/// Helper to write a single-block P25 TSDU packet.
/// </summary>
/// <param name="tsbk"></param>
/// <param name="noNetwork"></param>
/// <param name="clearBeforeWrite"></param>
/// <param name="force"></param>
void DFSITrunk::writeRF_TSDU_SBF(lc::TSBK* tsbk, bool noNetwork, bool clearBeforeWrite, bool force, bool imm)
{
if (!m_p25->m_control)
return;
assert(tsbk != nullptr);
writeRF_DFSI_Start(P25_DFSI_TYPE_TSBK);
uint8_t data[P25_TSDU_FRAME_LENGTH_BYTES + 2U];
::memset(data + 2U, 0x00U, P25_TSDU_FRAME_LENGTH_BYTES);
m_rfDFSILC.setFrameType(P25_DFSI_TSBK);
m_rfDFSILC.setStartStop(P25_DFSI_START_FLAG);
m_rfDFSILC.setType(P25_DFSI_TYPE_TSBK);
m_rfDFSILC.tsbk(tsbk);
// Generate Sync
Sync::addP25Sync(data + 2U);
// Generate NID
m_p25->m_nid.encode(data + 2U, P25_DUID_TSDU);
// Generate TSBK block
tsbk->setLastBlock(true); // always set last block -- this a Single Block TSDU
tsbk->encode(data + 2U);
if (m_debug) {
LogDebug(LOG_RF, P25_TSDU_STR " DFSI, lco = $%02X, mfId = $%02X, lastBlock = %u, AIV = %u, EX = %u, srcId = %u, dstId = %u, sysId = $%03X, netId = $%05X",
tsbk->getLCO(), tsbk->getMFId(), tsbk->getLastBlock(), tsbk->getAIV(), tsbk->getEX(), tsbk->getSrcId(), tsbk->getDstId(),
tsbk->getSysId(), tsbk->getNetId());
Utils::dump(1U, "!!! *TSDU (SBF) TSBK Block Data", data + P25_PREAMBLE_LENGTH_BYTES + 2U, P25_TSBK_FEC_LENGTH_BYTES);
}
// Add busy bits
P25Utils::addBusyBits(data + 2U, P25_TSDU_FRAME_LENGTH_BITS, true, false);
// Set first busy bits to 1,1
P25Utils::setBusyBits(data + 2U, P25_SS0_START, true, true);
if (!noNetwork)
writeNetworkRF(tsbk, data + 2U, true);
// bryanb: hack-o-ramma, for now -- we will force any immediate TSDUs as single-block
if (imm) {
force = true;
}
if (!force) {
if (clearBeforeWrite) {
m_p25->m_modem->clearP25Frame();
m_p25->m_txQueue.clear();
}
}
::memset(data + 2U, 0x00U, P25_TSDU_FRAME_LENGTH_BYTES);
// Generate DFSI TSBK block
m_rfDFSILC.encodeTSBK(data + 2U);
data[0U] = modem::TAG_DATA;
data[1U] = 0x00U;
m_p25->addFrame(data, P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U);
writeRF_DSFI_Stop(P25_DFSI_TYPE_TSBK);
}
/// <summary>
/// Helper to write a alternate multi-block trunking PDU packet.
/// </summary>
/// <param name="ambt"></param>
/// <param name="clearBeforeWrite"></param>
void DFSITrunk::writeRF_TSDU_AMBT(lc::AMBT* ambt, bool clearBeforeWrite)
{
if (!m_p25->m_control)
return;
assert(ambt != nullptr);
// for now this is ignored...
}
/// <summary>
/// Helper to write a network single-block P25 TSDU packet.
/// </summary>
/// <param name="tsbk"></param>
void DFSITrunk::writeNet_TSDU(lc::TSBK* tsbk)
{
assert(tsbk != nullptr);
uint8_t buffer[P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U];
::memset(buffer, 0x00U, P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U);
buffer[0U] = modem::TAG_DATA;
buffer[1U] = 0x00U;
// Regenerate TSDU Data
m_netDFSILC.tsbk(tsbk);
m_netDFSILC.encodeTSBK(buffer + 2U);
m_p25->addFrame(buffer, P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U, true);
if (m_network != nullptr)
m_network->resetP25();
}
/// <summary>
/// Helper to write start DFSI data.
/// </summary>
/// <param name="type"></param>
void DFSITrunk::writeRF_DFSI_Start(uint8_t type)
{
uint8_t buffer[P25_DFSI_SS_FRAME_LENGTH_BYTES + 2U];
::memset(buffer, 0x00U, P25_DFSI_SS_FRAME_LENGTH_BYTES + 2U);
// Generate Start/Stop
m_rfDFSILC.setFrameType(P25_DFSI_START_STOP);
m_rfDFSILC.setStartStop(P25_DFSI_START_FLAG);
m_rfDFSILC.setType(type);
// Generate Identifier Data
m_rfDFSILC.encodeNID(buffer + 2U);
buffer[0U] = modem::TAG_DATA;
buffer[1U] = 0x00U;
m_p25->addFrame(buffer, P25_DFSI_SS_FRAME_LENGTH_BYTES + 2U);
}
/// <suimmary>
/// Helper to write stop DFSI data.
/// </summary>
/// <param name="type"></param>
void DFSITrunk::writeRF_DSFI_Stop(uint8_t type)
{
uint8_t buffer[P25_DFSI_SS_FRAME_LENGTH_BYTES + 2U];
::memset(buffer, 0x00U, P25_DFSI_SS_FRAME_LENGTH_BYTES + 2U);
// Generate Start/Stop
m_rfDFSILC.setFrameType(P25_DFSI_START_STOP);
m_rfDFSILC.setStartStop(P25_DFSI_STOP_FLAG);
m_rfDFSILC.setType(type);
// Generate Identifier Data
m_rfDFSILC.encodeNID(buffer + 2U);
buffer[0U] = modem::TAG_EOT;
buffer[1U] = 0x00U;
// for whatever reason this is almost always sent twice
for (uint8_t i = 0; i < 2;i ++) {
m_p25->addFrame(buffer, P25_DFSI_SS_FRAME_LENGTH_BYTES + 2U);
}
}

@ -1,93 +0,0 @@
/**
* Digital Voice Modem - Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / Host Software
*
*/
/*
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(__P25_DFSI_PACKET_TRUNK_H__)
#define __P25_DFSI_PACKET_TRUNK_H__
#include "Defines.h"
#include "p25/dfsi/LC.h"
#include "p25/Control.h"
#include "network/BaseNetwork.h"
namespace p25
{
// ---------------------------------------------------------------------------
// Class Prototypes
// ---------------------------------------------------------------------------
namespace packet { class HOST_SW_API Trunk; }
class HOST_SW_API Control;
namespace dfsi
{
namespace packet
{
// ---------------------------------------------------------------------------
// Class Declaration
// This class implements handling logic for P25 trunking packets using
// the DFSI protocol instead of the P25 OTA protocol.
// ---------------------------------------------------------------------------
class HOST_SW_API DFSITrunk : public p25::packet::Trunk {
public:
/// <summary>Process a data frame from the RF interface.</summary>
bool process(uint8_t* data, uint32_t len, std::unique_ptr<lc::TSBK> preDecodedTSBK = nullptr) override;
protected:
LC m_rfDFSILC;
LC m_netDFSILC;
/// <summary>Initializes a new instance of the DFSITrunk class.</summary>
DFSITrunk(Control* p25, network::BaseNetwork* network, bool dumpTSBKData, bool debug, bool verbose);
/// <summary>Finalizes a instance of the DFSITrunk class.</summary>
virtual ~DFSITrunk();
/// <summary>Helper to write a P25 TDU w/ link control packet.</summary>
void writeRF_TDULC(lc::TDULC* lc, bool noNetwork) override;
/// <summary>Helper to write a single-block P25 TSDU packet.</summary>
void writeRF_TSDU_SBF(lc::TSBK* tsbk, bool noNetwork, bool clearBeforeWrite = false, bool force = false, bool imm = false) override;
/// <summary>Helper to write a alternate multi-block trunking PDU packet.</summary>
void writeRF_TSDU_AMBT(lc::AMBT* ambt, bool clearBeforeWrite = false) override;
/// <summary>Helper to write a network P25 TDU w/ link control packet.</summary>
//void writeNet_TDULC(lc::TDULC lc) override;
/// <summary>Helper to write a network single-block P25 TSDU packet.</summary>
void writeNet_TSDU(lc::TSBK* tsbk) override;
/// <suimmary>Helper to write start DFSI data.</summary>
void writeRF_DFSI_Start(uint8_t type);
/// <suimmary>Helper to write stop DFSI data.</summary>
void writeRF_DSFI_Stop(uint8_t type);
private:
friend class packet::DFSIVoice;
friend class p25::Control;
};
} // namespace packet
} // namespace dfsi
} // namespace p25
#endif // __P25_DFSI_PACKET_TRUNK_H__

File diff suppressed because it is too large Load Diff

@ -1,99 +0,0 @@
/**
* Digital Voice Modem - Host Software
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* @package DVM / Host Software
*
*/
//
// Based on code from the MMDVMHost project. (https://github.com/g4klx/MMDVMHost)
// Licensed under the GPLv2 License (https://opensource.org/licenses/GPL-2.0)
//
/*
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#if !defined(__P25_DFSI_PACKET_VOICE_H__)
#define __P25_DFSI_PACKET_VOICE_H__
#include "Defines.h"
#include "p25/dfsi/LC.h"
#include "p25/dfsi/packet/DFSITrunk.h"
#include "p25/Control.h"
#include "network/BaseNetwork.h"
namespace p25
{
// ---------------------------------------------------------------------------
// Class Prototypes
// ---------------------------------------------------------------------------
namespace packet { class HOST_SW_API Voice; }
class HOST_SW_API Control;
namespace dfsi
{
namespace packet
{
// ---------------------------------------------------------------------------
// Class Declaration
// This class implements handling logic for P25 voice packets using
// the DFSI protocol instead of the P25 OTA protocol.
// ---------------------------------------------------------------------------
class HOST_SW_API DFSIVoice : public p25::packet::Voice {
public:
/// <summary>Resets the data states for the RF interface.</summary>
void resetRF() override;
/// <summary>Resets the data states for the network.</summary>
void resetNet() override;
/// <summary>Process a data frame from the RF interface.</summary>
bool process(uint8_t* data, uint32_t len) override;
/// <summary>Process a data frame from the network.</summary>
bool processNetwork(uint8_t* data, uint32_t len, lc::LC& control, data::LowSpeedData& lsd, uint8_t& duid, uint8_t& frameType) override;
protected:
DFSITrunk* m_trunk;
LC m_rfDFSILC;
LC m_netDFSILC;
uint8_t* m_dfsiLDU1;
uint8_t* m_dfsiLDU2;
/// <summary>Initializes a new instance of the DFSIVoice class.</summary>
DFSIVoice(Control* p25, network::BaseNetwork* network, bool debug, bool verbose);
/// <summary>Finalizes a instance of the DFSIVoice class.</summary>
virtual ~DFSIVoice();
/// <summary>Helper to write a network P25 TDU packet.</summary>
void writeNet_TDU() override;
/// <summary>Helper to write a network P25 LDU1 packet.</summary>
void writeNet_LDU1() override;
/// <summary>Helper to write a network P25 LDU1 packet.</summary>
void writeNet_LDU2() override;
private:
friend class packet::DFSITrunk;
friend class p25::Control;
};
} // namespace packet
} // namespace dfsi
} // namespace p25
#endif // __P25_DFSI_PACKET_VOICE_H__

@ -48,7 +48,6 @@ namespace p25
// ---------------------------------------------------------------------------
namespace packet { class HOST_SW_API Voice; }
namespace dfsi { namespace packet { class HOST_SW_API DFSIVoice; } }
namespace packet { class HOST_SW_API Data; }
namespace lookups { class HOST_SW_API P25AffiliationLookup; }
class HOST_SW_API Control;
@ -104,7 +103,6 @@ namespace p25
protected:
friend class packet::Voice;
friend class dfsi::packet::DFSIVoice;
friend class packet::Data;
friend class p25::Control;
Control* m_p25;

Loading…
Cancel
Save

Powered by TurnKey Linux.