add the explicit channel form of the P25 telephone interconnect channel grant (MBT_OSP_TELE_INT_VCH_GRANT, AMBT); grant telephone interconnect calls on explicit channel sites with the AMBT grant instead of refusing them;
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>pull/133/head
parent
969c604622
commit
aad59f9390
@ -0,0 +1,94 @@
|
||||
// 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.
|
||||
*
|
||||
* Copyright (C) 2026 Charles Bricker, K3NOP
|
||||
*
|
||||
*/
|
||||
#include "Defines.h"
|
||||
#include "p25/lc/tsbk/mbt/MBT_OSP_TELE_INT_VCH_GRANT.h"
|
||||
|
||||
using namespace p25;
|
||||
using namespace p25::defines;
|
||||
using namespace p25::lc;
|
||||
using namespace p25::lc::tsbk;
|
||||
|
||||
#include <cassert>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Public Class Members
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/* Initializes a new instance of the MBT_OSP_TELE_INT_VCH_GRANT class. */
|
||||
|
||||
MBT_OSP_TELE_INT_VCH_GRANT::MBT_OSP_TELE_INT_VCH_GRANT() : AMBT(),
|
||||
m_forceChannelId(false),
|
||||
m_callTimer(0U),
|
||||
m_rxGrpVchId(0U),
|
||||
m_rxGrpVchNo(0U)
|
||||
{
|
||||
m_lco = TSBKO::IOSP_TELE_INT_DIAL;
|
||||
}
|
||||
|
||||
/* Decode a alternate trunking signalling block. */
|
||||
|
||||
bool MBT_OSP_TELE_INT_VCH_GRANT::decodeMBT(const data::DataHeader& dataHeader, const data::DataBlock* blocks)
|
||||
{
|
||||
assert(blocks != nullptr);
|
||||
|
||||
/* stub */
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Encode a alternate trunking signalling block. */
|
||||
|
||||
void MBT_OSP_TELE_INT_VCH_GRANT::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
|
||||
{
|
||||
assert(pduUserData != nullptr);
|
||||
|
||||
dataHeader.setBlocksToFollow(1U);
|
||||
|
||||
uint8_t serviceOptions =
|
||||
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
|
||||
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
|
||||
(m_priority & 0x07U); // Priority
|
||||
|
||||
dataHeader.setAMBTField8(serviceOptions);
|
||||
dataHeader.setAMBTField9(0U); // Reserved
|
||||
|
||||
uint16_t txFrequency = 0U;
|
||||
if ((m_grpVchId != 0U) || m_forceChannelId) {
|
||||
txFrequency = (txFrequency << 4) + m_grpVchId; // Tx Channel ID
|
||||
}
|
||||
else {
|
||||
txFrequency = (txFrequency << 4) + s_siteData.channelId(); // Tx Channel ID
|
||||
}
|
||||
txFrequency = (txFrequency << 12) + m_grpVchNo; // Tx Channel Number
|
||||
|
||||
uint16_t rxFrequency = 0U;
|
||||
if ((m_rxGrpVchId != 0U) || m_forceChannelId) {
|
||||
rxFrequency = (rxFrequency << 4) + m_rxGrpVchId; // Rx Channel ID
|
||||
}
|
||||
else {
|
||||
rxFrequency = (rxFrequency << 4) + s_siteData.channelId(); // Rx Channel ID
|
||||
}
|
||||
rxFrequency = (rxFrequency << 12) + m_rxGrpVchNo; // Rx Channel Number
|
||||
|
||||
/** Block 1 */
|
||||
SET_UINT16(txFrequency, pduUserData, 0U); // Transmit Frequency
|
||||
SET_UINT16(rxFrequency, pduUserData, 2U); // Receive Frequency
|
||||
SET_UINT16(m_callTimer, pduUserData, 4U); // Call Timer
|
||||
|
||||
// the source/target radio address is carried in the header (LLId)
|
||||
AMBT::encode(dataHeader, pduUserData);
|
||||
}
|
||||
|
||||
/* Returns a string that represents the current TSBK. */
|
||||
|
||||
std::string MBT_OSP_TELE_INT_VCH_GRANT::toString(bool isp)
|
||||
{
|
||||
return std::string("TSBKO, OSP_TELE_INT_VCH_GRANT (Telephone Interconnect Voice Channel Grant - Explicit)");
|
||||
}
|
||||
@ -0,0 +1,88 @@
|
||||
// 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.
|
||||
*
|
||||
* Copyright (C) 2026 Charles Bricker, K3NOP
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @file MBT_OSP_TELE_INT_VCH_GRANT.h
|
||||
* @ingroup p25_ambt
|
||||
* @file MBT_OSP_TELE_INT_VCH_GRANT.cpp
|
||||
* @ingroup p25_ambt
|
||||
*/
|
||||
#if !defined(__P25_LC_TSBK__MBT_OSP_TELE_INT_VCH_GRANT_H__)
|
||||
#define __P25_LC_TSBK__MBT_OSP_TELE_INT_VCH_GRANT_H__
|
||||
|
||||
#include "common/Defines.h"
|
||||
#include "common/p25/lc/AMBT.h"
|
||||
|
||||
namespace p25
|
||||
{
|
||||
namespace lc
|
||||
{
|
||||
namespace tsbk
|
||||
{
|
||||
// ---------------------------------------------------------------------------
|
||||
// Class Declaration
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* @brief Implements TELE INT VCH GRANT - Telephone Interconnect Voice Channel Grant - Explicit (OSP).
|
||||
* @ingroup p25_ambt
|
||||
*/
|
||||
class DVM_COMMON_API MBT_OSP_TELE_INT_VCH_GRANT : public AMBT {
|
||||
public:
|
||||
/**
|
||||
* @brief Initializes a new instance of the MBT_OSP_TELE_INT_VCH_GRANT class.
|
||||
*/
|
||||
MBT_OSP_TELE_INT_VCH_GRANT();
|
||||
|
||||
/**
|
||||
* @brief Decode a alternate trunking signalling block.
|
||||
* @param[in] dataHeader P25 PDU data header
|
||||
* @param[in] blocks P25 PDU data blocks
|
||||
* @returns bool True, if AMBT decoded, otherwise false.
|
||||
*/
|
||||
bool decodeMBT(const data::DataHeader& dataHeader, const data::DataBlock* blocks) override;
|
||||
/**
|
||||
* @brief Encode a alternate trunking signalling block.
|
||||
* @param[out] dataHeader P25 PDU data header
|
||||
* @param[out] pduUserData P25 PDU user data
|
||||
*/
|
||||
void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData) override;
|
||||
|
||||
/**
|
||||
* @brief Returns a string that represents the current AMBT.
|
||||
* @returns std::string String representation of the AMBT.
|
||||
*/
|
||||
std::string toString(bool isp = false) override;
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief Flag forcing the use of the voice channel ID regardless of value.
|
||||
*/
|
||||
DECLARE_PROPERTY(bool, forceChannelId, ForceChannelId);
|
||||
/**
|
||||
* @brief Call timer, in 100ms units (0 = no timer).
|
||||
*/
|
||||
DECLARE_PROPERTY(uint16_t, callTimer, CallTimer);
|
||||
|
||||
/** @name Common Data */
|
||||
/**
|
||||
* @brief Rx Voice channel ID.
|
||||
*/
|
||||
DECLARE_PROTECTED_PROPERTY(uint8_t, rxGrpVchId, RxGrpVchId);
|
||||
/**
|
||||
* @brief Rx Voice channel number.
|
||||
*/
|
||||
DECLARE_PROTECTED_PROPERTY(uint32_t, rxGrpVchNo, RxGrpVchNo);
|
||||
/** @} */
|
||||
};
|
||||
} // namespace tsbk
|
||||
} // namespace lc
|
||||
} // namespace p25
|
||||
|
||||
#endif // __P25_LC_TSBK__MBT_OSP_TELE_INT_VCH_GRANT_H__
|
||||
Loading…
Reference in new issue