begin implementing some basic SNDCP handling logic (this isn't complete, and this doesn't make SNDCP work *yet*), however until the implementation is complete, this should prevent channels from becoming grant locked (hopefully);
parent
6b8e889ea6
commit
e90350d350
@ -0,0 +1,103 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/**
|
||||||
|
* Digital Voice Modem - Common Library
|
||||||
|
* GPLv2 Open Source. Use is subject to license terms.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* @package DVM / Common Library
|
||||||
|
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#include "Defines.h"
|
||||||
|
#include "p25/lc/tsbk/ISP_SNDCP_REC_REQ.h"
|
||||||
|
|
||||||
|
using namespace p25;
|
||||||
|
using namespace p25::defines;
|
||||||
|
using namespace p25::lc;
|
||||||
|
using namespace p25::lc::tsbk;
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Public Class Members
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Initializes a new instance of the ISP_SNDCP_REC_REQ class.
|
||||||
|
/// </summary>
|
||||||
|
ISP_SNDCP_REC_REQ::ISP_SNDCP_REC_REQ() : TSBK(),
|
||||||
|
m_dataToSend(false),
|
||||||
|
m_dataServiceOptions(0U),
|
||||||
|
m_dataAccessControl(0U)
|
||||||
|
{
|
||||||
|
m_lco = TSBKO::ISP_SNDCP_REC_REQ;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Decode a trunking signalling block.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="rawTSBK"></param>
|
||||||
|
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
|
||||||
|
bool ISP_SNDCP_REC_REQ::decode(const uint8_t* data, bool rawTSBK)
|
||||||
|
{
|
||||||
|
assert(data != nullptr);
|
||||||
|
|
||||||
|
uint8_t tsbk[P25_TSBK_LENGTH_BYTES + 1U];
|
||||||
|
::memset(tsbk, 0x00U, P25_TSBK_LENGTH_BYTES);
|
||||||
|
|
||||||
|
bool ret = TSBK::decode(data, tsbk, rawTSBK);
|
||||||
|
if (!ret)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ulong64_t tsbkValue = TSBK::toValue(tsbk);
|
||||||
|
|
||||||
|
m_dataToSend = (tsbk[4U] & 0x80U) == 0x80U; // Data To Send Flag
|
||||||
|
|
||||||
|
m_dataServiceOptions = (uint8_t)((tsbkValue >> 56) & 0xFFU); // Data Service Options
|
||||||
|
m_dataAccessControl = (uint32_t)((tsbkValue >> 40) & 0xFFFFFFFFU); // Data Access Control
|
||||||
|
m_srcId = (uint32_t)(tsbkValue & 0xFFFFFFU); // Source Radio Address
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Encode a trunking signalling block.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
/// <param name="rawTSBK"></param>
|
||||||
|
/// <param name="noTrellis"></param>
|
||||||
|
void ISP_SNDCP_REC_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
|
||||||
|
{
|
||||||
|
assert(data != nullptr);
|
||||||
|
|
||||||
|
/* stub */
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a string that represents the current TSBK.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="isp"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
std::string ISP_SNDCP_REC_REQ::toString(bool isp)
|
||||||
|
{
|
||||||
|
return std::string("TSBKO, ISP_SNDCP_REC_REQ (SNDCP Data Channel Request)");
|
||||||
|
}
|
||||||
|
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Private Class Members
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Internal helper to copy the the class.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="data"></param>
|
||||||
|
void ISP_SNDCP_REC_REQ::copy(const ISP_SNDCP_REC_REQ& data)
|
||||||
|
{
|
||||||
|
TSBK::copy(data);
|
||||||
|
|
||||||
|
m_dataServiceOptions = data.m_dataServiceOptions;
|
||||||
|
m_dataAccessControl = data.m_dataAccessControl;
|
||||||
|
}
|
||||||
@ -0,0 +1,57 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
|
/**
|
||||||
|
* Digital Voice Modem - Common Library
|
||||||
|
* GPLv2 Open Source. Use is subject to license terms.
|
||||||
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
|
*
|
||||||
|
* @package DVM / Common Library
|
||||||
|
* @license GPLv2 License (https://opensource.org/licenses/GPL-2.0)
|
||||||
|
*
|
||||||
|
* Copyright (C) 2024 Bryan Biedenkapp, N2PLL
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
#if !defined(__P25_LC_TSBK__ISP_SNDCP_REC_REQ_H__)
|
||||||
|
#define __P25_LC_TSBK__ISP_SNDCP_REC_REQ_H__
|
||||||
|
|
||||||
|
#include "common/Defines.h"
|
||||||
|
#include "common/p25/lc/TSBK.h"
|
||||||
|
|
||||||
|
namespace p25
|
||||||
|
{
|
||||||
|
namespace lc
|
||||||
|
{
|
||||||
|
namespace tsbk
|
||||||
|
{
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
// Class Declaration
|
||||||
|
// Implements SNDCP REC REQ - SNDCP Reconnect Request (ISP).
|
||||||
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class HOST_SW_API ISP_SNDCP_REC_REQ : public TSBK {
|
||||||
|
public:
|
||||||
|
/// <summary>Initializes a new instance of the ISP_SNDCP_REC_REQ class.</summary>
|
||||||
|
ISP_SNDCP_REC_REQ();
|
||||||
|
|
||||||
|
/// <summary>Decode a trunking signalling block.</summary>
|
||||||
|
bool decode(const uint8_t* data, bool rawTSBK = false) override;
|
||||||
|
/// <summary>Encode a trunking signalling block.</summary>
|
||||||
|
void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false) override;
|
||||||
|
|
||||||
|
/// <summary>Returns a string that represents the current TSBK.</summary>
|
||||||
|
std::string toString(bool isp = true) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// <summary>Flag indicationg SU has buffered data to send</summary>
|
||||||
|
__PROPERTY(bool, dataToSend, DataToSend);
|
||||||
|
/// <summary>SNDCP Data Service Options</summary>
|
||||||
|
__PROPERTY(uint8_t, dataServiceOptions, DataServiceOptions);
|
||||||
|
/// <summary>SNDCP Data Access Control</summary>
|
||||||
|
__PROPERTY(uint32_t, dataAccessControl, DataAccessControl);
|
||||||
|
|
||||||
|
__COPY(ISP_SNDCP_REC_REQ);
|
||||||
|
};
|
||||||
|
} // namespace tsbk
|
||||||
|
} // namespace lc
|
||||||
|
} // namespace p25
|
||||||
|
|
||||||
|
#endif // __P25_LC_TSBK__ISP_SNDCP_REC_REQ_H__
|
||||||
Loading…
Reference in new issue