P25 code refactor to move TSBK handling to a "factory-based paradigm";

3.0-rcon_maint
Bryan Biedenkapp 3 years ago
parent 1053abf875
commit 3254122c4d

@ -31,6 +31,8 @@ file(GLOB dvmhost_SRC
"p25/edac/*.cpp"
"p25/lc/*.h"
"p25/lc/*.cpp"
"p25/lc/tsbk/*.h"
"p25/lc/tsbk/*.cpp"
"p25/lookups/*.h"
"p25/lookups/*.cpp"
"p25/packet/*.h"
@ -109,7 +111,7 @@ else ()
endif (ENABLE_DMR)
message(CHECK_START "P25 Digital Mode")
if (ENABLE_P25)
add_definitions(-DEANBLE_P25)
add_definitions(-DENABLE_P25)
message(CHECK_PASS "enabled")
else ()
message(CHECK_PASS "disabled")

@ -227,6 +227,30 @@ inline std::string __IP_FROM_ULONG(const ulong64_t& value) {
(buffer[offset + 1U] << 8) | \
(buffer[offset + 2U] << 0);
/**
* Class Copy Code Pattern
*/
/// <summary>Creates a private copy implementation.</summary>
/// <remarks>This requires the copy(const type& data) to be declared in the class definition.</remarks>
#define __COPY(type) \
private: void copy(const type& data); \
public: __forceinline type& operator=(const type& data) { \
if (this != &data) { \
copy(data); \
} \
return *this; \
}
/// <summary>Creates a protected copy implementation.</summary>
/// <remarks>This requires the copy(const type& data) to be declared in the class definition.</remarks>
#define __PROTECTED_COPY(type) \
protected: void copy(const type& data); \
public: __forceinline type& operator=(const type& data) { \
if (this != &data) { \
copy(data); \
} \
return *this; \
}
/**
* Property Creation
* These macros should always be used LAST in the "public" section of a class definition.
@ -235,6 +259,10 @@ inline std::string __IP_FROM_ULONG(const ulong64_t& value) {
#define __READONLY_PROPERTY(type, variableName, propName) \
private: type m_##variableName; \
public: __forceinline type get##propName(void) const { return m_##variableName; }
/// <summary>Creates a read-only get property.</summary>
#define __PROTECTED_READONLY_PROPERTY(type, variableName, propName) \
protected: type m_##variableName; \
public: __forceinline type get##propName(void) const { return m_##variableName; }
/// <summary>Creates a read-only get property, does not use "get".</summary>
#define __READONLY_PROPERTY_PLAIN(type, variableName, propName) \
private: type m_##variableName; \
@ -244,16 +272,26 @@ inline std::string __IP_FROM_ULONG(const ulong64_t& value) {
private: type m_##variableName; \
public: __forceinline type& get##propName(void) const { return m_##variableName; }
/// <summary>Creates a get and set property.</summary>
/// <summary>Creates a get and set private property.</summary>
#define __PROPERTY(type, variableName, propName) \
private: type m_##variableName; \
public: __forceinline type get##propName(void) const { return m_##variableName; } \
__forceinline void set##propName(type val) { m_##variableName = val; }
/// <summary>Creates a get and set property, does not use "get"/"set".</summary>
/// <summary>Creates a get and set protected property.</summary>
#define __PROTECTED_PROPERTY(type, variableName, propName) \
protected: type m_##variableName; \
public: __forceinline type get##propName(void) const { return m_##variableName; } \
__forceinline void set##propName(type val) { m_##variableName = val; }
/// <summary>Creates a get and set private property, does not use "get"/"set".</summary>
#define __PROPERTY_PLAIN(type, variableName, propName) \
private: type m_##variableName; \
public: __forceinline type propName(void) const { return m_##variableName; } \
__forceinline void propName(type val) { m_##variableName = val; }
/// <summary>Creates a get and set protected property, does not use "get"/"set".</summary>
#define __PROTECTED_PROPERTY_PLAIN(type, variableName, propName) \
protected: type m_##variableName; \
public: __forceinline type propName(void) const { return m_##variableName; } \
__forceinline void propName(type val) { m_##variableName = val; }
/// <summary>Creates a get and set property by reference.</summary>
#define __PROPERTY_BYREF(type, variableName, propName) \
private: type m_##variableName; \

@ -35,6 +35,7 @@
#include "p25/P25Defines.h"
#include "p25/data/DataHeader.h"
#include "p25/lc/LC.h"
#include "p25/lc/tsbk/TSBKFactory.h"
#include "p25/P25Utils.h"
#include "nxdn/NXDNDefines.h"
#include "nxdn/channel/LICH.h"
@ -411,6 +412,10 @@ int HostCal::run()
return 2;
}
p25::lc::TSBK::setVerbose(true);
p25::lc::TSBK::setWarnCRC(true);
p25::lc::tsbk::TSBKFactory::setWarnCRC(true);
m_modem = new Modem(modemPort, false, rxInvert, txInvert, pttInvert, dcBlocker, false, fdmaPreamble, dmrRxDelay, p25CorrCount, 10U, false, ignoreModemConfigArea, false, false, false);
m_modem->setLevels(rxLevel, txLevel, txLevel, txLevel, txLevel);
m_modem->setSymbolAdjust(dmrSymLevel3Adj, dmrSymLevel1Adj, p25SymLevel3Adj, p25SymLevel1Adj, nxdnSymLevel3Adj, nxdnSymLevel1Adj);
@ -2100,21 +2105,18 @@ void HostCal::processP25BER(const uint8_t* buffer)
else if (duid == P25_DUID_TSDU) {
timerStop();
lc::TSBK tsbk = lc::TSBK(SiteData(), lookups::IdenTable());
tsbk.setVerbose(true); // always verbose in CAL
tsbk.setWarnCRC(true);
lc::TSBK *tsbk = lc::tsbk::TSBKFactory::createTSBK(buffer + 1U);
Utils::dump(1U, "Raw TSBK Dump", buffer + 1U, P25_TSDU_FRAME_LENGTH_BYTES);
bool ret = tsbk.decode(buffer + 1U);
if (!ret) {
if (tsbk == NULL) {
LogWarning(LOG_CAL, P25_TSDU_STR ", undecodable LC");
m_berUndecodableLC++;
}
else {
LogMessage(LOG_CAL, P25_TSDU_STR ", mfId = $%02X, lco = $%02X, srcId = %u, dstId = %u, service = %u, status = %u, message = %u, extFunc = %u, netId = %u, sysId = %u",
tsbk.getMFId(), tsbk.getLCO(), tsbk.getSrcId(), tsbk.getDstId(), tsbk.getService(), tsbk.getStatus(), tsbk.getMessage(), tsbk.getExtendedFunction(),
tsbk.getNetId(), tsbk.getSysId());
LogMessage(LOG_CAL, P25_TSDU_STR ", mfId = $%02X, lco = $%02X, srcId = %u, dstId = %u, service = %u, netId = %u, sysId = %u",
tsbk->getMFId(), tsbk->getLCO(), tsbk->getSrcId(), tsbk->getDstId(), tsbk->getService(), tsbk->getNetId(), tsbk->getSysId());
delete tsbk;
}
}
}

@ -439,10 +439,10 @@ bool BaseNetwork::writeP25TDU(const p25::lc::LC& control, const p25::data::LowSp
/// <summary>
/// Writes P25 TSDU frame data to the network.
/// </summary>
/// <param name="tsbk"></param>
/// <param name="control"></param>
/// <param name="data"></param>
/// <returns></returns>
bool BaseNetwork::writeP25TSDU(const p25::lc::TSBK& tsbk, const uint8_t* data)
bool BaseNetwork::writeP25TSDU(const p25::lc::LC& control, const uint8_t* data)
{
if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING)
return false;
@ -453,7 +453,7 @@ bool BaseNetwork::writeP25TSDU(const p25::lc::TSBK& tsbk, const uint8_t* data)
m_streamId[0] = m_p25StreamId;
return writeP25TSDU(m_id, m_p25StreamId, tsbk, data);
return writeP25TSDU(m_id, m_p25StreamId, control, data);
}
/// <summary>
@ -962,30 +962,32 @@ bool BaseNetwork::writeP25TDU(const uint32_t id, const uint32_t streamId, const
/// </summary>
/// <param name="id"></param>
/// <param name="streamId"></param>
/// <param name="tsbk"></param>
/// <param name="control"></param>
/// <param name="data"></param>
/// <returns></returns>
bool BaseNetwork::writeP25TSDU(const uint32_t id, const uint32_t streamId, const p25::lc::TSBK& tsbk, const uint8_t* data)
bool BaseNetwork::writeP25TSDU(const uint32_t id, const uint32_t streamId, const p25::lc::LC& control, const uint8_t* data)
{
if (m_status != NET_STAT_RUNNING && m_status != NET_STAT_MST_RUNNING)
return false;
assert(data != NULL);
uint8_t buffer[DATA_PACKET_LENGTH];
::memset(buffer, 0x00U, DATA_PACKET_LENGTH);
::memcpy(buffer + 0U, TAG_P25_DATA, 4U);
buffer[4U] = tsbk.getLCO(); // LCO
buffer[4U] = control.getLCO(); // LCO
uint32_t srcId = tsbk.getSrcId(); // Source Address
uint32_t srcId = control.getSrcId(); // Source Address
__SET_UINT16(srcId, buffer, 5U);
uint32_t dstId = tsbk.getDstId(); // Target Address
uint32_t dstId = control.getDstId(); // Target Address
__SET_UINT16(dstId, buffer, 8U);
__SET_UINT32(id, buffer, 11U); // Peer ID
buffer[15U] = tsbk.getMFId(); // MFId
buffer[15U] = control.getMFId(); // MFId
__SET_UINT32(streamId, buffer, 16U); // Stream ID

@ -36,6 +36,7 @@
#include "p25/P25Defines.h"
#include "nxdn/NXDNDefines.h"
#include "dmr/data/Data.h"
#include "p25/data/DataHeader.h"
#include "p25/data/LowSpeedData.h"
#include "p25/dfsi/DFSIDefines.h"
#include "p25/dfsi/LC.h"
@ -155,7 +156,7 @@ namespace network
/// <summary>Writes P25 TDU frame data to the network.</summary>
virtual bool writeP25TDU(const p25::lc::LC& control, const p25::data::LowSpeedData& lsd);
/// <summary>Writes P25 TSDU frame data to the network.</summary>
virtual bool writeP25TSDU(const p25::lc::TSBK& control, const uint8_t* data);
virtual bool writeP25TSDU(const p25::lc::LC& control, const uint8_t* data);
/// <summary>Writes P25 PDU frame data to the network.</summary>
virtual bool writeP25PDU(const p25::data::DataHeader& header, const p25::data::DataHeader& secHeader, const uint8_t currentBlock,
const uint8_t* data, const uint32_t len);
@ -235,7 +236,7 @@ namespace network
/// <summary>Writes P25 TDU frame data to the network.</summary>
bool writeP25TDU(const uint32_t id, const uint32_t streamId, const p25::lc::LC& control, const p25::data::LowSpeedData& lsd);
/// <summary>Writes P25 TSDU frame data to the network.</summary>
bool writeP25TSDU(const uint32_t id, const uint32_t streamId, const p25::lc::TSBK& control, const uint8_t* data);
bool writeP25TSDU(const uint32_t id, const uint32_t streamId, const p25::lc::LC& control, const uint8_t* data);
/// <summary>Writes P25 PDU frame data to the network.</summary>
bool writeP25PDU(const uint32_t id, const uint32_t streamId, const p25::data::DataHeader& header, const p25::data::DataHeader& secHeader, const uint8_t currentBlock,
const uint8_t* data, const uint32_t len);

@ -94,8 +94,6 @@ using namespace modem;
#define RCD_P25_RID_GAQ "p25-rid-gaq"
#define RCD_P25_RID_UREG "p25-rid-ureg"
#define RCD_P25_PATCH "p25-patch"
#define RCD_P25_RELEASE_GRANTS "p25-rel-grnts"
#define RCD_P25_RELEASE_AFFS "p25-rel-affs"
@ -612,7 +610,8 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
if (p25 != NULL) {
uint32_t dstId = getArgUInt32(args, 0U);
if (dstId != 0U) {
p25->trunk()->setMFId(m_p25MFId);
// FIXME
//p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_Call_Alrt(p25::P25_WUID_FNE, dstId);
}
else {
@ -629,7 +628,8 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
if (p25 != NULL) {
uint32_t dstId = getArgUInt32(args, 0U);
if (dstId != 0U) {
p25->trunk()->setMFId(m_p25MFId);
// FIXME
//p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_Ext_Func(p25::P25_EXT_FNCT_CHECK, p25::P25_WUID_FNE, dstId);
}
else {
@ -646,7 +646,8 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
if (p25 != NULL) {
uint32_t dstId = getArgUInt32(args, 0U);
if (dstId != 0U) {
p25->trunk()->setMFId(m_p25MFId);
// FIXME
//p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_Ext_Func(p25::P25_EXT_FNCT_INHIBIT, p25::P25_WUID_FNE, dstId);
}
else {
@ -663,7 +664,8 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
if (p25 != NULL) {
uint32_t dstId = getArgUInt32(args, 0U);
if (dstId != 0U) {
p25->trunk()->setMFId(m_p25MFId);
// FIXME
//p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_Ext_Func(p25::P25_EXT_FNCT_UNINHIBIT, p25::P25_WUID_FNE, dstId);
}
else {
@ -680,7 +682,8 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
if (p25 != NULL) {
uint32_t dstId = getArgUInt32(args, 0U);
if (dstId != 0U) {
p25->trunk()->setMFId(m_p25MFId);
// FIXME
//p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_Grp_Aff_Q(dstId);
}
else {
@ -697,7 +700,8 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
if (p25 != NULL) {
uint32_t dstId = getArgUInt32(args, 0U);
if (dstId != 0U) {
p25->trunk()->setMFId(m_p25MFId);
// FIXME
//p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_U_Reg_Cmd(dstId);
}
else {
@ -710,26 +714,6 @@ void RemoteControl::process(Host* host, dmr::Control* dmr, p25::Control* p25, nx
LogError(LOG_RCON, reply.c_str());
}
}
else if (rcom == RCD_P25_PATCH && argCnt >= 1U) {
if (p25 != NULL) {
uint32_t group1 = getArgUInt32(args, 0U);
uint32_t group2 = getArgUInt32(args, 1U);
uint32_t group3 = getArgUInt32(args, 2U);
if (group1 != 0U) {
p25->trunk()->setMFId(m_p25MFId);
p25->trunk()->writeRF_TSDU_Mot_Patch(group1, group2, group3);
}
else {
reply = INVALID_OPT_STR "tried to add P25 group patch with no TGID?";
LogError(LOG_RCON, reply.c_str());
}
}
else {
reply = CMD_FAILED_STR "P25 mode is not enabled!";
LogError(LOG_RCON, reply.c_str());
}
}
else if (rcom == RCD_P25_RELEASE_GRANTS) {
if (p25 != NULL) {
p25->affiliations().releaseGrant(0, true);

@ -285,6 +285,12 @@ void Control::setOptions(yaml::Node& conf, const std::string cwCallsign, const s
m_siteData = SiteData(netId, sysId, rfssId, siteId, 0U, channelId, channelNo, serviceClass, lto);
m_siteData.setCallsign(cwCallsign);
lc::LC::setSiteData(m_siteData);
lc::TDULC::setSiteData(m_siteData);
lc::TSBK::setCallsign(cwCallsign);
lc::TSBK::setSiteData(m_siteData);
std::vector<::lookups::IdenTable> entries = m_idenTable->list();
for (auto it = entries.begin(); it != entries.end(); ++it) {
::lookups::IdenTable entry = *it;
@ -294,6 +300,8 @@ void Control::setOptions(yaml::Node& conf, const std::string cwCallsign, const s
}
}
lc::TDULC::setIdenEntry(m_idenEntry);
std::vector<uint32_t> availCh = voiceChNo;
m_siteData.setChCnt((uint8_t)availCh.size());
@ -349,11 +357,6 @@ void Control::setOptions(yaml::Node& conf, const std::string cwCallsign, const s
if (m_data != NULL) {
m_data->resetRF();
}
if (m_trunk != NULL) {
m_trunk->resetRF();
m_trunk->resetNet();
}
}
/// <summary>
@ -431,8 +434,6 @@ bool Control::processFrame(uint8_t* data, uint32_t len)
m_voice->resetRF();
m_data->resetRF();
m_trunk->m_rfTSBK = lc::TSBK(m_siteData, m_idenEntry);
return false;
}
@ -705,8 +706,6 @@ void Control::clock(uint32_t ms)
m_voice->resetNet();
m_trunk->m_netTSBK = lc::TSBK(m_siteData, m_idenEntry);
m_netTimeout.stop();
}
}
@ -720,9 +719,6 @@ void Control::clock(uint32_t ms)
m_data->resetRF();
m_trunk->m_rfTSBK = lc::TSBK(m_siteData, m_idenEntry);
m_trunk->m_netTSBK = lc::TSBK(m_siteData, m_idenEntry);
if (m_network != NULL)
m_network->resetP25();

@ -293,6 +293,8 @@ namespace p25
const uint8_t TSBK_IOSP_STS_UPDT = 0x18U; // STS UPDT REQ - Status Update Request (ISP), STS UPDT - Status Update (OSP)
const uint8_t TSBK_IOSP_STS_Q = 0x1AU; // STS Q REQ - Status Query Request (ISP), STS Q - Status Query (OSP)
const uint8_t TSBK_IOSP_MSG_UPDT = 0x1CU; // MSG UPDT REQ - Message Update Request (ISP), MSG UPDT - Message Update (OSP)
const uint8_t TSBK_IOSP_RAD_MON = 0x1DU; // RAD MON REQ - Radio Unit Monitor Request (ISP), RAD MON CMD - Radio Monitor Command (OSP)
const uint8_t TSBK_IOSP_RAD_MON_ENH = 0x1EU; // RAD MON ENH REQ - Radio Unit Monitor Enhanced Request (ISP), RAD MON ENH CMD - Radio Unit Monitor Enhanced Command (OSP)
const uint8_t TSBK_IOSP_CALL_ALRT = 0x1FU; // CALL ALRT REQ - Call Alert Request (ISP), CALL ALRT - Call Alert (OSP)
const uint8_t TSBK_IOSP_ACK_RSP = 0x20U; // ACK RSP U - Acknowledge Response - Unit (ISP), ACK RSP FNE - Acknowledge Response - FNE (OSP)
const uint8_t TSBK_IOSP_EXT_FNCT = 0x24U; // EXT FNCT RSP - Extended Function Response (ISP), EXT FNCT CMD - Extended Function Command (OSP)
@ -303,27 +305,23 @@ namespace p25
const uint8_t TSBK_ISP_TELE_INT_PSTN_REQ = 0x09U; // TELE INT PSTN REQ - Telephone Interconnect Request - Implicit
const uint8_t TSBK_ISP_SNDCP_CH_REQ = 0x12U; // SNDCP CH REQ - SNDCP Data Channel Request
const uint8_t TSBK_ISP_STS_Q_RSP = 0x19U; // STS Q RSP - Status Query Response
const uint8_t TSBK_ISP_STS_Q_REQ = 0x1CU; // STS_Q_REQ - Status Query Request
const uint8_t TSBK_ISP_RAD_MON_REQ = 0x1DU; // RAD_MON_REQ - Radio Unit Monitor Request
const uint8_t TSBK_ISP_RAD_MON_ENH_REQ = 0x1EU; // RAD_MON_ENH_REQ - Radio Unit Monitor Enhanced Request
const uint8_t TSBK_ISP_STS_Q_REQ = 0x1CU; // STS Q REQ - Status Query Request
const uint8_t TSBK_ISP_CAN_SRV_REQ = 0x23U; // CAN SRV REQ - Cancel Service Request
const uint8_t TSBK_ISP_EMERG_ALRM_REQ = 0x27U; // EMERG ALRM REQ - Emergency Alarm Request
const uint8_t TSBK_ISP_GRP_AFF_Q_RSP = 0x29U; // GRP AFF Q RSP - Group Affiliation Query Response
const uint8_t TSBK_ISP_U_DEREG_REQ = 0x2BU; // U DE REG REQ - Unit De-Registration Request
const uint8_t TSBK_ISP_LOC_REG_REQ = 0x2DU; // LOC REG REQ - Location Registration Request
const uint8_t TSBK_ISP_AUTH_RESP = 0x38U; // AUTH_RESP - Authentication Response
const uint8_t TSBK_ISP_AUTH_RESP_M = 0x39U; // AUTH_RESP_M - Authentication Response Mutual
const uint8_t TSBK_ISP_AUTH_FNE_RST = 0x3AU; // AUTH_FNE_RST - Authentication FNE Result
const uint8_t TSBK_ISP_AUTH_SU_DMD = 0x3BU; // AUTH_SU_DMD - Authentication SU Demand
const uint8_t TSBK_ISP_AUTH_RESP = 0x38U; // AUTH RESP - Authentication Response
const uint8_t TSBK_ISP_AUTH_RESP_M = 0x39U; // AUTH RESP M - Authentication Response Mutual
const uint8_t TSBK_ISP_AUTH_FNE_RST = 0x3AU; // AUTH FNE RST - Authentication FNE Result
const uint8_t TSBK_ISP_AUTH_SU_DMD = 0x3BU; // AUTH SU DMD - Authentication SU Demand
// TSBK Outbound Signalling Packet (OSP) Opcode(s)
const uint8_t TSBK_OSP_GRP_VCH_GRANT_UPD = 0x02U; // GRP VCH GRANT UPD - Group Voice Channel Grant Update
const uint8_t TSBK_OSP_UU_VCH_GRANT_UPD = 0x06U; // UU VCH GRANT UPD - Unit-to-Unit Voice Channel Grant Update
const uint8_t TSBK_OSP_SNDCP_CH_GNT = 0x14U; // SNDCP CH GNT - SNDCP Data Channel Grant
const uint8_t TSBK_OSP_SNDCP_CH_ANN = 0x16U; // SNDCP CH ANN - SNDCP Data Channel Announcement
const uint8_t TSBK_OSP_STS_Q = 0x1AU; // STS_Q - Status Query
const uint8_t TSBK_OSP_RAD_MON_CMD = 0x1DU; // RAD_MON_CMD - Radio Monitor Command
const uint8_t TSBK_OSP_RAD_MON_ENH_CMD = 0x1EU; // RAD_MON_ENH_CMD - Radio Unit Monitor Enhanced Command
const uint8_t TSBK_OSP_STS_Q = 0x1AU; // STS Q - Status Query
const uint8_t TSBK_OSP_DENY_RSP = 0x27U; // DENY RSP - Deny Response
const uint8_t TSBK_OSP_SCCB_EXP = 0x29U; // SCCB - Secondary Control Channel Broadcast - Explicit
const uint8_t TSBK_OSP_GRP_AFF_Q = 0x2AU; // GRP AFF Q - Group Affiliation Query
@ -331,8 +329,8 @@ namespace p25
const uint8_t TSBK_OSP_U_REG_CMD = 0x2DU; // U REG CMD - Unit Registration Command
const uint8_t TSBK_OSP_U_DEREG_ACK = 0x2FU; // U DE REG ACK - Unit De-Registration Acknowledge
const uint8_t TSBK_OSP_SYNC_BCAST = 0x30U; // SYNC BCAST - Synchronization Broadcast
const uint8_t TSBK_OSP_AUTH_DMD = 0x31U; // AUTH_DMD - Authentication Demand
const uint8_t TSBK_OSP_AUTH_FNE_RESP = 0x32U; // AUTH_FNE_RESP - Authentication FNE Response
const uint8_t TSBK_OSP_AUTH_DMD = 0x31U; // AUTH DMD - Authentication Demand
const uint8_t TSBK_OSP_AUTH_FNE_RESP = 0x32U; // AUTH FNE RESP - Authentication FNE Response
const uint8_t TSBK_OSP_QUE_RSP = 0x33U; // QUE RSP - Queued Response
const uint8_t TSBK_OSP_IDEN_UP_VU = 0x34U; // IDEN UP VU - Channel Identifier Update for VHF/UHF Bands
const uint8_t TSBK_OSP_SYS_SRV_BCAST = 0x38U; // SYS SRV BCAST - System Service Broadcast

@ -27,6 +27,7 @@
#include "p25/P25Defines.h"
#include "p25/dfsi/DFSIDefines.h"
#include "p25/dfsi/LC.h"
#include "p25/lc/tsbk/TSBKFactory.h"
#include "p25/P25Utils.h"
#include "Log.h"
#include "Utils.h"
@ -53,7 +54,7 @@ LC::LC() :
m_rssi(0U),
m_source(P25_DFSI_DEF_SOURCE),
m_control(),
m_tsbk(),
m_tsbk(NULL),
m_lsd(),
m_mi(NULL)
{
@ -717,7 +718,10 @@ void LC::encodeLDU2(uint8_t* data, const uint8_t* imbe)
bool LC::decodeTSBK(const uint8_t* data)
{
assert(data != NULL);
m_tsbk = lc::TSBK();
if (m_tsbk != NULL) {
delete m_tsbk;
m_tsbk = NULL;
}
m_frameType = data[0U]; // Frame Type
if (m_frameType != P25_DFSI_TSBK) {
@ -729,7 +733,13 @@ bool LC::decodeTSBK(const uint8_t* data)
uint8_t tsbk[P25_TSBK_LENGTH_BYTES];
::memcpy(tsbk, data + 9U, P25_TSBK_LENGTH_BYTES); // Raw TSBK + CRC
return m_tsbk.decode(tsbk, true);
m_tsbk = lc::tsbk::TSBKFactory::createTSBK(tsbk, true);
if (m_tsbk != NULL) {
return true;
} else {
return false;
}
}
/// <summary>
@ -738,10 +748,11 @@ bool LC::decodeTSBK(const uint8_t* data)
/// <param name="data"></param>
void LC::encodeTSBK(uint8_t* data)
{
assert(m_tsbk != NULL);
assert(data != NULL);
uint8_t tsbk[P25_TSBK_LENGTH_BYTES];
m_tsbk.encode(tsbk, true, true);
m_tsbk->encode(tsbk, true, true);
uint8_t dfsiFrame[P25_DFSI_TSBK_FRAME_LENGTH_BYTES];
::memset(dfsiFrame, 0x00U, P25_DFSI_TSBK_FRAME_LENGTH_BYTES);
@ -777,7 +788,7 @@ void LC::copy(const LC& data)
m_source = data.m_source;
m_control = lc::LC(data.m_control);
m_tsbk = lc::TSBK(data.m_tsbk);
//m_tsbk = lc::TSBK(data.m_tsbk);
m_lsd = data.m_lsd;
delete[] m_mi;

@ -108,7 +108,7 @@ namespace p25
/// <summary>Link control data.</summary>
__PROPERTY_PLAIN(p25::lc::LC, control, control);
/// <summary>TSBK.</summary>
__PROPERTY_PLAIN(p25::lc::TSBK, tsbk, tsbk);
__PROPERTY_PLAIN(p25::lc::TSBK*, tsbk, tsbk);
/// <summary>Low speed data.</summary>
__PROPERTY_PLAIN(p25::data::LowSpeedData, lsd, lsd);

@ -41,34 +41,14 @@ using namespace p25::dfsi::packet;
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Resets the data states for the RF interface.
/// </summary>
void DFSITrunk::resetRF()
{
Trunk::resetRF();
LC lc = LC();
m_rfDFSILC = lc;
}
/// <summary>
/// Resets the data states for the network.
/// </summary>
void DFSITrunk::resetNet()
{
Trunk::resetNet();
LC lc = LC();
m_netDFSILC = lc;
}
/// <summary>
/// Process a data frame from the RF interface.
/// </summary>
/// <param name="data">Buffer containing data frame.</param>
/// <param name="len">Length of data frame.</param>
/// <param name="preDecoded">Flag indicating the TSBK data is pre-decoded TSBK data.</param>
/// <param name="preDecodedTSBK">Pre-decoded TSBK.</param>
/// <returns></returns>
bool DFSITrunk::process(uint8_t* data, uint32_t len, bool preDecoded)
bool DFSITrunk::process(uint8_t* data, uint32_t len, lc::TSBK* preDecodedTSBK)
{
assert(data != NULL);
@ -78,16 +58,12 @@ bool DFSITrunk::process(uint8_t* data, uint32_t len, bool preDecoded)
if (!m_p25->m_control)
return false;
if (preDecoded) {
return Trunk::process(data + 2U, len, preDecoded);
if (preDecodedTSBK != NULL) {
return Trunk::process(data + 2U, len, preDecodedTSBK);
}
else {
resetRF();
resetNet();
if (m_rfDFSILC.decodeTSBK(data + 2U)) {
m_rfTSBK = m_rfDFSILC.tsbk();
return Trunk::process(tsbk, P25_TSBK_LENGTH_BYTES, true);
return Trunk::process(tsbk, P25_TSBK_LENGTH_BYTES, m_rfDFSILC.tsbk());
}
}
@ -133,14 +109,17 @@ void DFSITrunk::writeRF_TDULC(lc::TDULC lc, bool noNetwork)
/// <summary>
/// Helper to write a single-block P25 TSDU packet.
/// </summary>
/// <param name="tsbk"></param>
/// <param name="noNetwork"></param>
/// <param name="clearBeforeWrite"></param>
/// <param name="force"></param>
void DFSITrunk::writeRF_TSDU_SBF(bool noNetwork, bool clearBeforeWrite, bool force)
void DFSITrunk::writeRF_TSDU_SBF(lc::TSBK* tsbk, bool noNetwork, bool clearBeforeWrite, bool force)
{
if (!m_p25->m_control)
return;
assert(tsbk != NULL);
writeRF_DFSI_Start(P25_DFSI_TYPE_TSBK);
uint8_t data[P25_TSDU_FRAME_LENGTH_BYTES + 2U];
@ -149,7 +128,7 @@ void DFSITrunk::writeRF_TSDU_SBF(bool noNetwork, bool clearBeforeWrite, bool for
m_rfDFSILC.setFrameType(P25_DFSI_TSBK);
m_rfDFSILC.setStartStop(P25_DFSI_START_FLAG);
m_rfDFSILC.setType(P25_DFSI_TYPE_TSBK);
m_rfDFSILC.tsbk(m_rfTSBK);
m_rfDFSILC.tsbk(tsbk);
// Generate Sync
Sync::addP25Sync(data + 2U);
@ -158,13 +137,13 @@ void DFSITrunk::writeRF_TSDU_SBF(bool noNetwork, bool clearBeforeWrite, bool for
m_p25->m_nid.encode(data + 2U, P25_DUID_TSDU);
// Generate TSBK block
m_rfTSBK.setLastBlock(true); // always set last block -- this a Single Block TSDU
m_rfTSBK.encode(data + 2U);
tsbk->setLastBlock(true); // always set last block -- this a Single Block TSDU
tsbk->encode(data + 2U);
if (m_debug) {
LogDebug(LOG_RF, P25_TSDU_STR " DFSI, lco = $%02X, mfId = $%02X, lastBlock = %u, AIV = %u, EX = %u, srcId = %u, dstId = %u, sysId = $%03X, netId = $%05X",
m_rfTSBK.getLCO(), m_rfTSBK.getMFId(), m_rfTSBK.getLastBlock(), m_rfTSBK.getAIV(), m_rfTSBK.getEX(), m_rfTSBK.getSrcId(), m_rfTSBK.getDstId(),
m_rfTSBK.getSysId(), m_rfTSBK.getNetId());
tsbk->getLCO(), tsbk->getMFId(), tsbk->getLastBlock(), tsbk->getAIV(), tsbk->getEX(), tsbk->getSrcId(), tsbk->getDstId(),
tsbk->getSysId(), tsbk->getNetId());
Utils::dump(1U, "!!! *TSDU (SBF) TSBK Block Data", data + P25_PREAMBLE_LENGTH_BYTES + 2U, P25_TSBK_FEC_LENGTH_BYTES);
}
@ -176,7 +155,7 @@ void DFSITrunk::writeRF_TSDU_SBF(bool noNetwork, bool clearBeforeWrite, bool for
m_p25->setBusyBits(data + 2U, P25_SS0_START, true, true);
if (!noNetwork)
writeNetworkRF(data + 2U, true);
writeNetworkRF(tsbk, data + 2U, true);
if (!force) {
if (clearBeforeWrite) {
@ -201,20 +180,26 @@ void DFSITrunk::writeRF_TSDU_SBF(bool noNetwork, bool clearBeforeWrite, bool for
/// <summary>
/// Helper to write a alternate multi-block trunking PDU packet.
/// </summary>
/// <param name="ambt"></param>
/// <param name="clearBeforeWrite"></param>
void DFSITrunk::writeRF_TSDU_AMBT(bool clearBeforeWrite)
void DFSITrunk::writeRF_TSDU_AMBT(lc::AMBT* ambt, bool clearBeforeWrite)
{
if (!m_p25->m_control)
return;
assert(ambt != NULL);
// for now this is ignored...
}
/// <summary>
/// Helper to write a network single-block P25 TSDU packet.
/// </summary>
void DFSITrunk::writeNet_TSDU()
/// <param name="tsbk"></param>
void DFSITrunk::writeNet_TSDU(lc::TSBK* tsbk)
{
assert(tsbk != NULL);
uint8_t buffer[P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U];
::memset(buffer, 0x00U, P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U);
@ -222,7 +207,7 @@ void DFSITrunk::writeNet_TSDU()
buffer[1U] = 0x00U;
// Regenerate TSDU Data
m_netDFSILC.tsbk(m_netTSBK);
m_netDFSILC.tsbk(tsbk);
m_netDFSILC.encodeTSBK(buffer + 2U);
m_p25->addFrame(buffer, P25_DFSI_TSBK_FRAME_LENGTH_BYTES + 2U, true);

@ -52,13 +52,8 @@ namespace p25
class HOST_SW_API DFSITrunk : public p25::packet::Trunk {
public:
/// <summary>Resets the data states for the RF interface.</summary>
virtual void resetRF();
/// <summary>Resets the data states for the network.</summary>
virtual void resetNet();
/// <summary>Process a data frame from the RF interface.</summary>
virtual bool process(uint8_t* data, uint32_t len, bool preDecoded = false);
virtual bool process(uint8_t* data, uint32_t len, lc::TSBK* preDecodedTSBK = NULL);
protected:
LC m_rfDFSILC;
@ -73,14 +68,14 @@ namespace p25
virtual void writeRF_TDULC(lc::TDULC lc, bool noNetwork);
/// <summary>Helper to write a single-block P25 TSDU packet.</summary>
virtual void writeRF_TSDU_SBF(bool noNetwork, bool clearBeforeWrite = false, bool force = false);
virtual void writeRF_TSDU_SBF(lc::TSBK* tsbk, bool noNetwork, bool clearBeforeWrite = false, bool force = false);
/// <summary>Helper to write a alternate multi-block trunking PDU packet.</summary>
virtual void writeRF_TSDU_AMBT(bool clearBeforeWrite = false);
virtual void writeRF_TSDU_AMBT(lc::AMBT* ambt, bool clearBeforeWrite = false);
/// <summary>Helper to write a network P25 TDU w/ link control packet.</summary>
//virtual void writeNet_TDULC(lc::TDULC lc);
/// <summary>Helper to write a network single-block P25 TSDU packet.</summary>
virtual void writeNet_TSDU();
virtual void writeNet_TSDU(lc::TSBK* tsbk);
/// <suimmary>Helper to write start DFSI data.</summary>
void writeRF_DFSI_Start(uint8_t type);

@ -229,15 +229,12 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
}
}
m_p25->m_trunk->m_rfTSBK = lc::TSBK(&lc);
m_p25->m_trunk->m_rfTSBK.setVerbose(m_p25->m_trunk->m_dumpTSBK);
// validate the source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
if (m_lastRejectId == 0U || m_lastRejectId != srcId) {
LogWarning(LOG_RF, P25_HDU_STR " denial, RID rejection, srcId = %u", srcId);
if (m_p25->m_control) {
m_p25->m_trunk->writeRF_TSDU_Deny(P25_DENY_RSN_REQ_UNIT_NOT_VALID, (group ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH));
m_p25->m_trunk->writeRF_TSDU_Deny(srcId, P25_DENY_RSN_REQ_UNIT_NOT_VALID, (group ? TSBK_IOSP_GRP_VCH : TSBK_IOSP_UU_VCH));
m_p25->m_trunk->denialInhibit(srcId);
}
@ -259,7 +256,7 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, P25_HDU_STR " denial, RID rejection, dstId = %u", dstId);
if (m_p25->m_control) {
m_p25->m_trunk->writeRF_TSDU_Deny(P25_DENY_RSN_TGT_UNIT_NOT_VALID, TSBK_IOSP_UU_VCH);
m_p25->m_trunk->writeRF_TSDU_Deny(srcId, P25_DENY_RSN_TGT_UNIT_NOT_VALID, TSBK_IOSP_UU_VCH);
}
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
@ -279,7 +276,7 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
if (m_lastRejectId == 0 || m_lastRejectId != dstId) {
LogWarning(LOG_RF, P25_HDU_STR " denial, TGID rejection, dstId = %u", dstId);
if (m_p25->m_control) {
m_p25->m_trunk->writeRF_TSDU_Deny(P25_DENY_RSN_TGT_GROUP_NOT_VALID, TSBK_IOSP_GRP_VCH);
m_p25->m_trunk->writeRF_TSDU_Deny(srcId, P25_DENY_RSN_TGT_GROUP_NOT_VALID, TSBK_IOSP_GRP_VCH);
}
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
@ -300,7 +297,7 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
if (!m_p25->m_affiliations.isGroupAff(srcId, dstId) && m_p25->m_trunk->m_verifyAff) {
if (m_lastRejectId == 0 || m_lastRejectId != srcId) {
LogWarning(LOG_RF, P25_HDU_STR " denial, RID not affiliated to TGID, srcId = %u, dstId = %u", srcId, dstId);
m_p25->m_trunk->writeRF_TSDU_Deny(P25_DENY_RSN_REQ_UNIT_NOT_AUTH, TSBK_IOSP_GRP_VCH);
m_p25->m_trunk->writeRF_TSDU_Deny(srcId, P25_DENY_RSN_REQ_UNIT_NOT_AUTH, TSBK_IOSP_GRP_VCH);
m_p25->m_trunk->writeRF_TSDU_U_Reg_Cmd(srcId);
::ActivityLog("P25", true, "RF voice rejection from %u to %s%u ", srcId, group ? "TG " : "", dstId);
@ -321,6 +318,10 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
m_lastRejectId = 0U;
::ActivityLog("P25", true, "RF %svoice transmission from %u to %s%u", encrypted ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
uint8_t serviceOptions = (m_rfLC.getEmergency() ? 0x80U : 0x00U) + // Emergency Flag
(m_rfLC.getEncrypted() ? 0x40U : 0x00U) + // Encrypted Flag
(m_rfLC.getPriority() & 0x07U); // Priority
if (m_p25->m_control) {
// if the group wasn't granted out -- explicitly grant the group
if (!m_p25->m_affiliations.isGranted(dstId)) {
@ -335,7 +336,7 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
}
}
if (!m_p25->m_trunk->writeRF_TSDU_Grant(group)) {
if (!m_p25->m_trunk->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, group)) {
::memset(m_dfsiLDU1, 0x00U, 9U * 25U);
return false;
}
@ -349,7 +350,7 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
// single-channel trunking or voice on control support?
if (m_p25->m_control && m_p25->m_voiceOnControl) {
m_p25->m_trunk->writeRF_TSDU_Grant(group, true);
m_p25->m_trunk->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, group, true);
}
m_hadVoice = true;
@ -406,7 +407,7 @@ bool DFSIVoice::process(uint8_t* data, uint32_t len)
m_p25->m_rfTimeout.start();
m_lastDUID = P25_DUID_HDU;
m_rfLastHDU = lc::LC(m_p25->m_siteData);
m_rfLastHDU = lc::LC();
}
if (m_p25->m_rfState == RS_RF_AUDIO) {
@ -751,9 +752,6 @@ bool DFSIVoice::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, dat
resetRF();
resetNet();
m_p25->m_trunk->m_rfTSBK = lc::TSBK(m_p25->m_siteData, m_p25->m_idenEntry, m_p25->m_trunk->m_dumpTSBK);
m_p25->m_trunk->m_netTSBK = lc::TSBK(m_p25->m_siteData, m_p25->m_idenEntry, m_p25->m_trunk->m_dumpTSBK);
writeNet_LDU1();
}
else {
@ -934,7 +932,7 @@ void DFSIVoice::writeNet_LDU1()
}
// set network and RF link control states
m_netLC = lc::LC(m_p25->m_siteData);
m_netLC = lc::LC();
m_netLC.setLCO(control.getLCO());
m_netLC.setMFId(control.getMFId());
m_netLC.setSrcId(srcId);
@ -944,7 +942,7 @@ void DFSIVoice::writeNet_LDU1()
m_netLC.setEncrypted(control.getEncrypted());
m_netLC.setPriority(control.getPriority());
m_rfLC = lc::LC(m_p25->m_siteData);
m_rfLC = lc::LC();
m_rfLC.setLCO(control.getLCO());
m_rfLC.setMFId(control.getMFId());
m_rfLC.setSrcId(srcId);
@ -970,11 +968,6 @@ void DFSIVoice::writeNet_LDU1()
m_netLC.setKId(control.getKId());
m_rfLC.setKId(control.getKId());
m_p25->m_trunk->m_rfTSBK = lc::TSBK(&m_rfLC);
m_p25->m_trunk->m_rfTSBK.setVerbose(m_p25->m_trunk->m_dumpTSBK);
m_p25->m_trunk->m_netTSBK = lc::TSBK(&m_netLC);
m_p25->m_trunk->m_netTSBK.setVerbose(m_p25->m_trunk->m_dumpTSBK);
// validate source RID
if (!acl::AccessControl::validateSrcId(srcId)) {
LogWarning(LOG_NET, P25_HDU_STR " denial, RID rejection, srcId = %u", srcId);
@ -999,9 +992,13 @@ void DFSIVoice::writeNet_LDU1()
::ActivityLog("P25", false, "network %svoice transmission from %u to %s%u", m_netLC.getEncrypted() ? "encrypted " : "", srcId, group ? "TG " : "", dstId);
uint8_t serviceOptions = (m_rfLC.getEmergency() ? 0x80U : 0x00U) + // Emergency Flag
(m_rfLC.getEncrypted() ? 0x40U : 0x00U) + // Encrypted Flag
(m_rfLC.getPriority() & 0x07U); // Priority
// single-channel trunking or voice on control support?
if (m_p25->m_control && m_p25->m_voiceOnControl) {
if (!m_p25->m_trunk->writeRF_TSDU_Grant(group, false, true)) {
if (!m_p25->m_trunk->writeRF_TSDU_Grant(srcId, dstId, serviceOptions, group, false, true)) {
if (m_network != NULL)
m_network->resetP25();
@ -1011,8 +1008,8 @@ void DFSIVoice::writeNet_LDU1()
m_p25->m_netTimeout.stop();
m_p25->m_networkWatchdog.stop();
m_netLC = lc::LC(m_p25->m_siteData);
m_netLastLDU1 = lc::LC(m_p25->m_siteData);
m_netLC = lc::LC();
m_netLastLDU1 = lc::LC();
m_p25->m_netState = RS_NET_IDLE;
m_p25->m_netLastDstId = 0U;

@ -0,0 +1,178 @@
/**
* 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/P25Defines.h"
#include "p25/lc/AMBT.h"
#include "edac/CRC.h"
#include "HostMain.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc;
using namespace p25;
#include <cassert>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the AMBT class.
/// </summary>
AMBT::AMBT() : TSBK()
{
/* stub */
}
/// <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 AMBT::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
LogError(LOG_P25, "AMBT::decode(), bad call, not implemented");
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void AMBT::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
LogError(LOG_P25, "AMBT::encode(), bad call, not implemented");
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to convert TSBK bytes to a 64-bit long value.
/// </summary>
/// <param name="tsbk"></param>
/// <returns></returns>
ulong64_t AMBT::tsbkValue(const data::DataHeader dataHeader, const uint8_t* pduUserData)
{
ulong64_t tsbkValue = 0U;
// combine bytes into ulong64_t (8 byte) value
tsbkValue = dataHeader.getAMBTField8();
tsbkValue = (tsbkValue << 8) + dataHeader.getAMBTField9();
tsbkValue = (tsbkValue << 8) + pduUserData[0U];
tsbkValue = (tsbkValue << 8) + pduUserData[1U];
tsbkValue = (tsbkValue << 8) + pduUserData[2U];
tsbkValue = (tsbkValue << 8) + pduUserData[3U];
tsbkValue = (tsbkValue << 8) + pduUserData[4U];
tsbkValue = (tsbkValue << 8) + pduUserData[5U];
return tsbkValue;
}
/// <summary>
/// Internal helper to decode a trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <param name="pduUserData"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool AMBT::decode(const data::DataHeader dataHeader, const data::DataBlock* blocks, uint8_t* pduUserData)
{
assert(blocks != NULL);
assert(pduUserData != NULL);
if (dataHeader.getFormat() != PDU_FMT_AMBT) {
LogError(LOG_P25, "TSBK::decodeMBT(), PDU is not a AMBT PDU");
return false;
}
if (dataHeader.getBlocksToFollow() == 0U) {
LogError(LOG_P25, "TSBK::decodeMBT(), PDU contains no data blocks");
return false;
}
m_lco = dataHeader.getAMBTOpcode(); // LCO
m_lastBlock = true;
m_mfId = dataHeader.getMFId(); // Mfg Id.
if (dataHeader.getOutbound()) {
LogWarning(LOG_P25, "TSBK::decodeMBT(), MBT is an outbound MBT?, mfId = $%02X, lco = $%02X", m_mfId, m_lco);
}
// get PDU block data
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
uint32_t dataOffset = 0U;
for (uint8_t i = 0; i < dataHeader.getBlocksToFollow(); i++) {
uint32_t len = blocks[i].getData(pduUserData + dataOffset);
if (len != P25_PDU_UNCONFIRMED_LENGTH_BYTES) {
LogError(LOG_P25, "TSBK::decodeMBT(), failed to read PDU data block");
return false;
}
dataOffset += P25_PDU_UNCONFIRMED_LENGTH_BYTES;
}
return true;
}
/// <summary>
/// Internal helper to encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="pduUserData"></param>
void AMBT::encode(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
dataHeader.setFormat(PDU_FMT_AMBT);
dataHeader.setMFId(m_mfId);
dataHeader.setAckNeeded(false);
dataHeader.setOutbound(true);
dataHeader.setSAP(PDU_SAP_TRUNK_CTRL);
dataHeader.setLLId(m_srcId);
dataHeader.setFullMessage(true);
dataHeader.setBlocksToFollow(1U);
dataHeader.setAMBTOpcode(m_lco);
// generate packet CRC-32 and set data blocks
if (dataHeader.getBlocksToFollow() > 1U) {
edac::CRC::addCRC32(pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
} else {
edac::CRC::addCRC32(pduUserData, P25_PDU_UNCONFIRMED_LENGTH_BYTES);
}
}

@ -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(__P25_LC__AMBT_H__)
#define __P25_LC__AMBT_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
#include "p25/data/DataHeader.h"
#include "p25/data/DataBlock.h"
namespace p25
{
namespace lc
{
// ---------------------------------------------------------------------------
// Class Declaration
// Represents link control data for Alternate Trunking packets.
// ---------------------------------------------------------------------------
class HOST_SW_API AMBT : public TSBK {
public:
/// <summary>Initializes a new instance of the AMBT class.</summary>
AMBT();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks) = 0;
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData) = 0;
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
protected:
/// <summary>Internal helper to convert TSBK bytes to a 64-bit long value.</summary>
static ulong64_t tsbkValue(const data::DataHeader dataHeader, const uint8_t* pduUserData);
/// <summary>Internal helper to decode a trunking signalling block.</summary>
bool decode(const data::DataHeader dataHeader, const data::DataBlock* blocks, uint8_t* pduUserData);
/// <summary>Internal helper to encode a trunking signalling block.</summary>
void encode(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace lc
} // namespace p25
#endif // __P25_LC__AMBT_H__

@ -45,6 +45,12 @@ using namespace p25;
#include <cassert>
#include <cstring>
// ---------------------------------------------------------------------------
// Static Class Members
// ---------------------------------------------------------------------------
SiteData LC::m_siteData = SiteData();
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
@ -66,7 +72,6 @@ LC::LC() :
m_group(true),
m_algId(P25_ALGO_UNENCRYPT),
m_kId(0U),
m_siteData(SiteData()),
m_rs(),
m_encryptOverride(false),
m_tsbkVendorSkip(false),
@ -86,16 +91,6 @@ LC::LC(const LC& data) : LC()
copy(data);
}
/// <summary>
/// Initializes a new instance of the LC class.
/// </summary>
/// <param name="siteData"></param>
LC::LC(SiteData siteData) : LC()
{
m_siteData = siteData;
m_grpVchNo = m_siteData.channelNo();
}
/// <summary>
/// Finalizes a instance of LC class.
/// </summary>

@ -61,8 +61,6 @@ namespace p25
LC();
/// <summary>Initializes a copy instance of the LC class.</summary>
LC(const LC& data);
/// <summary>Initializes a new instance of the LC class.</summary>
LC(SiteData siteData);
/// <summary>Finalizes a instance of the LC class.</summary>
~LC();
@ -90,6 +88,12 @@ namespace p25
/// <summary>Gets the encryption message indicator.</summary>
void getMI(uint8_t* mi) const;
/** Local Site data */
/// <summary>Gets the local site data.</summary>
static SiteData getSiteData() { return m_siteData; }
/// <summary>Sets the local site data.</summary>
static void setSiteData(SiteData siteData) { m_siteData = siteData; }
public:
/** Common Data */
/// <summary>Flag indicating the link control data is protected.</summary>
@ -123,10 +127,6 @@ namespace p25
/// <summary>Encryption key ID.</summary>
__PROPERTY(uint32_t, kId, KId);
/** Local Site data */
/// <summary>Local Site Data.</summary>
__PROPERTY_PLAIN(SiteData, siteData, siteData);
private:
friend class TSBK;
friend class TDULC;
@ -139,6 +139,9 @@ namespace p25
/** Encryption data */
uint8_t* m_mi;
/** Local Site data */
static SiteData m_siteData;
/// <summary>Internal helper to copy the class.</summary>
void copy(const LC& data);

@ -40,6 +40,15 @@ using namespace p25;
#include <cassert>
#include <cstring>
// ---------------------------------------------------------------------------
// Static Class Members
// ---------------------------------------------------------------------------
bool TDULC::m_verbose = false;
SiteData TDULC::m_siteData = SiteData();
::lookups::IdenTable TDULC::m_siteIdenEntry = ::lookups::IdenTable();
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
@ -53,35 +62,11 @@ TDULC::TDULC(const TDULC& data) : TDULC()
copy(data);
}
/// <summary>
/// Initializes a new instance of the TDULC class.
/// </summary>
/// <param name="siteData"></param>
/// <param name="entry"></param>
TDULC::TDULC(SiteData siteData, ::lookups::IdenTable entry) : TDULC(siteData)
{
m_siteIdenEntry = entry;
m_grpVchNo = m_siteData.channelNo();
}
/// <summary>
/// Initializes a new instance of the TDULC class.
/// </summary>
/// <param name="siteData"></param>
/// <param name="entry"></param>
/// <param name="verbose"></param>
TDULC::TDULC(SiteData siteData, ::lookups::IdenTable entry, bool verbose) : TDULC(siteData)
{
m_verbose = verbose;
m_siteIdenEntry = entry;
m_grpVchNo = m_siteData.channelNo();
}
/// <summary>
/// Initializes a new instance of the TDULC class.
/// </summary>
/// <param name="lc"></param>
TDULC::TDULC(LC* lc) : TDULC(lc->siteData())
TDULC::TDULC(LC* lc) : TDULC()
{
m_protect = lc->m_protect;
m_lco = lc->m_lco;
@ -101,6 +86,32 @@ TDULC::TDULC(LC* lc) : TDULC(lc->siteData())
m_callTimer = lc->m_callTimer;
}
/// <summary>
/// Initializes a new instance of the TDULC class.
/// </summary>
TDULC::TDULC() :
m_protect(false),
m_lco(LC_GROUP),
m_mfId(P25_MFG_STANDARD),
m_srcId(0U),
m_dstId(0U),
m_grpVchNo(0U),
m_adjCFVA(P25_CFVA_FAILURE),
m_adjRfssId(0U),
m_adjSiteId(0U),
m_adjChannelId(0U),
m_adjChannelNo(0U),
m_adjServiceClass(P25_SVC_CLS_INVALID),
m_emergency(false),
m_encrypted(false),
m_priority(4U),
m_group(true),
m_rs(),
m_callTimer(0U)
{
m_grpVchNo = m_siteData.channelNo();
}
/// <summary>
/// Finalizes a instance of TDULC class.
/// </summary>
@ -207,45 +218,6 @@ void TDULC::encode(uint8_t * data)
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the TDULC class.
/// </summary>
/// <remarks>This should never be used.</remarks>
TDULC::TDULC() : TDULC(SiteData())
{
/* stub */
}
/// <summary>
/// Initializes a new instance of the TDULC class.
/// </summary>
/// <param name="siteData"></param>
TDULC::TDULC(SiteData siteData) :
m_verbose(false),
m_protect(false),
m_lco(LC_GROUP),
m_mfId(P25_MFG_STANDARD),
m_srcId(0U),
m_dstId(0U),
m_grpVchNo(0U),
m_adjCFVA(P25_CFVA_FAILURE),
m_adjRfssId(0U),
m_adjSiteId(0U),
m_adjChannelId(0U),
m_adjChannelNo(0U),
m_adjServiceClass(P25_SVC_CLS_INVALID),
m_emergency(false),
m_encrypted(false),
m_priority(4U),
m_group(true),
m_siteData(siteData),
m_siteIdenEntry(),
m_rs(),
m_callTimer(0U)
{
m_grpVchNo = m_siteData.channelNo();
}
/// <summary>
/// Internal helper to copy the the class.
/// </summary>

@ -57,11 +57,9 @@ namespace p25
/// <summary>Initializes a copy instance of the TDULC class.</summary>
TDULC(const TDULC& data);
/// <summary>Initializes a new instance of the TDULC class.</summary>
TDULC(SiteData siteData, ::lookups::IdenTable entry);
/// <summary>Initializes a new instance of the TDULC class.</summary>
TDULC(SiteData siteData, ::lookups::IdenTable entry, bool verbose);
/// <summary>Initializes a new instance of the TDULC class.</summary>
TDULC(LC* lc);
/// <summary>Initializes a new instance of the TDULC class.</summary>
TDULC();
/// <summary>Finalizes a instance of the TDULC class.</summary>
~TDULC();
@ -73,10 +71,20 @@ namespace p25
/// <summary>Encode a terminator data unit w/ link control.</summary>
void encode(uint8_t* data);
public:
/// <summary>Flag indicating verbose log output.</summary>
__PROPERTY(bool, verbose, Verbose);
/// <summary>Sets the flag indicating verbose log output.</summary>
static void setVerbose(bool verbose) { m_verbose = verbose; }
/** Local Site data */
/// <summary>Gets the local site data.</summary>
static SiteData getSiteData() { return m_siteData; }
/// <summary>Sets the local site data.</summary>
static void setSiteData(SiteData siteData) { m_siteData = siteData; }
/// <summary>Gets the local site identity entry.</summary>
static ::lookups::IdenTable getIdenEntry() { return m_siteIdenEntry; }
/// <summary>Sets the local site identity entry.</summary>
static void setIdenEntry(::lookups::IdenTable entry) { m_siteIdenEntry = entry; }
public:
/** Common Data */
/// <summary>Flag indicating the link control data is protected.</summary>
__PROPERTY(bool, protect, Protect);
@ -119,24 +127,19 @@ namespace p25
/// <summary>Flag indicating a group/talkgroup operation.</summary>
__PROPERTY(bool, group, Group);
/** Local Site data */
/// <summary>Local Site Data.</summary>
__PROPERTY_PLAIN(SiteData, siteData, siteData);
/// <summary>Local Site Identity Entry.</summary>
__PROPERTY_PLAIN(::lookups::IdenTable, siteIdenEntry, siteIdenEntry);
private:
/// <summary>Initializes a new instance of the TDULC class.</summary>
TDULC();
/// <summary>Initializes a new instance of the TDULC class.</summary>
TDULC(SiteData siteData);
protected:
friend class LC;
friend class TSBK;
edac::RS634717 m_rs;
uint32_t m_callTimer;
static bool m_verbose;
/** Local Site data */
static SiteData m_siteData;
static ::lookups::IdenTable m_siteIdenEntry;
/// <summary>Internal helper to copy the class.</summary>
void copy(const TDULC& data);

File diff suppressed because it is too large Load Diff

@ -7,7 +7,7 @@
*
*/
/*
* Copyright (C) 2017-2022 by Bryan Biedenkapp N2PLL
* 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
@ -27,8 +27,6 @@
#define __P25_LC__TSBK_H__
#include "Defines.h"
#include "p25/data/DataHeader.h"
#include "p25/data/DataBlock.h"
#include "p25/edac/Trellis.h"
#include "p25/lc/LC.h"
#include "p25/lc/TDULC.h"
@ -68,201 +66,106 @@ namespace p25
/// <summary>Initializes a copy instance of the TSBK class.</summary>
TSBK(const TSBK& data);
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK(SiteData siteData, ::lookups::IdenTable entry);
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK(SiteData siteData, ::lookups::IdenTable entry, bool verbose);
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK(SiteData siteData, ::lookups::IdenTable entry, bool verbose, bool warnCRC);
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK(LC* lc);
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK();
/// <summary>Finalizes a instance of the TSBK class.</summary>
~TSBK();
/// <summary>Equals operator.</summary>
TSBK& operator=(const TSBK& data);
/// <summary>Decode a alternate trunking signalling block.</summary>
bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
virtual ~TSBK();
/// <summary>Decode a trunking signalling block.</summary>
bool decode(const uint8_t* data, bool rawTSBK = false);
virtual bool decode(const uint8_t* data, bool rawTSBK = false) = 0;
/// <summary>Encode a trunking signalling block.</summary>
void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false) = 0;
/// <summary>Sets the flag to skip vendor opcode processing.</summary>
void setVendorSkip(bool skip);
/// <summary>Sets the flag indicating verbose log output.</summary>
static void setVerbose(bool verbose) { m_verbose = verbose; }
/// <summary>Sets the flag indicating CRC-errors should be warnings and not errors.</summary>
static void setWarnCRC(bool warnCRC) { m_warnCRC = warnCRC; }
/** Local Site data */
/// <summary>Sets the callsign.</summary>
void setCallsign(std::string callsign);
/** Authentication data */
/// <summary>Gets the authentication result.</summary>
void getAuthRes(uint8_t* res) const;
static void setCallsign(std::string callsign);
/// <summary>Sets the authentication random seed.</summary>
void setAuthRS(const uint8_t* rs);
/// <summary>Gets the authentication random seed.</summary>
void getAuthRS(uint8_t* rs) const;
/// <summary>Sets the authentication random challenge.</summary>
void setAuthRC(const uint8_t* rc);
/// <summary>Gets the authentication random challenge.</summary>
void getAuthRC(uint8_t* rc) const;
/// <summary>Gets the local site data.</summary>
static SiteData getSiteData() { return m_siteData; }
/// <summary>Sets the local site data.</summary>
static void setSiteData(SiteData siteData) { m_siteData = siteData; }
public:
/// <summary>Flag indicating verbose log output.</summary>
__PROPERTY(bool, verbose, Verbose);
/// <summary>Flag indicating CRC-errors should be warnings and not errors.</summary>
__PROPERTY(bool, warnCRC, WarnCRC);
/** Common Data */
/// <summary>Flag indicating the link control data is protected.</summary>
__PROPERTY(bool, protect, Protect);
__PROTECTED_PROPERTY(bool, protect, Protect);
/// <summary>Link control opcode.</summary>
__PROPERTY(uint8_t, lco, LCO);
__PROTECTED_PROPERTY(uint8_t, lco, LCO);
/// <summary>Manufacturer ID.</summary>
__PROPERTY(uint8_t, mfId, MFId);
__PROTECTED_PROPERTY(uint8_t, mfId, MFId);
/// <summary>Source ID.</summary>
__PROPERTY(uint32_t, srcId, SrcId);
__PROTECTED_PROPERTY(uint32_t, srcId, SrcId);
/// <summary>Destination ID.</summary>
__PROPERTY(uint32_t, dstId, DstId);
__PROTECTED_PROPERTY(uint32_t, dstId, DstId);
/// <summary>Flag indicating this is the last TSBK in a sequence of TSBKs.</summary>
__PROPERTY(bool, lastBlock, LastBlock);
__PROTECTED_PROPERTY(bool, lastBlock, LastBlock);
/// <summary>Flag indicating this TSBK contains additional information.</summary>
__PROPERTY(bool, aivFlag, AIV);
__PROTECTED_PROPERTY(bool, aivFlag, AIV);
/// <summary>Flag indicating this TSBK contains extended addressing.</summary>
__PROPERTY(bool, extendedAddrFlag, EX);
__PROTECTED_PROPERTY(bool, extendedAddrFlag, EX);
/// <summary>Service type.</summary>
__PROPERTY(uint8_t, service, Service);
__PROTECTED_PROPERTY(uint8_t, service, Service);
/// <summary>Response type.</summary>
__PROPERTY(uint8_t, response, Response);
__PROTECTED_PROPERTY(uint8_t, response, Response);
/// <summary>Configured network ID.</summary>
__READONLY_PROPERTY(uint32_t, netId, NetId);
__PROTECTED_READONLY_PROPERTY(uint32_t, netId, NetId);
/// <summary>Configured system ID.</summary>
__READONLY_PROPERTY(uint32_t, sysId, SysId);
__PROTECTED_READONLY_PROPERTY(uint32_t, sysId, SysId);
/// <summary>Voice channel ID.</summary>
__PROPERTY(uint32_t, grpVchId, GrpVchId);
__PROTECTED_PROPERTY(uint32_t, grpVchId, GrpVchId);
/// <summary>Voice channel number.</summary>
__PROPERTY(uint32_t, grpVchNo, GrpVchNo);
/// <summary>Message value.</summary>
__PROPERTY(uint32_t, messageValue, Message);
/// <summary>Status value.</summary>
__PROPERTY(uint8_t, statusValue, Status);
/// <summary>Extended function opcode.</summary>
__PROPERTY(uint32_t, extendedFunction, ExtendedFunction);
/// <summary>Microslot count.</summary>
__PROPERTY(uint16_t, microslotCount, MicroslotCount);
__PROTECTED_PROPERTY(uint32_t, grpVchNo, GrpVchNo);
/** SNDCP Channel Request */
/// <summary>SNDCP Data Service Options</summary>
__PROPERTY(uint8_t, dataServiceOptions, DataServiceOptions);
/// <summary>SNDCP Data Access Control</summary>
__PROPERTY(uint32_t, dataAccessControl, DataAccessControl);
/// <summary>SNDCP grant channel number.</summary>
__PROPERTY(uint32_t, dataChannelNo, DataChnNo);
/** Adjacent Site Data */
/// <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);
/** SCCB Data */
/// <summary>SCCB channel ID 1.</summary>
__PROPERTY(uint8_t, sccbChannelId1, SCCBChnId1);
/// <summary>SCCB channel ID 2.</summary>
__PROPERTY(uint8_t, sccbChannelId2, SCCBChnId2);
/// <summary>Explicit SCCB channel number.</summary>
__PROPERTY(uint32_t, sccbChannelNo, SCCBChnNo);
/** Location Data */
/// <summary>Location registration area.</summary>
__PROPERTY(uint8_t, lra, LRA);
/** Patch Group data */
/// <summary>Patch super group ID.</summary>
__PROPERTY(uint32_t, patchSuperGroupId, PatchSuperGroupId);
/// <summary>1st patch group ID.</summary>
__PROPERTY(uint32_t, patchGroup1Id, PatchGroup1Id);
/// <summary>2nd patch group ID.</summary>
__PROPERTY(uint32_t, patchGroup2Id, PatchGroup2Id);
/// <summary>3rd patch group ID.</summary>
__PROPERTY(uint32_t, patchGroup3Id, PatchGroup3Id);
/** Service Options */
/** Common Service Options */
/// <summary>Flag indicating the emergency bits are set.</summary>
__PROPERTY(bool, emergency, Emergency);
__PROTECTED_PROPERTY(bool, emergency, Emergency);
/// <summary>Flag indicating that encryption is enabled.</summary>
__PROPERTY(bool, encrypted, Encrypted);
__PROTECTED_PROPERTY(bool, encrypted, Encrypted);
/// <summary>Priority level for the traffic.</summary>
__PROPERTY(uint8_t, priority, Priority);
__PROTECTED_PROPERTY(uint8_t, priority, Priority);
/// <summary>Flag indicating a group/talkgroup operation.</summary>
__PROPERTY(bool, group, Group);
/** Radio Unit Monitor */
/// <summary>Radio Unit Monitor.</summary>
__PROPERTY(uint8_t, txMult, TxMult);
/** Authentication Handshake */
/// <summary>Flag indicating authentication was successful.</summary>
__PROPERTY(bool, authSuccess, AuthSuccess);
/// <summary>Flag indicating authentication is standalone.</summary>
__PROPERTY(bool, authStandalone, AuthStandalone);
__PROTECTED_PROPERTY(bool, group, Group);
/** Local Site data */
/// <summary>Local Site Data.</summary>
__PROPERTY_PLAIN(SiteData, siteData, siteData);
/// <summary>Local Site Identity Entry.</summary>
__PROPERTY_PLAIN(::lookups::IdenTable, siteIdenEntry, siteIdenEntry);
private:
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK();
/// <summary>Initializes a new instance of the TSBK class.</summary>
TSBK(SiteData siteData);
__PROTECTED_PROPERTY_PLAIN(::lookups::IdenTable, siteIdenEntry, siteIdenEntry);
protected:
friend class dfsi::LC;
friend class LC;
friend class TDULC;
edac::RS634717 m_rs;
edac::Trellis m_trellis;
bool m_vendorSkip;
bool m_sndcpAutoAccess;
bool m_sndcpReqAccess;
uint16_t m_sndcpDAC;
/** Authentication data */
uint8_t* m_authRes;
uint8_t* m_authRS;
uint8_t* m_authRC;
static bool m_verbose;
static bool m_warnCRC;
/** Local Site data */
uint8_t* m_siteCallsign;
static uint8_t* m_siteCallsign;
static SiteData m_siteData;
/// <summary>Internal helper to convert TSBK bytes to a 64-bit long value.</summary>
static ulong64_t tsbkValue(const uint8_t* tsbk);
/// <summary>Internal helper to convert a 64-bit long value to TSBK bytes.</summary>
static uint8_t* tsbkValue(const ulong64_t tsbkValue);
/// <summary>Internal helper to decode a trunking signalling block.</summary>
bool decode(const uint8_t* data, uint8_t* tsbk, bool rawTSBK = false);
/// <summary>Internal helper to encode a trunking signalling block.</summary>
void encode(uint8_t* data, const uint8_t* tsbk, bool rawTSBK = false, bool noTrellis = false);
/// <summary>Internal helper to copy the class.</summary>
void copy(const TSBK& data);
__PROTECTED_COPY(TSBK);
};
} // namespace lc
} // namespace p25

@ -0,0 +1,104 @@
/**
* 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/tsbk/IOSP_ACK_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_ACK_RSP class.
/// </summary>
IOSP_ACK_RSP::IOSP_ACK_RSP() : TSBK()
{
m_lco = TSBK_IOSP_ACK_RSP;
}
/// <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 IOSP_ACK_RSP::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_aivFlag = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Additional Info. Flag
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 IOSP_ACK_RSP::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (m_service & 0x3F); // Service Type
tsbkValue |= (m_aivFlag) ? 0x80U : 0x00U; // Additional Info. Valid Flag
tsbkValue |= (m_extendedAddrFlag) ? 0x40U : 0x00U; // Extended Addressing Flag
if (m_aivFlag && m_extendedAddrFlag) {
tsbkValue = (tsbkValue << 20) + m_siteData.netId(); // Network ID
tsbkValue = (tsbkValue << 12) + m_siteData.sysId(); // System ID
}
else {
tsbkValue = (tsbkValue << 32) + m_dstId; // Target Radio Address
}
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -0,0 +1,58 @@
/**
* 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__IOSP_ACK_RSP_H__)
#define __P25_LC_TSBK__IOSP_ACK_RSP_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements ACK RSP U - Acknowledge Response - Unit (ISP) and
// ACK RSP FNE - Acknowledge Response - FNE (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_ACK_RSP : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_ACK_RSP class.</summary>
IOSP_ACK_RSP();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_ACK_RSP_H__

@ -0,0 +1,93 @@
/**
* 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/tsbk/IOSP_CALL_ALRT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_CALL_ALRT class.
/// </summary>
IOSP_CALL_ALRT::IOSP_CALL_ALRT() : TSBK()
{
m_lco = TSBK_IOSP_CALL_ALRT;
}
/// <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 IOSP_CALL_ALRT::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 IOSP_CALL_ALRT::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 40) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -0,0 +1,58 @@
/**
* 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__IOSP_CALL_ALRT_H__)
#define __P25_LC_TSBK__IOSP_CALL_ALRT_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements CALL ALRT REQ - Call Alert Request (ISP) and
// CALL ALRT - Call Alert (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_CALL_ALRT : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_CALL_ALRT class.</summary>
IOSP_CALL_ALRT();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_CALL_ALRT_H__

@ -0,0 +1,111 @@
/**
* 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/tsbk/IOSP_EXT_FNCT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_EXT_FNCT class.
/// </summary>
IOSP_EXT_FNCT::IOSP_EXT_FNCT() : TSBK(),
m_extendedFunction(P25_EXT_FNCT_CHECK)
{
m_lco = TSBK_IOSP_EXT_FNCT;
}
/// <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 IOSP_EXT_FNCT::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_extendedFunction = (uint32_t)((tsbkValue >> 48) & 0xFFFFU); // Extended Function
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Argument
m_srcId = (uint32_t)(tsbkValue & 0xFFFFFFU); // Target Radio Address
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void IOSP_EXT_FNCT::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 16) + m_extendedFunction; // Extended Function
tsbkValue = (tsbkValue << 24) + m_srcId; // Argument
tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void IOSP_EXT_FNCT::copy(const IOSP_EXT_FNCT& data)
{
TSBK::copy(data);
m_extendedFunction = data.m_extendedFunction;
}

@ -0,0 +1,64 @@
/**
* 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__IOSP_EXT_FNCT_H__)
#define __P25_LC_TSBK__IOSP_EXT_FNCT_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements EXT FNCT RSP - Extended Function Response (ISP) and
// EXT FNCT CMD - Extended Function Command (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_EXT_FNCT : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_EXT_FNCT class.</summary>
IOSP_EXT_FNCT();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Extended function opcode.</summary>
__PROPERTY(uint32_t, extendedFunction, ExtendedFunction);
__COPY(IOSP_EXT_FNCT);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_EXT_FNCT_H__

@ -0,0 +1,113 @@
/**
* 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/tsbk/IOSP_GRP_AFF.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_GRP_AFF class.
/// </summary>
IOSP_GRP_AFF::IOSP_GRP_AFF() : TSBK(),
m_announceGroup(P25_WUID_ALL)
{
m_lco = TSBK_IOSP_GRP_AFF;
}
/// <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 IOSP_GRP_AFF::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_sysId = (uint32_t)((tsbkValue >> 40) & 0xFFFU); // System ID
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Talkgroup Address
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 IOSP_GRP_AFF::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = 1U; // Local/Global Affiliation Flag (0 = Local, 1 = Global)
tsbkValue = (tsbkValue << 7) + (m_response & 0x3U); // Affiliation Response
tsbkValue = (tsbkValue << 16) + (m_announceGroup & 0xFFFFU); // Announcement Group Address
tsbkValue = (tsbkValue << 16) + (m_dstId & 0xFFFFU); // Talkgroup Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void IOSP_GRP_AFF::copy(const IOSP_GRP_AFF& data)
{
TSBK::copy(data);
m_announceGroup = data.m_announceGroup;
}

@ -0,0 +1,64 @@
/**
* 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__IOSP_GRP_AFF_H__)
#define __P25_LC_TSBK__IOSP_GRP_AFF_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements GRP AFF REQ - Group Affiliation Request (ISP) and
// GRP AFF RSP - Group Affiliation Response (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_GRP_AFF : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_GRP_AFF class.</summary>
IOSP_GRP_AFF();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Announcement group.</summary>
__PROPERTY(uint32_t, announceGroup, AnnounceGroup);
__COPY(IOSP_GRP_AFF);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_GRP_AFF_H__

@ -0,0 +1,104 @@
/**
* 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/tsbk/IOSP_GRP_VCH.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_GRP_VCH class.
/// </summary>
IOSP_GRP_VCH::IOSP_GRP_VCH() : TSBK()
{
m_lco = TSBK_IOSP_GRP_VCH;
}
/// <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 IOSP_GRP_VCH::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_emergency = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Emergency Flag
m_encrypted = (((tsbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Encryption Flag
m_priority = (((tsbkValue >> 56) & 0xFFU) & 0x07U); // Priority
m_grpVchId = ((tsbkValue >> 52) & 0x0FU); // Channel ID
m_grpVchNo = ((tsbkValue >> 40) & 0xFFFU); // Channel Number
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Target Radio Address
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 IOSP_GRP_VCH::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue =
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
(m_priority & 0x07U); // Priority
tsbkValue = (tsbkValue << 4) + m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_grpVchNo; // Channel Number
tsbkValue = (tsbkValue << 16) + m_dstId; // Talkgroup Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -0,0 +1,58 @@
/**
* 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__IOSP_GRP_VCH_H__)
#define __P25_LC_TSBK__IOSP_GRP_VCH_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements GRP VCH REQ - Group Voice Channel Request (ISP) and
// GRP VCH GRANT - Group Voice Channel Grant (OSP).
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_GRP_VCH : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_GRP_VCH class.</summary>
IOSP_GRP_VCH();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_GRP_VCH_H__

@ -0,0 +1,111 @@
/**
* 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/tsbk/IOSP_MSG_UPDT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_MSG_UPDT class.
/// </summary>
IOSP_MSG_UPDT::IOSP_MSG_UPDT() : TSBK(),
m_messageValue(0U)
{
m_lco = TSBK_IOSP_MSG_UPDT;
}
/// <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 IOSP_MSG_UPDT::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_messageValue = (uint8_t)((tsbkValue >> 56) & 0xFFU); // Message Value
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 IOSP_MSG_UPDT::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 16) + m_messageValue; // Message Value
tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void IOSP_MSG_UPDT::copy(const IOSP_MSG_UPDT& data)
{
TSBK::copy(data);
m_messageValue = data.m_messageValue;
}

@ -0,0 +1,64 @@
/**
* 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__IOSP_MSG_UPDT_H__)
#define __P25_LC_TSBK__IOSP_MSG_UPDT_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements MSG UPDT REQ - Message Update Request (ISP) and
// MSG UPDT - Message Update (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_MSG_UPDT : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_MSG_UPDT class.</summary>
IOSP_MSG_UPDT();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Status value.</summary>
__PROPERTY(uint8_t, messageValue, Message);
__COPY(IOSP_MSG_UPDT);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_MSG_UPDT_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
* Copyright (C) 2022 by Jason- UWU - TIME_DATE_ANN & RAD_MON_CMD
*
* 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/tsbk/IOSP_RAD_MON.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_RAD_MON class.
/// </summary>
IOSP_RAD_MON::IOSP_RAD_MON() : TSBK(),
m_txMult(0U)
{
m_lco = TSBK_IOSP_RAD_MON;
}
/// <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 IOSP_RAD_MON::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_txMult = (uint8_t)((tsbkValue >> 48) & 0x3U); // TX Multiplier
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 IOSP_RAD_MON::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 48) + (m_txMult & 0x3U); // TX Multiplier
tsbkValue = (tsbkValue << 24) + (m_srcId & 0xFFFFFFU); // Source Radio Address
tsbkValue = tsbkValue + (m_dstId & 0xFFFFFFU); // Target Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void IOSP_RAD_MON::copy(const IOSP_RAD_MON& data)
{
TSBK::copy(data);
m_txMult = data.m_txMult;
}

@ -0,0 +1,65 @@
/**
* 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
* Copyright (C) 2022 by Jason- UWU - TIME_DATE_ANN & RAD_MON_CMD
*
* 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__IOSP_RAD_MON_H__)
#define __P25_LC_TSBK__IOSP_RAD_MON_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements RAD MON REQ - Radio Unit Monitor Request (ISP) and
// RAD MON CMD - Radio Monitor Command (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_RAD_MON : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_RAD_MON class.</summary>
IOSP_RAD_MON();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Radio Unit Monitor.</summary>
__PROPERTY(uint8_t, txMult, TxMult);
__COPY(IOSP_RAD_MON);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_RAD_MON_H__

@ -0,0 +1,111 @@
/**
* 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/tsbk/IOSP_STS_UPDT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_STS_UPDT class.
/// </summary>
IOSP_STS_UPDT::IOSP_STS_UPDT() : TSBK(),
m_statusValue(0U)
{
m_lco = TSBK_IOSP_STS_UPDT;
}
/// <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 IOSP_STS_UPDT::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_statusValue = (uint8_t)((tsbkValue >> 56) & 0xFFU); // Status Value
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 IOSP_STS_UPDT::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 16) + m_statusValue; // Status Value
tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void IOSP_STS_UPDT::copy(const IOSP_STS_UPDT& data)
{
TSBK::copy(data);
m_statusValue = data.m_statusValue;
}

@ -0,0 +1,64 @@
/**
* 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__IOSP_STS_UPDT_H__)
#define __P25_LC_TSBK__IOSP_STS_UPDT_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements STS UPDT REQ - Status Update Request (ISP) and
// STS UPDT - Status Update (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_STS_UPDT : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_STS_UPDT class.</summary>
IOSP_STS_UPDT();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Status value.</summary>
__PROPERTY(uint8_t, statusValue, Status);
__COPY(IOSP_STS_UPDT);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_STS_UPDT_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/tsbk/IOSP_UU_ANS.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_UU_ANS class.
/// </summary>
IOSP_UU_ANS::IOSP_UU_ANS() : TSBK()
{
m_lco = TSBK_IOSP_UU_ANS;
}
/// <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 IOSP_UU_ANS::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_emergency = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Emergency Flag
m_encrypted = (((tsbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Encryption Flag
m_priority = (((tsbkValue >> 56) & 0xFFU) & 0x07U); // Priority
m_response = (uint8_t)((tsbkValue >> 48) & 0xFFU); // Answer Response
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 IOSP_UU_ANS::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue =
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
(m_priority & 0x07U); // Priority
tsbkValue = (tsbkValue << 32) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -0,0 +1,61 @@
/**
* 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__IOSP_UU_ANS_H__)
#define __P25_LC_TSBK__IOSP_UU_ANS_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements UU ANS RSP - Unit-to-Unit Answer Response (ISP) and
// UU ANS REQ - Unit-to-Unit Answer Request (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_UU_ANS : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_UU_ANS class.</summary>
IOSP_UU_ANS();
/// <summary>Equals operator.</summary>
IOSP_UU_ANS& operator=(const IOSP_UU_ANS& data);
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_UU_ANS_H__

@ -0,0 +1,104 @@
/**
* 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/tsbk/IOSP_UU_VCH.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_UU_VCH class.
/// </summary>
IOSP_UU_VCH::IOSP_UU_VCH() : TSBK()
{
m_lco = TSBK_IOSP_UU_VCH;
}
/// <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 IOSP_UU_VCH::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_emergency = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Emergency Flag
m_encrypted = (((tsbkValue >> 56) & 0xFFU) & 0x40U) == 0x40U; // Encryption Flag
m_priority = (((tsbkValue >> 56) & 0xFFU) & 0x07U); // Priority
m_grpVchId = ((tsbkValue >> 52) & 0x0FU); // Channel ID
m_grpVchNo = ((tsbkValue >> 40) & 0xFFFU); // Channel Number
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Target Radio Address
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 IOSP_UU_VCH::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue =
(m_emergency ? 0x80U : 0x00U) + // Emergency Flag
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
(m_priority & 0x07U); // Priority
tsbkValue = (tsbkValue << 4) + m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_grpVchNo; // Channel Number
tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -0,0 +1,58 @@
/**
* 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__IOSP_UU_VCH_H__)
#define __P25_LC_TSBK__IOSP_UU_VCH_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements UU VCH REQ - Unit-to-Unit Voice Channel Request (ISP) and
// UU VCH GRANT - Unit-to-Unit Voice Channel Grant (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_UU_VCH : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_UU_VCH class.</summary>
IOSP_UU_VCH();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_UU_VCH_H__

@ -0,0 +1,96 @@
/**
* 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/tsbk/IOSP_U_REG.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the IOSP_U_REG class.
/// </summary>
IOSP_U_REG::IOSP_U_REG() : TSBK()
{
m_lco = TSBK_IOSP_U_REG;
}
/// <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 IOSP_U_REG::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_netId = (uint32_t)((tsbkValue >> 36) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 24) & 0xFFFU); // System ID
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 IOSP_U_REG::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 2) + (m_response & 0x3U); // Unit Registration Response
tsbkValue = (tsbkValue << 12) + m_siteData.sysId(); // System ID
tsbkValue = (tsbkValue << 24) + m_dstId; // Source ID
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -0,0 +1,58 @@
/**
* 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__IOSP_U_REG_H__)
#define __P25_LC_TSBK__IOSP_U_REG_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements U REG REQ - Unit Registration Request (ISP) and
// U REG RSP - Unit Registration Response (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API IOSP_U_REG : public TSBK {
public:
/// <summary>Initializes a new instance of the IOSP_U_REG class.</summary>
IOSP_U_REG();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__IOSP_U_REG_H__

@ -0,0 +1,105 @@
/**
* 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/tsbk/ISP_AUTH_FNE_RST.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_AUTH_FNE_RST class.
/// </summary>
ISP_AUTH_FNE_RST::ISP_AUTH_FNE_RST() : TSBK(),
m_authSuccess(false),
m_authStandalone(false)
{
m_lco = TSBK_ISP_AUTH_FNE_RST;
}
/// <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_AUTH_FNE_RST::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_authSuccess = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Authentication Success Flag
m_authStandalone = (((tsbkValue >> 56) & 0xFFU) & 0x01U) == 0x01U; // Authentication Standalone Flag
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_AUTH_FNE_RST::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
/* stub */
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void ISP_AUTH_FNE_RST::copy(const ISP_AUTH_FNE_RST& data)
{
TSBK::copy(data);
m_authSuccess = data.m_authSuccess;
m_authStandalone = data.m_authStandalone;
}

@ -0,0 +1,65 @@
/**
* 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__ISP_AUTH_FNE_RST_H__)
#define __P25_LC_TSBK__ISP_AUTH_FNE_RST_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH FNE RST - Authentication FNE Result
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_AUTH_FNE_RST : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_AUTH_FNE_RST class.</summary>
ISP_AUTH_FNE_RST();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Flag indicating authentication was successful.</summary>
__PROPERTY(bool, authSuccess, AuthSuccess);
/// <summary>Flag indicating authentication is standalone.</summary>
__PROPERTY(bool, authStandalone, AuthStandalone);
__COPY(ISP_AUTH_FNE_RST);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_AUTH_FNE_RST_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/tsbk/ISP_AUTH_RESP.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_AUTH_RESP class.
/// </summary>
ISP_AUTH_RESP::ISP_AUTH_RESP() : TSBK(),
m_authStandalone(false),
m_authRes(NULL)
{
m_lco = TSBK_ISP_AUTH_RESP;
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memset(m_authRes, 0x00U, P25_AUTH_RES_LENGTH_BYTES);
}
/// <summary>
/// Finalizes a instance of ISP_AUTH_RESP class.
/// </summary>
ISP_AUTH_RESP::~ISP_AUTH_RESP()
{
if (m_authRes != NULL) {
delete[] m_authRes;
m_authRes = NULL;
}
}
/// <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_AUTH_RESP::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_aivFlag = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Additional Info. Flag
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_response = (uint8_t)((tsbkValue >> 48) & 0xFFU); // Reason
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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_AUTH_RESP::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
/* stub */
}
/// <summary>Gets the authentication result.</summary>
/// <returns></returns>
void ISP_AUTH_RESP::getAuthRes(uint8_t* res) const
{
assert(res != NULL);
::memcpy(res, m_authRes, P25_AUTH_RES_LENGTH_BYTES);
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void ISP_AUTH_RESP::copy(const ISP_AUTH_RESP& data)
{
TSBK::copy(data);
m_authStandalone = data.m_authStandalone;
if (m_authRes != NULL) {
delete[] m_authRes;
}
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memcpy(m_authRes, data.m_authRes, P25_AUTH_RES_LENGTH_BYTES);
}

@ -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(__P25_LC_TSBK__ISP_AUTH_RESP_H__)
#define __P25_LC_TSBK__ISP_AUTH_RESP_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH RESP - Authentication Response
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_AUTH_RESP : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_AUTH_RESP class.</summary>
ISP_AUTH_RESP();
/// <summary>Finalizes a instance of the ISP_AUTH_RESP class.</summary>
~ISP_AUTH_RESP();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
/** Authentication data */
/// <summary>Gets the authentication result.</summary>
void getAuthRes(uint8_t* res) const;
public:
/// <summary>Flag indicating authentication is standalone.</summary>
__PROPERTY(bool, authStandalone, AuthStandalone);
private:
/** Authentication data */
uint8_t* m_authRes;
__COPY(ISP_AUTH_RESP);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_AUTH_RESP_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/tsbk/ISP_AUTH_SU_DMD.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_AUTH_SU_DMD class.
/// </summary>
ISP_AUTH_SU_DMD::ISP_AUTH_SU_DMD() : TSBK()
{
m_lco = TSBK_ISP_AUTH_SU_DMD;
}
/// <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_AUTH_SU_DMD::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
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_AUTH_SU_DMD::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
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(__P25_LC_TSBK__ISP_AUTH_SU_DMD_H__)
#define __P25_LC_TSBK__ISP_AUTH_SU_DMD_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH SU DMD - Authentication SU Demand
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_AUTH_SU_DMD : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_AUTH_SU_DMD class.</summary>
ISP_AUTH_SU_DMD();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_AUTH_SU_DMD_H__

@ -0,0 +1,89 @@
/**
* 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/tsbk/ISP_CAN_SRV_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_CAN_SRV_REQ class.
/// </summary>
ISP_CAN_SRV_REQ::ISP_CAN_SRV_REQ() : TSBK()
{
m_lco = TSBK_ISP_CAN_SRV_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_CAN_SRV_REQ::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_aivFlag = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Additional Info. Flag
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_response = (uint8_t)((tsbkValue >> 48) & 0xFFU); // Reason
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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_CAN_SRV_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
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(__P25_LC_TSBK__ISP_CAN_SRV_REQ_H__)
#define __P25_LC_TSBK__ISP_CAN_SRV_REQ_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements CAN SRV REQ - Cancel Service Request
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_CAN_SRV_REQ : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_CAN_SRV_REQ class.</summary>
ISP_CAN_SRV_REQ();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_CAN_SRV_REQ_H__

@ -0,0 +1,100 @@
/**
* 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/tsbk/ISP_EMERG_ALRM_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_EMERG_ALRM_REQ class.
/// </summary>
ISP_EMERG_ALRM_REQ::ISP_EMERG_ALRM_REQ() : TSBK()
{
m_lco = TSBK_ISP_EMERG_ALRM_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_EMERG_ALRM_REQ::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
/*
** bryanb: this is a bit of a hack -- because the EMERG ALRM and DENY have the same
** opcode; the following are used by TSBK_OSP_DENY_RSP; best way to check is for m_response > 0
*/
m_aivFlag = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Additional Info. Flag
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_response = (uint8_t)((tsbkValue >> 48) & 0xFFU); // Reason
if (m_response == 0U) {
m_emergency = true;
} else {
m_emergency = false;
}
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Target Radio Address
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_EMERG_ALRM_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
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(__P25_LC_TSBK__ISP_EMERG_ALRM_REQ_H__)
#define __P25_LC_TSBK__ISP_EMERG_ALRM_REQ_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements EMERG ALRM REQ - Emergency Alarm Request
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_EMERG_ALRM_REQ : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_EMERG_ALRM_REQ class.</summary>
ISP_EMERG_ALRM_REQ();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_EMERG_ALRM_REQ_H__

@ -0,0 +1,103 @@
/**
* 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/tsbk/ISP_GRP_AFF_Q_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_GRP_AFF_Q_RSP class.
/// </summary>
ISP_GRP_AFF_Q_RSP::ISP_GRP_AFF_Q_RSP() : TSBK(),
m_announceGroup(P25_WUID_ALL)
{
m_lco = TSBK_ISP_GRP_AFF_Q_RSP;
}
/// <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_GRP_AFF_Q_RSP::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_announceGroup = (uint32_t)((tsbkValue >> 40) & 0xFFFFU); // Announcement Group Address
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Talkgroup Address
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_GRP_AFF_Q_RSP::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
/* stub */
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void ISP_GRP_AFF_Q_RSP::copy(const ISP_GRP_AFF_Q_RSP& data)
{
TSBK::copy(data);
m_announceGroup = data.m_announceGroup;
}

@ -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(__P25_LC_TSBK__ISP_GRP_AFF_Q_RSP_H__)
#define __P25_LC_TSBK__ISP_GRP_AFF_Q_RSP_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements GRP AFF Q RSP - Group Affiliation Query Response
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_GRP_AFF_Q_RSP : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_GRP_AFF_Q_RSP class.</summary>
ISP_GRP_AFF_Q_RSP();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Announcement group.</summary>
__PROPERTY(uint32_t, announceGroup, AnnounceGroup);
__COPY(ISP_GRP_AFF_Q_RSP);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_GRP_AFF_Q_RSP_H__

@ -0,0 +1,103 @@
/**
* 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/tsbk/ISP_LOC_REG_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_LOC_REG_REQ class.
/// </summary>
ISP_LOC_REG_REQ::ISP_LOC_REG_REQ() : TSBK(),
m_lra(0U)
{
m_lco = TSBK_ISP_LOC_REG_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_LOC_REG_REQ::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_lra = (uint8_t)((tsbkValue >> 40) & 0xFFU); // LRA
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Talkgroup Address
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_LOC_REG_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
/* stub */
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void ISP_LOC_REG_REQ::copy(const ISP_LOC_REG_REQ& data)
{
TSBK::copy(data);
m_lra = data.m_lra;
}

@ -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(__P25_LC_TSBK__ISP_LOC_REG_REQ_H__)
#define __P25_LC_TSBK__ISP_LOC_REG_REQ_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements LOC REG REQ - Location Registration Request
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_LOC_REG_REQ : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_LOC_REG_REQ class.</summary>
ISP_LOC_REG_REQ();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <summary>Location registration area.</summary>
__PROPERTY(uint8_t, lra, LRA);
__COPY(ISP_LOC_REG_REQ);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_LOC_REG_REQ_H__

@ -0,0 +1,105 @@
/**
* 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/tsbk/ISP_SNDCP_CH_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_SNDCP_CH_REQ class.
/// </summary>
ISP_SNDCP_CH_REQ::ISP_SNDCP_CH_REQ() : TSBK(),
m_dataServiceOptions(0U),
m_dataAccessControl(0U)
{
m_lco = TSBK_ISP_SNDCP_CH_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_CH_REQ::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
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_CH_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
/* stub */
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void ISP_SNDCP_CH_REQ::copy(const ISP_SNDCP_CH_REQ& data)
{
TSBK::copy(data);
m_dataServiceOptions = data.m_dataServiceOptions;
m_dataAccessControl = data.m_dataAccessControl;
}

@ -0,0 +1,65 @@
/**
* 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__ISP_SNDCP_CH_REQ_H__)
#define __P25_LC_TSBK__ISP_SNDCP_CH_REQ_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements SNDCP CH REQ - SNDCP Data Channel Request (ISP).
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_SNDCP_CH_REQ : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_SNDCP_CH_REQ class.</summary>
ISP_SNDCP_CH_REQ();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/// <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_CH_REQ);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_SNDCP_CH_REQ_H__

@ -0,0 +1,87 @@
/**
* 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/tsbk/ISP_U_DEREG_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the ISP_U_DEREG_REQ class.
/// </summary>
ISP_U_DEREG_REQ::ISP_U_DEREG_REQ() : TSBK()
{
m_lco = TSBK_ISP_U_DEREG_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_U_DEREG_REQ::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_netId = (uint32_t)((tsbkValue >> 36) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 24) & 0xFFFU); // System ID
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_U_DEREG_REQ::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
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(__P25_LC_TSBK__ISP_U_DEREG_REQ_H__)
#define __P25_LC_TSBK__ISP_U_DEREG_REQ_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements U DE REG REQ - Unit De-Registration Request
// ---------------------------------------------------------------------------
class HOST_SW_API ISP_U_DEREG_REQ : public TSBK {
public:
/// <summary>Initializes a new instance of the ISP_U_DEREG_REQ class.</summary>
ISP_U_DEREG_REQ();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__ISP_U_DEREG_REQ_H__

@ -0,0 +1,91 @@
/**
* 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/tsbk/MBT_IOSP_ACK_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_IOSP_ACK_RSP class.
/// </summary>
MBT_IOSP_ACK_RSP::MBT_IOSP_ACK_RSP() : AMBT()
{
m_lco = TSBK_IOSP_ACK_RSP;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_IOSP_ACK_RSP::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_aivFlag = false;
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_netId = (uint32_t)((tsbkValue >> 36) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 24) & 0xFFFU); // System ID
m_dstId = (uint32_t)(tsbkValue & 0xFFFFFFU); // Target Radio Address
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_IOSP_ACK_RSP::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}

@ -0,0 +1,58 @@
/**
* 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__MBT_IOSP_ACK_RSP_H__)
#define __P25_LC_TSBK__MBT_IOSP_ACK_RSP_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements ACK RSP U - Acknowledge Response - Unit (ISP) and
// ACK RSP FNE - Acknowledge Response - FNE (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_IOSP_ACK_RSP : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_IOSP_ACK_RSP class.</summary>
MBT_IOSP_ACK_RSP();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_IOSP_ACK_RSP_H__

@ -0,0 +1,89 @@
/**
* 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/tsbk/MBT_IOSP_CALL_ALRT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_IOSP_CALL_ALRT class.
/// </summary>
MBT_IOSP_CALL_ALRT::MBT_IOSP_CALL_ALRT() : AMBT()
{
m_lco = TSBK_IOSP_CALL_ALRT;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_IOSP_CALL_ALRT::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_netId = (uint32_t)((tsbkValue >> 44) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 32) & 0xFFFU); // System ID
m_dstId = (uint32_t)((tsbkValue >> 8) & 0xFFFFFFU); // Target Radio Address
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_IOSP_CALL_ALRT::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}

@ -0,0 +1,58 @@
/**
* 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__MBT_IOSP_CALL_ALRT_H__)
#define __P25_LC_TSBK__MBT_IOSP_CALL_ALRT_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements CALL ALRT REQ - Call Alert Request (ISP) and
// CALL ALRT - Call Alert (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_IOSP_CALL_ALRT : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_IOSP_CALL_ALRT class.</summary>
MBT_IOSP_CALL_ALRT();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_IOSP_CALL_ALRT_H__

@ -0,0 +1,106 @@
/**
* 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/tsbk/MBT_IOSP_EXT_FNCT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_IOSP_EXT_FNCT class.
/// </summary>
MBT_IOSP_EXT_FNCT::MBT_IOSP_EXT_FNCT() : AMBT(),
m_extendedFunction(P25_EXT_FNCT_CHECK)
{
m_lco = TSBK_IOSP_EXT_FNCT;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_IOSP_EXT_FNCT::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_netId = (uint32_t)((tsbkValue >> 44) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 32) & 0xFFFU); // System ID
m_extendedFunction = (uint32_t)(((tsbkValue) & 0xFFFFU) << 8) + // Extended Function
pduUserData[6U];
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_IOSP_EXT_FNCT::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void MBT_IOSP_EXT_FNCT::copy(const MBT_IOSP_EXT_FNCT& data)
{
TSBK::copy(data);
m_extendedFunction = data.m_extendedFunction;
}

@ -0,0 +1,64 @@
/**
* 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__MBT_IOSP_EXT_FNCT_H__)
#define __P25_LC_TSBK__MBT_IOSP_EXT_FNCT_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements EXT FNCT RSP - Extended Function Response (ISP) and
// EXT FNCT CMD - Extended Function Command (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_IOSP_EXT_FNCT : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_IOSP_EXT_FNCT class.</summary>
MBT_IOSP_EXT_FNCT();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
public:
/// <summary>Extended function opcode.</summary>
__PROPERTY(uint32_t, extendedFunction, ExtendedFunction);
__COPY(MBT_IOSP_EXT_FNCT);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_IOSP_EXT_FNCT_H__

@ -0,0 +1,89 @@
/**
* 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/tsbk/MBT_IOSP_GRP_AFF.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_IOSP_GRP_AFF class.
/// </summary>
MBT_IOSP_GRP_AFF::MBT_IOSP_GRP_AFF() : AMBT()
{
m_lco = TSBK_IOSP_GRP_AFF;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_IOSP_GRP_AFF::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_netId = (uint32_t)((tsbkValue >> 44) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 32) & 0xFFFU); // System ID
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Talkgroup Address
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_IOSP_GRP_AFF::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}

@ -0,0 +1,58 @@
/**
* 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__MBT_IOSP_GRP_AFF_H__)
#define __P25_LC_TSBK__MBT_IOSP_GRP_AFF_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements GRP AFF REQ - Group Affiliation Request (ISP) and
// GRP AFF RSP - Group Affiliation Response (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_IOSP_GRP_AFF : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_IOSP_GRP_AFF class.</summary>
MBT_IOSP_GRP_AFF();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_IOSP_GRP_AFF_H__

@ -0,0 +1,106 @@
/**
* 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/tsbk/MBT_IOSP_MSG_UPDT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_IOSP_MSG_UPDT class.
/// </summary>
MBT_IOSP_MSG_UPDT::MBT_IOSP_MSG_UPDT() : AMBT(),
m_messageValue(0U)
{
m_lco = TSBK_IOSP_MSG_UPDT;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_IOSP_MSG_UPDT::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_messageValue = (uint8_t)((tsbkValue >> 48) & 0xFFFFU); // Message Value
m_netId = (uint32_t)((tsbkValue >> 28) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 16) & 0xFFFU); // System ID
m_dstId = (uint32_t)(((tsbkValue) & 0xFFFFU) << 8) + pduUserData[6U]; // Target Radio Address
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_IOSP_MSG_UPDT::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void MBT_IOSP_MSG_UPDT::copy(const MBT_IOSP_MSG_UPDT& data)
{
TSBK::copy(data);
m_messageValue = data.m_messageValue;
}

@ -0,0 +1,64 @@
/**
* 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__MBT_IOSP_MSG_UPDT_H__)
#define __P25_LC_TSBK__MBT_IOSP_MSG_UPDT_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements MSG UPDT REQ - Message Update Request (ISP) and
// MSG UPDT - Message Update (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_IOSP_MSG_UPDT : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_IOSP_MSG_UPDT class.</summary>
MBT_IOSP_MSG_UPDT();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
public:
/// <summary>Message value.</summary>
__PROPERTY(uint8_t, messageValue, Message);
__COPY(MBT_IOSP_MSG_UPDT);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_IOSP_MSG_UPDT_H__

@ -0,0 +1,106 @@
/**
* 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/tsbk/MBT_IOSP_STS_UPDT.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_IOSP_STS_UPDT class.
/// </summary>
MBT_IOSP_STS_UPDT::MBT_IOSP_STS_UPDT() : AMBT(),
m_statusValue(0U)
{
m_lco = TSBK_IOSP_STS_UPDT;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_IOSP_STS_UPDT::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_statusValue = (uint8_t)((tsbkValue >> 48) & 0xFFFFU); // Message Value
m_netId = (uint32_t)((tsbkValue >> 28) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 16) & 0xFFFU); // System ID
m_dstId = (uint32_t)(((tsbkValue) & 0xFFFFU) << 8) + pduUserData[6U]; // Target Radio Address
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_IOSP_STS_UPDT::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void MBT_IOSP_STS_UPDT::copy(const MBT_IOSP_STS_UPDT& data)
{
TSBK::copy(data);
m_statusValue = data.m_statusValue;
}

@ -0,0 +1,64 @@
/**
* 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__MBT_IOSP_STS_UPDT_H__)
#define __P25_LC_TSBK__MBT_IOSP_STS_UPDT_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements STS UPDT REQ - Status Update Request (ISP) and
// STS UPDT - Status Update (OSP)
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_IOSP_STS_UPDT : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_IOSP_STS_UPDT class.</summary>
MBT_IOSP_STS_UPDT();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
public:
/// <summary>Status value.</summary>
__PROPERTY(uint8_t, statusValue, Status);
__COPY(MBT_IOSP_STS_UPDT);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_IOSP_STS_UPDT_H__

@ -0,0 +1,184 @@
/**
* 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/tsbk/MBT_ISP_AUTH_RESP_M.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_ISP_AUTH_RESP_M class.
/// </summary>
MBT_ISP_AUTH_RESP_M::MBT_ISP_AUTH_RESP_M() : AMBT()
{
m_lco = TSBK_ISP_AUTH_RESP_M;
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memset(m_authRes, 0x00U, P25_AUTH_RES_LENGTH_BYTES);
m_authRC = new uint8_t[P25_AUTH_RAND_CHLNG_LENGTH_BYTES];
::memset(m_authRC, 0x00U, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}
/// <summary>
/// Finalizes a instance of MBT_ISP_AUTH_RESP_M class.
/// </summary>
MBT_ISP_AUTH_RESP_M::~MBT_ISP_AUTH_RESP_M()
{
if (m_authRes != NULL) {
delete[] m_authRes;
m_authRes = NULL;
}
if (m_authRC != NULL) {
delete[] m_authRC;
m_authRC = NULL;
}
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_ISP_AUTH_RESP_M::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
if (dataHeader.getBlocksToFollow() != 2) {
LogError(LOG_P25, "TSBK::decodeMBT(), PDU does not contain the appropriate amount of data blocks");
return false;
}
m_netId = (uint32_t)((tsbkValue >> 44) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 32) & 0xFFFU); // System ID
m_srcId = dataHeader.getLLId(); // Source Radio Address
/** Block 1 */
m_authRC[4U] = (uint8_t)pduUserData[5U] & 0xFFU; // Random Challenge b4
m_authRC[3U] = (uint8_t)pduUserData[6U] & 0xFFU; // Random Challenge b3
m_authRC[2U] = (uint8_t)pduUserData[7U] & 0xFFU; // Random Challenge b2
m_authRC[1U] = (uint8_t)pduUserData[8U] & 0xFFU; // Random Challenge b1
m_authRC[0U] = (uint8_t)pduUserData[9U] & 0xFFU; // Random Challenge b0
m_authRes[3U] = (uint8_t)pduUserData[10U] & 0xFFU; // Result b3
m_authRes[2U] = (uint8_t)pduUserData[11U] & 0xFFU; // Result b2
/** Block 2 */
m_authRes[1U] = (uint8_t)pduUserData[12U] & 0xFFU; // Result b1
m_authRes[0U] = (uint8_t)pduUserData[13U] & 0xFFU; // Result b0
m_authStandalone = ((pduUserData[14U] & 0xFFU) & 0x01U) == 0x01U; // Authentication Standalone Flag
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_ISP_AUTH_RESP_M::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}
/// <summary>Gets the authentication result.</summary>
/// <returns></returns>
void MBT_ISP_AUTH_RESP_M::getAuthRes(uint8_t* res) const
{
assert(res != NULL);
::memcpy(res, m_authRes, P25_AUTH_RES_LENGTH_BYTES);
}
/// <summary>Sets the authentication random challenge.</summary>
/// <param name="rc"></param>
void MBT_ISP_AUTH_RESP_M::setAuthRC(const uint8_t* rc)
{
assert(rc != NULL);
::memcpy(m_authRC, rc, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}
/// <summary>Gets the authentication random challenge.</summary>
/// <returns></returns>
void MBT_ISP_AUTH_RESP_M::getAuthRC(uint8_t* rc) const
{
assert(rc != NULL);
::memcpy(rc, m_authRC, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void MBT_ISP_AUTH_RESP_M::copy(const MBT_ISP_AUTH_RESP_M& data)
{
TSBK::copy(data);
m_authStandalone = data.m_authStandalone;
if (m_authRes != NULL) {
delete[] m_authRes;
}
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memcpy(m_authRes, data.m_authRes, P25_AUTH_RES_LENGTH_BYTES);
if (m_authRC != NULL) {
delete[] m_authRC;
}
m_authRC = new uint8_t[P25_AUTH_RAND_CHLNG_LENGTH_BYTES];
::memcpy(m_authRC, data.m_authRC, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}

@ -0,0 +1,79 @@
/**
* 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__MBT_ISP_AUTH_RESP_M_H__)
#define __P25_LC_TSBK__MBT_ISP_AUTH_RESP_M_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH RESP M - Authentication Response Mutual
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_ISP_AUTH_RESP_M : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_ISP_AUTH_RESP_M class.</summary>
MBT_ISP_AUTH_RESP_M();
/// <summary>Finalizes a instance of the MBT_ISP_AUTH_RESP_M class.</summary>
~MBT_ISP_AUTH_RESP_M();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
/** Authentication data */
/// <summary>Gets the authentication result.</summary>
void getAuthRes(uint8_t* res) const;
/// <summary>Sets the authentication random challenge.</summary>
void setAuthRC(const uint8_t* rc);
/// <summary>Gets the authentication random challenge.</summary>
void getAuthRC(uint8_t* rc) const;
public:
/// <summary>Flag indicating authentication is standalone.</summary>
__PROPERTY(bool, authStandalone, AuthStandalone);
private:
/** Authentication data */
uint8_t* m_authRes;
uint8_t* m_authRC;
__COPY(MBT_ISP_AUTH_RESP_M);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_ISP_AUTH_RESP_M_H__

@ -0,0 +1,88 @@
/**
* 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/tsbk/MBT_ISP_AUTH_SU_DMD.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_ISP_AUTH_SU_DMD class.
/// </summary>
MBT_ISP_AUTH_SU_DMD::MBT_ISP_AUTH_SU_DMD() : AMBT()
{
m_lco = TSBK_IOSP_GRP_AFF;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_ISP_AUTH_SU_DMD::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_netId = (uint32_t)((tsbkValue >> 44) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 32) & 0xFFFU); // System ID
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_ISP_AUTH_SU_DMD::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}

@ -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__MBT_ISP_AUTH_SU_DMD_H__)
#define __P25_LC_TSBK__MBT_ISP_AUTH_SU_DMD_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH SU DMD - Authentication SU Demand
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_ISP_AUTH_SU_DMD : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_ISP_AUTH_SU_DMD class.</summary>
MBT_ISP_AUTH_SU_DMD();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_ISP_AUTH_SU_DMD_H__

@ -0,0 +1,93 @@
/**
* 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/tsbk/MBT_ISP_CAN_SRV_REQ.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_ISP_CAN_SRV_REQ class.
/// </summary>
MBT_ISP_CAN_SRV_REQ::MBT_ISP_CAN_SRV_REQ() : AMBT()
{
m_lco = TSBK_ISP_CAN_SRV_REQ;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_ISP_CAN_SRV_REQ::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
uint8_t pduUserData[P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow()];
::memset(pduUserData, 0x00U, P25_PDU_UNCONFIRMED_LENGTH_BYTES * dataHeader.getBlocksToFollow());
bool ret = AMBT::decode(dataHeader, blocks, pduUserData);
if (!ret)
return false;
ulong64_t tsbkValue = AMBT::tsbkValue(dataHeader, pduUserData);
m_aivFlag = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Additional Info. Flag
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_response = (uint8_t)((tsbkValue >> 48) & 0xFFU); // Reason
m_netId = (uint32_t)((tsbkValue >> 20) & 0xFFFFFU); // Network ID
m_sysId = (uint32_t)((tsbkValue >> 8) & 0xFFFU); // System ID
m_dstId = (uint32_t)((((tsbkValue) & 0xFFU) << 16) + // Target Radio Address
(pduUserData[6U] << 8) + (pduUserData[7U]));
m_srcId = dataHeader.getLLId(); // Source Radio Address
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_ISP_CAN_SRV_REQ::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
/* stub */
return;
}

@ -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__MBT_ISP_CAN_SRV_REQ_H__)
#define __P25_LC_TSBK__MBT_ISP_CAN_SRV_REQ_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements CAN SRV REQ - Cancel Service Request
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_ISP_CAN_SRV_REQ : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_ISP_CAN_SRV_REQ class.</summary>
MBT_ISP_CAN_SRV_REQ();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_ISP_CAN_SRV_REQ_H__

@ -0,0 +1,133 @@
/**
* 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/tsbk/MBT_OSP_ADJ_STS_BCAST.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_OSP_ADJ_STS_BCAST class.
/// </summary>
MBT_OSP_ADJ_STS_BCAST::MBT_OSP_ADJ_STS_BCAST() : AMBT(),
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 = TSBK_OSP_ADJ_STS_BCAST;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_OSP_ADJ_STS_BCAST::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_OSP_ADJ_STS_BCAST::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
if ((m_adjRfssId != 0U) && (m_adjSiteId != 0U) && (m_adjChannelNo != 0U)) {
if (m_adjSysId == 0U) {
m_adjSysId = m_siteData.sysId();
}
// pack LRA, CFVA and system ID into LLID
uint32_t llId = m_siteData.lra(); // Location Registration Area
llId = (llId << 8) + m_adjCFVA; // CFVA
llId = (llId << 4) + m_siteData.siteId(); // System ID
dataHeader.setLLId(llId);
dataHeader.setAMBTField8(m_adjRfssId); // RF Sub-System ID
dataHeader.setAMBTField9(m_adjSiteId); // Site ID
/** Block 1 */
pduUserData[0U] = ((m_adjChannelId & 0x0FU) << 4) + // Transmit Channel ID & Channel Number MSB
((m_adjChannelNo >> 8) & 0xFFU);
pduUserData[1U] = (m_adjChannelNo >> 0) & 0xFFU; // Transmit Channel Number LSB
pduUserData[2U] = ((m_adjChannelId & 0x0FU) << 4) + // Receive Channel ID & Channel Number MSB
((m_adjChannelNo >> 8) & 0xFFU);
pduUserData[3U] = (m_adjChannelNo >> 0) & 0xFFU; // Receive Channel Number LSB
pduUserData[4U] = m_adjServiceClass; // System Service Class
pduUserData[5U] = (m_siteData.netId() >> 12) & 0xFFU; // Network ID (b19-12)
pduUserData[6U] = (m_siteData.netId() >> 4) & 0xFFU; // Network ID (b11-b4)
pduUserData[7U] = (m_siteData.netId() & 0x0FU) << 4; // Network ID (b3-b0)
}
else {
LogError(LOG_P25, "TSBK::encodeMBT(), invalid values for OSP_ADJ_STS_BCAST, adjRfssId = $%02X, adjSiteId = $%02X, adjChannelId = %u, adjChannelNo = $%02X, adjSvcClass = $%02X",
m_adjRfssId, m_adjSiteId, m_adjChannelId, m_adjChannelNo, m_adjServiceClass);
return; // blatently ignore creating this TSBK
}
AMBT::encode(dataHeader, pduUserData);
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void MBT_OSP_ADJ_STS_BCAST::copy(const MBT_OSP_ADJ_STS_BCAST& data)
{
TSBK::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,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_TSBK__MBT_OSP_ADJ_STS_BCAST_H__)
#define __P25_LC_TSBK__MBT_OSP_ADJ_STS_BCAST_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements ADJ STS BCAST - Adjacent Site Status Broadcast
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_OSP_ADJ_STS_BCAST : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_OSP_ADJ_STS_BCAST class.</summary>
MBT_OSP_ADJ_STS_BCAST();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
public:
/** Adjacent Site Data */
/// <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(MBT_OSP_ADJ_STS_BCAST);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_OSP_ADJ_STS_BCAST_H__

@ -0,0 +1,188 @@
/**
* 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/tsbk/MBT_OSP_AUTH_DMD.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_OSP_AUTH_DMD class.
/// </summary>
MBT_OSP_AUTH_DMD::MBT_OSP_AUTH_DMD() : AMBT()
{
m_lco = TSBK_OSP_AUTH_DMD;
m_authRS = new uint8_t[P25_AUTH_RAND_SEED_LENGTH_BYTES];
::memset(m_authRS, 0x00U, P25_AUTH_RAND_SEED_LENGTH_BYTES);
m_authRC = new uint8_t[P25_AUTH_RAND_CHLNG_LENGTH_BYTES];
::memset(m_authRC, 0x00U, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}
/// <summary>
/// Finalizes a instance of MBT_OSP_AUTH_DMD class.
/// </summary>
MBT_OSP_AUTH_DMD::~MBT_OSP_AUTH_DMD()
{
if (m_authRS != NULL) {
delete[] m_authRS;
m_authRS = NULL;
}
if (m_authRC != NULL) {
delete[] m_authRC;
m_authRC = NULL;
}
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_OSP_AUTH_DMD::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_OSP_AUTH_DMD::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
dataHeader.setBlocksToFollow(2U);
dataHeader.setAMBTField8((m_netId >> 12) & 0xFFU); // Network ID (b19-12)
dataHeader.setAMBTField9((m_netId >> 4) & 0xFFU); // Network ID (b11-b4)
/** Block 1 */
pduUserData[0U] = ((m_netId & 0x0FU) << 4) + ((m_sysId >> 8) & 0xFFU); // Network ID (b3-b0) + System ID (b11-b8)
pduUserData[1U] = (m_sysId & 0xFFU); // System ID (b7-b0)
__SET_UINT16(m_dstId, pduUserData, 2U); // Target Radio Address
pduUserData[5U] = m_authRS[9U]; // Random Salt b9
pduUserData[6U] = m_authRS[8U]; // Random Salt b8
pduUserData[7U] = m_authRS[7U]; // Random Salt b7
pduUserData[8U] = m_authRS[6U]; // Random Salt b6
pduUserData[9U] = m_authRS[5U]; // Random Salt b5
pduUserData[10U] = m_authRS[4U]; // Random Salt b4
pduUserData[11U] = m_authRS[3U]; // Random Salt b3
/** Block 2 */
pduUserData[12U] = m_authRS[2U]; // Random Salt b2
pduUserData[13U] = m_authRS[1U]; // Random Salt b1
pduUserData[14U] = m_authRS[0U]; // Random Salt b0
pduUserData[15U] = m_authRC[4U]; // Random Challenge b4
pduUserData[16U] = m_authRC[3U]; // Random Challenge b3
pduUserData[17U] = m_authRC[2U]; // Random Challenge b2
pduUserData[18U] = m_authRC[1U]; // Random Challenge b1
pduUserData[19U] = m_authRC[0U]; // Random Challenge b0
AMBT::encode(dataHeader, pduUserData);
}
/// <summary>Sets the authentication random seed.</summary>
/// <param name="mi"></param>
void MBT_OSP_AUTH_DMD::setAuthRS(const uint8_t* rs)
{
assert(rs != NULL);
::memcpy(m_authRS, rs, P25_AUTH_RAND_SEED_LENGTH_BYTES);
}
/// <summary>Gets the authentication random seed.</summary>
/// <returns></returns>
void MBT_OSP_AUTH_DMD::getAuthRS(uint8_t* rs) const
{
assert(rs != NULL);
::memcpy(rs, m_authRS, P25_AUTH_RAND_SEED_LENGTH_BYTES);
}
/// <summary>Sets the authentication random challenge.</summary>
/// <param name="rc"></param>
void MBT_OSP_AUTH_DMD::setAuthRC(const uint8_t* rc)
{
assert(rc != NULL);
::memcpy(m_authRC, rc, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}
/// <summary>Gets the authentication random challenge.</summary>
/// <returns></returns>
void MBT_OSP_AUTH_DMD::getAuthRC(uint8_t* rc) const
{
assert(rc != NULL);
::memcpy(rc, m_authRC, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void MBT_OSP_AUTH_DMD::copy(const MBT_OSP_AUTH_DMD& data)
{
TSBK::copy(data);
if (m_authRS != NULL) {
delete[] m_authRS;
}
m_authRS = new uint8_t[P25_AUTH_RAND_SEED_LENGTH_BYTES];
::memcpy(m_authRS, data.m_authRS, P25_AUTH_RAND_SEED_LENGTH_BYTES);
if (m_authRC != NULL) {
delete[] m_authRC;
}
m_authRC = new uint8_t[P25_AUTH_RAND_CHLNG_LENGTH_BYTES];
::memcpy(m_authRC, data.m_authRC, P25_AUTH_RAND_CHLNG_LENGTH_BYTES);
}

@ -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_TSBK__MBT_OSP_AUTH_DMD_H__)
#define __P25_LC_TSBK__MBT_OSP_AUTH_DMD_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH DMD - Authentication Demand
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_OSP_AUTH_DMD : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_OSP_AUTH_DMD class.</summary>
MBT_OSP_AUTH_DMD();
/// <summary>Finalizes a instance of the MBT_OSP_AUTH_DMD class.</summary>
~MBT_OSP_AUTH_DMD();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
/// <summary>Sets the authentication random seed.</summary>
void setAuthRS(const uint8_t* rs);
/// <summary>Gets the authentication random seed.</summary>
void getAuthRS(uint8_t* rs) const;
/// <summary>Sets the authentication random challenge.</summary>
void setAuthRC(const uint8_t* rc);
/// <summary>Gets the authentication random challenge.</summary>
void getAuthRC(uint8_t* rc) const;
private:
/** Authentication data */
uint8_t* m_authRS;
uint8_t* m_authRC;
__COPY(MBT_OSP_AUTH_DMD);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_OSP_AUTH_DMD_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 "p25/lc/tsbk/MBT_OSP_NET_STS_BCAST.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_OSP_NET_STS_BCAST class.
/// </summary>
MBT_OSP_NET_STS_BCAST::MBT_OSP_NET_STS_BCAST() : AMBT()
{
m_lco = TSBK_OSP_NET_STS_BCAST;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_OSP_NET_STS_BCAST::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_OSP_NET_STS_BCAST::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
// pack LRA and system ID into LLID
uint32_t llId = m_siteData.lra(); // Location Registration Area
llId = (llId << 12) + m_siteData.siteId(); // System ID
dataHeader.setLLId(llId);
/** Block 1 */
pduUserData[0U] = (m_siteData.netId() >> 12) & 0xFFU; // Network ID (b19-12)
pduUserData[1U] = (m_siteData.netId() >> 4) & 0xFFU; // Network ID (b11-b4)
pduUserData[2U] = (m_siteData.netId() & 0x0FU) << 4; // Network ID (b3-b0)
pduUserData[3U] = ((m_siteData.channelId() & 0x0FU) << 4) + // Transmit Channel ID & Channel Number MSB
((m_siteData.channelNo() >> 8) & 0xFFU);
pduUserData[4U] = (m_siteData.channelNo() >> 0) & 0xFFU; // Transmit Channel Number LSB
pduUserData[5U] = ((m_siteData.channelId() & 0x0FU) << 4) + // Receive Channel ID & Channel Number MSB
((m_siteData.channelNo() >> 8) & 0xFFU);
pduUserData[6U] = (m_siteData.channelNo() >> 0) & 0xFFU; // Receive Channel Number LSB
pduUserData[7U] = m_siteData.serviceClass(); // System Service Class
AMBT::encode(dataHeader, pduUserData);
}

@ -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__MBT_OSP_NET_STS_BCAST_H__)
#define __P25_LC_TSBK__MBT_OSP_NET_STS_BCAST_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements NET STS BCAST - Network Status Broadcast
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_OSP_NET_STS_BCAST : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_OSP_NET_STS_BCAST class.</summary>
MBT_OSP_NET_STS_BCAST();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_OSP_NET_STS_BCAST_H__

@ -0,0 +1,94 @@
/**
* 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/tsbk/MBT_OSP_RFSS_STS_BCAST.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the MBT_OSP_RFSS_STS_BCAST class.
/// </summary>
MBT_OSP_RFSS_STS_BCAST::MBT_OSP_RFSS_STS_BCAST() : AMBT()
{
m_lco = TSBK_OSP_RFSS_STS_BCAST;
}
/// <summary>
/// Decode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="blocks"></param>
/// <returns>True, if TSBK was decoded, otherwise false.</returns>
bool MBT_OSP_RFSS_STS_BCAST::decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks)
{
assert(blocks != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a alternate trunking signalling block.
/// </summary>
/// <param name="dataHeader"></param>
/// <param name="pduUserData"></param>
void MBT_OSP_RFSS_STS_BCAST::encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData)
{
assert(pduUserData != NULL);
// pack LRA and system ID into LLID
uint32_t llId = m_siteData.lra(); // Location Registration Area
llId = (llId << 12) + m_siteData.siteId(); // System ID
if (m_siteData.netActive()) {
llId |= 0x1000U; // Network Active Flag
}
dataHeader.setLLId(llId);
/** Block 1 */
pduUserData[0U] = (m_siteData.rfssId()) & 0xFFU; // RF Sub-System ID
pduUserData[1U] = (m_siteData.siteId()) & 0xFFU; // Site ID
pduUserData[2U] = ((m_siteData.channelId() & 0x0FU) << 4) + // Transmit Channel ID & Channel Number MSB
((m_siteData.channelNo() >> 8) & 0xFFU);
pduUserData[3U] = (m_siteData.channelNo() >> 0) & 0xFFU; // Transmit Channel Number LSB
pduUserData[4U] = ((m_siteData.channelId() & 0x0FU) << 4) + // Receive Channel ID & Channel Number MSB
((m_siteData.channelNo() >> 8) & 0xFFU);
pduUserData[5U] = (m_siteData.channelNo() >> 0) & 0xFFU; // Receive Channel Number LSB
pduUserData[6U] = m_siteData.serviceClass(); // System Service Class
AMBT::encode(dataHeader, pduUserData);
}

@ -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__MBT_OSP_RFSS_STS_BCAST_H__)
#define __P25_LC_TSBK__MBT_OSP_RFSS_STS_BCAST_H__
#include "Defines.h"
#include "p25/lc/AMBT.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements RFSS STS BCAST - RFSS Status Broadcast
// ---------------------------------------------------------------------------
class HOST_SW_API MBT_OSP_RFSS_STS_BCAST : public AMBT {
public:
/// <summary>Initializes a new instance of the MBT_OSP_RFSS_STS_BCAST class.</summary>
MBT_OSP_RFSS_STS_BCAST();
/// <summary>Decode a alternate trunking signalling block.</summary>
virtual bool decodeMBT(const data::DataHeader dataHeader, const data::DataBlock* blocks);
/// <summary>Encode a alternate trunking signalling block.</summary>
virtual void encodeMBT(data::DataHeader& dataHeader, uint8_t* pduUserData);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__MBT_OSP_RFSS_STS_BCAST_H__

@ -0,0 +1,130 @@
/**
* 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/tsbk/OSP_ADJ_STS_BCAST.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_ADJ_STS_BCAST class.
/// </summary>
OSP_ADJ_STS_BCAST::OSP_ADJ_STS_BCAST() : TSBK(),
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 = TSBK_OSP_ADJ_STS_BCAST;
}
/// <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 OSP_ADJ_STS_BCAST::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_adjSysId = (uint32_t)((tsbkValue >> 40) & 0xFFFU); // Site System ID
m_adjRfssId = (uint8_t)((tsbkValue >> 32) & 0xFFU); // Site RFSS ID
m_adjSiteId = (uint8_t)((tsbkValue >> 24) & 0xFFU); // Site ID
m_adjChannelId = (uint8_t)((tsbkValue >> 20) & 0xFU); // Site Channel ID
m_adjChannelNo = (uint32_t)((tsbkValue >> 8) & 0xFFFU); // Site Channel Number
m_adjServiceClass = (uint8_t)(tsbkValue & 0xFFU); // Site Service Class
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void OSP_ADJ_STS_BCAST::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = m_siteData.lra(); // Location Registration Area
tsbkValue = (tsbkValue << 4) +
(m_siteData.netActive()) ? P25_CFVA_NETWORK : 0U; // CFVA
tsbkValue = (tsbkValue << 12) + m_siteData.sysId(); // System ID
tsbkValue = (tsbkValue << 8) + m_siteData.rfssId(); // RF Sub-System ID
tsbkValue = (tsbkValue << 8) + m_siteData.siteId(); // Site ID
tsbkValue = (tsbkValue << 4) + m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_siteData.channelNo(); // Channel Number
tsbkValue = (tsbkValue << 8) + m_siteData.serviceClass(); // System Service Class
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void OSP_ADJ_STS_BCAST::copy(const OSP_ADJ_STS_BCAST& data)
{
TSBK::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,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_TSBK__OSP_ADJ_STS_BCAST_H__)
#define __P25_LC_TSBK__OSP_ADJ_STS_BCAST_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements ADJ STS BCAST - Adjacent Site Status Broadcast.
// ---------------------------------------------------------------------------
class HOST_SW_API OSP_ADJ_STS_BCAST : public TSBK {
public:
/// <summary>Initializes a new instance of the OSP_ADJ_STS_BCAST class.</summary>
OSP_ADJ_STS_BCAST();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
public:
/** Adjacent Site Data */
/// <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(OSP_ADJ_STS_BCAST);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__OSP_ADJ_STS_BCAST_H__

@ -0,0 +1,135 @@
/**
* 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/tsbk/OSP_AUTH_FNE_RESP.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_AUTH_FNE_RESP class.
/// </summary>
OSP_AUTH_FNE_RESP::OSP_AUTH_FNE_RESP() : TSBK(),
m_authRes(NULL)
{
m_lco = TSBK_OSP_AUTH_FNE_RESP;
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memset(m_authRes, 0x00U, P25_AUTH_RES_LENGTH_BYTES);
}
/// <summary>
/// Finalizes a instance of OSP_AUTH_FNE_RESP class.
/// </summary>
OSP_AUTH_FNE_RESP::~OSP_AUTH_FNE_RESP()
{
if (m_authRes != NULL) {
delete[] m_authRes;
m_authRes = NULL;
}
}
/// <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 OSP_AUTH_FNE_RESP::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void OSP_AUTH_FNE_RESP::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 8) + m_authRes[3U]; // Result b3
tsbkValue = (tsbkValue << 8) + m_authRes[2U]; // Result b2
tsbkValue = (tsbkValue << 8) + m_authRes[1U]; // Result b1
tsbkValue = (tsbkValue << 8) + m_authRes[0U]; // Result b0
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}
/// <summary>Sets the authentication result.</summary>
/// <param name="mi"></param>
void OSP_AUTH_FNE_RESP::setAuthRes(const uint8_t* res)
{
assert(res != NULL);
if (m_authRes != NULL) {
delete[] m_authRes;
}
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memcpy(m_authRes, res, P25_AUTH_RES_LENGTH_BYTES);
}
// ---------------------------------------------------------------------------
// Private Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Internal helper to copy the the class.
/// </summary>
/// <param name="data"></param>
void OSP_AUTH_FNE_RESP::copy(const OSP_AUTH_FNE_RESP& data)
{
TSBK::copy(data);
if (m_authRes != NULL) {
delete[] m_authRes;
}
m_authRes = new uint8_t[P25_AUTH_RES_LENGTH_BYTES];
::memcpy(m_authRes, data.m_authRes, P25_AUTH_RES_LENGTH_BYTES);
}

@ -0,0 +1,69 @@
/**
* 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__OSP_AUTH_FNE_RESP_H__)
#define __P25_LC_TSBK__OSP_AUTH_FNE_RESP_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements AUTH FNE RESP - Authentication FNE Response
// ---------------------------------------------------------------------------
class HOST_SW_API OSP_AUTH_FNE_RESP : public TSBK {
public:
/// <summary>Initializes a new instance of the OSP_AUTH_FNE_RESP class.</summary>
OSP_AUTH_FNE_RESP();
/// <summary>Finalizes a instance of the OSP_AUTH_FNE_RESP class.</summary>
~OSP_AUTH_FNE_RESP();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
/** Authentication data */
/// <summary>Sets the authentication result.</summary>
void setAuthRes(const uint8_t* res);
private:
/** Authentication data */
uint8_t* m_authRes;
__COPY(OSP_AUTH_FNE_RESP);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__OSP_AUTH_FNE_RESP_H__

@ -0,0 +1,114 @@
/**
* 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/tsbk/OSP_DENY_RSP.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_DENY_RSP class.
/// </summary>
OSP_DENY_RSP::OSP_DENY_RSP() : TSBK()
{
m_lco = TSBK_OSP_DENY_RSP;
}
/// <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 OSP_DENY_RSP::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_aivFlag = (((tsbkValue >> 56) & 0xFFU) & 0x80U) == 0x80U; // Additional Info. Flag
m_service = (uint8_t)((tsbkValue >> 56) & 0x3FU); // Service Type
m_response = (uint8_t)((tsbkValue >> 48) & 0xFFU); // Reason
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFFFU); // Target Radio Address
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 OSP_DENY_RSP::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
if (m_response == 0U) {
LogError(LOG_P25, "TSBK::encode(), invalid values for TSBK_OSP_DENY_RSP, reason = %u", m_response);
return; // blatently ignore creating this TSBK
}
tsbkValue = (m_aivFlag) ? 0x80U : 0x00U; // Additional Info Flag
tsbkValue = (tsbkValue << 6) + m_service; // Service Type
tsbkValue = (tsbkValue << 8) + m_response; // Deny/Queue Reason
if (m_group) {
// group deny/queue
tsbkValue = (tsbkValue << 8) + 0U; // Call Options
tsbkValue = (tsbkValue << 16) + m_dstId; // Talkgroup Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
}
else {
// private/individual deny/queue
tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
}
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -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__OSP_DENY_RSP_H__)
#define __P25_LC_TSBK__OSP_DENY_RSP_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements DENY RSP - Queued Response
// ---------------------------------------------------------------------------
class HOST_SW_API OSP_DENY_RSP : public TSBK {
public:
/// <summary>Initializes a new instance of the OSP_DENY_RSP class.</summary>
OSP_DENY_RSP();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__OSP_DENY_RSP_H__

@ -0,0 +1,90 @@
/**
* 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/tsbk/OSP_DVM_GIT_HASH.h"
#include "HostMain.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_DVM_GIT_HASH class.
/// </summary>
OSP_DVM_GIT_HASH::OSP_DVM_GIT_HASH() : TSBK()
{
m_lco = TSBK_OSP_DVM_GIT_HASH;
m_mfId = P25_MFG_DVM;
}
/// <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 OSP_DVM_GIT_HASH::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void OSP_DVM_GIT_HASH::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = g_gitHashBytes[0]; // ...
tsbkValue = (tsbkValue << 8) + (g_gitHashBytes[1U]); // ...
tsbkValue = (tsbkValue << 8) + (g_gitHashBytes[2U]); // ...
tsbkValue = (tsbkValue << 8) + (g_gitHashBytes[3U]); // ...
tsbkValue = (tsbkValue << 16) + 0U;
tsbkValue = (tsbkValue << 4) + m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_siteData.channelNo(); // Channel Number
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -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__OSP_DVM_GIT_HASH_H__)
#define __P25_LC_TSBK__OSP_DVM_GIT_HASH_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements DVM GIT Hash Identification
// ---------------------------------------------------------------------------
class HOST_SW_API OSP_DVM_GIT_HASH : public TSBK {
public:
/// <summary>Initializes a new instance of the OSP_DVM_GIT_HASH class.</summary>
OSP_DVM_GIT_HASH();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__OSP_DVM_GIT_HASH_H__

@ -0,0 +1,98 @@
/**
* 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/tsbk/OSP_DVM_LC_CALL_TERM.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_DVM_LC_CALL_TERM class.
/// </summary>
OSP_DVM_LC_CALL_TERM::OSP_DVM_LC_CALL_TERM() : TSBK()
{
m_lco = LC_CALL_TERM;
m_mfId = P25_MFG_DVM;
}
/// <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 OSP_DVM_LC_CALL_TERM::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
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::tsbkValue(tsbk);
m_grpVchId = ((tsbkValue >> 52) & 0x0FU); // Channel ID
m_grpVchNo = ((tsbkValue >> 40) & 0xFFFU); // Channel Number
m_dstId = (uint32_t)((tsbkValue >> 24) & 0xFFFFU); // Target Radio Address
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 OSP_DVM_LC_CALL_TERM::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 4) + m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_grpVchNo; // Channel Number
tsbkValue = (tsbkValue << 16) + m_dstId; // Talkgroup Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -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__OSP_LC_CALL_TERM_H__)
#define __P25_LC_TSBK__OSP_LC_CALL_TERM_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements CALL TERM - Call Termination or Cancellation
// ---------------------------------------------------------------------------
class HOST_SW_API OSP_DVM_LC_CALL_TERM : public TSBK {
public:
/// <summary>Initializes a new instance of the OSP_DVM_LC_CALL_TERM class.</summary>
OSP_DVM_LC_CALL_TERM();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__OSP_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/tsbk/OSP_GRP_AFF_Q.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_GRP_AFF_Q class.
/// </summary>
OSP_GRP_AFF_Q::OSP_GRP_AFF_Q() : TSBK()
{
m_lco = TSBK_OSP_GRP_AFF_Q;
}
/// <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 OSP_GRP_AFF_Q::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void OSP_GRP_AFF_Q::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = (tsbkValue << 24) + m_dstId; // Target Radio Address
tsbkValue = (tsbkValue << 24) + m_srcId; // Source Radio Address
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

@ -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__OSP_GRP_AFF_Q_H__)
#define __P25_LC_TSBK__OSP_GRP_AFF_Q_H__
#include "Defines.h"
#include "p25/lc/TSBK.h"
namespace p25
{
namespace lc
{
namespace tsbk
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements GRP AFF Q - Group Affiliation Query
// ---------------------------------------------------------------------------
class HOST_SW_API OSP_GRP_AFF_Q : public TSBK {
public:
/// <summary>Initializes a new instance of the OSP_GRP_AFF_Q class.</summary>
OSP_GRP_AFF_Q();
/// <summary>Decode a trunking signalling block.</summary>
virtual bool decode(const uint8_t* data, bool rawTSBK = false);
/// <summary>Encode a trunking signalling block.</summary>
virtual void encode(uint8_t* data, bool rawTSBK = false, bool noTrellis = false);
};
} // namespace tsbk
} // namespace lc
} // namespace p25
#endif // __P25_LC_TSBK__OSP_GRP_AFF_Q_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/tsbk/OSP_GRP_VCH_GRANT_UPD.h"
#include "Log.h"
#include "Utils.h"
using namespace p25::lc::tsbk;
using namespace p25::lc;
using namespace p25;
#include <cassert>
#include <cmath>
// ---------------------------------------------------------------------------
// Public Class Members
// ---------------------------------------------------------------------------
/// <summary>
/// Initializes a new instance of the OSP_GRP_VCH_GRANT_UPD class.
/// </summary>
OSP_GRP_VCH_GRANT_UPD::OSP_GRP_VCH_GRANT_UPD() : TSBK()
{
m_lco = TSBK_OSP_GRP_VCH_GRANT_UPD;
}
/// <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 OSP_GRP_VCH_GRANT_UPD::decode(const uint8_t* data, bool rawTSBK)
{
assert(data != NULL);
/* stub */
return true;
}
/// <summary>
/// Encode a trunking signalling block.
/// </summary>
/// <param name="data"></param>
/// <param name="rawTSBK"></param>
/// <param name="noTrellis"></param>
void OSP_GRP_VCH_GRANT_UPD::encode(uint8_t* data, bool rawTSBK, bool noTrellis)
{
assert(data != NULL);
ulong64_t tsbkValue = 0U;
tsbkValue = m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_grpVchNo; // Channel Number
tsbkValue = (tsbkValue << 16) + m_dstId; // Talkgroup Address
tsbkValue = (tsbkValue << 32) + 0;
uint8_t* tsbk = TSBK::tsbkValue(tsbkValue);
TSBK::encode(data, tsbk, rawTSBK, noTrellis);
delete[] tsbk;
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save

Powered by TurnKey Linux.