Compare commits

...

30 Commits

Author SHA1 Message Date
Neil Dorin
47e47ec272 Merged in bugfix/ecs-1138a (pull request #27)
Minor correction to EventId
2019-08-14 20:13:32 +00:00
Neil Dorin
c392ac6b06 Minor correction to EventId 2019-08-14 14:13:00 -06:00
Neil Dorin
af2fe7e54e Merged in bugfix/ecs-1138a (pull request #26)
Fixed EventIds for EndpointOnlineFeedback in DMInput/Output change handlers

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-14 20:11:27 +00:00
Neil Dorin
3f68a84fe8 Fixed EventIds for EndpointOnlineFeedback in DMInput/Output change handlers 2019-08-14 14:09:11 -06:00
Neil Dorin
b1459da2ba Merged in maintenance/ecs-1138 (pull request #25)
Fixes issue with missing DmpsAudioController.cs file

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-01 20:03:48 +00:00
Neil Dorin
82e2f1e959 Fixes issue with missing DmpsAudioController.cs file 2019-08-01 14:03:01 -06:00
Neil Dorin
c329e31802 Merged in bugfix/ecs-1138 (pull request #24)
Attemtping to debug issue with EndpointOnlineFeedback on output cards

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-08-01 19:52:27 +00:00
Neil Dorin
b917ff980a Attemtping to debug issue with EndpointOnlineFeedback on output cards 2019-07-31 15:31:40 -06:00
Neil Dorin
c3c9c584ae Merged in feature/ecs-1125 (pull request #23)
Feature/ecs 1125

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-30 20:24:25 +00:00
Neil Dorin
b6f6c72c92 Merge remote-tracking branch 'origin/development' into feature/ecs-1125
# Conflicts:
#	PepperDashEssentials/Bridges/DmChassisControllerBridge.cs
2019-07-30 14:24:02 -06:00
Neil Dorin
59b2995a1b Fixes exceptions in Eisc_SigChange by checking uo for null first. Then fixes issue where if output card is Card.Dmps3CodecOutput the NameFeedback property throws a null ref exception, even if you first check it for null. 2019-07-30 14:19:01 -06:00
Neil Dorin
bdf3e2054f Efforts to debug exceptions thrown on bridge string sigs 101-108 and 301-308 2019-07-29 16:32:39 -06:00
Neil Dorin
1acb3a20c5 Routing tested and working with EfS bridge 2019-07-26 16:53:52 -06:00
Neil Dorin
2c98fc4545 Merged in bugfix/ecs-1134 (pull request #22)
Switches to using input/output enpoint online feedback collections on chassis rather than IsOnline feedback from individual endpoints.

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-25 16:13:35 +00:00
Neil Dorin
05c9dd3c69 Switches to using input/output enpoint online feedback collections on chassis rather than IsOnline feedback from individual endpoints. 2019-07-25 10:01:04 -06:00
Neil Dorin
5de8b703dd Adds attemps to hanlde output card types. 2019-07-25 09:54:06 -06:00
Neil Dorin
a3887510df Additional progress after initial testing. Having issues iterating CrestronControlSystem.SwitcherInputs/Outputs collections. 2019-07-24 22:44:39 -06:00
Neil Dorin
dc8d0e25d5 Adds Virtual Dm Tx Controller classes to handle Dmps inputs with mutliple connectors and auto switching. Completes DmpsRoutingController (requires testing) 2019-07-22 17:04:41 -06:00
Neil Dorin
028e411ffe Started DmpsRoutingController 2019-07-18 16:46:01 -06:00
Neil Dorin
5aed3c4480 Merged in bugfix/ecs-1131 (pull request #21)
Bugfix/ecs 1131

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-18 20:16:48 +00:00
Neil Dorin
ddfd1d0586 Corrected case of dmTx to dmtx on dmtx200 2019-07-18 14:13:43 -06:00
Neil Dorin
77d5438063 Updates to script file 2019-07-12 11:37:16 -06:00
Neil Dorin
42a79f0e1e Merged in testing/jenkinsCI-1 (pull request #20)
Testing/jenkinsCI-1

Approved-by: Neil Dorin <ndorin@pepperdash.com>
2019-07-11 23:34:17 +00:00
Neil Dorin
f8a6ef8c41 Updated readme 2019-07-11 17:13:11 -06:00
Neil Dorin
af1489d511 reset revision number for assembly version to allow CI process to set it. 2019-07-11 16:35:36 -06:00
Neil Dorin
aa2b5b9ab4 Fixes double quotes in script 2019-07-11 12:26:56 -06:00
Neil Dorin
fd2fe8fa6e Comments out set-ExecutionPolicy RemoteSigned from script 2019-07-11 12:22:42 -06:00
Neil Dorin
15c6da43eb Adds PowerShell Script for updating assembly version number 2019-07-11 12:04:37 -06:00
Neil Dorin
6725266ad9 Set SGD files to copy to output directory 2019-07-10 12:01:11 -06:00
Neil Dorin
8f564a82d4 copies Crestron.SimplSharpPro.UI hint path from Essentials Core.csproj which works 2019-07-10 11:55:23 -06:00
18 changed files with 1536 additions and 157 deletions

View File

@@ -102,7 +102,11 @@ namespace PepperDash.Essentials.Bridges
(device as DmChassisController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmpsRoutingController)
{
(device as DmpsRoutingController).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
continue;
}
else if (device is DmTxControllerBase)
{
(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);
continue;
}
}
else if (device is IBridge)
{
(device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
@@ -217,16 +221,26 @@ namespace PepperDash.Essentials.Bridges
/// <param name="args"></param>
void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(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);
try
{
if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject;
if (uo != null)
{
Debug.Console(1, this, "Executing Action: {0}", uo.ToString());
if (uo is Action<bool>)
(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);
}
}
}

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
@@ -27,7 +28,7 @@ namespace PepperDash.Essentials.Bridges
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
// 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;
@@ -39,7 +40,16 @@ namespace PepperDash.Essentials.Bridges
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var TxKey = dmChassis.TxDictionary[ioSlot];
var TxDevice = DeviceManager.GetDeviceForKey(TxKey) as DmTxControllerBase;
TxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]);
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|| 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 if (TxDevice != null)
{
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]);
@@ -54,7 +64,16 @@ namespace PepperDash.Essentials.Bridges
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
var RxKey = dmChassis.RxDictionary[ioSlot];
var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase;
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
if (dmChassis.Chassis is DmMd8x8Cpu3 || dmChassis.Chassis is DmMd8x8Cpu3rps
|| dmChassis.Chassis is DmMd16x16Cpu3 || dmChassis.Chassis is DmMd16x16Cpu3rps
|| dmChassis.Chassis is DmMd32x32Cpu3 || dmChassis.Chassis is DmMd32x32Cpu3rps)
{
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
else if (RxDevice != null)
{
RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
}
}
// Feedback
dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]);
@@ -66,8 +85,6 @@ namespace PepperDash.Essentials.Bridges
dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]);
dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + 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]);
}
}

View 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;
}
}
}
}

View File

@@ -356,8 +356,22 @@ namespace PepperDash.Essentials
public void LoadDevices()
{
// Build the processor wrapper class
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
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
@@ -373,7 +387,7 @@ namespace PepperDash.Essentials
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
Debug.Console(0,
"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;
}

View File

@@ -121,6 +121,7 @@
<Compile Include="Bridges\BridgeFactory.cs" />
<Compile Include="Bridges\CameraControllerBridge.cs" />
<Compile Include="Bridges\AirMediaControllerBridge.cs" />
<Compile Include="Bridges\DmpsRoutingControllerBridge.cs" />
<Compile Include="Bridges\DisplayControllerBridge.cs" />
<Compile Include="Bridges\DigitalLoggerBridge.cs" />
<Compile Include="Bridges\DmChassisControllerBridge.cs" />
@@ -231,9 +232,15 @@
<Compile Include="UI\SubpageReferenceListSourceItem.cs" />
<None Include="app.config" />
<None Include="Properties\ControlSystem.cfg" />
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd" />
<EmbeddedResource Include="SGD\PepperDash Essentials iPad.sgd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-560.sgd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="SGD\PepperDash Essentials TSW-760.sgd">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\essentials-framework\Essentials Core\PepperDashEssentialsBase\PepperDash_Essentials_Core.csproj">

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
[assembly: AssemblyVersion("1.4.12.*")]
[assembly: AssemblyVersion("1.4.0.*")]

View File

@@ -0,0 +1,35 @@
function Update-SourceVersion
{
Param ([string]$Version)
$NewVersion = AssemblyVersion(" + $Version + .*");
foreach ($o in $input)
{
Write-output $o.FullName
$TmpFile = $o.FullName + .tmp
get-content $o.FullName |
%{$_ -replace AssemblyVersion\("(\d+\.\d+\.\d+)\.\*"\), $NewVersion } > $TmpFile
move-item $TmpFile $o.FullName -force
}
}
function Update-AllAssemblyInfoFiles ( $version )
{
foreach ($file in AssemblyInfo.cs, AssemblyInfo.vb )
{
get-childitem -recurse |? {$_.Name -eq $file} | Update-SourceVersion $version ;
}
}
# validate arguments
$r= [System.Text.RegularExpressions.Regex]::Match($args[0], "^\d+\.\d+\.\d+$");
if ($r.Success)
{
Update-AllAssemblyInfoFiles $args[0];
}
else
{
echo ;
echo Error: Input version does not match x.y.z format!
echo ;
echo "Unable to apply version to AssemblyInfo.cs files";
}

View File

@@ -1,16 +1,13 @@
# Pepperdash Essentials
## RELEASE PROCESS CONTROLLED BY JENKINS CI PROCESS
#### How to merge
## Essentials Framework
- If any external references have changed (like PepperDash.Core), make not of them in the commit in Framework
- Make changes
- Build
- Test on your system
- Commit and push to framework
- Commit and push to essentials
- Curse a whole lot when you try to figure out how to then get developments all synced up

View File

@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
{
Audio = 1,
Video = 2,
AudioVideo = 3
AudioVideo = 4
}
public enum eRoutingPortConnectionType

View File

@@ -21,8 +21,8 @@ namespace PepperDash.Essentials.DM
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
///
/// </summary>
public class DmChassisController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback//, ICardPortsDevice
{
public class DmChassisController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback
{
public DmMDMnxn Chassis { get; private set; }
// Feedbacks for EssentialDM
@@ -117,82 +117,6 @@ namespace PepperDash.Essentials.DM
controller.InputNames = properties.InputNames;
controller.OutputNames = properties.OutputNames;
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)
{
@@ -218,7 +142,6 @@ namespace PepperDash.Essentials.DM
TxDictionary = new Dictionary<uint, string>();
RxDictionary = new Dictionary<uint, string>();
IsOnline.OutputChange += new EventHandler<FeedbackEventArgs>(IsOnline_OutputChange);
//IsOnline.OutputChange += new EventHandler<EventArgs>(this.IsOnline_OutputChange);
Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
//Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange);
Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
@@ -249,7 +172,7 @@ namespace PepperDash.Essentials.DM
return Chassis.Inputs[tempX].VideoDetectedFeedback.BoolValue;
});
InputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Inputs[tempX].NameFeedback.StringValue != null)
if (Chassis.Inputs[tempX].NameFeedback != null)
{
return Chassis.Inputs[tempX].NameFeedback.StringValue;
}
@@ -259,7 +182,7 @@ namespace PepperDash.Essentials.DM
}
});
OutputNameFeedbacks[tempX] = new StringFeedback(() => {
if (Chassis.Outputs[tempX].NameFeedback.StringValue != null)
if (Chassis.Outputs[tempX].NameFeedback != null)
{
return Chassis.Outputs[tempX].NameFeedback.StringValue;
}
@@ -291,6 +214,7 @@ namespace PepperDash.Essentials.DM
}
});
InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; });
OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Outputs[tempX].EndpointOnlineFeedback; });
@@ -650,21 +574,32 @@ namespace PepperDash.Essentials.DM
//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, "DMINput OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break;
case DMInputEventIds.EndpointOnlineEventId: {
Debug.Console(2, this, "DMINput EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
break;
}
case (DMInputEventIds.VideoDetectedEventId): {
case DMInputEventIds.OnlineFeedbackEventId:
{
Debug.Console(2, this, "DMINput 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): {
case DMInputEventIds.InputNameEventId: {
Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
InputNameFeedbacks[args.Number].FireUpdate();
break;
}
default:
{
Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);
break;
}
}
}
///
@@ -674,46 +609,69 @@ namespace PepperDash.Essentials.DM
//This should be a switch case JTA 2018-07-02
var output = args.Number;
if (args.EventId == DMOutputEventIds.VolumeEventId &&
VolumeControls.ContainsKey(output))
{
VolumeControls[args.Number].VolumeEventFromChassis();
}
else if (args.EventId == DMOutputEventIds.OnlineFeedbackEventId)
{
OutputEndpointOnlineFeedbacks[output].FireUpdate();
}
else if (args.EventId == DMOutputEventIds.VideoOutEventId)
{
if (Chassis.Outputs[output].VideoOutFeedback != null)
{
Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output);
}
if (VideoOutputFeedbacks.ContainsKey(output))
{
VideoOutputFeedbacks[output].FireUpdate();
}
if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
{
OutputVideoRouteNameFeedbacks[output].FireUpdate();
}
}
else if (args.EventId == DMOutputEventIds.AudioOutEventId)
switch (args.EventId)
{
if (Chassis.Outputs[output].AudioOutFeedback != null)
case DMOutputEventIds.VolumeEventId:
{
if (VolumeControls.ContainsKey(output))
{
VolumeControls[args.Number].VolumeEventFromChassis();
}
break;
}
case DMOutputEventIds.EndpointOnlineEventId:
{
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].AudioOutFeedback.Number, output);
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
OutputEndpointOnlineFeedbacks[output].FireUpdate();
break;
}
if (AudioOutputFeedbacks.ContainsKey(output))
case DMOutputEventIds.OnlineFeedbackEventId:
{
AudioOutputFeedbacks[output].FireUpdate();
Debug.Console(2, this, "Output {0} DMInputEventIds.OnlineFeedbackEventId fired. State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
OutputEndpointOnlineFeedbacks[output].FireUpdate();
break;
}
case DMOutputEventIds.VideoOutEventId:
{
if (Chassis.Outputs[output].VideoOutFeedback != null)
{
Debug.Console(2, this, "DMSwitchVideo:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].VideoOutFeedback.Number, output);
}
if (VideoOutputFeedbacks.ContainsKey(output))
{
VideoOutputFeedbacks[output].FireUpdate();
}
if (OutputVideoRouteNameFeedbacks.ContainsKey(output))
{
OutputVideoRouteNameFeedbacks[output].FireUpdate();
}
break;
}
case DMOutputEventIds.AudioOutEventId:
{
if (Chassis.Outputs[output].AudioOutFeedback != null)
{
Debug.Console(2, this, "DMSwitchAudio:{0} Routed Input:{1} Output:{2}'", this.Name, Chassis.Outputs[output].AudioOutFeedback.Number, output);
}
if (AudioOutputFeedbacks.ContainsKey(output))
{
AudioOutputFeedbacks[output].FireUpdate();
}
break;
}
case DMOutputEventIds.OutputNameEventId:
{
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
OutputNameFeedbacks[output].FireUpdate();
break;
}
default:
{
Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
break;
}
}
else if (args.EventId == DMOutputEventIds.OutputNameEventId)
{
Debug.Console(2, this, "DM Output {0} NameFeedbackEventId", output);
OutputNameFeedbacks[output].FireUpdate();
}
}

View File

@@ -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;
}
}
}
}
}

View File

@@ -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
}
}

View File

@@ -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>();
}
}
}

View File

@@ -14,10 +14,12 @@ namespace PepperDash.Essentials.DM
public const string AirBoardIn = "AirBoardIn";
public const string AirMediaIn = "AirMediaIn";
public const string AnyVideoIn = "AnyVideoIn";
public const string AudioIn = "AudioIn";
public const string AudioLoopOut = "AudioLoopOut";
public const string BalancedAudioOut = "BalancedAudioOut";
public const string BalancedAudioOut1 = "BalancedAudioOut1";
public const string BalancedAudioOut2 = "BalancedAudioOut2";
public const string BncIn = "BncIn";
public const string CompositeIn = "CompositeIn";
public const string DisplayPortIn = "DisplayPortIn";
public const string DmIn = "DmIn";
@@ -32,6 +34,7 @@ namespace PepperDash.Essentials.DM
public const string HdmiLoopOut = "HdmiLoopOut";
public const string HdmiOut = "HdmiOut";
public const string Osd = "Osd";
public const string SpdifIn = "SpdifIn";
public const string VgaIn = "VgaIn";
}
}

View File

@@ -168,11 +168,9 @@ namespace PepperDash.Essentials.DM
&& tx.CvbsInput.SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, null, this);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,

View File

@@ -37,7 +37,7 @@ namespace PepperDash.Essentials.DM
// Catch constructor failures, mainly dues to IPID
try
{
if(typeName.StartsWith("dmTx200"))
if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem));
@@ -93,7 +93,7 @@ namespace PepperDash.Essentials.DM
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps)
{
if (typeName.StartsWith("dmTx200"))
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num]));
@@ -112,7 +112,7 @@ namespace PepperDash.Essentials.DM
}
else
{
if (typeName.StartsWith("dmTx200"))
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));

View File

@@ -56,7 +56,7 @@
</Reference>
<Reference Include="Crestron.SimplSharpPro.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll</HintPath>
</Reference>
<Reference Include="mscorlib" />
<Reference Include="PepperDash_Core, Version=1.0.4.20530, Culture=neutral, processorArchitecture=MSIL">
@@ -97,7 +97,10 @@
<Compile Include="Cards REMOVE\DmInputCardBase.cs" />
<Compile Include="Chassis\DmCardAudioOutput.cs" />
<Compile Include="Chassis\DmChassisController.cs" />
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
<Compile Include="Chassis\DmpsRoutingController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Config\DmpsRoutingConfig.cs" />
<Compile Include="Config\DmRmcConfig.cs" />
<Compile Include="Config\DmTxConfig.cs" />
<Compile Include="Config\DMChassisConfig.cs" />

View File

@@ -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)
{
return new VideoStatusFuncsWrapper