Skip to content

Commit

Permalink
Renamed DMR protocol files.
Browse files Browse the repository at this point in the history
  • Loading branch information
g4klx committed Feb 15, 2016
1 parent 656be11 commit 5185a0c
Show file tree
Hide file tree
Showing 29 changed files with 498 additions and 528 deletions.
18 changes: 9 additions & 9 deletions CSBK.cpp → DMRCSBK.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/

#include "CSBK.h"
#include "DMRCSBK.h"
#include "BPTC19696.h"
#include "Utils.h"
#include "CRC.h"

#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),
Expand Down Expand Up @@ -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;
}
10 changes: 5 additions & 5 deletions CSBK.h → DMRCSBK.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions DMRControl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions DMRControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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);
Expand All @@ -42,12 +42,12 @@ class CDMRControl {
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
100 changes: 100 additions & 0 deletions DMREMB.cpp
Original file line number Diff line number Diff line change
@@ -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;
}
13 changes: 6 additions & 7 deletions EMB.h → DMREMB.h
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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;
Expand All @@ -44,4 +44,3 @@ class CEMB
};

#endif

20 changes: 10 additions & 10 deletions EmbeddedLC.cpp → DMREmbeddedLC.cpp
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"
Expand All @@ -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);

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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)
}
Loading

0 comments on commit 5185a0c

Please sign in to comment.