Compare commits

..

20 Commits

Author SHA1 Message Date
Neil Dorin
5ef7882955 Updates drawing to have correct decision labels 2020-07-28 22:58:00 -06:00
Neil Dorin
3992aba843 Adds updated plugin load sequence drawing 2020-07-27 23:38:31 -06:00
Andrew Welker
b689a54936 Merge pull request #253 from PepperDash/hotfix/eiscApiAdvanced-backwards-compatibility
Add backwards compatability with `IBridge` to `EiscApiAdvanced`
2020-06-12 13:43:05 -06:00
Andrew Welker
1046672386 Merge branch 'master' into hotfix/eiscApiAdvanced-backwards-compatibility 2020-06-12 13:16:20 -06:00
Andrew Welker
5853dd6617 Merge pull request #241 from PepperDash/hotfix/dm-tx-chassis-bridge-fix
Add BasicDmTxControllerBase back
2020-06-10 16:11:58 -06:00
Andrew Welker
a0ef356bac Fix casts in DmBladeChassisController 2020-06-09 14:40:11 -06:00
Andrew Welker
486d6db7d8 fixes casting issues 2020-06-09 13:06:40 -06:00
Andrew Welker
81d9261a73 Changes base class to BasicDmTxControllerBase 2020-06-09 13:06:25 -06:00
Andrew Welker
2ace6ef6bc adds BasicDmTxControllerBase back in 2020-06-09 13:05:56 -06:00
Andrew Welker
cc6d94b188 Updates EiscApiAdvanced for backwards compatibility 2020-06-09 10:57:42 -06:00
Andrew Welker
0525f76b6b Added IBridge to Core
made existing IBridge inherit from it for backwards compatabilty
2020-06-09 10:57:17 -06:00
Neil Dorin
345442e195 Merge pull request #235 from PepperDash/hotfix/update-readme-to-include-4-series
Hotfix/update readme to include 4 series
2020-06-07 16:53:45 -06:00
Neil Dorin
e94e8b60a6 Bolds 4-series 2020-06-07 16:36:00 -06:00
Neil Dorin
4f4c8cba04 Update README.md 2020-06-07 16:11:17 -06:00
Andrew Welker
0a38442ac5 Merge pull request #224 from PepperDash/hotfix/dm-rmc4kz100-build
Fix issue building DM-RMC-4KZ-100-C & DM-TX-4KZ-202-C
2020-06-01 16:59:04 -06:00
Andrew Welker
083a3662e0 adds DmTx4kz202CController class
fixes errors in DmTx4kz302CController that were fixed in a previous
commit but were not merged into dev
2020-06-01 13:33:28 -06:00
Andrew Welker
37e1e50b94 #222 changes updates for EDID Feedbacks 2020-06-01 10:38:45 -06:00
Neil Dorin
862610b17d Merge pull request #216 from PepperDash/hotfix/genericcomm-incorrect-cast
Fix incorrect cast in GenericComm LinkToApi method
2020-05-27 10:34:08 -06:00
Andrew Welker
7bfc82c3cc #215 fix for incorrect cast in LinkToApi method 2020-05-27 09:50:50 -06:00
Trevor Payne
f81fe3d01f Merge pull request #203 from PepperDash/hotfix/dm-tx-bridging
Hotfix/dm tx bridging
2020-05-20 15:08:44 -05:00
29 changed files with 1178 additions and 1463 deletions

View File

@@ -1,5 +1,4 @@
using System;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Bridges
{
@@ -7,8 +6,7 @@ namespace PepperDash.Essentials.Bridges
/// Defines a device that uses the legacy JoinMapBase for its join map
/// </summary>
[Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")]
public interface IBridge
public interface IBridge:Core.Bridges.IBridge
{
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
}
}

View File

@@ -211,7 +211,7 @@ namespace PepperDash.Essentials
var comm = CommFactory.GetControlPropertiesConfig(dc);
var props = Newtonsoft.Json.JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(dc.Properties.ToString());
Debug.Console(1, "Factory Attempting to create new EssentialsTouchpanelController");
Debug.Console(1, "Factory Attempting to create new Generic Comm Device");
var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt);

View File

@@ -10,7 +10,7 @@ PepperDash Essentials is an open source Crestron framework that can be configure
Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other.
## Minimum Requirements
- Essentials Framework runs on any Crestron 3-series processor or Crestron's VC-4 platform.
- Essentials Framework runs on any Crestron 3-series processor, **4-series** processor or Crestron's VC-4 platform.
- To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required.
- Crestron's Simpl# Plugin is also required (must be obtained from Crestron).

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 KiB

View File

@@ -110,15 +110,24 @@ namespace PepperDash.Essentials.Core.Bridges
if (device == null) continue;
Debug.Console(1, this, "Linking Device: '{0}'", device.Key);
//if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type.
//{
// Debug.Console(2, this, "'{0}' is IBridge", device.Key);
//}
if (typeof (IBridge).IsAssignableFrom(device.GetType().GetCType()))
{
var basicBridge = device as IBridge;
if (basicBridge != null)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Notice,
"Linking EiscApiAdvanced {0} to device {1} using obsolete join map. Please update the device's join map.",
Key, device.Key);
basicBridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey);
}
continue;
}
if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType()))
{
continue;
}
var bridge = device as IBridgeAdvanced;
if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this);
}

View File

@@ -1,13 +1,19 @@
using System;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Bridges
{
/// <summary>
/// Defines a device that uses JoinMapBaseAdvanced for its join map
/// </summary>
public interface IBridgeAdvanced
public interface IBridgeAdvanced:IKeyed
{
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge);
}
public interface IBridge:IKeyed
{
void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey);
}
}

View File

@@ -1,61 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges
{
public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Name")]
public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("EnableAutoRoute")]
public JoinDataComplete EnableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Enable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("DisableAutoRoute")]
public JoinDataComplete DisableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Disable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("InputName")]
public JoinDataComplete InputName = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 },
new JoinMetadata() { Label = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("InputSync")]
public JoinDataComplete InputSync = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 },
new JoinMetadata() { Label = "Device Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("OutputName")]
public JoinDataComplete OutputName = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 2 },
new JoinMetadata() { Label = "Device Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("OutputRoute")]
public JoinDataComplete OutputRoute = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 2 },
new JoinMetadata() { Label = "Device Output Route Set/Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("OutputRoutedName")]
public JoinDataComplete OutputRoutedName = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 2 },
new JoinMetadata() { Label = "Device Output Route Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("EnableInputHdcp")]
public JoinDataComplete EnableInputHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 8 },
new JoinMetadata() { Label = "Device Enable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("DisableInputHdcp")]
public JoinDataComplete DisableInputHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 8 },
new JoinMetadata() { Label = "Device Disnable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("IsOnline")]
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 },
new JoinMetadata() { Label = "Device Onlne", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
public HdMdNxM4kEControllerJoinMap(uint joinStart)
: base(joinStart, typeof(HdMdNxM4kEControllerJoinMap))
{
}
}
}

View File

@@ -96,7 +96,7 @@ namespace PepperDash.Essentials.Core
trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig);
var sComm = this as ISocketStatus;
var sComm = CommPort as ISocketStatus;
if (sComm == null) return;
sComm.ConnectionChange += (s, a) =>
{

View File

@@ -78,145 +78,70 @@ namespace PepperDash.Essentials.Core
portDevKey, portNum);
return port;
}
}
public static IROutputPort GetIrOutputPort(DeviceConfig dc)
{
var irControllerKey = dc.Key + "-ir";
if (dc.Properties == null)
{
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", dc.Key);
return null;
}
var control = dc.Properties["control"];
if (control == null)
{
Debug.Console(0,
"WARNING: Device config does not include control properties. IR will not function for {0}", dc.Key);
return null;
}
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
IIROutputPorts irDev = null;
if (portDevKey == null)
{
Debug.Console(0, "WARNING: control properties is missing ir device for {0}", dc.Key);
return null;
}
if (portNum == 0)
{
Debug.Console(0, "WARNING: control properties is missing ir port number for {0}", dc.Key);
return null;
}
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
if (irDev == null)
{
Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey);
return null;
}
if (portNum >= irDev.NumberOfIROutputPorts)
{
Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum);
return null;
}
var port = irDev.IROutputPorts[portNum];
port.LoadIRDriver(Global.FilePathPrefix + "IR" + Global.DirectorySeparator + control["irFile"].Value<string>());
return port;
}
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
{
Debug.Console(1, "Attempting to create new Ir Port Controller");
if (config == null)
{
return null;
}
var irDevice = new IrOutputPortController(config.Key, GetIrOutputPort, config);
return irDevice;
}
/*
/// <summary>
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
/// </summary>
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
{
var irControllerKey = devConf.Key + "-ir";
if (devConf.Properties == null)
{
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
return new IrOutputPortController(irControllerKey, null, "");
}
}
var control = devConf.Properties["control"];
if (control == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
return c;
}
/// <summary>
/// Returns a ready-to-go IrOutputPortController from a DeviceConfig object.
/// </summary>
public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf)
{
var irControllerKey = devConf.Key + "-ir";
if (devConf.Properties == null)
{
Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key);
return new IrOutputPortController(irControllerKey, null, "");
}
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
IIROutputPorts irDev = null;
var control = devConf.Properties["control"];
if (control == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function");
return c;
}
if (portDevKey == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir device");
return c;
}
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
IIROutputPorts irDev = null;
if (portNum == 0)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
return c;
}
if (portDevKey == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir device");
return c;
}
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
if (portNum == 0)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir port number");
return c;
}
if (irDev == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
return c;
}
if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
if (portNum <= irDev.NumberOfIROutputPorts) // success!
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
IrDriverPathPrefix + control["irFile"].Value<string>());
else
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum);
return c;
}
}*/
if (irDev == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey);
return c;
}
if (portNum <= irDev.NumberOfIROutputPorts) // success!
return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum],
IrDriverPathPrefix + control["irFile"].Value<string>());
else
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum);
return c;
}
}
}
/// <summary>

View File

@@ -26,78 +26,23 @@ namespace PepperDash.Essentials.Core.CrestronIO
return () => InputPort.State;
}
}
public GenericDigitalInputDevice(string key, string name, Func<IOPortConfig, DigitalInput> postActivationFunc,
IOPortConfig config)
: base(key, name)
{
AddPostActivationAction(() =>
{
InputPort = postActivationFunc(config);
InputPort.Register();
InputPort.StateChange += InputPort_StateChange;
});
}
#region Events
public GenericDigitalInputDevice(string key, DigitalInput inputPort):
base(key)
{
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc);
InputPort = inputPort;
InputPort.StateChange += InputPort_StateChange;
}
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
{
InputStateFeedback.FireUpdate();
}
#endregion
#region PreActivate
private static DigitalInput GetDigitalInput(IOPortConfig dc)
{
IDigitalInputPorts ioPortDevice;
if (dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsDigitalInput)
{
Debug.Console(0, "GetDigitalInput: Processor does not support Digital Inputs");
return null;
}
ioPortDevice = Global.ControlSystem;
}
else
{
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IDigitalInputPorts;
if (ioPortDev == null)
{
Debug.Console(0, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfDigitalInputPorts)
{
Debug.Console(0, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
return ioPortDevice.DigitalInputPorts[dc.PortNumber];
}
#endregion
#region Bridge Linking
InputStateFeedback.FireUpdate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new IDigitalInputJoinMap(joinStart);
@@ -120,37 +65,98 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
Debug.Console(1, this, "Error: {0}", e);
}
}
#endregion
#region Factory
public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericDigitalInputDevice>
{
public GenericDigitalInputDeviceFactory()
{
TypeNames = new List<string>() { "digitalinput" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
if (props == null) return null;
var portDevice = new GenericDigitalInputDevice(dc.Key, dc.Name, GetDigitalInput, props);
return portDevice;
}
}
#endregion
}
}
}
public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory<GenericDigitalInputDevice>
{
public GenericDigitalInputDeviceFactory()
{
TypeNames = new List<string>() { "digitalinput" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Digtal Input Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
IDigitalInputPorts portDevice;
if (props.PortDeviceKey == "processor")
portDevice = Global.ControlSystem as IDigitalInputPorts;
else
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts;
if (portDevice == null)
Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", dc.Key);
else
{
var cs = (portDevice as CrestronControlSystem);
if (cs == null)
{
Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey);
return null;
}
if (cs.SupportsVersiport)
{
Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber);
if (props.PortNumber > cs.NumberOfVersiPorts)
{
Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range",
props.PortNumber, props.PortDeviceKey);
return null;
}
Versiport vp = cs.VersiPorts[props.PortNumber];
if (!vp.Registered)
{
var regSuccess = vp.Register();
if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(1, "Successfully Created Digital Input Device on Versiport");
return new GenericVersiportDigitalInputDevice(dc.Key, vp, props);
}
else
{
Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}",
props.PortNumber, props.PortDeviceKey, regSuccess);
return null;
}
}
}
else if (cs.SupportsDigitalInput)
{
Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber);
if (props.PortNumber > cs.NumberOfDigitalInputPorts)
{
Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range",
props.PortNumber, props.PortDeviceKey);
return null;
}
DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber];
if (!digitalInput.Registered)
{
if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(1, "Successfully Created Digital Input Device on Digital Input");
return new GenericDigitalInputDevice(dc.Key, digitalInput);
}
else
Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.",
props.PortNumber, props.PortDeviceKey);
}
}
}
return null;
}
}
}

View File

@@ -19,108 +19,41 @@ namespace PepperDash.Essentials.Core.CrestronIO
{
public Relay RelayOutput { get; private set; }
public BoolFeedback OutputIsOnFeedback { get; private set; }
//Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor
public GenericRelayDevice(string key, Relay relay) :
base(key)
{
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
RelayOutput = relay;
RelayOutput.Register();
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
}
public GenericRelayDevice(string key, string name, Func<IOPortConfig, Relay> postActivationFunc,
IOPortConfig config)
: base(key, name)
{
AddPostActivationAction(() =>
{
RelayOutput = postActivationFunc(config);
RelayOutput.Register();
RelayOutput.StateChange += RelayOutput_StateChange;
});
}
#region PreActivate
private static Relay GetRelay(IOPortConfig dc)
{
IRelayPorts relayDevice;
if(dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsRelay)
{
Debug.Console(0, "GetRelayDevice: Processor does not support relays");
return null;
}
relayDevice = Global.ControlSystem;
}
else
{
var relayDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IRelayPorts;
if (relayDev == null)
{
Debug.Console(0, "GetRelayDevice: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
relayDevice = relayDev;
}
if (relayDevice == null)
{
Debug.Console(0, "GetRelayDevice: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > relayDevice.NumberOfRelayPorts)
{
Debug.Console(0, "GetRelayDevice: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
return relayDevice.RelayPorts[dc.PortNumber];
}
#endregion
#region Events
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
public BoolFeedback OutputIsOnFeedback { get; private set; }
public GenericRelayDevice(string key, Relay relay):
base(key)
{
OutputIsOnFeedback.FireUpdate();
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
RelayOutput = relay;
RelayOutput.Register();
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
}
#endregion
#region Methods
public void OpenRelay()
{
RelayOutput.State = false;
}
public void CloseRelay()
{
RelayOutput.State = true;
}
public void ToggleRelayState()
{
if (RelayOutput.State == true)
OpenRelay();
else
CloseRelay();
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
{
OutputIsOnFeedback.FireUpdate();
}
public void OpenRelay()
{
RelayOutput.State = false;
}
public void CloseRelay()
{
RelayOutput.State = true;
}
public void ToggleRelayState()
{
if (RelayOutput.State == true)
OpenRelay();
else
CloseRelay();
}
#endregion
#region ISwitchedOutput Members
@@ -134,10 +67,8 @@ namespace PepperDash.Essentials.Core.CrestronIO
OpenRelay();
}
#endregion
#region Bridge Linking
#endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new GenericRelayControllerJoinMap(joinStart);
@@ -167,90 +98,77 @@ namespace PepperDash.Essentials.Core.CrestronIO
// feedback for relay state
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
}
#endregion
#region Factory
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
{
public GenericRelayDeviceFactory()
{
TypeNames = new List<string>() { "relayoutput" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
if (props == null) return null;
var portDevice = new GenericRelayDevice(dc.Key, dc.Name, GetRelay, props);
return portDevice;
/*
if (props.PortDeviceKey == "processor")
portDevice = Global.ControlSystem as IRelayPorts;
else
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
if (portDevice == null)
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
else
{
var cs = (portDevice as CrestronControlSystem);
if (cs != null)
{
// The relay is on a control system processor
if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts)
{
Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays");
return null;
}
}
else
{
// The relay is on another device type
if (props.PortNumber > portDevice.NumberOfRelayPorts)
{
Debug.Console(0, "Port Device: {0} does not have enough relays");
return null;
}
}
Relay relay = portDevice.RelayPorts[props.PortNumber];
if (!relay.Registered)
{
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
return new GenericRelayDevice(key, relay);
else
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
}
else
{
return new GenericRelayDevice(key, relay);
}
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
}
*/
}
}
#endregion
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
}
}
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
{
public GenericRelayDeviceFactory()
{
TypeNames = new List<string>() { "relayoutput" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new Generic Relay Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
var key = dc.Key;
IRelayPorts portDevice;
if (props.PortDeviceKey == "processor")
portDevice = Global.ControlSystem as IRelayPorts;
else
portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts;
if (portDevice == null)
Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
else
{
var cs = (portDevice as CrestronControlSystem);
if (cs != null)
{
// The relay is on a control system processor
if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts)
{
Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays");
return null;
}
}
else
{
// The relay is on another device type
if (props.PortNumber > portDevice.NumberOfRelayPorts)
{
Debug.Console(0, "Port Device: {0} does not have enough relays");
return null;
}
}
Relay relay = portDevice.RelayPorts[props.PortNumber];
if (!relay.Registered)
{
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
return new GenericRelayDevice(key, relay);
else
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey);
}
else
{
return new GenericRelayDevice(key, relay);
}
// Future: Check if portDevice is 3-series card or other non control system that supports versiports
}
return null;
}
}
}

View File

@@ -53,7 +53,7 @@ namespace PepperDash.Essentials.Core
public ConfigSnippetAttribute(string configSnippet)
{
Debug.Console(2, "Setting Config Snippet {0}", configSnippet);
Debug.Console(2, "Setting Description {0}", configSnippet);
_ConfigSnippet = configSnippet;
}
@@ -83,9 +83,8 @@ namespace PepperDash.Essentials.Core
foreach (var typeName in TypeNames)
{
Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName);
var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
string description = descriptionAttribute[0].Description;
var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[];
var attributes = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[];
string description = attributes[0].Description;
DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice);
}
}

View File

@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
public interface IBasicVideoMute
{
void VideoMuteToggle();
}
public interface IBasicVideoMuteWithFeedback : IBasicVideoMute
{
BoolFeedback VideoMuteIsOn { get; }
void VideoMuteOn();
void VideoMuteOff();
}
}

View File

@@ -3,10 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json.Linq;
using PepperDash.Essentials.Core.Config;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
@@ -40,21 +37,9 @@ namespace PepperDash.Essentials.Core
return;
}
LoadDriver(irDriverFilepath);
}
public IrOutputPortController(string key, Func<DeviceConfig, IROutputPort> postActivationFunc,
DeviceConfig config)
: base(key)
{
AddPostActivationAction(() =>
{
IrPort = postActivationFunc(config);
});
}
/// <summary>
}
/// <summary>
/// Loads the IR driver at path
/// </summary>
/// <param name="path"></param>
@@ -133,6 +118,7 @@ namespace PepperDash.Essentials.Core
{
Debug.Console(2, this, "Device {0}: IR Driver {1} does not contain command {2}",
Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command);
}
}
}
}

View File

@@ -129,7 +129,6 @@
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GlsOccupancySensorBaseJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdNxM4kEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" />
@@ -159,7 +158,6 @@
<Compile Include="Devices\DeviceFeedbackExtensions.cs" />
<Compile Include="Devices\EssentialsBridgeableDevice.cs" />
<Compile Include="Devices\EssentialsDevice.cs" />
<Compile Include="Devices\IProjectorInterfaces.cs" />
<Compile Include="Devices\PC\InRoomPc.cs" />
<Compile Include="Devices\PC\Laptop.cs" />
<Compile Include="Devices\ReconfigurableDevice.cs" />

View File

@@ -599,7 +599,7 @@ namespace PepperDash.Essentials.DM {
{
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase;
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice as DmTxControllerBase;

View File

@@ -1154,9 +1154,9 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase;
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice;
var advancedTxDevice = basicTxDevice as DmTxControllerBase;
if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
|| Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps

View File

@@ -1,394 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Newtonsoft.Json;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM.Chassis
{
[Description("Wrapper class for all HdMdNxM4E switchers")]
public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback
{
private HdMdNxM _Chassis;
private HdMd4x14kE _Chassis4x1;
public Dictionary<uint, string> InputNames { get; set; }
public Dictionary<uint, string> OutputNames { get; set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
public FeedbackCollection<BoolFeedback> VideoInputSyncFeedbacks { get; private set; }
public FeedbackCollection<IntFeedback> VideoOutputRouteFeedbacks { get; private set; }
public FeedbackCollection<StringFeedback> InputNameFeedbacks { get; private set; }
public FeedbackCollection<StringFeedback> OutputNameFeedbacks { get; private set; }
public FeedbackCollection<StringFeedback> OutputRouteNameFeedbacks { get; private set; }
public FeedbackCollection<BoolFeedback> InputHdcpEnableFeedback { get; private set; }
public FeedbackCollection<StringFeedback> DeviceNameFeedback { get; private set; }
public FeedbackCollection<BoolFeedback> AutoRouteFeedback { get; private set; }
#region Constructor
public HdMdNxM4kEBridgeableController(string key, string name, HdMdNxM chassis,
HdMdNxM4kEBridgeablePropertiesConfig props)
: base(key, name, chassis)
{
_Chassis = chassis;
var _props = props;
InputNames = props.Inputs;
OutputNames = props.Outputs;
VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>();
VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>();
InputNameFeedbacks = new FeedbackCollection<StringFeedback>();
OutputNameFeedbacks = new FeedbackCollection<StringFeedback>();
OutputRouteNameFeedbacks = new FeedbackCollection<StringFeedback>();
InputHdcpEnableFeedback = new FeedbackCollection<BoolFeedback>();
DeviceNameFeedback = new FeedbackCollection<StringFeedback>();
AutoRouteFeedback = new FeedbackCollection<BoolFeedback>();
InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
DeviceNameFeedback.Add(new StringFeedback(this.Name, () => this.Name));
if (_Chassis.NumberOfInputs == 1)
{
_Chassis4x1 = _Chassis as HdMd4x14kE;
AutoRouteFeedback.Add(new BoolFeedback(this.Name + "-" + InputNames[1], () => _Chassis4x1.AutoModeOnFeedback.BoolValue));
}
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
{
var inputName = InputNames[i];
_Chassis.Inputs[i].Name.StringValue = inputName;
InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, i, this));
VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[i].VideoDetectedFeedback.BoolValue));
InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[i].Name.StringValue));
InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
}
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
{
var outputName = OutputNames[i];
_Chassis.Outputs[i].Name.StringValue = outputName;
OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, i, this));
VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[i].VideoOutFeedback.Number));
OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].Name.StringValue));
OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].VideoOutFeedback.NameFeedback.StringValue));
}
_Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
_Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
AddPostActivationAction(AddFeedbackCollections);
}
#endregion
#region Methods
public void EnableHdcp(uint port)
{
if (port > _Chassis.NumberOfInputs) return;
if (port <= 0) return;
_Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn();
InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
}
public void DisableHdcp(uint port)
{
if (port > _Chassis.NumberOfInputs) return;
if (port <= 0) return;
_Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff();
InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
}
public void EnableAutoRoute()
{
if (_Chassis.NumberOfInputs != 1) return;
if (_Chassis4x1 == null) return;
_Chassis4x1.AutoModeOn();
}
public void DisableAutoRoute()
{
if (_Chassis.NumberOfInputs != 1) return;
if (_Chassis4x1 == null) return;
_Chassis4x1.AutoModeOff();
}
#region PostActivate
public void AddFeedbackCollections()
{
AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback);
AddCollectionsToList(VideoOutputRouteFeedbacks);
AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks, DeviceNameFeedback);
}
#endregion
#region FeedbackCollection Methods
//Add arrays of collections
public void AddCollectionsToList(params FeedbackCollection<BoolFeedback>[] newFbs)
{
foreach (FeedbackCollection<BoolFeedback> fbCollection in newFbs)
{
foreach (var item in newFbs)
{
AddCollectionToList(item);
}
}
}
public void AddCollectionsToList(params FeedbackCollection<IntFeedback>[] newFbs)
{
foreach (FeedbackCollection<IntFeedback> fbCollection in newFbs)
{
foreach (var item in newFbs)
{
AddCollectionToList(item);
}
}
}
public void AddCollectionsToList(params FeedbackCollection<StringFeedback>[] newFbs)
{
foreach (FeedbackCollection<StringFeedback> fbCollection in newFbs)
{
foreach (var item in newFbs)
{
AddCollectionToList(item);
}
}
}
//Add Collections
public void AddCollectionToList(FeedbackCollection<BoolFeedback> newFbs)
{
foreach (var f in newFbs)
{
if (f == null) continue;
AddFeedbackToList(f);
}
}
public void AddCollectionToList(FeedbackCollection<IntFeedback> newFbs)
{
foreach (var f in newFbs)
{
if (f == null) continue;
AddFeedbackToList(f);
}
}
public void AddCollectionToList(FeedbackCollection<StringFeedback> newFbs)
{
foreach (var f in newFbs)
{
if (f == null) continue;
AddFeedbackToList(f);
}
}
//Add Individual Feedbacks
public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb)
{
if (newFb == null) return;
if (!Feedbacks.Contains(newFb))
{
Feedbacks.Add(newFb);
}
}
#endregion
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
// Try to make switch only when necessary. The unit appears to toggle when already selected.
var current = _Chassis.HdmiOutputs[(uint)outputSelector].VideoOut;
if (current != _Chassis.HdmiInputs[(uint)inputSelector])
_Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = _Chassis.HdmiInputs[(uint)inputSelector];
}
#endregion
#endregion
#region Bridge Linking
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<HdMdNxM4kEControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
DeviceNameFeedback[this.Name].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]);
if (_Chassis4x1 != null)
{
AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkInputSig(trilist.BooleanInput[joinMap.EnableAutoRoute.JoinNumber]);
AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableAutoRoute.JoinNumber]);
}
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
{
var joinIndex = i - 1;
//Digital
VideoInputSyncFeedbacks[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]);
InputHdcpEnableFeedback[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]);
InputHdcpEnableFeedback[InputNames[i]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]);
trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(i));
trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(i));
//Serial
InputNameFeedbacks[InputNames[i]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]);
}
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
{
var joinIndex = i - 1;
//Analog
VideoOutputRouteFeedbacks[OutputNames[i]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]);
trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteSwitch(a, i, eRoutingSignalType.AudioVideo));
//Serial
OutputNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]);
OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]);
}
_Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange);
trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) =>
{
if (args.DeviceOnLine)
{
foreach (var feedback in Feedbacks)
{
feedback.FireUpdate();
}
}
});
}
#endregion
#region Events
void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
{
if (args.DeviceOnLine)
{
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
{
_Chassis.Inputs[i].Name.StringValue = InputNames[i];
}
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
{
_Chassis.Outputs[i].Name.StringValue = OutputNames[i];
}
foreach (var feedback in Feedbacks)
{
feedback.FireUpdate();
}
}
}
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{
if (args.EventId == DMOutputEventIds.VideoOutEventId)
{
foreach (var item in VideoOutputRouteFeedbacks)
{
item.FireUpdate();
}
}
}
void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
{
if (args.EventId == DMInputEventIds.VideoDetectedEventId)
{
foreach (var item in VideoInputSyncFeedbacks)
{
item.FireUpdate();
}
}
}
#endregion
#region Factory
public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory<HdMdNxM4kEBridgeableController>
{
public HdMdNxM4kEControllerFactory()
{
TypeNames = new List<string>() { "hdmd4x14ke-bridgeable", "hdmd4x24ke", "hdmd6x24ke" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device");
var props = JsonConvert.DeserializeObject<HdMdNxM4kEBridgeablePropertiesConfig>(dc.Properties.ToString());
var type = dc.Type.ToLower();
var control = props.Control;
var ipid = control.IpIdInt;
var address = control.TcpSshProperties.Address;
switch (type)
{
case ("hdmd4x14ke-bridgeable"):
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props);
case ("hdmd4x24ke"):
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props);
case ("hdmd6x24ke"):
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props);
default:
return null;
}
}
}
#endregion
}
}

View File

@@ -1,128 +1,125 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM.Chassis
{
public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting
{
public HdMdNxM Chassis { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="chassis"></param>
public HdMdNxM4kEController(string key, string name, HdMdNxM chassis,
HdMdNxM4kEPropertiesConfig props)
: base(key, name)
{
Chassis = chassis;
// logical ports
InputPorts = new RoutingPortCollection<RoutingInputPort>();
for (uint i = 1; i <= 4; i++)
{
InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, i, this));
}
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this));
// physical settings
if (props != null && props.Inputs != null)
{
foreach (var kvp in props.Inputs)
{
// strip "hdmiIn"
var inputNum = Convert.ToUInt32(kvp.Key.Substring(6));
var port = chassis.HdmiInputs[inputNum].HdmiInputPort;
// set hdcp disables
if (kvp.Value.DisableHdcp)
{
Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key);
port.HdcpSupportOff();
}
else
port.HdcpSupportOn();
}
}
}
public override bool CustomActivate()
{
var result = Chassis.Register();
if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "Device registration failed: {0}", result);
return false;
}
return base.CustomActivate();
}
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
// Try to make switch only when necessary. The unit appears to toggle when already selected.
var current = Chassis.HdmiOutputs[1].VideoOut;
if (current != Chassis.HdmiInputs[(uint)inputSelector])
Chassis.HdmiOutputs[1].VideoOut = Chassis.HdmiInputs[(uint)inputSelector];
}
#endregion
/////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="type"></param>
/// <param name="properties"></param>
/// <returns></returns>
public static HdMdNxM4kEController GetController(string key, string name,
string type, HdMdNxM4kEPropertiesConfig properties)
{
try
{
var ipid = properties.Control.IpIdInt;
var address = properties.Control.TcpSshProperties.Address;
type = type.ToLower();
if (type == "hdmd4x14ke")
{
Debug.Console(0, @"The 'hdmd4x14ke' device is not an Essentials Bridgeable device.
If an essentials Bridgeable Device is required, use the 'hdmd4x14ke-bridgeable' type");
var chassis = new HdMd4x14kE(ipid, address, Global.ControlSystem);
return new HdMdNxM4kEController(key, name, chassis, properties);
}
return null;
}
catch (Exception e)
{
Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e);
return null;
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DM;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM.Chassis
{
public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting
{
public HdMdNxM Chassis { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="chassis"></param>
public HdMdNxM4kEController(string key, string name, HdMdNxM chassis,
HdMdNxM4kEPropertiesConfig props)
: base(key, name)
{
Chassis = chassis;
// logical ports
InputPorts = new RoutingPortCollection<RoutingInputPort>();
for (uint i = 1; i <= 4; i++)
{
InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, i, this));
}
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this));
// physical settings
if (props != null && props.Inputs != null)
{
foreach (var kvp in props.Inputs)
{
// strip "hdmiIn"
var inputNum = Convert.ToUInt32(kvp.Key.Substring(6));
var port = chassis.HdmiInputs[inputNum].HdmiInputPort;
// set hdcp disables
if (kvp.Value.DisableHdcp)
{
Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key);
port.HdcpSupportOff();
}
else
port.HdcpSupportOn();
}
}
}
public override bool CustomActivate()
{
var result = Chassis.Register();
if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "Device registration failed: {0}", result);
return false;
}
return base.CustomActivate();
}
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
// Try to make switch only when necessary. The unit appears to toggle when already selected.
var current = Chassis.HdmiOutputs[1].VideoOut;
if(current != Chassis.HdmiInputs[(uint)inputSelector])
Chassis.HdmiOutputs[1].VideoOut = Chassis.HdmiInputs[(uint)inputSelector];
}
#endregion
/////////////////////////////////////////////////////
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="type"></param>
/// <param name="properties"></param>
/// <returns></returns>
public static HdMdNxM4kEController GetController(string key, string name,
string type, HdMdNxM4kEPropertiesConfig properties)
{
try
{
var ipid = properties.Control.IpIdInt;
var address = properties.Control.TcpSshProperties.Address;
type = type.ToLower();
if (type == "hdmd4x14ke")
{
var chassis = new HdMd4x14kE(ipid, address, Global.ControlSystem);
return new HdMdNxM4kEController(key, name, chassis, properties);
}
return null;
}
catch (Exception e)
{
Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e);
return null;
}
}
}
}

View File

@@ -8,28 +8,16 @@ using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.DM.Config
{
/// <summary>
/// Defines the properties section of HdMdNxM boxes
/// </summary>
public class HdMdNxM4kEPropertiesConfig
{
[JsonProperty("control")]
public ControlPropertiesConfig Control { get; set; }
[JsonProperty("inputs")]
public Dictionary<string, InputPropertiesConfig> Inputs { get; set; }
}
public class HdMdNxM4kEBridgeablePropertiesConfig
{
[JsonProperty("control")]
public ControlPropertiesConfig Control { get; set; }
[JsonProperty("inputs")]
public Dictionary<uint, string> Inputs { get; set; }
[JsonProperty("outputs")]
public Dictionary<uint, string> Outputs { get; set; }
}
{
/// <summary>
/// Defines the properties section of HdMdNxM boxes
/// </summary>
public class HdMdNxM4kEPropertiesConfig
{
[JsonProperty("control")]
public ControlPropertiesConfig Control { get; set; }
[JsonProperty("inputs")]
public Dictionary<string, InputPropertiesConfig> Inputs { get; set; }
}
}

View File

@@ -1,16 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.DM.Config
{
public class InputPropertiesConfig
{
public string Name { get; set; }
public bool DisableHdcp { get; set; }
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.DM.Config
{
public class InputPropertiesConfig
{
public string Name { get; set; }
public bool DisableHdcp { get; set; }
}
}

View File

@@ -23,18 +23,31 @@ namespace PepperDash.Essentials.DM
EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
//removed to prevent NullReferenceException
//_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
}
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
switch (args.EventId)
{
VideoOutputResolutionFeedback.FireUpdate();
case EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId:
case EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId:
case EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId:
VideoOutputResolutionFeedback.FireUpdate();
break;
case EndpointOutputStreamEventIds.HotplugDetectedEventId:
if (_rmc.HdmiOutput.ConnectedDevice == null) return;
EdidManufacturerFeedback.FireUpdate();
EdidNameFeedback.FireUpdate();
EdidPreferredTimingFeedback.FireUpdate();
EdidSerialNumberFeedback.FireUpdate();
break;
}
}
/*
void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
{
switch (args.EventId)
@@ -52,7 +65,7 @@ namespace PepperDash.Essentials.DM
EdidSerialNumberFeedback.FireUpdate();
break;
}
}
}*/
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{

View File

@@ -3,6 +3,7 @@
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
@@ -11,7 +12,7 @@ namespace PepperDash.Essentials.DM
using eVst = eX02VideoSourceType;
using eAst = eX02AudioSourceType;
public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs,
public class DmTx4k100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec
{
public DmTx4K100C1G Tx { get; private set; }
@@ -72,9 +73,7 @@ namespace PepperDash.Essentials.DM
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
LinkDmTxToApi(this, trilist, joinMap, bridge);
Debug.Console(1, this, "No properties to link. Skipping device {0}", Name);
}
#region IIROutputPorts Members
@@ -90,7 +89,5 @@ namespace PepperDash.Essentials.DM
#region ICec Members
public Cec StreamCec { get { return Tx.StreamCec; } }
#endregion
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
}
}

View File

@@ -1,205 +1,205 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4kX02CBase Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
public DmTx4k202CController(string key, string name, DmTx4kX02CBase tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback,
IIROutputPorts, IComPorts
{
public DmTx4k202C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else
return eVst.AllDisabled;
}
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
public DmTx4k202CController(string key, string name, DmTx4k202C tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback);
// Set Ports for CEC
HdmiIn1.Port = Tx.HdmiInputs[1];
HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput;
DmOut.Port = Tx.DmOutput;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null)
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (Hdmi2VideoSyncFeedback != null)
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback);
// Set Ports for CEC
HdmiIn1.Port = Tx.HdmiInputs[1];
HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput;
DmOut.Port = Tx.DmOutput;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null)
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (Hdmi2VideoSyncFeedback != null)
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
@@ -207,68 +207,68 @@ namespace PepperDash.Essentials.DM
switch (type)
{
case eRoutingSignalType.Video:
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
}
break;
case eRoutingSignalType.Audio:
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
}
break;
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eAst)inputSelector;
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eAst)inputSelector;
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
@@ -285,10 +285,10 @@ namespace PepperDash.Essentials.DM
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
}
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
@@ -305,63 +305,63 @@ namespace PepperDash.Essentials.DM
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
break;
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
return;
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
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;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
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;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -0,0 +1,359 @@
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
using eVst = eX02VideoSourceType;
using eAst = eX02AudioSourceType;
public class DmTx4kz202CController : DmTxControllerBase, ITxRouting,
IIROutputPorts, IComPorts
{
public DmTx4kz202C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
return Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue ? eVst.Hdmi2 : eVst.AllDisabled;
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
public DmTx4kz202CController(string key, string name, DmTx4kz202C tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
//Return VideoSourceFeedback here as DM-TX-4KZ-202-C does not support audio breakaway
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback);
// Set Ports for CEC
HdmiIn1.Port = Tx.HdmiInputs[1];
HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput;
DmOut.Port = Tx.DmOutput;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null)
{
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (Hdmi2VideoSyncFeedback != null)
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (type)
{
case eRoutingSignalType.Video:
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
}
break;
case eRoutingSignalType.Audio:
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
}
break;
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if(((signalType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio))
Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key);
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
break;
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
return;
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
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;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -1,9 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
@@ -13,14 +8,13 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM
{
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
using eVst = eX02VideoSourceType;
using eAst = eX02AudioSourceType;
public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback,
public class DmTx4kz302CController : DmTxControllerBase, ITxRouting,
IIROutputPorts, IComPorts
{
public DmTx4kz302C Tx { get; private set; }
@@ -46,23 +40,18 @@ namespace PepperDash.Essentials.DM
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
public eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
else // auto
{
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue)
return eVst.Vga;
else
return eVst.AllDisabled;
}
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi2;
return Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue ? eVst.Vga : eVst.AllDisabled;
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
@@ -108,7 +97,7 @@ namespace PepperDash.Essentials.DM
Tx.BaseEvent += Tx_BaseEvent;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
@@ -272,12 +261,14 @@ namespace PepperDash.Essentials.DM
// NOTE: It's possible that this particular TX model may not like the AudioSource property being set.
// The SIMPL definition only shows a single analog for AudioVideo Source
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
Tx.AudioSource = (eAst)inputSelector;
//it doesn't
Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key);
//Tx.AudioSource = (eAst)inputSelector;
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{

View File

@@ -27,7 +27,7 @@ namespace PepperDash.Essentials.DM
/// <param name="name"></param>
/// <param name="props"></param>
/// <returns></returns>
public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props)
{
// switch on type name... later...
@@ -52,7 +52,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302"))
@@ -115,7 +115,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
@@ -138,7 +138,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
@@ -157,11 +157,20 @@ namespace PepperDash.Essentials.DM
}
}
public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
{
protected BasicDmTxControllerBase(string key, string name, GenericBase hardware)
: base(key, name, hardware)
{
}
}
/// <summary>
///
/// </summary>
[Description("Wrapper class for all DM-TX variants")]
public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice
public abstract class DmTxControllerBase : BasicDmTxControllerBase
{
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
@@ -197,13 +206,7 @@ namespace PepperDash.Essentials.DM
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{
if (tx.Hardware is DmHDBasedTEndPoint)
{
Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name);
return;
}
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]);

View File

@@ -84,7 +84,7 @@
</Reference>
<Reference Include="SimplSharpReflectionInterface, Version=1.0.5583.25238, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
@@ -99,12 +99,11 @@
<Compile Include="Chassis\DmpsAudioOutputController.cs" />
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
<Compile Include="Chassis\DmpsRoutingController.cs" />
<Compile Include="Chassis\HdMdNxM4kEBridgeableController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />
<Compile Include="Endpoints\DGEs\DmDge200CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZScalerCController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx4kz202CController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx201SController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx4kz100Controller.cs" />
<Compile Include="Endpoints\Transmitters\TxInterfaces.cs" />
@@ -114,6 +113,7 @@
<Compile Include="Config\DmTxConfig.cs" />
<Compile Include="Config\DMChassisConfig.cs" />
<Compile Include="Config\HdMdNxM4kEPropertiesConfig.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />
<Compile Include="DmPortName.cs" />
<Compile Include="Endpoints\DGEs\Dge100Controller.cs" />
<Compile Include="Endpoints\DGEs\DgePropertiesConfig.cs" />

View File

@@ -12,6 +12,6 @@ namespace PepperDash.Essentials.Devices.Displays
public interface IInputHdmi4 { void InputHdmi4(); }
public interface IInputDisplayPort1 { void InputDisplayPort1(); }
public interface IInputDisplayPort2 { void InputDisplayPort2(); }
public interface IInputVga1 { void InputVga1(); }
public interface IInputVga1 { void InputVga1(); }
}