using System;
using System.Collections.Generic;
using System.Text;
namespace Rssdp
{
	/// 
	/// Represents a device that is a descendant of a  instance.
	/// 
	public class SsdpEmbeddedDevice : SsdpDevice
	{
		#region Fields
		
		private SsdpRootDevice _RootDevice;
		#endregion
		#region Constructors
		/// 
		/// Default constructor.
		/// 
		public SsdpEmbeddedDevice()
		{
		}
		/// 
		/// Deserialisation constructor.
		/// 
		/// A UPnP device description XML document.
		/// Thrown if the  argument is null.
		/// Thrown if the  argument is empty.
		public SsdpEmbeddedDevice(string deviceDescriptionXml)
			: base(deviceDescriptionXml)
		{
		}
		#endregion
		#region Public Properties
		/// 
		/// Returns the  that is this device's first ancestor. If this device is itself an , then returns a reference to itself.
		/// 
		public SsdpRootDevice RootDevice
		{
			get
			{
				return _RootDevice;
			}
			internal set
			{
				_RootDevice = value;
				lock (this.Devices)
				{
					foreach (var embeddedDevice in this.Devices)
					{
						((SsdpEmbeddedDevice)embeddedDevice).RootDevice = _RootDevice;
					}
				}
			}
		}
		#endregion
	}
}