diff options
-rwxr-xr-x | system/settings/settings.xml | 12 | ||||
-rw-r--r-- | xbmc/network/NetworkServices.cpp | 6 | ||||
-rw-r--r-- | xbmc/settings/Settings.cpp | 9 | ||||
-rw-r--r-- | xbmc/settings/Settings.h | 1 |
4 files changed, 28 insertions, 0 deletions
diff --git a/system/settings/settings.xml b/system/settings/settings.xml index dea94ec2ae..5ab0515058 100755 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -1620,6 +1620,18 @@ <control type="toggle" /> </setting> </group> + <group id="3"> + <requirement>HAS_ZEROCONF</requirement> + <setting id="services.deviceuuid" type="string"> + <visible>false</visible> + <level>1</level> + <default></default> + <constraints> + <allowempty>true</allowempty> + </constraints> + <control type="edit" format="string" /> + </setting> + </group> </category> <category id="control" label="14223" help="36327"> <group id="1" label="33101"> diff --git a/xbmc/network/NetworkServices.cpp b/xbmc/network/NetworkServices.cpp index 8260dd3310..a89a4723f8 100644 --- a/xbmc/network/NetworkServices.cpp +++ b/xbmc/network/NetworkServices.cpp @@ -545,6 +545,9 @@ bool CNetworkServices::StartWebserver() #ifdef HAS_ZEROCONF std::vector<std::pair<std::string, std::string> > txt; + txt.push_back(std::make_pair("txtvers", "1")); + txt.push_back(std::make_pair("uuid", CServiceBroker::GetSettings().GetString(CSettings::SETTING_SERVICES_DEVICEUUID))); + // publish web frontend and API services #ifdef HAS_WEB_INTERFACE CZeroconf::GetInstance()->PublishService("servers.webserver", "_http._tcp", CSysInfo::GetDeviceName(), webPort, txt); @@ -709,6 +712,9 @@ bool CNetworkServices::StartJSONRPCServer() #ifdef HAS_ZEROCONF std::vector<std::pair<std::string, std::string> > txt; + txt.push_back(std::make_pair("txtvers", "1")); + txt.push_back(std::make_pair("uuid", CServiceBroker::GetSettings().GetString(CSettings::SETTING_SERVICES_DEVICEUUID))); + CZeroconf::GetInstance()->PublishService("servers.jsonrpc-tpc", "_xbmc-jsonrpc._tcp", CSysInfo::GetDeviceName(), g_advancedSettings.m_jsonTcpPort, txt); #endif // HAS_ZEROCONF diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index 82d6e82a58..655f594946 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -306,6 +306,7 @@ const std::string CSettings::SETTING_WEATHER_CURRENTLOCATION = "weather.currentl const std::string CSettings::SETTING_WEATHER_ADDON = "weather.addon"; const std::string CSettings::SETTING_WEATHER_ADDONSETTINGS = "weather.addonsettings"; const std::string CSettings::SETTING_SERVICES_DEVICENAME = "services.devicename"; +const std::string CSettings::SETTING_SERVICES_DEVICEUUID = "services.deviceuuid"; const std::string CSettings::SETTING_SERVICES_UPNP = "services.upnp"; const std::string CSettings::SETTING_SERVICES_UPNPSERVER = "services.upnpserver"; const std::string CSettings::SETTING_SERVICES_UPNPANNOUNCE = "services.upnpannounce"; @@ -659,6 +660,14 @@ void CSettings::InitializeDefaults() if (g_application.IsStandAlone()) std::static_pointer_cast<CSettingInt>(GetSettingsManager()->GetSetting(CSettings::SETTING_POWERMANAGEMENT_SHUTDOWNSTATE))->SetDefault(POWERSTATE_SHUTDOWN); + + // Initialize deviceUUID if not already set, used in zeroconf advertisements. + std::shared_ptr<CSettingString> deviceUUID = std::static_pointer_cast<CSettingString>(GetSettingsManager()->GetSetting(CSettings::SETTING_SERVICES_DEVICEUUID)); + if (deviceUUID->GetValue().empty()) + { + const std::string& uuid = StringUtils::CreateUUID(); + std::static_pointer_cast<CSettingString>(GetSettingsManager()->GetSetting(CSettings::SETTING_SERVICES_DEVICEUUID))->SetValue(uuid); + } } void CSettings::InitializeOptionFillers() diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index 6e75e58c47..d0e3b64585 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -260,6 +260,7 @@ public: static const std::string SETTING_WEATHER_ADDON; static const std::string SETTING_WEATHER_ADDONSETTINGS; static const std::string SETTING_SERVICES_DEVICENAME; + static const std::string SETTING_SERVICES_DEVICEUUID; static const std::string SETTING_SERVICES_UPNP; static const std::string SETTING_SERVICES_UPNPSERVER; static const std::string SETTING_SERVICES_UPNPANNOUNCE; |