mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Merged in feature/ecs-1125 (pull request #23)
Feature/ecs 1125 Approved-by: Neil Dorin <ndorin@pepperdash.com>
This commit is contained in:
@@ -102,7 +102,11 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if (device is DmpsRoutingController)
|
||||||
|
{
|
||||||
|
(device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
else if (device is DmTxControllerBase)
|
else if (device is DmTxControllerBase)
|
||||||
{
|
{
|
||||||
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as DmTxControllerBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
@@ -127,7 +131,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
{
|
{
|
||||||
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (device is IBridge)
|
else if (device is IBridge)
|
||||||
{
|
{
|
||||||
(device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
(device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
|
||||||
@@ -217,16 +221,26 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
/// <param name="args"></param>
|
/// <param name="args"></param>
|
||||||
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
|
||||||
{
|
{
|
||||||
if (Debug.Level >= 1)
|
try
|
||||||
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
{
|
||||||
var uo = args.Sig.UserObject;
|
if (Debug.Level >= 1)
|
||||||
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
|
||||||
if (uo is Action<bool>)
|
var uo = args.Sig.UserObject;
|
||||||
(uo as Action<bool>)(args.Sig.BoolValue);
|
if (uo != null)
|
||||||
else if (uo is Action<ushort>)
|
{
|
||||||
(uo as Action<ushort>)(args.Sig.UShortValue);
|
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
|
||||||
else if (uo is Action<string>)
|
if (uo is Action<bool>)
|
||||||
(uo as Action<string>)(args.Sig.StringValue);
|
(uo as Action<bool>)(args.Sig.BoolValue);
|
||||||
|
else if (uo is Action<ushort>)
|
||||||
|
(uo as Action<ushort>)(args.Sig.UShortValue);
|
||||||
|
else if (uo is Action<string>)
|
||||||
|
(uo as Action<string>)(args.Sig.StringValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Error in Eisc_SigChange handler: {0}", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
@@ -27,7 +28,7 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||||
|
|
||||||
// Link up outputs
|
// Link up outputs
|
||||||
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs - 1; i++)
|
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++)
|
||||||
{
|
{
|
||||||
var ioSlot = i;
|
var ioSlot = i;
|
||||||
|
|
||||||
@@ -39,8 +40,16 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
||||||
var TxKey = dmChassis.TxDictionary[ioSlot];
|
var TxKey = dmChassis.TxDictionary[ioSlot];
|
||||||
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|
||||||
//TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|
||||||
|
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
|
||||||
|
{
|
||||||
|
dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
// TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
// TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
// trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
// trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||||
// TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
|
// TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
|
||||||
@@ -55,9 +64,16 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
|
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
|
||||||
var RxKey = dmChassis.RxDictionary[ioSlot];
|
var RxKey = dmChassis.RxDictionary[ioSlot];
|
||||||
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
|
||||||
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|
||||||
|
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|
||||||
//RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
|
||||||
|
{
|
||||||
|
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Feedback
|
// Feedback
|
||||||
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
||||||
@@ -69,8 +85,6 @@ namespace PepperDash.Essentials.Bridges
|
|||||||
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||||
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||||
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||||
// dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
|
||||||
// dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
177
PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs
Normal file
177
PepperDashEssentials/Bridges/DmpsRoutingControllerBridge.cs
Normal file
@@ -0,0 +1,177 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Bridges
|
||||||
|
{
|
||||||
|
public static class DmpsRoutingControllerApiExtentions
|
||||||
|
{
|
||||||
|
public static void LinkToApi(this DmpsRoutingController dmpsRouter, BasicTriList trilist, uint joinStart, string joinMapKey)
|
||||||
|
{
|
||||||
|
var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmpsRoutingControllerJoinMap;
|
||||||
|
|
||||||
|
if (joinMap == null)
|
||||||
|
joinMap = new DmpsRoutingControllerJoinMap();
|
||||||
|
|
||||||
|
joinMap.OffsetJoinNumbers(joinStart);
|
||||||
|
|
||||||
|
Debug.Console(1, dmpsRouter, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
|
||||||
|
|
||||||
|
// Link up outputs
|
||||||
|
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherInputs; i++)
|
||||||
|
{
|
||||||
|
Debug.Console(2, dmpsRouter, "Linking Input Card {0}", i);
|
||||||
|
|
||||||
|
var ioSlot = i;
|
||||||
|
|
||||||
|
//if (dmpsRouter.TxDictionary.ContainsKey(ioSlot))
|
||||||
|
//{
|
||||||
|
// Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
|
||||||
|
// var TxKey = dmpsRouter.TxDictionary[ioSlot];
|
||||||
|
// var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
|
||||||
|
// //TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// // TxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
// // trilist.SetUShortSigAction((ApiMap.HdcpSupport[ioSlot]), u => TxDevice.SetHdcpSupportAll((ePdtHdcpSupport)(u)));
|
||||||
|
// // TxDevice.HdcpSupportAllFeedback.LinkInputSig(trilist.UShortInput[joinMap. + ioSlot]);
|
||||||
|
// // trilist.UShortInput[ApiMap.HdcpSupportCapability[ioSlot]].UShortValue = TxDevice.HdcpSupportCapability;
|
||||||
|
//}
|
||||||
|
//else
|
||||||
|
//{
|
||||||
|
// // dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[ApiMap.TxVideoSyncStatus[ioSlot]]);
|
||||||
|
//}
|
||||||
|
|
||||||
|
if(dmpsRouter.VideoInputSyncFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]);
|
||||||
|
|
||||||
|
if (dmpsRouter.InputNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
|
||||||
|
|
||||||
|
trilist.SetStringSigAction(joinMap.InputNames + ioSlot, new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var inputCard = dmpsRouter.Dmps.SwitcherInputs[ioSlot] as DMInput;
|
||||||
|
|
||||||
|
if (inputCard != null)
|
||||||
|
{
|
||||||
|
if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue) && inputCard.NameFeedback.StringValue != s)
|
||||||
|
if(inputCard.Name != null)
|
||||||
|
inputCard.Name.StringValue = s;
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
if(dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (uint i = 1; i <= dmpsRouter.Dmps.NumberOfSwitcherOutputs; i++)
|
||||||
|
{
|
||||||
|
Debug.Console(2, dmpsRouter, "Linking Output Card {0}", i);
|
||||||
|
|
||||||
|
var ioSlot = i;
|
||||||
|
// Control
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video)));
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action<ushort>(o => dmpsRouter.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio)));
|
||||||
|
|
||||||
|
trilist.SetStringSigAction(joinMap.OutputNames + ioSlot, new Action<string>(s =>
|
||||||
|
{
|
||||||
|
var outputCard = dmpsRouter.Dmps.SwitcherOutputs[ioSlot] as DMOutput;
|
||||||
|
|
||||||
|
//Debug.Console(2, dmpsRouter, "Output Name String Sig Action for Output Card {0}", ioSlot);
|
||||||
|
|
||||||
|
if (outputCard != null)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, dmpsRouter, "Card Type: {0}", outputCard.CardInputOutputType);
|
||||||
|
|
||||||
|
if (!(outputCard is Crestron.SimplSharpPro.DM.Cards.Card.Dmps3CodecOutput) && outputCard.NameFeedback != null)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
|
||||||
|
{
|
||||||
|
//Debug.Console(2, dmpsRouter, "NameFeedabck: {0}", outputCard.NameFeedback.StringValue);
|
||||||
|
|
||||||
|
if (outputCard.NameFeedback.StringValue != s && outputCard.Name != null)
|
||||||
|
{
|
||||||
|
outputCard.Name.StringValue = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
|
// Feedback
|
||||||
|
if(dmpsRouter.VideoOutputFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
|
||||||
|
if (dmpsRouter.AudioOutputFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]);
|
||||||
|
if (dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot] != null)
|
||||||
|
dmpsRouter.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public class DmpsRoutingControllerJoinMap : JoinMapBase
|
||||||
|
{
|
||||||
|
public uint OutputVideo { get; set; }
|
||||||
|
public uint OutputAudio { get; set; }
|
||||||
|
public uint VideoSyncStatus { get; set; }
|
||||||
|
public uint InputNames { get; set; }
|
||||||
|
public uint OutputNames { get; set; }
|
||||||
|
public uint OutputCurrentVideoInputNames { get; set; }
|
||||||
|
public uint OutputCurrentAudioInputNames { get; set; }
|
||||||
|
public uint InputCurrentResolution { get; set; }
|
||||||
|
public uint InputEndpointOnline { get; set; }
|
||||||
|
public uint OutputEndpointOnline { get; set; }
|
||||||
|
//public uint HdcpSupport { get; set; }
|
||||||
|
//public uint HdcpSupportCapability { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DmpsRoutingControllerJoinMap()
|
||||||
|
{;
|
||||||
|
OutputVideo = 100; //101-299
|
||||||
|
OutputAudio = 300; //301-499
|
||||||
|
VideoSyncStatus = 100; //101-299
|
||||||
|
InputNames = 100; //101-299
|
||||||
|
OutputNames = 300; //301-499
|
||||||
|
OutputCurrentVideoInputNames = 2000; //2001-2199
|
||||||
|
OutputCurrentAudioInputNames = 2200; //2201-2399
|
||||||
|
InputCurrentResolution = 2400; // 2401-2599
|
||||||
|
InputEndpointOnline = 500;
|
||||||
|
OutputEndpointOnline = 700;
|
||||||
|
//HdcpSupport = 1000; //1001-1199
|
||||||
|
//HdcpSupportCapability = 1200; //1201-1399
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OffsetJoinNumbers(uint joinStart)
|
||||||
|
{
|
||||||
|
var joinOffset = joinStart - 1;
|
||||||
|
|
||||||
|
OutputVideo = OutputVideo + joinOffset;
|
||||||
|
OutputAudio = OutputAudio + joinOffset;
|
||||||
|
VideoSyncStatus = VideoSyncStatus + joinOffset;
|
||||||
|
InputNames = InputNames + joinOffset;
|
||||||
|
OutputNames = OutputNames + joinOffset;
|
||||||
|
OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset;
|
||||||
|
OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset;
|
||||||
|
InputCurrentResolution = InputCurrentResolution + joinOffset;
|
||||||
|
InputEndpointOnline = InputEndpointOnline + joinOffset;
|
||||||
|
OutputEndpointOnline = OutputEndpointOnline + joinOffset;
|
||||||
|
//HdcpSupport = HdcpSupport + joinOffset;
|
||||||
|
//HdcpSupportCapability = HdcpSupportCapability + joinOffset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -356,8 +356,22 @@ namespace PepperDash.Essentials
|
|||||||
public void LoadDevices()
|
public void LoadDevices()
|
||||||
{
|
{
|
||||||
// Build the processor wrapper class
|
// Build the processor wrapper class
|
||||||
|
|
||||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
|
||||||
|
|
||||||
|
// Check if the processor is a DMPS model
|
||||||
|
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
|
||||||
|
{
|
||||||
|
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
|
||||||
|
|
||||||
|
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, new DM.Config.DmpsRoutingPropertiesConfig());
|
||||||
|
DeviceManager.AddDevice(dmpsRoutingController);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, "************Processor is not DMPS type***************");
|
||||||
|
}
|
||||||
|
|
||||||
// Add global System Monitor device
|
// Add global System Monitor device
|
||||||
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
|
||||||
|
|
||||||
@@ -373,7 +387,7 @@ namespace PepperDash.Essentials
|
|||||||
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
|
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
|
||||||
Debug.Console(0,
|
Debug.Console(0,
|
||||||
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
|
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
|
||||||
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
|
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,6 +121,7 @@
|
|||||||
<Compile Include="Bridges\BridgeFactory.cs" />
|
<Compile Include="Bridges\BridgeFactory.cs" />
|
||||||
<Compile Include="Bridges\CameraControllerBridge.cs" />
|
<Compile Include="Bridges\CameraControllerBridge.cs" />
|
||||||
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
|
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
|
||||||
|
<Compile Include="Bridges\DmpsRoutingControllerBridge.cs" />
|
||||||
<Compile Include="Bridges\DisplayControllerBridge.cs" />
|
<Compile Include="Bridges\DisplayControllerBridge.cs" />
|
||||||
<Compile Include="Bridges\DigitalLoggerBridge.cs" />
|
<Compile Include="Bridges\DigitalLoggerBridge.cs" />
|
||||||
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
{
|
{
|
||||||
Audio = 1,
|
Audio = 1,
|
||||||
Video = 2,
|
Video = 2,
|
||||||
AudioVideo = 3
|
AudioVideo = 4
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eRoutingPortConnectionType
|
public enum eRoutingPortConnectionType
|
||||||
|
|||||||
@@ -21,8 +21,8 @@ namespace PepperDash.Essentials.DM
|
|||||||
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
|
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class DmChassisController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback//, ICardPortsDevice
|
public class DmChassisController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback
|
||||||
{
|
{
|
||||||
public DmMDMnxn Chassis { get; private set; }
|
public DmMDMnxn Chassis { get; private set; }
|
||||||
|
|
||||||
// Feedbacks for EssentialDM
|
// Feedbacks for EssentialDM
|
||||||
@@ -117,82 +117,6 @@ namespace PepperDash.Essentials.DM
|
|||||||
controller.InputNames = properties.InputNames;
|
controller.InputNames = properties.InputNames;
|
||||||
controller.OutputNames = properties.OutputNames;
|
controller.OutputNames = properties.OutputNames;
|
||||||
return controller;
|
return controller;
|
||||||
|
|
||||||
|
|
||||||
//DmChassisController controller = null;
|
|
||||||
|
|
||||||
//if (type == "dmmd8x8")
|
|
||||||
//{
|
|
||||||
// controller = new DmChassisController(key, name, new DmMd8x8(ipid, Global.ControlSystem));
|
|
||||||
|
|
||||||
// // add the cards and port names
|
|
||||||
// foreach (var kvp in properties.InputSlots)
|
|
||||||
// controller.AddInputCard(kvp.Value, kvp.Key);
|
|
||||||
// foreach (var kvp in properties.OutputSlots)
|
|
||||||
// {
|
|
||||||
// controller.AddOutputCard(kvp.Value, kvp.Key);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var kvp in properties.VolumeControls)
|
|
||||||
// {
|
|
||||||
// // get the card
|
|
||||||
// // check it for an audio-compatible type
|
|
||||||
// // make a something-something that will make it work
|
|
||||||
// // retire to mountain village
|
|
||||||
// var outNum = kvp.Key;
|
|
||||||
// var card = controller.Chassis.Outputs[outNum].Card;
|
|
||||||
// Audio.Output audio = null;
|
|
||||||
// if (card is DmcHdo)
|
|
||||||
// audio = (card as DmcHdo).Audio;
|
|
||||||
// else if (card is Dmc4kHdo)
|
|
||||||
// audio = (card as Dmc4kHdo).Audio;
|
|
||||||
// if (audio == null)
|
|
||||||
// continue;
|
|
||||||
// // wire up the audio to something here...
|
|
||||||
// controller.AddVolumeControl(outNum, audio);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// controller.InputNames = properties.InputNames;
|
|
||||||
// controller.OutputNames = properties.OutputNames;
|
|
||||||
// return controller;
|
|
||||||
//}
|
|
||||||
//else if (type == "dmmd16x16")
|
|
||||||
//{
|
|
||||||
// controller = new DmChassisController(key, name, new DmMd16x16(ipid, Global.ControlSystem));
|
|
||||||
|
|
||||||
// // add the cards and port names
|
|
||||||
// foreach (var kvp in properties.InputSlots)
|
|
||||||
// controller.AddInputCard(kvp.Value, kvp.Key);
|
|
||||||
// foreach (var kvp in properties.OutputSlots)
|
|
||||||
// {
|
|
||||||
// controller.AddOutputCard(kvp.Value, kvp.Key);
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
// foreach (var kvp in properties.VolumeControls)
|
|
||||||
// {
|
|
||||||
// // get the card
|
|
||||||
// // check it for an audio-compatible type
|
|
||||||
// // make a something-something that will make it work
|
|
||||||
// // retire to mountain village
|
|
||||||
// var outNum = kvp.Key;
|
|
||||||
// var card = controller.Chassis.Outputs[outNum].Card;
|
|
||||||
// Audio.Output audio = null;
|
|
||||||
// if (card is DmcHdo)
|
|
||||||
// audio = (card as DmcHdo).Audio;
|
|
||||||
// else if (card is Dmc4kHdo)
|
|
||||||
// audio = (card as Dmc4kHdo).Audio;
|
|
||||||
// if (audio == null)
|
|
||||||
// continue;
|
|
||||||
// // wire up the audio to something here...
|
|
||||||
// controller.AddVolumeControl(outNum, audio);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// controller.InputNames = properties.InputNames;
|
|
||||||
// controller.OutputNames = properties.OutputNames;
|
|
||||||
// return controller;
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
catch (System.Exception e)
|
catch (System.Exception e)
|
||||||
{
|
{
|
||||||
@@ -218,7 +142,6 @@ namespace PepperDash.Essentials.DM
|
|||||||
TxDictionary = new Dictionary<uint, string>();
|
TxDictionary = new Dictionary<uint, string>();
|
||||||
RxDictionary = new Dictionary<uint, string>();
|
RxDictionary = new Dictionary<uint, string>();
|
||||||
IsOnline.OutputChange += new EventHandler<FeedbackEventArgs>(IsOnline_OutputChange);
|
IsOnline.OutputChange += new EventHandler<FeedbackEventArgs>(IsOnline_OutputChange);
|
||||||
//IsOnline.OutputChange += new EventHandler<EventArgs>(this.IsOnline_OutputChange);
|
|
||||||
Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
|
Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
|
||||||
//Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange);
|
//Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange);
|
||||||
Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
|
Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
|
||||||
@@ -249,7 +172,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
|
return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
|
||||||
});
|
});
|
||||||
InputNameFeedbacks[tempX] = new StringFeedback(() => {
|
InputNameFeedbacks[tempX] = new StringFeedback(() => {
|
||||||
if (Chassis.Inputs[tempX].NameFeedback.StringValue != null)
|
if (Chassis.Inputs[tempX].NameFeedback != null)
|
||||||
{
|
{
|
||||||
return Chassis.Inputs[tempX].NameFeedback.StringValue;
|
return Chassis.Inputs[tempX].NameFeedback.StringValue;
|
||||||
}
|
}
|
||||||
@@ -259,7 +182,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
OutputNameFeedbacks[tempX] = new StringFeedback(() => {
|
OutputNameFeedbacks[tempX] = new StringFeedback(() => {
|
||||||
if (Chassis.Outputs[tempX].NameFeedback.StringValue != null)
|
if (Chassis.Outputs[tempX].NameFeedback != null)
|
||||||
{
|
{
|
||||||
return Chassis.Outputs[tempX].NameFeedback.StringValue;
|
return Chassis.Outputs[tempX].NameFeedback.StringValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,451 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Crestron.SimplSharpPro.DM.Cards;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.DM
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DmpsInternalVirtualHdmiVgaInputController : Device, ITxRouting, IHasFeedback
|
||||||
|
{
|
||||||
|
public Card.Dmps3HdmiVgaInput InputCard { get; protected set; }
|
||||||
|
|
||||||
|
public eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
|
||||||
|
public StringFeedback ActiveVideoInputFeedback { get; protected set; }
|
||||||
|
|
||||||
|
public RoutingInputPortWithVideoStatuses HdmiIn { get; protected set; }
|
||||||
|
public RoutingInputPortWithVideoStatuses VgaIn { get; protected set; }
|
||||||
|
public RoutingInputPort AudioIn { get; protected set; }
|
||||||
|
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
|
||||||
|
|
||||||
|
public RoutingOutputPort VirtualDmOut { get; protected set; }
|
||||||
|
|
||||||
|
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
|
||||||
|
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
|
||||||
|
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a list containing the Outputs that we want to expose.
|
||||||
|
/// </summary>
|
||||||
|
public FeedbackCollection<Feedback> Feedbacks { get; private set; }
|
||||||
|
|
||||||
|
public void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Helps get the "real" inputs, including when in Auto
|
||||||
|
/// </summary>
|
||||||
|
public eDmps3InputVideoSource ActualVideoInput
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (InputCard.VideoSourceFeedback != eDmps3InputVideoSource.Auto)
|
||||||
|
return InputCard.VideoSourceFeedback;
|
||||||
|
else // auto
|
||||||
|
{
|
||||||
|
if (InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
|
||||||
|
return eDmps3InputVideoSource.Hdmi;
|
||||||
|
else if (InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue)
|
||||||
|
return eDmps3InputVideoSource.Vga;
|
||||||
|
else
|
||||||
|
return eDmps3InputVideoSource.Bnc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual RoutingPortCollection<RoutingInputPort> InputPorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new RoutingPortCollection<RoutingInputPort>
|
||||||
|
{
|
||||||
|
HdmiIn,
|
||||||
|
VgaIn,
|
||||||
|
AudioIn,
|
||||||
|
AnyVideoInput
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public RoutingPortCollection<RoutingOutputPort> OutputPorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new RoutingPortCollection<RoutingOutputPort> { VirtualDmOut };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpsInternalVirtualHdmiVgaInputController(string key, string name, DMInput inputCard)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Feedbacks = new FeedbackCollection<Feedback>();
|
||||||
|
|
||||||
|
if (inputCard is Card.Dmps3HdmiVgaInput)
|
||||||
|
{
|
||||||
|
InputCard = inputCard as Card.Dmps3HdmiVgaInput;
|
||||||
|
|
||||||
|
HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi,
|
||||||
|
eDmps3InputVideoSource.Hdmi, this, VideoStatusHelper.GetHdmiInputStatusFuncs(InputCard.HdmiInputPort));
|
||||||
|
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||||
|
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eDmps3InputVideoSource.Vga, this,
|
||||||
|
VideoStatusHelper.GetVgaInputStatusFuncs(InputCard.VgaInputPort));
|
||||||
|
AudioIn = new RoutingInputPort(DmPortName.AudioIn, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio,
|
||||||
|
eDmps3InputAudioSource.Analog, this);
|
||||||
|
|
||||||
|
if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp2xSupport)
|
||||||
|
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
|
||||||
|
else if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp1xSupport)
|
||||||
|
HdcpSupportCapability = eHdcpCapabilityType.Hdcp1xSupport;
|
||||||
|
|
||||||
|
var combinedFuncs = new VideoStatusFuncsWrapper
|
||||||
|
{
|
||||||
|
HdcpActiveFeedbackFunc = () =>
|
||||||
|
(ActualVideoInput == eDmps3InputVideoSource.Hdmi
|
||||||
|
&& InputCard.HdmiInputPort.VideoAttributes.HdcpActiveFeedback.BoolValue),
|
||||||
|
|
||||||
|
HdcpStateFeedbackFunc = () =>
|
||||||
|
{
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
|
||||||
|
return InputCard.HdmiInputPort.VideoAttributes.HdcpStateFeedback.ToString();
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
|
||||||
|
VideoResolutionFeedbackFunc = () =>
|
||||||
|
{
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
|
||||||
|
return InputCard.HdmiInputPort.VideoAttributes.GetVideoResolutionString();
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Vga)
|
||||||
|
return InputCard.VgaInputPort.VideoAttributes.GetVideoResolutionString();
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
VideoSyncFeedbackFunc = () =>
|
||||||
|
(ActualVideoInput == eDmps3InputVideoSource.Hdmi
|
||||||
|
&& InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
|
||||||
|
|| (ActualVideoInput == eDmps3InputVideoSource.Vga
|
||||||
|
&& InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue),
|
||||||
|
|
||||||
|
HasVideoStatusFunc = () =>
|
||||||
|
(ActualVideoInput == eDmps3InputVideoSource.Hdmi
|
||||||
|
&& HdmiIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
|
||||||
|
|| (ActualVideoInput == eDmps3InputVideoSource.Vga
|
||||||
|
&& VgaIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
|
||||||
|
};
|
||||||
|
|
||||||
|
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
|
||||||
|
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, eDmps3InputVideoSource.Auto, this, combinedFuncs);
|
||||||
|
|
||||||
|
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualVideoInput.ToString());
|
||||||
|
|
||||||
|
VideoSourceNumericFeedback = new IntFeedback(() =>
|
||||||
|
{
|
||||||
|
return (int)InputCard.VideoSourceFeedback;
|
||||||
|
});
|
||||||
|
AudioSourceNumericFeedback = new IntFeedback(() =>
|
||||||
|
{
|
||||||
|
return (int)InputCard.AudioSourceFeedback;
|
||||||
|
});
|
||||||
|
|
||||||
|
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
|
||||||
|
{
|
||||||
|
if (InputCard.HdmiInputPort.HdcpSupportOnFeedback.BoolValue)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set Ports for CEC
|
||||||
|
HdmiIn.Port = InputCard.HdmiInputPort;
|
||||||
|
|
||||||
|
VirtualDmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.None, null, this);
|
||||||
|
|
||||||
|
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
|
||||||
|
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
|
||||||
|
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
|
||||||
|
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback);
|
||||||
|
|
||||||
|
//AddPostActivationAction(() =>
|
||||||
|
//{
|
||||||
|
// Link up all of these damned events to the various RoutingPorts via a helper handler
|
||||||
|
InputCard.HdmiInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
|
||||||
|
InputCard.HdmiInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
|
||||||
|
|
||||||
|
InputCard.VgaInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
|
||||||
|
InputCard.VgaInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
|
||||||
|
//});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Relays the input stream change to the appropriate RoutingInputPort.
|
||||||
|
/// </summary>
|
||||||
|
protected void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
|
||||||
|
{
|
||||||
|
if (eventId == Crestron.SimplSharpPro.DM.DMInputEventIds.SourceSyncEventId)
|
||||||
|
{
|
||||||
|
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
|
||||||
|
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Relays the VideoAttributes change to a RoutingInputPort
|
||||||
|
/// </summary>
|
||||||
|
protected void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
|
||||||
|
{
|
||||||
|
switch (eventId)
|
||||||
|
{
|
||||||
|
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
|
||||||
|
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
|
||||||
|
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
|
||||||
|
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
|
||||||
|
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
|
||||||
|
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
|
||||||
|
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
|
||||||
|
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
|
||||||
|
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
|
||||||
|
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds feedback(s) to the list
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="newFbs"></param>
|
||||||
|
public void AddToFeedbackList(params Feedback[] newFbs)
|
||||||
|
{
|
||||||
|
foreach (var f in newFbs)
|
||||||
|
{
|
||||||
|
if (f != null)
|
||||||
|
{
|
||||||
|
if (!Feedbacks.Contains(f))
|
||||||
|
{
|
||||||
|
Feedbacks.Add(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#region ITxRouting Members
|
||||||
|
|
||||||
|
|
||||||
|
public virtual void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
|
||||||
|
|
||||||
|
switch (input)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(eDmps3InputVideoSource.Auto, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(HdmiIn.Selector, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(VgaIn.Selector, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region IRouting Members
|
||||||
|
|
||||||
|
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
|
||||||
|
{
|
||||||
|
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
|
||||||
|
InputCard.VideoSource = (eDmps3InputVideoSource)inputSelector;
|
||||||
|
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
|
||||||
|
InputCard.AudioSource = (eDmps3InputAudioSource)inputSelector;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public class DmpsInternalVirtualHdmiVgaBncInputController : DmpsInternalVirtualHdmiVgaInputController
|
||||||
|
{
|
||||||
|
public new Card.Dmps3HdmiVgaBncInput InputCard { get; private set; }
|
||||||
|
|
||||||
|
public RoutingInputPortWithVideoStatuses BncIn { get; private set; }
|
||||||
|
public RoutingInputPort SpdifIn { get; private set; }
|
||||||
|
|
||||||
|
public override RoutingPortCollection<RoutingInputPort> InputPorts
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return new RoutingPortCollection<RoutingInputPort>
|
||||||
|
{
|
||||||
|
HdmiIn,
|
||||||
|
VgaIn,
|
||||||
|
BncIn,
|
||||||
|
SpdifIn,
|
||||||
|
AnyVideoInput
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public DmpsInternalVirtualHdmiVgaBncInputController(string key, string name, Card.Dmps3HdmiVgaBncInput inputCard)
|
||||||
|
: base(key, name, inputCard)
|
||||||
|
{
|
||||||
|
InputCard = inputCard;
|
||||||
|
|
||||||
|
HdmiIn = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi,
|
||||||
|
eDmps3InputVideoSource.Hdmi, this, VideoStatusHelper.GetHdmiInputStatusFuncs(InputCard.HdmiInputPort));
|
||||||
|
VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
|
||||||
|
eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eDmps3InputVideoSource.Vga, this,
|
||||||
|
VideoStatusHelper.GetVgaInputStatusFuncs(InputCard.VgaInputPort));
|
||||||
|
BncIn = new RoutingInputPortWithVideoStatuses(DmPortName.BncIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Component,
|
||||||
|
eDmps3InputVideoSource.Bnc, this, VideoStatusHelper.GetBncInputStatusFuncs(InputCard.BncInputPort));
|
||||||
|
SpdifIn = new RoutingInputPort(DmPortName.SpdifIn, eRoutingSignalType.Audio, eRoutingPortConnectionType.DigitalAudio,
|
||||||
|
eDmps3InputAudioSource.Spdif, this);
|
||||||
|
|
||||||
|
if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp2xSupport)
|
||||||
|
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
|
||||||
|
else if (InputCard.HdmiInputPort.HdcpSupportedLevelFeedback == eHdcpSupportedLevel.Hdcp1xSupport)
|
||||||
|
HdcpSupportCapability = eHdcpCapabilityType.Hdcp1xSupport;
|
||||||
|
|
||||||
|
var combinedFuncs = new VideoStatusFuncsWrapper
|
||||||
|
{
|
||||||
|
HdcpActiveFeedbackFunc = () =>
|
||||||
|
(ActualVideoInput == eDmps3InputVideoSource.Hdmi
|
||||||
|
&& InputCard.HdmiInputPort.VideoAttributes.HdcpActiveFeedback.BoolValue),
|
||||||
|
|
||||||
|
HdcpStateFeedbackFunc = () =>
|
||||||
|
{
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
|
||||||
|
return InputCard.HdmiInputPort.VideoAttributes.HdcpStateFeedback.ToString();
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
|
||||||
|
VideoResolutionFeedbackFunc = () =>
|
||||||
|
{
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Hdmi)
|
||||||
|
return InputCard.HdmiInputPort.VideoAttributes.GetVideoResolutionString();
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Vga)
|
||||||
|
return InputCard.VgaInputPort.VideoAttributes.GetVideoResolutionString();
|
||||||
|
if (ActualVideoInput == eDmps3InputVideoSource.Bnc)
|
||||||
|
return InputCard.BncInputPort.VideoAttributes.GetVideoResolutionString();
|
||||||
|
return "";
|
||||||
|
},
|
||||||
|
VideoSyncFeedbackFunc = () =>
|
||||||
|
(ActualVideoInput == eDmps3InputVideoSource.Hdmi
|
||||||
|
&& InputCard.HdmiInputPort.SyncDetectedFeedback.BoolValue)
|
||||||
|
|| (ActualVideoInput == eDmps3InputVideoSource.Vga
|
||||||
|
&& InputCard.VgaInputPort.SyncDetectedFeedback.BoolValue)
|
||||||
|
|| (ActualVideoInput == eDmps3InputVideoSource.Bnc
|
||||||
|
&& InputCard.BncInputPort.VideoDetectedFeedback.BoolValue),
|
||||||
|
|
||||||
|
HasVideoStatusFunc = () =>
|
||||||
|
(ActualVideoInput == eDmps3InputVideoSource.Hdmi
|
||||||
|
&& HdmiIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
|
||||||
|
|| (ActualVideoInput == eDmps3InputVideoSource.Vga
|
||||||
|
&& VgaIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
|
||||||
|
|| (ActualVideoInput == eDmps3InputVideoSource.Bnc
|
||||||
|
&&BncIn.VideoStatus.HasVideoStatusFeedback.BoolValue)
|
||||||
|
};
|
||||||
|
|
||||||
|
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
|
||||||
|
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
|
||||||
|
|
||||||
|
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualVideoInput.ToString());
|
||||||
|
|
||||||
|
VideoSourceNumericFeedback = new IntFeedback(() =>
|
||||||
|
{
|
||||||
|
return (int)InputCard.VideoSourceFeedback;
|
||||||
|
});
|
||||||
|
AudioSourceNumericFeedback = new IntFeedback(() =>
|
||||||
|
{
|
||||||
|
return (int)InputCard.AudioSourceFeedback;
|
||||||
|
});
|
||||||
|
|
||||||
|
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
|
||||||
|
{
|
||||||
|
if (InputCard.HdmiInputPort.HdcpSupportOnFeedback.BoolValue)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Set Ports for CEC
|
||||||
|
HdmiIn.Port = InputCard.HdmiInputPort;
|
||||||
|
|
||||||
|
VirtualDmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
|
||||||
|
eRoutingPortConnectionType.None, null, this);
|
||||||
|
|
||||||
|
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
|
||||||
|
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
|
||||||
|
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
|
||||||
|
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback);
|
||||||
|
|
||||||
|
//AddPostActivationAction(() =>
|
||||||
|
//{
|
||||||
|
// Link up all of these damned events to the various RoutingPorts via a helper handler
|
||||||
|
InputCard.HdmiInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
|
||||||
|
InputCard.HdmiInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
|
||||||
|
|
||||||
|
InputCard.VgaInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
|
||||||
|
InputCard.VgaInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
|
||||||
|
|
||||||
|
InputCard.BncInputPort.InputOutput.BaseDevice.BaseEvent += (o, a) => FowardInputStreamChange(HdmiIn, a.EventId);
|
||||||
|
InputCard.BncInputPort.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn, a.EventId);
|
||||||
|
//});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
|
||||||
|
|
||||||
|
switch (input)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(eDmps3InputVideoSource.Auto, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 1:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(HdmiIn.Selector, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(VgaIn.Selector, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 3:
|
||||||
|
{
|
||||||
|
ExecuteSwitch(BncIn.Selector, null, type);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,654 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Crestron.SimplSharp;
|
||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Crestron.SimplSharpPro.DM.Cards;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints;
|
||||||
|
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
|
||||||
|
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
|
||||||
|
using PepperDash.Essentials.DM.Config;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.DM
|
||||||
|
{
|
||||||
|
public class DmpsRoutingController : Device, IRoutingInputsOutputs, IRouting, IHasFeedback
|
||||||
|
{
|
||||||
|
public CrestronControlSystem Dmps { get; set; }
|
||||||
|
public ISystemControl SystemControl { get; private set; }
|
||||||
|
|
||||||
|
// Feedbacks for EssentialDM
|
||||||
|
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, IntFeedback> AudioOutputFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, BoolFeedback> VideoInputSyncFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, BoolFeedback> InputEndpointOnlineFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, BoolFeedback> OutputEndpointOnlineFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, StringFeedback> InputNameFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, StringFeedback> OutputNameFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, StringFeedback> OutputVideoRouteNameFeedbacks { get; private set; }
|
||||||
|
public Dictionary<uint, StringFeedback> OutputAudioRouteNameFeedbacks { get; private set; }
|
||||||
|
|
||||||
|
public FeedbackCollection<Feedback> Feedbacks { get; private set; }
|
||||||
|
|
||||||
|
// Need a couple Lists of generic Backplane ports
|
||||||
|
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||||
|
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||||
|
|
||||||
|
public Dictionary<uint, string> TxDictionary { get; set; }
|
||||||
|
public Dictionary<uint, string> RxDictionary { get; set; }
|
||||||
|
|
||||||
|
public Dictionary<uint, string> InputNames { get; set; }
|
||||||
|
public Dictionary<uint, string> OutputNames { get; set; }
|
||||||
|
public Dictionary<uint, DmCardAudioOutputController> VolumeControls { get; private set; }
|
||||||
|
|
||||||
|
public const int RouteOffTime = 500;
|
||||||
|
Dictionary<PortNumberType, CTimer> RouteOffTimers = new Dictionary<PortNumberType, CTimer>();
|
||||||
|
|
||||||
|
public static DmpsRoutingController GetDmpsRoutingController(string key, string name,
|
||||||
|
DmpsRoutingPropertiesConfig properties)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ISystemControl systemControl = null;
|
||||||
|
|
||||||
|
systemControl = Global.ControlSystem.SystemControl as ISystemControl;
|
||||||
|
|
||||||
|
if (systemControl == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var controller = new DmpsRoutingController(key, name, systemControl);
|
||||||
|
|
||||||
|
controller.InputNames = properties.InputNames;
|
||||||
|
controller.OutputNames = properties.OutputNames;
|
||||||
|
|
||||||
|
return controller;
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (System.Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(0, "Error getting DMPS Controller:\r{0}", e);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="key"></param>
|
||||||
|
/// <param name="name"></param>
|
||||||
|
/// <param name="chassis"></param>
|
||||||
|
public DmpsRoutingController(string key, string name, ISystemControl systemControl)
|
||||||
|
: base(key, name)
|
||||||
|
{
|
||||||
|
Dmps = Global.ControlSystem;
|
||||||
|
SystemControl = systemControl;
|
||||||
|
|
||||||
|
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||||
|
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||||
|
VolumeControls = new Dictionary<uint, DmCardAudioOutputController>();
|
||||||
|
TxDictionary = new Dictionary<uint, string>();
|
||||||
|
RxDictionary = new Dictionary<uint, string>();
|
||||||
|
|
||||||
|
VideoOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||||
|
AudioOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||||
|
VideoInputSyncFeedbacks = new Dictionary<uint, BoolFeedback>();
|
||||||
|
InputNameFeedbacks = new Dictionary<uint, StringFeedback>();
|
||||||
|
OutputNameFeedbacks = new Dictionary<uint, StringFeedback>();
|
||||||
|
OutputVideoRouteNameFeedbacks = new Dictionary<uint, StringFeedback>();
|
||||||
|
OutputAudioRouteNameFeedbacks = new Dictionary<uint, StringFeedback>();
|
||||||
|
InputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
|
||||||
|
OutputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
|
||||||
|
|
||||||
|
Debug.Console(1, this, "{0} Switcher Inputs Present.", Dmps.SwitcherInputs.Count);
|
||||||
|
Debug.Console(1, this, "{0} Switcher Outputs Present.", Dmps.SwitcherOutputs.Count);
|
||||||
|
|
||||||
|
SetupOutputCards();
|
||||||
|
|
||||||
|
SetupInputCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CustomActivate()
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
// Set input and output names from config
|
||||||
|
if (InputNames != null)
|
||||||
|
foreach (var kvp in InputNames)
|
||||||
|
(Dmps.SwitcherInputs[kvp.Key] as DMInput).Name.StringValue = kvp.Value;
|
||||||
|
if (OutputNames != null)
|
||||||
|
foreach (var kvp in OutputNames)
|
||||||
|
(Dmps.SwitcherOutputs[kvp.Key] as Card.Dmps3OutputBase).Name.StringValue = kvp.Value;
|
||||||
|
|
||||||
|
// Subscribe to events
|
||||||
|
Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange);
|
||||||
|
Dmps.DMOutputChange += new DMOutputEventHandler(Dmps_DMOutputChange);
|
||||||
|
|
||||||
|
return base.CustomActivate();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Iterate the SwitcherOutputs collection to setup feedbacks and add routing ports
|
||||||
|
/// </summary>
|
||||||
|
void SetupOutputCards()
|
||||||
|
{
|
||||||
|
foreach (var card in Dmps.SwitcherOutputs)
|
||||||
|
{
|
||||||
|
|
||||||
|
var outputCard = card as DMOutput;
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Adding Output Card Number {0} Type: {1}", outputCard.Number, outputCard.CardInputOutputType.ToString());
|
||||||
|
|
||||||
|
if (outputCard != null)
|
||||||
|
{
|
||||||
|
VideoOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
|
||||||
|
{
|
||||||
|
if (outputCard.VideoOutFeedback != null) { return (ushort)outputCard.VideoOutFeedback.Number; }
|
||||||
|
else { return 0; };
|
||||||
|
});
|
||||||
|
AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() =>
|
||||||
|
{
|
||||||
|
if (outputCard.AudioOutFeedback != null) { return (ushort)outputCard.AudioOutFeedback.Number; }
|
||||||
|
else { return 0; };
|
||||||
|
});
|
||||||
|
|
||||||
|
OutputNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||||
|
{
|
||||||
|
if (outputCard.NameFeedback != null && !string.IsNullOrEmpty(outputCard.NameFeedback.StringValue))
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Output Card {0} Name: {1}", outputCard.Number, outputCard.NameFeedback.StringValue);
|
||||||
|
return outputCard.NameFeedback.StringValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
OutputVideoRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||||
|
{
|
||||||
|
if (outputCard.VideoOutFeedback != null && outputCard.VideoOutFeedback.NameFeedback != null)
|
||||||
|
{
|
||||||
|
return outputCard.VideoOutFeedback.NameFeedback.StringValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() =>
|
||||||
|
{
|
||||||
|
if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null)
|
||||||
|
{
|
||||||
|
return outputCard.AudioOutFeedback.NameFeedback.StringValue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
OutputEndpointOnlineFeedbacks[outputCard.Number] = new BoolFeedback(() => { return outputCard.EndpointOnlineFeedback; });
|
||||||
|
|
||||||
|
AddOutputCard(outputCard.Number, outputCard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Iterate the SwitcherInputs collection to setup feedbacks and add routing ports
|
||||||
|
/// </summary>
|
||||||
|
void SetupInputCards()
|
||||||
|
{
|
||||||
|
foreach (var card in Dmps.SwitcherInputs)
|
||||||
|
{
|
||||||
|
var inputCard = card as DMInput;
|
||||||
|
|
||||||
|
Debug.Console(1, this, "Adding Input Card Number {0} Type: {1}", inputCard.Number, inputCard.CardInputOutputType.ToString());
|
||||||
|
|
||||||
|
if (inputCard != null)
|
||||||
|
{
|
||||||
|
InputEndpointOnlineFeedbacks[inputCard.Number] = new BoolFeedback(() => { return inputCard.EndpointOnlineFeedback; });
|
||||||
|
|
||||||
|
if (inputCard.VideoDetectedFeedback != null)
|
||||||
|
{
|
||||||
|
VideoInputSyncFeedbacks[inputCard.Number] = new BoolFeedback(() =>
|
||||||
|
{
|
||||||
|
return inputCard.VideoDetectedFeedback.BoolValue;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
InputNameFeedbacks[inputCard.Number] = new StringFeedback(() =>
|
||||||
|
{
|
||||||
|
if (inputCard.NameFeedback != null && !string.IsNullOrEmpty(inputCard.NameFeedback.StringValue))
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Input Card {0} Name: {1}", inputCard.Number, inputCard.NameFeedback.StringValue);
|
||||||
|
return inputCard.NameFeedback.StringValue;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Input Card {0} Name is null", inputCard.Number, inputCard.NameFeedback.StringValue);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
AddInputCard(inputCard.Number, inputCard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds the appropriate ports aand callst the appropreate add port method
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number"></param>
|
||||||
|
/// <param name="inputCard"></param>
|
||||||
|
public void AddInputCard(uint number, DMInput inputCard)
|
||||||
|
{
|
||||||
|
if (inputCard is Card.Dmps3HdmiInputWithoutAnalogAudio)
|
||||||
|
{
|
||||||
|
var hdmiInputCard = inputCard as Card.Dmps3HdmiInput;
|
||||||
|
|
||||||
|
var cecPort = hdmiInputCard.HdmiInputPort;
|
||||||
|
|
||||||
|
AddInputPortWithDebug(number, string.Format("HdmiIn{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, cecPort);
|
||||||
|
}
|
||||||
|
else if (inputCard is Card.Dmps3HdmiInput)
|
||||||
|
{
|
||||||
|
var hdmiInputCard = inputCard as Card.Dmps3HdmiInput;
|
||||||
|
|
||||||
|
var cecPort = hdmiInputCard.HdmiInputPort;
|
||||||
|
|
||||||
|
AddInputPortWithDebug(number, string.Format("HdmiIn{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, cecPort);
|
||||||
|
AddInputPortWithDebug(number, string.Format("HudioIn{1}", number), eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio);
|
||||||
|
}
|
||||||
|
else if (inputCard is Card.Dmps3HdmiVgaInput)
|
||||||
|
{
|
||||||
|
// TODO: Build a virtual TX device and assign the ports to it
|
||||||
|
|
||||||
|
var hdmiVgaInputCard = inputCard as Card.Dmps3HdmiVgaInput;
|
||||||
|
|
||||||
|
DmpsInternalVirtualHdmiVgaInputController inputCardController = new DmpsInternalVirtualHdmiVgaInputController(Key +
|
||||||
|
string.Format("-HdmiVgaIn{0}", number), string.Format("InternalInputController-{0}", number), hdmiVgaInputCard);
|
||||||
|
|
||||||
|
DeviceManager.AddDevice(inputCardController);
|
||||||
|
|
||||||
|
AddInputPortWithDebug(number, string.Format("HdmiVgaIn{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.BackplaneOnly);
|
||||||
|
}
|
||||||
|
else if (inputCard is Card.Dmps3HdmiVgaBncInput)
|
||||||
|
{
|
||||||
|
// TODO: Build a virtual TX device and assign the ports to it
|
||||||
|
|
||||||
|
var hdmiVgaBncInputCard = inputCard as Card.Dmps3HdmiVgaBncInput;
|
||||||
|
|
||||||
|
DmpsInternalVirtualHdmiVgaBncInputController inputCardController = new DmpsInternalVirtualHdmiVgaBncInputController(Key +
|
||||||
|
string.Format("-HdmiVgaBncIn{0}", number), string.Format("InternalInputController-{0}", number), hdmiVgaBncInputCard);
|
||||||
|
|
||||||
|
DeviceManager.AddDevice(inputCardController);
|
||||||
|
|
||||||
|
AddInputPortWithDebug(number, string.Format("HdmiVgaBncIn{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.BackplaneOnly);
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (inputCard is Card.Dmps3DmInput)
|
||||||
|
{
|
||||||
|
var hdmiInputCard = inputCard as Card.Dmps3DmInput;
|
||||||
|
|
||||||
|
var cecPort = hdmiInputCard.DmInputPort;
|
||||||
|
|
||||||
|
AddInputPortWithDebug(number, string.Format("DmIn{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, cecPort);
|
||||||
|
}
|
||||||
|
else if (inputCard is Card.Dmps3AirMediaInput)
|
||||||
|
{
|
||||||
|
var airMediaInputCard = inputCard as Card.Dmps3AirMediaInput;
|
||||||
|
|
||||||
|
AddInputPortWithDebug(number, string.Format("AirMediaIn{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Streaming);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds InputPort
|
||||||
|
/// </summary>
|
||||||
|
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType)
|
||||||
|
{
|
||||||
|
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
|
||||||
|
Debug.Console(2, this, "Adding input port '{0}'", portKey);
|
||||||
|
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
|
||||||
|
|
||||||
|
InputPorts.Add(inputPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds InputPort and sets Port as ICec object
|
||||||
|
/// </summary>
|
||||||
|
void AddInputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, ICec cecPort)
|
||||||
|
{
|
||||||
|
var portKey = string.Format("inputCard{0}--{1}", cardNum, portName);
|
||||||
|
Debug.Console(2, this, "Adding input port '{0}'", portKey);
|
||||||
|
var inputPort = new RoutingInputPort(portKey, sigType, portType, cardNum, this);
|
||||||
|
|
||||||
|
if (cecPort != null)
|
||||||
|
inputPort.Port = cecPort;
|
||||||
|
|
||||||
|
InputPorts.Add(inputPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Builds the appropriate ports and calls the appropriate add port method
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number"></param>
|
||||||
|
/// <param name="outputCard"></param>
|
||||||
|
public void AddOutputCard(uint number, DMOutput outputCard)
|
||||||
|
{
|
||||||
|
if (outputCard is Card.Dmps3HdmiOutput)
|
||||||
|
{
|
||||||
|
var hdmiOutputCard = outputCard as Card.Dmps3HdmiOutput;
|
||||||
|
|
||||||
|
var cecPort = hdmiOutputCard.HdmiOutputPort;
|
||||||
|
|
||||||
|
AddHdmiOutputPort(number, cecPort);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3DmOutput)
|
||||||
|
{
|
||||||
|
var dmOutputCard = outputCard as Card.Dmps3DmOutput;
|
||||||
|
|
||||||
|
var cecPort = dmOutputCard.DmOutputPort;
|
||||||
|
|
||||||
|
AddDmOutputPort(number);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3ProgramOutput)
|
||||||
|
{
|
||||||
|
AddAudioOnlyOutputPort(number, "Program");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3AuxOutput)
|
||||||
|
{
|
||||||
|
if(outputCard.CardInputOutputType == eCardInputOutputType.Dmps3Aux1Output)
|
||||||
|
AddAudioOnlyOutputPort(number, "Aux1");
|
||||||
|
else if(outputCard.CardInputOutputType == eCardInputOutputType.Dmps3Aux2Output)
|
||||||
|
AddAudioOnlyOutputPort(number, "Aux2");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3CodecOutput)
|
||||||
|
{
|
||||||
|
if (number == (uint)CrestronControlSystem.eDmps300cOutputs.Codec1
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps3200cOutputs.Codec1
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec1
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K250COutputs.Codec1
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Codec1)
|
||||||
|
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec1.ToString());
|
||||||
|
else if (number == (uint)CrestronControlSystem.eDmps300cOutputs.Codec2
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps3200cOutputs.Codec2
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps3300cAecOutputs.Codec2
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K250COutputs.Codec2
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Codec2)
|
||||||
|
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps300cOutputs.Codec2.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3DialerOutput)
|
||||||
|
{
|
||||||
|
AddAudioOnlyOutputPort(number, "Dialer");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3DigitalMixOutput)
|
||||||
|
{
|
||||||
|
if (number == (uint)CrestronControlSystem.eDmps34K250COutputs.Mix1
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K300COutputs.Mix1
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Mix1)
|
||||||
|
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix1.ToString());
|
||||||
|
if (number == (uint)CrestronControlSystem.eDmps34K250COutputs.Mix2
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K300COutputs.Mix2
|
||||||
|
|| number == (uint)CrestronControlSystem.eDmps34K350COutputs.Mix2)
|
||||||
|
AddAudioOnlyOutputPort(number, CrestronControlSystem.eDmps34K250COutputs.Mix2.ToString());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (outputCard is Card.Dmps3AecOutput)
|
||||||
|
{
|
||||||
|
AddAudioOnlyOutputPort(number, "Aec");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Output Card is of a type not currently handled:", outputCard.CardInputOutputType.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an Audio only output port
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number"></param>
|
||||||
|
void AddAudioOnlyOutputPort(uint number, string portName)
|
||||||
|
{
|
||||||
|
AddOutputPortWithDebug(number, portName, eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds an HDMI output port
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number"></param>
|
||||||
|
/// <param name="cecPort"></param>
|
||||||
|
void AddHdmiOutputPort(uint number, ICec cecPort)
|
||||||
|
{
|
||||||
|
AddOutputPortWithDebug(number, string.Format("hdmiOut{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, number, cecPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds a DM output port
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="number"></param>
|
||||||
|
void AddDmOutputPort(uint number)
|
||||||
|
{
|
||||||
|
AddOutputPortWithDebug(number, string.Format("dmOut{0}", number), eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds OutputPort
|
||||||
|
/// </summary>
|
||||||
|
void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
|
||||||
|
{
|
||||||
|
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||||
|
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||||
|
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Adds OutputPort and sets Port as ICec object
|
||||||
|
/// </summary>
|
||||||
|
void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort)
|
||||||
|
{
|
||||||
|
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||||
|
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||||
|
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||||
|
|
||||||
|
if (cecPort != null)
|
||||||
|
outputPort.Port = cecPort;
|
||||||
|
|
||||||
|
OutputPorts.Add(outputPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void AddVolumeControl(uint number, Audio.Output audio)
|
||||||
|
{
|
||||||
|
VolumeControls.Add(number, new DmCardAudioOutputController(audio));
|
||||||
|
}
|
||||||
|
|
||||||
|
void Dmps_DMInputChange(Switch device, DMInputEventArgs args)
|
||||||
|
{
|
||||||
|
//Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString());
|
||||||
|
|
||||||
|
switch (args.EventId)
|
||||||
|
{
|
||||||
|
case (DMInputEventIds.OnlineFeedbackEventId):
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
|
||||||
|
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (DMInputEventIds.VideoDetectedEventId):
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
|
||||||
|
VideoInputSyncFeedbacks[args.Number].FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case (DMInputEventIds.InputNameEventId):
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
|
||||||
|
InputNameFeedbacks[args.Number].FireUpdate();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
|
||||||
|
|
||||||
|
var output = args.Number;
|
||||||
|
|
||||||
|
DMOutput outputCard = Dmps.SwitcherOutputs[output] as DMOutput;
|
||||||
|
|
||||||
|
if (args.EventId == DMOutputEventIds.VolumeEventId &&
|
||||||
|
VolumeControls.ContainsKey(output))
|
||||||
|
{
|
||||||
|
VolumeControls[args.Number].VolumeEventFromChassis();
|
||||||
|
}
|
||||||
|
else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId
|
||||||
|
&& OutputEndpointOnlineFeedbacks.ContainsKey(output))
|
||||||
|
{
|
||||||
|
OutputEndpointOnlineFeedbacks[output].FireUpdate();
|
||||||
|
}
|
||||||
|
else if (args.EventId == DMOutputEventIds.VideoOutEventId)
|
||||||
|
{
|
||||||
|
if (outputCard != null && outputCard.VideoOutFeedback != null)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.VideoOutFeedback.Number, output);
|
||||||
|
}
|
||||||
|
if (VideoOutputFeedbacks.ContainsKey(output))
|
||||||
|
{
|
||||||
|
VideoOutputFeedbacks[output].FireUpdate();
|
||||||
|
}
|
||||||
|
if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
|
||||||
|
{
|
||||||
|
OutputVideoRouteNameFeedbacks[output].FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.EventId == DMOutputEventIds.AudioOutEventId)
|
||||||
|
{
|
||||||
|
if (outputCard != null && outputCard.AudioOutFeedback != null)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, outputCard.AudioOutFeedback.Number, output);
|
||||||
|
}
|
||||||
|
if (AudioOutputFeedbacks.ContainsKey(output))
|
||||||
|
{
|
||||||
|
AudioOutputFeedbacks[output].FireUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (args.EventId == DMOutputEventIds.OutputNameEventId
|
||||||
|
&& OutputNameFeedbacks.ContainsKey(output))
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
|
||||||
|
OutputNameFeedbacks[output].FireUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="pnt"></param>
|
||||||
|
void StartOffTimer(PortNumberType pnt)
|
||||||
|
{
|
||||||
|
if (RouteOffTimers.ContainsKey(pnt))
|
||||||
|
return;
|
||||||
|
RouteOffTimers[pnt] = new CTimer(o =>
|
||||||
|
{
|
||||||
|
ExecuteSwitch(0, pnt.Number, pnt.Type);
|
||||||
|
}, RouteOffTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
#region IRouting Members
|
||||||
|
|
||||||
|
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType sigType)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType);
|
||||||
|
|
||||||
|
var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail
|
||||||
|
var output = Convert.ToUInt32(outputSelector);
|
||||||
|
|
||||||
|
if (input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs)
|
||||||
|
{
|
||||||
|
// Check to see if there's an off timer waiting on this and if so, cancel
|
||||||
|
var key = new PortNumberType(output, sigType);
|
||||||
|
if (input == 0)
|
||||||
|
{
|
||||||
|
StartOffTimer(key);
|
||||||
|
}
|
||||||
|
else if (key.Number > 0)
|
||||||
|
{
|
||||||
|
if (RouteOffTimers.ContainsKey(key))
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "{0} cancelling route off due to new source", output);
|
||||||
|
RouteOffTimers[key].Stop();
|
||||||
|
RouteOffTimers.Remove(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
|
||||||
|
|
||||||
|
|
||||||
|
if (inCard != null)
|
||||||
|
{
|
||||||
|
// NOTE THAT THESE ARE NOTS - TO CATCH THE AudioVideo TYPE
|
||||||
|
if (sigType != eRoutingSignalType.Audio)
|
||||||
|
{
|
||||||
|
var outputCard = Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase;
|
||||||
|
|
||||||
|
//SystemControl.VideoEnter.BoolValue = true;
|
||||||
|
if (outputCard != null && outputCard.VideoOut != null)
|
||||||
|
outputCard.VideoOut = inCard;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sigType != eRoutingSignalType.Video)
|
||||||
|
{
|
||||||
|
var outputCard = Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase;
|
||||||
|
if (outputCard != null && outputCard.AudioOut != null)
|
||||||
|
outputCard.AudioOut = inCard;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector, outputSelector);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Error executing switch: {0}", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Crestron.SimplSharpPro.DM;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using Newtonsoft.Json.Converters;
|
||||||
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
|
using PepperDash.Essentials.DM.Cards;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.DM.Config
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the "properties" property of a DM device config
|
||||||
|
/// </summary>
|
||||||
|
public class DmpsRoutingPropertiesConfig
|
||||||
|
{
|
||||||
|
[JsonProperty("inputNames")]
|
||||||
|
public Dictionary<uint, string> InputNames { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("outputNames")]
|
||||||
|
public Dictionary<uint, string> OutputNames { get; set; }
|
||||||
|
|
||||||
|
public DmpsRoutingPropertiesConfig()
|
||||||
|
{
|
||||||
|
InputNames = new Dictionary<uint, string>();
|
||||||
|
OutputNames = new Dictionary<uint, string>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,10 +14,12 @@ namespace PepperDash.Essentials.DM
|
|||||||
public const string AirBoardIn = "AirBoardIn";
|
public const string AirBoardIn = "AirBoardIn";
|
||||||
public const string AirMediaIn = "AirMediaIn";
|
public const string AirMediaIn = "AirMediaIn";
|
||||||
public const string AnyVideoIn = "AnyVideoIn";
|
public const string AnyVideoIn = "AnyVideoIn";
|
||||||
|
public const string AudioIn = "AudioIn";
|
||||||
public const string AudioLoopOut = "AudioLoopOut";
|
public const string AudioLoopOut = "AudioLoopOut";
|
||||||
public const string BalancedAudioOut = "BalancedAudioOut";
|
public const string BalancedAudioOut = "BalancedAudioOut";
|
||||||
public const string BalancedAudioOut1 = "BalancedAudioOut1";
|
public const string BalancedAudioOut1 = "BalancedAudioOut1";
|
||||||
public const string BalancedAudioOut2 = "BalancedAudioOut2";
|
public const string BalancedAudioOut2 = "BalancedAudioOut2";
|
||||||
|
public const string BncIn = "BncIn";
|
||||||
public const string CompositeIn = "CompositeIn";
|
public const string CompositeIn = "CompositeIn";
|
||||||
public const string DisplayPortIn = "DisplayPortIn";
|
public const string DisplayPortIn = "DisplayPortIn";
|
||||||
public const string DmIn = "DmIn";
|
public const string DmIn = "DmIn";
|
||||||
@@ -32,6 +34,7 @@ namespace PepperDash.Essentials.DM
|
|||||||
public const string HdmiLoopOut = "HdmiLoopOut";
|
public const string HdmiLoopOut = "HdmiLoopOut";
|
||||||
public const string HdmiOut = "HdmiOut";
|
public const string HdmiOut = "HdmiOut";
|
||||||
public const string Osd = "Osd";
|
public const string Osd = "Osd";
|
||||||
|
public const string SpdifIn = "SpdifIn";
|
||||||
public const string VgaIn = "VgaIn";
|
public const string VgaIn = "VgaIn";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -168,11 +168,9 @@ namespace PepperDash.Essentials.DM
|
|||||||
&& tx.CvbsInput.SyncDetectedFeedback.BoolValue)
|
&& tx.CvbsInput.SyncDetectedFeedback.BoolValue)
|
||||||
};
|
};
|
||||||
|
|
||||||
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
|
|
||||||
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
|
|
||||||
|
|
||||||
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
|
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
|
||||||
eRoutingPortConnectionType.DmCat, null, this);
|
eRoutingPortConnectionType.DmCat, null, this);
|
||||||
|
|
||||||
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
|
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
|
||||||
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
|
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
|
||||||
|
|||||||
@@ -97,7 +97,10 @@
|
|||||||
<Compile Include="Cards REMOVE\DmInputCardBase.cs" />
|
<Compile Include="Cards REMOVE\DmInputCardBase.cs" />
|
||||||
<Compile Include="Chassis\DmCardAudioOutput.cs" />
|
<Compile Include="Chassis\DmCardAudioOutput.cs" />
|
||||||
<Compile Include="Chassis\DmChassisController.cs" />
|
<Compile Include="Chassis\DmChassisController.cs" />
|
||||||
|
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
|
||||||
|
<Compile Include="Chassis\DmpsRoutingController.cs" />
|
||||||
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
|
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
|
||||||
|
<Compile Include="Config\DmpsRoutingConfig.cs" />
|
||||||
<Compile Include="Config\DmRmcConfig.cs" />
|
<Compile Include="Config\DmRmcConfig.cs" />
|
||||||
<Compile Include="Config\DmTxConfig.cs" />
|
<Compile Include="Config\DmTxConfig.cs" />
|
||||||
<Compile Include="Config\DMChassisConfig.cs" />
|
<Compile Include="Config\DMChassisConfig.cs" />
|
||||||
|
|||||||
@@ -48,6 +48,26 @@ namespace PepperDash.Essentials.DM
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static VideoStatusFuncsWrapper GetVgaInputStatusFuncs(VgaDviInputPort port)
|
||||||
|
{
|
||||||
|
return new VideoStatusFuncsWrapper
|
||||||
|
{
|
||||||
|
HdcpActiveFeedbackFunc = () => port.VideoAttributes.HdcpActiveFeedback.BoolValue,
|
||||||
|
HdcpStateFeedbackFunc = () => port.VideoAttributes.HdcpStateFeedback.ToString(),
|
||||||
|
VideoResolutionFeedbackFunc = () => port.VideoAttributes.GetVideoResolutionString(),
|
||||||
|
VideoSyncFeedbackFunc = () => port.SyncDetectedFeedback.BoolValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static VideoStatusFuncsWrapper GetBncInputStatusFuncs(Component port)
|
||||||
|
{
|
||||||
|
return new VideoStatusFuncsWrapper
|
||||||
|
{
|
||||||
|
VideoResolutionFeedbackFunc = () => port.VideoAttributes.GetVideoResolutionString(),
|
||||||
|
VideoSyncFeedbackFunc = () => port.VideoDetectedFeedback.BoolValue
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public static VideoStatusFuncsWrapper GetDmInputStatusFuncs(DMInputPort port)
|
public static VideoStatusFuncsWrapper GetDmInputStatusFuncs(DMInputPort port)
|
||||||
{
|
{
|
||||||
return new VideoStatusFuncsWrapper
|
return new VideoStatusFuncsWrapper
|
||||||
|
|||||||
Reference in New Issue
Block a user