From 56ad3e4bfe08624b58f2967817fa6261663a9d36 Mon Sep 17 00:00:00 2001 From: Jonathan Naylor Date: Wed, 6 Feb 2019 11:05:47 +0000 Subject: [PATCH] Start optional removal of TA and GPS data. --- RemoveTA.cpp | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++ RemoveTA.h | 39 +++++++++++++++++++++++ 2 files changed, 129 insertions(+) create mode 100644 RemoveTA.cpp create mode 100644 RemoveTA.h diff --git a/RemoveTA.cpp b/RemoveTA.cpp new file mode 100644 index 0000000..76c52ea --- /dev/null +++ b/RemoveTA.cpp @@ -0,0 +1,90 @@ +/* +* Copyright (C) 2017,2019 by Jonathan Naylor G4KLX +* +* 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 "RemoveTA.h" +#include "DMREMB.h" +#include "DMRLC.h" + +#include + +CRemoveTA::CRemoveTA() : +m_embeddedLC() +{ +} + +CRemoveTA::~CRemoveTA() +{ +} + +void CRemoveTA::process(CDMRData& data) +{ + unsigned char dataType = data.getDataType(); + + switch (dataType) { + case DT_VOICE_LC_HEADER: + processHeader(data); + break; + + case DT_VOICE: + processVoice(data); + break; + + case DT_CSBK: + case DT_DATA_HEADER: + case DT_RATE_12_DATA: + case DT_RATE_34_DATA: + case DT_RATE_1_DATA: + case DT_VOICE_SYNC: + case DT_TERMINATOR_WITH_LC: + // Nothing to do + break; + + case DT_VOICE_PI_HEADER: + default: + // Not sure what to do + break; + } +} + +void CRemoveTA::processHeader(CDMRData& data, unsigned char dataType) +{ + CDMRLC lc; + lc.setFLCO(flco); + lc.setSrcId(srcId); + lc.setDstId(dstId); + + m_embeddedLC.setLC(lc); +} + +void CRemoveTA::processVoice(CDMRData& data) +{ + unsigned char n = data.getN(); + + unsigned char buffer[DMR_FRAME_LENGTH_BYTES]; + data.getData(buffer); + + CDMREMB emb; + emb.putData(buffer); + + lcss = m_embeddedLC.getData(buffer, n); + + emb.setLCSS(lcss); + emb.getData(buffer); + + data.setData(buffer); +} diff --git a/RemoveTA.h b/RemoveTA.h new file mode 100644 index 0000000..94a019a --- /dev/null +++ b/RemoveTA.h @@ -0,0 +1,39 @@ +/* +* Copyright (C) 2017,2019 by Jonathan Naylor G4KLX +* +* 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(REMOVETA_H) +#define REMOVETA_H + +#include "DMREmbeddedData.h" +#include "DMRData.h" + +class CRemoveTA { +public: + CRemoveTA(); + ~CRemoveTA(); + + bool process(CDMRData& data); + +private: + CDMREmbeddedData m_embeddedLC; + + void processHeader(CDMRData& data); + void processVoice(CDMRData& data); +}; + +#endif