using System; using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM; using PepperDash.Core; namespace PepperDash.Essentials.Core { /// /// The handler type for a Room's SourceInfoChange /// public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type); //******************************************************************************************* // Interfaces /// /// For rooms with a single presentation source, change event /// public interface IHasCurrentSourceInfoChange { string CurrentSourceInfoKey { get; set; } SourceListItem CurrentSourceInfo { get; set; } event SourceInfoChangeHandler CurrentSourceChange; } /// /// Defines a class that has a collection of RoutingInputPorts /// public interface IRoutingInputs : IKeyed { RoutingPortCollection InputPorts { get; } } /// /// Defines a class that has a collection of RoutingOutputPorts /// public interface IRoutingOutputs : IKeyed { RoutingPortCollection OutputPorts { get; } } /// /// For fixed-source endpoint devices /// public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange { } /// /// For fixed-source endpoint devices /// [Obsolete("Please switch to IRoutingSink")] public interface IRoutingSinkNoSwitching : IRoutingSink { } /// /// Endpoint device like a display, that selects inputs /// public interface IRoutingSinkWithSwitching : IRoutingSink { //void ClearRoute(); void ExecuteSwitch(object inputSelector); } /// /// For devices like RMCs, baluns, other devices with no switching. /// public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs { } /// /// Defines a midpoint device as have internal routing. Any devices in the middle of the /// signal chain, that do switching, must implement this for routing to work otherwise /// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough /// device. /// public interface IRouting : IRoutingInputsOutputs { void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType); } public interface IRoutingNumeric : IRouting { void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } public interface ITxRouting : IRoutingNumeric { IntFeedback VideoSourceNumericFeedback { get; } IntFeedback AudioSourceNumericFeedback { get; } } /// /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) /// public interface IRmcRouting : IRoutingNumeric { IntFeedback AudioVideoSourceNumericFeedback { get; } } /// /// Defines an IRmcRouting with a feedback event /// public interface ITxRoutingWithFeedback : ITxRouting { } /// /// Defines an IRmcRouting with a feedback event /// public interface IRmcRoutingWithFeedback : IRmcRouting { } /// /// Defines an IRoutingOutputs devices as being a source - the start of the chain /// public interface IRoutingSource : IRoutingOutputs { } /// /// Defines an event structure for reporting output route data /// public interface IRoutingFeedback : IKeyName { event EventHandler NumericSwitchChange; //void OnSwitchChange(RoutingNumericEventArgs e); } /// /// Defines an IRoutingNumeric with a feedback event /// public interface IRoutingNumericWithFeedback : IRoutingNumeric, IRoutingFeedback { } /// /// Defines an IRouting with a feedback event /// public interface IRoutingWithFeedback : IRouting, IRoutingFeedback { } public class RoutingNumericEventArgs : EventArgs { public uint? Output { get; set; } public uint? Input { get; set; } public eRoutingSignalType SigType { get; set; } public RoutingInputPort InputPort { get; set; } public RoutingOutputPort OutputPort { get; set; } public RoutingNumericEventArgs(uint output, uint input, eRoutingSignalType sigType) : this(output, input, null, null, sigType) { } public RoutingNumericEventArgs(RoutingOutputPort outputPort, RoutingInputPort inputPort, eRoutingSignalType sigType) : this(null, null, outputPort, inputPort, sigType) { } public RoutingNumericEventArgs() : this(null, null, null, null, 0) { } public RoutingNumericEventArgs(uint? output, uint? input, RoutingOutputPort outputPort, RoutingInputPort inputPort, eRoutingSignalType sigType) { OutputPort = outputPort; InputPort = inputPort; Output = output; Input = input; SigType = sigType; } } }