PortStatus.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. using System.Collections.Generic;
  2. using InABox.IPC;
  3. namespace PRSServer
  4. {
  5. public enum PortState
  6. {
  7. Unavailable,
  8. Available,
  9. Secure,
  10. }
  11. public enum PortType
  12. {
  13. None,
  14. Database,
  15. Session,
  16. Web,
  17. GPS,
  18. Sigfox,
  19. Certificate
  20. }
  21. public class PortStatus
  22. {
  23. public int Port { get; set; }
  24. public PortType Type { get; set; }
  25. public PortState State { get; set; }
  26. public PortStatus(int port, PortType type, PortState state)
  27. {
  28. Port = port;
  29. Type = type;
  30. State = state;
  31. }
  32. public PortStatus()
  33. {
  34. Port = 0;
  35. Type = PortType.None;
  36. State = PortState.Unavailable;
  37. }
  38. }
  39. //public class PortStatus[] : List<PortStatus> { }
  40. public class PortStatusCommand : IRPCCommand<PortStatusParameters,PortStatus[]> { }
  41. public class PortStatusParameters { }
  42. public class PortStatusHandler : RPCCommandHandler<IEngine,PortStatusParameters,PortStatus[]>
  43. {
  44. public override PortStatus[]? Execute(PortStatusParameters? parameters) => Sender.PortStatusList();
  45. public PortStatusHandler(IEngine sender) : base(sender)
  46. {
  47. }
  48. }
  49. }