示例#1
0
        protected String getMediaServerIP(CpMediaServer _mediaServer)
        {
            if (_mediaServer == null)
                return String.Empty;

            this.writeLog(LogType.Info, "Auflösen der Raumfeld-MedienServer IP");

            Uri url = new Uri(mediaServer.Location);

            try
            {
                IPAddress address = IPAddress.Parse(url.Host);
                return address.ToString();
            }
            catch (Exception e)
            {
                this.writeLog(LogType.Warning, String.Format("IP-Adresse konnte nicht aufgelöst werden. Host: {0} Suche über DNS", url.Host), e);
            }

            try
            {
                IPHostEntry hostEntry = Dns.GetHostEntry(url.Host);
                return hostEntry.AddressList[0].ToString();
            }
            catch (Exception e)
            {
                this.writeLog(LogType.Error, String.Format("IP-Adresse konnte nicht per DNS aufgelöst werden. Host: {0}", url.Host), e);
                // this is a fatal error! App hast to crash!
                throw new Exception(Global.getCrashInfo());
            }
        }
示例#2
0
        protected void mediaServerRemovedSink(CpMediaServer _mediaServer)
        {
            this.writeLog(LogType.Info, String.Format("MediaServer '{0}' verloren", _mediaServer.ServerFriendlyName));

            if (_mediaServer.ServerFriendlyName != raumfeldMediaServerDeviceName)
                return;

            mediaServer = null;
            contentDirectory = null;
            if (mediaServerRemoved != null) mediaServerRemoved();
        }
示例#3
0
 protected void MediaServerRemovedSink(CpMediaServer _mediaServer)
 {
     if (onMediaServerRemoved != null) this.onMediaServerRemoved(_mediaServer);
 }
示例#4
0
        protected void mediaServerFoundSink(CpMediaServer _mediaServer)
        {
            this.writeLog(LogType.Info, String.Format("MediaServer '{0}' gefunden", _mediaServer.ServerFriendlyName));

            if (_mediaServer.ServerFriendlyName != raumfeldMediaServerDeviceName)
                return;

            mediaServer = _mediaServer;
            mediaServerIpAddress = this.getMediaServerIP(mediaServer);
            mediaServerRequestUriBase = this.getMediaServerRequestUri();

            contentDirectory = mediaServer.contentDirectory;
            contentDirectory.onStateVariableContainerUpdateIds += contentDirectory_onStateVariableContainerUpdateIds;

            this.writeLog(LogType.Info, String.Format("Medienserver IP: '{0}', RequestUrl: '{1}'", mediaServerIpAddress, mediaServerRequestUriBase));

            if (mediaServerFound != null) mediaServerFound();
        }
示例#5
0
 protected void MediaServerFoundSink(CpMediaServer _mediaServer)
 {
     if (onMediaServerFound != null) this.onMediaServerFound(_mediaServer);
 }