mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Fix: SSDP Server spec adjust (#599)
* Fix: SSDP Server spec adjust - Fix: Windows 7 network overview no longer removes the Hyperion entry - Fix: The general section should be marked as global
This commit is contained in:
@@ -19,8 +19,21 @@ SSDPHandler::SSDPHandler(WebServer* webserver, const quint16& flatBufPort, QObje
|
||||
setFlatBufPort(_flatbufPort);
|
||||
}
|
||||
|
||||
SSDPHandler::~SSDPHandler()
|
||||
{
|
||||
sendAnnounceList(false);
|
||||
}
|
||||
|
||||
void SSDPHandler::initServer()
|
||||
{
|
||||
_uuid = AuthManager::getInstance()->getID();
|
||||
SSDPServer::setUuid(_uuid);
|
||||
|
||||
// announce targets
|
||||
_deviceList.push_back("upnp:rootdevice");
|
||||
_deviceList.push_back("uuid:"+_uuid);
|
||||
_deviceList.push_back("urn:hyperion-project.org:device:basic:1");
|
||||
|
||||
// prep server
|
||||
SSDPServer::initServer();
|
||||
|
||||
@@ -65,15 +78,12 @@ void SSDPHandler::handleWebServerStateChange(const bool newState)
|
||||
_webserver->setSSDPDescription(buildDesc());
|
||||
setDescriptionAddress(getDescAddress());
|
||||
if(start())
|
||||
{
|
||||
sendAlive("upnp:rootdevice");
|
||||
sendAlive("urn:schemas-upnp-org:device:basic:1");
|
||||
sendAlive("urn:hyperion-project.org:device:basic:1");
|
||||
}
|
||||
sendAnnounceList(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_webserver->setSSDPDescription("");
|
||||
sendAnnounceList(false);
|
||||
stop();
|
||||
}
|
||||
}
|
||||
@@ -87,17 +97,13 @@ void SSDPHandler::handleNetworkConfigurationChanged(const QNetworkConfiguration
|
||||
if(_localAddress != localAddress)
|
||||
{
|
||||
// revoke old ip
|
||||
sendByeBye("upnp:rootdevice");
|
||||
sendByeBye("urn:schemas-upnp-org:device:basic:1");
|
||||
sendByeBye("urn:hyperion-project.org:device:basic:1");
|
||||
sendAnnounceList(false);
|
||||
|
||||
// update desc & notify new ip
|
||||
_localAddress = localAddress;
|
||||
_webserver->setSSDPDescription(buildDesc());
|
||||
setDescriptionAddress(getDescAddress());
|
||||
sendAlive("upnp:rootdevice");
|
||||
sendAlive("urn:schemas-upnp-org:device:basic:1");
|
||||
sendAlive("urn:hyperion-project.org:device:basic:1");
|
||||
sendAnnounceList(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -141,5 +147,11 @@ const QString SSDPHandler::buildDesc()
|
||||
/// %2 friendly name Hyperion 2.0.0 (192.168.0.177)
|
||||
/// %3 modelNumber 2.0.0
|
||||
/// %4 serialNumber / UDN (H ID) Fjsa723dD0....
|
||||
return SSDP_DESCRIPTION.arg(getBaseAddress(), QString("Hyperion (%2)").arg(_localAddress), QString(HYPERION_VERSION), AuthManager::getInstance()->getID());
|
||||
return SSDP_DESCRIPTION.arg(getBaseAddress(), QString("Hyperion (%2)").arg(_localAddress), QString(HYPERION_VERSION), _uuid);
|
||||
}
|
||||
|
||||
void SSDPHandler::sendAnnounceList(const bool alive){
|
||||
for(const auto & entry : _deviceList){
|
||||
alive ? SSDPServer::sendAlive(entry) : SSDPServer::sendByeBye(entry);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user