parent
daf09bd562
commit
d89c90118d
@ -0,0 +1,146 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBKFactory.h"
|
||||
#include "edac/BPTC19696.h"
|
||||
#include "edac/CRC.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBKFactory class.
|
||||
/// </summary>
|
||||
CSBKFactory::CSBKFactory()
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes a instance of CSBKFactory class.
|
||||
/// </summary>
|
||||
CSBKFactory::~CSBKFactory()
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of a CSBK.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
std::unique_ptr<CSBK> CSBKFactory::createCSBK(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
|
||||
// decode BPTC (196,96) FEC
|
||||
edac::BPTC19696 bptc;
|
||||
bptc.decode(data, csbk);
|
||||
|
||||
// validate the CRC-CCITT 16
|
||||
csbk[10U] ^= CSBK_CRC_MASK[0U];
|
||||
csbk[11U] ^= CSBK_CRC_MASK[1U];
|
||||
|
||||
bool valid = edac::CRC::checkCCITT162(csbk, DMR_CSBK_LENGTH_BYTES);
|
||||
if (!valid) {
|
||||
LogError(LOG_DMR, "CSBK::decode(), failed CRC CCITT-162 check");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// restore the checksum
|
||||
csbk[10U] ^= CSBK_CRC_MASK[0U];
|
||||
csbk[11U] ^= CSBK_CRC_MASK[1U];
|
||||
|
||||
uint8_t CSBKO = csbk[0U] & 0x3FU; // CSBKO
|
||||
uint8_t FID = csbk[1U]; // Feature ID
|
||||
|
||||
switch (CSBKO) {
|
||||
case CSBKO_BSDWNACT:
|
||||
return decode(new CSBK_BSDWNACT(), data);
|
||||
case CSBKO_UU_V_REQ:
|
||||
return decode(new CSBK_UU_V_REQ(), data);
|
||||
case CSBKO_UU_ANS_RSP:
|
||||
return decode(new CSBK_UU_ANS_RSP(), data);
|
||||
case CSBKO_PRECCSBK:
|
||||
return decode(new CSBK_PRECCSBK(), data);
|
||||
case CSBKO_RAND: // CSBKO_CALL_ALRT when FID == FID_DMRA
|
||||
switch (FID)
|
||||
{
|
||||
case FID_DMRA:
|
||||
return decode(new CSBK_CALL_ALRT(), data);
|
||||
case FID_ETSI:
|
||||
default:
|
||||
return decode(new CSBK_RAND(), data);
|
||||
}
|
||||
case CSBKO_EXT_FNCT:
|
||||
return decode(new CSBK_EXT_FNCT(), data);
|
||||
case CSBKO_NACK_RSP:
|
||||
return decode(new CSBK_NACK_RSP(), data);
|
||||
|
||||
/** Tier 3 */
|
||||
case CSBKO_ACK_RSP:
|
||||
return decode(new CSBK_ACK_RSP(), data);
|
||||
|
||||
default:
|
||||
LogError(LOG_DMR, "CSBKFactory::create(), unknown CSBK type, csbko = $%02X", CSBKO);
|
||||
break;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="csbk"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
std::unique_ptr<CSBK> CSBKFactory::decode(CSBK* csbk, const uint8_t* data)
|
||||
{
|
||||
assert(csbk != nullptr);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (!csbk->decode(data)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::unique_ptr<CSBK>(csbk);
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
/**
|
||||
* 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(__DMR_LC__CSBK_FACTORY_H__)
|
||||
#define __DMR_LC__CSBK_FACTORY_H__
|
||||
|
||||
#include "Defines.h"
|
||||
|
||||
#include "dmr/lc/CSBK.h"
|
||||
#include "dmr/lc/csbk/CSBK_ACK_RSP.h"
|
||||
#include "dmr/lc/csbk/CSBK_ALOHA.h"
|
||||
#include "dmr/lc/csbk/CSBK_BROADCAST.h"
|
||||
#include "dmr/lc/csbk/CSBK_BSDWNACT.h"
|
||||
#include "dmr/lc/csbk/CSBK_CALL_ALRT.h"
|
||||
#include "dmr/lc/csbk/CSBK_DVM_GIT_HASH.h"
|
||||
#include "dmr/lc/csbk/CSBK_EXT_FNCT.h"
|
||||
#include "dmr/lc/csbk/CSBK_NACK_RSP.h"
|
||||
#include "dmr/lc/csbk/CSBK_PD_GRANT.h"
|
||||
#include "dmr/lc/csbk/CSBK_PRECCSBK.h"
|
||||
#include "dmr/lc/csbk/CSBK_PV_GRANT.h"
|
||||
#include "dmr/lc/csbk/CSBK_RAND.h"
|
||||
#include "dmr/lc/csbk/CSBK_TD_GRANT.h"
|
||||
#include "dmr/lc/csbk/CSBK_TV_GRANT.h"
|
||||
#include "dmr/lc/csbk/CSBK_UU_ANS_RSP.h"
|
||||
#include "dmr/lc/csbk/CSBK_UU_V_REQ.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Helper class to instantiate an instance of a CSBK.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBKFactory {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBKFactory class.</summary>
|
||||
CSBKFactory();
|
||||
/// <summary>Finalizes a instance of the CSBKFactory class.</summary>
|
||||
~CSBKFactory();
|
||||
|
||||
/// <summary>Create an instance of a CSBK.</summary>
|
||||
static std::unique_ptr<CSBK> createCSBK(const uint8_t* data);
|
||||
|
||||
private:
|
||||
/// <summary></summary>
|
||||
static std::unique_ptr<CSBK> decode(CSBK* tsbk, const uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC__CSBK_FACTORY_H__
|
||||
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_ACK_RSP.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_ACK_RSP class.
|
||||
/// </summary>
|
||||
CSBK_ACK_RSP::CSBK_ACK_RSP() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_ACK_RSP;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_ACK_RSP::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_GI = (((csbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Group/Individual Flag
|
||||
m_reason = (uint8_t)((csbkValue >> 33) & 0xFFU); // Reason Code
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_ACK_RSP::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
if (m_reason == TS_ACK_RSN_REG) {
|
||||
csbkValue = 0U;
|
||||
} else {
|
||||
csbkValue = (m_GI ? 0x40U : 0x00U) + // Source Type
|
||||
(m_siteData.siteId() & 0x3FU); // Net + Site LSB
|
||||
}
|
||||
csbkValue = (csbkValue << 7) + (m_response & 0x7FU); // Response Information
|
||||
csbkValue = (csbkValue << 8) + (m_reason & 0xFFU); // Reason Code
|
||||
csbkValue = (csbkValue << 25) + m_dstId; // Target Radio Address
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_ACK_RSP_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_ACK_RSP_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements ACK RSP - Acknowledge Response
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_ACK_RSP : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_ACK_RSP class.</summary>
|
||||
CSBK_ACK_RSP();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_ACK_RSP_H__
|
||||
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_ALOHA.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_ALOHA class.
|
||||
/// </summary>
|
||||
CSBK_ALOHA::CSBK_ALOHA() : CSBK(),
|
||||
m_siteTSSync(false),
|
||||
m_alohaMask(0U),
|
||||
m_backoffNo(1U),
|
||||
m_nRandWait(DEFAULT_NRAND_WAIT)
|
||||
{
|
||||
m_CSBKO = CSBKO_ALOHA;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_ALOHA::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_ALOHA::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = (csbkValue << 2) + 0U; // Reserved
|
||||
csbkValue = (csbkValue << 1) + ((m_siteTSSync) ? 1U : 0U); // Site Time Slot Synchronization
|
||||
csbkValue = (csbkValue << 3) + DMR_ALOHA_VER_151; // DMR Spec. Version (1.5.1)
|
||||
csbkValue = (csbkValue << 1) + ((m_siteOffsetTiming) ? 1U : 0U); // Site Timing: Aligned or Offset
|
||||
csbkValue = (csbkValue << 1) + ((m_siteData.netActive()) ? 1U : 0U); // Site Networked
|
||||
csbkValue = (csbkValue << 5) + (m_alohaMask & 0x1FU); // MS Mask
|
||||
csbkValue = (csbkValue << 2) + 0U; // Service Function
|
||||
csbkValue = (csbkValue << 4) + (m_nRandWait & 0x0FU); // Random Access Wait
|
||||
csbkValue = (csbkValue << 1) + ((m_siteData.requireReg()) ? 1U : 0U); // Require Registration
|
||||
csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number
|
||||
csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_ALOHA::copy(const CSBK_ALOHA& data)
|
||||
{
|
||||
CSBK::copy(data);
|
||||
|
||||
m_siteTSSync = data.m_siteTSSync;
|
||||
m_alohaMask = data.m_alohaMask;
|
||||
|
||||
m_backoffNo = data.m_backoffNo;
|
||||
m_nRandWait = data.m_nRandWait;
|
||||
}
|
||||
@ -0,0 +1,70 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_ALOHA_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_ALOHA_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements ALOHA - Aloha PDUs for the random access protocol
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_ALOHA : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_ALOHA class.</summary>
|
||||
CSBK_ALOHA();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Aloha Site Time Slot Synchronization.</summary>
|
||||
__PROPERTY(bool, siteTSSync, SiteTSSync);
|
||||
/// <summary>Aloha MS mask.</summary>
|
||||
__PROPERTY(uint8_t, alohaMask, AlohaMask);
|
||||
|
||||
/// <summary>Backoff Number.</summary>
|
||||
__PROPERTY(uint8_t, backoffNo, BackoffNo);
|
||||
/// <summary>Random Access Wait Delay.</summary>
|
||||
__PROPERTY(uint8_t, nRandWait, NRandWait);
|
||||
|
||||
__COPY(CSBK_ALOHA);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_ALOHA_H__
|
||||
@ -0,0 +1,174 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_BROADCAST.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_BROADCAST class.
|
||||
/// </summary>
|
||||
CSBK_BROADCAST::CSBK_BROADCAST() : CSBK(),
|
||||
m_anncType(BCAST_ANNC_SITE_PARMS),
|
||||
m_hibernating(false),
|
||||
m_annWdCh1(false),
|
||||
m_annWdCh2(false),
|
||||
m_backoffNo(1U)
|
||||
{
|
||||
m_CSBKO = CSBKO_BROADCAST;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_BROADCAST::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_BROADCAST::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
if (!m_Cdef) {
|
||||
csbkValue = m_anncType; // Announcement Type
|
||||
}
|
||||
|
||||
switch (m_anncType)
|
||||
{
|
||||
case BCAST_ANNC_ANN_WD_TSCC:
|
||||
// Broadcast Parms 1
|
||||
csbkValue = (csbkValue << 4) + 0U; // Reserved
|
||||
csbkValue = (csbkValue << 4) + (m_colorCode & 0x0FU); // Color Code 1
|
||||
csbkValue = (csbkValue << 4) + (m_colorCode & 0x0FU); // Color Code 2
|
||||
csbkValue = (csbkValue << 1) + ((m_annWdCh1) ? 1U : 0U); // Announce/Withdraw Channel 1
|
||||
csbkValue = (csbkValue << 1) + ((m_annWdCh2) ? 1U : 0U); // Announce/Withdraw Channel 2
|
||||
|
||||
csbkValue = (csbkValue << 1) + ((m_siteData.requireReg()) ? 1U : 0U); // Require Registration
|
||||
csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number
|
||||
csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity
|
||||
|
||||
// Broadcast Parms 2
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Channel 1
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh2 & 0xFFFU); // Logical Channel 2
|
||||
break;
|
||||
case BCAST_ANNC_CHAN_FREQ:
|
||||
{
|
||||
uint32_t calcSpace = (uint32_t)(m_siteIdenEntry.chSpaceKhz() / 0.125);
|
||||
float calcTxOffset = m_siteIdenEntry.txOffsetMhz() * 1000000;
|
||||
const uint32_t multiple = 100000;
|
||||
|
||||
// calculate Rx frequency
|
||||
uint32_t rxFrequency = (uint32_t)((m_siteIdenEntry.baseFrequency() + ((calcSpace * 125) * m_logicalCh1)) + calcTxOffset);
|
||||
|
||||
// generate frequency in mhz
|
||||
uint32_t rxFreqMhz = rxFrequency + multiple / 2;
|
||||
rxFreqMhz -= rxFreqMhz % multiple;
|
||||
rxFreqMhz /= multiple * 10;
|
||||
|
||||
// generate khz offset
|
||||
uint32_t rxFreqKhz = rxFrequency - (rxFreqMhz * 1000000);
|
||||
|
||||
// calculate Tx Frequency
|
||||
uint32_t txFrequency = (uint32_t)((m_siteIdenEntry.baseFrequency() + ((calcSpace * 125) * m_logicalCh1)));
|
||||
|
||||
// generate frequency in mhz
|
||||
uint32_t txFreqMhz = txFrequency + multiple / 2;
|
||||
txFreqMhz -= txFreqMhz % multiple;
|
||||
txFreqMhz /= multiple * 10;
|
||||
|
||||
// generate khz offset
|
||||
uint32_t txFreqKhz = txFrequency - (txFreqMhz * 1000000);
|
||||
|
||||
csbkValue = 0U; // Cdef Type (always 0 for ANN_WD_TSCC)
|
||||
csbkValue = (csbkValue << 2) + 0U; // Reserved
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Channel
|
||||
csbkValue = (csbkValue << 10) + (txFreqMhz & 0x7FFU); // Transmit Freq Mhz
|
||||
csbkValue = (csbkValue << 13) + (txFreqKhz & 0x3FFFU); // Transmit Freq Offset Khz
|
||||
csbkValue = (csbkValue << 10) + (rxFreqMhz & 0x7FFU); // Receive Freq Mhz
|
||||
csbkValue = (csbkValue << 13) + (rxFreqKhz & 0x3FFFU); // Receive Freq Khz
|
||||
}
|
||||
break;
|
||||
case BCAST_ANNC_SITE_PARMS:
|
||||
// Broadcast Parms 1
|
||||
csbkValue = (csbkValue << 14) + m_siteData.systemIdentity(true); // Site Identity (Broadcast Parms 1)
|
||||
|
||||
csbkValue = (csbkValue << 1) + ((m_siteData.requireReg()) ? 1U : 0U); // Require Registration
|
||||
csbkValue = (csbkValue << 4) + (m_backoffNo & 0x0FU); // Backoff Number
|
||||
csbkValue = (csbkValue << 16) + m_siteData.systemIdentity(); // Site Identity
|
||||
|
||||
// Broadcast Parms 2
|
||||
csbkValue = (csbkValue << 1) + 0U; // Roaming TG Subscription/Attach
|
||||
csbkValue = (csbkValue << 1) + ((m_hibernating) ? 1U : 0U); // TSCC Hibernating
|
||||
csbkValue = (csbkValue << 22) + 0U; // Broadcast Parms 2 (Reserved)
|
||||
break;
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_BROADCAST::copy(const CSBK_BROADCAST& data)
|
||||
{
|
||||
CSBK::copy(data);
|
||||
|
||||
m_anncType = data.m_anncType;
|
||||
m_hibernating = data.m_hibernating;
|
||||
|
||||
m_annWdCh1 = data.m_annWdCh1;
|
||||
m_annWdCh2 = data.m_annWdCh2;
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_BROADCAST_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_BROADCAST_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements BCAST - Announcement PDUs
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_BROADCAST : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_BROADCAST class.</summary>
|
||||
CSBK_BROADCAST();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Broadcast Announcment Type.</summary>
|
||||
__PROPERTY(uint8_t, anncType, AnncType);
|
||||
/// <summary>Broadcast Hibernation Flag.</summary>
|
||||
__PROPERTY(bool, hibernating, Hibernating);
|
||||
|
||||
/// <summary>Broadcast Announce/Withdraw Channel 1 Flag.</summary>
|
||||
__PROPERTY(bool, annWdCh1, AnnWdCh1);
|
||||
/// <summary>Broadcast Announce/Withdraw Channel 2 Flag.</summary>
|
||||
__PROPERTY(bool, annWdCh2, AnnWdCh2);
|
||||
|
||||
/// <summary>Backoff Number.</summary>
|
||||
__PROPERTY(uint8_t, backoffNo, BackoffNo);
|
||||
|
||||
__COPY(CSBK_BROADCAST);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_BROADCAST_H__
|
||||
@ -0,0 +1,99 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_BSDWNACT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_BSDWNACT class.
|
||||
/// </summary>
|
||||
CSBK_BSDWNACT::CSBK_BSDWNACT() : CSBK(),
|
||||
m_bsId(0U)
|
||||
{
|
||||
m_CSBKO = CSBKO_BSDWNACT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_BSDWNACT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_bsId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Base Station Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_BSDWNACT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_BSDWNACT::copy(const CSBK_BSDWNACT& data)
|
||||
{
|
||||
CSBK::copy(data);
|
||||
|
||||
m_bsId = data.m_bsId;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_BSDWNACT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_BSDWNACT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements BS DWN ACT - BS Outbound Activation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_BSDWNACT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_BSDWNACT class.</summary>
|
||||
CSBK_BSDWNACT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Base Station ID.</summary>
|
||||
__READONLY_PROPERTY(uint32_t, bsId, BSId);
|
||||
|
||||
__COPY(CSBK_BSDWNACT);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_BSDWNACT_H__
|
||||
@ -0,0 +1,92 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_CALL_ALRT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_CALL_ALRT class.
|
||||
/// </summary>
|
||||
CSBK_CALL_ALRT::CSBK_CALL_ALRT() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_RAND;
|
||||
m_FID = FID_DMRA;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_CALL_ALRT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_GI = (((csbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Group/Individual Flag
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_CALL_ALRT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = (m_GI) ? 0x40U : 0x00U; // Group/Individual Flag
|
||||
csbkValue = (csbkValue << 32) + m_dstId; // Target Radio Address
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_CALL_ALRT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_CALL_ALRT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements CALL ALRT - Call Alert
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_CALL_ALRT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_CALL_ALRT class.</summary>
|
||||
CSBK_CALL_ALRT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_CALL_ALRT_H__
|
||||
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_DVM_GIT_HASH.h"
|
||||
#include "HostMain.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_DVM_GIT_HASH class.
|
||||
/// </summary>
|
||||
CSBK_DVM_GIT_HASH::CSBK_DVM_GIT_HASH() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_DVM_GIT_HASH;
|
||||
m_FID = FID_DVM;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_DVM_GIT_HASH::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_DVM_GIT_HASH::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = g_gitHashBytes[0]; // ...
|
||||
csbkValue = (csbkValue << 8) + (g_gitHashBytes[1U]); // ...
|
||||
csbkValue = (csbkValue << 8) + (g_gitHashBytes[2U]); // ...
|
||||
csbkValue = (csbkValue << 8) + (g_gitHashBytes[3U]); // ...
|
||||
csbkValue = (csbkValue << 16) + 0U;
|
||||
csbkValue = (csbkValue << 4) + m_siteIdenEntry.channelId(); // Channel ID
|
||||
csbkValue = (csbkValue << 12) + m_logicalCh1; // Channel Number
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_DVM_GIT_HASH_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_DVM_GIT_HASH_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements DVM GIT Hash Identification
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_DVM_GIT_HASH : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_DVM_GIT_HASH class.</summary>
|
||||
CSBK_DVM_GIT_HASH();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_DVM_GIT_HASH_H__
|
||||
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_EXT_FNCT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_EXT_FNCT class.
|
||||
/// </summary>
|
||||
CSBK_EXT_FNCT::CSBK_EXT_FNCT() : CSBK(),
|
||||
m_extendedFunction(DMR_EXT_FNCT_CHECK)
|
||||
{
|
||||
m_CSBKO = CSBKO_EXT_FNCT;
|
||||
m_FID = FID_DMRA;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_EXT_FNCT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_dataContent = (((csbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; //
|
||||
m_extendedFunction = (uint8_t)((csbkValue >> 48) & 0xFFU); // Function
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_EXT_FNCT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue =
|
||||
(m_GI ? 0x40U : 0x00U) + // Group or Invididual
|
||||
(m_dataContent ? 0x80U : 0x00U);
|
||||
csbkValue = (csbkValue << 8) + m_extendedFunction; // Function
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Target Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_EXT_FNCT::copy(const CSBK_EXT_FNCT& data)
|
||||
{
|
||||
CSBK::copy(data);
|
||||
|
||||
m_extendedFunction = data.m_extendedFunction;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_EXT_FNCT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_EXT_FNCT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements EXT FNCT - Extended Function
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_EXT_FNCT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_EXT_FNCT class.</summary>
|
||||
CSBK_EXT_FNCT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Extended function opcode.</summary>
|
||||
__PROPERTY(uint8_t, extendedFunction, ExtendedFunction);
|
||||
|
||||
__COPY(CSBK_EXT_FNCT);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_EXT_FNCT_H__
|
||||
@ -0,0 +1,112 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_NACK_RSP.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_NACK_RSP class.
|
||||
/// </summary>
|
||||
CSBK_NACK_RSP::CSBK_NACK_RSP() : CSBK(),
|
||||
m_serviceKind(0U)
|
||||
{
|
||||
m_CSBKO = CSBKO_NACK_RSP;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_NACK_RSP::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_GI = (((csbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Group/Individual Flag
|
||||
m_serviceKind = (((csbkValue >> 56) & 0xFFU) & 0x3FU); // Service Kind
|
||||
m_reason = (uint8_t)((csbkValue >> 48) & 0xFFU); // Reason Code
|
||||
m_srcId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Source Radio Address
|
||||
m_dstId = (uint32_t)(csbkValue & 0xFFFFFFU); // Target Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_NACK_RSP::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = 0x80U + // Additional Information Field (always 1)
|
||||
(m_GI ? 0x40U : 0x00U) + // Source Type
|
||||
(m_serviceKind & 0x3FU); // Service Kind
|
||||
csbkValue = (csbkValue << 8) + m_reason; // Reason Code
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Target Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_NACK_RSP::copy(const CSBK_NACK_RSP& data)
|
||||
{
|
||||
CSBK::copy(data);
|
||||
|
||||
m_serviceKind = data.m_serviceKind;
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_NACK_RSP_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_NACK_RSP_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements NACK RSP - Negative Acknowledgement Response
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_NACK_RSP : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_NACK_RSP class.</summary>
|
||||
CSBK_NACK_RSP();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Service Kind.</summary>
|
||||
__PROPERTY(uint8_t, serviceKind, ServiceKind);
|
||||
|
||||
__COPY(CSBK_NACK_RSP);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_NACK_RSP_H__
|
||||
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_PD_GRANT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_PD_GRANT class.
|
||||
/// </summary>
|
||||
CSBK_PD_GRANT::CSBK_PD_GRANT() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_PD_GRANT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_PD_GRANT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_PD_GRANT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Physical Channel 1
|
||||
csbkValue = (csbkValue << 1) + (m_slotNo & 0x3U); // Logical Slot Number
|
||||
csbkValue = (csbkValue << 1) + 0U; // High Rate Flag - Always Single Slot Data
|
||||
csbkValue = (csbkValue << 1) + ((m_emergency) ? 1U : 0U); // Emergency
|
||||
csbkValue = (csbkValue << 1) + ((m_siteOffsetTiming) ? 1U : 0U); // Site Timing: Aligned or Offset
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Talkgroup ID
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_PD_GRANT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_PD_GRANT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements PD_GRANT - Private Data Channel Grant
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_PD_GRANT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_PD_GRANT class.</summary>
|
||||
CSBK_PD_GRANT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_PD_GRANT_H__
|
||||
@ -0,0 +1,86 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_PRECCSBK.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_PRECCSBK class.
|
||||
/// </summary>
|
||||
CSBK_PRECCSBK::CSBK_PRECCSBK() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_PRECCSBK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_PRECCSBK::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_GI = (((csbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Group/Individual Flag
|
||||
m_dataContent = (((csbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; //
|
||||
m_CBF = (uint8_t)((csbkValue >> 48) & 0xFFU); // Blocks to Follow
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_PRECCSBK::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_PRECCSBK_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_PRECCSBK_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements PRE CSBK - Preamble CSBK
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_PRECCSBK : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_PRECCSBK class.</summary>
|
||||
CSBK_PRECCSBK();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_PRECCSBK_H__
|
||||
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_PV_GRANT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_PV_GRANT class.
|
||||
/// </summary>
|
||||
CSBK_PV_GRANT::CSBK_PV_GRANT() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_PV_GRANT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_PV_GRANT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_PV_GRANT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Physical Channel 1
|
||||
csbkValue = (csbkValue << 1) + (m_slotNo & 0x3U); // Logical Slot Number
|
||||
csbkValue = (csbkValue << 1) + 0U; // Reserved
|
||||
csbkValue = (csbkValue << 1) + ((m_emergency) ? 1U : 0U); // Emergency
|
||||
csbkValue = (csbkValue << 1) + ((m_siteOffsetTiming) ? 1U : 0U); // Site Timing: Aligned or Offset
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Talkgroup ID
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_PV_GRANT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_PV_GRANT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements PV_GRANT - Private Voice Channel Grant
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_PV_GRANT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_PV_GRANT class.</summary>
|
||||
CSBK_PV_GRANT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_PV_GRANT_H__
|
||||
@ -0,0 +1,117 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_RAND.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_RAND class.
|
||||
/// </summary>
|
||||
CSBK_RAND::CSBK_RAND() : CSBK(),
|
||||
m_serviceOptions(0U),
|
||||
m_serviceExtra(0U),
|
||||
m_serviceKind(0U)
|
||||
{
|
||||
m_CSBKO = CSBKO_RAND;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_RAND::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_serviceOptions = (uint8_t)((csbkValue >> 57U) & 0x7FU); // Service Options
|
||||
m_proxy = (((csbkValue >> 56U) & 0xFF) & 0x01U) == 0x01U; // Proxy Flag
|
||||
m_serviceExtra = (uint8_t)((csbkValue >> 52U) & 0x0FU); // Service Extras (content dependant on service)
|
||||
m_serviceKind = (uint8_t)((csbkValue >> 48U) & 0x0FU); // Service Kind
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_RAND::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = m_serviceOptions & 0x7FU; // Service Options
|
||||
csbkValue = (csbkValue << 1) + (m_proxy ? 0x01U : 0x00); // Proxy Flag
|
||||
csbkValue = (csbkValue << 4) + (m_serviceExtra & 0x0FU); // Service Extras
|
||||
csbkValue = (csbkValue << 4) + (m_serviceKind & 0x0FU); // Service Kind
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Target Radio Address
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_RAND::copy(const CSBK_RAND& data)
|
||||
{
|
||||
CSBK::copy(data);
|
||||
|
||||
m_serviceOptions = data.m_serviceOptions;
|
||||
m_serviceExtra = data.m_serviceExtra;
|
||||
m_serviceKind = data.m_serviceKind;
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_RAND_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_RAND_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements RAND - Random Access
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_RAND : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_RAND class.</summary>
|
||||
CSBK_RAND();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Service Options.</summary>
|
||||
__PROPERTY(uint8_t, serviceOptions, ServiceOptions);
|
||||
/// <summary>Service Extra Options.</summary>
|
||||
__PROPERTY(uint8_t, serviceExtra, ServiceExtra);
|
||||
/// <summary>Service Kind.</summary>
|
||||
__PROPERTY(uint8_t, serviceKind, ServiceKind);
|
||||
|
||||
__COPY(CSBK_RAND);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_RAND_H__
|
||||
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_TD_GRANT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_TD_GRANT class.
|
||||
/// </summary>
|
||||
CSBK_TD_GRANT::CSBK_TD_GRANT() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_TD_GRANT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_TD_GRANT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_TD_GRANT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Physical Channel 1
|
||||
csbkValue = (csbkValue << 1) + (m_slotNo & 0x3U); // Logical Slot Number
|
||||
csbkValue = (csbkValue << 1) + 0U; // High Rate Flag - Always Single Slot Data
|
||||
csbkValue = (csbkValue << 1) + ((m_emergency) ? 1U : 0U); // Emergency
|
||||
csbkValue = (csbkValue << 1) + ((m_siteOffsetTiming) ? 1U : 0U); // Site Timing: Aligned or Offset
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Talkgroup ID
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_TD_GRANT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_TD_GRANT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements TD_GRANT - Talkgroup Data Channel Grant
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_TD_GRANT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_TD_GRANT class.</summary>
|
||||
CSBK_TD_GRANT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_TD_GRANT_H__
|
||||
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_TV_GRANT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_TV_GRANT class.
|
||||
/// </summary>
|
||||
CSBK_TV_GRANT::CSBK_TV_GRANT() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_TV_GRANT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_TV_GRANT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_TV_GRANT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t csbkValue = 0U;
|
||||
|
||||
csbkValue = (csbkValue << 12) + (m_logicalCh1 & 0xFFFU); // Logical Physical Channel 1
|
||||
csbkValue = (csbkValue << 1) + (m_slotNo & 0x3U); // Logical Slot Number
|
||||
csbkValue = (csbkValue << 1) + 0U; // Late Entry
|
||||
csbkValue = (csbkValue << 1) + ((m_emergency) ? 1U : 0U); // Emergency
|
||||
csbkValue = (csbkValue << 1) + ((m_siteOffsetTiming) ? 1U : 0U); // Site Timing: Aligned or Offset
|
||||
csbkValue = (csbkValue << 24) + m_dstId; // Talkgroup ID
|
||||
csbkValue = (csbkValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> csbk = CSBK::fromValue(csbkValue);
|
||||
CSBK::encode(data, csbk.get());
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_TV_GRANT_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_TV_GRANT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements TV_GRANT - Talkgroup Voice Channel Grant
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_TV_GRANT : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_TV_GRANT class.</summary>
|
||||
CSBK_TV_GRANT();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_TV_GRANT_H__
|
||||
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_UU_ANS_RSP.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_UU_ANS_RSP class.
|
||||
/// </summary>
|
||||
CSBK_UU_ANS_RSP::CSBK_UU_ANS_RSP() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_UU_ANS_RSP;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_UU_ANS_RSP::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_UU_ANS_RSP::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_UU_ANS_RSP_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_UU_ANS_RSP_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements UU ANS RSP - Unit to Unit Answer Response
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_UU_ANS_RSP : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_UU_ANS_RSP class.</summary>
|
||||
CSBK_UU_ANS_RSP();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_UU_ANS_RSP_H__
|
||||
@ -0,0 +1,83 @@
|
||||
/**
|
||||
* 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 "dmr/lc/csbk/CSBK_UU_V_REQ.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace dmr::lc::csbk;
|
||||
using namespace dmr::lc;
|
||||
using namespace dmr;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the CSBK_UU_V_REQ class.
|
||||
/// </summary>
|
||||
CSBK_UU_V_REQ::CSBK_UU_V_REQ() : CSBK()
|
||||
{
|
||||
m_CSBKO = CSBKO_UU_V_REQ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if CSBK was decoded, otherwise false.</returns>
|
||||
bool CSBK_UU_V_REQ::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t csbk[DMR_CSBK_LENGTH_BYTES];
|
||||
::memset(csbk, 0x00U, DMR_CSBK_LENGTH_BYTES);
|
||||
|
||||
bool ret = CSBK::decode(data, csbk);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t csbkValue = CSBK::toValue(csbk);
|
||||
|
||||
m_dstId = (uint32_t)((csbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(csbkValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a control signalling block.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void CSBK_UU_V_REQ::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
}
|
||||
@ -0,0 +1,57 @@
|
||||
/**
|
||||
* 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(__DMR_LC_CSBK__CSBK_UU_V_REQ_H__)
|
||||
#define __DMR_LC_CSBK__CSBK_UU_V_REQ_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "dmr/lc/CSBK.h"
|
||||
|
||||
namespace dmr
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace csbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements UU VCH REQ - Unit-to-Unit Voice Channel Request
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API CSBK_UU_V_REQ : public CSBK {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the CSBK_UU_V_REQ class.</summary>
|
||||
CSBK_UU_V_REQ();
|
||||
|
||||
/// <summary>Decode a control signalling block.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a control signalling block.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace csbk
|
||||
} // namespace lc
|
||||
} // namespace dmr
|
||||
|
||||
#endif // __DMR_LC_CSBK__CSBK_UU_V_REQ_H__
|
||||
Loading…
Reference in new issue