aboutsummaryrefslogtreecommitdiff
path: root/RSSDP/SsdpEmbeddedDevice.cs
blob: 28948f9506703f1f69b3f483e6037a7ec8f47429 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using System.Collections.Generic;
using System.Text;

namespace Rssdp
{
	/// <summary>
	/// Represents a device that is a descendant of a <see cref="SsdpRootDevice"/> instance.
	/// </summary>
	public class SsdpEmbeddedDevice : SsdpDevice
	{

		#region Fields
		
		private SsdpRootDevice _RootDevice;

		#endregion

		#region Constructors

		/// <summary>
		/// Default constructor.
		/// </summary>
		public SsdpEmbeddedDevice()
		{
		}

		/// <summary>
		/// Deserialisation constructor.
		/// </summary>
		/// <param name="deviceDescriptionXml">A UPnP device description XML document.</param>
		/// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="deviceDescriptionXml"/> argument is null.</exception>
		/// <exception cref="System.ArgumentException">Thrown if the <paramref name="deviceDescriptionXml"/> argument is empty.</exception>
		public SsdpEmbeddedDevice(string deviceDescriptionXml)
			: base(deviceDescriptionXml)
		{
		}

		#endregion

		#region Public Properties

		/// <summary>
		/// Returns the <see cref="SsdpRootDevice"/> that is this device's first ancestor. If this device is itself an <see cref="SsdpRootDevice"/>, then returns a reference to itself.
		/// </summary>
		public SsdpRootDevice RootDevice
		{
			get
			{
				return _RootDevice;
			}
			internal set
			{
				_RootDevice = value;
				lock (this.Devices)
				{
					foreach (var embeddedDevice in this.Devices)
					{
						((SsdpEmbeddedDevice)embeddedDevice).RootDevice = _RootDevice;
					}
				}
			}
		}

		#endregion

	}
}