Renamed DMR protocol files.
This commit is contained in:
parent
656be113f5
commit
5185a0c245
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "CSBK.h"
|
||||
#include "DMRCSBK.h"
|
||||
#include "BPTC19696.h"
|
||||
#include "Utils.h"
|
||||
#include "CRC.h"
|
||||
|
@ -24,7 +24,7 @@
|
|||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CCSBK::CCSBK(const unsigned char* bytes) :
|
||||
CDMRCSBK::CDMRCSBK(const unsigned char* bytes) :
|
||||
m_CSBKO(CSBKO_NONE),
|
||||
m_FID(0x00U),
|
||||
m_bsId(0U),
|
||||
|
@ -84,36 +84,36 @@ m_valid(false)
|
|||
}
|
||||
}
|
||||
|
||||
CCSBK::~CCSBK()
|
||||
CDMRCSBK::~CDMRCSBK()
|
||||
{
|
||||
}
|
||||
|
||||
bool CCSBK::isValid() const
|
||||
bool CDMRCSBK::isValid() const
|
||||
{
|
||||
return m_valid;
|
||||
}
|
||||
|
||||
CSBKO CCSBK::getCSBKO() const
|
||||
CSBKO CDMRCSBK::getCSBKO() const
|
||||
{
|
||||
return m_CSBKO;
|
||||
}
|
||||
|
||||
unsigned char CCSBK::getFID() const
|
||||
unsigned char CDMRCSBK::getFID() const
|
||||
{
|
||||
return m_FID;
|
||||
}
|
||||
|
||||
unsigned int CCSBK::getBSId() const
|
||||
unsigned int CDMRCSBK::getBSId() const
|
||||
{
|
||||
return m_bsId;
|
||||
}
|
||||
|
||||
unsigned int CCSBK::getSrcId() const
|
||||
unsigned int CDMRCSBK::getSrcId() const
|
||||
{
|
||||
return m_srcId;
|
||||
}
|
||||
|
||||
unsigned int CCSBK::getDstId() const
|
||||
unsigned int CDMRCSBK::getDstId() const
|
||||
{
|
||||
return m_dstId;
|
||||
}
|
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(CSBK_H)
|
||||
#define CSBK_H
|
||||
#if !defined(DMRCSBK_H)
|
||||
#define DMRCSBK_H
|
||||
|
||||
#include "DMRDefines.h"
|
||||
|
||||
|
@ -31,11 +31,11 @@ enum CSBKO {
|
|||
CSBKO_PRECCSBK = 0x3D
|
||||
};
|
||||
|
||||
class CCSBK
|
||||
class CDMRCSBK
|
||||
{
|
||||
public:
|
||||
CCSBK(const unsigned char* bytes);
|
||||
~CCSBK();
|
||||
CDMRCSBK(const unsigned char* bytes);
|
||||
~CDMRCSBK();
|
||||
|
||||
bool isValid() const;
|
||||
|
|
@ -13,12 +13,12 @@
|
|||
|
||||
#include "DMRControl.h"
|
||||
#include "Defines.h"
|
||||
#include "CSBK.h"
|
||||
#include "DMRCSBK.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <cassert>
|
||||
|
||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int timeout, CModem* modem, CHomebrewDMRIPSC* network, IDisplay* display, bool duplex) :
|
||||
CDMRControl::CDMRControl(unsigned int id, unsigned int colorCode, unsigned int timeout, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex) :
|
||||
m_id(id),
|
||||
m_colorCode(colorCode),
|
||||
m_modem(modem),
|
||||
|
@ -42,7 +42,7 @@ bool CDMRControl::processWakeup(const unsigned char* data)
|
|||
if (data[0U] != TAG_DATA || data[1U] != (DMR_IDLE_RX | DMR_SYNC_DATA | DT_CSBK))
|
||||
return false;
|
||||
|
||||
CCSBK csbk(data + 2U);
|
||||
CDMRCSBK csbk(data + 2U);
|
||||
|
||||
CSBKO csbko = csbk.getCSBKO();
|
||||
if (csbko != CSBKO_BSDWNACT)
|
||||
|
|
16
DMRControl.h
16
DMRControl.h
|
@ -19,7 +19,7 @@
|
|||
#if !defined(DMRControl_H)
|
||||
#define DMRControl_H
|
||||
|
||||
#include "HomebrewDMRIPSC.h"
|
||||
#include "DMRIPSC.h"
|
||||
#include "Display.h"
|
||||
#include "DMRSlot.h"
|
||||
#include "DMRData.h"
|
||||
|
@ -28,7 +28,7 @@
|
|||
|
||||
class CDMRControl {
|
||||
public:
|
||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int timeout, CModem* modem, CHomebrewDMRIPSC* network, IDisplay* display, bool duplex);
|
||||
CDMRControl(unsigned int id, unsigned int colorCode, unsigned int timeout, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex);
|
||||
~CDMRControl();
|
||||
|
||||
bool processWakeup(const unsigned char* data);
|
||||
|
@ -42,12 +42,12 @@ public:
|
|||
void clock(unsigned int ms);
|
||||
|
||||
private:
|
||||
unsigned int m_id;
|
||||
unsigned int m_colorCode;
|
||||
CModem* m_modem;
|
||||
CHomebrewDMRIPSC* m_network;
|
||||
CDMRSlot m_slot1;
|
||||
CDMRSlot m_slot2;
|
||||
unsigned int m_id;
|
||||
unsigned int m_colorCode;
|
||||
CModem* m_modem;
|
||||
CDMRIPSC* m_network;
|
||||
CDMRSlot m_slot1;
|
||||
CDMRSlot m_slot2;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -0,0 +1,100 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016 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 "DMREMB.h"
|
||||
|
||||
#include "QR1676.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CDMREMB::CDMREMB() :
|
||||
m_colorCode(0U),
|
||||
m_PI(false),
|
||||
m_LCSS(0U)
|
||||
{
|
||||
}
|
||||
|
||||
CDMREMB::~CDMREMB()
|
||||
{
|
||||
}
|
||||
|
||||
void CDMREMB::putData(const unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char DMREMB[2U];
|
||||
DMREMB[0U] = (data[13U] << 4) & 0xF0U;
|
||||
DMREMB[0U] |= (data[14U] >> 4) & 0x0FU;
|
||||
DMREMB[1U] = (data[18U] << 4) & 0xF0U;
|
||||
DMREMB[1U] |= (data[19U] >> 4) & 0x0FU;
|
||||
|
||||
CQR1676::decode(DMREMB);
|
||||
|
||||
m_colorCode = (DMREMB[0U] >> 4) & 0x0FU;
|
||||
m_PI = (DMREMB[0U] & 0x08U) == 0x08U;
|
||||
m_LCSS = (DMREMB[0U] >> 1) & 0x03U;
|
||||
}
|
||||
|
||||
void CDMREMB::getData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char DMREMB[2U];
|
||||
DMREMB[0U] = (m_colorCode << 4) & 0xF0U;
|
||||
DMREMB[0U] |= m_PI ? 0x08U : 0x00U;
|
||||
DMREMB[0U] |= (m_LCSS << 1) & 0x06U;
|
||||
DMREMB[1U] = 0x00U;
|
||||
|
||||
CQR1676::encode(DMREMB);
|
||||
|
||||
data[13U] = (data[13U] & 0xF0U) | ((DMREMB[0U] >> 4U) & 0x0FU);
|
||||
data[14U] = (data[14U] & 0x0FU) | ((DMREMB[0U] << 4U) & 0xF0U);
|
||||
data[18U] = (data[18U] & 0xF0U) | ((DMREMB[1U] >> 4U) & 0x0FU);
|
||||
data[19U] = (data[19U] & 0x0FU) | ((DMREMB[1U] << 4U) & 0xF0U);
|
||||
}
|
||||
|
||||
unsigned char CDMREMB::getColorCode() const
|
||||
{
|
||||
return m_colorCode;
|
||||
}
|
||||
|
||||
void CDMREMB::setColorCode(unsigned char code)
|
||||
{
|
||||
m_colorCode = code;
|
||||
}
|
||||
|
||||
bool CDMREMB::getPI() const
|
||||
{
|
||||
return m_PI;
|
||||
}
|
||||
|
||||
void CDMREMB::setPI(bool pi)
|
||||
{
|
||||
m_PI = pi;
|
||||
}
|
||||
|
||||
unsigned char CDMREMB::getLCSS() const
|
||||
{
|
||||
return m_LCSS;
|
||||
}
|
||||
|
||||
void CDMREMB::setLCSS(unsigned char lcss)
|
||||
{
|
||||
m_LCSS = lcss;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,14 +16,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(EMB_H)
|
||||
#define EMB_H
|
||||
#if !defined(DMREMB_H)
|
||||
#define DMREMB_H
|
||||
|
||||
class CEMB
|
||||
class CDMREMB
|
||||
{
|
||||
public:
|
||||
CEMB();
|
||||
~CEMB();
|
||||
CDMREMB();
|
||||
~CDMREMB();
|
||||
|
||||
void putData(const unsigned char* data);
|
||||
void getData(unsigned char* data) const;
|
||||
|
@ -44,4 +44,3 @@ private:
|
|||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "EmbeddedLC.h"
|
||||
#include "DMREmbeddedLC.h"
|
||||
|
||||
#include "Hamming.h"
|
||||
#include "Utils.h"
|
||||
|
@ -27,20 +27,20 @@
|
|||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
CEmbeddedLC::CEmbeddedLC() :
|
||||
CDMREmbeddedLC::CDMREmbeddedLC() :
|
||||
m_rawLC(NULL),
|
||||
m_state(LCS_NONE)
|
||||
{
|
||||
m_rawLC = new bool[128U];
|
||||
}
|
||||
|
||||
CEmbeddedLC::~CEmbeddedLC()
|
||||
CDMREmbeddedLC::~CDMREmbeddedLC()
|
||||
{
|
||||
delete[] m_rawLC;
|
||||
}
|
||||
|
||||
// Add LC data (which may consist of 4 blocks) to the data store
|
||||
CLC* CEmbeddedLC::addData(const unsigned char* data, unsigned char lcss)
|
||||
CDMRLC* CDMREmbeddedLC::addData(const unsigned char* data, unsigned char lcss)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -99,7 +99,7 @@ CLC* CEmbeddedLC::addData(const unsigned char* data, unsigned char lcss)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void CEmbeddedLC::setData(const CLC& lc)
|
||||
void CDMREmbeddedLC::setData(const CDMRLC& lc)
|
||||
{
|
||||
bool lcData[72U];
|
||||
lc.getData(lcData);
|
||||
|
@ -150,7 +150,7 @@ void CEmbeddedLC::setData(const CLC& lc)
|
|||
}
|
||||
}
|
||||
|
||||
unsigned int CEmbeddedLC::getData(unsigned char* data, unsigned int n) const
|
||||
unsigned int CDMREmbeddedLC::getData(unsigned char* data, unsigned int n) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -193,7 +193,7 @@ unsigned int CEmbeddedLC::getData(unsigned char* data, unsigned int n) const
|
|||
}
|
||||
|
||||
// Unpack and error check an embedded LC
|
||||
CLC* CEmbeddedLC::processMultiBlockEmbeddedLC()
|
||||
CDMRLC* CDMREmbeddedLC::processMultiBlockEmbeddedLC()
|
||||
{
|
||||
// The data is unpacked downwards in columns
|
||||
bool data[128U];
|
||||
|
@ -256,11 +256,11 @@ CLC* CEmbeddedLC::processMultiBlockEmbeddedLC()
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return new CLC(lcData);
|
||||
return new CDMRLC(lcData);
|
||||
}
|
||||
|
||||
// Deal with a single block embedded LC
|
||||
void CEmbeddedLC::processSingleBlockEmbeddedLC(const bool* data)
|
||||
void CDMREmbeddedLC::processSingleBlockEmbeddedLC(const bool* data)
|
||||
{
|
||||
// Nothing interesting, or just NULL (I think)
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,10 +16,10 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef EmbeddedLC_H
|
||||
#define EmbeddedLC_H
|
||||
#ifndef DMREmbeddedLC_H
|
||||
#define DMREmbeddedLC_H
|
||||
|
||||
#include "LC.h"
|
||||
#include "DMRLC.h"
|
||||
|
||||
enum LC_STATE {
|
||||
LCS_NONE,
|
||||
|
@ -28,24 +28,23 @@ enum LC_STATE {
|
|||
LCS_THIRD
|
||||
};
|
||||
|
||||
class CEmbeddedLC
|
||||
class CDMREmbeddedLC
|
||||
{
|
||||
public:
|
||||
CEmbeddedLC();
|
||||
~CEmbeddedLC();
|
||||
CDMREmbeddedLC();
|
||||
~CDMREmbeddedLC();
|
||||
|
||||
CLC* addData(const unsigned char* data, unsigned char lcss);
|
||||
CDMRLC* addData(const unsigned char* data, unsigned char lcss);
|
||||
|
||||
void setData(const CLC& lc);
|
||||
void setData(const CDMRLC& lc);
|
||||
unsigned int getData(unsigned char* data, unsigned int n) const;
|
||||
|
||||
private:
|
||||
bool* m_rawLC;
|
||||
LC_STATE m_state;
|
||||
|
||||
CLC* processMultiBlockEmbeddedLC();
|
||||
void processSingleBlockEmbeddedLC(const bool* data);
|
||||
CDMRLC* processMultiBlockEmbeddedLC();
|
||||
void processSingleBlockEmbeddedLC(const bool* data);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -17,24 +17,25 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "FullLC.h"
|
||||
#include "Log.h"
|
||||
#include "DMRFullLC.h"
|
||||
|
||||
#include "DMRDefines.h"
|
||||
#include "RS129.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CFullLC::CFullLC() :
|
||||
CDMRFullLC::CDMRFullLC() :
|
||||
m_bptc()
|
||||
{
|
||||
}
|
||||
|
||||
CFullLC::~CFullLC()
|
||||
CDMRFullLC::~CDMRFullLC()
|
||||
{
|
||||
}
|
||||
|
||||
CLC* CFullLC::decode(const unsigned char* data, unsigned char type)
|
||||
CDMRLC* CDMRFullLC::decode(const unsigned char* data, unsigned char type)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -61,15 +62,15 @@ CLC* CFullLC::decode(const unsigned char* data, unsigned char type)
|
|||
|
||||
if (!CRS129::check(lcData)) {
|
||||
::LogDebug("Checksum failed for the LC");
|
||||
CLC lc(lcData);
|
||||
CDMRLC lc(lcData);
|
||||
LogDebug("Invalid LC, src = %u, dst = %s%u", lc.getSrcId(), lc.getFLCO() == FLCO_GROUP ? "TG " : "", lc.getDstId());
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return new CLC(lcData);
|
||||
return new CDMRLC(lcData);
|
||||
}
|
||||
|
||||
void CFullLC::encode(const CLC& lc, unsigned char* data, unsigned char type)
|
||||
void CDMRFullLC::encode(const CDMRLC& lc, unsigned char* data, unsigned char type)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,23 +16,23 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef FullLC_H
|
||||
#define FullLC_H
|
||||
#ifndef DMRFullLC_H
|
||||
#define DMRFullLC_H
|
||||
|
||||
#include "LC.h"
|
||||
#include "SlotType.h"
|
||||
#include "DMRLC.h"
|
||||
#include "DMRSlotType.h"
|
||||
|
||||
#include "BPTC19696.h"
|
||||
|
||||
class CFullLC
|
||||
class CDMRFullLC
|
||||
{
|
||||
public:
|
||||
CFullLC();
|
||||
~CFullLC();
|
||||
CDMRFullLC();
|
||||
~CDMRFullLC();
|
||||
|
||||
CLC* decode(const unsigned char* data, unsigned char type);
|
||||
CDMRLC* decode(const unsigned char* data, unsigned char type);
|
||||
|
||||
void encode(const CLC& lc, unsigned char* data, unsigned char type);
|
||||
void encode(const CDMRLC& lc, unsigned char* data, unsigned char type);
|
||||
|
||||
private:
|
||||
CBPTC19696 m_bptc;
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,7 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "HomebrewDMRIPSC.h"
|
||||
#include "DMRIPSC.h"
|
||||
|
||||
#include "StopWatch.h"
|
||||
#include "SHA256.h"
|
||||
#include "Utils.h"
|
||||
|
@ -29,7 +30,7 @@ const unsigned int BUFFER_LENGTH = 500U;
|
|||
const unsigned int HOMEBREW_DATA_PACKET_LENGTH = 53U;
|
||||
|
||||
|
||||
CHomebrewDMRIPSC::CHomebrewDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, const char* software, const char* version, bool debug) :
|
||||
CDMRIPSC::CDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, const char* software, const char* version, bool debug) :
|
||||
m_address(),
|
||||
m_port(port),
|
||||
m_id(NULL),
|
||||
|
@ -84,7 +85,7 @@ m_beacon(false)
|
|||
::srand(stopWatch.start());
|
||||
}
|
||||
|
||||
CHomebrewDMRIPSC::~CHomebrewDMRIPSC()
|
||||
CDMRIPSC::~CDMRIPSC()
|
||||
{
|
||||
delete[] m_buffer;
|
||||
delete[] m_salt;
|
||||
|
@ -92,7 +93,7 @@ CHomebrewDMRIPSC::~CHomebrewDMRIPSC()
|
|||
delete[] m_id;
|
||||
}
|
||||
|
||||
void CHomebrewDMRIPSC::setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, float latitude, float longitude, int height, const std::string& location, const std::string& description, const std::string& url)
|
||||
void CDMRIPSC::setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, float latitude, float longitude, int height, const std::string& location, const std::string& description, const std::string& url)
|
||||
{
|
||||
m_callsign = callsign;
|
||||
m_rxFrequency = rxFrequency;
|
||||
|
@ -107,7 +108,7 @@ void CHomebrewDMRIPSC::setConfig(const std::string& callsign, unsigned int rxFre
|
|||
m_url = url;
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::open()
|
||||
bool CDMRIPSC::open()
|
||||
{
|
||||
LogMessage("Opening DMR IPSC");
|
||||
|
||||
|
@ -128,12 +129,12 @@ bool CHomebrewDMRIPSC::open()
|
|||
return true;
|
||||
}
|
||||
|
||||
void CHomebrewDMRIPSC::enable(bool enabled)
|
||||
void CDMRIPSC::enable(bool enabled)
|
||||
{
|
||||
m_enabled = enabled;
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::read(CDMRData& data)
|
||||
bool CDMRIPSC::read(CDMRData& data)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
return false;
|
||||
|
@ -188,7 +189,7 @@ bool CHomebrewDMRIPSC::read(CDMRData& data)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::write(const CDMRData& data)
|
||||
bool CDMRIPSC::write(const CDMRData& data)
|
||||
{
|
||||
if (m_status != RUNNING)
|
||||
return false;
|
||||
|
@ -242,7 +243,7 @@ bool CHomebrewDMRIPSC::write(const CDMRData& data)
|
|||
return write(buffer, HOMEBREW_DATA_PACKET_LENGTH);
|
||||
}
|
||||
|
||||
void CHomebrewDMRIPSC::close()
|
||||
void CDMRIPSC::close()
|
||||
{
|
||||
LogMessage("Closing DMR IPSC");
|
||||
|
||||
|
@ -254,7 +255,7 @@ void CHomebrewDMRIPSC::close()
|
|||
m_socket.close();
|
||||
}
|
||||
|
||||
void CHomebrewDMRIPSC::clock(unsigned int ms)
|
||||
void CDMRIPSC::clock(unsigned int ms)
|
||||
{
|
||||
in_addr address;
|
||||
unsigned int port;
|
||||
|
@ -359,7 +360,7 @@ void CHomebrewDMRIPSC::clock(unsigned int ms)
|
|||
}
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::writeLogin()
|
||||
bool CDMRIPSC::writeLogin()
|
||||
{
|
||||
unsigned char buffer[8U];
|
||||
|
||||
|
@ -369,7 +370,7 @@ bool CHomebrewDMRIPSC::writeLogin()
|
|||
return write(buffer, 8U);
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::writeAuthorisation()
|
||||
bool CDMRIPSC::writeAuthorisation()
|
||||
{
|
||||
unsigned int size = m_password.size();
|
||||
|
||||
|
@ -390,7 +391,7 @@ bool CHomebrewDMRIPSC::writeAuthorisation()
|
|||
return write(out, 40U);
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::writeConfig()
|
||||
bool CDMRIPSC::writeConfig()
|
||||
{
|
||||
char buffer[400U];
|
||||
|
||||
|
@ -404,7 +405,7 @@ bool CHomebrewDMRIPSC::writeConfig()
|
|||
return write((unsigned char*)buffer, 302U);
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::writePing()
|
||||
bool CDMRIPSC::writePing()
|
||||
{
|
||||
unsigned char buffer[11U];
|
||||
|
||||
|
@ -414,7 +415,7 @@ bool CHomebrewDMRIPSC::writePing()
|
|||
return write(buffer, 11U);
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::wantsBeacon()
|
||||
bool CDMRIPSC::wantsBeacon()
|
||||
{
|
||||
bool beacon = m_beacon;
|
||||
|
||||
|
@ -423,7 +424,7 @@ bool CHomebrewDMRIPSC::wantsBeacon()
|
|||
return beacon;
|
||||
}
|
||||
|
||||
bool CHomebrewDMRIPSC::write(const unsigned char* data, unsigned int length)
|
||||
bool CDMRIPSC::write(const unsigned char* data, unsigned int length)
|
||||
{
|
||||
assert(data != NULL);
|
||||
assert(length > 0U);
|
|
@ -16,8 +16,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(HOMEBREWDMRIPSC_H)
|
||||
#define HOMEBREWDMRIPSC_H
|
||||
#if !defined(DMRIPSC_H)
|
||||
#define DMRIPSC_H
|
||||
|
||||
#include "UDPSocket.h"
|
||||
#include "Timer.h"
|
||||
|
@ -27,11 +27,11 @@
|
|||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
class CHomebrewDMRIPSC
|
||||
class CDMRIPSC
|
||||
{
|
||||
public:
|
||||
CHomebrewDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, const char* software, const char* version, bool debug);
|
||||
~CHomebrewDMRIPSC();
|
||||
CDMRIPSC(const std::string& address, unsigned int port, unsigned int id, const std::string& password, const char* software, const char* version, bool debug);
|
||||
~CDMRIPSC();
|
||||
|
||||
void setConfig(const std::string& callsign, unsigned int rxFrequency, unsigned int txFrequency, unsigned int power, unsigned int colorCode, float latitude, float longitude, int height, const std::string& location, const std::string& description, const std::string& url);
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,14 +16,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "LC.h"
|
||||
#include "DMRLC.h"
|
||||
|
||||
#include "Utils.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CLC::CLC(FLCO flco, unsigned int srcId, unsigned int dstId) :
|
||||
CDMRLC::CDMRLC(FLCO flco, unsigned int srcId, unsigned int dstId) :
|
||||
m_PF(false),
|
||||
m_FLCO(flco),
|
||||
m_FID(0U),
|
||||
|
@ -32,7 +32,7 @@ m_dstId(dstId)
|
|||
{
|
||||
}
|
||||
|
||||
CLC::CLC(const unsigned char* bytes) :
|
||||
CDMRLC::CDMRLC(const unsigned char* bytes) :
|
||||
m_PF(false),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_FID(0U),
|
||||
|
@ -51,7 +51,7 @@ m_dstId(0U)
|
|||
m_srcId = bytes[6U] << 16 | bytes[7U] << 8 | bytes[8U];
|
||||
}
|
||||
|
||||
CLC::CLC(const bool* bits) :
|
||||
CDMRLC::CDMRLC(const bool* bits) :
|
||||
m_PF(false),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_FID(0U),
|
||||
|
@ -83,7 +83,7 @@ m_dstId(0U)
|
|||
m_dstId = d1 << 16 | d2 << 8 | d3;
|
||||
}
|
||||
|
||||
CLC::CLC() :
|
||||
CDMRLC::CDMRLC() :
|
||||
m_PF(false),
|
||||
m_FLCO(FLCO_GROUP),
|
||||
m_FID(0U),
|
||||
|
@ -92,11 +92,11 @@ m_dstId(0U)
|
|||
{
|
||||
}
|
||||
|
||||
CLC::~CLC()
|
||||
CDMRLC::~CDMRLC()
|
||||
{
|
||||
}
|
||||
|
||||
void CLC::getData(unsigned char* bytes) const
|
||||
void CDMRLC::getData(unsigned char* bytes) const
|
||||
{
|
||||
assert(bytes != NULL);
|
||||
|
||||
|
@ -116,7 +116,7 @@ void CLC::getData(unsigned char* bytes) const
|
|||
bytes[8U] = m_srcId >> 0;
|
||||
}
|
||||
|
||||
void CLC::getData(bool* bits) const
|
||||
void CDMRLC::getData(bool* bits) const
|
||||
{
|
||||
unsigned char bytes[9U];
|
||||
getData(bytes);
|
||||
|
@ -132,52 +132,52 @@ void CLC::getData(bool* bits) const
|
|||
CUtils::byteToBitsBE(bytes[8U], bits + 64U);
|
||||
}
|
||||
|
||||
bool CLC::getPF() const
|
||||
bool CDMRLC::getPF() const
|
||||
{
|
||||
return m_PF;
|
||||
}
|
||||
|
||||
void CLC::setPF(bool pf)
|
||||
void CDMRLC::setPF(bool pf)
|
||||
{
|
||||
m_PF = pf;
|
||||
}
|
||||
|
||||
FLCO CLC::getFLCO() const
|
||||
FLCO CDMRLC::getFLCO() const
|
||||
{
|
||||
return m_FLCO;
|
||||
}
|
||||
|
||||
void CLC::setFLCO(FLCO flco)
|
||||
void CDMRLC::setFLCO(FLCO flco)
|
||||
{
|
||||
m_FLCO = flco;
|
||||
}
|
||||
|
||||
unsigned char CLC::getFID() const
|
||||
unsigned char CDMRLC::getFID() const
|
||||
{
|
||||
return m_FID;
|
||||
}
|
||||
|
||||
void CLC::setFID(unsigned char fid)
|
||||
void CDMRLC::setFID(unsigned char fid)
|
||||
{
|
||||
m_FID = fid;
|
||||
}
|
||||
|
||||
unsigned int CLC::getSrcId() const
|
||||
unsigned int CDMRLC::getSrcId() const
|
||||
{
|
||||
return m_srcId;
|
||||
}
|
||||
|
||||
void CLC::setSrcId(unsigned int id)
|
||||
void CDMRLC::setSrcId(unsigned int id)
|
||||
{
|
||||
m_srcId = id;
|
||||
}
|
||||
|
||||
unsigned int CLC::getDstId() const
|
||||
unsigned int CDMRLC::getDstId() const
|
||||
{
|
||||
return m_dstId;
|
||||
}
|
||||
|
||||
void CLC::setDstId(unsigned int id)
|
||||
void CDMRLC::setDstId(unsigned int id)
|
||||
{
|
||||
m_dstId = id;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,19 +16,19 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(LC_H)
|
||||
#define LC_H
|
||||
#if !defined(DMRLC_H)
|
||||
#define DMRLC_H
|
||||
|
||||
#include "DMRDefines.h"
|
||||
|
||||
class CLC
|
||||
class CDMRLC
|
||||
{
|
||||
public:
|
||||
CLC(FLCO flco, unsigned int srcId, unsigned int dstId);
|
||||
CLC(const unsigned char* bytes);
|
||||
CLC(const bool* bits);
|
||||
CLC();
|
||||
~CLC();
|
||||
CDMRLC(FLCO flco, unsigned int srcId, unsigned int dstId);
|
||||
CDMRLC(const unsigned char* bytes);
|
||||
CDMRLC(const bool* bits);
|
||||
CDMRLC();
|
||||
~CDMRLC();
|
||||
|
||||
void getData(unsigned char* bytes) const;
|
||||
void getData(bool* bits) const;
|
|
@ -16,7 +16,7 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "ShortLC.h"
|
||||
#include "DMRShortLC.h"
|
||||
|
||||
#include "Hamming.h"
|
||||
#include "Utils.h"
|
||||
|
@ -25,7 +25,7 @@
|
|||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
||||
CShortLC::CShortLC() :
|
||||
CDMRShortLC::CDMRShortLC() :
|
||||
m_rawData(NULL),
|
||||
m_deInterData(NULL)
|
||||
{
|
||||
|
@ -33,14 +33,14 @@ m_deInterData(NULL)
|
|||
m_deInterData = new bool[68U];
|
||||
}
|
||||
|
||||
CShortLC::~CShortLC()
|
||||
CDMRShortLC::~CDMRShortLC()
|
||||
{
|
||||
delete[] m_rawData;
|
||||
delete[] m_deInterData;
|
||||
}
|
||||
|
||||
// The main decode function
|
||||
bool CShortLC::decode(const unsigned char* in, unsigned char* out)
|
||||
bool CDMRShortLC::decode(const unsigned char* in, unsigned char* out)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
|
@ -63,7 +63,7 @@ bool CShortLC::decode(const unsigned char* in, unsigned char* out)
|
|||
}
|
||||
|
||||
// The main encode function
|
||||
void CShortLC::encode(const unsigned char* in, unsigned char* out)
|
||||
void CDMRShortLC::encode(const unsigned char* in, unsigned char* out)
|
||||
{
|
||||
assert(in != NULL);
|
||||
assert(out != NULL);
|
||||
|
@ -81,7 +81,7 @@ void CShortLC::encode(const unsigned char* in, unsigned char* out)
|
|||
encodeExtractBinary(out);
|
||||
}
|
||||
|
||||
void CShortLC::decodeExtractBinary(const unsigned char* in)
|
||||
void CDMRShortLC::decodeExtractBinary(const unsigned char* in)
|
||||
{
|
||||
CUtils::byteToBitsBE(in[0U], m_rawData + 0U);
|
||||
CUtils::byteToBitsBE(in[1U], m_rawData + 8U);
|
||||
|
@ -95,7 +95,7 @@ void CShortLC::decodeExtractBinary(const unsigned char* in)
|
|||
}
|
||||
|
||||
// Deinterleave the raw data
|
||||
void CShortLC::decodeDeInterleave()
|
||||
void CDMRShortLC::decodeDeInterleave()
|
||||
{
|
||||
for (unsigned int i = 0U; i < 68U; i++)
|
||||
m_deInterData[i] = false;
|
||||
|
@ -111,7 +111,7 @@ void CShortLC::decodeDeInterleave()
|
|||
}
|
||||
|
||||
// Check each row with a Hamming (17,12,3) code and each column with a parity bit
|
||||
bool CShortLC::decodeErrorCheck()
|
||||
bool CDMRShortLC::decodeErrorCheck()
|
||||
{
|
||||
// Run through each of the 3 rows containing data
|
||||
CHamming::decode17123(m_deInterData + 0U);
|
||||
|
@ -129,7 +129,7 @@ bool CShortLC::decodeErrorCheck()
|
|||
}
|
||||
|
||||
// Extract the 36 bits of payload
|
||||
void CShortLC::decodeExtractData(unsigned char* data) const
|
||||
void CDMRShortLC::decodeExtractData(unsigned char* data) const
|
||||
{
|
||||
bool bData[40U];
|
||||
|
||||
|
@ -154,7 +154,7 @@ void CShortLC::decodeExtractData(unsigned char* data) const
|
|||
}
|
||||
|
||||
// Extract the 36 bits of payload
|
||||
void CShortLC::encodeExtractData(const unsigned char* in) const
|
||||
void CDMRShortLC::encodeExtractData(const unsigned char* in) const
|
||||
{
|
||||
bool bData[40U];
|
||||
CUtils::byteToBitsBE(in[0U], bData + 0U);
|
||||
|
@ -178,7 +178,7 @@ void CShortLC::encodeExtractData(const unsigned char* in) const
|
|||
}
|
||||
|
||||
// Check each row with a Hamming (17,12,3) code and each column with a parity bit
|
||||
void CShortLC::encodeErrorCheck()
|
||||
void CDMRShortLC::encodeErrorCheck()
|
||||
{
|
||||
// Run through each of the 3 rows containing data
|
||||
CHamming::encode17123(m_deInterData + 0U);
|
||||
|
@ -191,7 +191,7 @@ void CShortLC::encodeErrorCheck()
|
|||
}
|
||||
|
||||
// Interleave the raw data
|
||||
void CShortLC::encodeInterleave()
|
||||
void CDMRShortLC::encodeInterleave()
|
||||
{
|
||||
for (unsigned int i = 0U; i < 72U; i++)
|
||||
m_rawData[i] = false;
|
||||
|
@ -206,7 +206,7 @@ void CShortLC::encodeInterleave()
|
|||
m_rawData[67U] = m_deInterData[67U];
|
||||
}
|
||||
|
||||
void CShortLC::encodeExtractBinary(unsigned char* data)
|
||||
void CDMRShortLC::encodeExtractBinary(unsigned char* data)
|
||||
{
|
||||
CUtils::bitsToByteBE(m_rawData + 0U, data[0U]);
|
||||
CUtils::bitsToByteBE(m_rawData + 8U, data[1U]);
|
|
@ -16,14 +16,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(SHORTLC_H)
|
||||
#define SHORTLC_H
|
||||
#if !defined(DMRSHORTLC_H)
|
||||
#define DMRSHORTLC_H
|
||||
|
||||
class CShortLC
|
||||
class CDMRShortLC
|
||||
{
|
||||
public:
|
||||
CShortLC();
|
||||
~CShortLC();
|
||||
CDMRShortLC();
|
||||
~CDMRShortLC();
|
||||
|
||||
bool decode(const unsigned char* in, unsigned char* out);
|
||||
|
129
DMRSlot.cpp
129
DMRSlot.cpp
|
@ -12,33 +12,33 @@
|
|||
*/
|
||||
|
||||
#include "DMRDataHeader.h"
|
||||
#include "SlotType.h"
|
||||
#include "ShortLC.h"
|
||||
#include "DMRSlotType.h"
|
||||
#include "DMRShortLC.h"
|
||||
#include "DMRFullLC.h"
|
||||
#include "DMRSlot.h"
|
||||
#include "DMRSync.h"
|
||||
#include "FullLC.h"
|
||||
#include "DMRCSBK.h"
|
||||
#include "Utils.h"
|
||||
#include "CSBK.h"
|
||||
#include "Sync.h"
|
||||
#include "CRC.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <ctime>
|
||||
|
||||
unsigned int CDMRSlot::m_colorCode = 0U;
|
||||
CModem* CDMRSlot::m_modem = NULL;
|
||||
CHomebrewDMRIPSC* CDMRSlot::m_network = NULL;
|
||||
IDisplay* CDMRSlot::m_display = NULL;
|
||||
bool CDMRSlot::m_duplex = true;
|
||||
unsigned int CDMRSlot::m_colorCode = 0U;
|
||||
CModem* CDMRSlot::m_modem = NULL;
|
||||
CDMRIPSC* CDMRSlot::m_network = NULL;
|
||||
IDisplay* CDMRSlot::m_display = NULL;
|
||||
bool CDMRSlot::m_duplex = true;
|
||||
|
||||
unsigned char* CDMRSlot::m_idle = NULL;
|
||||
unsigned char* CDMRSlot::m_idle = NULL;
|
||||
|
||||
FLCO CDMRSlot::m_flco1;
|
||||
unsigned char CDMRSlot::m_id1 = 0U;
|
||||
bool CDMRSlot::m_voice1 = true;
|
||||
FLCO CDMRSlot::m_flco2;
|
||||
unsigned char CDMRSlot::m_id2 = 0U;
|
||||
bool CDMRSlot::m_voice2 = true;
|
||||
FLCO CDMRSlot::m_flco1;
|
||||
unsigned char CDMRSlot::m_id1 = 0U;
|
||||
bool CDMRSlot::m_voice1 = true;
|
||||
FLCO CDMRSlot::m_flco2;
|
||||
unsigned char CDMRSlot::m_id2 = 0U;
|
||||
bool CDMRSlot::m_voice2 = true;
|
||||
|
||||
// #define DUMP_DMR
|
||||
|
||||
|
@ -98,7 +98,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
bool audioSync = (data[1U] & DMR_SYNC_AUDIO) == DMR_SYNC_AUDIO;
|
||||
|
||||
if (dataSync) {
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.putData(data + 2U);
|
||||
|
||||
unsigned char dataType = slotType.getDataType();
|
||||
|
@ -107,7 +107,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
if (m_state == RS_RELAYING_RF_AUDIO)
|
||||
return;
|
||||
|
||||
CFullLC fullLC;
|
||||
CDMRFullLC fullLC;
|
||||
m_lc = fullLC.decode(data + 2U, DT_VOICE_LC_HEADER);
|
||||
if (m_lc == NULL) {
|
||||
LogMessage("DMR Slot %u: unable to decode the LC", m_slotNo);
|
||||
|
@ -118,8 +118,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -156,8 +155,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -176,8 +174,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
slotType.getData(data + 2U);
|
||||
|
||||
// Set the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_EOT;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -211,14 +208,13 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
|
||||
m_frames = dataHeader.getBlocks();
|
||||
|
||||
m_lc = new CLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
||||
m_lc = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
||||
|
||||
// Regenerate the Slot Type
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -244,7 +240,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
|
||||
LogMessage("DMR Slot %u, received RF data header from %u to %s%u, %u blocks", m_slotNo, srcId, gi ? "TG ": "", dstId, m_frames);
|
||||
} else if (dataType == DT_CSBK) {
|
||||
CCSBK csbk(data + 2U);
|
||||
CDMRCSBK csbk(data + 2U);
|
||||
// if (!csbk.isValid()) {
|
||||
// LogMessage("DMR Slot %u: unable to decode the CSBK", m_slotNo);
|
||||
// return;
|
||||
|
@ -263,8 +259,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -292,8 +287,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
m_frames--;
|
||||
|
||||
|
@ -316,8 +310,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
} else if (audioSync) {
|
||||
if (m_state == RS_RELAYING_RF_AUDIO) {
|
||||
// Convert the Audio Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addAudioSync(data + 2U);
|
||||
CSync::addDMRAudioSync(data + 2U);
|
||||
|
||||
unsigned char fid = m_lc->getFID();
|
||||
if (fid == FID_ETSI || fid == FID_DMRA)
|
||||
|
@ -337,7 +330,7 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
m_state = RS_LATE_ENTRY;
|
||||
}
|
||||
} else {
|
||||
CEMB emb;
|
||||
CDMREMB emb;
|
||||
emb.putData(data + 2U);
|
||||
|
||||
if (m_state == RS_RELAYING_RF_AUDIO) {
|
||||
|
@ -370,13 +363,12 @@ void CDMRSlot::writeModem(unsigned char *data)
|
|||
// Create a dummy start frame to replace the received frame
|
||||
unsigned char start[DMR_FRAME_LENGTH_BYTES + 2U];
|
||||
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(start + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
CFullLC fullLC;
|
||||
CDMRFullLC fullLC;
|
||||
fullLC.encode(*m_lc, start + 2U, DT_VOICE_LC_HEADER);
|
||||
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.setDataType(DT_VOICE_LC_HEADER);
|
||||
slotType.getData(start + 2U);
|
||||
|
@ -468,13 +460,12 @@ void CDMRSlot::writeEndOfTransmission(bool writeEnd)
|
|||
// Create a dummy start end frame
|
||||
unsigned char data[DMR_FRAME_LENGTH_BYTES + 2U];
|
||||
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
CFullLC fullLC;
|
||||
CDMRFullLC fullLC;
|
||||
fullLC.encode(*m_lc, data + 2U, DT_TERMINATOR_WITH_LC);
|
||||
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.setDataType(DT_TERMINATOR_WITH_LC);
|
||||
slotType.getData(data + 2U);
|
||||
|
@ -512,7 +503,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
if (m_state == RS_RELAYING_NETWORK_AUDIO)
|
||||
return;
|
||||
|
||||
CFullLC fullLC;
|
||||
CDMRFullLC fullLC;
|
||||
m_lc = fullLC.decode(data + 2U, DT_VOICE_LC_HEADER);
|
||||
if (m_lc == NULL) {
|
||||
LogMessage("DMR Slot %u, bad LC received from the network", m_slotNo);
|
||||
|
@ -520,14 +511,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
}
|
||||
|
||||
// Regenerate the Slot Type
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.setDataType(DT_VOICE_LC_HEADER);
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -562,14 +552,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
return;
|
||||
|
||||
// Regenerate the Slot Type
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.setDataType(DT_VOICE_PI_HEADER);
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -584,14 +573,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
return;
|
||||
|
||||
// Regenerate the Slot Type
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.setDataType(DT_TERMINATOR_WITH_LC);
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_EOT;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -626,17 +614,16 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
|
||||
m_frames = dataHeader.getBlocks();
|
||||
|
||||
m_lc = new CLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
||||
m_lc = new CDMRLC(gi ? FLCO_GROUP : FLCO_USER_USER, srcId, dstId);
|
||||
|
||||
// Regenerate the Slot Type
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.setDataType(DT_DATA_HEADER);
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -657,7 +644,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
LogMessage("DMR Slot %u, received network data header from %u to %s%u, %u blocks", m_slotNo, dmrData.getSrcId(), gi ? "TG ": "", dmrData.getDstId(), m_frames);
|
||||
} else if (dataType == DT_VOICE_SYNC) {
|
||||
if (m_state == RS_LISTENING) {
|
||||
m_lc = new CLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId());
|
||||
m_lc = new CDMRLC(dmrData.getFLCO(), dmrData.getSrcId(), dmrData.getDstId());
|
||||
|
||||
m_timeoutTimer.start();
|
||||
|
||||
|
@ -703,8 +690,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
}
|
||||
|
||||
// Convert the Audio Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addAudioSync(data + 2U);
|
||||
CSync::addDMRAudioSync(data + 2U);
|
||||
|
||||
writeQueue(data);
|
||||
|
||||
|
@ -760,7 +746,7 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
writeFile(data);
|
||||
#endif
|
||||
} else if (dataType == DT_CSBK) {
|
||||
CCSBK csbk(data + 2U);
|
||||
CDMRCSBK csbk(data + 2U);
|
||||
// if (!csbk.isValid()) {
|
||||
// LogMessage("DMR Slot %u: unable to decode the CSBK", m_slotNo);
|
||||
// return;
|
||||
|
@ -776,14 +762,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
case CSBKO_NACKRSP:
|
||||
case CSBKO_PRECCSBK: {
|
||||
// Regenerate the Slot Type
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.putData(data + 2U);
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
data[0U] = TAG_DATA;
|
||||
data[1U] = 0x00U;
|
||||
|
@ -808,14 +793,13 @@ void CDMRSlot::writeNetwork(const CDMRData& dmrData)
|
|||
return;
|
||||
|
||||
// Regenerate the Slot Type
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.putData(data + 2U);
|
||||
slotType.setColorCode(m_colorCode);
|
||||
slotType.getData(data + 2U);
|
||||
|
||||
// Convert the Data Sync to be from the BS
|
||||
CDMRSync sync;
|
||||
sync.addDataSync(data + 2U);
|
||||
CSync::addDMRDataSync(data + 2U);
|
||||
|
||||
m_frames--;
|
||||
|
||||
|
@ -930,7 +914,7 @@ void CDMRSlot::writeNetwork(const unsigned char* data, unsigned char dataType)
|
|||
writeNetwork(data, dataType, m_lc->getFLCO(), m_lc->getSrcId(), m_lc->getDstId());
|
||||
}
|
||||
|
||||
void CDMRSlot::init(unsigned int colorCode, CModem* modem, CHomebrewDMRIPSC* network, IDisplay* display, bool duplex)
|
||||
void CDMRSlot::init(unsigned int colorCode, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex)
|
||||
{
|
||||
assert(modem != NULL);
|
||||
assert(display != NULL);
|
||||
|
@ -946,7 +930,7 @@ void CDMRSlot::init(unsigned int colorCode, CModem* modem, CHomebrewDMRIPSC* net
|
|||
::memcpy(m_idle, DMR_IDLE_DATA, DMR_FRAME_LENGTH_BYTES + 2U);
|
||||
|
||||
// Generate the Slot Type for the Idle frame
|
||||
CSlotType slotType;
|
||||
CDMRSlotType slotType;
|
||||
slotType.setColorCode(colorCode);
|
||||
slotType.setDataType(DT_IDLE);
|
||||
slotType.getData(m_idle + 2U);
|
||||
|
@ -1026,7 +1010,7 @@ void CDMRSlot::setShortLC(unsigned int slotNo, unsigned int id, FLCO flco, bool
|
|||
|
||||
unsigned char sLC[9U];
|
||||
|
||||
CShortLC shortLC;
|
||||
CDMRShortLC shortLC;
|
||||
shortLC.encode(lc, sLC);
|
||||
|
||||
m_modem->writeDMRShortLC(sLC);
|
||||
|
@ -1117,8 +1101,7 @@ void CDMRSlot::insertSilence(unsigned int count)
|
|||
::memcpy(data, DMR_SILENCE_DATA, DMR_FRAME_LENGTH_BYTES + 2U);
|
||||
|
||||
if (n == 0U) {
|
||||
CDMRSync sync;
|
||||
sync.addAudioSync(data + 2U);
|
||||
CSync::addDMRAudioSync(data + 2U);
|
||||
} else {
|
||||
// Set the Embedded LC to 0x00
|
||||
::memset(data + 2U + 13U, 0x00U, 5U);
|
||||
|
|
18
DMRSlot.h
18
DMRSlot.h
|
@ -19,19 +19,19 @@
|
|||
#if !defined(DMRSlot_H)
|
||||
#define DMRSlot_H
|
||||
|
||||
#include "HomebrewDMRIPSC.h"
|
||||
#include "DMREmbeddedLC.h"
|
||||
#include "StopWatch.h"
|
||||
#include "EmbeddedLC.h"
|
||||
#include "RingBuffer.h"
|
||||
#include "AMBEFEC.h"
|
||||
#include "DMRSlot.h"
|
||||
#include "DMRData.h"
|
||||
#include "Display.h"
|
||||
#include "Defines.h"
|
||||
#include "DMRIPSC.h"
|
||||
#include "DMREMB.h"
|
||||
#include "Timer.h"
|
||||
#include "Modem.h"
|
||||
#include "EMB.h"
|
||||
#include "LC.h"
|
||||
#include "DMRLC.h"
|
||||
|
||||
class CDMRSlot {
|
||||
public:
|
||||
|
@ -46,14 +46,14 @@ public:
|
|||
|
||||
void clock(unsigned int ms);
|
||||
|
||||
static void init(unsigned int colorCode, CModem* modem, CHomebrewDMRIPSC* network, IDisplay* display, bool duplex);
|
||||
static void init(unsigned int colorCode, CModem* modem, CDMRIPSC* network, IDisplay* display, bool duplex);
|
||||
|
||||
private:
|
||||
unsigned int m_slotNo;
|
||||
CRingBuffer<unsigned char> m_queue;
|
||||
RPT_STATE m_state;
|
||||
CEmbeddedLC m_embeddedLC;
|
||||
CLC* m_lc;
|
||||
CDMREmbeddedLC m_embeddedLC;
|
||||
CDMRLC* m_lc;
|
||||
unsigned char m_seqNo;
|
||||
unsigned char m_n;
|
||||
CTimer m_networkWatchdog;
|
||||
|
@ -66,12 +66,12 @@ private:
|
|||
unsigned int m_bits;
|
||||
unsigned int m_errs;
|
||||
unsigned char* m_lastFrame;
|
||||
CEMB m_lastEMB;
|
||||
CDMREMB m_lastEMB;
|
||||
FILE* m_fp;
|
||||
|
||||
static unsigned int m_colorCode;
|
||||
static CModem* m_modem;
|
||||
static CHomebrewDMRIPSC* m_network;
|
||||
static CDMRIPSC* m_network;
|
||||
static IDisplay* m_display;
|
||||
static bool m_duplex;
|
||||
|
||||
|
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
* Copyright (C) 2015,2016 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 "DMRSlotType.h"
|
||||
|
||||
#include "Golay2087.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CDMRSlotType::CDMRSlotType() :
|
||||
m_colorCode(0U),
|
||||
m_dataType(0U)
|
||||
{
|
||||
}
|
||||
|
||||
CDMRSlotType::~CDMRSlotType()
|
||||
{
|
||||
}
|
||||
|
||||
void CDMRSlotType::putData(const unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char DMRSlotType[3U];
|
||||
DMRSlotType[0U] = (data[12U] << 2) & 0xFCU;
|
||||
DMRSlotType[0U] |= (data[13U] >> 6) & 0x03U;
|
||||
|
||||
DMRSlotType[1U] = (data[13U] << 2) & 0xC0U;
|
||||
DMRSlotType[1U] |= (data[19U] << 2) & 0x3CU;
|
||||
DMRSlotType[1U] |= (data[20U] >> 6) & 0x03U;
|
||||
|
||||
DMRSlotType[2U] = (data[20U] << 2) & 0xF0U;
|
||||
|
||||
unsigned char code = CGolay2087::decode(DMRSlotType);
|
||||
|
||||
m_colorCode = (code >> 4) & 0x0FU;
|
||||
m_dataType = (code >> 0) & 0x0FU;
|
||||
}
|
||||
|
||||
void CDMRSlotType::getData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char DMRSlotType[3U];
|
||||
DMRSlotType[0U] = (m_colorCode << 4) & 0xF0U;
|
||||
DMRSlotType[0U] |= (m_dataType << 0) & 0x0FU;
|
||||
DMRSlotType[1U] = 0x00U;
|
||||
DMRSlotType[2U] = 0x00U;
|
||||
|
||||
CGolay2087::encode(DMRSlotType);
|
||||
|
||||
data[12U] = (data[12U] & 0xC0U) | ((DMRSlotType[0U] >> 2) & 0x3FU);
|
||||
data[13U] = (data[13U] & 0x0FU) | ((DMRSlotType[0U] << 6) & 0xC0U) | ((DMRSlotType[1U] >> 2) & 0x30U);
|
||||
data[19U] = (data[19U] & 0xF0U) | ((DMRSlotType[1U] >> 2) & 0x0FU);
|
||||
data[20U] = (data[20U] & 0x03U) | ((DMRSlotType[1U] << 6) & 0xC0U) | ((DMRSlotType[2U] >> 2) & 0x3CU);
|
||||
}
|
||||
|
||||
unsigned char CDMRSlotType::getColorCode() const
|
||||
{
|
||||
return m_colorCode;
|
||||
}
|
||||
|
||||
void CDMRSlotType::setColorCode(unsigned char code)
|
||||
{
|
||||
m_colorCode = code;
|
||||
}
|
||||
|
||||
unsigned char CDMRSlotType::getDataType() const
|
||||
{
|
||||
return m_dataType;
|
||||
}
|
||||
|
||||
void CDMRSlotType::setDataType(unsigned char type)
|
||||
{
|
||||
m_dataType = type;
|
||||
}
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (C) 2015 by Jonathan Naylor G4KLX
|
||||
* Copyright (C) 2015,2016 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
|
||||
|
@ -16,14 +16,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(SLOTTYPE_H)
|
||||
#define SLOTTYPE_H
|
||||
#if !defined(DMRSLOTTYPE_H)
|
||||
#define DMRSLOTTYPE_H
|
||||
|
||||
class CSlotType
|
||||
class CDMRSlotType
|
||||
{
|
||||
public:
|
||||
CSlotType();
|
||||
~CSlotType();
|
||||
CDMRSlotType();
|
||||
~CDMRSlotType();
|
||||
|
||||
void putData(const unsigned char* data);
|
||||
void getData(unsigned char* data) const;
|
100
EMB.cpp
100
EMB.cpp
|
@ -1,100 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 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 "EMB.h"
|
||||
|
||||
#include "QR1676.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CEMB::CEMB() :
|
||||
m_colorCode(0U),
|
||||
m_PI(false),
|
||||
m_LCSS(0U)
|
||||
{
|
||||
}
|
||||
|
||||
CEMB::~CEMB()
|
||||
{
|
||||
}
|
||||
|
||||
void CEMB::putData(const unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char emb[2U];
|
||||
emb[0U] = (data[13U] << 4) & 0xF0U;
|
||||
emb[0U] |= (data[14U] >> 4) & 0x0FU;
|
||||
emb[1U] = (data[18U] << 4) & 0xF0U;
|
||||
emb[1U] |= (data[19U] >> 4) & 0x0FU;
|
||||
|
||||
CQR1676::decode(emb);
|
||||
|
||||
m_colorCode = (emb[0U] >> 4) & 0x0FU;
|
||||
m_PI = (emb[0U] & 0x08U) == 0x08U;
|
||||
m_LCSS = (emb[0U] >> 1) & 0x03U;
|
||||
}
|
||||
|
||||
void CEMB::getData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char emb[2U];
|
||||
emb[0U] = (m_colorCode << 4) & 0xF0U;
|
||||
emb[0U] |= m_PI ? 0x08U : 0x00U;
|
||||
emb[0U] |= (m_LCSS << 1) & 0x06U;
|
||||
emb[1U] = 0x00U;
|
||||
|
||||
CQR1676::encode(emb);
|
||||
|
||||
data[13U] = (data[13U] & 0xF0U) | ((emb[0U] >> 4U) & 0x0FU);
|
||||
data[14U] = (data[14U] & 0x0FU) | ((emb[0U] << 4U) & 0xF0U);
|
||||
data[18U] = (data[18U] & 0xF0U) | ((emb[1U] >> 4U) & 0x0FU);
|
||||
data[19U] = (data[19U] & 0x0FU) | ((emb[1U] << 4U) & 0xF0U);
|
||||
}
|
||||
|
||||
unsigned char CEMB::getColorCode() const
|
||||
{
|
||||
return m_colorCode;
|
||||
}
|
||||
|
||||
void CEMB::setColorCode(unsigned char code)
|
||||
{
|
||||
m_colorCode = code;
|
||||
}
|
||||
|
||||
bool CEMB::getPI() const
|
||||
{
|
||||
return m_PI;
|
||||
}
|
||||
|
||||
void CEMB::setPI(bool pi)
|
||||
{
|
||||
m_PI = pi;
|
||||
}
|
||||
|
||||
unsigned char CEMB::getLCSS() const
|
||||
{
|
||||
return m_LCSS;
|
||||
}
|
||||
|
||||
void CEMB::setLCSS(unsigned char lcss)
|
||||
{
|
||||
m_LCSS = lcss;
|
||||
}
|
|
@ -446,7 +446,7 @@ bool CMMDVMHost::createDMRNetwork()
|
|||
LogInfo(" Address: %s", address.c_str());
|
||||
LogInfo(" Port: %u", port);
|
||||
|
||||
m_dmrNetwork = new CHomebrewDMRIPSC(address, port, id, password, VERSION, "MMDVM", debug);
|
||||
m_dmrNetwork = new CDMRIPSC(address, port, id, password, VERSION, "MMDVM", debug);
|
||||
|
||||
std::string callsign = m_conf.getCallsign();
|
||||
unsigned int rxFrequency = m_conf.getRxFrequency();
|
||||
|
|
22
MMDVMHost.h
22
MMDVMHost.h
|
@ -19,8 +19,8 @@
|
|||
#if !defined(MMDVMHOST_H)
|
||||
#define MMDVMHOST_H
|
||||
|
||||
#include "HomebrewDMRIPSC.h"
|
||||
#include "DStarNetwork.h"
|
||||
#include "DMRIPSC.h"
|
||||
#include "Display.h"
|
||||
#include "Timer.h"
|
||||
#include "Modem.h"
|
||||
|
@ -37,16 +37,16 @@ public:
|
|||
int run();
|
||||
|
||||
private:
|
||||
CConf m_conf;
|
||||
CModem* m_modem;
|
||||
CDStarNetwork* m_dstarNetwork;
|
||||
CHomebrewDMRIPSC* m_dmrNetwork;
|
||||
IDisplay* m_display;
|
||||
unsigned char m_mode;
|
||||
CTimer m_modeTimer;
|
||||
bool m_dstarEnabled;
|
||||
bool m_dmrEnabled;
|
||||
bool m_ysfEnabled;
|
||||
CConf m_conf;
|
||||
CModem* m_modem;
|
||||
CDStarNetwork* m_dstarNetwork;
|
||||
CDMRIPSC* m_dmrNetwork;
|
||||
IDisplay* m_display;
|
||||
unsigned char m_mode;
|
||||
CTimer m_modeTimer;
|
||||
bool m_dstarEnabled;
|
||||
bool m_dmrEnabled;
|
||||
bool m_ysfEnabled;
|
||||
|
||||
void readParams();
|
||||
bool createModem();
|
||||
|
|
|
@ -150,28 +150,29 @@
|
|||
<ClInclude Include="BPTC19696.h" />
|
||||
<ClInclude Include="Conf.h" />
|
||||
<ClInclude Include="CRC.h" />
|
||||
<ClInclude Include="CSBK.h" />
|
||||
<ClInclude Include="Defines.h" />
|
||||
<ClInclude Include="Display.h" />
|
||||
<ClInclude Include="DMRControl.h" />
|
||||
<ClInclude Include="DMRCSBK.h" />
|
||||
<ClInclude Include="DMRData.h" />
|
||||
<ClInclude Include="DMRDataHeader.h" />
|
||||
<ClInclude Include="DMRDefines.h" />
|
||||
<ClInclude Include="DMREMB.h" />
|
||||
<ClInclude Include="DMREmbeddedLC.h" />
|
||||
<ClInclude Include="DMRFullLC.h" />
|
||||
<ClInclude Include="DMRIPSC.h" />
|
||||
<ClInclude Include="DMRLC.h" />
|
||||
<ClInclude Include="DMRShortLC.h" />
|
||||
<ClInclude Include="DMRSlot.h" />
|
||||
<ClInclude Include="DMRSync.h" />
|
||||
<ClInclude Include="DMRSlotType.h" />
|
||||
<ClInclude Include="DStarControl.h" />
|
||||
<ClInclude Include="DStarDefines.h" />
|
||||
<ClInclude Include="DStarHeader.h" />
|
||||
<ClInclude Include="DStarNetwork.h" />
|
||||
<ClInclude Include="DStarSlowData.h" />
|
||||
<ClInclude Include="EMB.h" />
|
||||
<ClInclude Include="EmbeddedLC.h" />
|
||||
<ClInclude Include="FullLC.h" />
|
||||
<ClInclude Include="Golay2087.h" />
|
||||
<ClInclude Include="Golay24128.h" />
|
||||
<ClInclude Include="Hamming.h" />
|
||||
<ClInclude Include="HomebrewDMRIPSC.h" />
|
||||
<ClInclude Include="LC.h" />
|
||||
<ClInclude Include="Log.h" />
|
||||
<ClInclude Include="MMDVMHost.h" />
|
||||
<ClInclude Include="Modem.h" />
|
||||
|
@ -181,9 +182,8 @@
|
|||
<ClInclude Include="RS129.h" />
|
||||
<ClInclude Include="SerialController.h" />
|
||||
<ClInclude Include="SHA256.h" />
|
||||
<ClInclude Include="ShortLC.h" />
|
||||
<ClInclude Include="SlotType.h" />
|
||||
<ClInclude Include="StopWatch.h" />
|
||||
<ClInclude Include="Sync.h" />
|
||||
<ClInclude Include="TFTSerial.h" />
|
||||
<ClInclude Include="Timer.h" />
|
||||
<ClInclude Include="UDPSocket.h" />
|
||||
|
@ -199,25 +199,26 @@
|
|||
<ClCompile Include="BPTC19696.cpp" />
|
||||
<ClCompile Include="Conf.cpp" />
|
||||
<ClCompile Include="CRC.cpp" />
|
||||
<ClCompile Include="CSBK.cpp" />
|
||||
<ClCompile Include="Display.cpp" />
|
||||
<ClCompile Include="DMRControl.cpp" />
|
||||
<ClCompile Include="DMRCSBK.cpp" />
|
||||
<ClCompile Include="DMRData.cpp" />
|
||||
<ClCompile Include="DMRDataHeader.cpp" />
|
||||
<ClCompile Include="DMREMB.cpp" />
|
||||
<ClCompile Include="DMREmbeddedLC.cpp" />
|
||||
<ClCompile Include="DMRFullLC.cpp" />
|
||||
<ClCompile Include="DMRIPSC.cpp" />
|
||||
<ClCompile Include="DMRLC.cpp" />
|
||||
<ClCompile Include="DMRShortLC.cpp" />
|
||||
<ClCompile Include="DMRSlot.cpp" />
|
||||
<ClCompile Include="DMRSync.cpp" />
|
||||
<ClCompile Include="DMRSlotType.cpp" />
|
||||
<ClCompile Include="DStarControl.cpp" />
|
||||
<ClCompile Include="DStarHeader.cpp" />
|
||||
<ClCompile Include="DStarNetwork.cpp" />
|
||||
<ClCompile Include="DStarSlowData.cpp" />
|
||||
<ClCompile Include="EMB.cpp" />
|
||||
<ClCompile Include="EmbeddedLC.cpp" />
|
||||
<ClCompile Include="FullLC.cpp" />
|
||||
<ClCompile Include="Golay2087.cpp" />
|
||||
<ClCompile Include="Golay24128.cpp" />
|
||||
<ClCompile Include="Hamming.cpp" />
|
||||
<ClCompile Include="HomebrewDMRIPSC.cpp" />
|
||||
<ClCompile Include="LC.cpp" />
|
||||
<ClCompile Include="Log.cpp" />
|
||||
<ClCompile Include="MMDVMHost.cpp" />
|
||||
<ClCompile Include="Modem.cpp" />
|
||||
|
@ -226,9 +227,8 @@
|
|||
<ClCompile Include="RS129.cpp" />
|
||||
<ClCompile Include="SerialController.cpp" />
|
||||
<ClCompile Include="SHA256.cpp" />
|
||||
<ClCompile Include="ShortLC.cpp" />
|
||||
<ClCompile Include="SlotType.cpp" />
|
||||
<ClCompile Include="StopWatch.cpp" />
|
||||
<ClCompile Include="Sync.cpp" />
|
||||
<ClCompile Include="TFTSerial.cpp" />
|
||||
<ClCompile Include="Timer.cpp" />
|
||||
<ClCompile Include="UDPSocket.cpp" />
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
<ClInclude Include="CRC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CSBK.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Defines.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -41,21 +38,9 @@
|
|||
<ClInclude Include="DMRSlot.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRSync.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DStarDefines.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EMB.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EmbeddedLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FullLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Golay2087.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -65,12 +50,6 @@
|
|||
<ClInclude Include="Hamming.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="HomebrewDMRIPSC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="LC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Log.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -98,12 +77,6 @@
|
|||
<ClInclude Include="SHA256.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ShortLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SlotType.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StopWatch.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
|
@ -152,6 +125,33 @@
|
|||
<ClInclude Include="YSFFICH.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRCSBK.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Sync.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMREMB.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMREmbeddedLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRFullLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRIPSC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRShortLC.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DMRSlotType.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="BPTC19696.cpp">
|
||||
|
@ -163,9 +163,6 @@
|
|||
<ClCompile Include="CRC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CSBK.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Display.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -178,18 +175,6 @@
|
|||
<ClCompile Include="DMRSlot.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRSync.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EMB.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EmbeddedLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FullLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Golay2087.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -199,12 +184,6 @@
|
|||
<ClCompile Include="Hamming.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="HomebrewDMRIPSC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="LC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Log.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -229,12 +208,6 @@
|
|||
<ClCompile Include="SHA256.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ShortLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SlotType.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StopWatch.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -277,5 +250,32 @@
|
|||
<ClCompile Include="YSFFICH.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRCSBK.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Sync.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMREMB.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMREmbeddedLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRFullLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRIPSC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRShortLC.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DMRSlotType.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
7
Makefile
7
Makefile
|
@ -5,10 +5,9 @@ LIBS =
|
|||
LDFLAGS = -g
|
||||
|
||||
OBJECTS = \
|
||||
AMBEFEC.o BPTC19696.o Conf.o CRC.o CSBK.o Display.o DMRControl.o DMRData.o DMRDataHeader.o DMRSlot.o DMRSync.o DStarControl.o DStarHeader.o \
|
||||
DStarNetwork.o DStarSlowData.o EMB.o EmbeddedLC.o FullLC.o Golay2087.o Golay24128.o Hamming.o HomebrewDMRIPSC.o LC.o Log.o MMDVMHost.o Modem.o \
|
||||
NullDisplay.o QR1676.o RS129.o SerialController.o SHA256.o ShortLC.o SlotType.o StopWatch.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFConvolution.o \
|
||||
YSFEcho.o YSFFICH.o
|
||||
AMBEFEC.o BPTC19696.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedLC.o DMRFullLC.o DMRIPSC.o DMRLC.o DMRShortLC.o \
|
||||
DMRSlot.o DMRSlotType.o DStarControl.o DStarHeader.o DStarNetwork.o DStarSlowData.o Golay2087.o Golay24128.o Hamming.o Log.o MMDVMHost.o Modem.o NullDisplay.o \
|
||||
QR1676.o RS129.o SerialController.o SHA256.o StopWatch.o Sync.o TFTSerial.o Timer.o UDPSocket.o Utils.o YSFConvolution.o YSFEcho.o YSFFICH.o
|
||||
|
||||
all: MMDVMHost
|
||||
|
||||
|
|
92
SlotType.cpp
92
SlotType.cpp
|
@ -1,92 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2015 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 "SlotType.h"
|
||||
|
||||
#include "Golay2087.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
CSlotType::CSlotType() :
|
||||
m_colorCode(0U),
|
||||
m_dataType(0U)
|
||||
{
|
||||
}
|
||||
|
||||
CSlotType::~CSlotType()
|
||||
{
|
||||
}
|
||||
|
||||
void CSlotType::putData(const unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char slotType[3U];
|
||||
slotType[0U] = (data[12U] << 2) & 0xFCU;
|
||||
slotType[0U] |= (data[13U] >> 6) & 0x03U;
|
||||
|
||||
slotType[1U] = (data[13U] << 2) & 0xC0U;
|
||||
slotType[1U] |= (data[19U] << 2) & 0x3CU;
|
||||
slotType[1U] |= (data[20U] >> 6) & 0x03U;
|
||||
|
||||
slotType[2U] = (data[20U] << 2) & 0xF0U;
|
||||
|
||||
unsigned char code = CGolay2087::decode(slotType);
|
||||
|
||||
m_colorCode = (code >> 4) & 0x0FU;
|
||||
m_dataType = (code >> 0) & 0x0FU;
|
||||
}
|
||||
|
||||
void CSlotType::getData(unsigned char* data) const
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
unsigned char slotType[3U];
|
||||
slotType[0U] = (m_colorCode << 4) & 0xF0U;
|
||||
slotType[0U] |= (m_dataType << 0) & 0x0FU;
|
||||
slotType[1U] = 0x00U;
|
||||
slotType[2U] = 0x00U;
|
||||
|
||||
CGolay2087::encode(slotType);
|
||||
|
||||
data[12U] = (data[12U] & 0xC0U) | ((slotType[0U] >> 2) & 0x3FU);
|
||||
data[13U] = (data[13U] & 0x0FU) | ((slotType[0U] << 6) & 0xC0U) | ((slotType[1U] >> 2) & 0x30U);
|
||||
data[19U] = (data[19U] & 0xF0U) | ((slotType[1U] >> 2) & 0x0FU);
|
||||
data[20U] = (data[20U] & 0x03U) | ((slotType[1U] << 6) & 0xC0U) | ((slotType[2U] >> 2) & 0x3CU);
|
||||
}
|
||||
|
||||
unsigned char CSlotType::getColorCode() const
|
||||
{
|
||||
return m_colorCode;
|
||||
}
|
||||
|
||||
void CSlotType::setColorCode(unsigned char code)
|
||||
{
|
||||
m_colorCode = code;
|
||||
}
|
||||
|
||||
unsigned char CSlotType::getDataType() const
|
||||
{
|
||||
return m_dataType;
|
||||
}
|
||||
|
||||
void CSlotType::setDataType(unsigned char type)
|
||||
{
|
||||
m_dataType = type;
|
||||
}
|
|
@ -16,22 +16,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#include "DMRSync.h"
|
||||
#include "Sync.h"
|
||||
#include "DMRDefines.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
CDMRSync::CDMRSync()
|
||||
{
|
||||
}
|
||||
|
||||
CDMRSync::~CDMRSync()
|
||||
{
|
||||
}
|
||||
|
||||
void CDMRSync::addDataSync(unsigned char* data) const
|
||||
void CSync::addDMRDataSync(unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
|
@ -39,7 +31,7 @@ void CDMRSync::addDataSync(unsigned char* data) const
|
|||
data[i + 13U] = (data[i + 13U] & ~SYNC_MASK[i]) | BS_SOURCED_DATA_SYNC[i];
|
||||
}
|
||||
|
||||
void CDMRSync::addAudioSync(unsigned char* data) const
|
||||
void CSync::addDMRAudioSync(unsigned char* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
|
@ -16,18 +16,14 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#if !defined(DMRSYNC_H)
|
||||
#define DMRSYNC_H
|
||||
#if !defined(SYNC_H)
|
||||
#define SYNC_H
|
||||
|
||||
class CDMRSync
|
||||
class CSync
|
||||
{
|
||||
public:
|
||||
CDMRSync();
|
||||
~CDMRSync();
|
||||
|
||||
void addDataSync(unsigned char* data) const;
|
||||
|
||||
void addAudioSync(unsigned char* data) const;
|
||||
static void addDMRDataSync(unsigned char* data);
|
||||
static void addDMRAudioSync(unsigned char* data);
|
||||
|
||||
private:
|
||||
};
|
Loading…
Reference in New Issue