SsdpEmbeddedDevice.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace Rssdp
  6. {
  7. /// <summary>
  8. /// Represents a device that is a descendant of a <see cref="SsdpRootDevice"/> instance.
  9. /// </summary>
  10. public class SsdpEmbeddedDevice : SsdpDevice
  11. {
  12. #region Fields
  13. private SsdpRootDevice _RootDevice;
  14. #endregion
  15. #region Constructors
  16. /// <summary>
  17. /// Default constructor.
  18. /// </summary>
  19. public SsdpEmbeddedDevice()
  20. {
  21. }
  22. /// <summary>
  23. /// Deserialisation constructor.
  24. /// </summary>
  25. /// <param name="deviceDescriptionXml">A UPnP device description XML document.</param>
  26. /// <exception cref="System.ArgumentNullException">Thrown if the <paramref name="deviceDescriptionXml"/> argument is null.</exception>
  27. /// <exception cref="System.ArgumentException">Thrown if the <paramref name="deviceDescriptionXml"/> argument is empty.</exception>
  28. public SsdpEmbeddedDevice(string deviceDescriptionXml)
  29. : base(deviceDescriptionXml)
  30. {
  31. }
  32. #endregion
  33. #region Public Properties
  34. /// <summary>
  35. /// 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.
  36. /// </summary>
  37. public SsdpRootDevice RootDevice
  38. {
  39. get
  40. {
  41. return _RootDevice;
  42. }
  43. internal set
  44. {
  45. _RootDevice = value;
  46. lock (this.Devices)
  47. {
  48. foreach (var embeddedDevice in this.Devices)
  49. {
  50. ((SsdpEmbeddedDevice)embeddedDevice).RootDevice = _RootDevice;
  51. }
  52. }
  53. }
  54. }
  55. #endregion
  56. }
  57. }