mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 10:38:45 -04:00
websocket spectrum: added listening address and port to websocket spectrum server information. Fixed setting of listening address
This commit is contained in:
parent
270fd955ae
commit
358f1ea2f0
@ -774,11 +774,12 @@ void SpectrumVis::handleWSOpenClose(bool openClose)
|
||||
|
||||
void SpectrumVis::handleConfigureWSSpectrum(const QString& address, uint16_t port)
|
||||
{
|
||||
m_wsSpectrum.setListeningAddress(address);
|
||||
m_wsSpectrum.setPort(port);
|
||||
|
||||
if (m_wsSpectrum.socketOpened())
|
||||
{
|
||||
m_wsSpectrum.closeSocket();
|
||||
m_wsSpectrum.setListeningAddress(address);
|
||||
m_wsSpectrum.setPort(port);
|
||||
m_wsSpectrum.openSocket();
|
||||
}
|
||||
}
|
||||
@ -824,6 +825,18 @@ int SpectrumVis::webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& respons
|
||||
response.init();
|
||||
response.setRun(serverRunning ? 1 : 0);
|
||||
|
||||
QHostAddress serverAddress = m_wsSpectrum.getListeningAddress();
|
||||
|
||||
if (serverAddress != QHostAddress::Null) {
|
||||
response.setListeningAddress(new QString(serverAddress.toString()));
|
||||
}
|
||||
|
||||
uint16_t serverPort = m_wsSpectrum.getListeningPort();
|
||||
|
||||
if (serverPort != 0) {
|
||||
response.setListeningPort(serverPort);
|
||||
}
|
||||
|
||||
if (peerHosts.size() > 0)
|
||||
{
|
||||
response.setClients(new QList<SWGSDRangel::SWGSpectrumServer_clients*>);
|
||||
|
@ -124,6 +124,24 @@ void WSSpectrum::socketDisconnected()
|
||||
}
|
||||
}
|
||||
|
||||
QHostAddress WSSpectrum::getListeningAddress() const
|
||||
{
|
||||
if (m_webSocketServer) {
|
||||
return m_webSocketServer->serverAddress();
|
||||
} else {
|
||||
return QHostAddress::Null;
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t WSSpectrum::getListeningPort() const
|
||||
{
|
||||
if (m_webSocketServer) {
|
||||
return m_webSocketServer->serverPort();
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
void WSSpectrum::newSpectrum(
|
||||
const std::vector<Real>& spectrum,
|
||||
int fftSize,
|
||||
|
@ -45,6 +45,8 @@ public:
|
||||
void getPeers(QList<QHostAddress>& hosts, QList<quint16>& ports) const;
|
||||
void setListeningAddress(const QString& address) { m_listeningAddress.setAddress(address); }
|
||||
void setPort(quint16 port) { m_port = port; }
|
||||
QHostAddress getListeningAddress() const;
|
||||
uint16_t getListeningPort() const;
|
||||
void newSpectrum(
|
||||
const std::vector<Real>& spectrum,
|
||||
int fftSize,
|
||||
|
Loading…
Reference in New Issue
Block a user