Skip to content

Commit

Permalink
Add M17 network status to Remote command "status" output.
Browse files Browse the repository at this point in the history
YSFNetwork: fix ::IsConnected(), it should not take m_enabled in account.
  • Loading branch information
f1rmb committed Jan 7, 2022
1 parent 4b86466 commit 20b1367
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions M17Network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ void CM17Network::enable(bool enabled)
m_enabled = enabled;
}

bool CM17Network::isConnected() const
{
return (m_addrLen != 0);
}

void CM17Network::sendPing()
{
unsigned char buffer[5U];
Expand Down
2 changes: 2 additions & 0 deletions M17Network.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ class CM17Network {

void clock(unsigned int ms);

bool isConnected() const;

private:
CUDPSocket m_socket;
sockaddr_storage m_addr;
Expand Down
1 change: 1 addition & 0 deletions MMDVMHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2698,5 +2698,6 @@ void CMMDVMHost::buildNetworkStatusString(std::string &str)
str += std::string(" ysf:") + (((m_ysfNetwork == NULL) || (m_ysfEnabled == false)) ? "n/a" : (m_ysfNetwork->isConnected() ? "conn" : "disc"));
str += std::string(" p25:") + (((m_p25Network == NULL) || (m_p25Enabled == false)) ? "n/a" : (m_p25Network->isConnected() ? "conn" : "disc"));
str += std::string(" nxdn:") + (((m_nxdnNetwork == NULL) || (m_nxdnEnabled == false)) ? "n/a" : (m_nxdnNetwork->isConnected() ? "conn" : "disc"));
str += std::string(" m17:") + (((m_m17Network == NULL) || (m_m17Enabled == false)) ? "n/a" : (m_m17Network->isConnected() ? "conn" : "disc"));
str += std::string(" fm:") + (m_fmEnabled ? "conn" : "n/a");
}
2 changes: 1 addition & 1 deletion YSFNetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ void CYSFNetwork::reset()

bool CYSFNetwork::isConnected() const
{
return m_enabled && (m_addrLen != 0U);
return (m_addrLen != 0U);
}

void CYSFNetwork::close()
Expand Down

0 comments on commit 20b1367

Please sign in to comment.