From 01dfa15173aa35453b32af009b4f683e2b203ff7 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Mon, 18 Dec 2023 13:47:10 -0500 Subject: [PATCH] correct some issues with NXDN channel identification and some incorrect restriction calculations; --- src/nxdn/Control.cpp | 8 ++++---- src/nxdn/SiteData.h | 8 ++++---- src/nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.cpp | 4 ++-- src/nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.cpp | 6 +++--- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/nxdn/Control.cpp b/src/nxdn/Control.cpp index 3353a4fc..165db438 100644 --- a/src/nxdn/Control.cpp +++ b/src/nxdn/Control.cpp @@ -286,11 +286,11 @@ void Control::setOptions(yaml::Node& conf, bool supervisor, const std::string cw ** Site Data */ // calculate the NXDN location ID - uint32_t locId = NXDN_LOC_CAT_LOCAL; // DVM is currently fixed to "local" category - locId = (locId << 17) + sysId; - locId = (locId << 5) + (siteId & 0x1FU); + uint32_t locId = NXDN_LOC_CAT_GLOBAL; // DVM is currently fixed to "global" category + locId = (locId << 10) + (sysId & 0x3FFU); + locId = (locId << 12) + (siteId & 0xFFFU); - m_siteData = SiteData(locId, channelId, channelNo, serviceClass, false); + m_siteData = SiteData(locId, channelId, (channelNo & 0x3FF), serviceClass, false); m_siteData.setCallsign(cwCallsign); for (uint32_t ch : voiceChNo) { diff --git a/src/nxdn/SiteData.h b/src/nxdn/SiteData.h index fbc604be..a73ba749 100644 --- a/src/nxdn/SiteData.h +++ b/src/nxdn/SiteData.h @@ -63,8 +63,8 @@ namespace nxdn /// SiteData(uint32_t locId, uint8_t channelId, uint32_t channelNo, uint8_t serviceClass, bool requireReq) : m_locId(locId), - m_channelId(1U), - m_channelNo(1U), + m_channelId(channelId), + m_channelNo(channelNo), m_serviceClass(NXDN_SIF1_VOICE_CALL_SVC | NXDN_SIF1_DATA_CALL_SVC), m_isAdjSite(false), m_callsign("CHANGEME"), @@ -75,8 +75,8 @@ namespace nxdn m_locId = 0xFFFFFFU; // channel id clamping - if (channelId > 15U) - channelId = 15U; + if (m_channelId > 15U) + m_channelId = 15U; // channel number clamping if (m_channelNo == 0U) { // clamp to 1 diff --git a/src/nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.cpp b/src/nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.cpp index 55011311..30d3ffcf 100644 --- a/src/nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.cpp +++ b/src/nxdn/lc/rcch/MESSAGE_TYPE_SITE_INFO.cpp @@ -96,11 +96,11 @@ void MESSAGE_TYPE_SITE_INFO::encode(uint8_t* data, uint32_t length, uint32_t off // bryanb: this is currently fixed -- maybe dynamic in the future rcch[8U] = 0U; // Restriction Information - No access restriction / No cycle restriction - rcch[9U] = 0x08U; // ... - No group restriction / GMS; Location Registration Restriction + rcch[9U] = 0U; // ... - No group restriction / No Location Registration Restriction rcch[10U] = (!m_siteData.netActive() ? 0x01U : 0x00U); // ... - No group ratio restriction / No delay time extension / ISO // bryanb: this is currently fixed -- maybe dynamic in the future - rcch[11U] = NXDN_CH_ACCESS_BASE_FREQ_SYS_DEFINED; // Channel Access Information - Channel Version / Sys Defined Step / Sys Defined Base Freq + rcch[11U] = NXDN_CH_ACCESS_BASE_FREQ_SYS_DEFINED << 2; // Channel Access Information - Channel Version / Sys Defined Step / Sys Defined Base Freq rcch[14U] = 1U; // Version diff --git a/src/nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.cpp b/src/nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.cpp index f42138ae..b5e6041f 100644 --- a/src/nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.cpp +++ b/src/nxdn/lc/rcch/MESSAGE_TYPE_SRV_INFO.cpp @@ -83,9 +83,9 @@ void MESSAGE_TYPE_SRV_INFO::encode(uint8_t* data, uint32_t length, uint32_t offs rcch[5U] = (m_siteData.netActive() ? NXDN_SIF2_IP_NETWORK : 0x00U); // ... // bryanb: this is currently fixed -- maybe dynamic in the future - rcch[6U] = 0U; // Restriction Information - No access restriction / No cycle restriction - rcch[7U] = 0x08U; // ... - No group restriction / GMS; Location Registration Restriction - rcch[8U] = (!m_siteData.netActive() ? 0x01U : 0x00U); // ... - No group ratio restriction / No delay time extension / ISO + rcch[8U] = 0U; // Restriction Information - No access restriction / No cycle restriction + rcch[9U] = 0U; // ... - No group restriction / No Location Registration Restriction + rcch[10U] = (!m_siteData.netActive() ? 0x01U : 0x00U); // ... - No group ratio restriction / No delay time extension / ISO RCCH::encode(data, rcch, length, offset); }