parent
de4b6ea30d
commit
471a00fa04
@ -0,0 +1,123 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tdulc/LC_ADJ_STS_BCAST.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_ADJ_STS_BCAST class.
|
||||
/// </summary>
|
||||
LC_ADJ_STS_BCAST::LC_ADJ_STS_BCAST() : TDULC(),
|
||||
m_adjCFVA(P25_CFVA_FAILURE),
|
||||
m_adjRfssId(0U),
|
||||
m_adjSiteId(0U),
|
||||
m_adjChannelId(0U),
|
||||
m_adjChannelNo(0U),
|
||||
m_adjServiceClass(P25_SVC_CLS_INVALID)
|
||||
{
|
||||
m_lco = p25::LC_ADJ_STS_BCAST;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_ADJ_STS_BCAST::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_ADJ_STS_BCAST::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
if ((m_adjRfssId != 0U) && (m_adjSiteId != 0U) && (m_adjChannelNo != 0U)) {
|
||||
if (m_adjSysId == 0U) {
|
||||
m_adjSysId = m_siteData.sysId();
|
||||
}
|
||||
|
||||
rsValue = m_siteData.lra(); // Location Registration Area
|
||||
rsValue = (rsValue << 12) + m_adjSysId; // System ID
|
||||
rsValue = (rsValue << 8) + m_adjRfssId; // RF Sub-System ID
|
||||
rsValue = (rsValue << 8) + m_adjSiteId; // Site ID
|
||||
rsValue = (rsValue << 4) + m_adjChannelId; // Channel ID
|
||||
rsValue = (rsValue << 12) + m_adjChannelNo; // Channel Number
|
||||
rsValue = (rsValue << 8) + m_adjServiceClass; // System Service Class
|
||||
}
|
||||
else {
|
||||
LogError(LOG_P25, "TDULC::encodeLC(), invalid values for LC_ADJ_STS_BCAST, tsbkAdjSiteRFSSId = $%02X, tsbkAdjSiteId = $%02X, tsbkAdjSiteChannel = $%02X",
|
||||
m_adjRfssId, m_adjSiteId, m_adjChannelNo);
|
||||
return; // blatently ignore creating this TSBK
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.get());
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Internal helper to copy the the class.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_ADJ_STS_BCAST::copy(const LC_ADJ_STS_BCAST& data)
|
||||
{
|
||||
TDULC::copy(data);
|
||||
|
||||
m_adjCFVA = data.m_adjCFVA;
|
||||
m_adjRfssId = data.m_adjRfssId;
|
||||
m_adjSiteId = data.m_adjSiteId;
|
||||
m_adjChannelId = data.m_adjChannelId;
|
||||
m_adjChannelNo = data.m_adjChannelNo;
|
||||
m_adjServiceClass = data.m_adjServiceClass;
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__P25_LC_TSBK__LC_ADJ_STS_BCAST_H__)
|
||||
#define __P25_LC_TSBK__LC_ADJ_STS_BCAST_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements ADJ STS BCAST - Adjacent Site Status Broadcast
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_ADJ_STS_BCAST : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_ADJ_STS_BCAST class.</summary>
|
||||
LC_ADJ_STS_BCAST();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
|
||||
public:
|
||||
/// <summary>Adjacent site CFVA flags.</summary>
|
||||
__PROPERTY(uint8_t, adjCFVA, AdjSiteCFVA);
|
||||
/// <summary>Adjacent site system ID.</summary>
|
||||
__PROPERTY(uint32_t, adjSysId, AdjSiteSysId);
|
||||
/// <summary>Adjacent site RFSS ID.</summary>
|
||||
__PROPERTY(uint8_t, adjRfssId, AdjSiteRFSSId);
|
||||
/// <summary>Adjacent site ID.</summary>
|
||||
__PROPERTY(uint8_t, adjSiteId, AdjSiteId);
|
||||
/// <summary>Adjacent site channel ID.</summary>
|
||||
__PROPERTY(uint8_t, adjChannelId, AdjSiteChnId);
|
||||
/// <summary>Adjacent site channel number.</summary>
|
||||
__PROPERTY(uint32_t, adjChannelNo, AdjSiteChnNo);
|
||||
/// <summary>Adjacent site service class.</summary>
|
||||
__PROPERTY(uint8_t, adjServiceClass, AdjSiteSvcClass);
|
||||
|
||||
__COPY(LC_ADJ_STS_BCAST);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_ADJ_STS_BCAST_H__
|
||||
@ -0,0 +1,81 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tdulc/LC_CALL_TERM.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_CALL_TERM class.
|
||||
/// </summary>
|
||||
LC_CALL_TERM::LC_CALL_TERM() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_CALL_TERM;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_CALL_TERM::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_CALL_TERM::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
rsValue = 0U;
|
||||
rsValue = (rsValue << 24) + P25_WUID_FNE; // System Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_CALL_TERM_H__)
|
||||
#define __P25_LC_TSBK__LC_CALL_TERM_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements CALL TERM - Call Termination or Cancellation
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_CALL_TERM : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_CALL_TERM class.</summary>
|
||||
LC_CALL_TERM();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_CALL_TERM_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 "p25/lc/tdulc/LC_CONV_FALLBACK.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_CONV_FALLBACK class.
|
||||
/// </summary>
|
||||
LC_CONV_FALLBACK::LC_CONV_FALLBACK() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_CONV_FALLBACK;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_CONV_FALLBACK::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_CONV_FALLBACK::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
rsValue = (rsValue << 48) + m_siteData.channelId(); // Channel ID 6
|
||||
rsValue = (rsValue << 40) + m_siteData.channelId(); // Channel ID 5
|
||||
rsValue = (rsValue << 32) + m_siteData.channelId(); // Channel ID 4
|
||||
rsValue = (rsValue << 24) + m_siteData.channelId(); // Channel ID 3
|
||||
rsValue = (rsValue << 16) + m_siteData.channelId(); // Channel ID 2
|
||||
rsValue = (rsValue << 8) + m_siteData.channelId(); // Channel ID 1
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_CONV_FALLBACK_H__)
|
||||
#define __P25_LC_TSBK__LC_CONV_FALLBACK_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements CONV FALLBACK - Conventional Fallback
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_CONV_FALLBACK : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_CONV_FALLBACK class.</summary>
|
||||
LC_CONV_FALLBACK();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_CONV_FALLBACK_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 "p25/lc/tdulc/LC_GROUP.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_GROUP class.
|
||||
/// </summary>
|
||||
LC_GROUP::LC_GROUP() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_GROUP;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_GROUP::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rs[P25_TDULC_LENGTH_BYTES + 1U];
|
||||
::memset(rs, 0x00U, P25_TDULC_LENGTH_BYTES);
|
||||
|
||||
bool ret = TDULC::decode(data, rs);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t rsValue = TDULC::toValue(rs);
|
||||
|
||||
m_mfId = rs[1U]; // Mfg Id.
|
||||
m_group = true;
|
||||
m_emergency = (rs[2U] & 0x80U) == 0x80U; // Emergency Flag
|
||||
m_encrypted = (rs[2U] & 0x40U) == 0x40U; // Encryption Flag
|
||||
m_priority = (rs[2U] & 0x07U); // Priority
|
||||
m_dstId = (uint32_t)((rsValue >> 24) & 0xFFFFU); // Talkgroup Address
|
||||
m_srcId = (uint32_t)(rsValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_GROUP::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
rsValue = m_mfId;
|
||||
rsValue = (rsValue << 8) +
|
||||
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
|
||||
(m_priority & 0x07U); // Priority
|
||||
rsValue = (rsValue << 24) + m_dstId; // Talkgroup Address
|
||||
rsValue = (rsValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_GROUP_H__)
|
||||
#define __P25_LC_TSBK__LC_GROUP_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements GRP VCH USER - Group Voice Channel User
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_GROUP : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_GROUP class.</summary>
|
||||
LC_GROUP();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_GROUP_H__
|
||||
@ -0,0 +1,85 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tdulc/LC_GROUP_UPDT.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_GROUP_UPDT class.
|
||||
/// </summary>
|
||||
LC_GROUP_UPDT::LC_GROUP_UPDT() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_GROUP_UPDT;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_GROUP_UPDT::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_GROUP_UPDT::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
rsValue = m_siteData.channelId(); // Group A - Channel ID
|
||||
rsValue = (rsValue << 12) + m_grpVchNo; // Group A - Channel Number
|
||||
rsValue = (rsValue << 16) + m_dstId; // Group A - Talkgroup Address
|
||||
rsValue = (rsValue << 4) + m_siteData.channelId(); // Group B - Channel ID
|
||||
rsValue = (rsValue << 12) + m_grpVchNo; // Group B - Channel Number
|
||||
rsValue = (rsValue << 16) + m_dstId; // Group B - Talkgroup Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_GROUP_UPDT_H__)
|
||||
#define __P25_LC_TSBK__LC_GROUP_UPDT_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements GRP VCH UPDT - Group Voice Channel Update
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_GROUP_UPDT : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_GROUP_UPDT class.</summary>
|
||||
LC_GROUP_UPDT();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_GROUP_UPDT_H__
|
||||
@ -0,0 +1,121 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tdulc/LC_IDEN_UP.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_IDEN_UP class.
|
||||
/// </summary>
|
||||
LC_IDEN_UP::LC_IDEN_UP() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_IDEN_UP;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_IDEN_UP::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_IDEN_UP::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
if ((m_siteIdenEntry.chBandwidthKhz() != 0.0F) && (m_siteIdenEntry.chSpaceKhz() != 0.0F) &&
|
||||
(m_siteIdenEntry.txOffsetMhz() != 0U) && (m_siteIdenEntry.baseFrequency() != 0U)) {
|
||||
if (m_siteIdenEntry.baseFrequency() < 762000000U) {
|
||||
uint32_t calcSpace = (uint32_t)(m_siteIdenEntry.chSpaceKhz() / 0.125);
|
||||
|
||||
float fCalcTxOffset = (fabs(m_siteIdenEntry.txOffsetMhz()) / m_siteIdenEntry.chSpaceKhz()) * 1000.0F;
|
||||
uint32_t uCalcTxOffset = (uint32_t)fCalcTxOffset;
|
||||
if (m_siteIdenEntry.txOffsetMhz() > 0.0F)
|
||||
uCalcTxOffset |= 0x2000U; // this sets a positive offset ...
|
||||
|
||||
uint32_t calcBaseFreq = (uint32_t)(m_siteIdenEntry.baseFrequency() / 5);
|
||||
uint8_t chanBw = (m_siteIdenEntry.chBandwidthKhz() >= 12.5F) ? P25_IDEN_UP_VU_BW_125K : P25_IDEN_UP_VU_BW_625K;
|
||||
|
||||
rsValue = m_siteIdenEntry.channelId(); // Channel ID
|
||||
rsValue = (rsValue << 4) + chanBw; // Channel Bandwidth
|
||||
rsValue = (rsValue << 14) + uCalcTxOffset; // Transmit Offset
|
||||
rsValue = (rsValue << 10) + calcSpace; // Channel Spacing
|
||||
rsValue = (rsValue << 32) + calcBaseFreq; // Base Frequency
|
||||
} else {
|
||||
uint32_t calcSpace = (uint32_t)(m_siteIdenEntry.chSpaceKhz() / 0.125);
|
||||
|
||||
float fCalcTxOffset = (fabs(m_siteIdenEntry.txOffsetMhz()) * 1000000.0F) / 250000.0F;
|
||||
uint32_t uCalcTxOffset = (uint32_t)fCalcTxOffset;
|
||||
if (m_siteIdenEntry.txOffsetMhz() > 0.0F)
|
||||
uCalcTxOffset |= 0x2000U; // this sets a positive offset ...
|
||||
|
||||
uint32_t calcBaseFreq = (uint32_t)(m_siteIdenEntry.baseFrequency() / 5);
|
||||
uint16_t chanBw = (uint16_t)((m_siteIdenEntry.chBandwidthKhz() * 1000) / 125);
|
||||
|
||||
rsValue = m_siteIdenEntry.channelId(); // Channel ID
|
||||
rsValue = (rsValue << 4) + chanBw; // Channel Bandwidth
|
||||
rsValue = (rsValue << 14) + uCalcTxOffset; // Transmit Offset
|
||||
rsValue = (rsValue << 10) + calcSpace; // Channel Spacing
|
||||
rsValue = (rsValue << 32) + calcBaseFreq; // Base Frequency
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogError(LOG_P25, "TDULC::encodeLC(), invalid values for LC_IDEN_UP, baseFrequency = %uHz, txOffsetMhz = %fMHz, chBandwidthKhz = %fKHz, chSpaceKhz = %fKHz",
|
||||
m_siteIdenEntry.baseFrequency(), m_siteIdenEntry.txOffsetMhz(), m_siteIdenEntry.chBandwidthKhz(),
|
||||
m_siteIdenEntry.chSpaceKhz());
|
||||
return; // blatently ignore creating this TSBK
|
||||
}
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_IDEN_UP_H__)
|
||||
#define __P25_LC_TSBK__LC_IDEN_UP_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements IDEN UP - Channel Identifier Update
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_IDEN_UP : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_IDEN_UP class.</summary>
|
||||
LC_IDEN_UP();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_IDEN_UP_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 "p25/lc/tdulc/LC_NET_STS_BCAST.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_NET_STS_BCAST class.
|
||||
/// </summary>
|
||||
LC_NET_STS_BCAST::LC_NET_STS_BCAST() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_NET_STS_BCAST;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_NET_STS_BCAST::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_NET_STS_BCAST::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
rsValue = (rsValue << 20) + m_siteData.netId(); // Network ID
|
||||
rsValue = (rsValue << 12) + m_siteData.sysId(); // System ID
|
||||
rsValue = (rsValue << 4) + m_siteData.channelId(); // Channel ID
|
||||
rsValue = (rsValue << 12) + m_siteData.channelNo(); // Channel Number
|
||||
rsValue = (rsValue << 8) + m_siteData.serviceClass(); // System Service Class
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_NET_STS_BCAST_H__)
|
||||
#define __P25_LC_TSBK__LC_NET_STS_BCAST_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements NET STS BCAST - Network Status Broadcast
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_NET_STS_BCAST : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_NET_STS_BCAST class.</summary>
|
||||
LC_NET_STS_BCAST();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_NET_STS_BCAST_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 "p25/lc/tdulc/LC_PRIVATE.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_PRIVATE class.
|
||||
/// </summary>
|
||||
LC_PRIVATE::LC_PRIVATE() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_PRIVATE;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_PRIVATE::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rs[P25_TDULC_LENGTH_BYTES + 1U];
|
||||
::memset(rs, 0x00U, P25_TDULC_LENGTH_BYTES);
|
||||
|
||||
bool ret = TDULC::decode(data, rs);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t rsValue = TDULC::toValue(rs);
|
||||
|
||||
m_mfId = rs[1U]; // Mfg Id.
|
||||
m_group = false;
|
||||
m_emergency = (rs[2U] & 0x80U) == 0x80U; // Emergency Flag
|
||||
m_encrypted = (rs[2U] & 0x40U) == 0x40U; // Encryption Flag
|
||||
m_priority = (rs[2U] & 0x07U); // Priority
|
||||
m_dstId = (uint32_t)((rsValue >> 24) & 0xFFFFFFU); // Target Radio Address
|
||||
m_srcId = (uint32_t)(rsValue & 0xFFFFFFU); // Source Radio Address
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_PRIVATE::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
rsValue = m_mfId;
|
||||
rsValue = (rsValue << 8) +
|
||||
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
|
||||
(m_priority & 0x07U); // Priority
|
||||
rsValue = (rsValue << 24) + m_dstId; // Target Radio Address
|
||||
rsValue = (rsValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_PRIVATE_H__)
|
||||
#define __P25_LC_TSBK__LC_PRIVATE_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements UU VCH USER - Unit-to-Unit Voice Channel User
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_PRIVATE : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_PRIVATE class.</summary>
|
||||
LC_PRIVATE();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_PRIVATE_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 "p25/lc/tdulc/LC_RFSS_STS_BCAST.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_RFSS_STS_BCAST class.
|
||||
/// </summary>
|
||||
LC_RFSS_STS_BCAST::LC_RFSS_STS_BCAST() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_RFSS_STS_BCAST;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_RFSS_STS_BCAST::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_RFSS_STS_BCAST::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
rsValue = m_siteData.lra(); // Location Registration Area
|
||||
rsValue = (rsValue << 12) + m_siteData.sysId(); // System ID
|
||||
rsValue = (rsValue << 8) + m_siteData.rfssId(); // RF Sub-System ID
|
||||
rsValue = (rsValue << 8) + m_siteData.siteId(); // Site ID
|
||||
rsValue = (rsValue << 4) + m_siteData.channelId(); // Channel ID
|
||||
rsValue = (rsValue << 12) + m_siteData.channelNo(); // Channel Number
|
||||
rsValue = (rsValue << 8) + m_siteData.serviceClass(); // System Service Class
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_RFSS_STS_BCAST_H__)
|
||||
#define __P25_LC_TSBK__LC_RFSS_STS_BCAST_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements RFSS STS BCAST - RFSS Status Broadcast
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_RFSS_STS_BCAST : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_RFSS_STS_BCAST class.</summary>
|
||||
LC_RFSS_STS_BCAST();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_RFSS_STS_BCAST_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 "p25/lc/tdulc/LC_SYS_SRV_BCAST.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_SYS_SRV_BCAST class.
|
||||
/// </summary>
|
||||
LC_SYS_SRV_BCAST::LC_SYS_SRV_BCAST() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_SYS_SRV_BCAST;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_SYS_SRV_BCAST::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_SYS_SRV_BCAST::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
const uint32_t services = (m_siteData.netActive()) ? P25_SYS_SRV_NET_ACTIVE : 0U | P25_SYS_SRV_DEFAULT;
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
rsValue = 0U;
|
||||
rsValue = (rsValue << 16) + services; // System Services Available
|
||||
rsValue = (rsValue << 24) + services; // System Services Supported
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_SYS_SRV_BCAST_H__)
|
||||
#define __P25_LC_TSBK__LC_SYS_SRV_BCAST_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements SYS SRV BCAST - System Service Broadcast
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_SYS_SRV_BCAST : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_SYS_SRV_BCAST class.</summary>
|
||||
LC_SYS_SRV_BCAST();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_SYS_SRV_BCAST_H__
|
||||
@ -0,0 +1,101 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tdulc/LC_TEL_INT_VCH_USER.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the LC_TEL_INT_VCH_USER class.
|
||||
/// </summary>
|
||||
LC_TEL_INT_VCH_USER::LC_TEL_INT_VCH_USER() : TDULC()
|
||||
{
|
||||
m_lco = p25::LC_TEL_INT_VCH_USER;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
bool LC_TEL_INT_VCH_USER::decode(const uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
uint8_t rs[P25_TDULC_LENGTH_BYTES + 1U];
|
||||
::memset(rs, 0x00U, P25_TDULC_LENGTH_BYTES);
|
||||
|
||||
bool ret = TDULC::decode(data, rs);
|
||||
if (!ret)
|
||||
return false;
|
||||
|
||||
ulong64_t rsValue = TDULC::toValue(rs);
|
||||
|
||||
m_emergency = (rs[2U] & 0x80U) == 0x80U; // Emergency Flag
|
||||
m_encrypted = (rs[2U] & 0x40U) == 0x40U; // Encryption Flag
|
||||
m_priority = (rs[2U] & 0x07U); // Priority
|
||||
m_callTimer = (uint32_t)((rsValue >> 24) & 0xFFFFU); // Call Timer
|
||||
if (m_srcId == 0U) {
|
||||
m_srcId = (uint32_t)(rsValue & 0xFFFFFFU); // Source/Target Address
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encode a terminator data unit w/ link control.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
void LC_TEL_INT_VCH_USER::encode(uint8_t* data)
|
||||
{
|
||||
assert(data != NULL);
|
||||
|
||||
ulong64_t rsValue = 0U;
|
||||
|
||||
m_implicit = true;
|
||||
|
||||
rsValue = m_mfId;
|
||||
rsValue = (rsValue << 8) +
|
||||
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
|
||||
(m_priority & 0x07U); // Priority
|
||||
rsValue = (rsValue << 24) + m_dstId; // Target Radio Address
|
||||
rsValue = (rsValue << 24) + m_srcId; // Source Radio Address
|
||||
|
||||
std::unique_ptr<uint8_t[]> rs = TDULC::fromValue(rsValue);
|
||||
TDULC::encode(data, rs.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(__P25_LC_TSBK__LC_TEL_INT_VCH_USER_H__)
|
||||
#define __P25_LC_TSBK__LC_TEL_INT_VCH_USER_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/TDULC.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Implements TEL INT VCH USER - Telephone Interconnect Voice Channel User
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API LC_TEL_INT_VCH_USER : public TDULC {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the LC_TEL_INT_VCH_USER class.</summary>
|
||||
LC_TEL_INT_VCH_USER();
|
||||
|
||||
/// <summary>Decode a terminator data unit w/ link control.</summary>
|
||||
virtual bool decode(const uint8_t* data);
|
||||
/// <summary>Encode a terminator data unit w/ link control.</summary>
|
||||
virtual void encode(uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__LC_TEL_INT_VCH_USER_H__
|
||||
@ -0,0 +1,136 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tdulc/TDULCFactory.h"
|
||||
#include "edac/Golay24128.h"
|
||||
#include "Log.h"
|
||||
#include "Utils.h"
|
||||
|
||||
using namespace p25::lc::tdulc;
|
||||
using namespace p25::lc;
|
||||
using namespace p25;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Static Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
::edac::RS634717 TDULCFactory::m_rs = ::edac::RS634717();
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the TDULCFactory class.
|
||||
/// </summary>
|
||||
TDULCFactory::TDULCFactory()
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Finalizes a instance of TDULCFactory class.
|
||||
/// </summary>
|
||||
TDULCFactory::~TDULCFactory()
|
||||
{
|
||||
/* stub */
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create an instance of a TDULC.
|
||||
/// </summary>
|
||||
/// <param name="data"></param>
|
||||
/// <returns>True, if TDULC was decoded, otherwise false.</returns>
|
||||
std::unique_ptr<TDULC> TDULCFactory::createTDULC(const uint8_t* data)
|
||||
{
|
||||
assert(data != nullptr);
|
||||
|
||||
// deinterleave
|
||||
uint8_t rs[P25_TDULC_LENGTH_BYTES + 1U];
|
||||
uint8_t raw[P25_TDULC_FEC_LENGTH_BYTES + 1U];
|
||||
P25Utils::decode(data, raw, 114U, 410U);
|
||||
|
||||
// decode Golay (24,12,8) FEC
|
||||
edac::Golay24128::decode24128(rs, raw, P25_TDULC_LENGTH_BYTES);
|
||||
|
||||
#if DEBUG_P25_TDULC
|
||||
Utils::dump(2U, "TDULCFactory::decode(), TDULC RS", rs, P25_TDULC_LENGTH_BYTES);
|
||||
#endif
|
||||
|
||||
// decode RS (24,12,13) FEC
|
||||
try {
|
||||
bool ret = m_rs.decode241213(rs);
|
||||
if (!ret) {
|
||||
LogError(LOG_P25, "TDULCFactory::decode(), failed to decode RS (24,12,13) FEC");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
catch (...) {
|
||||
Utils::dump(2U, "P25, RS excepted with input data", rs, P25_TDULC_LENGTH_BYTES);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint8_t lco = rs[0U] & 0x3FU; // LCO
|
||||
|
||||
// standard P25 reference opcodes
|
||||
switch (lco) {
|
||||
case p25::LC_GROUP:
|
||||
return decode(new LC_GROUP(), data);
|
||||
case p25::LC_PRIVATE:
|
||||
return decode(new LC_PRIVATE(), data);
|
||||
case p25::LC_TEL_INT_VCH_USER:
|
||||
return decode(new LC_TEL_INT_VCH_USER(), data);
|
||||
default:
|
||||
LogError(LOG_P25, "TDULCFactory::create(), unknown TDULC LCO value, lco = $%02X", lco);
|
||||
break;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Private Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="tdulc"></param>
|
||||
/// <param name="data"></param>
|
||||
/// <returns></returns>
|
||||
std::unique_ptr<TDULC> TDULCFactory::decode(TDULC* tdulc, const uint8_t* data)
|
||||
{
|
||||
assert(tdulc != nullptr);
|
||||
assert(data != nullptr);
|
||||
|
||||
if (!tdulc->decode(data)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return std::unique_ptr<TDULC>(tdulc);
|
||||
}
|
||||
@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Digital Voice Modem - Host Software
|
||||
* GPLv2 Open Source. Use is subject to license terms.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* @package DVM / Host Software
|
||||
*
|
||||
*/
|
||||
/*
|
||||
* Copyright (C) 2022 by Bryan Biedenkapp N2PLL
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
#if !defined(__P25_LC__TDULC_FACTORY_H__)
|
||||
#define __P25_LC__TDULC_FACTORY_H__
|
||||
|
||||
#include "Defines.h"
|
||||
#include "edac/RS634717.h"
|
||||
|
||||
#include "p25/lc/TDULC.h"
|
||||
#include "p25/lc/tdulc/LC_ADJ_STS_BCAST.h"
|
||||
#include "p25/lc/tdulc/LC_CALL_TERM.h"
|
||||
#include "p25/lc/tdulc/LC_CONV_FALLBACK.h"
|
||||
#include "p25/lc/tdulc/LC_GROUP_UPDT.h"
|
||||
#include "p25/lc/tdulc/LC_GROUP.h"
|
||||
#include "p25/lc/tdulc/LC_IDEN_UP.h"
|
||||
#include "p25/lc/tdulc/LC_NET_STS_BCAST.h"
|
||||
#include "p25/lc/tdulc/LC_PRIVATE.h"
|
||||
#include "p25/lc/tdulc/LC_RFSS_STS_BCAST.h"
|
||||
#include "p25/lc/tdulc/LC_SYS_SRV_BCAST.h"
|
||||
#include "p25/lc/tdulc/LC_TEL_INT_VCH_USER.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tdulc
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// Helper class to instantiate an instance of a TDULC.
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
class HOST_SW_API TDULCFactory {
|
||||
public:
|
||||
/// <summary>Initializes a new instance of the TDULCFactory class.</summary>
|
||||
TDULCFactory();
|
||||
/// <summary>Finalizes a instance of the TDULCFactory class.</summary>
|
||||
~TDULCFactory();
|
||||
|
||||
/// <summary>Create an instance of a TDULC.</summary>
|
||||
static std::unique_ptr<TDULC> createTDULC(const uint8_t* data);
|
||||
|
||||
private:
|
||||
static edac::RS634717 m_rs;
|
||||
|
||||
/// <summary></summary>
|
||||
static std::unique_ptr<TDULC> decode(TDULC* tdulc, const uint8_t* data);
|
||||
};
|
||||
} // namespace tdulc
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC__TDULC_FACTORY_H__
|
||||
Loading…
Reference in new issue