From 285e45c0e2a40c81adbf5aeafb8cba99da3088a9 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Wed, 9 Oct 2024 17:44:46 -0400 Subject: [PATCH] add freq display to peer list; --- src/sysview/PeerListWnd.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/src/sysview/PeerListWnd.h b/src/sysview/PeerListWnd.h index 9de68650..2dececd6 100644 --- a/src/sysview/PeerListWnd.h +++ b/src/sysview/PeerListWnd.h @@ -157,6 +157,28 @@ public: g_peerIdentityNameMap[peerId] = std::string(identity); + std::ostringstream txOss; + std::ostringstream rxOss; + if (chNo > 0U) { + IdenTable idenEntry = g_idenTable->find(chId); + if (idenEntry.baseFrequency() == 0U) { + ::LogError(LOG_HOST, "Channel Id %u has an invalid base frequency.", chId); + } + + if (idenEntry.txOffsetMhz() == 0U) { + ::LogError(LOG_HOST, "Channel Id %u has an invalid Tx offset.", chId); + } + + uint32_t calcSpace = (uint32_t)(idenEntry.chSpaceKhz() / 0.125); + float calcTxOffset = idenEntry.txOffsetMhz() * 1000000.0; + + uint32_t rxFrequency = (uint32_t)((idenEntry.baseFrequency() + ((calcSpace * 125) * chNo)) + (uint32_t)calcTxOffset); + uint32_t txFrequency = (uint32_t)((idenEntry.baseFrequency() + ((calcSpace * 125) * chNo))); + + txOss << std::fixed << std::setprecision(5) << (double)(txFrequency / 1000000.0); + rxOss << std::fixed << std::setprecision(5) << (double)(rxFrequency / 1000000.0); + } + // pad peer IDs properly std::ostringstream peerOss; peerOss << std::setw(9) << std::setfill('0') << peerId; @@ -166,7 +188,7 @@ public: ccPeerOss << std::setw(9) << std::setfill('0') << ccPeerId; // build list view entry - const std::array columns = { + const std::array columns = { peerOss.str(), identity, software, peerAddress, std::to_string(port), @@ -175,7 +197,8 @@ public: (connected) ? "X" : "", strConnState, std::to_string(pingsReceived), - std::to_string(chId), std::to_string(chNo) + std::to_string(chId), std::to_string(chNo), + rxOss.str(), txOss.str() }; const finalcut::FStringList line(columns.cbegin(), columns.cend()); @@ -241,6 +264,8 @@ private: m_listView.addColumn("Pings Received", 8); m_listView.addColumn("Ch. ID", 8); m_listView.addColumn("Ch. No", 8); + m_listView.addColumn("Rx Freq", 9); + m_listView.addColumn("Tx Freq", 9); // set right alignment for TGID m_listView.setColumnAlignment(1, finalcut::Align::Right);