expand DMR LC service options out to proper class fields;

pull/1/head
Bryan Biedenkapp 5 years ago
parent bbd4a89fae
commit d1e265bd8e

@ -134,6 +134,16 @@ namespace dmr
const uint8_t FID_ETSI = 0x00U; // ETSI Standard Feature Set
const uint8_t FID_DMRA = 0x10U; //
const uint8_t LC_SVC_OPT_EMERGENCY = 0x80U;
const uint8_t LC_SVC_OPT_PRIVACY = 0x40U;
const uint8_t LC_SVC_OPT_BCAST = 0x08U;
const uint8_t LC_SVC_OPT_OVCM = 0x04U;
const uint8_t CALL_PRIORITY_NONE = 0x00U;
const uint8_t CALL_PRIORITY_1 = 0x01U;
const uint8_t CALL_PRIORITY_2 = 0x02U;
const uint8_t CALL_PRIORITY_3 = 0x03U;
const uint32_t DMR_EXT_FNCT_CHECK = 0x0000U; // Radio Check
const uint32_t DMR_EXT_FNCT_UNINHIBIT = 0x007EU; // Radio Uninhibit
const uint32_t DMR_EXT_FNCT_INHIBIT = 0x007FU; // Radio Inhibit

@ -52,8 +52,12 @@ LC::LC(uint8_t flco, uint32_t srcId, uint32_t dstId) :
m_FID(0U),
m_srcId(srcId),
m_dstId(dstId),
m_R(false),
m_options(0U)
m_emergency(false),
m_encrypted(false),
m_broadcast(false),
m_ovcm(false),
m_priority(CALL_PRIORITY_2),
m_R(false)
{
/* stub */
}
@ -67,8 +71,12 @@ LC::LC(const uint8_t* bytes) :
m_FID(0U),
m_srcId(0U),
m_dstId(0U),
m_R(false),
m_options(0U)
m_emergency(false),
m_encrypted(false),
m_broadcast(false),
m_ovcm(false),
m_priority(CALL_PRIORITY_2),
m_R(false)
{
assert(bytes != NULL);
@ -79,10 +87,14 @@ LC::LC(const uint8_t* bytes) :
m_FID = bytes[1U];
m_options = bytes[2U];
m_emergency = (bytes[2U] & 0x80U) == 0x80U; // Emergency Flag
m_encrypted = (bytes[2U] & 0x40U) == 0x40U; // Encryption Flag
m_broadcast = (bytes[2U] & 0x08U) == 0x08U; // Broadcast Flag
m_ovcm = (bytes[2U] & 0x04U) == 0x04U; // OVCM Flag
m_priority = (bytes[2U] & 0x03U); // Priority
m_dstId = bytes[3U] << 16 | bytes[4U] << 8 | bytes[5U];
m_srcId = bytes[6U] << 16 | bytes[7U] << 8 | bytes[8U];
m_dstId = bytes[3U] << 16 | bytes[4U] << 8 | bytes[5U]; // Destination Address
m_srcId = bytes[6U] << 16 | bytes[7U] << 8 | bytes[8U]; // Source Address
}
/// <summary>
/// Initializes a new instance of the LC class.
@ -94,8 +106,12 @@ LC::LC(const bool* bits) :
m_FID(0U),
m_srcId(0U),
m_dstId(0U),
m_R(false),
m_options(0U)
m_emergency(false),
m_encrypted(false),
m_broadcast(false),
m_ovcm(false),
m_priority(CALL_PRIORITY_2),
m_R(false)
{
assert(bits != NULL);
@ -110,7 +126,12 @@ LC::LC(const bool* bits) :
m_FID = temp2;
Utils::bitsToByteBE(bits + 16U, temp3);
m_options = temp3;
m_emergency = (temp3 & 0x80U) == 0x80U; // Emergency Flag
m_encrypted = (temp3 & 0x40U) == 0x40U; // Encryption Flag
m_broadcast = (temp3 & 0x08U) == 0x08U; // Broadcast Flag
m_ovcm = (temp3 & 0x04U) == 0x04U; // OVCM Flag
m_priority = (temp3 & 0x03U); // Priority
uint8_t d1, d2, d3;
Utils::bitsToByteBE(bits + 24U, d1);
@ -122,8 +143,8 @@ LC::LC(const bool* bits) :
Utils::bitsToByteBE(bits + 56U, s2);
Utils::bitsToByteBE(bits + 64U, s3);
m_srcId = s1 << 16 | s2 << 8 | s3;
m_dstId = d1 << 16 | d2 << 8 | d3;
m_srcId = s1 << 16 | s2 << 8 | s3; // Source Address
m_dstId = d1 << 16 | d2 << 8 | d3; // Destination Address
}
/// <summary>
/// Initializes a new instance of the LC class.
@ -134,8 +155,12 @@ LC::LC() :
m_FID(0U),
m_srcId(0U),
m_dstId(0U),
m_R(false),
m_options(0U)
m_emergency(false),
m_encrypted(false),
m_broadcast(false),
m_ovcm(false),
m_priority(CALL_PRIORITY_2),
m_R(false)
{
/* stub */
}
@ -166,15 +191,19 @@ void LC::getData(uint8_t* bytes) const
bytes[1U] = m_FID;
bytes[2U] = m_options;
bytes[2U] = (m_emergency ? 0x80U : 0x00U) + // Emergency Flag
(m_encrypted ? 0x40U : 0x00U) + // Encrypted Flag
(m_broadcast ? 0x08U : 0x00U) + // Broadcast Flag
(m_ovcm ? 0x04U : 0x00U) + // OVCM Flag
(m_priority & 0x03U); // Priority
bytes[3U] = m_dstId >> 16;
bytes[4U] = m_dstId >> 8;
bytes[5U] = m_dstId >> 0;
bytes[3U] = m_dstId >> 16; // Destination Address
bytes[4U] = m_dstId >> 8; // ..
bytes[5U] = m_dstId >> 0; // ..
bytes[6U] = m_srcId >> 16;
bytes[7U] = m_srcId >> 8;
bytes[8U] = m_srcId >> 0;
bytes[6U] = m_srcId >> 16; // Source Address
bytes[7U] = m_srcId >> 8; // ..
bytes[8U] = m_srcId >> 0; // ..
}
/// <summary>
@ -198,24 +227,3 @@ void LC::getData(bool* bits) const
Utils::byteToBitsBE(bytes[7U], bits + 56U);
Utils::byteToBitsBE(bytes[8U], bits + 64U);
}
/// <summary>
///
/// </summary>
/// <returns></returns>
bool LC::getOVCM() const
{
return (m_options & 0x04U) == 0x04U;
}
/// <summary>
///
/// </summary>
/// <param name="ovcm"></param>
void LC::setOVCM(bool ovcm)
{
if (ovcm)
m_options |= 0x04U;
else
m_options &= 0xFBU;
}

@ -60,10 +60,6 @@ namespace dmr
/// <summary>Gets LC data as bits.</summary>
void getData(bool* bits) const;
/// <summary>Gets the OVCM flag.</summary>
bool getOVCM() const;
/// <summary>Sets the OVCM flag.</summary>
void setOVCM(bool ovcm);
public:
/// <summary>Flag indicating whether link protection is enabled.</summary>
__PROPERTY(bool, PF, PF);
@ -79,10 +75,20 @@ namespace dmr
/// <summary>Destination ID.</summary>
__PROPERTY(uint32_t, dstId, DstId);
/** Service Options */
/// <summary>Flag indicating the emergency bits are set.</summary>
__PROPERTY(bool, emergency, Emergency);
/// <summary>Flag indicating that encryption is enabled.</summary>
__PROPERTY(bool, encrypted, Encrypted);
/// <summary>Priority level for the traffic.</summary>
__PROPERTY(uint8_t, priority, Priority);
/// <summary>Flag indicating broadcast operation.</summary>
__PROPERTY(bool, broadcast, Broadcast);
/// <summary>Flag indicating OVCM operation.</summary>
__PROPERTY(bool, ovcm, OVCM);
private:
bool m_R;
uint8_t m_options;
};
} // namespace lc
} // namespace dmr

@ -249,6 +249,9 @@ namespace p25
const uint8_t PDU_TYPE_SNDCP_RF_UNCONFIRMED = 0x04U;
const uint8_t PDU_TYPE_SNDCP_RF_CONFIRMED = 0x05U;
const uint8_t LC_SVC_OPT_EMERGENCY = 0x80U;
const uint8_t LC_SVC_OPT_ENCRYPTION = 0x40U;
// LDUx/TDULC Link Control Opcode(s)
const uint8_t LC_GROUP = 0x00U; // GRP VCH USER - Group Voice Channel User
const uint8_t LC_GROUP_UPDT = 0x02U; // GRP VCH UPDT - Group Voice Channel Update

@ -1555,7 +1555,7 @@ void TrunkPacket::writeRF_TDULC(uint8_t duid, bool noNetwork)
}
//if (m_verbose) {
// LogMessage(LOG_RF, P25_TDULC_STR ", lc = $%02X, srcId = %u", m_netTDULC.getLCO(), m_netTDULC.getSrcId());
// LogMessage(LOG_RF, P25_TDULC_STR ", lc = $%02X, srcId = %u", m_rfTDULC.getLCO(), m_rfTDULC.getSrcId());
//}
}

Loading…
Cancel
Save

Powered by TurnKey Linux.