report network peer ID in status API call; display network peer ID on dvmmon;

pull/33/head
Bryan Biedenkapp 3 years ago
parent 31d9a3e1c3
commit ee74cad81b

@ -2293,7 +2293,7 @@ bool Host::createNetwork()
uint16_t restApiPort = (uint16_t)networkConf["restPort"].as<uint32_t>(REST_API_DEFAULT_PORT);
std::string restApiPassword = networkConf["restPassword"].as<std::string>();
bool restApiDebug = networkConf["restDebug"].as<bool>(false);
uint32_t id = networkConf["id"].as<uint32_t>(1001U);
uint32_t id = networkConf["id"].as<uint32_t>(1000U);
uint32_t jitter = networkConf["talkgroupHang"].as<uint32_t>(360U);
std::string password = networkConf["password"].as<std::string>();
bool slot1 = networkConf["slot1"].as<bool>(true);
@ -2303,6 +2303,11 @@ bool Host::createNetwork()
bool updateLookup = networkConf["updateLookups"].as<bool>(false);
bool debug = networkConf["debug"].as<bool>(false);
if (id > 999999999U) {
::LogError(LOG_HOST, "Network Peer ID cannot be greater then 999999999.");
return false;
}
if (restApiPassword.length() > 64) {
std::string password = restApiPassword;
restApiPassword = password.substr(0, 64);

@ -199,7 +199,8 @@ private:
wnd->addCallback("update-selected", this, [&](NodeStatusWnd* wnd) {
std::stringstream ss;
ss << (uint32_t)(wnd->getChannelId()) << "-" << wnd->getChannelNo() << " / "
<< wnd->getChData().address() << ":" << wnd->getChData().port();
<< wnd->getChData().address() << ":" << wnd->getChData().port() << " / "
<< "Peer ID " << (uint32_t)(wnd->getPeerId());
m_selectWnd.setSelectedText(ss.str());
m_selectedCh = wnd->getChData();

@ -86,6 +86,8 @@ public:
lookups::VoiceChData getChData() { return m_chData; }
/// <summary>Sets the channel data.</summary>
void setChData(lookups::VoiceChData chData) { m_chData = chData; }
/// <summary>Gets the peer ID.</summary>
uint32_t getPeerId() const { return m_peerId; }
private:
int m_timerId;
@ -98,8 +100,10 @@ private:
lookups::VoiceChData m_chData;
uint8_t m_channelId;
uint32_t m_channelNo;
uint32_t m_peerId;
FLabel m_modeStr{this};
FLabel m_peerIdStr{this};
FLabel m_channelNoLabel{"Ch. No.: ", this};
FLabel m_chanNo{this};
@ -166,6 +170,9 @@ private:
m_modeStr.setAlignment(Align::Right);
m_modeStr.setEmphasis();
m_peerIdStr.setGeometry(FPoint(17, 2), FSize(9, 1));
m_peerIdStr.setAlignment(Align::Right);
// channel number
{
m_channelNoLabel.setGeometry(FPoint(2, 1), FSize(10, 1));
@ -292,6 +299,11 @@ private:
break;
}
if (rsp["peerId"].is<uint32_t>()) {
m_peerId = rsp["peerId"].get<uint32_t>();
m_peerIdStr.setText(__INT_STR(m_peerId));
}
// get remote node state
if (rsp["dmrTSCCEnable"].is<bool>() && rsp["p25CtrlEnable"].is<bool>() &&
rsp["nxdnCtrlEnable"].is<bool>()) {

@ -100,7 +100,7 @@ private:
FDialog::setShadow(false);
m_selectedHostLabel.setGeometry(FPoint(2, 1), FSize(18, 1));
m_selectedHost.setGeometry(FPoint(20, 1), FSize(30, 1));
m_selectedHost.setGeometry(FPoint(20, 1), FSize(60, 1));
m_selectedHost.setText("None");
FDialog::initLayout();

@ -79,7 +79,7 @@ BaseNetwork::BaseNetwork(uint32_t peerId, bool duplex, bool debug, bool slot1, b
m_pktSeq(0U),
m_audio()
{
assert(peerId > 1000U);
assert(peerId < 999999999U);
m_socket = new UDPSocket(localPort);
m_frameQueue = new FrameQueue(m_socket, peerId, debug);

@ -486,17 +486,8 @@ void RESTAPI::restAPI_GetStatus(const HTTPPayload& request, HTTPPayload& reply,
setResponseDefaultStatus(response);
yaml::Node systemConf = m_host->m_conf["system"];
yaml::Node networkConf = m_host->m_conf["network"];
{
yaml::Node modemConfig = m_host->m_conf["system"]["modem"];
std::string portType = modemConfig["protocol"]["type"].as<std::string>();
response["portType"].set<std::string>(portType);
yaml::Node uartConfig = modemConfig["protocol"]["uart"];
std::string modemPort = uartConfig["port"].as<std::string>();
response["modemPort"].set<std::string>(modemPort);
uint32_t portSpeed = uartConfig["speed"].as<uint32_t>(115200U);
response["portSpeed"].set<uint32_t>(portSpeed);
response["state"].set<uint8_t>(m_host->m_state);
bool dmrEnabled = m_dmr != nullptr;
response["dmrEnabled"].set<bool>(dmrEnabled);
@ -505,9 +496,6 @@ void RESTAPI::restAPI_GetStatus(const HTTPPayload& request, HTTPPayload& reply,
bool nxdnEnabled = m_nxdn != nullptr;
response["nxdnEnabled"].set<bool>(nxdnEnabled);
uint8_t protoVer = m_host->m_modem->getVersion();
response["protoVer"].set<uint8_t>(protoVer);
response["fixedMode"].set<bool>(m_host->m_fixedMode);
response["dmrTSCCEnable"].set<bool>(m_host->m_dmrTSCCData);
@ -532,10 +520,23 @@ void RESTAPI::restAPI_GetStatus(const HTTPPayload& request, HTTPPayload& reply,
response["lastDstId"].set<uint32_t>(m_host->m_lastDstId);
response["lastSrcId"].set<uint32_t>(m_host->m_lastSrcId);
uint32_t peerId = networkConf["id"].as<uint32_t>();
response["peerId"].set<uint32_t>(peerId);
}
yaml::Node modemConfig = m_host->m_conf["system"]["modem"];
{
json::object modemInfo = json::object();
std::string portType = modemConfig["protocol"]["type"].as<std::string>();
modemInfo["portType"].set<std::string>(portType);
yaml::Node uartConfig = modemConfig["protocol"]["uart"];
std::string modemPort = uartConfig["port"].as<std::string>();
modemInfo["modemPort"].set<std::string>(modemPort);
uint32_t portSpeed = uartConfig["speed"].as<uint32_t>(115200U);
modemInfo["portSpeed"].set<uint32_t>(portSpeed);
if (!m_host->m_modem->isHotspot()) {
modemInfo["pttInvert"].set<bool>(m_host->m_modem->m_pttInvert);
modemInfo["rxInvert"].set<bool>(m_host->m_modem->m_rxInvert);
@ -611,6 +612,10 @@ void RESTAPI::restAPI_GetStatus(const HTTPPayload& request, HTTPPayload& reply,
modemInfo["rxFrequencyEffective"].set<uint32_t>(rxFreqEffective);
uint32_t txFreqEffective = m_host->m_modem->m_txFrequency + m_host->m_modem->m_txTuning;
modemInfo["txFrequencyEffective"].set<uint32_t>(txFreqEffective);
uint8_t protoVer = m_host->m_modem->getVersion();
modemInfo["protoVer"].set<uint8_t>(protoVer);
response["modem"].set<json::object>(modemInfo);
}

Loading…
Cancel
Save

Powered by TurnKey Linux.