123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899 |
- using InABox.Core;
- using InABox.Rpc;
- namespace PRSServices;
- public enum PortState
- {
- Unavailable,
- Available,
- Secure,
- }
- public enum PortType
- {
- None,
- Database,
- Session,
- Web,
- GPS,
- Sigfox,
- Certificate
- }
- public class PortStatus
- {
- public int Port { get; set; }
- public PortType Type { get; set; }
- public PortState State { get; set; }
- public PortStatus(int port, PortType type, PortState state)
- {
- Port = port;
- Type = type;
- State = state;
- }
- public PortStatus()
- {
- Port = 0;
- Type = PortType.None;
- State = PortState.Unavailable;
- }
- }
- //public class PortStatus[] : List<PortStatus> { }
- public class PortStatusCommand : IRpcCommand<PortStatusParameters, PortStatusResult>
- {
- public bool Log => false;
- }
- public class PortStatusParameters : IRpcCommandParameters
- {
- public void SerializeBinary(CoreBinaryWriter writer)
- {throw new System.NotImplementedException();
-
- }
- public void DeserializeBinary(CoreBinaryReader reader)
- {
- throw new System.NotImplementedException();
- }
- public string? FullDescription() => null;
- public string? ShortDescription() => null;
- }
- public class PortStatusResult : IRpcCommandResult
- {
-
- public PortStatus[] Ports { get; set; }
- public PortStatusResult()
- {
- Ports = new PortStatus[] { };
- }
- public void SerializeBinary(CoreBinaryWriter writer)
- {
- writer.WriteBinaryValue(Ports);
- }
- public void DeserializeBinary(CoreBinaryReader reader)
- {
- Ports = reader.ReadBinaryValue<PortStatus[]>();
- }
- public string? FullDescription() => null;
- }
- public class PortStatusHandler : RpcCommandHandler<IEngine, PortStatusCommand, PortStatusParameters, PortStatusResult>
- {
- protected override PortStatusResult Execute(IRpcSession session, PortStatusParameters? parameters, Logger logger)
- => new() { Ports = Sender.PortStatusList() };
- public PortStatusHandler(IEngine sender) : base(sender)
- {
- }
- }
|