1
0

SharedSurveillanceCameraMonitorSystem.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. using Robust.Shared.Serialization;
  2. namespace Content.Shared.SurveillanceCamera;
  3. // Camera monitor state. If the camera is null, there should be a blank
  4. // space where the camera is.
  5. [Serializable, NetSerializable]
  6. public sealed class SurveillanceCameraMonitorUiState : BoundUserInterfaceState
  7. {
  8. // The active camera on the monitor. If this is null, the part of the UI
  9. // that contains the monitor should clear.
  10. public NetEntity? ActiveCamera { get; }
  11. // Currently available subnets. Does not send the entirety of the possible
  12. // cameras to view because that could be really, really large
  13. public HashSet<string> Subnets { get; }
  14. public string ActiveAddress;
  15. // Currently active subnet.
  16. public string ActiveSubnet { get; }
  17. // Known cameras, by address and name.
  18. public Dictionary<string, string> Cameras { get; }
  19. public SurveillanceCameraMonitorUiState(NetEntity? activeCamera, HashSet<string> subnets, string activeAddress, string activeSubnet, Dictionary<string, string> cameras)
  20. {
  21. ActiveCamera = activeCamera;
  22. Subnets = subnets;
  23. ActiveAddress = activeAddress;
  24. ActiveSubnet = activeSubnet;
  25. Cameras = cameras;
  26. }
  27. }
  28. [Serializable, NetSerializable]
  29. public sealed class SurveillanceCameraMonitorSwitchMessage : BoundUserInterfaceMessage
  30. {
  31. public string Address { get; }
  32. public SurveillanceCameraMonitorSwitchMessage(string address)
  33. {
  34. Address = address;
  35. }
  36. }
  37. [Serializable, NetSerializable]
  38. public sealed class SurveillanceCameraMonitorSubnetRequestMessage : BoundUserInterfaceMessage
  39. {
  40. public string Subnet { get; }
  41. public SurveillanceCameraMonitorSubnetRequestMessage(string subnet)
  42. {
  43. Subnet = subnet;
  44. }
  45. }
  46. // Sent when the user requests that the cameras on the current subnet be refreshed.
  47. [Serializable, NetSerializable]
  48. public sealed class SurveillanceCameraRefreshCamerasMessage : BoundUserInterfaceMessage
  49. {}
  50. // Sent when the user requests that the subnets known by the monitor be refreshed.
  51. [Serializable, NetSerializable]
  52. public sealed class SurveillanceCameraRefreshSubnetsMessage : BoundUserInterfaceMessage
  53. {}
  54. // Sent when the user wants to disconnect the monitor from the camera.
  55. [Serializable, NetSerializable]
  56. public sealed class SurveillanceCameraDisconnectMessage : BoundUserInterfaceMessage
  57. {}
  58. [Serializable, NetSerializable]
  59. public enum SurveillanceCameraMonitorUiKey : byte
  60. {
  61. Key
  62. }
  63. // SETUP
  64. [Serializable, NetSerializable]
  65. public sealed class SurveillanceCameraSetupBoundUiState : BoundUserInterfaceState
  66. {
  67. public string Name { get; }
  68. public uint Network { get; }
  69. public List<string> Networks { get; }
  70. public bool NameDisabled { get; }
  71. public bool NetworkDisabled { get; }
  72. public SurveillanceCameraSetupBoundUiState(string name, uint network, List<string> networks, bool nameDisabled, bool networkDisabled)
  73. {
  74. Name = name;
  75. Network = network;
  76. Networks = networks;
  77. NameDisabled = nameDisabled;
  78. NetworkDisabled = networkDisabled;
  79. }
  80. }
  81. [Serializable, NetSerializable]
  82. public sealed class SurveillanceCameraSetupSetName : BoundUserInterfaceMessage
  83. {
  84. public string Name { get; }
  85. public SurveillanceCameraSetupSetName(string name)
  86. {
  87. Name = name;
  88. }
  89. }
  90. [Serializable, NetSerializable]
  91. public sealed class SurveillanceCameraSetupSetNetwork : BoundUserInterfaceMessage
  92. {
  93. public int Network { get; }
  94. public SurveillanceCameraSetupSetNetwork(int network)
  95. {
  96. Network = network;
  97. }
  98. }
  99. [Serializable, NetSerializable]
  100. public enum SurveillanceCameraSetupUiKey : byte
  101. {
  102. Camera,
  103. Router
  104. }