diff --git a/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs b/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs
index 12108564..d8af5a55 100644
--- a/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs
+++ b/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs
@@ -55,7 +55,7 @@ namespace PepperDash.Essentials
return null;
}
- // DSP format: deviceKey--levelName, biampTesira-1--master
+ // DSP/DMPS format: deviceKey--levelName, biampTesira-1--master
match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)");
if (match.Success)
{
@@ -67,6 +67,27 @@ namespace PepperDash.Essentials
if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always...
return dsp.LevelControlPoints[levelTag];
}
+
+ var dmps = DeviceManager.GetDeviceForKey(devKey) as DmpsAudioOutputController;
+ if (dmps != null)
+ {
+ var levelTag = match.Groups[2].Value;
+ switch (levelTag)
+ {
+ case "master":
+ return dmps.MasterVolumeLevel;
+ case "source":
+ return dmps.SourceVolumeLevel;
+ case "micsmaster":
+ return dmps.MicsMasterVolumeLevel;
+ case "codec1":
+ return dmps.Codec1VolumeLevel;
+ case "codec2":
+ return dmps.Codec2VolumeLevel;
+ default:
+ return dmps.MasterVolumeLevel;
+ }
+ }
// No volume for some reason. We have failed as developers
return null;
}
diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs
index 1ab3b28e..8f3be4e1 100644
--- a/PepperDashEssentials/ControlSystem.cs
+++ b/PepperDashEssentials/ControlSystem.cs
@@ -13,6 +13,7 @@ using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
+using PepperDash.Essentials.Core.Web;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
@@ -46,28 +47,29 @@ namespace PepperDash.Essentials
///
public override void InitializeSystem()
{
- _startTimer = new CTimer(StartSystem,StartupTime);
-
-
// If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate
// to allow any HD-BaseT DM endpoints to register first.
- if (Global.ControlSystemIsDmpsType)
+ bool preventInitializationComplete = Global.ControlSystemIsDmpsType;
+ if (preventInitializationComplete)
{
Debug.Console(1, "******************* InitializeSystem() Entering **********************");
-
- _initializeEvent = new CEvent();
-
+ _startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime);
+ _initializeEvent = new CEvent(true, false);
DeviceManager.AllDevicesRegistered += (o, a) =>
{
_initializeEvent.Set();
- Debug.Console(1, "******************* InitializeSystem() Exiting **********************");
};
-
_initializeEvent.Wait(30000);
+ Debug.Console(1, "******************* InitializeSystem() Exiting **********************");
+ SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
+ }
+ else
+ {
+ _startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime);
}
}
- private void StartSystem(object obj)
+ private void StartSystem(object preventInitialization)
{
DeterminePlatform();
@@ -79,7 +81,7 @@ namespace PepperDash.Essentials
CrestronConsole.AddNewConsoleCommand(PluginLoader.ReportAssemblyVersions, "reportversions", "Reports the versions of the loaded assemblies", ConsoleAccessLevelEnum.AccessOperator);
- CrestronConsole.AddNewConsoleCommand(PepperDash.Essentials.Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator);
+ CrestronConsole.AddNewConsoleCommand(Core.DeviceFactory.GetDeviceFactoryTypes, "gettypes", "Gets the device types that can be built. Accepts a filter string.", ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(BridgeHelper.PrintJoinMap, "getjoinmap", "map(s) for bridge or device on bridge [brKey [devKey]]", ConsoleAccessLevelEnum.AccessOperator);
@@ -124,7 +126,10 @@ namespace PepperDash.Essentials
return;
}
- SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
+ if (!(bool)preventInitialization)
+ {
+ SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
+ }
}
///
@@ -353,6 +358,7 @@ namespace PepperDash.Essentials
// Build the processor wrapper class
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
+ DeviceManager.AddDevice(new EssemtialsWebApi("essentialsWebApi","Essentials Web API"));
// Add global System Monitor device
if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
diff --git a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs
index b97ef9c4..65cc52fa 100644
--- a/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs
+++ b/PepperDashEssentials/Room/Types/EssentialsTechRoom.cs
@@ -272,7 +272,7 @@ namespace PepperDash.Essentials
{
Debug.Console(2, this,
@"Attempting to run action:
-DeviceKey: {0}
+Key: {0}
MethodName: {1}
Params: {2}"
, a.DeviceKey, a.MethodName, a.Params);
diff --git a/PepperDashEssentials/Room/Types/IEssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/IEssentialsHuddleSpaceRoom.cs
deleted file mode 100644
index 45074fb7..00000000
--- a/PepperDashEssentials/Room/Types/IEssentialsHuddleSpaceRoom.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.DeviceTypeInterfaces;
-using PepperDash.Essentials.Room.Config;
-using PepperDash.Essentials.Core.Devices;
-using PepperDash.Essentials.Devices.Common.Codec;
-using PepperDash.Essentials.Devices.Common.VideoCodec;
-using PepperDash.Essentials.Devices.Common.AudioCodec;
-
-
-using PepperDash.Core;
-
-namespace PepperDash.Essentials
-{
- public interface IEssentialsHuddleSpaceRoom : IEssentialsRoom, IHasCurrentSourceInfoChange, IRunRouteAction, IHasDefaultDisplay
- {
- bool ExcludeFromGlobalFunctions { get; }
-
- void RunRouteAction(string routeKey);
-
- EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; }
-
- IBasicVolumeControls CurrentVolumeControls { get; }
-
- event EventHandler CurrentVolumeDeviceChange;
- }
-
- public interface IEssentialsHuddleVtc1Room : IEssentialsRoom, IHasCurrentSourceInfoChange,
- IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, IHasDefaultDisplay
- {
- EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; }
-
- void RunRouteAction(string routeKey);
-
- IHasScheduleAwareness ScheduleSource { get; }
-
- string DefaultCodecRouteString { get; }
- }
-}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs
index 11b8f4ff..cb937235 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs
@@ -109,7 +109,7 @@ namespace PepperDash.Essentials.Core.Bridges
{
public EiscApiPropertiesConfig PropertiesConfig { get; private set; }
- protected Dictionary JoinMaps { get; private set; }
+ public Dictionary JoinMaps { get; private set; }
public BasicTriList Eisc { get; private set; }
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs
index 6d783639..11e20375 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmTxControllerJoinMap.cs
@@ -64,6 +64,11 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete VgaContrast = new JoinDataComplete(new JoinData { JoinNumber = 7, JoinSpan = 1 },
new JoinMetadata { Description = "DM TX Online", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+ [JoinName("Port3HdcpState")]
+ public JoinDataComplete Port3HdcpState = new JoinDataComplete(new JoinData { JoinNumber = 8, JoinSpan = 1 },
+ new JoinMetadata { Description = "DM TX Port 3 HDCP State Set / Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
+
+
///
/// Constructor to use when instantiating this Join Map without inheriting from it
///
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs
index 363d389b..8e352bc5 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/SystemMonitorJoinMap.cs
@@ -47,7 +47,7 @@ namespace PepperDash.Essentials.Core.Bridges
[JoinName("ProgramOffsetJoin")]
public JoinDataComplete ProgramOffsetJoin = new JoinDataComplete(new JoinData { JoinNumber = 5, JoinSpan = 5 },
new JoinMetadata { Description = "All Program Data is offset between slots by 5 - First Joins Start at 11", JoinCapabilities = eJoinCapabilities.None, JoinType = eJoinType.None });
-
+
[JoinName("ProgramStart")]
public JoinDataComplete ProgramStart = new JoinDataComplete(new JoinData { JoinNumber = 11, JoinSpan = 1 },
new JoinMetadata { Description = "Processor Program Start / Fb", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
@@ -132,6 +132,23 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete DhcpStatus = new JoinDataComplete(new JoinData { JoinNumber = 86, JoinSpan = 1 },
new JoinMetadata { Description = "Processor Ethernet Dhcp Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
+ [JoinName("ProcessorRebot")]
+ public JoinDataComplete ProcessorReboot = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
+ new JoinMetadata { Description = "Reboot processor", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("IsAppliance")]
+ public JoinDataComplete IsAppliance = new JoinDataComplete(new JoinData { JoinNumber = 1, JoinSpan = 1 },
+ new JoinMetadata { Description = "Is appliance Fb", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("IsServer")]
+ public JoinDataComplete IsServer = new JoinDataComplete(new JoinData { JoinNumber = 2, JoinSpan = 1 },
+ new JoinMetadata { Description = "Is server Fb", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+ [JoinName("ProgramReset")]
+ public JoinDataComplete ProgramReset = new JoinDataComplete(new JoinData { JoinNumber = 15, JoinSpan = 1 },
+ new JoinMetadata { Description = "Resets the program", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
+
+
///
/// Constructor to use when instantiating this Join Map without inheriting from it
///
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs
index 8a5efe47..9667b5b9 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs
@@ -183,6 +183,8 @@ namespace PepperDash.Essentials.Core
[JsonConverter(typeof(ComSpecJsonConverter))]
public ComPort.ComPortSpec ComParams { get; set; }
+ public string RoomId { get; set; }
+
public string CresnetId { get; set; }
///
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs
index 57bf2287..65efd0b9 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs
@@ -388,20 +388,18 @@ namespace PepperDash.Essentials.Core
var outputPorts = ((device as IRoutingOutputs) != null) ? (device as IRoutingOutputs).OutputPorts : null;
if (inputPorts != null)
{
- Debug.Console(0, "Device {0} has {1} Input Ports:", s, inputPorts.Count);
+ CrestronConsole.ConsoleCommandResponse("Device {0} has {1} Input Ports:", s, inputPorts.Count);
foreach (var routingInputPort in inputPorts)
{
- Debug.Console(0, "{0}", routingInputPort.Key);
- }
- }
- if (outputPorts != null)
- {
- Debug.Console(0, "Device {0} has {1} Output Ports:", s, outputPorts.Count);
- foreach (var routingOutputPort in outputPorts)
- {
- Debug.Console(0, "{0}", routingOutputPort.Key);
+ CrestronConsole.ConsoleCommandResponse("{0}", routingInputPort.Key);
}
}
+ if (outputPorts == null) return;
+ CrestronConsole.ConsoleCommandResponse("Device {0} has {1} Output Ports:", s, outputPorts.Count);
+ foreach (var routingOutputPort in outputPorts)
+ {
+ CrestronConsole.ConsoleCommandResponse("{0}", routingOutputPort.Key);
+ }
}
///
@@ -435,7 +433,7 @@ namespace PepperDash.Essentials.Core
if (device == null)
{
- Debug.Console(0, "Unable to get device with key: {0}", deviceKey);
+ CrestronConsole.ConsoleCommandResponse("Unable to get device with key: {0}", deviceKey);
return;
}
@@ -447,7 +445,7 @@ namespace PepperDash.Essentials.Core
}
catch
{
- Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both");
+ CrestronConsole.ConsoleCommandResponse("Unable to convert setting value. Please use off/rx/tx/both");
return;
}
@@ -458,18 +456,18 @@ namespace PepperDash.Essentials.Core
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);
+ CrestronConsole.ConsoleCommandResponse("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);
+ CrestronConsole.ConsoleCommandResponse("Unable to convert minutes or settings value. Please use an integer value for minutes. Error: {0}", e);
}
}
else
{
device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
- Debug.Console(0, "Device: '{0}' debug level set to {1} for default time (30 minutes)", deviceKey, debugSetting);
+ CrestronConsole.ConsoleCommandResponse("Device: '{0}' debug level set to {1} for default time (30 minutes)", deviceKey, debugSetting);
}
}
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs
index ebdc87b1..793ff34a 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs
@@ -172,21 +172,14 @@ namespace PepperDash.Essentials.Core
///
/// Prints the type names and associated metadata from the FactoryMethods collection.
///
- ///
+ ///
public static void GetDeviceFactoryTypes(string filter)
{
- Dictionary types = new Dictionary();
+ var types = !string.IsNullOrEmpty(filter)
+ ? FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value)
+ : FactoryMethods;
- if (!string.IsNullOrEmpty(filter))
- {
- types = FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
- }
- else
- {
- types = FactoryMethods;
- }
-
- Debug.Console(0, "Device Types:");
+ CrestronConsole.ConsoleCommandResponse("Device Types:");
foreach (var type in types.OrderBy(t => t.Key))
{
@@ -198,11 +191,23 @@ namespace PepperDash.Essentials.Core
cType = type.Value.CType.FullName;
}
- Debug.Console(0,
+ CrestronConsole.ConsoleCommandResponse(
@"Type: '{0}'
CType: '{1}'
Description: {2}", type.Key, cType, description);
}
}
+
+ ///
+ /// Returns the device factory dictionary
+ ///
+ ///
+ ///
+ public static Dictionary GetDeviceFactoryDictionary(string filter)
+ {
+ return string.IsNullOrEmpty(filter)
+ ? FactoryMethods
+ : FactoryMethods.Where(k => k.Key.Contains(filter)).ToDictionary(k => k.Key, k => k.Value);
+ }
}
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs
index 6ffb16cc..60aa6275 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
-using System.Data;
using System.Globalization;
using System.Linq;
-using System.Runtime.InteropServices;
using System.Text;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharp.CrestronIO;
@@ -103,22 +101,22 @@ namespace PepperDash.Essentials.Core
///
public void PrintJoinMapInfo()
{
- Debug.Console(0, "{0}:\n", GetType().Name);
+ CrestronConsole.ConsoleCommandResponse("{0}:\n", GetType().Name);
// Get the joins of each type and print them
- Debug.Console(0, "Digitals:");
+ CrestronConsole.ConsoleCommandResponse("Digitals:");
var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
+ CrestronConsole.ConsoleCommandResponse("Found {0} Digital Joins", digitals.Count);
PrintJoinList(GetSortedJoins(digitals));
- Debug.Console(0, "Analogs:");
+ CrestronConsole.ConsoleCommandResponse("Analogs:");
var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
+ CrestronConsole.ConsoleCommandResponse("Found {0} Analog Joins", analogs.Count);
PrintJoinList(GetSortedJoins(analogs));
- Debug.Console(0, "Serials:");
+ CrestronConsole.ConsoleCommandResponse("Serials:");
var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
+ CrestronConsole.ConsoleCommandResponse("Found {0} Serial Joins", serials.Count);
PrintJoinList(GetSortedJoins(serials));
}
@@ -141,7 +139,7 @@ namespace PepperDash.Essentials.Core
{
foreach (var join in joins)
{
- Debug.Console(0,
+ CrestronConsole.ConsoleCommandResponse(
@"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'",
join.Value.JoinNumber,
join.Value.Label,
@@ -236,25 +234,45 @@ namespace PepperDash.Essentials.Core
///
public void PrintJoinMapInfo()
{
- Debug.Console(0, "{0}:\n", GetType().Name);
+ var sb = JoinmapStringBuilder();
+
+ CrestronConsole.ConsoleCommandResponse(sb.ToString());
+ }
+
+ private StringBuilder JoinmapStringBuilder()
+ {
+ var sb = new StringBuilder();
// Get the joins of each type and print them
- Debug.Console(0, "Digitals:");
- var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
- PrintJoinList(GetSortedJoins(digitals));
+ sb.AppendLine(String.Format("# {0}", GetType().Name));
+ sb.AppendLine();
+ sb.AppendLine("## Digitals");
+ sb.AppendLine();
+ // Get the joins of each type and print them
+ var digitals =
+ Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital)
+ .ToDictionary(j => j.Key, j => j.Value);
+ var digitalSb = AppendJoinList(GetSortedJoins(digitals));
+ digitalSb.AppendLine("## Analogs");
+ digitalSb.AppendLine();
- Debug.Console(0, "Analogs:");
- var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
- PrintJoinList(GetSortedJoins(analogs));
+ var analogs =
+ Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog)
+ .ToDictionary(j => j.Key, j => j.Value);
+ var analogSb = AppendJoinList(GetSortedJoins(analogs));
+ analogSb.AppendLine("## Serials");
+ analogSb.AppendLine();
- Debug.Console(0, "Serials:");
- var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
- PrintJoinList(GetSortedJoins(serials));
+ var serials =
+ Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial)
+ .ToDictionary(j => j.Key, j => j.Value);
+ var serialSb = AppendJoinList(GetSortedJoins(serials));
+ sb.EnsureCapacity(sb.Length + digitalSb.Length + analogSb.Length + serialSb.Length);
+ sb.Append(digitalSb).Append(analogSb).Append(serialSb);
+ return sb;
}
+
///
/// Prints the join information to console
///
@@ -262,37 +280,11 @@ namespace PepperDash.Essentials.Core
{
var pluginType = GetType().Name;
- Debug.Console(0, "{0}:\n", pluginType);
+ CrestronConsole.ConsoleCommandResponse("{0}:\n", pluginType);
- var sb = new StringBuilder();
- sb.AppendLine(String.Format("# {0}", GetType().Name));
- sb.AppendLine(String.Format("Generated from '{0}' on bridge '{1}'", deviceKey, bridgeKey));
- sb.AppendLine();
- sb.AppendLine("## Digitals");
- // Get the joins of each type and print them
- var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Digital Joins", digitals.Count);
- var digitalSb = AppendJoinList(GetSortedJoins(digitals));
- digitalSb.AppendLine("## Analogs");
- digitalSb.AppendLine();
- Debug.Console(0, "Analogs:");
- var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Analog Joins", analogs.Count);
- var analogSb = AppendJoinList(GetSortedJoins(analogs));
- analogSb.AppendLine("## Serials");
- analogSb.AppendLine();
-
- Debug.Console(0, "Serials:");
- var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value);
- Debug.Console(2, "Found {0} Serial Joins", serials.Count);
- var serialSb = AppendJoinList(GetSortedJoins(serials));
-
- sb.EnsureCapacity(sb.Length + digitalSb.Length + analogSb.Length + serialSb.Length);
- sb.Append(digitalSb).Append(analogSb).Append(serialSb);
-
- WriteJoinmapMarkdown(sb, pluginType, bridgeKey, deviceKey);
+ WriteJoinmapMarkdown(JoinmapStringBuilder(), pluginType, bridgeKey, deviceKey);
}
@@ -303,7 +295,7 @@ namespace PepperDash.Essentials.Core
using (var sw = new StreamWriter(fileName))
{
sw.WriteLine(stringBuilder.ToString());
- Debug.Console(0, "Joinmap Readme generated and written to {0}", fileName);
+ CrestronConsole.ConsoleCommandResponse("Joinmap Readme generated and written to {0}", fileName);
}
}
@@ -313,7 +305,7 @@ namespace PepperDash.Essentials.Core
///
///
///
- List> GetSortedJoins(Dictionary joins)
+ static List> GetSortedJoins(Dictionary joins)
{
var sortedJoins = joins.ToList();
@@ -322,20 +314,6 @@ namespace PepperDash.Essentials.Core
return sortedJoins;
}
- void PrintJoinList(List> joins)
- {
- foreach (var join in joins)
- {
- Debug.Console(0,
- @"Join Number: {0} | JoinSpan: '{1}' | JoinName: {2} | Description: '{3}' | Type: '{4}' | Capabilities: '{5}'",
- join.Value.JoinNumber,
- join.Value.JoinSpan,
- join.Key,
- String.IsNullOrEmpty(join.Value.AttributeName) ? join.Value.Metadata.Label : join.Value.AttributeName,
- join.Value.Metadata.JoinType.ToString(),
- join.Value.Metadata.JoinCapabilities.ToString());
- }
- }
static StringBuilder AppendJoinList(List> joins)
{
@@ -579,7 +557,7 @@ namespace PepperDash.Essentials.Core
var errorKey = string.Empty;
foreach (var item in dataArray)
{
- if (item.Value.TrimEnd() == placeholder) ;
+ if (item.Value.TrimEnd() == placeholder) continue;
errorKey = item.Key;
break;
}
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs
index 056686b1..319a0a3c 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs
@@ -43,7 +43,20 @@ namespace PepperDash.Essentials.Core.Monitoring
public StringFeedback UptimeFeedback { get; set; }
public StringFeedback LastStartFeedback { get; set; }
- public SystemMonitorController(string key)
+ public BoolFeedback IsApplianceFeedback { get; protected set; }
+ private bool _isApplianceFb
+ {
+ get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance; }
+ }
+
+ public BoolFeedback IsServerFeedback { get; protected set; }
+ private bool _isServerFb
+ {
+ get { return CrestronEnvironment.DevicePlatform == eDevicePlatform.Server; }
+ }
+
+
+ public SystemMonitorController(string key)
: base(key)
{
Debug.Console(2, this, "Adding SystemMonitorController.");
@@ -63,6 +76,9 @@ namespace PepperDash.Essentials.Core.Monitoring
UptimeFeedback = new StringFeedback(() => _uptime);
LastStartFeedback = new StringFeedback(()=> _lastStart);
+ IsApplianceFeedback = new BoolFeedback(() => _isApplianceFb);
+ IsServerFeedback = new BoolFeedback(() => _isServerFb);
+
ProgramStatusFeedbackCollection = new Dictionary();
foreach (var prog in SystemMonitor.ProgramCollection)
@@ -123,6 +139,26 @@ namespace PepperDash.Essentials.Core.Monitoring
_uptime = uptimeRaw.Substring(forIndex + 4);
}
+ private static void ProcessorReboot()
+ {
+ if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) return;
+
+ var response = string.Empty;
+ CrestronConsole.SendControlSystemCommand("reboot", ref response);
+ }
+
+ private static void ProgramReset(uint index)
+ {
+ if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Server) return;
+
+ if (index <= 0 || index > 10) return;
+
+ var cmd = string.Format("progreset -p:{0}", index);
+
+ var response = string.Empty;
+ CrestronConsole.SendControlSystemCommand(cmd, ref response);
+ }
+
private void CrestronEnvironmentOnEthernetEventHandler(EthernetEventArgs ethernetEventArgs)
{
if (ethernetEventArgs.EthernetEventType != eEthernetEventType.LinkUp) return;
@@ -185,6 +221,9 @@ namespace PepperDash.Essentials.Core.Monitoring
SerialNumberFeedback.FireUpdate();
ModelFeedback.FireUpdate();
+ IsApplianceFeedback.FireUpdate();
+ IsServerFeedback.FireUpdate();
+
OnSystemMonitorPropertiesChanged();
}
@@ -237,6 +276,11 @@ namespace PepperDash.Essentials.Core.Monitoring
UptimeFeedback.LinkInputSig(trilist.StringInput[joinMap.Uptime.JoinNumber]);
LastStartFeedback.LinkInputSig(trilist.StringInput[joinMap.LastBoot.JoinNumber]);
+ trilist.SetSigHeldAction(joinMap.ProcessorReboot.JoinNumber, 10000, ProcessorReboot);
+
+ IsApplianceFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsAppliance.JoinNumber]);
+ IsServerFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsServer.JoinNumber]);
+
// iterate the program status feedback collection and map all the joins
LinkProgramInfoJoins(this, trilist, joinMap);
@@ -301,11 +345,13 @@ namespace PepperDash.Essentials.Core.Monitoring
p.Value.AggregatedProgramInfoFeedback.LinkInputSig(
trilist.StringInput[programSlotJoinStart + joinMap.AggregatedProgramInfo.JoinNumber]);
+ trilist.SetSigHeldAction(programSlotJoinStart + joinMap.ProgramReset.JoinNumber, 10000, () => ProgramReset(programNumber));
+
programSlotJoinStart = programSlotJoinStart + joinMap.ProgramOffsetJoin.JoinSpan;
}
- }
+ }
- //// Sets the time zone
+ //// Sets the time zone
//public void SetTimeZone(int timeZone)
//{
// SystemMonitor.TimeZoneInformation.TimeZoneNumber = timeZone;
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
index 268d4f12..e0859077 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
@@ -92,6 +92,10 @@
..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll
False
+
+ False
+ ..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCWSHelperInterface.dll
+
False
..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll
@@ -196,6 +200,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj.DotSettings b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj.DotSettings
new file mode 100644
index 00000000..cb991a69
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj.DotSettings
@@ -0,0 +1,3 @@
+
+ True
+ False
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs
index 9da843b8..f69d35d0 100644
--- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Plugins/PluginLoader.cs
@@ -194,10 +194,11 @@ namespace PepperDash.Essentials
///
public static void ReportAssemblyVersions(string command)
{
- Debug.Console(0, "Loaded Assemblies:");
+
+ CrestronConsole.ConsoleCommandResponse("Loaded Assemblies:");
foreach (var assembly in LoadedAssemblies)
{
- Debug.Console(0, "{0} Version: {1}", assembly.Name, assembly.Version);
+ CrestronConsole.ConsoleCommandResponse("{0} Version: {1}", assembly.Name, assembly.Version);
}
}
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssemtialsWebApi.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssemtialsWebApi.cs
new file mode 100644
index 00000000..dd2ade1a
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssemtialsWebApi.cs
@@ -0,0 +1,224 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharp;
+using Crestron.SimplSharp.WebScripting;
+using PepperDash.Core;
+using PepperDash.Core.Web;
+using PepperDash.Essentials.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web
+{
+ public class EssemtialsWebApi : EssentialsDevice
+ {
+ private readonly WebApiServer _server;
+
+ ///
+ /// http(s)://{ipaddress}/cws/{basePath}
+ /// http(s)://{ipaddress}/VirtualControl/Rooms/{roomId}/cws/{basePath}
+ ///
+ private readonly string _defaultBasePath = CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance
+ ? string.Format("/app{0:00}/api", InitialParametersClass.ApplicationNumber)
+ : "/api";
+
+ private const int DebugTrace = 0;
+ private const int DebugInfo = 1;
+ private const int DebugVerbose = 2;
+
+ ///
+ /// CWS base path
+ ///
+ public string BasePath { get; private set; }
+
+ ///
+ /// Tracks if CWS is registered
+ ///
+ public bool IsRegistered
+ {
+ get { return _server.IsRegistered; }
+ }
+
+ ///
+ /// Constructor
+ ///
+ ///
+ ///
+ public EssemtialsWebApi(string key, string name)
+ : this(key, name, null)
+ {
+ }
+
+ ///
+ /// Constructor
+ ///
+ ///
+ ///
+ ///
+ public EssemtialsWebApi(string key, string name, EssentialsWebApiPropertiesConfig config)
+ : base(key, name)
+ {
+ Key = key;
+
+ if (config == null)
+ BasePath = _defaultBasePath;
+ else
+ BasePath = string.IsNullOrEmpty(config.BasePath) ? _defaultBasePath : config.BasePath;
+
+ _server = new WebApiServer(Key, Name, BasePath);
+ }
+
+ ///
+ /// Custom activate, add routes
+ ///
+ ///
+ public override bool CustomActivate()
+ {
+ var routes = new List
+ {
+ new HttpCwsRoute("reportversions")
+ {
+ Name = "ReportVersions",
+ RouteHandler = new ReportVersionsRequestHandler()
+ },
+ new HttpCwsRoute("appdebug")
+ {
+ Name = "AppDebug",
+ RouteHandler = new AppDebugRequestHandler()
+ },
+ new HttpCwsRoute("devlist")
+ {
+ Name = "DevList",
+ RouteHandler = new DevListRequestHandler()
+ },
+ new HttpCwsRoute("devprops")
+ {
+ Name = "DevProps",
+ RouteHandler = new DevPropsRequestHandler()
+ },
+ new HttpCwsRoute("devjson")
+ {
+ Name = "DevJson",
+ RouteHandler = new DevJsonRequestHandler()
+ },
+ new HttpCwsRoute("setdevicestreamdebug")
+ {
+ Name = "SetDeviceStreamDebug",
+ RouteHandler = new SetDeviceStreamDebugRequestHandler()
+ },
+ new HttpCwsRoute("disableallstreamdebug")
+ {
+ Name = "DisableAllStreamDebug",
+ RouteHandler = new DisableAllStreamDebugRequestHandler()
+ },
+ new HttpCwsRoute("showconfig")
+ {
+ Name = "ShowConfig",
+ RouteHandler = new ShowConfigRequestHandler()
+ },
+ new HttpCwsRoute("gettypes")
+ {
+ Name = "GetTypes",
+ RouteHandler = new GetTypesRequestHandler()
+ },
+ new HttpCwsRoute("gettypes/{filter}")
+ {
+ Name = "GetTypesByFilter",
+ RouteHandler = new GetTypesByFilterRequestHandler()
+ },
+ new HttpCwsRoute("getjoinmap/{bridgeKey}")
+ {
+ Name = "GetJoinMapsForBridgeKey",
+ RouteHandler = new GetJoinMapForBridgeKeyRequestHandler()
+ },
+ new HttpCwsRoute("getjoinmap/{bridgeKey}/{deviceKey}")
+ {
+ Name = "GetJoinMapsForDeviceKey",
+ RouteHandler = new GetJoinMapForDeviceKeyRequestHandler()
+ },
+ new HttpCwsRoute("feedbacks/{deviceKey}")
+ {
+ Name = "GetFeedbacksForDeviceKey",
+ RouteHandler = new GetFeedbacksForDeviceRequestHandler()
+ }
+ };
+
+ foreach (var route in routes.Where(route => route != null))
+ {
+ var r = route;
+ _server.AddRoute(r);
+ }
+
+ return base.CustomActivate();
+ }
+
+ ///
+ /// Initializes the CWS class
+ ///
+ public override void Initialize()
+ {
+ // If running on an appliance
+ if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance)
+ {
+ /*
+ WEBSERVER [ON | OFF | TIMEOUT | MAXSESSIONSPERUSER ]
+ */
+ var response = string.Empty;
+ CrestronConsole.SendControlSystemCommand("webserver", ref response);
+ if (response.Contains("OFF")) return;
+
+ var is4Series = eCrestronSeries.Series4 == (Global.ProcessorSeries & eCrestronSeries.Series4);
+ Debug.Console(DebugTrace, Debug.ErrorLogLevel.Notice, "Starting Essentials Web API on {0} Appliance", is4Series ? "4-series" : "3-series");
+
+ _server.Start();
+
+ GetPaths();
+
+ return;
+ }
+
+ // Automatically start CWS when running on a server (Linux OS, Virtual Control)
+ Debug.Console(DebugTrace, Debug.ErrorLogLevel.Notice, "Starting Essentials Web API on Virtual Control Server");
+
+ _server.Start();
+
+ GetPaths();
+ }
+
+ ///
+ /// Print the available pahts
+ ///
+ ///
+ /// http(s)://{ipaddress}/cws/{basePath}
+ /// http(s)://{ipaddress}/VirtualControl/Rooms/{roomId}/cws/{basePath}
+ ///
+ public void GetPaths()
+ {
+ Debug.Console(DebugTrace, this, "{0}", new String('-', 50));
+
+ var currentIp = CrestronEthernetHelper.GetEthernetParameter(
+ CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
+
+ var hostname = CrestronEthernetHelper.GetEthernetParameter(
+ CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
+
+ var path = CrestronEnvironment.DevicePlatform == eDevicePlatform.Server
+ ? string.Format("http(s)://{0}/VirtualControl/Rooms/{1}/cws{2}", hostname, InitialParametersClass.RoomId, BasePath)
+ : string.Format("http(s)://{0}/cws{1}", currentIp, BasePath);
+
+ Debug.Console(DebugTrace, this, "Server:{0}", path);
+
+ var routeCollection = _server.GetRouteCollection();
+ if (routeCollection == null)
+ {
+ Debug.Console(DebugTrace, this, "Server route collection is null");
+ return;
+ }
+ Debug.Console(DebugTrace, this, "Configured Routes:");
+ foreach (var route in routeCollection)
+ {
+ Debug.Console(DebugTrace, this, "{0}: {1}/{2}", route.Name, path, route.Url);
+ }
+ Debug.Console(DebugTrace, this, "{0}", new String('-', 50));
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiFactory.cs
new file mode 100644
index 00000000..51361c2c
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiFactory.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+using PepperDash.Core;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Web
+{
+ public class EssentialsWebApiFactory : EssentialsDeviceFactory
+ {
+ public EssentialsWebApiFactory()
+ {
+ TypeNames = new List { "EssentialsWebApi" };
+ }
+
+ public override EssentialsDevice BuildDevice(DeviceConfig dc)
+ {
+ Debug.Console(1, "Factory Attempting to create new Essentials Web API Server");
+
+ var props = dc.Properties.ToObject();
+ if (props != null) return new EssemtialsWebApi(dc.Key, dc.Name, props);
+
+ Debug.Console(1, "Factory failed to create new Essentials Web API Server");
+ return null;
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiHelpers.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiHelpers.cs
new file mode 100644
index 00000000..4830edb4
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiHelpers.cs
@@ -0,0 +1,87 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp.WebScripting;
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core.Web
+{
+ public class EssentialsWebApiHelpers
+ {
+ public static string GetRequestBody(HttpCwsRequest request)
+ {
+ var bytes = new Byte[request.ContentLength];
+
+ request.InputStream.Read(bytes, 0, request.ContentLength);
+
+ return Encoding.UTF8.GetString(bytes, 0, bytes.Length);
+ }
+
+ public static object MapToAssemblyObject(LoadedAssembly assembly)
+ {
+ return new
+ {
+ Name = assembly.Name,
+ Version = assembly.Version
+ };
+ }
+
+ public static object MapToDeviceListObject(IKeyed device)
+ {
+ return new
+ {
+ Key = device.Key,
+ Name = (device is IKeyName)
+ ? (device as IKeyName).Name
+ : "---"
+ };
+ }
+
+ public static object MapJoinToObject(string key, JoinMapBaseAdvanced join)
+ {
+ var kp = new KeyValuePair(key, join);
+
+ return MapJoinToObject(kp);
+ }
+
+ public static object MapJoinToObject(KeyValuePair join)
+ {
+ return new
+ {
+ DeviceKey = join.Key,
+ Joins = join.Value.Joins.Select(j => MapJoinDataCompleteToObject(j))
+ };
+ }
+
+ public static object MapJoinDataCompleteToObject(KeyValuePair joinData)
+ {
+ return new
+ {
+ Signal = joinData.Key,
+ Description = joinData.Value.Metadata.Description,
+ JoinNumber = joinData.Value.JoinNumber,
+ JoinSpan = joinData.Value.JoinSpan,
+ JoinType = joinData.Value.Metadata.JoinType.ToString(),
+ JoinCapabilities = joinData.Value.Metadata.JoinCapabilities.ToString()
+ };
+ }
+
+ public static object MapDeviceTypeToObject(string key, DeviceFactoryWrapper device)
+ {
+ var kp = new KeyValuePair(key, device);
+
+ return MapDeviceTypeToObject(kp);
+ }
+
+ public static object MapDeviceTypeToObject(KeyValuePair device)
+ {
+ return new
+ {
+ Type = device.Key,
+ Description = device.Value.Description,
+ CType = device.Value.CType == null ? "---": device.Value.CType.ToString()
+ };
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiPropertiesConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiPropertiesConfig.cs
new file mode 100644
index 00000000..a57e1ce9
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/EssentialsWebApiPropertiesConfig.cs
@@ -0,0 +1,10 @@
+using Newtonsoft.Json;
+
+namespace PepperDash.Essentials.Core.Web
+{
+ public class EssentialsWebApiPropertiesConfig
+ {
+ [JsonProperty("basePath")]
+ public string BasePath { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/AppDebugRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/AppDebugRequestHandler.cs
new file mode 100644
index 00000000..bbe4bd22
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/AppDebugRequestHandler.cs
@@ -0,0 +1,82 @@
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class AppDebugRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public AppDebugRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var appDebug = new AppDebug { Level = Debug.Level };
+
+ var body = JsonConvert.SerializeObject(appDebug, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.Write(body, false);
+ context.Response.End();
+ }
+
+ ///
+ /// Handles POST method requests
+ ///
+ ///
+ protected override void HandlePost(HttpCwsContext context)
+ {
+ if (context.Request.ContentLength < 0)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var data = EssentialsWebApiHelpers.GetRequestBody(context.Request);
+ if (string.IsNullOrEmpty(data))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var appDebug = new AppDebug();
+ var requestBody = JsonConvert.DeserializeAnonymousType(data, appDebug);
+
+ Debug.SetDebugLevel(requestBody.Level);
+
+ appDebug.Level = Debug.Level;
+ var responseBody = JsonConvert.SerializeObject(appDebug, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.Write(responseBody, false);
+ context.Response.End();
+ }
+ }
+
+ public class AppDebug
+ {
+ [JsonProperty("level", NullValueHandling = NullValueHandling.Ignore)]
+ public int Level { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DefaultRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DefaultRequestHandler.cs
new file mode 100644
index 00000000..786962f5
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DefaultRequestHandler.cs
@@ -0,0 +1,118 @@
+using Crestron.SimplSharp.WebScripting;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class DefaultRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DefaultRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles CONNECT method requests
+ ///
+ ///
+ protected override void HandleConnect(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles DELETE method requests
+ ///
+ ///
+ protected override void HandleDelete(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles HEAD method requests
+ ///
+ ///
+ protected override void HandleHead(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles OPTIONS method requests
+ ///
+ ///
+ protected override void HandleOptions(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles PATCH method requests
+ ///
+ ///
+ protected override void HandlePatch(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles POST method requests
+ ///
+ ///
+ protected override void HandlePost(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles PUT method requests
+ ///
+ ///
+ protected override void HandlePut(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles TRACE method requests
+ ///
+ ///
+ protected override void HandleTrace(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 418;
+ context.Response.StatusDescription = "I'm a teapot";
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs
new file mode 100644
index 00000000..7a9162bd
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevJsonRequestHandler.cs
@@ -0,0 +1,66 @@
+using System;
+using Crestron.SimplSharp.WebScripting;
+using PepperDash.Core;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class DevJsonRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DevJsonRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles POST method requests
+ ///
+ ///
+ protected override void HandlePost(HttpCwsContext context)
+ {
+ if (context.Request.ContentLength < 0)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var data = EssentialsWebApiHelpers.GetRequestBody(context.Request);
+ if (string.IsNullOrEmpty(data))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ try
+ {
+ DeviceJsonApi.DoDeviceActionWithJson(data);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.End();
+ }
+ catch (Exception ex)
+ {
+ Debug.Console(1, "Exception Message: {0}", ex.Message);
+ Debug.Console(2, "Exception Stack Trace: {0}", ex.StackTrace);
+ if(ex.InnerException != null) Debug.Console(2, "Exception Inner: {0}", ex.InnerException);
+
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs
new file mode 100644
index 00000000..cf2a1e78
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevListRequestHandler.cs
@@ -0,0 +1,51 @@
+using System.Linq;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class DevListRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DevListRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var allDevices = DeviceManager.AllDevices;
+ if (allDevices == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ allDevices.Sort((a, b) => System.String.Compare(a.Key, b.Key, System.StringComparison.Ordinal));
+
+ var deviceList = allDevices.Select(d => EssentialsWebApiHelpers.MapToDeviceListObject(d)).ToList();
+
+ var js = JsonConvert.SerializeObject(deviceList, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs
new file mode 100644
index 00000000..be8d154d
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DevPropsRequestHandler.cs
@@ -0,0 +1,76 @@
+using System.Text;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class DevPropsRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DevPropsRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles POST method requests
+ ///
+ ///
+ protected override void HandlePost(HttpCwsContext context)
+ {
+ if (context.Request.ContentLength < 0)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var data = EssentialsWebApiHelpers.GetRequestBody(context.Request);
+ if (string.IsNullOrEmpty(data))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var o = new DeviceActionWrapper();
+ var body = JsonConvert.DeserializeAnonymousType(data, o);
+
+ if (string.IsNullOrEmpty(body.DeviceKey))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var deviceProps = DeviceJsonApi.GetProperties(body.DeviceKey);
+ if (deviceProps == null || deviceProps.ToLower().Contains("no device"))
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = Encoding.UTF8;
+ context.Response.Write(deviceProps, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs
new file mode 100644
index 00000000..2e4546f4
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/DisableAllStreamDebugRequestHandler.cs
@@ -0,0 +1,32 @@
+using Crestron.SimplSharp.WebScripting;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class DisableAllStreamDebugRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public DisableAllStreamDebugRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles POST method requests
+ ///
+ ///
+ protected override void HandlePost(HttpCwsContext context)
+ {
+ DeviceManager.DisableAllDeviceStreamDebugging();
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs
new file mode 100644
index 00000000..5d76bc73
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetFeedbacksForDeviceRequestHandler.cs
@@ -0,0 +1,102 @@
+using System.Linq;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class GetFeedbacksForDeviceRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetFeedbacksForDeviceRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var routeData = context.Request.RouteData;
+ if (routeData == null)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ object deviceObj;
+ if (!routeData.Values.TryGetValue("deviceKey", out deviceObj))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+
+ var device = DeviceManager.GetDeviceForKey(deviceObj.ToString()) as IHasFeedback;
+ if (device == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ var boolFeedback =
+ from feedback in device.Feedbacks.OfType()
+ where !string.IsNullOrEmpty(feedback.Key)
+ select new
+ {
+ FeedbackKey = feedback.Key,
+ Value = feedback.BoolValue
+ };
+
+ var intFeedback =
+ from feedback in device.Feedbacks.OfType()
+ where !string.IsNullOrEmpty(feedback.Key)
+ select new
+ {
+ FeedbackKey = feedback.Key,
+ Value = feedback.IntValue
+ };
+
+ var stringFeedback =
+ from feedback in device.Feedbacks.OfType()
+ where !string.IsNullOrEmpty(feedback.Key)
+ select new
+ {
+ FeedbackKey = feedback.Key,
+ Value = feedback.StringValue ?? string.Empty
+ };
+
+ var responseObj = new
+ {
+ BoolValues = boolFeedback,
+ IntValues = intFeedback,
+ SerialValues = stringFeedback
+ };
+
+ var js = JsonConvert.SerializeObject(responseObj, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs
new file mode 100644
index 00000000..7e15fd5e
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForBridgeKeyRequestHandler.cs
@@ -0,0 +1,78 @@
+using System.Linq;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class GetJoinMapForBridgeKeyRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetJoinMapForBridgeKeyRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var routeData = context.Request.RouteData;
+ if (routeData == null)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ object bridgeObj;
+ if (!routeData.Values.TryGetValue("bridgeKey", out bridgeObj))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var bridge = DeviceManager.GetDeviceForKey(bridgeObj.ToString()) as EiscApiAdvanced;
+ if (bridge == null)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var joinMap = bridge.JoinMaps.Select(j => EssentialsWebApiHelpers.MapJoinToObject(j)).ToList();
+ if (joinMap == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ var js = JsonConvert.SerializeObject(joinMap, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs
new file mode 100644
index 00000000..77d7f8ea
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetJoinMapForDeviceKeyRequestHandler.cs
@@ -0,0 +1,95 @@
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class GetJoinMapForDeviceKeyRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetJoinMapForDeviceKeyRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var routeData = context.Request.RouteData;
+ if (routeData == null)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ object bridgeObj;
+ if (!routeData.Values.TryGetValue("bridgeKey", out bridgeObj))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ object deviceObj;
+ if (!routeData.Values.TryGetValue("deviceKey", out deviceObj))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var bridge = DeviceManager.GetDeviceForKey(bridgeObj.ToString()) as EiscApiAdvanced;
+ if (bridge == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ JoinMapBaseAdvanced deviceJoinMap;
+ if (!bridge.JoinMaps.TryGetValue(deviceObj.ToString(), out deviceJoinMap))
+ {
+ context.Response.StatusCode = 500;
+ context.Response.StatusDescription = "Internal Server Error";
+ context.Response.End();
+
+ return;
+ }
+
+ var joinMap = EssentialsWebApiHelpers.MapJoinToObject(deviceObj.ToString(), deviceJoinMap);
+ var js = JsonConvert.SerializeObject(joinMap, Formatting.Indented, new JsonSerializerSettings
+ {
+ ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
+ NullValueHandling = NullValueHandling.Ignore,
+ MissingMemberHandling = MissingMemberHandling.Ignore,
+ DefaultValueHandling = DefaultValueHandling.Ignore,
+ TypeNameHandling = TypeNameHandling.None
+ });
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs
new file mode 100644
index 00000000..706793e7
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesByFilterRequestHandler.cs
@@ -0,0 +1,68 @@
+using System.Linq;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class GetTypesByFilterRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetTypesByFilterRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var routeData = context.Request.RouteData;
+ if (routeData == null)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ object filterObj;
+ if (!routeData.Values.TryGetValue("filter", out filterObj))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var deviceFactory = DeviceFactory.GetDeviceFactoryDictionary(filterObj.ToString());
+ if (deviceFactory == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ var deviceTypes = deviceFactory.Select(t => EssentialsWebApiHelpers.MapDeviceTypeToObject(t)).ToList();
+ var js = JsonConvert.SerializeObject(deviceTypes, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs
new file mode 100644
index 00000000..9d5f1150
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/GetTypesRequestHandler.cs
@@ -0,0 +1,58 @@
+using System.Linq;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class GetTypesRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public GetTypesRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var routeData = context.Request.RouteData;
+ if (routeData == null)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var deviceFactory = DeviceFactory.GetDeviceFactoryDictionary(null);
+ if (deviceFactory == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ var deviceTypes = deviceFactory.Select(t => EssentialsWebApiHelpers.MapDeviceTypeToObject(t)).ToList();
+ var js = JsonConvert.SerializeObject(deviceTypes, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/ReportVersionsRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/ReportVersionsRequestHandler.cs
new file mode 100644
index 00000000..e6fb45f1
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/ReportVersionsRequestHandler.cs
@@ -0,0 +1,49 @@
+using System.Linq;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class ReportVersionsRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public ReportVersionsRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var loadAssemblies = PluginLoader.LoadedAssemblies;
+ if (loadAssemblies == null)
+ {
+ context.Response.StatusCode = 500;
+ context.Response.StatusDescription = "Internal Server Error";
+ context.Response.End();
+
+ return;
+ }
+
+ var assemblies = loadAssemblies.Select(a => EssentialsWebApiHelpers.MapToAssemblyObject(a)).ToList();
+
+ var js = JsonConvert.SerializeObject(assemblies, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(js, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/SetDeviceStreamDebugRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/SetDeviceStreamDebugRequestHandler.cs
new file mode 100644
index 00000000..bb7cc12f
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/SetDeviceStreamDebugRequestHandler.cs
@@ -0,0 +1,212 @@
+using System;
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core;
+using PepperDash.Core.Web.RequestHandlers;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class SetDeviceStreamDebugRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Handles CONNECT method requests
+ ///
+ ///
+ protected override void HandleConnect(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles DELETE method requests
+ ///
+ ///
+ protected override void HandleDelete(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles HEAD method requests
+ ///
+ ///
+ protected override void HandleHead(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles OPTIONS method requests
+ ///
+ ///
+ protected override void HandleOptions(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles PATCH method requests
+ ///
+ ///
+ protected override void HandlePatch(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles POST method requests
+ ///
+ ///
+ protected override void HandlePost(HttpCwsContext context)
+ {
+ if (context.Request.ContentLength < 0)
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var data = EssentialsWebApiHelpers.GetRequestBody(context.Request);
+ if (data == null)
+ {
+ context.Response.StatusCode = 500;
+ context.Response.StatusDescription = "Internal Server Error";
+ context.Response.End();
+
+ return;
+ }
+
+ var config = new SetDeviceStreamDebugConfig();
+ var body = JsonConvert.DeserializeAnonymousType(data, config);
+ if (body == null)
+ {
+ context.Response.StatusCode = 500;
+ context.Response.StatusDescription = "Internal Server Error";
+ context.Response.End();
+
+ return;
+ }
+
+ if (string.IsNullOrEmpty(body.DeviceKey) || string.IsNullOrEmpty(body.Setting))
+ {
+ context.Response.StatusCode = 400;
+ context.Response.StatusDescription = "Bad Request";
+ context.Response.End();
+
+ return;
+ }
+
+ var device = DeviceManager.GetDeviceForKey(body.DeviceKey) as IStreamDebugging;
+ if (device == null)
+ {
+ context.Response.StatusCode = 404;
+ context.Response.StatusDescription = "Not Found";
+ context.Response.End();
+
+ return;
+ }
+
+ eStreamDebuggingSetting debugSetting;
+ try
+ {
+ debugSetting = (eStreamDebuggingSetting) Enum.Parse(typeof (eStreamDebuggingSetting), body.Setting, true);
+ }
+ catch (Exception ex)
+ {
+ context.Response.StatusCode = 500;
+ context.Response.StatusDescription = "Internal Server Error";
+ context.Response.End();
+
+ return;
+ }
+
+ try
+ {
+ var mins = Convert.ToUInt32(body.Timeout);
+ if (mins > 0)
+ {
+ device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, mins);
+ }
+ else
+ {
+ device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting);
+ }
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.End();
+ }
+ catch (Exception ex)
+ {
+ context.Response.StatusCode = 500;
+ context.Response.StatusDescription = "Internal Server Error";
+ context.Response.End();
+ }
+ }
+
+ ///
+ /// Handles PUT method requests
+ ///
+ ///
+ protected override void HandlePut(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+
+ ///
+ /// Handles TRACE method requests
+ ///
+ ///
+ protected override void HandleTrace(HttpCwsContext context)
+ {
+ context.Response.StatusCode = 501;
+ context.Response.StatusDescription = "Not Implemented";
+ context.Response.End();
+ }
+ }
+
+
+ public class SetDeviceStreamDebugConfig
+ {
+ [JsonProperty("deviceKey", NullValueHandling = NullValueHandling.Include)]
+ public string DeviceKey { get; set; }
+
+ [JsonProperty("setting", NullValueHandling = NullValueHandling.Include)]
+ public string Setting { get; set; }
+
+ [JsonProperty("timeout")]
+ public int Timeout { get; set; }
+
+ public SetDeviceStreamDebugConfig()
+ {
+ DeviceKey = null;
+ Setting = null;
+ Timeout = 15;
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/ShowConfigRequestHandler.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/ShowConfigRequestHandler.cs
new file mode 100644
index 00000000..89da86b3
--- /dev/null
+++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Web/RequestHandlers/ShowConfigRequestHandler.cs
@@ -0,0 +1,37 @@
+using Crestron.SimplSharp.WebScripting;
+using Newtonsoft.Json;
+using PepperDash.Core.Web.RequestHandlers;
+using PepperDash.Essentials.Core.Config;
+
+namespace PepperDash.Essentials.Core.Web.RequestHandlers
+{
+ public class ShowConfigRequestHandler : WebApiBaseRequestHandler
+ {
+ ///
+ /// Constructor
+ ///
+ ///
+ /// base(true) enables CORS support by default
+ ///
+ public ShowConfigRequestHandler()
+ : base(true)
+ {
+ }
+
+ ///
+ /// Handles GET method requests
+ ///
+ ///
+ protected override void HandleGet(HttpCwsContext context)
+ {
+ var config = JsonConvert.SerializeObject(ConfigReader.ConfigObject, Formatting.Indented);
+
+ context.Response.StatusCode = 200;
+ context.Response.StatusDescription = "OK";
+ context.Response.ContentType = "application/json";
+ context.Response.ContentEncoding = System.Text.Encoding.UTF8;
+ context.Response.Write(config, false);
+ context.Response.End();
+ }
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs
index ce2204fe..ff07a54b 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs
@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.DM.AirMedia
[Description("Wrapper class for an AM-200 or AM-300")]
public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IIROutputPorts, IComPorts
{
- public AmX00 AirMedia { get; private set; }
+ public Am3x00 AirMedia { get; private set; }
public DeviceConfig DeviceConfig { get; private set; }
@@ -44,7 +44,7 @@ namespace PepperDash.Essentials.DM.AirMedia
public StringFeedback SerialNumberFeedback { 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, Am3x00 device, DeviceConfig dc, AirMediaPropertiesConfig props)
: base(key, name, device)
{
@@ -95,24 +95,31 @@ namespace PepperDash.Essentials.DM.AirMedia
AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange);
- IsInSessionFeedback = new BoolFeedback(new Func(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0));
- ErrorFeedback = new IntFeedback(new Func(() => AirMedia.AirMedia.ErrorFeedback.UShortValue));
- NumberOfUsersConnectedFeedback = new IntFeedback(new Func(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue));
- LoginCodeFeedback = new IntFeedback(new Func(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue));
- ConnectionAddressFeedback = new StringFeedback(new Func(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue));
- HostnameFeedback = new StringFeedback(new Func(() => AirMedia.AirMedia.HostNameFeedback.StringValue));
+ IsInSessionFeedback = new BoolFeedback(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0);
+ ErrorFeedback = new IntFeedback(() => AirMedia.AirMedia.ErrorFeedback.UShortValue);
+ NumberOfUsersConnectedFeedback = new IntFeedback(() => AirMedia.AirMedia.NumberOfUsersConnectedFeedback.UShortValue);
+ LoginCodeFeedback = new IntFeedback(() => AirMedia.AirMedia.LoginCodeFeedback.UShortValue);
+ ConnectionAddressFeedback = new StringFeedback(() => AirMedia.AirMedia.ConnectionAddressFeedback.StringValue);
+ HostnameFeedback = new StringFeedback(() => AirMedia.AirMedia.HostNameFeedback.StringValue);
// TODO: Figure out if we can actually get the TSID/Serial
- SerialNumberFeedback = new StringFeedback(new Func(() => "unknown"));
+ SerialNumberFeedback = new StringFeedback(() => "unknown");
- AirMedia.DisplayControl.DisplayControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(DisplayControl_DisplayControlChange);
+ AirMedia.DisplayControl.DisplayControlChange += DisplayControl_DisplayControlChange;
- VideoOutFeedback = new IntFeedback(new Func(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback)));
- AutomaticInputRoutingEnabledFeedback = new BoolFeedback(new Func(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue));
+ VideoOutFeedback = new IntFeedback(() => Convert.ToInt16(AirMedia.DisplayControl.VideoOutFeedback));
+ AutomaticInputRoutingEnabledFeedback = new BoolFeedback(() => AirMedia.DisplayControl.EnableAutomaticRoutingFeedback.BoolValue);
- AirMedia.HdmiIn.StreamChange += new Crestron.SimplSharpPro.DeviceSupport.StreamEventHandler(HdmiIn_StreamChange);
+ // Not all AirMedia versions support HDMI In like the 3200
+ if (AirMedia.HdmiIn != null)
+ {
+ AirMedia.HdmiIn.StreamChange += HdmiIn_StreamChange;
+ HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue);
+ return;
+ }
- HdmiVideoSyncDetectedFeedback = new BoolFeedback(new Func(() => AirMedia.HdmiIn.SyncDetectedFeedback.BoolValue));
+ // Return false if the AirMedia device doesn't support HDMI Input
+ HdmiVideoSyncDetectedFeedback = new BoolFeedback(() => false);
}
public override bool CustomActivate()
@@ -122,7 +129,7 @@ namespace PepperDash.Essentials.DM.AirMedia
else
AirMedia.DisplayControl.DisableAutomaticRouting();
- return base.CustomActivate();
+ return true;
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
@@ -179,31 +186,53 @@ namespace PepperDash.Essentials.DM.AirMedia
/// Arguments defined as IKeyName sender, output, input, and eRoutingSignalType
private void OnSwitchChange(RoutingNumericEventArgs e)
{
- var newEvent = NumericSwitchChange;
- if (newEvent != null) newEvent(this, e);
- }
+ var handler = NumericSwitchChange;
+
+ if (handler == null) return;
+
+ handler(this, e);
+ }
void AirMedia_AirMediaChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{
- if (args.EventId == AirMediaInputSlot.AirMediaStatusFeedbackEventId)
- IsInSessionFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaErrorFeedbackEventId)
- ErrorFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaNumberOfUserConnectedEventId)
- NumberOfUsersConnectedFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaLoginCodeEventId)
- LoginCodeFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaConnectionAddressFeedbackEventId)
- ConnectionAddressFeedback.FireUpdate();
- else if (args.EventId == AirMediaInputSlot.AirMediaHostNameFeedbackEventId)
- HostnameFeedback.FireUpdate();
+ switch (args.EventId)
+ {
+ case AirMediaInputSlot.AirMediaStatusFeedbackEventId:
+ {
+ IsInSessionFeedback.FireUpdate();
+ break;
+ }
+ case AirMediaInputSlot.AirMediaErrorFeedbackEventId:
+ {
+ ErrorFeedback.FireUpdate();
+ break;
+ }
+ case AirMediaInputSlot.AirMediaNumberOfUserConnectedEventId:
+ {
+ NumberOfUsersConnectedFeedback.FireUpdate();
+ break;
+ }
+ case AirMediaInputSlot.AirMediaLoginCodeEventId:
+ {
+ LoginCodeFeedback.FireUpdate();
+ break;
+ }
+ case AirMediaInputSlot.AirMediaConnectionAddressFeedbackEventId:
+ {
+ ConnectionAddressFeedback.FireUpdate();
+ break;
+ }
+ case AirMediaInputSlot.AirMediaHostNameFeedbackEventId:
+ {
+ HostnameFeedback.FireUpdate();
+ break;
+ }
+ }
}
void DisplayControl_DisplayControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
{
- if (args.EventId == AmX00.VideoOutFeedbackEventId)
- {
VideoOutFeedback.FireUpdate();
var localInputPort =
@@ -211,8 +240,7 @@ namespace PepperDash.Essentials.DM.AirMedia
OnSwitchChange(new RoutingNumericEventArgs(1, VideoOutFeedback.UShortValue, OutputPorts.First(),
localInputPort, eRoutingSignalType.AudioVideo));
- }
- else if (args.EventId == AmX00.EnableAutomaticRoutingFeedbackEventId)
+
AutomaticInputRoutingEnabledFeedback.FireUpdate();
}
@@ -342,7 +370,7 @@ namespace PepperDash.Essentials.DM.AirMedia
{
public AirMediaControllerFactory()
{
- TypeNames = new List() { "am200", "am300" };
+ TypeNames = new List() { "am200", "am300", "am3200" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
@@ -351,12 +379,26 @@ namespace PepperDash.Essentials.DM.AirMedia
Debug.Console(1, "Factory Attempting to create new AirMedia Device");
- var props = JsonConvert.DeserializeObject(dc.Properties.ToString());
- AmX00 amDevice = null;
- if (type == "am200")
- amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am200(props.Control.IpIdInt, Global.ControlSystem);
- else if (type == "am300")
- amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem);
+ var props = dc.Properties.ToObject();
+ Am3x00 amDevice = null;
+ switch (type)
+ {
+ case "am200" :
+ {
+ amDevice = new Am200(props.Control.IpIdInt, Global.ControlSystem);
+ break;
+ }
+ case "am300" :
+ {
+ amDevice = new Am300(props.Control.IpIdInt, Global.ControlSystem);
+ break;
+ }
+ case "am3200" :
+ {
+ amDevice = new Am3200(props.Control.IpIdInt, Global.ControlSystem);
+ break;
+ }
+ }
return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props);
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs
index ec3553a1..bfea158e 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs
@@ -28,6 +28,8 @@ namespace PepperDash.Essentials.DM
InputPorts = new RoutingPortCollection {DmIn};
OutputPorts = new RoutingPortCollection {HDBaseTSink};
+ PreventRegistration = true;
+ rmc.Register();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs
index f33dd5be..0753ed4a 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs
@@ -1,99 +1,99 @@
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
-
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
- ///
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.DM;
+using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
+
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.DM
+{
+ ///
+ /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
+ ///
///
- [Description("Wrapper Class for DM-RMC-150-S")]
- public class DmRmc150SController : DmRmcControllerBase, IRoutingInputsOutputs,
- IIROutputPorts, IComPorts, ICec
- {
- private readonly DmRmc150S _rmc;
-
- public RoutingInputPort DmIn { get; private set; }
- public RoutingOutputPort HdmiOut { get; private set; }
-
- public RoutingPortCollection InputPorts
- {
- get; private set;
- }
-
- public RoutingPortCollection OutputPorts
- {
- get;
- private set ;
- }
-
- ///
- /// Make a Crestron RMC and put it in here
- ///
- public DmRmc150SController(string key, string name, DmRmc150S rmc)
- : base(key, name, rmc)
- {
- _rmc = rmc;
- DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.DmCat, 0, this);
- HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, null, this);
-
- EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
- EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
- EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
- EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
-
- InputPorts = new RoutingPortCollection {DmIn};
- OutputPorts = new RoutingPortCollection {HdmiOut};
-
- _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
-
- // Set Ports for CEC
- HdmiOut.Port = _rmc.HdmiOutput;
- }
-
- void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
- {
- switch (args.EventId)
- {
- case ConnectedDeviceEventIds.ManufacturerEventId:
- EdidManufacturerFeedback.FireUpdate();
- break;
- case ConnectedDeviceEventIds.NameEventId:
- EdidNameFeedback.FireUpdate();
- break;
- case ConnectedDeviceEventIds.PreferredTimingEventId:
- EdidPreferredTimingFeedback.FireUpdate();
- break;
- case ConnectedDeviceEventIds.SerialNumberEventId:
- EdidSerialNumberFeedback.FireUpdate();
- break;
- }
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
- }
-
- #region IIROutputPorts Members
- public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } }
- public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } }
- #endregion
-
- #region IComPorts Members
- public CrestronCollection ComPorts { get { return _rmc.ComPorts; } }
- public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } }
- #endregion
-
- #region ICec Members
- public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } }
- #endregion
- }
+ [Description("Wrapper Class for DM-RMC-150-S")]
+ public class DmRmc150SController : DmRmcControllerBase, IRoutingInputsOutputs,
+ IIROutputPorts, IComPorts, ICec
+ {
+ private readonly DmRmc150S _rmc;
+
+ public RoutingInputPort DmIn { get; private set; }
+ public RoutingOutputPort HdmiOut { get; private set; }
+
+ public RoutingPortCollection InputPorts
+ {
+ get; private set;
+ }
+
+ public RoutingPortCollection OutputPorts
+ {
+ get;
+ private set ;
+ }
+
+ ///
+ /// Make a Crestron RMC and put it in here
+ ///
+ public DmRmc150SController(string key, string name, DmRmc150S rmc)
+ : base(key, name, rmc)
+ {
+ _rmc = rmc;
+ DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
+ eRoutingPortConnectionType.DmCat, 0, this);
+ HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
+ eRoutingPortConnectionType.Hdmi, null, this);
+
+ EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
+ EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
+ EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
+ EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
+
+ InputPorts = new RoutingPortCollection {DmIn};
+ OutputPorts = new RoutingPortCollection {HdmiOut};
+
+ _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
+
+ // Set Ports for CEC
+ HdmiOut.Port = _rmc.HdmiOutput;
+ }
+
+ void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
+ {
+ switch (args.EventId)
+ {
+ case ConnectedDeviceEventIds.ManufacturerEventId:
+ EdidManufacturerFeedback.FireUpdate();
+ break;
+ case ConnectedDeviceEventIds.NameEventId:
+ EdidNameFeedback.FireUpdate();
+ break;
+ case ConnectedDeviceEventIds.PreferredTimingEventId:
+ EdidPreferredTimingFeedback.FireUpdate();
+ break;
+ case ConnectedDeviceEventIds.SerialNumberEventId:
+ EdidSerialNumberFeedback.FireUpdate();
+ break;
+ }
+ }
+
+ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
+ {
+ LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
+ }
+
+ #region IIROutputPorts Members
+ public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } }
+ public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } }
+ #endregion
+
+ #region IComPorts Members
+ public CrestronCollection ComPorts { get { return _rmc.ComPorts; } }
+ public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } }
+ #endregion
+
+ #region ICec Members
+ public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } }
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs
index ed5bd378..df39e4ee 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs
@@ -1,111 +1,111 @@
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Endpoints;
-using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
-
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
- ///
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.DM;
+using Crestron.SimplSharpPro.DM.Endpoints;
+using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
+
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.DM
+{
+ ///
+ /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions
+ ///
///
[Description("Wrapper Class for DM-RMC-200-C")]
- public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs,
- IIROutputPorts, IComPorts, ICec
- {
- private readonly DmRmc200C _rmc;
-
- public RoutingInputPort DmIn { get; private set; }
+ public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs,
+ IIROutputPorts, IComPorts, ICec
+ {
+ private readonly DmRmc200C _rmc;
+
+ public RoutingInputPort DmIn { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
-
- public RoutingPortCollection InputPorts
- {
- get; private set;
- }
-
- public RoutingPortCollection OutputPorts
- {
- get; private set;
- }
-
- ///
- /// Make a Crestron RMC and put it in here
- ///
- public DmRmc200CController(string key, string name, DmRmc200C rmc)
- : base(key, name, rmc)
- {
- _rmc = rmc;
- DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.DmCat, 0, this);
- HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, null, this);
-
- EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
- EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
- EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
- EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
-
- VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
-
- _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
- _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
-
- InputPorts = new RoutingPortCollection {DmIn};
- OutputPorts = new RoutingPortCollection {HdmiOut};
-
- // Set Ports for CEC
- HdmiOut.Port = _rmc.HdmiOutput;
- }
-
- void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
- {
- if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
- args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
- {
- VideoOutputResolutionFeedback.FireUpdate();
- }
- }
-
- void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
- {
- switch (args.EventId)
- {
- case ConnectedDeviceEventIds.ManufacturerEventId:
- EdidManufacturerFeedback.FireUpdate();
- break;
- case ConnectedDeviceEventIds.NameEventId:
- EdidNameFeedback.FireUpdate();
- break;
- case ConnectedDeviceEventIds.PreferredTimingEventId:
- EdidPreferredTimingFeedback.FireUpdate();
- break;
- case ConnectedDeviceEventIds.SerialNumberEventId:
- EdidSerialNumberFeedback.FireUpdate();
- break;
- }
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
- }
-
- #region IIROutputPorts Members
- public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } }
- public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } }
- #endregion
-
- #region IComPorts Members
- public CrestronCollection ComPorts { get { return _rmc.ComPorts; } }
- public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } }
- #endregion
-
- #region ICec Members
- public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } }
- #endregion
- }
+
+ public RoutingPortCollection InputPorts
+ {
+ get; private set;
+ }
+
+ public RoutingPortCollection OutputPorts
+ {
+ get; private set;
+ }
+
+ ///
+ /// Make a Crestron RMC and put it in here
+ ///
+ public DmRmc200CController(string key, string name, DmRmc200C rmc)
+ : base(key, name, rmc)
+ {
+ _rmc = rmc;
+ DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo,
+ eRoutingPortConnectionType.DmCat, 0, this);
+ HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo,
+ eRoutingPortConnectionType.Hdmi, null, this);
+
+ EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
+ EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
+ EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
+ EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
+
+ VideoOutputResolutionFeedback = new StringFeedback(() => _rmc.HdmiOutput.GetVideoResolutionString());
+
+ _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
+ _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
+
+ InputPorts = new RoutingPortCollection {DmIn};
+ OutputPorts = new RoutingPortCollection {HdmiOut};
+
+ // Set Ports for CEC
+ HdmiOut.Port = _rmc.HdmiOutput;
+ }
+
+ void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
+ {
+ if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
+ args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
+ {
+ VideoOutputResolutionFeedback.FireUpdate();
+ }
+ }
+
+ void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
+ {
+ switch (args.EventId)
+ {
+ case ConnectedDeviceEventIds.ManufacturerEventId:
+ EdidManufacturerFeedback.FireUpdate();
+ break;
+ case ConnectedDeviceEventIds.NameEventId:
+ EdidNameFeedback.FireUpdate();
+ break;
+ case ConnectedDeviceEventIds.PreferredTimingEventId:
+ EdidPreferredTimingFeedback.FireUpdate();
+ break;
+ case ConnectedDeviceEventIds.SerialNumberEventId:
+ EdidSerialNumberFeedback.FireUpdate();
+ break;
+ }
+ }
+
+ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
+ {
+ LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
+ }
+
+ #region IIROutputPorts Members
+ public CrestronCollection IROutputPorts { get { return _rmc.IROutputPorts; } }
+ public int NumberOfIROutputPorts { get { return _rmc.NumberOfIROutputPorts; } }
+ #endregion
+
+ #region IComPorts Members
+ public CrestronCollection ComPorts { get { return _rmc.ComPorts; } }
+ public int NumberOfComPorts { get { return _rmc.NumberOfComPorts; } }
+ #endregion
+
+ #region ICec Members
+ public Cec StreamCec { get { return _rmc.HdmiOutput.StreamCec; } }
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs
index 529f740a..d92d9620 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs
@@ -32,7 +32,9 @@ namespace PepperDash.Essentials.DM
eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc};
InputPorts = new RoutingPortCollection {DmIn};
- OutputPorts = new RoutingPortCollection {HdmiOut};
+ OutputPorts = new RoutingPortCollection {HdmiOut};
+ PreventRegistration = true;
+ rmc.Register();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
index 5d644a2a..e237c3a5 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs
@@ -329,6 +329,9 @@ namespace PepperDash.Essentials.DM
DmRmcPropertiesConfig props, string pKey, uint ipid)
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
+ CrestronGenericBaseDevice rx;
+ bool useChassisForOfflineFeedback = false;
+
if (parentDev is DmpsRoutingController)
{
var dmps = parentDev as DmpsRoutingController;
@@ -342,22 +345,33 @@ namespace PepperDash.Essentials.DM
return null;
}
// Must use different constructor for DMPS4K types. No IPID
- if (Global.ControlSystemIsDmps4kType || typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
+ if (Global.ControlSystemIsDmps4kType)
{
- var rmc = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber);
- Debug.Console(0, "DM endpoint output {0} is for Dmps4k, changing online feedback to chassis", num);
- rmc.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue);
+ rx = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber);
+ useChassisForOfflineFeedback = true;
+ }
+ else
+ {
+ rx = GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber);
+ if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
+ {
+ useChassisForOfflineFeedback = true;
+ }
+ }
+ if (useChassisForOfflineFeedback)
+ {
+ Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
+ rx.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue);
dmps.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
{
- foreach (var feedback in rmc.Feedbacks)
+ foreach (var feedback in rx.Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
- return rmc;
}
- return GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber);
+ return rx;
}
else if (parentDev is DmChassisController)
{
@@ -380,23 +394,33 @@ namespace PepperDash.Essentials.DM
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
- chassis is DmMd128x128 || chassis is DmMd64x64
- || typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
+ chassis is DmMd128x128 || chassis is DmMd64x64)
{
- var rmc = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev);
- Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
- rmc.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue);
- controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
- {
- foreach (var feedback in rmc.Feedbacks)
- {
- if (feedback != null)
- feedback.FireUpdate();
- }
- };
- return rmc;
+ rx = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev);
+ useChassisForOfflineFeedback = true;
}
- return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev);
+ else
+ {
+ rx = GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev);
+ if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
+ {
+ useChassisForOfflineFeedback = true;
+ }
+ }
+ if (useChassisForOfflineFeedback)
+ {
+ Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
+ rx.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue);
+ controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
+ {
+ foreach (var feedback in rx.Feedbacks)
+ {
+ if (feedback != null)
+ feedback.FireUpdate();
+ }
+ };
+ }
+ return rx;
}
catch (Exception e)
{
@@ -499,9 +523,7 @@ namespace PepperDash.Essentials.DM
Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message);
return null;
}
- }
-
-
+ }
}
public class DmRmcControllerFactory : EssentialsDeviceFactory
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs
index fe4454b9..10507c4d 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs
@@ -1,41 +1,41 @@
using System;
using System.Linq;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Endpoints;
-using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-
-namespace PepperDash.Essentials.DM
-{
- // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
-
- ///
- /// Controller class for all DM-TX-201C/S/F transmitters
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.DM;
+using Crestron.SimplSharpPro.DM.Endpoints;
+using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
+
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.DM
+{
+ // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
+
+ ///
+ /// Controller class for all DM-TX-201C/S/F transmitters
///
[Description("Wrapper class for DM-TX-200-C")]
- public class DmTx200Controller : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
- {
- public DmTx200C2G Tx { get; private set; }
-
- public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
- public RoutingInputPortWithVideoStatuses VgaInput { get; private set; }
- public RoutingOutputPort DmOutput { get; private set; }
-
- public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
- public IntFeedback VideoSourceNumericFeedback { get; protected set; }
- public IntFeedback AudioSourceNumericFeedback { get; protected set; }
- public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } //actually state
- public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
- public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
-
- public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
-
- public IntFeedback VgaBrightnessFeedback { get; protected set; }
+ public class DmTx200Controller : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
+ {
+ public DmTx200C2G Tx { get; private set; }
+
+ public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
+ public RoutingInputPortWithVideoStatuses VgaInput { get; private set; }
+ public RoutingOutputPort DmOutput { get; private set; }
+
+ public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
+ public IntFeedback VideoSourceNumericFeedback { get; protected set; }
+ public IntFeedback AudioSourceNumericFeedback { get; protected set; }
+ public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } //actually state
+ public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
+ public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
+
+ public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
+
+ public IntFeedback VgaBrightnessFeedback { get; protected set; }
public IntFeedback VgaContrastFeedback { get; protected set; }
//IroutingNumericEvent
@@ -49,57 +49,57 @@ namespace PepperDash.Essentials.DM
{
var newEvent = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
- }
-
-
- ///
- /// Helps get the "real" inputs, including when in Auto
- ///
- public DmTx200Base.eSourceSelection ActualActiveVideoInput
- {
- get
- {
- if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
- Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
- Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
- return Tx.VideoSourceFeedback;
- if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
- return DmTx200Base.eSourceSelection.Digital;
-
- return Tx.VgaInput.SyncDetectedFeedback.BoolValue ? DmTx200Base.eSourceSelection.Analog : DmTx200Base.eSourceSelection.Disable;
- }
- }
-
- public RoutingPortCollection InputPorts
- {
- get
- {
- return new RoutingPortCollection
- {
- HdmiInput,
- VgaInput,
- AnyVideoInput
- };
- }
- }
-
- public RoutingPortCollection OutputPorts
- {
- get
- {
- return new RoutingPortCollection { DmOutput };
- }
- }
-
- ///
- ///
- ///
- ///
- ///
- ///
- public DmTx200Controller(string key, string name, DmTx200C2G tx, bool preventRegistration)
- : base(key, name, tx)
- {
+ }
+
+
+ ///
+ /// Helps get the "real" inputs, including when in Auto
+ ///
+ public DmTx200Base.eSourceSelection ActualActiveVideoInput
+ {
+ get
+ {
+ if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
+ Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
+ Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
+ return Tx.VideoSourceFeedback;
+ if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
+ return DmTx200Base.eSourceSelection.Digital;
+
+ return Tx.VgaInput.SyncDetectedFeedback.BoolValue ? DmTx200Base.eSourceSelection.Analog : DmTx200Base.eSourceSelection.Disable;
+ }
+ }
+
+ public RoutingPortCollection InputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection
+ {
+ HdmiInput,
+ VgaInput,
+ AnyVideoInput
+ };
+ }
+ }
+
+ public RoutingPortCollection OutputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection { DmOutput };
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DmTx200Controller(string key, string name, DmTx200C2G tx, bool preventRegistration)
+ : base(key, name, tx)
+ {
Tx = tx;
PreventRegistration = preventRegistration;
@@ -116,300 +116,300 @@ namespace PepperDash.Essentials.DM
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
{
FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
- };
-
- ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
- () => ActualActiveVideoInput.ToString());
-
- Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
- Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
- Tx.BaseEvent += Tx_BaseEvent;
- Tx.OnlineStatusChange += Tx_OnlineStatusChange;
-
- VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
- AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
-
+ };
+
+ ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
+ () => ActualActiveVideoInput.ToString());
+
+ Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
+ Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
+ Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
+
+ VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
+ AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
+
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
//setting this on the base class so that we can get it easily on the chassis.
- HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
-
- HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
-
- HdmiVideoSyncFeedback = new BoolFeedback(() => tx.HdmiInput.SyncDetectedFeedback.BoolValue);
-
- VgaVideoSyncFeedback = new BoolFeedback(() => tx.VgaInput.SyncDetectedFeedback.BoolValue);
-
- FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
-
- VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
- VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
-
- tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
-
-
- var combinedFuncs = new VideoStatusFuncsWrapper
- {
- HdcpActiveFeedbackFunc = () =>
- (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
- && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
-
- HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
-
- VideoResolutionFeedbackFunc = () =>
- {
- if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
- return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
- return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
- },
- VideoSyncFeedbackFunc = () =>
- (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
- && tx.HdmiInput.SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog
- && tx.VgaInput.SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto
- && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
-
- };
-
- AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
-
- DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmCat, null, this);
-
- AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
- AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
- AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
- AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback,
- VgaVideoSyncFeedback);
-
- // Set Ports for CEC
- HdmiInput.Port = Tx.HdmiInput;
- VgaInput.Port = Tx.VgaInput;
- DmOutput.Port = Tx.DmOutput;
- }
-
- private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
- {
- switch (args.EventId)
- {
- case EndpointInputStreamEventIds.FreeRunFeedbackEventId:
- FreeRunEnabledFeedback.FireUpdate();
- break;
- case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
- VgaVideoSyncFeedback.FireUpdate();
- break;
- }
- }
-
- void VideoControls_ControlChange(object sender, GenericEventArgs args)
- {
- var id = args.EventId;
- Debug.Console(2, this, "EventId {0}", args.EventId);
-
- switch (id)
- {
- case VideoControlsEventIds.BrightnessFeedbackEventId:
- VgaBrightnessFeedback.FireUpdate();
- break;
- case VideoControlsEventIds.ContrastFeedbackEventId:
- VgaContrastFeedback.FireUpdate();
- break;
- }
- }
-
+ HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
+
+ HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
+
+ HdmiVideoSyncFeedback = new BoolFeedback(() => tx.HdmiInput.SyncDetectedFeedback.BoolValue);
+
+ VgaVideoSyncFeedback = new BoolFeedback(() => tx.VgaInput.SyncDetectedFeedback.BoolValue);
+
+ FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
+
+ VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
+ VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
+
+ tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
+
+
+ var combinedFuncs = new VideoStatusFuncsWrapper
+ {
+ HdcpActiveFeedbackFunc = () =>
+ (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
+ && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
+
+ HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
+
+ VideoResolutionFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
+ return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
+ return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
+ },
+ VideoSyncFeedbackFunc = () =>
+ (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
+ && tx.HdmiInput.SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog
+ && tx.VgaInput.SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto
+ && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
+
+ };
+
+ AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
+
+ DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
+ eRoutingPortConnectionType.DmCat, null, this);
+
+ AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
+ AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
+ AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
+ AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback,
+ VgaVideoSyncFeedback);
+
+ // Set Ports for CEC
+ HdmiInput.Port = Tx.HdmiInput;
+ VgaInput.Port = Tx.VgaInput;
+ DmOutput.Port = Tx.DmOutput;
+ }
+
+ private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
+ {
+ switch (args.EventId)
+ {
+ case EndpointInputStreamEventIds.FreeRunFeedbackEventId:
+ FreeRunEnabledFeedback.FireUpdate();
+ break;
+ case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
+ VgaVideoSyncFeedback.FireUpdate();
+ break;
+ }
+ }
+
+ void VideoControls_ControlChange(object sender, GenericEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
+ switch (id)
+ {
+ case VideoControlsEventIds.BrightnessFeedbackEventId:
+ VgaBrightnessFeedback.FireUpdate();
+ break;
+ case VideoControlsEventIds.ContrastFeedbackEventId:
+ VgaContrastFeedback.FireUpdate();
+ break;
+ }
+ }
+
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
var localVideoInputPort =
InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.VideoSourceFeedback);
var localAudioInputPort =
- InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.AudioSourceFeedback);
-
-
- ActiveVideoInputFeedback.FireUpdate();
- VideoSourceNumericFeedback.FireUpdate();
+ InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection) p.Selector == Tx.AudioSourceFeedback);
+
+
+ ActiveVideoInputFeedback.FireUpdate();
+ VideoSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate();
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
- OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
- }
-
- public override bool CustomActivate()
- {
-
- Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
- Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
-
- Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaInput, a.EventId);
- Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId);
-
- // Base does register and sets up comm monitoring.
- return base.CustomActivate();
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
-
- if (HdmiVideoSyncFeedback != null)
- {
- HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
- }
- if (VgaVideoSyncFeedback != null)
- {
- VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
- }
-
- LinkDmTxToApi(this, trilist, joinMap, bridge);
- }
-
- ///
- /// Enables or disables free run
- ///
- ///
- public void SetFreeRunEnabled(bool enable)
- {
- Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
- }
-
- ///
- /// Sets the VGA brightness level
- ///
- ///
- public void SetVgaBrightness(ushort level)
- {
- Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
- }
-
- ///
- /// Sets the VGA contrast level
- ///
- ///
- public void SetVgaContrast(ushort level)
- {
- Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
- }
-
- public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
- {
- Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
-
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(DmTx200Base.eSourceSelection.Auto, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(HdmiInput.Selector, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(VgaInput.Selector, null, type);
- break;
- }
- case 3:
- {
- ExecuteSwitch(DmTx200Base.eSourceSelection.Disable, null, type);
- break;
- }
- }
- }
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
- Tx.VideoSource = (DmTx200Base.eSourceSelection)inputSelector;
- if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- Tx.AudioSource = (DmTx200Base.eSourceSelection)inputSelector;
- }
-
- void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
- {
- var id = args.EventId;
- Debug.Console(2, this, "EventId {0}", args.EventId);
-
- switch (id)
- {
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
+ }
+
+ public override bool CustomActivate()
+ {
+
+ Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
+ Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
+
+ Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaInput, a.EventId);
+ Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId);
+
+ // Base does register and sets up comm monitoring.
+ return base.CustomActivate();
+ }
+
+ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
+ {
+ var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
+
+ if (HdmiVideoSyncFeedback != null)
+ {
+ HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
+ }
+ if (VgaVideoSyncFeedback != null)
+ {
+ VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
+ }
+
+ LinkDmTxToApi(this, trilist, joinMap, bridge);
+ }
+
+ ///
+ /// Enables or disables free run
+ ///
+ ///
+ public void SetFreeRunEnabled(bool enable)
+ {
+ Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
+ }
+
+ ///
+ /// Sets the VGA brightness level
+ ///
+ ///
+ public void SetVgaBrightness(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
+ }
+
+ ///
+ /// Sets the VGA contrast level
+ ///
+ ///
+ public void SetVgaContrast(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
+ }
+
+ public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
+ {
+ Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
+
+ switch (input)
+ {
+ case 0:
+ {
+ ExecuteSwitch(DmTx200Base.eSourceSelection.Auto, null, type);
+ break;
+ }
+ case 1:
+ {
+ ExecuteSwitch(HdmiInput.Selector, null, type);
+ break;
+ }
+ case 2:
+ {
+ ExecuteSwitch(VgaInput.Selector, null, type);
+ break;
+ }
+ case 3:
+ {
+ ExecuteSwitch(DmTx200Base.eSourceSelection.Disable, null, type);
+ break;
+ }
+ }
+ }
+
+ public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
+ {
+ if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
+ Tx.VideoSource = (DmTx200Base.eSourceSelection)inputSelector;
+ if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
+ Tx.AudioSource = (DmTx200Base.eSourceSelection)inputSelector;
+ }
+
+ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
+ switch (id)
+ {
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
- var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
- Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
- VideoSourceNumericFeedback.FireUpdate();
+ var localVideoInputPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.VideoSourceFeedback);
+ Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
+ VideoSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
- break;
+ break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
- var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
- Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
+ var localInputAudioPort = InputPorts.FirstOrDefault(p => (DmTx200Base.eSourceSelection)p.Selector == Tx.AudioSourceFeedback);
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
- OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
- break;
- }
- }
-
- void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
- {
- Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
-
- switch (args.EventId)
- {
- case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
- HdmiInHdcpCapabilityFeedback.FireUpdate();
- break;
- case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
- HdmiInHdcpCapabilityFeedback.FireUpdate();
- break;
- case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
- HdmiVideoSyncFeedback.FireUpdate();
- break;
- }
- }
-
- ///
- /// Relays the input stream change to the appropriate RoutingInputPort.
- ///
- void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
- {
- return;
- }
- inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
- }
-
- ///
- /// Relays the VideoAttributes change to a RoutingInputPort
- ///
- void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
- //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
- // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
- switch (eventId)
- {
- case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
- inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HdcpStateFeedbackEventId:
- inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
- case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- }
- }
-
- }
+ OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
+ break;
+ }
+ }
+
+ void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
+ {
+ Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
+
+ switch (args.EventId)
+ {
+ case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
+ HdmiInHdcpCapabilityFeedback.FireUpdate();
+ break;
+ case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
+ HdmiInHdcpCapabilityFeedback.FireUpdate();
+ break;
+ case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
+ HdmiVideoSyncFeedback.FireUpdate();
+ break;
+ }
+ }
+
+ ///
+ /// Relays the input stream change to the appropriate RoutingInputPort.
+ ///
+ void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ {
+ if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
+ {
+ return;
+ }
+ inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
+ }
+
+ ///
+ /// Relays the VideoAttributes change to a RoutingInputPort
+ ///
+ void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ {
+ //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
+ //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
+ // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
+ switch (eventId)
+ {
+ case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
+ inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.HdcpStateFeedbackEventId:
+ inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
+ case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
+ inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
+ inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ break;
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs
index 660d2fec..ae3dd7fc 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs
@@ -8,33 +8,33 @@ using System.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-
-namespace PepperDash.Essentials.DM
-{
- ///
- /// Controller class for all DM-TX-201C/S/F transmitters
+using PepperDash.Essentials.Core.Bridges;
+
+namespace PepperDash.Essentials.DM
+{
+ ///
+ /// Controller class for all DM-TX-201C/S/F transmitters
///
[Description("Wrapper class for DM-TX-201-C")]
- public class DmTx201CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
- {
- public DmTx201C Tx { get; private set; }
-
- public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
- public RoutingInputPortWithVideoStatuses VgaInput { get; private set; }
- public RoutingOutputPort DmOutput { get; private set; }
- public RoutingOutputPort HdmiLoopOut { get; private set; }
-
- public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
- public IntFeedback VideoSourceNumericFeedback { get; protected set; }
- public IntFeedback AudioSourceNumericFeedback { get; protected set; }
- public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
- public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
- public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
-
- public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
-
- public IntFeedback VgaBrightnessFeedback { get; protected set; }
+ public class DmTx201CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFreeRun, IVgaBrightnessContrastControls
+ {
+ public DmTx201C Tx { get; private set; }
+
+ public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
+ public RoutingInputPortWithVideoStatuses VgaInput { get; private set; }
+ public RoutingOutputPort DmOutput { get; private set; }
+ public RoutingOutputPort HdmiLoopOut { get; private set; }
+
+ public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
+ public IntFeedback VideoSourceNumericFeedback { get; protected set; }
+ public IntFeedback AudioSourceNumericFeedback { get; protected set; }
+ public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
+ public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
+ public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
+
+ public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
+
+ public IntFeedback VgaBrightnessFeedback { get; protected set; }
public IntFeedback VgaContrastFeedback { get; protected set; }
//IroutingNumericEvent
@@ -48,61 +48,61 @@ namespace PepperDash.Essentials.DM
{
var newEvent = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
- }
-
- ///
- /// Helps get the "real" inputs, including when in Auto
- ///
- public DmTx200Base.eSourceSelection ActualActiveVideoInput
- {
- get
- {
- if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
- Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
- Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
- return Tx.VideoSourceFeedback;
- else // auto
- {
- if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
- return DmTx200Base.eSourceSelection.Digital;
- else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
- return DmTx200Base.eSourceSelection.Analog;
- else
- return DmTx200Base.eSourceSelection.Disable;
- }
- }
- }
-
- public RoutingPortCollection InputPorts
- {
- get
- {
- return new RoutingPortCollection
- {
- HdmiInput,
- VgaInput,
- AnyVideoInput
- };
- }
- }
-
- public RoutingPortCollection OutputPorts
- {
- get
- {
- return new RoutingPortCollection { DmOutput, HdmiLoopOut };
- }
- }
-
- ///
- ///
- ///
- ///
- ///
+ }
+
+ ///
+ /// Helps get the "real" inputs, including when in Auto
+ ///
+ public DmTx200Base.eSourceSelection ActualActiveVideoInput
+ {
+ get
+ {
+ if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
+ Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
+ Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
+ return Tx.VideoSourceFeedback;
+ else // auto
+ {
+ if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
+ return DmTx200Base.eSourceSelection.Digital;
+ else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
+ return DmTx200Base.eSourceSelection.Analog;
+ else
+ return DmTx200Base.eSourceSelection.Disable;
+ }
+ }
+ }
+
+ public RoutingPortCollection InputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection
+ {
+ HdmiInput,
+ VgaInput,
+ AnyVideoInput
+ };
+ }
+ }
+
+ public RoutingPortCollection OutputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection { DmOutput, HdmiLoopOut };
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
///
- public DmTx201CController(string key, string name, DmTx201C tx, bool preventRegistration)
- : base(key, name, tx)
- {
+ public DmTx201CController(string key, string name, DmTx201C tx, bool preventRegistration)
+ : base(key, name, tx)
+ {
Tx = tx;
PreventRegistration = preventRegistration;
@@ -119,89 +119,89 @@ namespace PepperDash.Essentials.DM
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
{
FeedbackMatchObject = DmTx200Base.eSourceSelection.Analog
- };
-
- ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
- () => ActualActiveVideoInput.ToString());
-
+ };
+
+ ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
+ () => ActualActiveVideoInput.ToString());
+
Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
- Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
- Tx.BaseEvent += Tx_BaseEvent;
- Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange);
-
- VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
-
+ Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
+ Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange);
+
+ VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
+
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
(tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
- HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
-
- HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
-
- VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
-
- FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
-
- VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
-
- VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
-
- tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
-
- HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
-
- var combinedFuncs = new VideoStatusFuncsWrapper
- {
- HdcpActiveFeedbackFunc = () =>
- (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
- && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
+ HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
- HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ?
- tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
-
- VideoResolutionFeedbackFunc = () =>
- {
- if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
- return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
- return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ?
- tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
- },
-
- VideoSyncFeedbackFunc = () =>
- (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
- && tx.HdmiInput.SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog
- && tx.VgaInput.SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto
- && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
-
- };
-
- AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
-
- DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this);
- HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, null, this);
-
- AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
- AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
- AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
- AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback,
- VgaVideoSyncFeedback);
-
- // Set Ports for CEC
- HdmiInput.Port = Tx.HdmiInput;
- VgaInput.Port = Tx.VgaInput;
- HdmiLoopOut.Port = Tx.HdmiOutput;
- DmOutput.Port = Tx.DmOutput;
- }
-
- void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
- {
- var id = args.EventId;
+ HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
+
+ VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
+
+ FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
+
+ VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
+
+ VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
+
+ tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange;
+
+ HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
+
+ var combinedFuncs = new VideoStatusFuncsWrapper
+ {
+ HdcpActiveFeedbackFunc = () =>
+ (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
+ && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
+
+ HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ?
+ tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
+
+ VideoResolutionFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
+ return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
+ return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ?
+ tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
+ },
+
+ VideoSyncFeedbackFunc = () =>
+ (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
+ && tx.HdmiInput.SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog
+ && tx.VgaInput.SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto
+ && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
+
+ };
+
+ AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
+
+ DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this);
+ HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
+ eRoutingPortConnectionType.Hdmi, null, this);
+
+ AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
+ AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
+ AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
+ AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback,
+ VgaVideoSyncFeedback);
+
+ // Set Ports for CEC
+ HdmiInput.Port = Tx.HdmiInput;
+ VgaInput.Port = Tx.VgaInput;
+ HdmiLoopOut.Port = Tx.HdmiOutput;
+ DmOutput.Port = Tx.DmOutput;
+ }
+
+ void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
+ {
+ var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
switch (id)
@@ -212,7 +212,7 @@ namespace PepperDash.Essentials.DM
case VideoControlsEventIds.ContrastFeedbackEventId:
VgaContrastFeedback.FireUpdate();
break;
- }
+ }
}
void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
@@ -228,7 +228,7 @@ namespace PepperDash.Essentials.DM
AudioSourceNumericFeedback.FireUpdate();
OnSwitchChange(new RoutingNumericEventArgs(1, VideoSourceNumericFeedback.UShortValue, OutputPorts.First(), localVideoInputPort, eRoutingSignalType.Video));
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localAudioInputPort, eRoutingSignalType.Audio));
- }
+ }
private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
@@ -241,107 +241,107 @@ namespace PepperDash.Essentials.DM
VgaVideoSyncFeedback.FireUpdate();
break;
}
- }
-
- public override bool CustomActivate()
- {
- Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
- Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
-
- Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaInput, a.EventId);
- Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId);
-
- // Base does register and sets up comm monitoring.
- return base.CustomActivate();
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
-
- if (HdmiVideoSyncFeedback != null)
- {
- HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
- }
- if (VgaVideoSyncFeedback != null)
- {
- VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
- }
-
- LinkDmTxToApi(this, trilist, joinMap, bridge);
- }
-
- ///
- /// Enables or disables free run
- ///
- ///
- public void SetFreeRunEnabled(bool enable)
+ }
+
+ public override bool CustomActivate()
+ {
+ Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
+ Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, a.EventId);
+
+ Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaInput, a.EventId);
+ Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(VgaInput, a.EventId);
+
+ // Base does register and sets up comm monitoring.
+ return base.CustomActivate();
+ }
+
+ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
- Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
- }
-
- ///
- /// Sets the VGA brightness level
- ///
- ///
- public void SetVgaBrightness(ushort level)
- {
- Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
- }
-
- ///
- /// Sets the VGA contrast level
- ///
- ///
- public void SetVgaContrast(ushort level)
- {
- Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
- }
-
- ///
- /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable)
- ///
- ///
- ///
- ///
- public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
- {
- Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
-
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(DmTx200Base.eSourceSelection.Auto, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(HdmiInput.Selector, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(VgaInput.Selector, null, type);
- break;
- }
- case 3:
- {
- ExecuteSwitch(DmTx200Base.eSourceSelection.Disable, null, type);
- break;
- }
- }
- }
-
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- if((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
- Tx.VideoSource = (DmTx200Base.eSourceSelection)inputSelector;
- if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- Tx.AudioSource = (DmTx200Base.eSourceSelection)inputSelector;
- }
-
- void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
+ var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
+
+ if (HdmiVideoSyncFeedback != null)
+ {
+ HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
+ }
+ if (VgaVideoSyncFeedback != null)
+ {
+ VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
+ }
+
+ LinkDmTxToApi(this, trilist, joinMap, bridge);
+ }
+
+ ///
+ /// Enables or disables free run
+ ///
+ ///
+ public void SetFreeRunEnabled(bool enable)
+ {
+ Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
+ }
+
+ ///
+ /// Sets the VGA brightness level
+ ///
+ ///
+ public void SetVgaBrightness(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
+ }
+
+ ///
+ /// Sets the VGA contrast level
+ ///
+ ///
+ public void SetVgaContrast(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
+ }
+
+ ///
+ /// Switches the audio/video source based on the integer value (0-Auto, 1-HDMI, 2-VGA, 3-Disable)
+ ///
+ ///
+ ///
+ ///
+ public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
+ {
+ Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
+
+ switch (input)
+ {
+ case 0:
+ {
+ ExecuteSwitch(DmTx200Base.eSourceSelection.Auto, null, type);
+ break;
+ }
+ case 1:
+ {
+ ExecuteSwitch(HdmiInput.Selector, null, type);
+ break;
+ }
+ case 2:
+ {
+ ExecuteSwitch(VgaInput.Selector, null, type);
+ break;
+ }
+ case 3:
+ {
+ ExecuteSwitch(DmTx200Base.eSourceSelection.Disable, null, type);
+ break;
+ }
+ }
+ }
+
+ public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
+ {
+ if((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
+ Tx.VideoSource = (DmTx200Base.eSourceSelection)inputSelector;
+ if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
+ Tx.AudioSource = (DmTx200Base.eSourceSelection)inputSelector;
+ }
+
+ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
@@ -361,11 +361,11 @@ namespace PepperDash.Essentials.DM
AudioSourceNumericFeedback.FireUpdate();
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
- }
- }
-
- void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
- {
+ }
+ }
+
+ void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
+ {
Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
@@ -379,52 +379,52 @@ namespace PepperDash.Essentials.DM
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
HdmiVideoSyncFeedback.FireUpdate();
break;
- }
-
- }
-
- ///
- /// Relays the input stream change to the appropriate RoutingInputPort.
- ///
- void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
+ }
+
+ }
+
+ ///
+ /// Relays the input stream change to the appropriate RoutingInputPort.
+ ///
+ void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ {
+ if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
- return;
+ return;
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
- }
-
- ///
- /// Relays the VideoAttributes change to a RoutingInputPort
- ///
- void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
- //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
- // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
- switch (eventId)
- {
- case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
- inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HdcpStateFeedbackEventId:
- inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
- case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- }
- }
-
- }
+ AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
+ }
+
+ ///
+ /// Relays the VideoAttributes change to a RoutingInputPort
+ ///
+ void FireVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ {
+ //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
+ //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
+ // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
+ switch (eventId)
+ {
+ case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
+ inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.HdcpStateFeedbackEventId:
+ inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
+ case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
+ inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
+ inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ break;
+ }
+ }
+
+ }
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs
index 5bbf5fd5..3c7ffffa 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs
@@ -78,6 +78,8 @@ namespace PepperDash.Essentials.DM
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
+ PreventRegistration = true;
+ tx.Register();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs
index 87906735..c03a2291 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs
@@ -1,49 +1,49 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-//using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DeviceSupport;
-using Crestron.SimplSharpPro.DM;
-using Crestron.SimplSharpPro.DM.Endpoints;
-using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Bridges;
-using PepperDash.Essentials.DM.Config;
-
-namespace PepperDash.Essentials.DM
-{
- using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharpPro;
+//using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.DM;
+using Crestron.SimplSharpPro.DM.Endpoints;
+using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
+
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Bridges;
+using PepperDash.Essentials.DM.Config;
+
+namespace PepperDash.Essentials.DM
+{
+ using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-302-C")]
- public class DmTx4k302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
- IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
- {
- public DmTx4k302C Tx { get; private set; }
-
- public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
- public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
- public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
- public RoutingOutputPort DmOut { get; private set; }
- public RoutingOutputPort HdmiLoopOut { get; private set; }
-
- public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
- public IntFeedback VideoSourceNumericFeedback { get; protected set; }
- public IntFeedback AudioSourceNumericFeedback { get; protected set; }
- public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
- public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
- public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
- public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
- public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
-
- public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
-
- public IntFeedback VgaBrightnessFeedback { get; protected set; }
+ public class DmTx4k302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
+ IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls
+ {
+ public DmTx4k302C Tx { get; private set; }
+
+ public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
+ public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
+ public RoutingInputPortWithVideoStatuses VgaIn { get; private set; }
+ public RoutingOutputPort DmOut { get; private set; }
+ public RoutingOutputPort HdmiLoopOut { get; private set; }
+
+ public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
+ public IntFeedback VideoSourceNumericFeedback { get; protected set; }
+ public IntFeedback AudioSourceNumericFeedback { get; protected set; }
+ public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
+ public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
+ public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
+ public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
+ public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
+
+ public BoolFeedback FreeRunEnabledFeedback { get; protected set; }
+
+ public IntFeedback VgaBrightnessFeedback { get; protected set; }
public IntFeedback VgaContrastFeedback { get; protected set; }
//IroutingNumericEvent
@@ -57,92 +57,92 @@ namespace PepperDash.Essentials.DM
{
var newEvent = NumericSwitchChange;
if (newEvent != null) newEvent(this, e);
- }
-
-
- ///
- /// Helps get the "real" inputs, including when in Auto
- ///
- public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
- {
- get
- {
- if (Tx.VideoSourceFeedback != eVst.Auto)
- return Tx.VideoSourceFeedback;
- else // auto
- {
- if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
- return eVst.Hdmi1;
- else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
- return eVst.Hdmi2;
- else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
- return eVst.Vga;
- else
- return eVst.AllDisabled;
- }
- }
- }
- public RoutingPortCollection InputPorts
- {
- get
- {
- return new RoutingPortCollection
- {
- HdmiIn1,
- HdmiIn2,
- VgaIn,
- AnyVideoInput
- };
- }
- }
- public RoutingPortCollection OutputPorts
- {
- get
- {
- return new RoutingPortCollection { DmOut, HdmiLoopOut };
- }
+ }
+
+
+ ///
+ /// Helps get the "real" inputs, including when in Auto
+ ///
+ public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput
+ {
+ get
+ {
+ if (Tx.VideoSourceFeedback != eVst.Auto)
+ return Tx.VideoSourceFeedback;
+ else // auto
+ {
+ if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
+ return eVst.Hdmi1;
+ else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
+ return eVst.Hdmi2;
+ else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
+ return eVst.Vga;
+ else
+ return eVst.AllDisabled;
+ }
+ }
}
- public DmTx4k302CController(string key, string name, DmTx4k302C tx, bool preventRegistration)
- : base(key, name, tx)
- {
+ public RoutingPortCollection InputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection
+ {
+ HdmiIn1,
+ HdmiIn2,
+ VgaIn,
+ AnyVideoInput
+ };
+ }
+ }
+ public RoutingPortCollection OutputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection { DmOut, HdmiLoopOut };
+ }
+ }
+ public DmTx4k302CController(string key, string name, DmTx4k302C tx, bool preventRegistration)
+ : base(key, name, tx)
+ {
Tx = tx;
- PreventRegistration = preventRegistration;
-
- HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
+ PreventRegistration = preventRegistration;
+
+ HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]))
{
FeedbackMatchObject = eVst.Hdmi1
- };
- HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
+ };
+ HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]))
{
FeedbackMatchObject = eVst.Hdmi2
};
-
- VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
- eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.Vga, this,
+
+ VgaIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
+ eRoutingSignalType.Video, eRoutingPortConnectionType.Vga, eVst.Vga, this,
VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput))
{
FeedbackMatchObject = eVst.Vga
};
-
- ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
- () => ActualActiveVideoInput.ToString());
-
- Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
+
+ ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
+ () => ActualActiveVideoInput.ToString());
+
+ Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
- Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
- Tx.BaseEvent += Tx_BaseEvent;
-
- Tx.OnlineStatusChange += Tx_OnlineStatusChange;
-
- VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
- AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
-
- HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
-
+ Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange;
+ Tx.BaseEvent += Tx_BaseEvent;
+
+ Tx.OnlineStatusChange += Tx_OnlineStatusChange;
+
+ VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
+ AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
+
+ HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
+
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
@@ -150,77 +150,77 @@ namespace PepperDash.Essentials.DM
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int)tx.HdmiInputs[1].HdcpCapabilityFeedback
- : (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
-
- HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
-
- Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
-
- Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
-
- VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
-
- FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
-
- VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
- VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
-
- tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange);
-
-
- var combinedFuncs = new VideoStatusFuncsWrapper
- {
- HdcpActiveFeedbackFunc = () =>
- (ActualActiveVideoInput == eVst.Hdmi1
- && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
- || (ActualActiveVideoInput == eVst.Hdmi2
- && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
-
- HdcpStateFeedbackFunc = () =>
- {
- if (ActualActiveVideoInput == eVst.Hdmi1)
- return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
+ : (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
+
+ HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
+
+ Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
+
+ Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
+
+ VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);
+
+ FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled);
+
+ VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue);
+ VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue);
+
+ tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange);
+
+
+ var combinedFuncs = new VideoStatusFuncsWrapper
+ {
+ HdcpActiveFeedbackFunc = () =>
+ (ActualActiveVideoInput == eVst.Hdmi1
+ && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
+ || (ActualActiveVideoInput == eVst.Hdmi2
+ && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
+
+ HdcpStateFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == eVst.Hdmi1)
+ return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : "";
- },
-
- VideoResolutionFeedbackFunc = () =>
- {
- if (ActualActiveVideoInput == eVst.Hdmi1)
- return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
- if (ActualActiveVideoInput == eVst.Hdmi2)
- return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
+ },
+
+ VideoResolutionFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == eVst.Hdmi1)
+ return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
+ if (ActualActiveVideoInput == eVst.Hdmi2)
+ return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return ActualActiveVideoInput == eVst.Vga ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
- },
- VideoSyncFeedbackFunc = () =>
- (ActualActiveVideoInput == eVst.Hdmi1
- && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == eVst.Hdmi2
- && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
- || (ActualActiveVideoInput == eVst.Vga
- && tx.VgaInput.SyncDetectedFeedback.BoolValue)
-
- };
-
- AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
- eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
-
- DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.DmCat, null, this);
- HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
- eRoutingPortConnectionType.Hdmi, null, this);
-
-
- AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
- AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
- AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
- AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
- Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, VgaVideoSyncFeedback);
-
- // Set Ports for CEC
- HdmiIn1.Port = Tx.HdmiInputs[1];
- HdmiIn2.Port = Tx.HdmiInputs[2];
- HdmiLoopOut.Port = Tx.HdmiOutput;
- DmOut.Port = Tx.DmOutput;
+ },
+ VideoSyncFeedbackFunc = () =>
+ (ActualActiveVideoInput == eVst.Hdmi1
+ && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == eVst.Hdmi2
+ && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == eVst.Vga
+ && tx.VgaInput.SyncDetectedFeedback.BoolValue)
+
+ };
+
+ AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
+
+ DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
+ eRoutingPortConnectionType.DmCat, null, this);
+ HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
+ eRoutingPortConnectionType.Hdmi, null, this);
+
+
+ AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
+ AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
+ AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
+ AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
+ Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, VgaVideoSyncFeedback);
+
+ // Set Ports for CEC
+ HdmiIn1.Port = Tx.HdmiInputs[1];
+ HdmiIn2.Port = Tx.HdmiInputs[2];
+ HdmiLoopOut.Port = Tx.HdmiOutput;
+ DmOut.Port = Tx.DmOutput;
}
void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
@@ -234,13 +234,13 @@ namespace PepperDash.Essentials.DM
VgaVideoSyncFeedback.FireUpdate();
break;
}
- }
-
- void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
- {
- var id = args.EventId;
- Debug.Console(2, this, "EventId {0}", args.EventId);
-
+ }
+
+ void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
switch (id)
{
case VideoControlsEventIds.BrightnessFeedbackEventId:
@@ -249,76 +249,76 @@ namespace PepperDash.Essentials.DM
case VideoControlsEventIds.ContrastFeedbackEventId:
VgaContrastFeedback.FireUpdate();
break;
- }
- }
-
-
-
- public override bool CustomActivate()
- {
- // Link up all of these damned events to the various RoutingPorts via a helper handler
- Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
- Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
-
- Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
- Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
-
- Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
- Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
-
- // Base does register and sets up comm monitoring.
- return base.CustomActivate();
- }
-
- public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
- {
- var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
-
- if (Hdmi1VideoSyncFeedback != null)
+ }
+ }
+
+
+
+ public override bool CustomActivate()
+ {
+ // Link up all of these damned events to the various RoutingPorts via a helper handler
+ Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
+ Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
+
+ Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
+ Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
+
+ Tx.VgaInput.InputStreamChange += (o, a) => FowardInputStreamChange(VgaIn, a.EventId);
+ Tx.VgaInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(VgaIn, a.EventId);
+
+ // Base does register and sets up comm monitoring.
+ return base.CustomActivate();
+ }
+
+ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
+ {
+ var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
+
+ if (Hdmi1VideoSyncFeedback != null)
{
- Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
- }
- if (Hdmi2VideoSyncFeedback != null)
+ Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
+ }
+ if (Hdmi2VideoSyncFeedback != null)
{
- Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
- }
- if (VgaVideoSyncFeedback != null)
+ Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
+ }
+ if (VgaVideoSyncFeedback != null)
{
- VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]);
- }
-
- LinkDmTxToApi(this, trilist, joinMap, bridge);
- }
-
- ///
- /// Enables or disables free run
- ///
- ///
+ VgaVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]);
+ }
+
+ LinkDmTxToApi(this, trilist, joinMap, bridge);
+ }
+
+ ///
+ /// Enables or disables free run
+ ///
+ ///
public void SetFreeRunEnabled(bool enable)
{
Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
}
- ///
- /// Sets the VGA brightness level
- ///
- ///
- public void SetVgaBrightness(ushort level)
- {
- Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
- }
-
- ///
- /// Sets the VGA contrast level
- ///
- ///
- public void SetVgaContrast(ushort level)
- {
- Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
- }
-
-
-
+ ///
+ /// Sets the VGA brightness level
+ ///
+ ///
+ public void SetVgaBrightness(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
+ }
+
+ ///
+ /// Sets the VGA contrast level
+ ///
+ ///
+ public void SetVgaContrast(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
+ }
+
+
+
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
@@ -326,76 +326,76 @@ namespace PepperDash.Essentials.DM
switch (type)
{
case eRoutingSignalType.Video:
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(eVst.Auto, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(HdmiIn1.Selector, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(HdmiIn2.Selector, null, type);
- break;
- }
- case 3:
- {
- ExecuteSwitch(VgaIn.Selector, null, type);
- break;
- }
- case 4:
- {
- ExecuteSwitch(eVst.AllDisabled, null, type);
- break;
- }
+ switch (input)
+ {
+ case 0:
+ {
+ ExecuteSwitch(eVst.Auto, null, type);
+ break;
+ }
+ case 1:
+ {
+ ExecuteSwitch(HdmiIn1.Selector, null, type);
+ break;
+ }
+ case 2:
+ {
+ ExecuteSwitch(HdmiIn2.Selector, null, type);
+ break;
+ }
+ case 3:
+ {
+ ExecuteSwitch(VgaIn.Selector, null, type);
+ break;
+ }
+ case 4:
+ {
+ ExecuteSwitch(eVst.AllDisabled, null, type);
+ break;
+ }
}
break;
case eRoutingSignalType.Audio:
- switch (input)
- {
- case 0:
- {
- ExecuteSwitch(eAst.Auto, null, type);
- break;
- }
- case 1:
- {
- ExecuteSwitch(eAst.Hdmi1, null, type);
- break;
- }
- case 2:
- {
- ExecuteSwitch(eAst.Hdmi2, null, type);
- break;
- }
- case 3:
- {
- ExecuteSwitch(eAst.AudioIn, null, type);
- break;
- }
- case 4:
- {
- ExecuteSwitch(eAst.AllDisabled, null, type);
- break;
- }
+ switch (input)
+ {
+ case 0:
+ {
+ ExecuteSwitch(eAst.Auto, null, type);
+ break;
+ }
+ case 1:
+ {
+ ExecuteSwitch(eAst.Hdmi1, null, type);
+ break;
+ }
+ case 2:
+ {
+ ExecuteSwitch(eAst.Hdmi2, null, type);
+ break;
+ }
+ case 3:
+ {
+ ExecuteSwitch(eAst.AudioIn, null, type);
+ break;
+ }
+ case 4:
+ {
+ ExecuteSwitch(eAst.AllDisabled, null, type);
+ break;
+ }
}
break;
}
}
- public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
- {
- if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
- Tx.VideoSource = (eVst)inputSelector;
- if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
- Tx.AudioSource = (eAst)inputSelector;
- }
-
+ public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
+ {
+ if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
+ Tx.VideoSource = (eVst)inputSelector;
+ if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
+ Tx.AudioSource = (eAst)inputSelector;
+ }
+
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
@@ -405,7 +405,7 @@ namespace PepperDash.Essentials.DM
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
- if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
+ if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
HdcpStateFeedback.FireUpdate();
break;
@@ -450,57 +450,57 @@ namespace PepperDash.Essentials.DM
OnSwitchChange(new RoutingNumericEventArgs(1, AudioSourceNumericFeedback.UShortValue, OutputPorts.First(), localInputAudioPort, eRoutingSignalType.Audio));
break;
}
- }
+ }
- ///
- /// Relays the input stream change to the appropriate RoutingInputPort.
- ///
- void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ ///
+ /// Relays the input stream change to the appropriate RoutingInputPort.
+ ///
+ void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return;
- inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
+ inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
- }
-
- ///
- /// Relays the VideoAttributes change to a RoutingInputPort
- ///
- void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
- {
- //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
- //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
- // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
- switch (eventId)
- {
- case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
- inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HdcpStateFeedbackEventId:
- inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
- case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
- inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
- AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
- break;
- }
- }
-
-
- #region IIROutputPorts Members
- public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } }
- public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
- #endregion
-
- #region IComPorts Members
- public CrestronCollection ComPorts { get { return Tx.ComPorts; } }
- public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
- #endregion
- }
+ }
+
+ ///
+ /// Relays the VideoAttributes change to a RoutingInputPort
+ ///
+ void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ {
+ //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
+ //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
+ // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
+ switch (eventId)
+ {
+ case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
+ inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.HdcpStateFeedbackEventId:
+ inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
+ case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
+ inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ break;
+ case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
+ inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
+ break;
+ }
+ }
+
+
+ #region IIROutputPorts Members
+ public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } }
+ public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
+ #endregion
+
+ #region IComPorts Members
+ public CrestronCollection ComPorts { get { return Tx.ComPorts; } }
+ public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs
index c1a5cec7..bb7d9e3d 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs
@@ -72,6 +72,7 @@ namespace PepperDash.Essentials.DM
HdmiIn.Port = Tx;
PreventRegistration = true;
+ tx.Register();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs
index de60d80e..4d77a7fc 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs
@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.DM
[Description("Wrapper class for DM-TX-4K-Z-302-C")]
- public class DmTx4kz302CController : DmTxControllerBase, ITxRoutingWithFeedback, IHasFeedback,
+ public class DmTx4kz302CController : DmTxControllerBase, ITxRoutingWithFeedback,
IIROutputPorts, IComPorts
{
public DmTx4kz302C Tx { get; private set; }
@@ -34,6 +34,7 @@ namespace PepperDash.Essentials.DM
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
+ public IntFeedback DisplayPortInHdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; }
@@ -131,12 +132,25 @@ namespace PepperDash.Essentials.DM
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
+ DisplayPortInHdcpCapabilityFeedback = new IntFeedback("DisplayPortHdcpCapability",
+ () => (int) tx.DisplayPortInput.HdcpCapabilityFeedback);
+
+
+ /*
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int)tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
+ */
+
+ //yeah this is gross - but it's the quickest way to do this...
+ HdcpStateFeedback = new IntFeedback(() => {
+ var states = new[] {(int) tx.DisplayPortInput.HdcpCapabilityFeedback, (int) tx.HdmiInputs[1].HdcpCapabilityFeedback, (int) tx.HdmiInputs[2].HdcpCapabilityFeedback};
+
+ return states.Max();
+ });
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
@@ -146,7 +160,6 @@ namespace PepperDash.Essentials.DM
DisplayPortVideoSyncFeedback = new BoolFeedback(() => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue);
-
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
@@ -411,8 +424,7 @@ namespace PepperDash.Essentials.DM
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
- }
-
+ }
#region IIROutputPorts Members
public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } }
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
index d707ebd3..771864d6 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
@@ -126,6 +126,7 @@ namespace PepperDash.Essentials.DM
var parentDev = DeviceManager.GetDeviceForKey(pKey);
DMInput dmInput;
BasicDmTxControllerBase tx;
+ bool useChassisForOfflineFeedback = false;
if (parentDev is DmChassisController)
{
@@ -155,15 +156,23 @@ namespace PepperDash.Essentials.DM
chassis is DmMd128x128 || chassis is DmMd64x64)
{
tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput);
- Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num);
- tx.IsOnline.SetValueFunc(() => switchDev.InputEndpointOnlineFeedbacks[num].BoolValue);
- switchDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
- return tx;
+ useChassisForOfflineFeedback = true;
}
else
{
- return GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput);
+ tx = GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput);
+ if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g")
+ {
+ useChassisForOfflineFeedback = true;
+ }
}
+ if (useChassisForOfflineFeedback)
+ {
+ Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
+ tx.IsOnline.SetValueFunc(() => switchDev.InputEndpointOnlineFeedbacks[num].BoolValue);
+ switchDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
+ }
+ return tx;
}
catch (Exception e)
{
@@ -203,15 +212,23 @@ namespace PepperDash.Essentials.DM
if(Global.ControlSystemIsDmps4kType)
{
tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput);
- Debug.Console(0, "DM endpoint output {0} is for DMPS3-4K, changing online feedback to chassis", num);
- tx.IsOnline.SetValueFunc(() => dmpsDev.InputEndpointOnlineFeedbacks[num].BoolValue);
- dmpsDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
- return tx;
+ useChassisForOfflineFeedback = true;
}
else
{
- return GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput);
+ tx = GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput);
+ if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g")
+ {
+ useChassisForOfflineFeedback = true;
+ }
}
+ if (useChassisForOfflineFeedback)
+ {
+ Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
+ tx.IsOnline.SetValueFunc(() => dmpsDev.InputEndpointOnlineFeedbacks[num].BoolValue);
+ dmpsDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
+ }
+ return tx;
}
catch (Exception e)
{
@@ -377,6 +394,26 @@ namespace PepperDash.Essentials.DM
}
}
+ if (txR.InputPorts[DmPortName.DisplayPortIn] != null)
+ {
+ var inputPort = txR.InputPorts[DmPortName.DisplayPortIn];
+
+ if (tx.Feedbacks["DisplayPortInHdcpCapability"] != null)
+ {
+ var intFeedback = tx.Feedbacks["DisplayPortInHdcpCapability"] as IntFeedback;
+ if (intFeedback != null)
+ intFeedback.LinkInputSig(trilist.UShortInput[joinMap.Port3HdcpState.JoinNumber]);
+ }
+
+ if (inputPort.ConnectionType == eRoutingPortConnectionType.Hdmi && inputPort.Port != null)
+ {
+ var port = inputPort.Port as EndpointDisplayPortInput;
+
+ SetHdcpCapabilityAction(hdcpTypeSimple, port, joinMap.Port3HdcpState.JoinNumber, trilist);
+ }
+
+ }
+
}
var txFreeRun = tx as IHasFreeRun;
@@ -424,6 +461,20 @@ namespace PepperDash.Essentials.DM
});
}
}
+
+ private void SetHdcpCapabilityAction(bool hdcpTypeSimple, EndpointDisplayPortInput port, uint join,
+ BasicTriList trilist)
+ {
+
+
+ trilist.SetUShortSigAction(join,
+ s =>
+ {
+ port.HdcpCapability = (eHdcpCapabilityType) s;
+ });
+
+ }
+
}
public class DmTxControllerFactory : EssentialsDeviceFactory
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs
index bedf1aad..a40ee68b 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs
@@ -52,6 +52,9 @@ namespace PepperDash.Essentials.DM
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
}
+
+ PreventRegistration = true;
+ tx.Register();
}
#region IRoutingInputs Members
diff --git a/packages.config b/packages.config
index ffea92a5..104d002d 100644
--- a/packages.config
+++ b/packages.config
@@ -1,3 +1,3 @@
-
+
\ No newline at end of file