2
0

SsdpEmbeddedDevice.cs 1.5 KB

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