minor fixes and cleanups; allow transmitted service class properly reflect registration and composite classes based on configured options;

pull/1/head
Bryan Biedenkapp 5 years ago
parent e71e946990
commit a66f91fe2f

@ -1042,8 +1042,13 @@ int Host::run()
setMode(HOST_STATE_QUIT);
delete dmr;
delete p25;
if (dmr != NULL) {
delete dmr;
}
if (p25 != NULL) {
delete p25;
}
return EXIT_SUCCESS;
}
@ -1482,8 +1487,10 @@ void Host::setMode(uint8_t mode)
m_modeTimer.stop();
if (m_mode == HOST_STATE_QUIT) {
m_modem->close();
delete m_modem;
if (m_modem != NULL) {
m_modem->close();
delete m_modem;
}
if (m_tidLookup != NULL) {
m_tidLookup->stop();

@ -1834,25 +1834,25 @@ void HostCal::printDebug(const uint8_t* buffer, uint32_t length)
}
else if (buffer[2U] == CMD_DEBUG2) {
short val1 = (buffer[length - 2U] << 8) | buffer[length - 1U];
LogMessage(LOG_MODEM, "M: %.*s %d", length - 5U, buffer + 3U, val1);
LogMessage(LOG_MODEM, "M: %.*s %X", length - 5U, buffer + 3U, val1);
}
else if (buffer[2U] == CMD_DEBUG3) {
short val1 = (buffer[length - 4U] << 8) | buffer[length - 3U];
short val2 = (buffer[length - 2U] << 8) | buffer[length - 1U];
LogMessage(LOG_MODEM, "M: %.*s %d %d", length - 7U, buffer + 3U, val1, val2);
LogMessage(LOG_MODEM, "M: %.*s %X %X", length - 7U, buffer + 3U, val1, val2);
}
else if (buffer[2U] == CMD_DEBUG4) {
short val1 = (buffer[length - 6U] << 8) | buffer[length - 5U];
short val2 = (buffer[length - 4U] << 8) | buffer[length - 3U];
short val3 = (buffer[length - 2U] << 8) | buffer[length - 1U];
LogMessage(LOG_MODEM, "M: %.*s %d %d %d", length - 9U, buffer + 3U, val1, val2, val3);
LogMessage(LOG_MODEM, "M: %.*s %X %X %X", length - 9U, buffer + 3U, val1, val2, val3);
}
else if (buffer[2U] == CMD_DEBUG5) {
short val1 = (buffer[length - 8U] << 8) | buffer[length - 7U];
short val2 = (buffer[length - 6U] << 8) | buffer[length - 5U];
short val3 = (buffer[length - 4U] << 8) | buffer[length - 3U];
short val4 = (buffer[length - 2U] << 8) | buffer[length - 1U];
LogMessage(LOG_MODEM, "M: %.*s %d %d %d %d", length - 11U, buffer + 3U, val1, val2, val3, val4);
LogMessage(LOG_MODEM, "M: %.*s %X %X %X %X", length - 11U, buffer + 3U, val1, val2, val3, val4);
}
}

@ -1332,25 +1332,25 @@ void Modem::printDebug()
}
else if (m_buffer[2U] == CMD_DEBUG2) {
short val1 = (m_buffer[m_length - 2U] << 8) | m_buffer[m_length - 1U];
LogDebug(LOG_MODEM, "M: %.*s %d", m_length - 5U, m_buffer + 3U, val1);
LogDebug(LOG_MODEM, "M: %.*s %X", m_length - 5U, m_buffer + 3U, val1);
}
else if (m_buffer[2U] == CMD_DEBUG3) {
short val1 = (m_buffer[m_length - 4U] << 8) | m_buffer[m_length - 3U];
short val2 = (m_buffer[m_length - 2U] << 8) | m_buffer[m_length - 1U];
LogDebug(LOG_MODEM, "M: %.*s %d %d", m_length - 7U, m_buffer + 3U, val1, val2);
LogDebug(LOG_MODEM, "M: %.*s %X %X", m_length - 7U, m_buffer + 3U, val1, val2);
}
else if (m_buffer[2U] == CMD_DEBUG4) {
short val1 = (m_buffer[m_length - 6U] << 8) | m_buffer[m_length - 5U];
short val2 = (m_buffer[m_length - 4U] << 8) | m_buffer[m_length - 3U];
short val3 = (m_buffer[m_length - 2U] << 8) | m_buffer[m_length - 1U];
LogDebug(LOG_MODEM, "M: %.*s %d %d %d", m_length - 9U, m_buffer + 3U, val1, val2, val3);
LogDebug(LOG_MODEM, "M: %.*s %X %X %X", m_length - 9U, m_buffer + 3U, val1, val2, val3);
}
else if (m_buffer[2U] == CMD_DEBUG5) {
short val1 = (m_buffer[m_length - 8U] << 8) | m_buffer[m_length - 7U];
short val2 = (m_buffer[m_length - 6U] << 8) | m_buffer[m_length - 5U];
short val3 = (m_buffer[m_length - 4U] << 8) | m_buffer[m_length - 3U];
short val4 = (m_buffer[m_length - 2U] << 8) | m_buffer[m_length - 1U];
LogDebug(LOG_MODEM, "M: %.*s %d %d %d %d", m_length - 11U, m_buffer + 3U, val1, val2, val3, val4);
LogDebug(LOG_MODEM, "M: %.*s %X %X %X %X", m_length - 11U, m_buffer + 3U, val1, val2, val3, val4);
}
}

@ -212,6 +212,7 @@ void Control::setOptions(yaml::Node& conf, const std::string cwCallsign, const s
m_voiceOnControl = p25Protocol["voiceOnControl"].as<bool>(false);
m_ackTSBKRequests = control["ackRequests"].as<bool>(true);
m_trunk->setServiceClass(m_control, m_voiceOnControl);
m_voice->m_silenceThreshold = p25Protocol["silenceThreshold"].as<uint32_t>(p25::DEFAULT_SILENCE_THRESHOLD);

@ -194,6 +194,29 @@ void TrunkPacket::setSiteChCnt(uint8_t chCnt)
m_netTSBK.setSiteChCnt(chCnt);
}
/// <summary>
/// Sets the service class for this site.
/// </summary>
/// <param name="control"></param>
/// <param name="voiceOnControl"></param>
void TrunkPacket::setServiceClass(bool control, bool voiceOnControl)
{
uint8_t serviceClass = P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA;
if (control) {
serviceClass |= P25_SVC_CLS_REG;
}
if (voiceOnControl) {
serviceClass |= P25_SVC_CLS_COMPOSITE;
}
m_rfTSBK.setServiceClass(serviceClass);
m_netTSBK.setServiceClass(serviceClass);
m_rfTDULC.setServiceClass(serviceClass);
m_netTDULC.setServiceClass(serviceClass);
}
/// <summary>
/// Resets the data states for the RF interface.
/// </summary>
@ -797,6 +820,9 @@ bool TrunkPacket::processNetwork(uint8_t* data, uint32_t len, lc::LC& control, d
case TSBK_OSP_U_DEREG_ACK:
// ignore a network user deregistration command
break;
case TSBK_OSP_LOC_REG_RSP:
// ignore a network location registration command
break;
case TSBK_OSP_DENY_RSP:
if (m_verbose) {
LogMessage(LOG_NET, P25_TSDU_STR ", TSBK_OSP_DENY_RSP (Deny Response), AIV = %u, reason = $%02X, srcId = %u, dstId = %u",

@ -69,6 +69,8 @@ namespace p25
void setNetActive(bool active);
/// <summary>Sets the total number of channels at the site.</summary>
void setSiteChCnt(uint8_t chCnt);
/// <summary>Sets the service class for this site.</summary>
void setServiceClass(bool control, bool voiceOnControl);
/// <summary>Resets the data states for the RF interface.</summary>
void resetRF();

@ -56,6 +56,7 @@ TDULC::TDULC() :
m_mfId(P25_MFG_STANDARD),
m_srcId(0U),
m_dstId(0U),
m_serviceClass(P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA),
m_emergency(false),
m_encrypted(false),
m_priority(4U),
@ -370,8 +371,7 @@ void TDULC::encodeLC(uint8_t* rs)
rsValue = (rsValue << 8) + m_adjSiteId; // Site ID
rsValue = (rsValue << 4) + m_adjChannelId; // Channel ID
rsValue = (rsValue << 12) + m_adjChannelNo; // Channel Number
rsValue = (rsValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
rsValue = (rsValue << 8) + m_serviceClass; // System Service Class
}
else {
LogError(LOG_P25, "invalid values for LC_ADJ_STS_BCAST, tsbkAdjSiteRFSSId = $%02X, tsbkAdjSiteId = $%02X, tsbkAdjSiteChannel = $%02X",
@ -388,8 +388,7 @@ void TDULC::encodeLC(uint8_t* rs)
rsValue = (rsValue << 8) + m_siteData.siteId(); // Site ID
rsValue = (rsValue << 4) + m_siteData.channelId(); // Channel ID
rsValue = (rsValue << 12) + m_siteData.channelNo(); // Channel Number
rsValue = (rsValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
rsValue = (rsValue << 8) + m_serviceClass; // System Service Class
break;
case LC_NET_STS_BCAST:
rs[0U] |= 0x40U; // Implicit Operation
@ -398,8 +397,7 @@ void TDULC::encodeLC(uint8_t* rs)
rsValue = (rsValue << 12) + m_siteData.sysId(); // System ID
rsValue = (rsValue << 4) + m_siteData.channelId(); // Channel ID
rsValue = (rsValue << 12) + m_siteData.channelNo(); // Channel Number
rsValue = (rsValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
rsValue = (rsValue << 8) + m_serviceClass; // System Service Class
break;
default:
LogError(LOG_P25, "unknown LC value, mfId = $%02X, lco = $%02X", m_mfId, m_lco);

@ -96,6 +96,9 @@ namespace p25
/// <summary>Destination ID.</summary>
__PROPERTY(uint32_t, dstId, DstId);
/// <summary>Service class.</summary>
__PROPERTY(uint8_t, serviceClass, ServiceClass);
/// <summary>Voice channel number.</summary>
__PROPERTY(uint32_t, grpVchNo, GrpVchNo);

@ -58,6 +58,7 @@ TSBK::TSBK() :
m_lastBlock(false),
m_aivFlag(true),
m_extendedAddrFlag(false),
m_serviceClass(P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA),
m_emergency(false),
m_encrypted(false),
m_priority(4U),
@ -445,12 +446,10 @@ void TSBK::encode(uint8_t * data, bool singleBlock)
tsbkValue = (tsbkValue << 12) + m_sccbChannelNo; // Channel (R) Number
if (m_sccbChannelId1 > 0) {
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
tsbkValue = (tsbkValue << 8) + m_serviceClass; // System Service Class
}
else {
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_INVALID);
tsbkValue = (tsbkValue << 8) + (P25_SVC_CLS_INVALID); // System Service Class
}
break;
case TSBK_OSP_GRP_AFF_Q:
@ -513,21 +512,17 @@ void TSBK::encode(uint8_t * data, bool singleBlock)
tsbkValue = (tsbkValue << 8) + m_siteData.siteId(); // Site ID
tsbkValue = (tsbkValue << 16) + m_sccbChannelId1; // SCCB Channel ID 1
if (m_sccbChannelId1 > 0) {
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
tsbkValue = (tsbkValue << 8) + m_serviceClass; // System Service Class
}
else {
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_INVALID);
tsbkValue = (tsbkValue << 8) + (P25_SVC_CLS_INVALID); // System Service Class
}
tsbkValue = (tsbkValue << 16) + m_sccbChannelId2; // SCCB Channel ID 2
if (m_sccbChannelId2 > 0) {
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
tsbkValue = (tsbkValue << 8) + m_serviceClass; // System Service Class
}
else {
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_INVALID);
tsbkValue = (tsbkValue << 8) + (P25_SVC_CLS_INVALID); // System Service Class
}
break;
case TSBK_OSP_RFSS_STS_BCAST:
@ -539,8 +534,7 @@ void TSBK::encode(uint8_t * data, bool singleBlock)
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) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
tsbkValue = (tsbkValue << 8) + m_serviceClass; // System Service Class
break;
case TSBK_OSP_NET_STS_BCAST:
tsbkValue = m_siteData.lra(); // Location Registration Area
@ -548,8 +542,7 @@ void TSBK::encode(uint8_t * data, bool singleBlock)
tsbkValue = (tsbkValue << 12) + m_siteData.sysId(); // System ID
tsbkValue = (tsbkValue << 4) + m_siteData.channelId(); // Channel ID
tsbkValue = (tsbkValue << 12) + m_siteData.channelNo(); // Channel Number
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
tsbkValue = (tsbkValue << 8) + m_serviceClass; // System Service Class
break;
case TSBK_OSP_ADJ_STS_BCAST:
{
@ -565,8 +558,7 @@ void TSBK::encode(uint8_t * data, bool singleBlock)
tsbkValue = (tsbkValue << 8) + m_adjSiteId; // Site ID
tsbkValue = (tsbkValue << 4) + m_adjChannelId; // Channel ID
tsbkValue = (tsbkValue << 12) + m_adjChannelNo; // Channel Number
tsbkValue = (tsbkValue << 8) + // System Service Class
(P25_SVC_CLS_COMPOSITE | P25_SVC_CLS_VOICE | P25_SVC_CLS_DATA | P25_SVC_CLS_REG);
tsbkValue = (tsbkValue << 8) + m_serviceClass; // System Service Class
}
else {
LogError(LOG_P25, "invalid values for OSP_ADJ_STS_BCAST, adjRfssId = $%02X, adjSiteId = $%02X, adjChannelId = %u, adjChannelNo = $%02X",

@ -113,6 +113,9 @@ namespace p25
/// <summary>Service type.</summary>
__PROPERTY(uint8_t, service, Service);
/// <summary>Service class.</summary>
__PROPERTY(uint8_t, serviceClass, ServiceClass);
/// <summary>Response type.</summary>
__PROPERTY(uint8_t, response, Response);

Loading…
Cancel
Save

Powered by TurnKey Linux.