public Subscription(string Udn, string Sid, IUPnPService Service, string LocalIp)
 {
     this.sid     = Sid;
     this.udn     = Udn;
     this.service = Service;
     this.localIp = LocalIp;
 }
示例#2
0
 /// <summary>
 /// Creates a new service added event arguments.
 /// </summary>
 /// <param name="device">The underlying COM device that was added.</param>
 /// <param name="interfaceGuid">The network interface guid.</param>
 /// <param name="service">The service which was added.</param>
 internal ServiceAddedEventArgs(IUPnPDevice device, Guid interfaceGuid, IUPnPService service)
 {
     mdCOMDevice              = device;
     msCOMService             = service;
     mgInterfaceGuid          = interfaceGuid;
     mbInterfaceGuidAvailable = true;
 }
		public Subscription (string Udn, string Sid, IUPnPService Service, string LocalIp)
		{
			this.sid = Sid;
			this.udn = Udn;
			this.service = Service;
			this.localIp = LocalIp;
		}
 /// <summary>
 /// Creates a new service added event arguments.
 /// </summary>
 /// <param name="deviceArgs">The underlying device args from which the service came.</param>
 /// <param name="service">The underlying COM service that was added.</param>
 internal ServiceAddedEventArgs(DeviceAddedEventArgs deviceArgs, IUPnPService service)
 {
     mbInterfaceGuidAvailable = deviceArgs.InterfaceGuidAvailable;
     if (mbInterfaceGuidAvailable) mgInterfaceGuid = deviceArgs.InterfaceGuid;
     mdCOMDevice = deviceArgs.COMDevice;
     msCOMService = service;
 }
 /// <summary>
 /// Gets the readable info for a native com service.
 /// </summary>
 /// <param name="service">The service to get the readable info for.</param>
 /// <param name="indent">The indent for the readable info.</param>
 /// <returns>The readable info for the native com serivce.</returns>
 public static string ReadableInfo(this IUPnPService service, int indent = 0)
 {
     return(string.Format(
                "{0}{1} ({2})",
                new String(' ', indent * 4),
                service.Id,
                service.ServiceTypeIdentifier));
 }
示例#6
0
        /// <summary>
        /// Creates a new service object.
        /// </summary>
        /// <param name="device">The immediate device for the service.</param>
        /// <param name="comService">The native service for the service.</param>
        internal Service(Device device, IUPnPService comService)
        {
            msCOMService = comService;
            mscCallback  = new ServiceCallback(this);

            mdDevice = device;
            mbDead   = false;
        }
示例#7
0
 /// <summary>
 /// Creates a new service added event arguments.
 /// </summary>
 /// <param name="deviceArgs">The underlying device args from which the service came.</param>
 /// <param name="service">The underlying COM service that was added.</param>
 internal ServiceAddedEventArgs(DeviceAddedEventArgs deviceArgs, IUPnPService service)
 {
     mbInterfaceGuidAvailable = deviceArgs.InterfaceGuidAvailable;
     if (mbInterfaceGuidAvailable)
     {
         mgInterfaceGuid = deviceArgs.InterfaceGuid;
     }
     mdCOMDevice  = deviceArgs.COMDevice;
     msCOMService = service;
 }
        private static void GetPhotos(object State)
        {
            object[]         P           = (object[])State;
            int              i           = (int)P [0];
            IUPnPService     Service     = (IUPnPService)P [1];
            string           ContentType = (string)P [2];
            string           Extension   = (string)P [3];
            MailMessage      Msg         = (MailMessage)P [4];
            ManualResetEvent Done        = (ManualResetEvent)P [5];
            DateTime         Next        = DateTime.Now;

            try
            {
                UPnPAction GetDefaultImageURL = Service ["GetDefaultImageURL"];
                Variables  v = new Variables();
                GetDefaultImageURL.Execute(v);
                string ImageURL = (string)v ["RetImageURL"];

                ParsedUri    ImageURI = Web.ParseUri(ImageURL);
                HttpResponse Response;
                int          ms;
                int          j;

                using (HttpSocketClient Client = new HttpSocketClient(ImageURI.Host, ImageURI.Port, ImageURI.UriScheme is HttpsUriScheme, ImageURI.Credentials))
                {
                    Client.ReceiveTimeout = 20000;

                    for (j = 1; j <= 3; j++)
                    {
                        ms = (int)System.Math.Round((Next - DateTime.Now).TotalMilliseconds);
                        if (ms > 0)
                        {
                            Thread.Sleep(ms);
                        }

                        Response = Client.GET(ImageURI.PathAndQuery, ContentType);
                        Msg.EmbedObject("cam" + (i + 1).ToString() + "img" + j.ToString() + "." + Extension, ContentType, Response.Data);

                        Log.Information("Click.", EventLevel.Minor, Service.Device.FriendlyName);

                        Next = Next.AddSeconds(5);
                    }
                }
            } catch (ThreadAbortException)
            {
                Thread.ResetAbort();
            } catch (Exception ex)
            {
                Log.Exception(ex);
            } finally
            {
                Done.Set();
            }
        }
        /// <summary>
        /// Gets the friendly service type identifier for a native com service.
        /// </summary>
        /// <param name="service">The native com service.</param>
        /// <returns>The service type identifier for the native com service.</returns>
        public static string GetFriendlyServiceTypeIdentifier(this IUPnPService service)
        {
            string[] lsComponents = service.ServiceTypeIdentifier.Split(':');

            if (lsComponents.Length > 2)
            {
                return(String.Format("{0}:{1}", lsComponents[lsComponents.Length - 2], lsComponents[lsComponents.Length - 1]));
            }
            else
            {
                return(service.ServiceTypeIdentifier);
            }
        }
        /// <summary>
        /// Removes the cache for a native dvice and service.
        /// </summary>
        /// <param name="device">The native device.</param>
        /// <param name="service">The native service.</param>
        internal void RemoveCacheFor(IUPnPDevice device, IUPnPService service)
        {
            string lsKey = KeyFor(device, service);

            if (Logging.Enabled)
                Logging.Log(this, string.Format("Getting ServiceDescription cache for: '{0}' root of '{1}' key '{2}'", device.RootDevice.FriendlyName, service.Id, lsKey), 1);

            ServiceDescription lsdDesc = null;
            if (mdCache.TryGetValue(lsKey, out lsdDesc))
                mdURLCache.Remove(lsdDesc.DocumentURL);

            mdCache.Remove(lsKey);
        }
示例#11
0
        public static XmlDocument GetItems(IUPnPService svc, string containerID, string criteria, string filter, int startItem, int count)
        {
            XmlDocument doc = new XmlDocument();

            object results;
            object retVal;
            int    hr = svc.InvokeAction("Browse", new object[] { containerID, criteria, filter, startItem, count, "" }, out results, out retVal);

            if (hr == 0)
            {
                doc.LoadXml(((object[])results)[0].ToString());
            }
            return(doc);
        }
        /// <summary>
        /// Gets the service description for a native device and service.
        /// </summary>
        /// <param name="device">The native device.</param>
        /// <param name="service">The native service.</param>
        /// <returns>The service description for the cache or null if not available.</returns>
        internal ServiceDescription this[IUPnPDevice device, IUPnPService service]
        {
            get
            {
                ServiceDescription lsdDesc;
                string             lsKey = KeyFor(device, service);

                if (Logging.Enabled)
                {
                    Logging.Log(this, string.Format("Getting ServiceDescription from cache for: '{0}' root of '{1}' key '{2}'", device.RootDevice.FriendlyName, service.Id, lsKey), 1);
                }

                try
                {
                    if (!mdCache.TryGetValue(lsKey, out lsdDesc))
                    {
                        if (Logging.Enabled)
                        {
                            Logging.Log(this, "Cache missed");
                        }
                        lsdDesc = service.Description(device, RootDescriptionCache.Cache[device.RootDevice]);

                        if (lsdDesc != null)
                        {
                            if (Logging.Enabled)
                            {
                                Logging.Log(this, "Adding to cache");
                            }
                            mdCache[lsKey] = lsdDesc;
                            mdURLCache[lsdDesc.DocumentURL] = lsdDesc;
                        }
                        else
                        if (Logging.Enabled)
                        {
                            Logging.Log(this, "Failed, nothing to add to cache");
                        }
                    }

                    return(lsdDesc);
                }
                finally
                {
                    if (Logging.Enabled)
                    {
                        Logging.Log(this, "Finished getting ServiceDescription from cache", -1);
                    }
                }
            }
        }
示例#13
0
        // Checks if device supports Content Directory service and opens a browser on it
        private void BrowseDevice(IUPnPDevice device)
        {
            // Get service enumerator
            IntPtr       pE    = device.Services._NewEnum;
            IEnumUnknown pEnum = (IEnumUnknown)Marshal.GetObjectForIUnknown(pE);

            Marshal.Release(pE);

            // Enumerate services. Look for one that has ContentDirectory in its description
            uint         cItems;
            IUPnPService svc         = null;
            IUPnPService svcContent  = null;
            bool         couldBrowse = false;

            while (pEnum.Next(1, out pE, out cItems) == 0 && cItems == 1)
            {
                svc = (IUPnPService)Marshal.GetObjectForIUnknown(pE);
                Marshal.Release(pE);

                object results;// = new object[3];
                object retVal;
                if (svc.ServiceTypeIdentifier.IndexOf("ContentDirectory", StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    // Check if the service supports Browse verb
                    // This is not really neccessary, but just a precaution
                    svcContent = svc;
                    int hr = svc.InvokeAction("Browse", new object[] { "0", "BrowseDirectChildren", "*", 0, 0, "" }, out results, out retVal);
                    if (hr == 0)
                    {
                        couldBrowse = true;
                    }
                    hr = 0;
                }
            }

            if (!couldBrowse || svcContent == null)
            {
                MessageBox.Show("Found no browsable content");
            }
            else
            {
                // We have found the Content Directory
                Browser browser = new Browser(svcContent);
                browser.ShowDialog();
            }
        }
        /// <summary>
        /// Removes the cache for a native dvice and service.
        /// </summary>
        /// <param name="device">The native device.</param>
        /// <param name="service">The native service.</param>
        internal void RemoveCacheFor(IUPnPDevice device, IUPnPService service)
        {
            string lsKey = KeyFor(device, service);

            if (Logging.Enabled)
            {
                Logging.Log(this, string.Format("Getting ServiceDescription cache for: '{0}' root of '{1}' key '{2}'", device.RootDevice.FriendlyName, service.Id, lsKey), 1);
            }

            ServiceDescription lsdDesc = null;

            if (mdCache.TryGetValue(lsKey, out lsdDesc))
            {
                mdURLCache.Remove(lsdDesc.DocumentURL);
            }

            mdCache.Remove(lsKey);
        }
示例#15
0
        public Browser(IUPnPService svc)
        {
            InitializeComponent();
            service = svc;
            TreeNode    root = new TreeNode("Root");
            XmlDocument doc  = new XmlDocument();

            doc.LoadXml(@"<DIDL-Lite xmlns:dc=""http://purl.org/dc/elements/1.1/"" xmlns:upnp=""urn:schemas-upnp-org:metadata-1-0/upnp/"" xmlns=""urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/"">
<container id=""0"">
  <dc:title>Music</dc:title> 
  <upnp:class>object.container</upnp:class></container></DIDL-Lite>");
            root.Tag = doc.DocumentElement.ChildNodes[0];
            root.Nodes.Add("");
            tvItems.Nodes.Add(root);
            mgr = new XmlNamespaceManager(doc.NameTable);
            mgr.AddNamespace("upnp", "urn:schemas-upnp-org:metadata-1-0/upnp/");
            mgr.AddNamespace("dc", "http://purl.org/dc/elements/1.1/");
        }
        /// <summary>
        /// Gets the service description for a native device and service.
        /// </summary>
        /// <param name="device">The native device.</param>
        /// <param name="service">The native service.</param>
        /// <returns>The service description for the cache or null if not available.</returns>
        internal ServiceDescription this[IUPnPDevice device, IUPnPService service]
        {
            get
            {
                ServiceDescription lsdDesc;
                string lsKey = KeyFor(device, service);

                if (Logging.Enabled)
                    Logging.Log(this, string.Format("Getting ServiceDescription from cache for: '{0}' root of '{1}' key '{2}'", device.RootDevice.FriendlyName, service.Id, lsKey), 1);

                try
                {
                    if (!mdCache.TryGetValue(lsKey, out lsdDesc))
                    {
                        if (Logging.Enabled)
                            Logging.Log(this, "Cache missed");
                        lsdDesc = service.Description(device, RootDescriptionCache.Cache[device.RootDevice]);

                        if (lsdDesc != null)
                        {
                            if (Logging.Enabled)
                                Logging.Log(this, "Adding to cache");
                            mdCache[lsKey] = lsdDesc;
                            mdURLCache[lsdDesc.DocumentURL] = lsdDesc;
                        }
                        else
                            if (Logging.Enabled)
                                Logging.Log(this, "Failed, nothing to add to cache");
                    }

                    return lsdDesc;
                }
                finally
                {
                    if (Logging.Enabled)
                        Logging.Log(this, "Finished getting ServiceDescription from cache", -1);
                }
            }
        }
 /// <summary>
 /// Creates a new service added event arguments.
 /// </summary>
 /// <param name="device">The underlying COM device that was added.</param>
 /// <param name="interfaceGuid">The network interface guid.</param>
 /// <param name="service">The service which was added.</param>
 internal ServiceAddedEventArgs(IUPnPDevice device, Guid interfaceGuid, IUPnPService service)
 {
     mdCOMDevice = device;
     msCOMService = service;
     mgInterfaceGuid = interfaceGuid;
     mbInterfaceGuidAvailable = true;
 }
示例#18
0
 /// <summary>
 /// Creates a new service object.
 /// </summary>
 /// <param name="comDevice">The immediate native device for the object.</param>
 /// <param name="interfaceGuid">The network interface Guid or Guid.Empty for none.</param>
 /// <param name="comService">The native service for the service.</param>
 internal Service(IUPnPDevice comDevice, Guid interfaceGuid, IUPnPService comService)
     : this(new Device(comDevice, interfaceGuid), comService)
 {
 }
 /// <summary>
 /// Creates a new service added event arguments.
 /// </summary>
 /// <param name="device">The underlying COM device that was added.</param>
 /// <param name="service">The underlying COM service that was added.</param>
 internal ServiceAddedEventArgs(IUPnPDevice device, IUPnPService service)
 {
     mbInterfaceGuidAvailable = false;
     mdCOMDevice = device;
     msCOMService = service;
 }
        private static void SendAlarmMail()
        {
            MailMessage                 Msg = new MailMessage(mailSettings.Recipient, "Motion Detected.", string.Empty, MessageType.Html);
            List <WaitHandle>           ThreadTerminationEvents = new List <WaitHandle> ();
            Dictionary <string, string> VariableValues;
            StringBuilder               Html = new StringBuilder();
            string           Resolution;
            string           ContentType;
            string           Extension;
            ManualResetEvent Done;

            IUPnPService[] Cameras;
            int            i, j, c;

            lock (stillImageCameras)
            {
                c       = stillImageCameras.Count;
                Cameras = new IUPnPService[c];
                stillImageCameras.Values.CopyTo(Cameras, 0);
            }

            Html.Append("<html><head/><body><h1>Motion detected</h1>");
            Html.Append("<p>Motion has been detected while the light is turned off.</p>");

            if (c > 0)
            {
                Html.Append("<h2>Camera Photos</h2>");
                Html.Append("<table cellspacing='0' cellpadding='10' border='0'>");

                for (i = 0; i < c; i++)
                {
                    lock (stateVariables)
                    {
                        if (!stateVariables.TryGetValue(Cameras [i].Device.UDN, out VariableValues))
                        {
                            VariableValues = null;
                        }
                    }

                    Html.Append("<tr>");

                    if (VariableValues != null &&
                        VariableValues.TryGetValue("DefaultResolution", out Resolution) &&
                        VariableValues.TryGetValue("DefaultEncoding", out ContentType))
                    {
                        Extension = MimeUtilities.GetDefaultFileExtension(ContentType);

                        for (j = 1; j <= 3; j++)
                        {
                            Html.Append("<td align='center'><img src='cid:cam");
                            Html.Append((i + 1).ToString());
                            Html.Append("img");
                            Html.Append(j.ToString());
                            Html.Append(".");
                            Html.Append(Extension);
                            Html.Append("' width='");
                            Html.Append(Resolution.Replace("x", "' height='"));
                            Html.Append("'/></td>");
                        }

                        Done = new ManualResetEvent(false);
                        ThreadTerminationEvents.Add(Done);

                        Thread T = new Thread(GetPhotos);
                        T.Priority = ThreadPriority.BelowNormal;
                        T.Name     = "GetPhotos#" + (i + 1).ToString();
                        T.Start(new object[] { i, Cameras [i], ContentType, Extension, Msg, Done });
                    }
                    else
                    {
                        Html.Append("<td colspan='3'>Camera not accessible at this time.</td>");
                    }

                    Html.Append("</tr>");
                }
            }

            Html.Append("</table></body></html>");

            if (ThreadTerminationEvents.Count > 0)
            {
                WaitHandle.WaitAll(ThreadTerminationEvents.ToArray(), 30000);
            }

            Msg.Body = Html.ToString();
            SmtpOutbox.SendMail(Msg, mailSettings.From);
        }
示例#21
0
 /// <summary>
 /// Creates a new service added event arguments.
 /// </summary>
 /// <param name="device">The underlying COM device that was added.</param>
 /// <param name="service">The underlying COM service that was added.</param>
 internal ServiceAddedEventArgs(IUPnPDevice device, IUPnPService service)
 {
     mbInterfaceGuidAvailable = false;
     mdCOMDevice  = device;
     msCOMService = service;
 }
示例#22
0
		private static void SendAlarmMail ()
		{
			MailMessage Msg = new MailMessage (mailSettings.Recipient, "Motion Detected.", string.Empty, MessageType.Html);
			List<WaitHandle> ThreadTerminationEvents = new List<WaitHandle> ();
			Dictionary<string,string> VariableValues;
			StringBuilder Html = new StringBuilder ();
			string Resolution;
			string ContentType;
			string Extension;
			ManualResetEvent Done;
			IUPnPService[] Cameras;
			int i, j, c;

			lock (stillImageCameras)
			{
				c = stillImageCameras.Count;
				Cameras = new IUPnPService[c];
				stillImageCameras.Values.CopyTo (Cameras, 0);
			}

			Html.Append ("<html><head/><body><h1>Motion detected</h1>");
			Html.Append ("<p>Motion has been detected while the light is turned off.</p>");

			if (c > 0)
			{
				Html.Append ("<h2>Camera Photos</h2>");
				Html.Append ("<table cellspacing='0' cellpadding='10' border='0'>");

				for (i = 0; i < c; i++)
				{
					lock (stateVariables)
					{
						if (!stateVariables.TryGetValue (Cameras [i].Device.UDN, out VariableValues))
							VariableValues = null;
					}

					Html.Append ("<tr>");

					if (VariableValues != null &&
					    VariableValues.TryGetValue ("DefaultResolution", out Resolution) &&
					    VariableValues.TryGetValue ("DefaultEncoding", out ContentType))
					{
						Extension = MimeUtilities.GetDefaultFileExtension (ContentType);

						for (j = 1; j <= 3; j++)
						{
							Html.Append ("<td align='center'><img src='cid:cam");
							Html.Append ((i + 1).ToString ());
							Html.Append ("img");
							Html.Append (j.ToString ());
							Html.Append (".");
							Html.Append (Extension);
							Html.Append ("' width='");
							Html.Append (Resolution.Replace ("x", "' height='"));
							Html.Append ("'/></td>");
						}

						Done = new ManualResetEvent (false);
						ThreadTerminationEvents.Add (Done);

						Thread T = new Thread (GetPhotos);
						T.Priority = ThreadPriority.BelowNormal;
						T.Name = "GetPhotos#" + (i + 1).ToString ();
						T.Start (new object[]{ i, Cameras [i], ContentType, Extension, Msg, Done });
					} else
						Html.Append ("<td colspan='3'>Camera not accessible at this time.</td>");

					Html.Append ("</tr>");
				}
			}

			Html.Append ("</table></body></html>");

			if (ThreadTerminationEvents.Count > 0)
				WaitHandle.WaitAll (ThreadTerminationEvents.ToArray (), 30000);

			Msg.Body = Html.ToString ();
			SmtpOutbox.SendMail (Msg, mailSettings.From);
		}
 /// <summary>
 /// Gets the key for a native device and service.
 /// </summary>
 /// <param name="device">The native device.</param>
 /// <param name="service">The native service.</param>
 /// <returns>The key for the device and service.</returns>
 private string KeyFor(IUPnPDevice device, IUPnPService service)
 {
     return(device.RootDevice.UniqueDeviceName + "|" + service.Id);
 }
示例#24
0
        /// <summary>
        /// Gets the description for a service.
        /// </summary>
        /// <param name="service">The native com service.</param>
        /// <param name="device">The native com device.</param>
        /// <param name="rootDescription">The root description for the services device.</param>
        /// <returns>The service description.</returns>
        public static ServiceDescription Description(
            this IUPnPService service, IUPnPDevice device, RootDescription rootDescription)
        {
            if (Logging.Enabled)
            {
                Logging.Log(service, String.Format("Getting ServiceDescription for {0} -> {1}", device.FriendlyName, service.Id), 1);
            }

            try
            {
                DeviceServiceDescription ldsdDesc = service.DeviceServiceDescription(device, rootDescription);

                if (ldsdDesc != null)
                {
                    ServiceDescription lsdDesc = ldsdDesc.GetDescription(rootDescription);

                    if (lsdDesc != null)
                    {
                        if (Logging.Enabled)
                        {
                            if (Logging.Enabled)
                            {
                                Logging.Log(service, "ServiceDescription:", 1);
                            }

                            try
                            {
                                if (Logging.Enabled)
                                {
                                    Logging.Log(service, lsdDesc.ToString());
                                }
                            }
                            finally
                            {
                                if (Logging.Enabled)
                                {
                                    Logging.Log(service, "End ServiceDescription", -1);
                                }
                            }
                        }
                    }
                    else
                    if (Logging.Enabled)
                    {
                        Logging.Log(service, "ServiceDescription not found");
                    }

                    return(lsdDesc);
                }
                else
                {
                    if (Logging.Enabled)
                    {
                        Logging.Log(service, "Failed - Device Service Description Not Located");
                    }
                    return(null);
                }
            }
            finally
            {
                if (Logging.Enabled)
                {
                    Logging.Log(service, String.Format("Finished getting ServiceDescription for {0} -> {1}", device.FriendlyName, service.Id), -1);
                }
            }
        }
示例#25
0
        /// <summary>
        /// Gets the device service description for a service.
        /// </summary>
        /// <param name="service">The service to get the description for.</param>
        /// <param name="device">The device to get the description for.</param>
        /// <param name="rootDescription">The root description for the device.</param>
        /// <returns>The device service description.</returns>
        public static DeviceServiceDescription DeviceServiceDescription(
            this IUPnPService service, IUPnPDevice device, RootDescription rootDescription)
        {
            if (Logging.Enabled)
            {
                Logging.Log(service, String.Format("Getting DeviceServiceDescription for {0} -> {1}", device.FriendlyName, service.Id), 1);
            }

            try
            {
                if (Logging.Enabled)
                {
                    if (Logging.Enabled)
                    {
                        Logging.Log(service, "Using RootDescription:", 1);
                    }

                    try
                    {
                        if (Logging.Enabled)
                        {
                            Logging.Log(service, rootDescription.ToString());
                        }
                    }
                    finally
                    {
                        if (Logging.Enabled)
                        {
                            Logging.Log(service, "End RootDescription", -1);
                        }
                    }
                }

                DeviceServiceDescription ldsdDesc = null;

                if (rootDescription != null)
                {
                    if (Logging.Enabled)
                    {
                        Logging.Log(service, string.Format("Finding device by UDN: '{0}'", device.UniqueDeviceName));
                    }
                    DeviceDescription lddDevice = rootDescription.FindDevice(device.UniqueDeviceName);

                    if (lddDevice != null)
                    {
                        if (Logging.Enabled)
                        {
                            Logging.Log(service, string.Format("Device Found, finding DeviceServiceDescription by Service ID: '{0}'", service.Id));
                        }

                        if (Logging.Enabled)
                        {
                            if (Logging.Enabled)
                            {
                                Logging.Log(service, "DeviceDescription:", 1);
                            }

                            try
                            {
                                if (Logging.Enabled)
                                {
                                    Logging.Log(service, lddDevice.ToString());
                                }
                            }
                            finally
                            {
                                if (Logging.Enabled)
                                {
                                    Logging.Log(service, "End DeviceDescription", -1);
                                }
                            }
                        }

                        lddDevice.DeviceServices.TryGetValue(service.Id, out ldsdDesc);

                        if (ldsdDesc != null)
                        {
                            if (Logging.Enabled)
                            {
                                if (Logging.Enabled)
                                {
                                    Logging.Log(service, "DeviceServiceDescription found:", 1);
                                }

                                try
                                {
                                    if (Logging.Enabled)
                                    {
                                        Logging.Log(service, ldsdDesc.ToString());
                                    }
                                }
                                finally
                                {
                                    if (Logging.Enabled)
                                    {
                                        Logging.Log(service, "End DeviceServiceDescription", -1);
                                    }
                                }
                            }
                        }
                        else
                        if (Logging.Enabled)
                        {
                            Logging.Log(service, "DeviceServiceDescripton not found");
                        }
                    }
                    else
                    if (Logging.Enabled)
                    {
                        Logging.Log(service, "Device not found");
                    }
                }
                else
                if (Logging.Enabled)
                {
                    Logging.Log(service, "Invalid rootDescription parameter");
                }

                return(ldsdDesc);
            }
            finally
            {
                if (Logging.Enabled)
                {
                    Logging.Log(service, String.Format("Finished getting DeviceServiceDescription for {0} -> {1}", device.FriendlyName, service.Id), -1);
                }
            }
        }
 /// <summary>
 /// Gets the key for a native device and service.
 /// </summary>
 /// <param name="device">The native device.</param>
 /// <param name="service">The native service.</param>
 /// <returns>The key for the device and service.</returns>
 private string KeyFor(IUPnPDevice device, IUPnPService service)
 {
     return device.RootDevice.UniqueDeviceName + "|" + service.Id;
 }
示例#27
0
 public bool RemoveService(IUPnPService service)
 {
     return (RemoveService(service.GetUPnPService()));
 }
示例#28
0
 /// <summary>
 /// Add a UPnPService to this device
 /// </summary>
 /// <param name="service">Service</param>
 public void AddService(IUPnPService service)
 {
     AddService(service.GetUPnPService());
 }