From 6a26e4fd5f8f87df0c2c679c76e57e28e78393ff Mon Sep 17 00:00:00 2001 From: penfold42 Date: Tue, 27 Sep 2016 01:50:31 +1000 Subject: [PATCH] Added avahi/bonjour advertisement to webconfig (#258) --- libsrc/webconfig/StaticFileServing.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libsrc/webconfig/StaticFileServing.cpp b/libsrc/webconfig/StaticFileServing.cpp index b56ac3ed..f74f9ea8 100644 --- a/libsrc/webconfig/StaticFileServing.cpp +++ b/libsrc/webconfig/StaticFileServing.cpp @@ -8,6 +8,10 @@ #include #include #include +#include +#include +#include + StaticFileServing::StaticFileServing (Hyperion *hyperion, QString baseUrl, quint16 port, QObject * parent) : QObject (parent) @@ -40,6 +44,18 @@ StaticFileServing::~StaticFileServing () void StaticFileServing::onServerStarted (quint16 port) { Info(_log, "started on port %d name \"%s\"", port ,_server->getServerName().toStdString().c_str()); + + const std::string mDNSDescr = ( _server->getServerName().toStdString() + + "@" + + QHostInfo::localHostName().toStdString() + ); + + BonjourServiceRegister *bonjourRegister_http = new BonjourServiceRegister(); + bonjourRegister_http->registerService( + BonjourRecord(mDNSDescr.c_str(), "_http._tcp", QString()), + port + ); + Debug(_log, "Web Config mDNS responder started"); } void StaticFileServing::onServerStopped () {