Merge branch 'development' into hotfix/eiscApiAdvanced-backwards-compatibility

This commit is contained in:
Andrew Welker
2020-06-12 13:43:22 -06:00
committed by GitHub
83 changed files with 3697 additions and 2359 deletions

View File

@@ -3,7 +3,6 @@ using System.Collections.Generic;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.EthernetCommunication; using Crestron.SimplSharpPro.EthernetCommunication;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Bridges;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
@@ -15,15 +14,11 @@ namespace PepperDash.Essentials.Bridges
{ {
public EiscApiPropertiesConfig PropertiesConfig { get; private set; } public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
protected Dictionary<string, JoinMapBaseAdvanced> JoinMaps { get; private set; }
public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; }
public EiscApi(DeviceConfig dc) : public EiscApi(DeviceConfig dc) :
base(dc.Key) base(dc.Key)
{ {
JoinMaps = new Dictionary<string, JoinMapBaseAdvanced>();
PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>(); PropertiesConfig = dc.Properties.ToObject<EiscApiPropertiesConfig>();
//PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString()); //PropertiesConfig = JsonConvert.DeserializeObject<EiscApiPropertiesConfig>(dc.Properties.ToString());
@@ -69,60 +64,10 @@ namespace PepperDash.Essentials.Bridges
} }
Debug.Console(1, this, "Devices Linked."); Debug.Console(1, this, "Devices Linked.");
}); });
} }
/// <summary>
/// Adds a join map
/// </summary>
/// <param name="deviceKey"></param>
/// <param name="joinMap"></param>
public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap)
{
if (!JoinMaps.ContainsKey(deviceKey))
{
JoinMaps.Add(deviceKey, joinMap);
}
else
{
Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey);
}
}
/// <summary>
/// Prints all the join maps on this bridge
/// </summary>
public void PrintJoinMaps()
{
Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X"));
foreach (var joinMap in JoinMaps)
{
Debug.Console(0, "Join map for device '{0}':", joinMap.Key);
joinMap.Value.PrintJoinMapInfo();
}
}
/// <summary>
/// Prints the join map for a device by key
/// </summary>
/// <param name="deviceKey"></param>
public void PrintJoinMapForDevice(string deviceKey)
{
var joinMap = JoinMaps[deviceKey];
if (joinMap == null)
{
Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey);
return;
}
Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key);
joinMap.PrintJoinMapInfo();
}
/// <summary> /// <summary>
/// Used for debugging to trigger an action based on a join number and type /// Used for debugging to trigger an action based on a join number and type
/// </summary> /// </summary>
@@ -194,7 +139,7 @@ namespace PepperDash.Essentials.Bridges
try try
{ {
if (Debug.Level >= 1) if (Debug.Level >= 1)
Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
var uo = args.Sig.UserObject; var uo = args.Sig.UserObject;
if (uo == null) return; if (uo == null) return;

View File

@@ -555,7 +555,7 @@ namespace PepperDash.Essentials
/// <returns></returns> /// <returns></returns>
bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey) bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey)
{ {
IRoutingSinkNoSwitching dest = null; IRoutingSink dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice as IRoutingSinkNoSwitching; dest = DefaultAudioDevice as IRoutingSinkNoSwitching;

View File

@@ -71,7 +71,7 @@ namespace PepperDash.Essentials
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; } public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; } public IRoutingSink DefaultAudioDevice { get; private set; }
public IBasicVolumeControls DefaultVolumeControls { get; private set; } public IBasicVolumeControls DefaultVolumeControls { get; private set; }
public bool ExcludeFromGlobalFunctions { get; set; } public bool ExcludeFromGlobalFunctions { get; set; }
@@ -471,14 +471,14 @@ namespace PepperDash.Essentials
/// <returns></returns> /// <returns></returns>
bool DoRoute(SourceRouteListItem route) bool DoRoute(SourceRouteListItem route)
{ {
IRoutingSinkNoSwitching dest = null; IRoutingSink dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice; dest = DefaultAudioDevice;
else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase))
dest = DefaultDisplay; dest = DefaultDisplay;
else else
dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink;
if (dest == null) if (dest == null)
{ {

View File

@@ -590,7 +590,7 @@ namespace PepperDash.Essentials
/// <returns></returns> /// <returns></returns>
bool DoRoute(SourceRouteListItem route) bool DoRoute(SourceRouteListItem route)
{ {
IRoutingSinkNoSwitching dest = null; IRoutingSink dest = null;
if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase))
dest = DefaultAudioDevice as IRoutingSinkNoSwitching; dest = DefaultAudioDevice as IRoutingSinkNoSwitching;

View File

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

View File

@@ -0,0 +1,57 @@
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("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

@@ -0,0 +1,238 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.Bridges
{
public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("Power")]
public JoinDataComplete Power = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Power", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Menu")]
public JoinDataComplete Menu = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 },
new JoinMetadata() { Label = "Menu", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Guide")]
public JoinDataComplete Guide = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 },
new JoinMetadata() { Label = "Guide", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Info")]
public JoinDataComplete Info = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 },
new JoinMetadata() { Label = "Info", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeUp")]
public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 },
new JoinMetadata() { Label = "VolumeUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeDown")]
public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 },
new JoinMetadata() { Label = "VolumeDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("DialPadUp")]
public JoinDataComplete DialPadUp = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 },
new JoinMetadata() { Label = "DialPadUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("DialPadDown")]
public JoinDataComplete DialPadDown = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 },
new JoinMetadata() { Label = "DialPadDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("DialPadLeft")]
public JoinDataComplete DialPadLeft = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 },
new JoinMetadata() { Label = "DialPadLeft", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("DialPadRight")]
public JoinDataComplete DialPadRight = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 },
new JoinMetadata() { Label = "DialPadRight", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("DialPadSelect")]
public JoinDataComplete DialPadSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 },
new JoinMetadata() { Label = "DialPadSelect", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("ChannelUp")]
public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 },
new JoinMetadata() { Label = "ChannelUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("ChannelDown")]
public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 },
new JoinMetadata() { Label = "ChannelDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Mute")]
public JoinDataComplete Mute = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 },
new JoinMetadata() { Label = "Mute", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Exit")]
public JoinDataComplete Exit = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 },
new JoinMetadata() { Label = "Exit", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Last")]
public JoinDataComplete Last = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 },
new JoinMetadata() { Label = "Last", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Play")]
public JoinDataComplete Play = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 },
new JoinMetadata() { Label = "Play", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Pause")]
public JoinDataComplete Pause = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 },
new JoinMetadata() { Label = "Pause", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Rewind")]
public JoinDataComplete Rewind = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 },
new JoinMetadata() { Label = "Rewind", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("FastForward")]
public JoinDataComplete FastForward = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 },
new JoinMetadata() { Label = "FastForward", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("PreviousTrack")]
public JoinDataComplete PreviousTrack = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 },
new JoinMetadata() { Label = "PreviousTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("NextTrack")]
public JoinDataComplete NextTrack = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 },
new JoinMetadata() { Label = "NextTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Stop")]
public JoinDataComplete Stop = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 },
new JoinMetadata() { Label = "Stop", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Record")]
public JoinDataComplete Record = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 },
new JoinMetadata() { Label = "Record", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Dvr")]
public JoinDataComplete Dvr = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 },
new JoinMetadata() { Label = "Dvr", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad1")]
public JoinDataComplete Keypad1 = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad2Abc")]
public JoinDataComplete Keypad2 = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad2Abc", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad3Def")]
public JoinDataComplete Keypad3Def = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad3Def", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad4Ghi")]
public JoinDataComplete Keypad4Ghi = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad4Ghi", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad5Jkl")]
public JoinDataComplete Keypad5Jkl = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad5Jkl", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad6Mno")]
public JoinDataComplete Keypad6Mno = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad6Mno", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad7Pqrs")]
public JoinDataComplete Keypad7Pqrs = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad7Pqrs", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad8Tuv")]
public JoinDataComplete Keypad8Tuv = new JoinDataComplete(new JoinData() { JoinNumber = 33, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad8Tuv", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad9Wxyz")]
public JoinDataComplete Keypad9Wxyz = new JoinDataComplete(new JoinData() { JoinNumber = 34, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad9Wxyz", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Keypad0")]
public JoinDataComplete Keypad0 = new JoinDataComplete(new JoinData() { JoinNumber = 35, JoinSpan = 1 },
new JoinMetadata() { Label = "Keypad0", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Clear")]
public JoinDataComplete Clear = new JoinDataComplete(new JoinData() { JoinNumber = 36, JoinSpan = 1 },
new JoinMetadata() { Label = "Clear", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Enter")]
public JoinDataComplete Enter = new JoinDataComplete(new JoinData() { JoinNumber = 37, JoinSpan = 1 },
new JoinMetadata() { Label = "Enter", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Red")]
public JoinDataComplete Red = new JoinDataComplete(new JoinData() { JoinNumber = 38, JoinSpan = 1 },
new JoinMetadata() { Label = "Red", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Green")]
public JoinDataComplete Green = new JoinDataComplete(new JoinData() { JoinNumber = 39, JoinSpan = 1 },
new JoinMetadata() { Label = "Green", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Yellow")]
public JoinDataComplete Yellow = new JoinDataComplete(new JoinData() { JoinNumber = 40, JoinSpan = 1 },
new JoinMetadata() { Label = "Yellow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Blue")]
public JoinDataComplete Blue = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 1 },
new JoinMetadata() { Label = "Blue", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom1")]
public JoinDataComplete Custom1 = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom2")]
public JoinDataComplete Custom2 = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom3")]
public JoinDataComplete Custom3 = new JoinDataComplete(new JoinData() { JoinNumber = 44, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom3", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom4")]
public JoinDataComplete Custom4 = new JoinDataComplete(new JoinData() { JoinNumber = 45, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom4", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom5")]
public JoinDataComplete Custom5 = new JoinDataComplete(new JoinData() { JoinNumber = 46, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom5", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom6")]
public JoinDataComplete Custom6 = new JoinDataComplete(new JoinData() { JoinNumber = 47, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom6", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom7")]
public JoinDataComplete Custom7 = new JoinDataComplete(new JoinData() { JoinNumber = 48, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom7", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom8")]
public JoinDataComplete Custom8 = new JoinDataComplete(new JoinData() { JoinNumber = 49, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom8", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Custom9")]
public JoinDataComplete Custom9 = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 },
new JoinMetadata() { Label = "Custom9", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Fav")]
public JoinDataComplete Fav = new JoinDataComplete(new JoinData() { JoinNumber = 51, JoinSpan = 1 },
new JoinMetadata() { Label = "Fav", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Home")]
public JoinDataComplete Home = new JoinDataComplete(new JoinData() { JoinNumber = 52, JoinSpan = 1 },
new JoinMetadata() { Label = "Home", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("BatteryLow")]
public JoinDataComplete BatteryLow = new JoinDataComplete(new JoinData() { JoinNumber = 53, JoinSpan = 1 },
new JoinMetadata() { Label = "BatteryLow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("BatteryCritical")]
public JoinDataComplete BatteryCritical = new JoinDataComplete(new JoinData() { JoinNumber = 54, JoinSpan = 1 },
new JoinMetadata() { Label = "BatteryCritical", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("BatteryVoltage")]
public JoinDataComplete BatteryVoltage = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "BatteryVoltage", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
public Hrxxx0WirelessRemoteControllerJoinMap(uint joinStart)
: base(joinStart, typeof(Hrxxx0WirelessRemoteControllerJoinMap))
{
}
}
}

View File

@@ -11,8 +11,10 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
public class ComPortController : Device, IBasicCommunication public class ComPortController : Device, IBasicCommunicationWithStreamDebugging
{ {
public CommunicationStreamDebugging StreamDebugging { get; private set; }
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived; public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived; public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
@@ -24,6 +26,8 @@ namespace PepperDash.Essentials.Core
public ComPortController(string key, Func<EssentialsControlPropertiesConfig, ComPort> postActivationFunc, public ComPortController(string key, Func<EssentialsControlPropertiesConfig, ComPort> postActivationFunc,
ComPort.ComPortSpec spec, EssentialsControlPropertiesConfig config) : base(key) ComPort.ComPortSpec spec, EssentialsControlPropertiesConfig config) : base(key)
{ {
StreamDebugging = new CommunicationStreamDebugging(key);
Spec = spec; Spec = spec;
AddPostActivationAction(() => AddPostActivationAction(() =>
@@ -91,7 +95,12 @@ namespace PepperDash.Essentials.Core
} }
var textHandler = TextReceived; var textHandler = TextReceived;
if (textHandler != null) if (textHandler != null)
{
if (StreamDebugging.RxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Recevied: '{0}'", s);
textHandler(this, new GenericCommMethodReceiveTextArgs(s)); textHandler(this, new GenericCommMethodReceiveTextArgs(s));
}
} }
public override bool Deactivate() public override bool Deactivate()
@@ -105,7 +114,10 @@ namespace PepperDash.Essentials.Core
{ {
if (Port == null) if (Port == null)
return; return;
Port.Send(text);
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, text);
Port.Send(text);
} }
public void SendBytes(byte[] bytes) public void SendBytes(byte[] bytes)
@@ -113,6 +125,9 @@ namespace PepperDash.Essentials.Core
if (Port == null) if (Port == null)
return; return;
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length); var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
if (StreamDebugging.TxStreamDebuggingIsEnabled)
Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes));
Port.Send(text); Port.Send(text);
} }

View File

@@ -184,6 +184,26 @@ namespace PepperDash.Essentials.Core
throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId)); throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId));
} }
} }
}
public string InfinetId { get; set; }
/// <summary>
/// Attepmts to provide uiont conversion of string InifinetId
/// </summary>
public uint InfinetIdInt
{
get
{
try
{
return Convert.ToUInt32(InfinetId, 16);
}
catch (Exception)
{
throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId));
}
}
} }
} }

View File

@@ -0,0 +1,235 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public static class IRPortHelper
{
public static string IrDriverPathPrefix
{
get
{
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
}
}
/// <summary>
/// Finds either the ControlSystem or a device controller that contains IR ports and
/// returns a port from the hardware device
/// </summary>
/// <param name="propsToken"></param>
/// <returns>IrPortConfig object. The port and or filename will be empty/null
/// if valid values don't exist on config</returns>
public static IrOutPortConfig GetIrPort(JToken propsToken)
{
var control = propsToken["control"];
if (control == null)
return null;
if (control["method"].Value<string>() != "ir")
{
Debug.Console(0, "IRPortHelper called with non-IR properties");
return null;
}
var port = new IrOutPortConfig();
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
if (portDevKey == null || portNum == 0)
{
Debug.Console(1, "WARNING: Properties is missing port device or port number");
return port;
}
IIROutputPorts irDev = 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(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
return port;
}
if (portNum <= irDev.NumberOfIROutputPorts) // success!
{
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
port.Port = irDev.IROutputPorts[portNum];
port.FileName = file;
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
}
else
{
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
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;
}
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
IIROutputPorts irDev = null;
if (portDevKey == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir device");
return c;
}
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.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
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>
/// Wrapper to help in IR port creation
/// </summary>
public class IrOutPortConfig
{
public IROutputPort Port { get; set; }
public string FileName { get; set; }
public IrOutPortConfig()
{
FileName = "";
}
}
}

View File

@@ -1,105 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Core
{
public class ComPortController : Device, IBasicCommunication
{
public event EventHandler<GenericCommMethodReceiveBytesArgs> BytesReceived;
public event EventHandler<GenericCommMethodReceiveTextArgs> TextReceived;
ComPort Port;
ComPort.ComPortSpec Spec;
public ComPortController(string key, IComPorts ComDevice, uint comPortNum, ComPort.ComPortSpec spec)
: base(key)
{
Port = ComDevice.ComPorts[comPortNum];
Spec = spec;
Debug.Console(2, "Creating com port '{0}'", key);
Debug.Console(2, "Com port spec:\r{0}", JsonConvert.SerializeObject(spec));
}
/// <summary>
/// Creates a ComPort if the parameters are correct. Returns and logs errors if not
/// </summary>
public static ComPortController GetComPortController(string key,
IComPorts comDevice, uint comPortNum, ComPort.ComPortSpec spec)
{
Debug.Console(1, "Creating com port '{0}'", key);
if (comDevice == null)
throw new ArgumentNullException("comDevice");
if (string.IsNullOrEmpty(key))
throw new ArgumentNullException("key");
if (comPortNum > comDevice.NumberOfComPorts)
{
Debug.Console(0, "[{0}] Com port {1} out of range on {2}",
key, comPortNum, comDevice.GetType().Name);
return null;
}
var port = new ComPortController(key, comDevice, comPortNum, spec);
return port;
}
/// <summary>
/// Registers port and sends ComSpec
/// </summary>
/// <returns>false if either register or comspec fails</returns>
public override bool CustomActivate()
{
var result = Port.Register();
if (result != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(0, this, "Cannot register Com port: {0}", result);
return false;
}
var specResult = Port.SetComPortSpec(Spec);
if (specResult != 0)
{
Debug.Console(0, this, "Cannot set comspec");
return false;
}
Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived);
return true;
}
void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args)
{
if (BytesReceived != null)
{
var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData);
BytesReceived(this, new GenericCommMethodReceiveBytesArgs(bytes));
}
if(TextReceived != null)
TextReceived(this, new GenericCommMethodReceiveTextArgs(args.SerialData));
}
public override bool Deactivate()
{
return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success;
}
#region IBasicCommunication Members
public void SendText(string text)
{
Port.Send(text);
}
public void SendBytes(byte[] bytes)
{
var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length);
Port.Send(text);
}
#endregion
}
}

View File

@@ -1,160 +0,0 @@
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
/// <summary>
///
/// </summary>
public static class IRPortHelper
{
public static string IrDriverPathPrefix
{
get
{
return Global.FilePathPrefix + "IR" + Global.DirectorySeparator;
}
}
/// <summary>
/// Finds either the ControlSystem or a device controller that contains IR ports and
/// returns a port from the hardware device
/// </summary>
/// <param name="propsToken"></param>
/// <returns>IrPortConfig object. The port and or filename will be empty/null
/// if valid values don't exist on config</returns>
public static IrOutPortConfig GetIrPort(JToken propsToken)
{
var control = propsToken["control"];
if (control == null)
return null;
if (control["method"].Value<string>() != "ir")
{
Debug.Console(0, "IRPortHelper called with non-IR properties");
return null;
}
var port = new IrOutPortConfig();
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
if (portDevKey == null || portNum == 0)
{
Debug.Console(1, "WARNING: Properties is missing port device or port number");
return port;
}
IIROutputPorts irDev = 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(1, "[Config] Error, device with IR ports '{0}' not found", portDevKey);
return port;
}
if (portNum <= irDev.NumberOfIROutputPorts) // success!
{
var file = IrDriverPathPrefix + control["irFile"].Value<string>();
port.Port = irDev.IROutputPorts[portNum];
port.FileName = file;
return port; // new IrOutPortConfig { Port = irDev.IROutputPorts[portNum], FileName = file };
}
else
{
Debug.Console(1, "[Config] Error, device '{0}' IR port {1} out of range",
portDevKey, portNum);
return port;
}
}
/// <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;
}
var portDevKey = control.Value<string>("controlPortDevKey");
var portNum = control.Value<uint>("controlPortNumber");
IIROutputPorts irDev = null;
if (portDevKey == null)
{
var c = new IrOutputPortController(irControllerKey, null, "");
Debug.Console(0, c, "WARNING: control properties is missing ir device");
return c;
}
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.Equals("controlSystem", StringComparison.OrdinalIgnoreCase)
|| portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase))
irDev = Global.ControlSystem;
else
irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts;
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>
/// Wrapper to help in IR port creation
/// </summary>
public class IrOutPortConfig
{
public IROutputPort Port { get; set; }
public string FileName { get; set; }
public IrOutPortConfig()
{
FileName = "";
}
}
}

View File

@@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core.CrestronIO namespace PepperDash.Essentials.Core.CrestronIO
{ {
[Description("Wrapper class for Digital Input")]
public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput
{ {
public DigitalInput InputPort { get; private set; } public DigitalInput InputPort { get; private set; }
@@ -26,23 +27,78 @@ namespace PepperDash.Essentials.Core.CrestronIO
return () => InputPort.State; return () => InputPort.State;
} }
} }
public GenericDigitalInputDevice(string key, DigitalInput inputPort):
base(key) public GenericDigitalInputDevice(string key, string name, Func<IOPortConfig, DigitalInput> postActivationFunc,
{ IOPortConfig config)
InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc); : base(key, name)
{
InputPort = inputPort;
AddPostActivationAction(() =>
InputPort.StateChange += InputPort_StateChange; {
InputPort = postActivationFunc(config);
}
InputPort.Register();
InputPort.StateChange += InputPort_StateChange;
});
}
#region Events
void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args) void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args)
{ {
InputStateFeedback.FireUpdate(); 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
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new IDigitalInputJoinMap(joinStart); var joinMap = new IDigitalInputJoinMap(joinStart);
@@ -65,98 +121,37 @@ namespace PepperDash.Essentials.Core.CrestronIO
{ {
Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key); Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key);
Debug.Console(1, this, "Error: {0}", e); 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

@@ -14,46 +14,114 @@ namespace PepperDash.Essentials.Core.CrestronIO
{ {
/// <summary> /// <summary>
/// Represents a generic device controlled by relays /// Represents a generic device controlled by relays
/// </summary> /// </summary>
[Description("Wrapper class for a Relay")]
public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput
{ {
public Relay RelayOutput { get; private set; } public Relay RelayOutput { get; private set; }
public BoolFeedback OutputIsOnFeedback { get; private set; } public BoolFeedback OutputIsOnFeedback { get; private set; }
public GenericRelayDevice(string key, Relay relay): //Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor
base(key) public GenericRelayDevice(string key, Relay relay) :
{ base(key)
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State)); {
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
RelayOutput = relay;
RelayOutput.Register(); RelayOutput = relay;
RelayOutput.Register();
RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange);
} 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) void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
{ {
OutputIsOnFeedback.FireUpdate(); OutputIsOnFeedback.FireUpdate();
} }
public void OpenRelay() #endregion
{
RelayOutput.State = false; #region Methods
}
public void OpenRelay()
public void CloseRelay() {
{ RelayOutput.State = false;
RelayOutput.State = true; }
}
public void CloseRelay()
public void ToggleRelayState() {
{ RelayOutput.State = true;
if (RelayOutput.State == true) }
OpenRelay();
else public void ToggleRelayState()
CloseRelay(); {
if (RelayOutput.State == true)
OpenRelay();
else
CloseRelay();
} }
#endregion
#region ISwitchedOutput Members #region ISwitchedOutput Members
@@ -67,8 +135,10 @@ namespace PepperDash.Essentials.Core.CrestronIO
OpenRelay(); OpenRelay();
} }
#endregion #endregion
#region Bridge Linking
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new GenericRelayControllerJoinMap(joinStart); var joinMap = new GenericRelayControllerJoinMap(joinStart);
@@ -98,77 +168,90 @@ namespace PepperDash.Essentials.Core.CrestronIO
// feedback for relay state // feedback for relay state
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); 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;
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice> if (portDevice == null)
{ Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key);
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 else
{ {
// The relay is on another device type var cs = (portDevice as CrestronControlSystem);
if (props.PortNumber > portDevice.NumberOfRelayPorts) if (cs != null)
{ {
Debug.Console(0, "Port Device: {0} does not have enough relays"); // The relay is on a control system processor
return null; 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;
}
} }
}
Relay relay = portDevice.RelayPorts[props.PortNumber];
if (!relay.Registered)
{
if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success)
return new GenericRelayDevice(key, relay);
else else
Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); {
// 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
} }
else */
{
return new GenericRelayDevice(key, relay); }
} }
// Future: Check if portDevice is 3-series card or other non control system that supports versiports #endregion
}
return null;
}
} }
} }

View File

@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
triList.SetBoolSigAction(141, dev.Right); triList.SetBoolSigAction(141, dev.Right);
triList.SetBoolSigAction(142, dev.Select); triList.SetBoolSigAction(142, dev.Select);
triList.SetBoolSigAction(130, dev.Menu); triList.SetBoolSigAction(130, dev.Menu);
triList.SetBoolSigAction(134, dev.Exit); triList.SetBoolSigAction(134, dev.Exit);
} }
public static void UnlinkButtons(this IDPad dev, BasicTriList triList) public static void UnlinkButtons(this IDPad dev, BasicTriList triList)

View File

@@ -43,7 +43,10 @@ namespace PepperDash.Essentials.Core
CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive", CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive",
"Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator); "Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator);
}
CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s => DisableAllDeviceStreamDebugging(), "disableallstreamdebug", "disables stream debugging on all devices", ConsoleAccessLevelEnum.AccessOperator);
}
/// <summary> /// <summary>
/// Calls activate steps on all Device class items /// Calls activate steps on all Device class items
@@ -299,5 +302,81 @@ namespace PepperDash.Essentials.Core
} }
com.SimulateReceive(match.Groups[2].Value); com.SimulateReceive(match.Groups[2].Value);
} }
/// <summary>
/// Attempts to set the debug level of a device
/// </summary>
/// <param name="s"></param>
public static void SetDeviceStreamDebugging(string s)
{
var args = s.Split(' ');
var deviceKey = args[0];
var setting = args[1];
var timeout= String.Empty;
if (args.Length >= 3)
{
timeout = args[2];
}
var device = GetDeviceForKey(deviceKey) as IStreamDebugging;
if (device == null)
{
Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
return;
}
eStreamDebuggingSetting debugSetting;
try
{
debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true);
}
catch
{
Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
return;
}
if (!string.IsNullOrEmpty(timeout))
{
try
{
var min = Convert.ToUInt32(timeout);
device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min);
Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min);
}
catch (Exception e)
{
Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e);
}
}
else
{
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting);
}
}
/// <summary>
/// Sets stream debugging settings to off for all devices
/// </summary>
public static void DisableAllDeviceStreamDebugging()
{
foreach (var device in AllDevices)
{
var streamDevice = device as IStreamDebugging;
if (streamDevice != null)
{
streamDevice.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Off);
}
}
}
} }
} }

View File

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

View File

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

View File

@@ -1,235 +1,236 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced [Description("Wrapper class for a Basic IR Display")]
{ public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
public IrOutputPortController IrPort { get; private set; } {
public ushort IrPulseTime { get; set; } public IrOutputPortController IrPort { get; private set; }
public ushort IrPulseTime { get; set; }
protected override Func<bool> PowerIsOnFeedbackFunc
{ protected override Func<bool> PowerIsOnFeedbackFunc
get { return () => _PowerIsOn; } {
} get { return () => _PowerIsOn; }
protected override Func<bool> IsCoolingDownFeedbackFunc }
{ protected override Func<bool> IsCoolingDownFeedbackFunc
get { return () => _IsCoolingDown; } {
} get { return () => _IsCoolingDown; }
protected override Func<bool> IsWarmingUpFeedbackFunc }
{ protected override Func<bool> IsWarmingUpFeedbackFunc
get { return () => _IsWarmingUp; } {
} get { return () => _IsWarmingUp; }
}
bool _PowerIsOn;
bool _IsWarmingUp; bool _PowerIsOn;
bool _IsCoolingDown; bool _IsWarmingUp;
bool _IsCoolingDown;
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
: base(key, name) public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
{ : base(key, name)
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); {
DeviceManager.AddDevice(IrPort); IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
DeviceManager.AddDevice(IrPort);
PowerIsOnFeedback.OutputChange += (o, a) => {
Debug.Console(2, this, "Power on={0}", _PowerIsOn); PowerIsOnFeedback.OutputChange += (o, a) => {
if (_PowerIsOn) StartWarmingTimer(); Debug.Console(2, this, "Power on={0}", _PowerIsOn);
else StartCoolingTimer(); if (_PowerIsOn) StartWarmingTimer();
}; else StartCoolingTimer();
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); };
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
{ InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, {
eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false),
eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false),
eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false), new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video,
new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false),
eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false), new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false),
eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false), new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false),
eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false), new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
}); eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
} });
}
public void Hdmi1()
{ public void Hdmi1()
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
}
public void Hdmi2()
{ public void Hdmi2()
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
}
public void Hdmi3()
{ public void Hdmi3()
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
}
public void Hdmi4()
{ public void Hdmi4()
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
}
public void Component1()
{ public void Component1()
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
}
public void Video1()
{ public void Video1()
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
}
public void Antenna()
{ public void Antenna()
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime); {
} IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
}
#region IPower Members
#region IPower Members
public override void PowerOn()
{ public override void PowerOn()
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); {
_PowerIsOn = true; IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
PowerIsOnFeedback.FireUpdate(); _PowerIsOn = true;
} PowerIsOnFeedback.FireUpdate();
}
public override void PowerOff()
{ public override void PowerOff()
_PowerIsOn = false; {
PowerIsOnFeedback.FireUpdate(); _PowerIsOn = false;
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); PowerIsOnFeedback.FireUpdate();
} IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
}
public override void PowerToggle()
{ public override void PowerToggle()
_PowerIsOn = false; {
PowerIsOnFeedback.FireUpdate(); _PowerIsOn = false;
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); PowerIsOnFeedback.FireUpdate();
} IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
}
#endregion
#endregion
#region IBasicVolumeControls Members
#region IBasicVolumeControls Members
public void VolumeUp(bool pressRelease)
{ public void VolumeUp(bool pressRelease)
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease); {
} IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
}
public void VolumeDown(bool pressRelease)
{ public void VolumeDown(bool pressRelease)
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease); {
} IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
}
public void MuteToggle()
{ public void MuteToggle()
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200); {
} IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
}
#endregion
#endregion
void StartWarmingTimer()
{ void StartWarmingTimer()
_IsWarmingUp = true; {
IsWarmingUpFeedback.FireUpdate(); _IsWarmingUp = true;
new CTimer(o => { IsWarmingUpFeedback.FireUpdate();
_IsWarmingUp = false; new CTimer(o => {
IsWarmingUpFeedback.FireUpdate(); _IsWarmingUp = false;
}, 10000); IsWarmingUpFeedback.FireUpdate();
} }, 10000);
}
void StartCoolingTimer()
{ void StartCoolingTimer()
_IsCoolingDown = true; {
IsCoolingDownFeedback.FireUpdate(); _IsCoolingDown = true;
new CTimer(o => IsCoolingDownFeedback.FireUpdate();
{ new CTimer(o =>
_IsCoolingDown = false; {
IsCoolingDownFeedback.FireUpdate(); _IsCoolingDown = false;
}, 7000); IsCoolingDownFeedback.FireUpdate();
} }, 7000);
}
#region IRoutingSink Members
#region IRoutingSink Members
/// <summary>
/// Typically called by the discovery routing algorithm. /// <summary>
/// </summary> /// Typically called by the discovery routing algorithm.
/// <param name="inputSelector">A delegate containing the input selector method to call</param> /// </summary>
public override void ExecuteSwitch(object inputSelector) /// <param name="inputSelector">A delegate containing the input selector method to call</param>
{ public override void ExecuteSwitch(object inputSelector)
Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString()); {
Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
Action finishSwitch = () =>
{ Action finishSwitch = () =>
var action = inputSelector as Action; {
if (action != null) var action = inputSelector as Action;
action(); if (action != null)
}; action();
};
if (!PowerIsOnFeedback.BoolValue)
{ if (!PowerIsOnFeedback.BoolValue)
PowerOn(); {
EventHandler<FeedbackEventArgs> oneTimer = null; PowerOn();
oneTimer = (o, a) => EventHandler<FeedbackEventArgs> oneTimer = null;
{ oneTimer = (o, a) =>
if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming {
IsWarmingUpFeedback.OutputChange -= oneTimer; if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming
finishSwitch(); IsWarmingUpFeedback.OutputChange -= oneTimer;
}; finishSwitch();
IsWarmingUpFeedback.OutputChange += oneTimer; };
} IsWarmingUpFeedback.OutputChange += oneTimer;
else // Do it! }
finishSwitch(); else // Do it!
} finishSwitch();
}
#endregion
#endregion
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); {
} LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
} }
}
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
{ public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
public BasicIrDisplayFactory() {
{ public BasicIrDisplayFactory()
TypeNames = new List<string>() { "basicirdisplay" }; {
} TypeNames = new List<string>() { "basicirdisplay" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{ public override EssentialsDevice BuildDevice(DeviceConfig dc)
Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device"); {
var ir = IRPortHelper.GetIrPort(dc.Properties); Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device");
if (ir != null) var ir = IRPortHelper.GetIrPort(dc.Properties);
{ if (ir != null)
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName); {
display.IrPulseTime = 200; // Set default pulse time for IR commands. var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
return display; display.IrPulseTime = 200; // Set default pulse time for IR commands.
} return display;
}
return null;
} return null;
} }
}
} }

View File

@@ -105,7 +105,9 @@ namespace PepperDash.Essentials.Core.Fusion
// Default poll time is 5 min unless overridden by config value // Default poll time is 5 min unless overridden by config value
public long SchedulePollInterval = 300000; public long SchedulePollInterval = 300000;
public long PushNotificationTimeout = 5000; public long PushNotificationTimeout = 5000;
private const string RemoteOccupancyXml = "<Occupancy><Type>Local</Type><State>{0}</State></Occupancy>";
protected Dictionary<int, FusionAsset> FusionStaticAssets; protected Dictionary<int, FusionAsset> FusionStaticAssets;
@@ -115,7 +117,10 @@ namespace PepperDash.Essentials.Core.Fusion
// For use with occ sensor attached to a scheduling panel in Fusion // For use with occ sensor attached to a scheduling panel in Fusion
protected FusionOccupancySensorAsset FusionOccSensor; protected FusionOccupancySensorAsset FusionOccSensor;
public BoolFeedback RoomIsOccupiedFeedback { get; private set; } public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
private string _roomOccupancyRemoteString;
public StringFeedback RoomOccupancyRemoteStringFeedback { get; private set; }
protected Func<bool> RoomIsOccupiedFeedbackFunc protected Func<bool> RoomIsOccupiedFeedbackFunc
{ {
@@ -1365,14 +1370,24 @@ namespace PepperDash.Essentials.Core.Fusion
var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig); var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig);
// Tie to method on occupancy object // Tie to method on occupancy object
//occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b)); //occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b));
RoomOccupancyRemoteStringFeedback = new StringFeedback(() => _roomOccupancyRemoteString);
Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
Room.RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
RoomOccupancyRemoteStringFeedback.LinkInputSig(occSensorAsset.RoomOccupancyInfo.InputSig);
Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
//} //}
} }
/// <summary> void RoomIsOccupiedFeedback_OutputChange(object sender, FeedbackEventArgs e)
{
_roomOccupancyRemoteString = String.Format(RemoteOccupancyXml, e.BoolValue ? "Occupied" : "Unoccupied");
RoomOccupancyRemoteStringFeedback.FireUpdate();
}
/// <summary>
/// Helper to get the number from the end of a device's key string /// Helper to get the number from the end of a device's key string
/// </summary> /// </summary>
/// <returns>-1 if no number matched</returns> /// <returns>-1 if no number matched</returns>

View File

@@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Gateways;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for Crestron Infinet-EX Gateways")]
public class CenRfgwController : CrestronGenericBaseDevice
{
private GatewayBase _Gateway;
public GatewayBase GateWay { get { return _Gateway; } }
/// <summary>
/// Constructor for the on-board gateway
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public CenRfgwController(string key, string name, GatewayBase gateway) :
base(key, name, gateway)
{
_Gateway = gateway;
}
public static CenRfgwController GetNewExGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType)
{
eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true);
try
{
var cs = Global.ControlSystem;
GatewayBase gw = null;
switch (type)
{
case eExGatewayType.Ethernet:
gw = new CenRfgwEx(ipId, cs);
break;
case eExGatewayType.EthernetShared:
gw = new CenRfgwExEthernetSharable(ipId, cs);
break;
case eExGatewayType.Cresnet:
gw = new CenRfgwExCresnet(cresnetId, cs);
break;
}
return new CenRfgwController(key, name, gw);
}
catch (Exception)
{
Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", type == eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType);
return null;
}
}
public static CenRfgwController GetNewErGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType)
{
eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true);
try
{
var cs = Global.ControlSystem;
GatewayBase gw = null;
switch (type)
{
case eExGatewayType.Ethernet:
gw = new CenErfgwPoe(ipId, cs);
break;
case eExGatewayType.EthernetShared:
gw = new CenErfgwPoeEthernetSharable(ipId, cs);
break;
case eExGatewayType.Cresnet:
gw = new CenErfgwPoeCresnet(cresnetId, cs);
break;
}
return new CenRfgwController(key, name, gw);
}
catch (Exception)
{
Debug.Console(0, "ERROR: Cannot create ER Gateway, id {0}, type {1}", type== eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType);
return null;
}
}
}
public enum eExGatewayType
{
Ethernet, EthernetShared, Cresnet
}
#region Factory
public class CenRfgwControllerFactory : EssentialsDeviceFactory<CenRfgwController>
{
public CenRfgwControllerFactory()
{
TypeNames = new List<string>() { "cenrfgwex", "cenerfgwpoe" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device");
var props = JsonConvert.DeserializeObject<EssentialsRfGatewayConfig>(dc.Properties.ToString());
var type = dc.Type.ToLower();
var control = props.Control;
var ipid = control.IpIdInt;
var cresnetId = control.CresnetIdInt;
var gatewayType = props.GatewayType;
switch (type)
{
case ("cenrfgwex"):
return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name,
(ushort)ipid, (ushort)cresnetId, gatewayType);
case ("cenerfgwpoe"):
return CenRfgwController.GetNewErGatewayController(dc.Key, dc.Name,
(ushort)ipid, (ushort)cresnetId, gatewayType);
default:
return null;
}
}
}
#endregion
}

View File

@@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Core
{
public class EssentialsRfGatewayConfig
{
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("gatewayType")]
public string GatewayType { get; set; }
}
}

View File

@@ -17,8 +17,8 @@ namespace PepperDash.Essentials.Core
{ {
public static class Global public static class Global
{ {
public static CrestronControlSystem ControlSystem { get; set; } public static CrestronControlSystem ControlSystem { get; set; }
public static LicenseManager LicenseManager { get; set; } public static LicenseManager LicenseManager { get; set; }
/// <summary> /// <summary>

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using Crestron.SimplSharp.Reflection; using Crestron.SimplSharp.Reflection;
using PepperDash.Core; using PepperDash.Core;
@@ -345,8 +346,10 @@ namespace PepperDash.Essentials.Core
/// <summary> /// <summary>
/// Metadata describing the join /// Metadata describing the join
/// </summary> /// </summary>
public class JoinMetadata public class JoinMetadata
{ {
private string _description;
/// <summary> /// <summary>
/// Join number (based on join offset value) /// Join number (based on join offset value)
/// </summary> /// </summary>
@@ -361,10 +364,17 @@ namespace PepperDash.Essentials.Core
public uint JoinSpan { get; set; } public uint JoinSpan { get; set; }
/// <summary> /// <summary>
/// A label for the join to better describe it's usage /// A label for the join to better describe its usage
/// </summary> /// </summary>
[JsonProperty("label")] [Obsolete("Use Description instead")]
public string Label { get; set; } [JsonProperty("label")]
public string Label { get { return _description; } set { _description = value; } }
/// <summary>
/// A description for the join to better describe its usage
/// </summary>
[JsonProperty("description")]
public string Description { get { return _description; } set { _description = value; } }
/// <summary> /// <summary>
/// Signal type(s) /// Signal type(s)
/// </summary> /// </summary>
@@ -454,11 +464,13 @@ namespace PepperDash.Essentials.Core
name = attribute.Name; name = attribute.Name;
Debug.Console(2, "JoinName Attribute value: {0}", name); Debug.Console(2, "JoinName Attribute value: {0}", name);
return name; return name;
} }
} }
[AttributeUsage(AttributeTargets.All)] [AttributeUsage(AttributeTargets.All)]
public class JoinNameAttribute : Attribute public class JoinNameAttribute : CAttribute
{ {
private string _Name; private string _Name;
@@ -472,5 +484,5 @@ namespace PepperDash.Essentials.Core
{ {
get { return _Name; } get { return _Name; }
} }
} }
} }

View File

@@ -62,6 +62,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath> <HintPath>..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
</Reference> </Reference>
<Reference Include="Crestron.SimplSharpPro.Gateways, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
</Reference>
<Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL"> <Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath> <HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll</HintPath>
@@ -129,15 +133,23 @@
<Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\GenericLightingJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\GenericRelayControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\GlsOccupancySensorBaseJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\GlsOccupancySensorBaseJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdNxM4kEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\HdMdxxxCEControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\Hrxxx0WirelessRemoteControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\IBasicCommunicationJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\IDigitalInputJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\SetTopBoxControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\StatusSignControllerJoinMap.cs" />
<Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" /> <Compile Include="Bridges\JoinMaps\SystemMonitorJoinMap.cs" />
<Compile Include="Config\Comm and IR\CecPortController.cs" /> <Compile Include="Comm and IR\CecPortController.cs" />
<Compile Include="Config\Comm and IR\GenericComm.cs" /> <Compile Include="Comm and IR\CommFactory.cs" />
<Compile Include="Config\Comm and IR\GenericHttpClient.cs" /> <Compile Include="Comm and IR\CommunicationExtras.cs" />
<Compile Include="Comm and IR\ComPortController.cs" />
<Compile Include="Comm and IR\ComSpecJsonConverter.cs" />
<Compile Include="Comm and IR\ConsoleCommMockDevice.cs" />
<Compile Include="Comm and IR\GenericComm.cs" />
<Compile Include="Comm and IR\GenericHttpClient.cs" />
<Compile Include="Comm and IR\IRPortHelper.cs" />
<Compile Include="Config\Essentials\ConfigUpdater.cs" /> <Compile Include="Config\Essentials\ConfigUpdater.cs" />
<Compile Include="Config\Essentials\ConfigReader.cs" /> <Compile Include="Config\Essentials\ConfigReader.cs" />
<Compile Include="Config\Essentials\ConfigWriter.cs" /> <Compile Include="Config\Essentials\ConfigWriter.cs" />
@@ -158,6 +170,7 @@
<Compile Include="Devices\DeviceFeedbackExtensions.cs" /> <Compile Include="Devices\DeviceFeedbackExtensions.cs" />
<Compile Include="Devices\EssentialsBridgeableDevice.cs" /> <Compile Include="Devices\EssentialsBridgeableDevice.cs" />
<Compile Include="Devices\EssentialsDevice.cs" /> <Compile Include="Devices\EssentialsDevice.cs" />
<Compile Include="Devices\IProjectorInterfaces.cs" />
<Compile Include="Devices\PC\InRoomPc.cs" /> <Compile Include="Devices\PC\InRoomPc.cs" />
<Compile Include="Devices\PC\Laptop.cs" /> <Compile Include="Devices\PC\Laptop.cs" />
<Compile Include="Devices\ReconfigurableDevice.cs" /> <Compile Include="Devices\ReconfigurableDevice.cs" />
@@ -175,6 +188,8 @@
<Compile Include="Fusion\FusionEventHandlers.cs" /> <Compile Include="Fusion\FusionEventHandlers.cs" />
<Compile Include="Fusion\FusionProcessorQueries.cs" /> <Compile Include="Fusion\FusionProcessorQueries.cs" />
<Compile Include="Fusion\FusionRviDataClasses.cs" /> <Compile Include="Fusion\FusionRviDataClasses.cs" />
<Compile Include="Gateways\CenRfgwController.cs" />
<Compile Include="Gateways\EssentialsRfGatewayConfig.cs" />
<Compile Include="Global\JobTimer.cs" /> <Compile Include="Global\JobTimer.cs" />
<Compile Include="Global\Scheduler.cs" /> <Compile Include="Global\Scheduler.cs" />
<Compile Include="JoinMaps\JoinMapBase.cs" /> <Compile Include="JoinMaps\JoinMapBase.cs" />
@@ -187,11 +202,6 @@
<Compile Include="Presets\PresetBase.cs" /> <Compile Include="Presets\PresetBase.cs" />
<Compile Include="Plugins\IPluginDeviceFactory.cs" /> <Compile Include="Plugins\IPluginDeviceFactory.cs" />
<Compile Include="Ramps and Increments\ActionIncrementer.cs" /> <Compile Include="Ramps and Increments\ActionIncrementer.cs" />
<Compile Include="Config\Comm and IR\CommFactory.cs" />
<Compile Include="Config\Comm and IR\CommunicationExtras.cs" />
<Compile Include="Config\Comm and IR\ComSpecJsonConverter.cs" />
<Compile Include="Config\Comm and IR\ConsoleCommMockDevice.cs" />
<Compile Include="Config\Comm and IR\IRPortHelper.cs" />
<Compile Include="Config\BasicConfig.cs" /> <Compile Include="Config\BasicConfig.cs" />
<Compile Include="Config\ConfigPropertiesHelpers.cs" /> <Compile Include="Config\ConfigPropertiesHelpers.cs" />
<Compile Include="Config\InfoConfig.cs" /> <Compile Include="Config\InfoConfig.cs" />
@@ -220,6 +230,9 @@
<Compile Include="Feedbacks\BoolFeedbackOneShot.cs" /> <Compile Include="Feedbacks\BoolFeedbackOneShot.cs" />
<Compile Include="Ramps and Increments\NumericalHelpers.cs" /> <Compile Include="Ramps and Increments\NumericalHelpers.cs" />
<Compile Include="Ramps and Increments\UshortSigIncrementer.cs" /> <Compile Include="Ramps and Increments\UshortSigIncrementer.cs" />
<Compile Include="Remotes\ButtonExtensions.cs" />
<Compile Include="Remotes\CrestronRemotePropertiesConfig.cs" />
<Compile Include="Remotes\Hrxx0WirelessRemoteController.cs" />
<Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" /> <Compile Include="Room\Behaviours\RoomOnToDefaultSourceWhenOccupied.cs" />
<Compile Include="Room\EssentialsRoomBase.cs" /> <Compile Include="Room\EssentialsRoomBase.cs" />
<Compile Include="Room\Interfaces.cs" /> <Compile Include="Room\Interfaces.cs" />
@@ -275,7 +288,6 @@
<Compile Include="UI PageManagers\PageManager.cs" /> <Compile Include="UI PageManagers\PageManager.cs" />
<Compile Include="UI PageManagers\SetTopBoxTwoPanelPageManager.cs" /> <Compile Include="UI PageManagers\SetTopBoxTwoPanelPageManager.cs" />
<Compile Include="VideoStatus\VideoStatusOutputs.cs" /> <Compile Include="VideoStatus\VideoStatusOutputs.cs" />
<Compile Include="Config\Comm and IR\ComPortController.cs" />
<Compile Include="Crestron\CrestronGenericBaseDevice.cs" /> <Compile Include="Crestron\CrestronGenericBaseDevice.cs" />
<Compile Include="DeviceControlsParentInterfaces\IPresentationSource.cs" /> <Compile Include="DeviceControlsParentInterfaces\IPresentationSource.cs" />
<Compile Include="Devices\DeviceManager.cs" /> <Compile Include="Devices\DeviceManager.cs" />

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public static class ButtonExtensions
{
public static Button SetButtonAction(this Button button, Action<bool> a)
{
button.UserObject = a;
return button;
}
public static Button SetButtonAction(this CrestronCollection<Button> bc, uint sigNum, Action<bool> a)
{
return bc[sigNum].SetButtonAction(a);
}
public static bool GetBool(this CrestronCollection<Button> bc, uint sigNum)
{
return bc[sigNum].State == eButtonState.Pressed ? true : false;
}
public static Button SetButtonPressedAction(this CrestronCollection<Button> bc, uint sigNum, Action a)
{
return bc[sigNum].SetButtonAction(b => { if (b) a(); });
}
public static Button SetButtonReleasedAction(this CrestronCollection<Button> bc, uint sigNum, Action a)
{
return bc[sigNum].SetButtonAction(b => { if (!b) a(); });
}
public static Button SetButtonFalseAction(this Button button, Action a)
{
return button.SetButtonAction(b => { if (!b) a(); });
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using PepperDash.Core;
namespace PepperDash.Essentials.Core
{
public class CrestronRemotePropertiesConfig
{
[JsonProperty("control")]
public EssentialsControlPropertiesConfig Control { get; set; }
[JsonProperty("gatewayDeviceKey")]
public string GatewayDeviceKey { get; set; }
}
}

View File

@@ -0,0 +1,245 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Gateways;
using Crestron.SimplSharpPro.Remotes;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core
{
[Description("Wrapper class for all HR-Series remotes")]
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback
{
private Hr1x0WirelessRemoteBase _remote;
public FeedbackCollection<Feedback> Feedbacks { get; set; }
public CrestronCollection<Button> Buttons { get { return _remote.Button; } }
public Hrxx0WirelessRemoteController(string key, Func<DeviceConfig, Hr1x0WirelessRemoteBase> preActivationFunc,
DeviceConfig config)
: base(key, config.Name)
{
Feedbacks = new FeedbackCollection<Feedback>();
AddPreActivationAction(() =>
{
_remote = preActivationFunc(config);
_remote.ButtonStateChange += new ButtonEventHandler(_remote_ButtonStateChange);
Feedbacks.Add(new BoolFeedback("BatteryCritical", () => _remote.BatteryCriticalFeedback.BoolValue));
Feedbacks.Add(new BoolFeedback("BatteryLow", () => _remote.BatteryLowFeedback.BoolValue));
Feedbacks.Add(new IntFeedback("BatteryVoltage", () => _remote.BatteryVoltageFeedback.UShortValue));
_remote.BaseEvent += new BaseEventHandler(_remote_BaseEvent);
});
}
void _remote_BaseEvent(GenericBase device, BaseEventArgs args)
{
if(args.EventId == Hr1x0EventIds.BatteryCriticalFeedbackEventId)
Feedbacks["BatteryCritical"].FireUpdate();
if(args.EventId == Hr1x0EventIds.BatteryLowFeedbackEventId)
Feedbacks["BatteryLow"].FireUpdate();
if(args.EventId == Hr1x0EventIds.BatteryVoltageFeedbackEventId)
Feedbacks["BatteryVoltage"].FireUpdate();
}
void _remote_ButtonStateChange(GenericBase device, ButtonEventArgs args)
{
try
{
var handler = args.Button.UserObject;
if (handler == null) return;
Debug.Console(1, this, "Executing Action: {0}", handler.ToString());
if (handler is Action<bool>)
{
(handler as Action<bool>)(args.Button.State == eButtonState.Pressed ? true : false);
}
}
catch (Exception e)
{
Debug.Console(2, this, "Error in ButtonStateChange handler: {0}", e);
}
}
#region Preactivation
private static Hr1x0WirelessRemoteBase GetHr1x0WirelessRemote(DeviceConfig config)
{
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
var type = config.Type;
var rfId = (uint)props.Control.InfinetIdInt;
GatewayBase gateway;
if (props.GatewayDeviceKey == "processor")
{
gateway = Global.ControlSystem.ControllerRFGatewayDevice;
}
else
{
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
return null;
}
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
gateway = gatewayDev.GateWay;
}
if (gateway == null)
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid gateway", props.GatewayDeviceKey);
return null;
}
switch (type)
{
case ("hr100"):
return new Hr100(rfId, gateway);
case ("hr150"):
return new Hr150(rfId, gateway);
case ("hr310"):
return new Hr310(rfId, gateway);
default:
return null;
}
}
static void gateway_BaseEvent(GenericBase device, BaseEventArgs args)
{
throw new NotImplementedException();
}
#endregion
#region Factory
public class Hrxx0WirelessRemoteControllerFactory : EssentialsDeviceFactory<Hrxx0WirelessRemoteController>
{
public Hrxx0WirelessRemoteControllerFactory()
{
TypeNames = new List<string>() { "hr100", "hr150", "hr310" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new HR-x00 Remote Device");
return new Hrxx0WirelessRemoteController(dc.Key, GetHr1x0WirelessRemote, dc);
}
}
#endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new Hrxxx0WirelessRemoteControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<Hrxxx0WirelessRemoteControllerJoinMap>(joinMapSerialized);
bridge.AddJoinMap(Key, joinMap);
//List<string> ExcludedKeys = new List<string>();
foreach (var feedback in Feedbacks)
{
var myFeedback = feedback;
var joinData =
joinMap.Joins.FirstOrDefault(
x =>
x.Key.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase));
if (string.IsNullOrEmpty((joinData.Key))) continue;
var name = joinData.Key;
var join = joinData.Value;
if (join.Metadata.JoinType == eJoinType.Digital)
{
Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", name, join.JoinNumber);
var someFeedback = myFeedback as BoolFeedback;
if(someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.BooleanInput[join.JoinNumber]);
}
if (join.Metadata.JoinType == eJoinType.Analog)
{
Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", name, join.JoinNumber);
var someFeedback = myFeedback as IntFeedback;
if (someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.UShortInput[join.JoinNumber]);
}
if (join.Metadata.JoinType == eJoinType.Serial)
{
Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", name, join.JoinNumber);
var someFeedback = myFeedback as StringFeedback;
if (someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.StringInput[join.JoinNumber]);
}
}
//var newJoinKeys = joinMap.Joins.Keys.Except(ExcludedKeys).ToList();
//var newJoinMap = newJoinKeys.Where(k => joinMap.Joins.ContainsKey(k)).Select(k => joinMap.Joins[k]);
Debug.Console(2, this, "There are {0} remote buttons", _remote.Button.Count);
for (uint i = 1; i <= _remote.Button.Count; i++)
{
Debug.Console(2, this, "Attempting to link join index {0}", i);
var index = i;
var joinData =
joinMap.Joins.FirstOrDefault(
o =>
o.Key.Equals(_remote.Button[index].Name.ToString(),
StringComparison.InvariantCultureIgnoreCase));
if (string.IsNullOrEmpty((joinData.Key))) continue;
var join = joinData.Value;
var name = joinData.Key;
Debug.Console(2, this, "Setting User Object for '{0}'", name);
if (join.Metadata.JoinType == eJoinType.Digital)
{
_remote.Button[i].SetButtonAction((b) => trilist.BooleanInput[join.JoinNumber].BoolValue = b);
}
}
trilist.OnlineStatusChange += (d, args) =>
{
if (!args.DeviceOnLine) return;
foreach (var feedback in Feedbacks)
{
feedback.FireUpdate();
}
};
}
public void SetTrilistBool(BasicTriList trilist, uint join, bool b)
{
trilist.BooleanInput[join].BoolValue = b;
}
}
}

View File

@@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Core
/// and then attempts a new Route and if sucessful, stores that RouteDescriptor /// and then attempts a new Route and if sucessful, stores that RouteDescriptor
/// in RouteDescriptorCollection.DefaultCollection /// in RouteDescriptorCollection.DefaultCollection
/// </summary> /// </summary>
public static void ReleaseAndMakeRoute(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType) public static void ReleaseAndMakeRoute(this IRoutingSink destination, IRoutingOutputs source, eRoutingSignalType signalType)
{ {
destination.ReleaseRoute(); destination.ReleaseRoute();
@@ -39,7 +39,7 @@ namespace PepperDash.Essentials.Core
/// RouteDescriptorCollection.DefaultCollection /// RouteDescriptorCollection.DefaultCollection
/// </summary> /// </summary>
/// <param name="destination"></param> /// <param name="destination"></param>
public static void ReleaseRoute(this IRoutingInputs destination) public static void ReleaseRoute(this IRoutingSink destination)
{ {
var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination); var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination);
if (current != null) if (current != null)
@@ -56,7 +56,7 @@ namespace PepperDash.Essentials.Core
/// of an audio/video route are discovered a route descriptor is returned. If no route is /// of an audio/video route are discovered a route descriptor is returned. If no route is
/// discovered, then null is returned /// discovered, then null is returned
/// </summary> /// </summary>
public static RouteDescriptor GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType) public static RouteDescriptor GetRouteToSource(this IRoutingSink destination, IRoutingOutputs source, eRoutingSignalType signalType)
{ {
var routeDescr = new RouteDescriptor(source, destination, signalType); var routeDescr = new RouteDescriptor(source, destination, signalType);
// if it's a single signal type, find the route // if it's a single signal type, find the route
@@ -152,7 +152,7 @@ namespace PepperDash.Essentials.Core
if (outputPortToUse == null) if (outputPortToUse == null)
{ {
// it's a sink device // it's a sink device
routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort)); routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort));
} }
else if (destination is IRouting) else if (destination is IRouting)
{ {
@@ -265,14 +265,20 @@ namespace PepperDash.Essentials.Core
foreach (var route in Routes) foreach (var route in Routes)
{ {
Debug.Console(2, "ExecuteRoutes: {0}", route.ToString()); Debug.Console(2, "ExecuteRoutes: {0}", route.ToString());
if (route.SwitchingDevice is IRoutingSinkWithSwitching) if (route.SwitchingDevice is IRoutingSink)
(route.SwitchingDevice as IRoutingSinkWithSwitching).ExecuteSwitch(route.InputPort.Selector); {
else if (route.SwitchingDevice is IRouting) var device = route.SwitchingDevice as IRoutingSinkWithSwitching;
{ if (device == null)
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType); continue;
route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType);
Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue); device.ExecuteSwitch(route.InputPort.Selector);
} }
else if (route.SwitchingDevice is IRouting)
{
(route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType);
route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType);
Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue);
}
} }
} }

View File

@@ -1,109 +1,120 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using PepperDash.Core; using PepperDash.Core;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// The handler type for a Room's SourceInfoChange /// The handler type for a Room's SourceInfoChange
/// </summary> /// </summary>
public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type); public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type);
//******************************************************************************************* //*******************************************************************************************
// Interfaces // Interfaces
/// <summary> /// <summary>
/// For rooms with a single presentation source, change event /// For rooms with a single presentation source, change event
/// </summary> /// </summary>
public interface IHasCurrentSourceInfoChange public interface IHasCurrentSourceInfoChange
{ {
string CurrentSourceInfoKey { get; set; } string CurrentSourceInfoKey { get; set; }
SourceListItem CurrentSourceInfo { get; set; } SourceListItem CurrentSourceInfo { get; set; }
event SourceInfoChangeHandler CurrentSourceChange; event SourceInfoChangeHandler CurrentSourceChange;
} }
/// <summary> /// <summary>
/// Defines a class that has a collection of RoutingInputPorts /// Defines a class that has a collection of RoutingInputPorts
/// </summary> /// </summary>
public interface IRoutingInputs : IKeyed public interface IRoutingInputs : IKeyed
{ {
RoutingPortCollection<RoutingInputPort> InputPorts { get; } RoutingPortCollection<RoutingInputPort> InputPorts { get; }
} }
/// <summary> /// <summary>
/// Defines a class that has a collection of RoutingOutputPorts /// Defines a class that has a collection of RoutingOutputPorts
/// </summary> /// </summary>
public interface IRoutingOutputs : IKeyed public interface IRoutingOutputs : IKeyed
{ {
RoutingPortCollection<RoutingOutputPort> OutputPorts { get; } RoutingPortCollection<RoutingOutputPort> OutputPorts { get; }
} }
/// <summary> /// <summary>
/// For fixed-source endpoint devices /// For fixed-source endpoint devices
/// </summary> /// </summary>
public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange
{ {
} }
/// <summary> /// <summary>
/// Endpoint device like a display, that selects inputs /// For fixed-source endpoint devices
/// </summary> /// </summary>
public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching, IHasCurrentSourceInfoChange [Obsolete]
{ public interface IRoutingSinkNoSwitching : IRoutingSink
//void ClearRoute(); {
void ExecuteSwitch(object inputSelector);
} }
/// <summary> /// <summary>
/// For devices like RMCs, baluns, other devices with no switching. /// Endpoint device like a display, that selects inputs
/// </summary> /// </summary>
public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs public interface IRoutingSinkWithSwitching : IRoutingSink
{ {
} //void ClearRoute();
void ExecuteSwitch(object inputSelector);
/// <summary> }
/// Defines a midpoint device as have internal routing. Any devices in the middle of the
/// signal chain, that do switching, must implement this for routing to work otherwise /// <summary>
/// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough /// For devices like RMCs, baluns, other devices with no switching.
/// device. /// </summary>
/// </summary> public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs
public interface IRouting : IRoutingInputsOutputs {
{ }
//void ClearRoute(object outputSelector);
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType); /// <summary>
} /// Defines a midpoint device as have internal routing. Any devices in the middle of the
/// signal chain, that do switching, must implement this for routing to work otherwise
public interface ITxRouting : IRouting /// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough
{ /// device.
IntFeedback VideoSourceNumericFeedback { get; } /// </summary>
IntFeedback AudioSourceNumericFeedback { get; } public interface IRouting : IRoutingInputsOutputs
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); {
void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType);
}
public interface IRoutingNumeric : IRouting
{
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
}
public interface ITxRouting : IRoutingNumeric
{
IntFeedback VideoSourceNumericFeedback { get; }
IntFeedback AudioSourceNumericFeedback { get; }
} }
/// <summary> /// <summary>
/// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C)
/// </summary> /// </summary>
public interface IRmcRouting : IRouting public interface IRmcRouting : IRoutingNumeric
{ {
IntFeedback AudioVideoSourceNumericFeedback { get; } IntFeedback AudioVideoSourceNumericFeedback { get; }
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); }
}
/// <summary>
/// <summary> /// Defines an IRoutingOutputs devices as being a source - the start of the chain
/// Defines an IRoutingOutputs devices as being a source - the start of the chain /// </summary>
/// </summary> public interface IRoutingSource : IRoutingOutputs
public interface IRoutingSource : IRoutingOutputs {
{ }
}
} }

View File

@@ -16,7 +16,8 @@ using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM.AirMedia namespace PepperDash.Essentials.DM.AirMedia
{ {
public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IIROutputPorts, IComPorts [Description("Wrapper class for an AM-200 or AM-300")]
public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumeric, IIROutputPorts, IComPorts
{ {
public AmX00 AirMedia { get; private set; } public AmX00 AirMedia { get; private set; }
@@ -40,7 +41,7 @@ namespace PepperDash.Essentials.DM.AirMedia
public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; } public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; }
public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props) public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
:base(key, name, device) : base(key, name, device)
{ {
AirMedia = device; AirMedia = device;
@@ -51,27 +52,30 @@ namespace PepperDash.Essentials.DM.AirMedia
InputPorts = new RoutingPortCollection<RoutingInputPort>(); InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>(); OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.Audio | eRoutingSignalType.Video, InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)); eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this));
InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)); eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this));
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)); eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this));
InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video, InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)); eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this));
if (AirMedia is Am300) if (AirMedia is Am300)
{ {
InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this)); eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this));
} }
OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
eRoutingPortConnectionType.Hdmi, null, this));
AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange); AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange);
IsInSessionFeedback = new BoolFeedback( new Func<bool>(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0 )); IsInSessionFeedback = new BoolFeedback(new Func<bool>(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0));
ErrorFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.ErrorFeedback.UShortValue)); ErrorFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.ErrorFeedback.UShortValue));
NumberOfUsersConnectedFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue)); NumberOfUsersConnectedFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue));
LoginCodeFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue)); LoginCodeFeedback = new IntFeedback(new Func<int>(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue));
@@ -202,7 +206,7 @@ namespace PepperDash.Essentials.DM.AirMedia
/// </summary> /// </summary>
public void SelectDmIn() public void SelectDmIn()
{ {
AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.HDMI; AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM;
} }
/// <summary> /// <summary>
@@ -210,7 +214,7 @@ namespace PepperDash.Essentials.DM.AirMedia
/// </summary> /// </summary>
public void SelectHdmiIn() public void SelectHdmiIn()
{ {
AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM; AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.HDMI;
} }
public void SelectAirboardIn() public void SelectAirboardIn()
@@ -259,6 +263,33 @@ namespace PepperDash.Essentials.DM.AirMedia
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType signalType)
{
if ((signalType & eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
if (!Enum.IsDefined(typeof (AmX00DisplayControl.eAirMediaX00VideoSource), input))
{
Debug.Console(2, this, "Invalid Video Source Index : {0}", input);
return;
}
AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource) input;
}
#endregion
#region IRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
Debug.Console(2, this, "Input Selector = {0}", inputSelector.ToString());
var handler = inputSelector as Action;
if (handler == null) return;
handler();
}
#endregion
} }
public class AirMediaControllerFactory : EssentialsDeviceFactory<AirMediaController> public class AirMediaControllerFactory : EssentialsDeviceFactory<AirMediaController>
@@ -282,7 +313,7 @@ namespace PepperDash.Essentials.DM.AirMedia
amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem); amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props); return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props);
} }
} }
} }

View File

@@ -21,7 +21,8 @@ namespace PepperDash.Essentials.DM {
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
{
public DMChassisPropertiesConfig PropertiesConfig { get; set; } public DMChassisPropertiesConfig PropertiesConfig { get; set; }
public Switch Chassis { get; private set; } public Switch Chassis { get; private set; }
@@ -563,14 +564,23 @@ namespace PepperDash.Essentials.DM {
var outCard = input == 0 ? null : Chassis.Outputs[output]; var outCard = input == 0 ? null : Chassis.Outputs[output];
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) { if ((sigType | eRoutingSignalType.Video) != eRoutingSignalType.Video) return;
Chassis.VideoEnter.BoolValue = true; Chassis.VideoEnter.BoolValue = true;
Chassis.Outputs[output].VideoOut = inCard; Chassis.Outputs[output].VideoOut = inCard;
}
} }
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
}
#endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new DmBladeChassisControllerJoinMap(joinStart); var joinMap = new DmBladeChassisControllerJoinMap(joinStart);
@@ -808,6 +818,7 @@ namespace PepperDash.Essentials.DM {
}); });
} }
} }
} }
/* /*

View File

@@ -21,7 +21,7 @@ namespace PepperDash.Essentials.DM
/// ///
/// </summary> /// </summary>
[Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")] [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")]
public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric
{ {
public DMChassisPropertiesConfig PropertiesConfig { get; set; } public DMChassisPropertiesConfig PropertiesConfig { get; set; }
@@ -1094,6 +1094,15 @@ namespace PepperDash.Essentials.DM
} }
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
}
#endregion
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new DmChassisControllerJoinMap(joinStart); var joinMap = new DmChassisControllerJoinMap(joinStart);

View File

@@ -18,8 +18,8 @@ using PepperDash.Essentials.DM.Config;
using Feedback = PepperDash.Essentials.Core.Feedback; using Feedback = PepperDash.Essentials.Core.Feedback;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
public class DmpsRoutingController : EssentialsBridgeableDevice, IRouting, IHasFeedback public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumeric, IHasFeedback
{ {
public CrestronControlSystem Dmps { get; set; } public CrestronControlSystem Dmps { get; set; }
public ISystemControl SystemControl { get; private set; } public ISystemControl SystemControl { get; private set; }
@@ -661,8 +661,6 @@ namespace PepperDash.Essentials.DM
} }
} }
} }
///
/// </summary>
void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args) void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args)
{ {
Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString()); Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString());
@@ -724,10 +722,7 @@ namespace PepperDash.Essentials.DM
{ {
if (RouteOffTimers.ContainsKey(pnt)) if (RouteOffTimers.ContainsKey(pnt))
return; return;
RouteOffTimers[pnt] = new CTimer(o => RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(0, pnt.Number, pnt.Type), RouteOffTime);
{
ExecuteSwitch(0, pnt.Number, pnt.Type);
}, RouteOffTime);
} }
#region IRouting Members #region IRouting Members
@@ -809,6 +804,15 @@ namespace PepperDash.Essentials.DM
} }
} }
#endregion #endregion
#region IRoutingNumeric Members
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType)
{
ExecuteSwitch(inputSelector, outputSelector, sigType);
}
#endregion
} }
} }

View File

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

View File

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

View File

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

View File

@@ -18,9 +18,7 @@ using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.DM.Endpoints.DGEs namespace PepperDash.Essentials.DM.Endpoints.DGEs
{ {
/// <summary> [Description("Wrapper class for DGE-100")]
/// Wrapper class for DGE-100 and DM-DGE-200-C
/// </summary>
public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec
{ {
private readonly Dge100 _dge; private readonly Dge100 _dge;

View File

@@ -20,6 +20,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs
/// <summary> /// <summary>
/// Wrapper class for DGE-100 and DM-DGE-200-C /// Wrapper class for DGE-100 and DM-DGE-200-C
/// </summary> /// </summary>
[Description("Wrapper class for DM-DGE-200-C")]
public class DmDge200CController : Dge100Controller, IRoutingInputsOutputs public class DmDge200CController : Dge100Controller, IRoutingInputsOutputs
{ {
private readonly DmDge200C _dge; private readonly DmDge200C _dge;

View File

@@ -11,7 +11,8 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
[Description("Wrapper Class for DM-RMC-100-S")]
public class DmRmc100SController : DmRmcControllerBase, IRoutingInputsOutputs, public class DmRmc100SController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -11,7 +11,8 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
[Description("Wrapper Class for DM-RMC-150-S")]
public class DmRmc150SController : DmRmcControllerBase, IRoutingInputsOutputs, public class DmRmc150SController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs, [Description("Wrapper Class for DM-RMC-200-C")]
public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
private readonly DmRmc200C _rmc; private readonly DmRmc200C _rmc;

View File

@@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
[Description("Wrapper Class for DM-RMC-200-S2")]
public class DmRmc200S2Controller : DmRmcControllerBase, IRoutingInputsOutputs, public class DmRmc200S2Controller : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs, [Description("Wrapper Class for DM-RMC-200-S")]
public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
private readonly DmRmc200S _rmc; private readonly DmRmc200S _rmc;

View File

@@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, [Description("Wrapper Class for DM-RMC-4K-SCALER-C")]
public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback,
IIROutputPorts, IComPorts, ICec, IRelayPorts IIROutputPorts, IComPorts, ICec, IRelayPorts
{ {
private readonly DmRmc4kScalerC _rmc; private readonly DmRmc4kScalerC _rmc;

View File

@@ -6,7 +6,9 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
[Description("Wrapper Class for DM-RMC-4K-100-C-1G")]
public class DmRmc4k100C1GController : DmHdBaseTControllerBase, IRoutingInputsOutputs, public class DmRmc4k100C1GController : DmHdBaseTControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
[Description("Wrapper Class for DM-RMC-4K-SCALER-C-DSP")]
public class DmRmc4kScalerCDspController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, public class DmRmc4kScalerCDspController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback,
IIROutputPorts, IComPorts, ICec, IRelayPorts IIROutputPorts, IComPorts, ICec, IRelayPorts
{ {

View File

@@ -7,7 +7,8 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
[Description("Wrapper Class for DM-RMC-4K-Z-100-C")]
public class DmRmc4kZ100CController : DmRmcX100CController public class DmRmc4kZ100CController : DmRmcX100CController
{ {
private readonly DmRmc4kz100C _rmc; private readonly DmRmc4kz100C _rmc;

View File

@@ -11,6 +11,7 @@ using PepperDash.Core;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
[Description("Wrapper Class for DM-RMC-4K-Z-SCALER-C")]
public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -173,22 +173,22 @@ namespace PepperDash.Essentials.DM
{"dmrmcscalers", (k, n,i, d) => new DmRmcScalerSController(k, n, new DmRmcScalerS(i,d))}, {"dmrmcscalers", (k, n,i, d) => new DmRmcScalerSController(k, n, new DmRmcScalerS(i,d))},
{ {
"dmrmcscalers2", "dmrmcscalers2",
(k, n,i, d) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(d)) (k, n,i, d) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(i, d))
}, },
{ {
"dmrmc4kscalerc", "dmrmc4kscalerc",
(k, n,i, d) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(d)) (k, n,i, d) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(i, d))
}, },
{ {
"dmrmc4kscalercdsp", "dmrmc4kscalercdsp",
(k, n,i, d) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(d)) (k, n,i, d) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(i, d))
}, },
{ {
"dmrmc4kzscalerc", "dmrmc4kzscalerc",
(k, n,i, d) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(d)) (k, n,i, d) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(i, d))
}, },
{"hdbasetrx", (k,n,i,d) => new HDBaseTRxController(k,n, new HDRx3CB(d))}, {"hdbasetrx", (k,n,i,d) => new HDBaseTRxController(k,n, new HDRx3CB(i, d))},
{"dmrmc4k100c1g", (k,n,i,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(d))} {"dmrmc4k100c1g", (k,n,i,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(i, d))}
}; };
} }
/// <summary> /// <summary>
@@ -307,7 +307,7 @@ namespace PepperDash.Essentials.DM
TypeNames = new List<string> TypeNames = new List<string>
{ "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s",
"dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp",
"dmrmc4kz100c", "dmrmckzscalerc" }; "dmrmc4kz100c", "dmrmc4kzscalerc" };
} }
public override EssentialsDevice BuildDevice(DeviceConfig dc) public override EssentialsDevice BuildDevice(DeviceConfig dc)

View File

@@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, [Description("Wrapper Class for DM-RMC-SCALER-C")]
public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
private readonly DmRmcScalerC _rmc; private readonly DmRmcScalerC _rmc;

View File

@@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
[Description("Wrapper Class for DM-RMC-SCALER-S2")]
public class DmRmcScalerS2Controller : DmRmcControllerBase, IRoutingInputsOutputs, public class DmRmcScalerS2Controller : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -12,7 +12,8 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
[Description("Wrapper Class for DM-RMC-SCALER-S")]
public class DmRmcScalerSController : DmRmcControllerBase, IRoutingInputsOutputs, public class DmRmcScalerSController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

@@ -11,8 +11,9 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Builds a controller for basic DM-RMCs (both 4K and non-4K) with Com and IR ports and no control functions /// Builds a controller for basic DM-RMCs (both 4K and non-4K) with Com and IR ports and no control functions
/// ///
/// </summary> /// </summary>
public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, [Description("Wrapper Class for DM-RMC-4K-100-C & DM-RMC-100-C")]
public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
private readonly DmRmc100C _rmc; private readonly DmRmc100C _rmc;

View File

@@ -16,7 +16,7 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Controller class for all DM-TX-201C/S/F transmitters /// Controller class for all DM-TX-201C/S/F transmitters
/// </summary> /// </summary>
[Description("Wrapper class for DM-TX-200-C Endpoint")] [Description("Wrapper class for DM-TX-200-C")]
public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
{ {
public DmTx200C2G Tx { get; private set; } public DmTx200C2G Tx { get; private set; }

View File

@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Controller class for all DM-TX-201C/S/F transmitters /// Controller class for all DM-TX-201C/S/F transmitters
/// </summary> /// </summary>
[Description("Wrapper class for DM-TX-201-C Endpoint")] [Description("Wrapper class for DM-TX-201-C")]
public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
{ {
public DmTx201C Tx { get; private set; } public DmTx201C Tx { get; private set; }

View File

@@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Controller class for all DM-TX-201S/F transmitters /// Controller class for all DM-TX-201S/F transmitters
/// </summary> /// </summary>
[Description("Wrapper class for DM-TX-201-S/F Endpoint")] [Description("Wrapper class for DM-TX-201-S/F")]
public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls
{ {
public DmTx201S Tx { get; private set; } public DmTx201S Tx { get; private set; }

View File

@@ -17,8 +17,9 @@ using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
using eVst = DmTx401C.eSourceSelection; using eVst = DmTx401C.eSourceSelection;
[Description("Wrapper class for DM-TX-401-C")]
public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{ {
public DmTx401C Tx { get; private set; } public DmTx401C Tx { get; private set; }

View File

@@ -68,8 +68,9 @@ namespace PepperDash.Essentials.DM
// Set Ports for CEC // Set Ports for CEC
HdmiIn.Port = Tx; HdmiIn.Port = Tx;
}
PreventRegistration = true;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {

View File

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

View File

@@ -18,8 +18,9 @@ using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-302-C")]
public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback, public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback,
IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
{ {

View File

@@ -21,6 +21,7 @@ namespace PepperDash.Essentials.DM
/// <summary> /// <summary>
/// Controller class for all DM-TX-201C/S/F transmitters /// Controller class for all DM-TX-201C/S/F transmitters
/// </summary> /// </summary>
[Description("Wrapper class for DM-TX-4K-Z-100-C")]
public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback, public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {

View File

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

View File

@@ -1,364 +1,364 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.DM.Config; using PepperDash.Essentials.DM.Config;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
public class DmTxHelper public class DmTxHelper
{ {
/// <summary> /// <summary>
/// A factory method for various DmTxControllers /// A factory method for various DmTxControllers
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="props"></param> /// <param name="props"></param>
/// <returns></returns> /// <returns></returns>
public static BasicDmTxControllerBase 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... // switch on type name... later...
typeName = typeName.ToLower(); typeName = typeName.ToLower();
//uint ipid = Convert.ToUInt16(props.Id, 16); //uint ipid = Convert.ToUInt16(props.Id, 16);
var ipid = props.Control.IpIdInt; var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower(); var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor") if (pKey == "processor")
{ {
// Catch constructor failures, mainly dues to IPID // Catch constructor failures, mainly dues to IPID
try try
{ {
if(typeName.StartsWith("dmtx200")) if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem)); return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem)); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201c")) if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem)); return new DmTx201CController(key, name, new DmTx201C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem)); return new DmTx201SController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem)); return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem)); return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem)); return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem)); return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx401")) if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem)); return new DmTx401CController(key, name, new DmTx401C(ipid, Global.ControlSystem));
Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key); Debug.Console(0, "{1} WARNING: Cannot create DM-TX of type: '{0}'", typeName, key);
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
} }
} }
else else
{ {
var parentDev = DeviceManager.GetDeviceForKey(pKey); var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch)) if (!(parentDev is IDmSwitch))
{ {
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.", Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey); key, pKey);
return null; return null;
} }
// Get the Crestron chassis and link stuff up // Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitch); var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis; var chassis = switchDev.Chassis;
var num = props.ParentInputNumber; var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs) if (num <= 0 || num > chassis.NumberOfInputs)
{ {
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range", Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num); key, num);
return null; return null;
} }
else else
{ {
var controller = (parentDev as IDmSwitch); var controller = (parentDev as IDmSwitch);
controller.TxDictionary.Add(num, key); controller.TxDictionary.Add(num, key);
} }
// Catch constructor failures, mainly dues to IPID // Catch constructor failures, mainly dues to IPID
try try
{ {
// Must use different constructor for CPU3 chassis types. No IPID // Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps|| chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps||
chassis is DmMd128x128 || chassis is DmMd64x64) chassis is DmMd128x128 || chassis is DmMd64x64)
{ {
if (typeName.StartsWith("dmtx200")) if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num])); return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c")) if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num])); return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num])); return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100")) if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num])); return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num])); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num])); return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num])); return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num])); return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num])); return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401")) if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num])); return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
} }
else else
{ {
if (typeName.StartsWith("dmtx200")) if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num])); return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c")) if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num])); return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s")) if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num])); return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100")) if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num])); return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100")) if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num])); return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num])); return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num])); return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num])); return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num])); return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401")) if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num])); return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
} }
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e); Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
} }
} }
return null; return null;
} }
} }
public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice
{ {
protected BasicDmTxControllerBase(string key, string name, GenericBase hardware) protected BasicDmTxControllerBase(string key, string name, GenericBase hardware)
: base(key, name, hardware) : base(key, name, hardware)
{ {
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
[Description("Wrapper class for all DM-TX variants")] [Description("Wrapper class for all DM-TX variants")]
public abstract class DmTxControllerBase : BasicDmTxControllerBase public abstract class DmTxControllerBase : BasicDmTxControllerBase
{ {
public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { } public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { }
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; } public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; } public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; } public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware) protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware) : base(key, name, hardware)
{ {
// if wired to a chassis, skip registration step in base class // if wired to a chassis, skip registration step in base class
if (hardware.DMInput != null) if (hardware.DMInput != null)
{ {
this.PreventRegistration = true; this.PreventRegistration = true;
} }
AddToFeedbackList(ActiveVideoInputFeedback); AddToFeedbackList(ActiveVideoInputFeedback);
} }
protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware) protected DmTxControllerBase(string key, string name, DmHDBasedTEndPoint hardware) : base(key, name, hardware)
{ {
} }
protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey) protected DmTxControllerJoinMap GetDmTxJoinMap(uint joinStart, string joinMapKey)
{ {
var joinMap = new DmTxControllerJoinMap(joinStart); var joinMap = new DmTxControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized)) if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized); joinMap = JsonConvert.DeserializeObject<DmTxControllerJoinMap>(joinMapSerialized);
return joinMap; return joinMap;
} }
protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge) protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge)
{ {
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.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]); tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]);
tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]); tx.AnyVideoInput.VideoStatus.VideoResolutionFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentInputResolution.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
bool hdcpTypeSimple; bool hdcpTypeSimple;
if (tx.Hardware is DmTx4kX02CBase) if (tx.Hardware is DmTx4kX02CBase)
hdcpTypeSimple = false; hdcpTypeSimple = false;
else else
hdcpTypeSimple = true; hdcpTypeSimple = true;
if (tx is ITxRouting) if (tx is ITxRouting)
{ {
var txR = tx as ITxRouting; var txR = tx as ITxRouting;
trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber, trilist.SetUShortSigAction(joinMap.VideoInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video)); i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Video));
trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber, trilist.SetUShortSigAction(joinMap.AudioInput.JoinNumber,
i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio)); i => txR.ExecuteNumericSwitch(i, 0, eRoutingSignalType.Audio));
txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]); txR.VideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoInput.JoinNumber]);
txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]); txR.AudioSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioInput.JoinNumber]);
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability; trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber].UShortValue = (ushort)tx.HdcpSupportCapability;
if (txR.InputPorts[DmPortName.HdmiIn] != null) if (txR.InputPorts[DmPortName.HdmiIn] != null)
{ {
var inputPort = txR.InputPorts[DmPortName.HdmiIn]; var inputPort = txR.InputPorts[DmPortName.HdmiIn];
if (tx.Feedbacks["HdmiInHdcpCapability"] != null) if (tx.Feedbacks["HdmiInHdcpCapability"] != null)
{ {
var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback; var intFeedback = tx.Feedbacks["HdmiInHdcpCapability"] as IntFeedback;
if (intFeedback != null) if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
} }
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{ {
var port = inputPort.Port as EndpointHdmiInput; var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist); SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
} }
} }
if (txR.InputPorts[DmPortName.HdmiIn1] != null) if (txR.InputPorts[DmPortName.HdmiIn1] != null)
{ {
var inputPort = txR.InputPorts[DmPortName.HdmiIn1]; var inputPort = txR.InputPorts[DmPortName.HdmiIn1];
if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null) if (tx.Feedbacks["HdmiIn1HdcpCapability"] != null)
{ {
var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback; var intFeedback = tx.Feedbacks["HdmiIn1HdcpCapability"] as IntFeedback;
if (intFeedback != null) if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
} }
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{ {
var port = inputPort.Port as EndpointHdmiInput; var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist); SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port1HdcpState.JoinNumber, trilist);
} }
} }
if (txR.InputPorts[DmPortName.HdmiIn2] != null) if (txR.InputPorts[DmPortName.HdmiIn2] != null)
{ {
var inputPort = txR.InputPorts[DmPortName.HdmiIn2]; var inputPort = txR.InputPorts[DmPortName.HdmiIn2];
if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null) if (tx.Feedbacks["HdmiIn2HdcpCapability"] != null)
{ {
var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback; var intFeedback = tx.Feedbacks["HdmiIn2HdcpCapability"] as IntFeedback;
if (intFeedback != null) if (intFeedback != null)
intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]); intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port1HdcpState.JoinNumber]);
} }
if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null) if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
{ {
var port = inputPort.Port as EndpointHdmiInput; var port = inputPort.Port as EndpointHdmiInput;
SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist); SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port2HdcpState.JoinNumber, trilist);
} }
} }
} }
var txFreeRun = tx as IHasFreeRun; var txFreeRun = tx as IHasFreeRun;
if (txFreeRun != null) if (txFreeRun != null)
{ {
txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]); txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]);
trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled); trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled);
} }
var txVga = tx as IVgaBrightnessContrastControls; var txVga = tx as IVgaBrightnessContrastControls;
{ {
if (txVga == null) return; if (txVga == null) return;
txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]); txVga.VgaBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaBrightness.JoinNumber]);
txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]); txVga.VgaContrastFeedback.LinkInputSig(trilist.UShortInput[joinMap.VgaContrast.JoinNumber]);
trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness); trilist.SetUShortSigAction(joinMap.VgaBrightness.JoinNumber, txVga.SetVgaBrightness);
trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast); trilist.SetUShortSigAction(joinMap.VgaContrast.JoinNumber, txVga.SetVgaContrast);
} }
} }
private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist)
{ {
if (hdcpTypeSimple) if (hdcpTypeSimple)
{ {
trilist.SetUShortSigAction(join, trilist.SetUShortSigAction(join,
s => s =>
{ {
if (s == 0) if (s == 0)
{ {
port.HdcpSupportOff(); port.HdcpSupportOff();
} }
else if (s > 0) else if (s > 0)
{ {
port.HdcpSupportOn(); port.HdcpSupportOn();
} }
}); });
} }
else else
{ {
trilist.SetUShortSigAction(join, trilist.SetUShortSigAction(join,
s => s =>
{ {
port.HdcpCapability = (eHdcpCapabilityType)s; port.HdcpCapability = (eHdcpCapabilityType)s;
}); });
} }
} }
} }
public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase> public class DmTxControllerFactory : EssentialsDeviceFactory<DmTxControllerBase>
{ {
public DmTxControllerFactory() public DmTxControllerFactory()
{ {
TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", TypeNames = new List<string>() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c",
"dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" }; "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" };
} }
public override EssentialsDevice BuildDevice(DeviceConfig dc) public override EssentialsDevice BuildDevice(DeviceConfig dc)
{ {
var type = dc.Type.ToLower(); var type = dc.Type.ToLower();
Debug.Console(1, "Factory Attempting to create new DM-TX Device"); Debug.Console(1, "Factory Attempting to create new DM-TX Device");
var props = JsonConvert.DeserializeObject var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString()); <PepperDash.Essentials.DM.Config.DmTxPropertiesConfig>(dc.Properties.ToString());
return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props); return PepperDash.Essentials.DM.DmTxHelper.GetDmTxController(dc.Key, dc.Name, type, props);
} }
} }
} }

View File

@@ -99,7 +99,9 @@
<Compile Include="Chassis\DmpsAudioOutputController.cs" /> <Compile Include="Chassis\DmpsAudioOutputController.cs" />
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" /> <Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
<Compile Include="Chassis\DmpsRoutingController.cs" /> <Compile Include="Chassis\DmpsRoutingController.cs" />
<Compile Include="Chassis\HdMdNxM4kEBridgeableController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" /> <Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />
<Compile Include="Endpoints\DGEs\DmDge200CController.cs" /> <Compile Include="Endpoints\DGEs\DmDge200CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" /> <Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZScalerCController.cs" /> <Compile Include="Endpoints\Receivers\DmRmc4kZScalerCController.cs" />
@@ -113,7 +115,6 @@
<Compile Include="Config\DmTxConfig.cs" /> <Compile Include="Config\DmTxConfig.cs" />
<Compile Include="Config\DMChassisConfig.cs" /> <Compile Include="Config\DMChassisConfig.cs" />
<Compile Include="Config\HdMdNxM4kEPropertiesConfig.cs" /> <Compile Include="Config\HdMdNxM4kEPropertiesConfig.cs" />
<Compile Include="Config\InputPropertiesConfig.cs" />
<Compile Include="DmPortName.cs" /> <Compile Include="DmPortName.cs" />
<Compile Include="Endpoints\DGEs\Dge100Controller.cs" /> <Compile Include="Endpoints\DGEs\Dge100Controller.cs" />
<Compile Include="Endpoints\DGEs\DgePropertiesConfig.cs" /> <Compile Include="Endpoints\DGEs\DgePropertiesConfig.cs" />

View File

@@ -1,133 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Gateways;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Devices.Common
{
public class CenRfgwController : CrestronGenericBaseDevice
{
public GatewayBase Gateway { get { return Hardware as GatewayBase; } }
/// <summary>
/// Constructor for the on-board gateway
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
public CenRfgwController(string key, string name, GatewayBase gateway) :
base(key, name, gateway)
{
}
public static CenRfgwController GetNewExGatewayController(string key, string name, string id, string gatewayType)
{
uint uid;
eExGatewayType type;
try
{
uid = Convert.ToUInt32(id, 16);
type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true);
var cs = Global.ControlSystem;
GatewayBase gw = null;
switch (type)
{
case eExGatewayType.Ethernet:
gw = new CenRfgwEx(uid, cs);
break;
case eExGatewayType.EthernetShared:
gw = new CenRfgwExEthernetSharable(uid, cs);
break;
case eExGatewayType.Cresnet:
gw = new CenRfgwExCresnet(uid, cs);
break;
}
return new CenRfgwController(key, name, gw);
}
catch (Exception)
{
Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", id, gatewayType);
return null;
}
}
public static CenRfgwController GetNewErGatewayController(string key, string name, string id, string gatewayType)
{
uint uid;
eExGatewayType type;
try
{
uid = Convert.ToUInt32(id, 16);
type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true);
var cs = Global.ControlSystem;
GatewayBase gw = null;
switch (type)
{
case eExGatewayType.Ethernet:
gw = new CenErfgwPoe(uid, cs);
break;
case eExGatewayType.EthernetShared:
gw = new CenErfgwPoeEthernetSharable(uid, cs);
break;
case eExGatewayType.Cresnet:
gw = new CenErfgwPoeCresnet(uid, cs);
break;
}
return new CenRfgwController(key, name, gw);
}
catch (Exception)
{
Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", id, gatewayType);
return null;
}
}
/// <summary>
/// Gets the actual Crestron EX gateway for a given key. "processor" or the key of
/// a CenRfgwExController in DeviceManager
/// </summary>
/// <param name="key"></param>
/// <returns>Either processor GW or Gateway property of CenRfgwExController</returns>
public static GatewayBase GetExGatewayBaseForKey(string key)
{
key = key.ToLower();
if (key == "processor" && Global.ControlSystem.SupportsInternalRFGateway)
return Global.ControlSystem.ControllerRFGatewayDevice;
var gwCont = DeviceManager.GetDeviceForKey(key) as CenRfgwController;
if (gwCont != null)
return gwCont.Gateway;
return null;
}
}
public enum eExGatewayType
{
Ethernet, EthernetShared, Cresnet
}
public class CenRfgwControllerFactory : EssentialsDeviceFactory<CenRfgwController>
{
public CenRfgwControllerFactory()
{
TypeNames = new List<string>() { "cenrfgwex", "cenerfgwpoe" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device");
return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name,
dc.Properties.Value<string>("id"), dc.Properties.Value<string>("gatewayType"));
}
}
}

View File

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

View File

@@ -132,7 +132,6 @@
<Compile Include="Codec\iHasDialer.cs" /> <Compile Include="Codec\iHasDialer.cs" />
<Compile Include="Codec\iHasDirectory.cs" /> <Compile Include="Codec\iHasDirectory.cs" />
<Compile Include="Codec\iHasScheduleAwareness.cs" /> <Compile Include="Codec\iHasScheduleAwareness.cs" />
<Compile Include="Crestron\Gateways\CenRfgwController.cs" />
<Compile Include="Display\ComTcpDisplayBase.cs" /> <Compile Include="Display\ComTcpDisplayBase.cs" />
<Compile Include="Display\AvocorVTFDisplay.cs" /> <Compile Include="Display\AvocorVTFDisplay.cs" />
<Compile Include="Display\InputInterfaces.cs" /> <Compile Include="Display\InputInterfaces.cs" />

View File

@@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common.Occupancy namespace PepperDash.Essentials.Devices.Common.Occupancy
{ {
[Description("Wrapper class for CEN-ODT-C-POE")]
public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
{ {
public CenOdtCPoe OccSensor { get; private set; } public CenOdtCPoe OccSensor { get; private set; }

View File

@@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common.Occupancy namespace PepperDash.Essentials.Devices.Common.Occupancy
{ {
[Description("Wrapper class for Single Technology GLS Occupancy Sensors")]
public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider
{ {
public GlsOccupancySensorBase OccSensor { get; private set; } public GlsOccupancySensorBase OccSensor { get; private set; }

View File

@@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Common.Occupancy namespace PepperDash.Essentials.Devices.Common.Occupancy
{ {
[Description("Wrapper class for Dual Technology GLS Occupancy Sensors")]
public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController
{ {
public new GlsOdtCCn OccSensor { get; private set; } public new GlsOdtCCn OccSensor { get; private set; }

View File

@@ -15,7 +15,8 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Devices.Common namespace PepperDash.Essentials.Devices.Common
{ {
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower [Description("Wrapper class for an IR Set Top Box")]
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower
{ {
public IrOutputPortController IrPort { get; private set; } public IrOutputPortController IrPort { get; private set; }

View File

@@ -14,9 +14,9 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Devices.Common namespace PepperDash.Essentials.Devices.Common
{ {
[Description("Wrapper class for an IR-Controlled AppleTV")]
public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs
{ {
public IrOutputPortController IrPort { get; private set; } public IrOutputPortController IrPort { get; private set; }
public const string StandardDriverName = "Apple AppleTV-v2.ir"; public const string StandardDriverName = "Apple AppleTV-v2.ir";
public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } } public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } }

View File

@@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Routing; using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Devices.Common namespace PepperDash.Essentials.Devices.Common
{ {
[Description("Wrapper class for an IR-Controlled Roku")]
public class Roku2 : EssentialsDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs public class Roku2 : EssentialsDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs
{ {
[Api] [Api]