using System; using System.Collections.Generic; using PepperDash.Core; namespace PepperDash.Essentials.Core { /// /// Base class for RoutingInput and Output ports /// public abstract class RoutingPort : IKeyed { public string Key { get; private set; } public eRoutingSignalType Type { get; private set; } public eRoutingPortConnectionType ConnectionType { get; private set; } public readonly object Selector; public bool IsInternal { get; private set; } public RoutingPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, bool isInternal) { Key = key; Type = type; ConnectionType = connType; Selector = selector; IsInternal = IsInternal; } } public enum eRoutingSignalType { Audio, Video, AudioVideo } public enum eRoutingPortConnectionType { None, BackplaneOnly, Hdmi, Rgb, Vga, LineAudio, DigitalAudio, Sdi, Composite, Component, DmCat, DmMmFiber, DmSmFiber } /// /// Basic RoutingInput with no statuses. /// public class RoutingInputPort : RoutingPort { /// /// The IRoutingInputs object this lives on /// public IRoutingInputs ParentDevice { get; private set; } /// /// Constructor for a basic RoutingInputPort /// /// An object used to refer to this port in the IRouting device's ExecuteSwitch method. /// May be string, number, whatever /// The IRoutingInputs object this lives on public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingInputs parent) : this (key, type, connType, selector, parent, false) { } /// /// Constructor for a virtual routing input port that lives inside a device. For example /// the ports that link a DM card to a DM matrix bus /// /// true for internal ports public RoutingInputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingInputs parent, bool isInternal) : base(key, type, connType, selector, isInternal) { if (parent == null) throw new ArgumentNullException("parent"); ParentDevice = parent; } } /// /// A RoutingInputPort for devices like DM-TX and DM input cards. /// Will provide video statistics on connected signals /// public class RoutingInputPortWithVideoStatuses : RoutingInputPort { /// /// Video statuses attached to this port /// public VideoStatusOutputs VideoStatus { get; private set; } /// /// Constructor /// /// An object used to refer to this port in the IRouting device's ExecuteSwitch method. /// May be string, number, whatever /// The IRoutingInputs object this lives on /// A VideoStatusFuncsWrapper used to assign the callback funcs that will get /// the values for the various stats public RoutingInputPortWithVideoStatuses(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingInputs parent, VideoStatusFuncsWrapper funcs) : base(key, type, connType, selector, parent) { VideoStatus = new VideoStatusOutputs(funcs); } } public class RoutingOutputPort : RoutingPort { /// /// The IRoutingOutputs object this port lives on /// public IRoutingOutputs ParentDevice { get; private set; } public InUseTracking InUseTracker { get; private set; } /// /// /// An object used to refer to this port in the IRouting device's ExecuteSwitch method. /// May be string, number, whatever /// The IRoutingOutputs object this port lives on public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingOutputs parent) : this(key, type, connType, selector, parent, false) { } public RoutingOutputPort(string key, eRoutingSignalType type, eRoutingPortConnectionType connType, object selector, IRoutingOutputs parent, bool isInternal) : base(key, type, connType, selector, isInternal) { if (parent == null) throw new ArgumentNullException("parent"); ParentDevice = parent; InUseTracker = new InUseTracking(); } public override string ToString() { return ParentDevice.Key + ":" + Key; } } }