reorganize code, move Network class from host into common as its being used more as a generic peer network class; add some warning messaging to the FNE when a peer link or external peer (i.e. intra-FNE connection) drops;

pull/86/head
Bryan Biedenkapp 11 months ago
parent 0496737d46
commit a2fa303217

@ -77,7 +77,7 @@ include(CPack)
include(src/fne/CMakeLists.txt)
add_executable(dvmfne ${common_INCLUDE} ${dvmfne_SRC})
target_link_libraries(dvmfne PRIVATE common ${OPENSSL_LIBRARIES} asio::asio Threads::Threads)
target_include_directories(dvmfne PRIVATE ${OPENSSL_INCLUDE_DIR} src src/host src/fne)
target_include_directories(dvmfne PRIVATE ${OPENSSL_INCLUDE_DIR} src src/fne)
#
## dvmmon
@ -141,4 +141,4 @@ if (COMPILE_WIN32)
else ()
target_link_libraries(dvmbridge PRIVATE common vocoder ${OPENSSL_LIBRARIES} dl asio::asio Threads::Threads)
endif (COMPILE_WIN32)
target_include_directories(dvmbridge PRIVATE ${OPENSSL_INCLUDE_DIR} src src/host src/bridge)
target_include_directories(dvmbridge PRIVATE ${OPENSSL_INCLUDE_DIR} src src/bridge)

@ -8,9 +8,6 @@
# *
# */
file(GLOB bridge_SRC
"src/host/network/Network.h"
"src/host/network/Network.cpp"
"src/bridge/audio/*.h"
"src/bridge/audio/*.c"

@ -159,32 +159,32 @@ bool PeerNetwork::writeConfig()
json::object config = json::object();
// identity and frequency
config["identity"].set<std::string>(m_identity); // Identity
config["rxFrequency"].set<uint32_t>(m_rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_txFrequency); // Tx Frequency
config["identity"].set<std::string>(m_metadata->identity); // Identity
config["rxFrequency"].set<uint32_t>(m_metadata->rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_metadata->txFrequency); // Tx Frequency
// system info
json::object sysInfo = json::object();
sysInfo["latitude"].set<float>(m_latitude); // Latitude
sysInfo["longitude"].set<float>(m_longitude); // Longitude
sysInfo["latitude"].set<float>(m_metadata->latitude); // Latitude
sysInfo["longitude"].set<float>(m_metadata->longitude); // Longitude
sysInfo["height"].set<int>(m_height); // Height
sysInfo["location"].set<std::string>(m_location); // Location
sysInfo["height"].set<int>(m_metadata->height); // Height
sysInfo["location"].set<std::string>(m_metadata->location); // Location
config["info"].set<json::object>(sysInfo);
// channel data
json::object channel = json::object();
channel["txPower"].set<uint32_t>(m_power); // Tx Power
channel["txOffsetMhz"].set<float>(m_txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_channelNo); // Channel No
channel["txPower"].set<uint32_t>(m_metadata->power); // Tx Power
channel["txOffsetMhz"].set<float>(m_metadata->txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_metadata->chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_metadata->channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_metadata->channelNo); // Channel No
config["channel"].set<json::object>(channel);
// RCON
json::object rcon = json::object();
rcon["password"].set<std::string>(m_restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_restApiPort); // REST API Port
rcon["password"].set<std::string>(m_metadata->restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_metadata->restApiPort); // REST API Port
config["rcon"].set<json::object>(rcon);
config["software"].set<std::string>(std::string(software)); // Software ID

@ -22,7 +22,7 @@
#include "Defines.h"
#include "common/dmr/data/EmbeddedData.h"
#include "host/network/Network.h"
#include "common/network/Network.h"
#include <string>
#include <cstdint>

@ -1,10 +1,9 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Digital Voice Modem - Modem Host Software
* Digital Voice Modem - Common Library
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2015,2016,2017 Jonathan Naylor, G4KLX
* Copyright (C) 2017-2025 Bryan Biedenkapp, N2PLL
*
*/
@ -56,23 +55,10 @@ Network::Network(const std::string& address, uint16_t port, uint16_t localPort,
m_timeoutTimer(1000U, 60U),
m_pktSeq(0U),
m_loginStreamId(0U),
m_identity(),
m_rxFrequency(0U),
m_txFrequency(0U),
m_txOffsetMhz(0.0F),
m_chBandwidthKhz(0.0F),
m_channelId(0U),
m_channelNo(0U),
m_power(0U),
m_latitude(0.0F),
m_longitude(0.0F),
m_height(0),
m_location(),
m_restApiPassword(),
m_restApiPort(0),
m_conventional(false),
m_metadata(nullptr),
m_remotePeerId(0U),
m_promiscuousPeer(false),
m_userHandleProtocol(false),
m_dmrInCallCallback(nullptr),
m_p25InCallCallback(nullptr),
m_nxdnInCallCallback(nullptr),
@ -89,6 +75,8 @@ Network::Network(const std::string& address, uint16_t port, uint16_t localPort,
m_rxDMRStreamId[1U] = 0U;
m_rxP25StreamId = 0U;
m_rxNXDNStreamId = 0U;
m_metadata = new PeerMetadata();
}
/* Finalizes a instance of the Network class. */
@ -97,6 +85,7 @@ Network::~Network()
{
delete[] m_salt;
delete[] m_rxDMRStreamId;
delete m_metadata;
}
/* Resets the DMR ring buffer for the given slot. */
@ -143,28 +132,29 @@ void Network::setLookups(lookups::RadioIdLookup* ridLookup, lookups::TalkgroupRu
void Network::setMetadata(const std::string& identity, uint32_t rxFrequency, uint32_t txFrequency, float txOffsetMhz, float chBandwidthKhz,
uint8_t channelId, uint32_t channelNo, uint32_t power, float latitude, float longitude, int height, const std::string& location)
{
m_identity = identity;
m_rxFrequency = rxFrequency;
m_txFrequency = txFrequency;
m_txOffsetMhz = txOffsetMhz;
m_chBandwidthKhz = chBandwidthKhz;
m_channelId = channelId;
m_channelNo = channelNo;
m_power = power;
m_latitude = latitude;
m_longitude = longitude;
m_height = height;
m_location = location;
m_metadata->identity = identity;
m_metadata->rxFrequency = rxFrequency;
m_metadata->txFrequency = txFrequency;
m_metadata->txOffsetMhz = txOffsetMhz;
m_metadata->chBandwidthKhz = chBandwidthKhz;
m_metadata->channelId = channelId;
m_metadata->channelNo = channelNo;
m_metadata->power = power;
m_metadata->latitude = latitude;
m_metadata->longitude = longitude;
m_metadata->height = height;
m_metadata->location = location;
}
/* Sets REST API configuration settings from the modem. */
void Network::setRESTAPIData(const std::string& password, uint16_t port)
{
m_restApiPassword = password;
m_restApiPort = port;
m_metadata->restApiPassword = password;
m_metadata->restApiPort = port;
}
/* Sets endpoint preshared encryption key. */
@ -265,6 +255,13 @@ void Network::clock(uint32_t ms)
switch (fneHeader.getFunction()) {
case NET_FUNC::PROTOCOL:
{
// are protocol messages being user handled?
if (m_userHandleProtocol) {
userPacketHandler(fneHeader.getPeerId(), { fneHeader.getFunction(), fneHeader.getSubFunction() },
buffer.get(), length, fneHeader.getStreamId());
break;
}
if (fneHeader.getSubFunction() == NET_SUBFUNC::PROTOCOL_SUBFUNC_DMR) { // Encapsulated DMR data frame
if (m_enabled && m_dmrEnabled) {
uint32_t slotNo = (buffer[15U] & 0x80U) == 0x80U ? 1U : 0U; // this is the raw index for the stream ID array
@ -931,36 +928,38 @@ bool Network::writeConfig()
json::object config = json::object();
// identity and frequency
config["identity"].set<std::string>(m_identity); // Identity
config["rxFrequency"].set<uint32_t>(m_rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_txFrequency); // Tx Frequency
config["identity"].set<std::string>(m_metadata->identity); // Identity
config["rxFrequency"].set<uint32_t>(m_metadata->rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_metadata->txFrequency); // Tx Frequency
// system info
json::object sysInfo = json::object();
sysInfo["latitude"].set<float>(m_latitude); // Latitude
sysInfo["longitude"].set<float>(m_longitude); // Longitude
sysInfo["latitude"].set<float>(m_metadata->latitude); // Latitude
sysInfo["longitude"].set<float>(m_metadata->longitude); // Longitude
sysInfo["height"].set<int>(m_height); // Height
sysInfo["location"].set<std::string>(m_location); // Location
sysInfo["height"].set<int>(m_metadata->height); // Height
sysInfo["location"].set<std::string>(m_metadata->location); // Location
config["info"].set<json::object>(sysInfo);
// channel data
json::object channel = json::object();
channel["txPower"].set<uint32_t>(m_power); // Tx Power
channel["txOffsetMhz"].set<float>(m_txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_channelNo); // Channel No
channel["txPower"].set<uint32_t>(m_metadata->power); // Tx Power
channel["txOffsetMhz"].set<float>(m_metadata->txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_metadata->chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_metadata->channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_metadata->channelNo); // Channel No
config["channel"].set<json::object>(channel);
// RCON
json::object rcon = json::object();
rcon["password"].set<std::string>(m_restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_restApiPort); // REST API Port
rcon["password"].set<std::string>(m_metadata->restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_metadata->restApiPort); // REST API Port
config["rcon"].set<json::object>(rcon);
config["conventionalPeer"].set<bool>(m_conventional); // Conventional Peer Marker
config["software"].set<std::string>(std::string(software)); // Software ID
// Flags
config["conventionalPeer"].set<bool>(m_metadata->isConventional); // Conventional Peer Marker
config["software"].set<std::string>(std::string(software));
json::value v = json::value(config);
std::string json = v.serialize();

@ -1,27 +1,22 @@
// SPDX-License-Identifier: GPL-2.0-only
/**
* Digital Voice Modem - Modem Host Software
* Digital Voice Modem - Common Library
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright (C) 2015,2016,2017,2018 Jonathan Naylor, G4KLX
* Copyright (C) 2017-2023 Bryan Biedenkapp, N2PLL
* Copyright (C) 2017-2025 Bryan Biedenkapp, N2PLL
*
*/
/**
* @defgroup network Host Networking
* @brief Implementation for the host networking.
* @ingroup host
*
* @file Network.h
* @ingroup network
* @ingroup network_core
* @file Network.cpp
* @ingroup network
* @ingroup network_core
*/
#if !defined(__NETWORK_H__)
#define __NETWORK_H__
#include "Defines.h"
#include "common/Defines.h"
#include "common/network/BaseNetwork.h"
#include "common/lookups/RadioIdLookup.h"
#include "common/lookups/TalkgroupRulesLookup.h"
@ -33,6 +28,46 @@
namespace network
{
// ---------------------------------------------------------------------------
// Structure Declaration
// ---------------------------------------------------------------------------
/**
* @brief This structure represents a peer metadata.
* @ingroup network_core
*/
struct PeerMetadata {
/** @name Identity and Frequency */
std::string identity; //! Peer Identity
uint32_t rxFrequency; //! Peer Rx Frequency
uint32_t txFrequency; //! Peer Tx Frequency
/** @} */
/** @name System Info */
uint32_t power; //! Peer Tx Power (W)
float latitude; //! Location Latitude (decmial notation)
float longitude; //! Location Longitude (decmial notation)
int height; //! Height (M)
std::string location; //! Textual Location
/** @} */
/** @name Channel Data */
float txOffsetMhz; //! Tx Offset (MHz)
float chBandwidthKhz; //! Channel Bandwidth (kHz)
uint8_t channelId; //! Channel ID
uint32_t channelNo; //! Channel Number
/** @} */
/** @name RCON */
std::string restApiPassword; //! REST API Password
uint16_t restApiPort; //! REST API Port
/** @} */
/** @name Flags */
bool isConventional; //! Flag indicating peer is a conventional peer.
/** @} */
};
// ---------------------------------------------------------------------------
// Class Declaration
// ---------------------------------------------------------------------------
@ -115,7 +150,7 @@ namespace network
* @brief Sets a flag indicating whether the conventional option is sent to the FNE.
* @param conv Flag indicating conventional operation.
*/
void setConventional(bool conv) { m_conventional = conv; }
void setConventional(bool conv) { m_metadata->isConventional = conv; }
/**
* @brief Sets endpoint preshared encryption key.
* @param presharedKey Encryption preshared key for networking.
@ -208,35 +243,40 @@ namespace network
uint16_t m_pktSeq;
uint32_t m_loginStreamId;
/** station metadata */
std::string m_identity;
uint32_t m_rxFrequency;
uint32_t m_txFrequency;
float m_txOffsetMhz;
float m_chBandwidthKhz;
uint8_t m_channelId;
uint32_t m_channelNo;
uint32_t m_power;
float m_latitude;
float m_longitude;
int m_height;
std::string m_location;
std::string m_restApiPassword;
uint16_t m_restApiPort;
bool m_conventional;
PeerMetadata* m_metadata;
uint32_t m_remotePeerId;
/**
* @brief Flag indicating this peer will not perform peer ID checking and will process most incoming packets.
*/
bool m_promiscuousPeer;
/**
* @brief Flag indicating this peer will not handle protocol processing internally, and will forward processing
* to the defined user packet handler.
*/
bool m_userHandleProtocol;
/**
* @brief DMR In-Call Control Function Callback.
* (This is called when the master sends a In-Call Control request.)
*/
std::function<void(NET_ICC::ENUM command, uint32_t dstId, uint8_t slotNo)> m_dmrInCallCallback;
/**
* @brief P25 In-Call Control Function Callback.
* (This is called once the master sends a In-Call Control request.)
*/
std::function<void(NET_ICC::ENUM command, uint32_t dstId)> m_p25InCallCallback;
/**
* @brief NXDN In-Call Control Function Callback.
* (This is called once the master sends a In-Call Control request.)
*/
std::function<void(NET_ICC::ENUM command, uint32_t dstId)> m_nxdnInCallCallback;
/**
* @brief Encryption Key Response Function Callback.
* (This is called once the master responds to a key request.)
*/
std::function<void(p25::kmm::KeyItem ki, uint8_t algId, uint8_t keyLength)> m_keyRespCallback;
/**

@ -8,9 +8,6 @@
# *
# */
file(GLOB dvmfne_SRC
"src/host/network/Network.h"
"src/host/network/Network.cpp"
"src/fne/network/callhandler/*.h"
"src/fne/network/callhandler/*.cpp"
"src/fne/network/callhandler/packetdata/*.h"

@ -303,6 +303,19 @@ void FNENetwork::clock(uint32_t ms)
if (dt < now) {
LogInfoEx(LOG_NET, "PEER %u (%s) timed out, dt = %u, now = %u", id, connection->identity().c_str(),
dt, now);
// set connection states for this stale connection
connection->connected(false);
connection->connectionState(NET_STAT_INVALID);
// if the connection was an external peer or a peer link -- be noisy about a possible
// netsplit
if (connection->isExternalPeer() || connection->isPeerLink()) {
for (uint8_t i = 0U; i < 3U; i++)
LogWarning(LOG_NET, "PEER %u (%s) downstream netsplit, dt = %u, now = %u", id, connection->identity().c_str(),
dt, now);
}
peersToRemove.push_back(id);
}
}

@ -31,9 +31,9 @@
#include "common/lookups/RadioIdLookup.h"
#include "common/lookups/TalkgroupRulesLookup.h"
#include "common/lookups/PeerListLookup.h"
#include "common/network/Network.h"
#include "fne/network/influxdb/InfluxDB.h"
#include "fne/CryptoContainer.h"
#include "host/network/Network.h"
#include <string>
#include <cstdint>

@ -565,36 +565,38 @@ bool PeerNetwork::writeConfig()
json::object config = json::object();
// identity and frequency
config["identity"].set<std::string>(m_identity); // Identity
config["rxFrequency"].set<uint32_t>(m_rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_txFrequency); // Tx Frequency
config["identity"].set<std::string>(m_metadata->identity); // Identity
config["rxFrequency"].set<uint32_t>(m_metadata->rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_metadata->txFrequency); // Tx Frequency
// system info
json::object sysInfo = json::object();
sysInfo["latitude"].set<float>(m_latitude); // Latitude
sysInfo["longitude"].set<float>(m_longitude); // Longitude
sysInfo["latitude"].set<float>(m_metadata->latitude); // Latitude
sysInfo["longitude"].set<float>(m_metadata->longitude); // Longitude
sysInfo["height"].set<int>(m_height); // Height
sysInfo["location"].set<std::string>(m_location); // Location
sysInfo["height"].set<int>(m_metadata->height); // Height
sysInfo["location"].set<std::string>(m_metadata->location); // Location
config["info"].set<json::object>(sysInfo);
// channel data
json::object channel = json::object();
channel["txPower"].set<uint32_t>(m_power); // Tx Power
channel["txOffsetMhz"].set<float>(m_txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_channelNo); // Channel No
channel["txPower"].set<uint32_t>(m_metadata->power); // Tx Power
channel["txOffsetMhz"].set<float>(m_metadata->txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_metadata->chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_metadata->channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_metadata->channelNo); // Channel No
config["channel"].set<json::object>(channel);
// RCON
json::object rcon = json::object();
rcon["password"].set<std::string>(m_restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_restApiPort); // REST API Port
rcon["password"].set<std::string>(m_metadata->restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_metadata->restApiPort); // REST API Port
config["rcon"].set<json::object>(rcon);
// Flags
bool external = true;
config["externalPeer"].set<bool>(external); // External Peer Marker
config["software"].set<std::string>(std::string(software)); // Software ID
json::value v = json::value(config);

@ -18,7 +18,7 @@
#include "Defines.h"
#include "common/lookups/PeerListLookup.h"
#include "host/network/Network.h"
#include "common/network/Network.h"
#include <string>
#include <cstdint>
@ -31,7 +31,7 @@ namespace network
// ---------------------------------------------------------------------------
/**
* @brief Implements the core peer networking logic.
* @brief Implements the FNE peer networking logic.
* @ingroup fne_network
*/
class HOST_SW_API PeerNetwork : public Network {

@ -33,11 +33,11 @@
#include "common/lookups/RadioIdLookup.h"
#include "common/lookups/TalkgroupRulesLookup.h"
#include "common/network/json/json.h"
#include "common/network/Network.h"
#include "common/yaml/Yaml.h"
#include "dmr/Control.h"
#include "p25/Control.h"
#include "nxdn/Control.h"
#include "network/Network.h"
#include "network/RESTAPI.h"
#include "modem/Modem.h"
#include "modem/ModemV24.h"

@ -32,11 +32,11 @@
#include "common/lookups/RadioIdLookup.h"
#include "common/lookups/TalkgroupRulesLookup.h"
#include "common/network/RTPFNEHeader.h"
#include "common/network/Network.h"
#include "common/yaml/Yaml.h"
#include "dmr/lookups/DMRAffiliationLookup.h"
#include "dmr/Slot.h"
#include "modem/Modem.h"
#include "network/Network.h"
namespace dmr
{

@ -23,6 +23,7 @@
#include "common/lookups/IdenTableLookup.h"
#include "common/lookups/RadioIdLookup.h"
#include "common/lookups/TalkgroupRulesLookup.h"
#include "common/network/Network.h"
#include "common/RingBuffer.h"
#include "common/StopWatch.h"
#include "common/Timer.h"
@ -32,7 +33,6 @@
#include "dmr/packet/Data.h"
#include "dmr/packet/Voice.h"
#include "modem/Modem.h"
#include "network/Network.h"
#include <vector>
#include <mutex>

@ -32,6 +32,7 @@
#include "common/lookups/TalkgroupRulesLookup.h"
#include "common/lookups/AffiliationLookup.h"
#include "common/network/RTPFNEHeader.h"
#include "common/network/Network.h"
#include "common/RingBuffer.h"
#include "common/StopWatch.h"
#include "common/Timer.h"
@ -39,7 +40,6 @@
#include "nxdn/packet/Voice.h"
#include "nxdn/packet/ControlSignaling.h"
#include "nxdn/packet/Data.h"
#include "network/Network.h"
#include "modem/Modem.h"
#include <cstdio>

@ -32,6 +32,7 @@
#include "common/lookups/RadioIdLookup.h"
#include "common/lookups/TalkgroupRulesLookup.h"
#include "common/network/RTPFNEHeader.h"
#include "common/network/Network.h"
#include "common/p25/SiteData.h"
#include "common/RingBuffer.h"
#include "common/StopWatch.h"
@ -40,7 +41,6 @@
#include "p25/packet/Data.h"
#include "p25/packet/Voice.h"
#include "p25/packet/ControlSignaling.h"
#include "network/Network.h"
#include "p25/lookups/P25AffiliationLookup.h"
#include "modem/Modem.h"

@ -9,8 +9,6 @@
# */
file(GLOB sysView_SRC
"src/host/modem/Modem.h"
"src/host/network/Network.h"
"src/host/network/Network.cpp"
"src/remote/RESTClient.cpp"
"src/remote/RESTClient.h"

@ -1,6 +1,6 @@
// SPDX-License-Identifier: PROPRIETARY
/*
* Digital Voice Modem - FNE Affiliations View
* Digital Voice Modem - FNE System View
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -426,40 +426,42 @@ bool PeerNetwork::writeConfig()
json::object config = json::object();
// identity and frequency
config["identity"].set<std::string>(m_identity); // Identity
config["rxFrequency"].set<uint32_t>(m_rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_txFrequency); // Tx Frequency
config["identity"].set<std::string>(m_metadata->identity); // Identity
config["rxFrequency"].set<uint32_t>(m_metadata->rxFrequency); // Rx Frequency
config["txFrequency"].set<uint32_t>(m_metadata->txFrequency); // Tx Frequency
// system info
json::object sysInfo = json::object();
sysInfo["latitude"].set<float>(m_latitude); // Latitude
sysInfo["longitude"].set<float>(m_longitude); // Longitude
sysInfo["latitude"].set<float>(m_metadata->latitude); // Latitude
sysInfo["longitude"].set<float>(m_metadata->longitude); // Longitude
sysInfo["height"].set<int>(m_height); // Height
sysInfo["location"].set<std::string>(m_location); // Location
sysInfo["height"].set<int>(m_metadata->height); // Height
sysInfo["location"].set<std::string>(m_metadata->location); // Location
config["info"].set<json::object>(sysInfo);
// channel data
json::object channel = json::object();
channel["txPower"].set<uint32_t>(m_power); // Tx Power
channel["txOffsetMhz"].set<float>(m_txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_channelNo); // Channel No
channel["txPower"].set<uint32_t>(m_metadata->power); // Tx Power
channel["txOffsetMhz"].set<float>(m_metadata->txOffsetMhz); // Tx Offset (Mhz)
channel["chBandwidthKhz"].set<float>(m_metadata->chBandwidthKhz); // Ch. Bandwidth (khz)
channel["channelId"].set<uint8_t>(m_metadata->channelId); // Channel ID
channel["channelNo"].set<uint32_t>(m_metadata->channelNo); // Channel No
config["channel"].set<json::object>(channel);
// RCON
json::object rcon = json::object();
rcon["password"].set<std::string>(m_restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_restApiPort); // REST API Port
rcon["password"].set<std::string>(m_metadata->restApiPassword); // REST API Password
rcon["port"].set<uint16_t>(m_metadata->restApiPort); // REST API Port
config["rcon"].set<json::object>(rcon);
// Flags
bool external = true;
config["externalPeer"].set<bool>(external); // External Peer Marker
bool convPeer = true;
config["conventionalPeer"].set<bool>(convPeer); // Conventional Peer Marker
bool sysView = true;
config["sysView"].set<bool>(sysView); // SysView Peer Marker
config["software"].set<std::string>(std::string(software)); // Software ID
json::value v = json::value(config);

@ -1,6 +1,6 @@
// SPDX-License-Identifier: PROPRIETARY
/*
* Digital Voice Modem - FNE Affiliations View
* Digital Voice Modem - FNE System View
* GPLv2 Open Source. Use is subject to license terms.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -8,20 +8,20 @@
*
*/
/**
* @defgroup fneAffView_network Networking
* @brief Implementation for the FNE networking.
* @ingroup fneAffView
* @defgroup fneSysView_network Networking
* @brief Implementation for the SysView networking.
* @ingroup fneSysView
*
* @file PeerNetwork.h
* @ingroup fneAffView_network
* @ingroup fneSysView
* @file PeerNetwork.cpp
* @ingroup fneAffView_network
* @ingroup fneSysView
*/
#if !defined(__PEER_NETWORK_H__)
#define __PEER_NETWORK_H__
#include "Defines.h"
#include "host/network/Network.h"
#include "common/network/Network.h"
#include <string>
#include <cstdint>
@ -31,9 +31,12 @@ namespace network
{
// ---------------------------------------------------------------------------
// Class Declaration
// Implements the core peer networking logic.
// ---------------------------------------------------------------------------
/**
* @brief Implements the SysView peer networking logic.
* @ingroup fneAffView_network
*/
class HOST_SW_API PeerNetwork : public Network {
public:
/**

Loading…
Cancel
Save

Powered by TurnKey Linux.