From 3bf3ac2ccea86e5ecad4727e765fda379d2dbf52 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 13 May 2020 09:35:56 -0500 Subject: [PATCH 01/52] resolves #178 - Addedd Requested Interface IHasVideoMute --- .../UI/EssentialsTouchpanelController.cs | 2 +- .../Devices/IProjectorInterfaces.cs | 17 +++++++++++++++++ .../PepperDash_Essentials_Core.csproj | 1 + .../Display/InputInterfaces.cs | 7 ++++--- 4 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index d008eee0..eade64bd 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -211,7 +211,7 @@ namespace PepperDash.Essentials var comm = CommFactory.GetControlPropertiesConfig(dc); var props = Newtonsoft.Json.JsonConvert.DeserializeObject(dc.Properties.ToString()); - Debug.Console(1, "Factory Attempting to create new Generic Comm Device"); + Debug.Console(1, "Factory Attempting to create new EssentialsTouchpanelController"); var panelController = new EssentialsTouchpanelController(dc.Key, dc.Name, dc.Type, props, comm.IpIdInt); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs new file mode 100644 index 00000000..9c8d4529 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core +{ + public interface IHasVideoMute + { + BoolFeedback VideoMuteIsOn { get; } + + void VideoMuteOn(bool pressRelease); + void VideoMuteOff(bool pressRelease); + void VideoMuteToggle(bool pressRelease); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 4e3e1b41..00db3b08 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -158,6 +158,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs index ce7113e1..fa9f103d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs @@ -2,7 +2,9 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Crestron.SimplSharp; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + namespace PepperDash.Essentials.Devices.Displays { @@ -12,6 +14,5 @@ namespace PepperDash.Essentials.Devices.Displays public interface IInputHdmi4 { void InputHdmi4(); } public interface IInputDisplayPort1 { void InputDisplayPort1(); } public interface IInputDisplayPort2 { void InputDisplayPort2(); } - public interface IInputVga1 { void InputVga1(); } - + public interface IInputVga1 { void InputVga1(); } } \ No newline at end of file From f2cb95af960abf435c3859fc37a04b0fe223921e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 13 May 2020 09:40:45 -0500 Subject: [PATCH 02/52] removed some unintentionally added text from InputInterfaces.cs --- .../Essentials Devices Common/Display/InputInterfaces.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs index fa9f103d..d984f523 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Display/InputInterfaces.cs @@ -2,9 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Crestron.SimplSharp; -using PepperDash.Essentials.Core; - +using Crestron.SimplSharp; namespace PepperDash.Essentials.Devices.Displays { @@ -15,4 +13,5 @@ namespace PepperDash.Essentials.Devices.Displays public interface IInputDisplayPort1 { void InputDisplayPort1(); } public interface IInputDisplayPort2 { void InputDisplayPort2(); } public interface IInputVga1 { void InputVga1(); } + } \ No newline at end of file From efe8b1576375b004b95ae73ce89c3c54e4861e4a Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 13 May 2020 10:32:01 -0500 Subject: [PATCH 03/52] Updated Interfaces to be more granular --- .../Devices/IProjectorInterfaces.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs index 9c8d4529..6efb7776 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IProjectorInterfaces.cs @@ -6,12 +6,17 @@ using Crestron.SimplSharp; namespace PepperDash.Essentials.Core { - public interface IHasVideoMute + public interface IBasicVideoMute + { + void VideoMuteToggle(); + } + + public interface IBasicVideoMuteWithFeedback : IBasicVideoMute { BoolFeedback VideoMuteIsOn { get; } - void VideoMuteOn(bool pressRelease); - void VideoMuteOff(bool pressRelease); - void VideoMuteToggle(bool pressRelease); + void VideoMuteOn(); + void VideoMuteOff(); + } } \ No newline at end of file From aef491855c2c573466d28a1e4abaca6ec61dae34 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 14 May 2020 17:20:19 -0500 Subject: [PATCH 04/52] Not Complete - Still Adding Feedbacks, Bridge, and JoinMaps --- .../Devices/EssentialsDevice.cs | 7 +- .../Chassis/HdMdNxM4kEController.cs | 289 +++++++++++------- .../Config/HdMdNxM4kEPropertiesConfig.cs | 3 + 3 files changed, 182 insertions(+), 117 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs index 410c7a48..8d7f2c8d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/EssentialsDevice.cs @@ -53,7 +53,7 @@ namespace PepperDash.Essentials.Core public ConfigSnippetAttribute(string configSnippet) { - Debug.Console(2, "Setting Description {0}", configSnippet); + Debug.Console(2, "Setting Config Snippet {0}", configSnippet); _ConfigSnippet = configSnippet; } @@ -83,8 +83,9 @@ namespace PepperDash.Essentials.Core foreach (var typeName in TypeNames) { Debug.Console(2, "Getting Description Attribute from class: '{0}'", typeof(T).FullName); - var attributes = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[]; - string description = attributes[0].Description; + var descriptionAttribute = typeof(T).GetCustomAttributes(typeof(DescriptionAttribute), true) as DescriptionAttribute[]; + string description = descriptionAttribute[0].Description; + var snippetAttribute = typeof(T).GetCustomAttributes(typeof(ConfigSnippetAttribute), true) as ConfigSnippetAttribute[]; DeviceFactory.AddFactoryForType(typeName.ToLower(), description, typeof(T), BuildDevice); } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs index 4ee4ecc8..fc30c1aa 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs @@ -2,124 +2,185 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using Newtonsoft.Json; using Crestron.SimplSharp; using Crestron.SimplSharpPro.DM; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.DM.Config; - -namespace PepperDash.Essentials.DM.Chassis -{ - public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting - { - public HdMdNxM Chassis { get; private set; } - - public RoutingPortCollection InputPorts { get; private set; } - public RoutingPortCollection OutputPorts { get; private set; } - - - /// - /// - /// - /// - /// - /// - public HdMdNxM4kEController(string key, string name, HdMdNxM chassis, - HdMdNxM4kEPropertiesConfig props) - : base(key, name) - { - Chassis = chassis; - - // logical ports - InputPorts = new RoutingPortCollection(); - for (uint i = 1; i <= 4; i++) - { - InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, i, this)); - } - OutputPorts = new RoutingPortCollection(); - OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this)); - - // physical settings - if (props != null && props.Inputs != null) - { - foreach (var kvp in props.Inputs) - { - // strip "hdmiIn" - var inputNum = Convert.ToUInt32(kvp.Key.Substring(6)); - - var port = chassis.HdmiInputs[inputNum].HdmiInputPort; - // set hdcp disables - if (kvp.Value.DisableHdcp) - { - Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key); - port.HdcpSupportOff(); - } - else - port.HdcpSupportOn(); - } - } - } - - public override bool CustomActivate() - { - var result = Chassis.Register(); - if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(0, this, "Device registration failed: {0}", result); - return false; - } - - return base.CustomActivate(); - } - - - - #region IRouting Members - - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - // Try to make switch only when necessary. The unit appears to toggle when already selected. - var current = Chassis.HdmiOutputs[1].VideoOut; - if(current != Chassis.HdmiInputs[(uint)inputSelector]) - Chassis.HdmiOutputs[1].VideoOut = Chassis.HdmiInputs[(uint)inputSelector]; - } - - #endregion - - ///////////////////////////////////////////////////// - - /// - /// - /// - /// - /// - /// - /// - /// - public static HdMdNxM4kEController GetController(string key, string name, - string type, HdMdNxM4kEPropertiesConfig properties) - { - try - { - var ipid = properties.Control.IpIdInt; - var address = properties.Control.TcpSshProperties.Address; - - type = type.ToLower(); - if (type == "hdmd4x14ke") - { - var chassis = new HdMd4x14kE(ipid, address, Global.ControlSystem); - return new HdMdNxM4kEController(key, name, chassis, properties); - } - return null; - } - catch (Exception e) - { - Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e); - return null; - } - } - } +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.DM.Chassis +{ + public class HdMdNxM4kEController : EssentialsBridgeableDevice, IRoutingInputsOutputs, IRouting + { + public HdMdNxM Chassis { get; private set; } + + public RoutingPortCollection InputPorts { get; private set; } + public RoutingPortCollection OutputPorts { get; private set; } + + public FeedbackCollection VideoInputSyncFeedbacks { get; private set; } + public FeedbackCollection VideoOutputRouteFeedbacks { get; private set; } + public FeedbackCollection InputNameFeedbacks { get; private set; } + public FeedbackCollection OutputNameFeedbacks { get; private set; } + public FeedbackCollection OutputRouteNameFeedbacks { get; private set; } + + + /// + /// + /// + /// + /// + /// + public HdMdNxM4kEController(string key, string name, HdMdNxM chassis, + HdMdNxM4kEPropertiesConfig props) + : base(key, name) + { + Chassis = chassis; + + var _props = props; + + VideoInputSyncFeedbacks = new FeedbackCollection(); + VideoOutputRouteFeedbacks = new FeedbackCollection(); + InputNameFeedbacks = new FeedbackCollection(); + OutputNameFeedbacks = new FeedbackCollection(); + OutputRouteNameFeedbacks = new FeedbackCollection(); + + // logical ports + InputPorts = new RoutingPortCollection(); + for (uint i = 1; i <= Chassis.NumberOfInputs; i++) + { + InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, i, this)); + VideoInputSyncFeedbacks.Add(new BoolFeedback(i.ToString(), () => Chassis.Inputs[i].VideoDetectedFeedback.BoolValue)); + InputNameFeedbacks.Add(new StringFeedback(i.ToString, () => _props.Inputs[i - 1].Name)); + } + + OutputPorts = new RoutingPortCollection(); + for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) + { + OutputPorts.Add(new RoutingOutputPort("hdmiOut" + i, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, i, this)); + VideoOutputRouteFeedbacks.Add(new IntFeedback(i.ToString(), () => (int)Chassis.Outputs[i].VideoOutFeedback.Number)); + } + + // physical settings + if (props != null && props.Inputs != null) + { + foreach (var kvp in props.Inputs) + { + // strip "hdmiIn" + var inputNum = Convert.ToUInt32(kvp.Key.Substring(6)); + + var port = chassis.HdmiInputs[inputNum].HdmiInputPort; + // set hdcp disables + if (kvp.Value.DisableHdcp) + { + Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key); + port.HdcpSupportOff(); + } + else + port.HdcpSupportOn(); + } + } + + Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); + Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); + } + + void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) + { + if (args.EventId == DMOutputEventIds.VideoOutEventId) + { + foreach (var item in VideoOutputRouteFeedbacks) + { + item.FireUpdate(); + } + } + } + + void Chassis_DMInputChange(Switch device, DMInputEventArgs args) + { + if (args.EventId == DMInputEventIds.VideoDetectedEventId) + { + foreach (var item in VideoInputSyncFeedbacks) + { + item.FireUpdate(); + } + } + } + + public override bool CustomActivate() + { + var result = Chassis.Register(); + if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success) + { + Debug.Console(0, this, "Device registration failed: {0}", result); + return false; + } + + + + return base.CustomActivate(); + } + + + + #region IRouting Members + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + // Try to make switch only when necessary. The unit appears to toggle when already selected. + var current = Chassis.HdmiOutputs[(uint)outputSelector].VideoOut; + if (current != Chassis.HdmiInputs[(uint)inputSelector]) + Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = Chassis.HdmiInputs[(uint)inputSelector]; + } + + #endregion + + ///////////////////////////////////////////////////// + + + public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory + { + public HdMdNxM4kEControllerFactory() + { + TypeNames = new List() { "hdmd4x14ke", "hdmd4x24ke", "hdmd6x24ke" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + + + Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + var type = dc.Type.ToLower(); + var control = props.Control; + var ipid = control.IpIdInt; + var address = control.TcpSshProperties.Address; + + if (type.StartsWith("hdmd4x14ke")) + { + return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props); + } + + else if (type.StartsWith("hdmd4x24ke")) + { + return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props); + } + + else if (type.StartsWith("hdmd6x24ke")) + { + return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props); + } + + return null; + } + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs index 06411e39..78794671 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs @@ -19,5 +19,8 @@ namespace PepperDash.Essentials.DM.Config [JsonProperty("inputs")] public Dictionary Inputs { get; set; } + + [JsonProperty("outputs"] + public Dictionary } } \ No newline at end of file From efd4f379ee4038793d1b1516fb40fb25dbd4e656 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 15 May 2020 10:42:56 -0500 Subject: [PATCH 05/52] Resolves #186 - Completely refactored HD-MD-Switch Class --- .../JoinMaps/HdMdNxM4kEControllerJoinMap.cs | 53 +++ .../PepperDash_Essentials_Core.csproj | 1 + .../Chassis/HdMdNxM4kEController.cs | 328 ++++++++++++++---- .../Config/HdMdNxM4kEPropertiesConfig.cs | 8 +- .../Config/InputPropertiesConfig.cs | 15 - .../PepperDash_Essentials_DM.csproj | 1 - 6 files changed, 310 insertions(+), 96 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs delete mode 100644 essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs new file mode 100644 index 00000000..87a0643a --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs @@ -0,0 +1,53 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class HdMdNxM4kEControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputName")] + public JoinDataComplete InputName = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 }, + new JoinMetadata() { Label = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("InputSync")] + public JoinDataComplete InputSync = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 }, + new JoinMetadata() { Label = "Device Input Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("OutputName")] + public JoinDataComplete OutputName = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 2 }, + new JoinMetadata() { Label = "Device Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("OutputRoute")] + public JoinDataComplete OutputRoute = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 2 }, + new JoinMetadata() { Label = "Device Output Route Set/Get", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog }); + + [JoinName("OutputRoutedName")] + public JoinDataComplete OutputRoutedName = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 2 }, + new JoinMetadata() { Label = "Device Output Route Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + + [JoinName("EnableInputHdcp")] + public JoinDataComplete EnableInputHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 8 }, + new JoinMetadata() { Label = "Device Enable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableInputHdcp")] + public JoinDataComplete DisableInputHdcp = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 8 }, + new JoinMetadata() { Label = "Device Disnable Input Hdcp", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "Device Onlne", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + public HdMdNxM4kEControllerJoinMap(uint joinStart) + : base(joinStart, typeof(HdMdNxM4kEControllerJoinMap)) + { + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 00db3b08..63b7f580 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -129,6 +129,7 @@ + diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs index fc30c1aa..e2f5ff2c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs @@ -1,24 +1,30 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Newtonsoft.Json; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DM; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM.Config; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.DM.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; - namespace PepperDash.Essentials.DM.Chassis { - public class HdMdNxM4kEController : EssentialsBridgeableDevice, IRoutingInputsOutputs, IRouting + [Description("Wrapper class for all HdMdNxM4E switchers")] + public class HdMdNxM4kEController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback { public HdMdNxM Chassis { get; private set; } + public string DeviceName { get; private set; } + + public Dictionary InputNames { get; set; } + public Dictionary OutputNames { get; set; } + public RoutingPortCollection InputPorts { get; private set; } public RoutingPortCollection OutputPorts { get; private set; } @@ -27,68 +33,262 @@ namespace PepperDash.Essentials.DM.Chassis public FeedbackCollection InputNameFeedbacks { get; private set; } public FeedbackCollection OutputNameFeedbacks { get; private set; } public FeedbackCollection OutputRouteNameFeedbacks { get; private set; } + public FeedbackCollection InputHdcpEnableFeedback { get; private set; } + public FeedbackCollection DeviceNameFeedback { get; private set; } + #region Constructor - /// - /// - /// - /// - /// - /// public HdMdNxM4kEController(string key, string name, HdMdNxM chassis, HdMdNxM4kEPropertiesConfig props) - : base(key, name) + : base(key, name, chassis) { Chassis = chassis; - var _props = props; + DeviceName = name; + + InputNames = props.Inputs; + OutputNames = props.Outputs; + VideoInputSyncFeedbacks = new FeedbackCollection(); VideoOutputRouteFeedbacks = new FeedbackCollection(); InputNameFeedbacks = new FeedbackCollection(); OutputNameFeedbacks = new FeedbackCollection(); OutputRouteNameFeedbacks = new FeedbackCollection(); + InputHdcpEnableFeedback = new FeedbackCollection(); + DeviceNameFeedback = new FeedbackCollection(); - // logical ports InputPorts = new RoutingPortCollection(); + OutputPorts = new RoutingPortCollection(); + + DeviceNameFeedback.Add(new StringFeedback("DeviceName", () => DeviceName)); + for (uint i = 1; i <= Chassis.NumberOfInputs; i++) { - InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.AudioVideo, + var inputName = InputNames[i]; + Chassis.Inputs[i].Name.StringValue = inputName; + + InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, i, this)); - VideoInputSyncFeedbacks.Add(new BoolFeedback(i.ToString(), () => Chassis.Inputs[i].VideoDetectedFeedback.BoolValue)); - InputNameFeedbacks.Add(new StringFeedback(i.ToString, () => _props.Inputs[i - 1].Name)); + VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => Chassis.Inputs[i].VideoDetectedFeedback.BoolValue)); + InputNameFeedbacks.Add(new StringFeedback(inputName, () => Chassis.Inputs[i].Name.StringValue)); + InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue)); + } - OutputPorts = new RoutingPortCollection(); for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) { - OutputPorts.Add(new RoutingOutputPort("hdmiOut" + i, eRoutingSignalType.AudioVideo, + var outputName = OutputNames[i]; + Chassis.Outputs[i].Name.StringValue = outputName; + + OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, i, this)); - VideoOutputRouteFeedbacks.Add(new IntFeedback(i.ToString(), () => (int)Chassis.Outputs[i].VideoOutFeedback.Number)); - } - - // physical settings - if (props != null && props.Inputs != null) - { - foreach (var kvp in props.Inputs) - { - // strip "hdmiIn" - var inputNum = Convert.ToUInt32(kvp.Key.Substring(6)); - - var port = chassis.HdmiInputs[inputNum].HdmiInputPort; - // set hdcp disables - if (kvp.Value.DisableHdcp) - { - Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key); - port.HdcpSupportOff(); - } - else - port.HdcpSupportOn(); - } + VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)Chassis.Outputs[i].VideoOutFeedback.Number)); + OutputNameFeedbacks.Add(new StringFeedback(outputName, () => Chassis.Outputs[i].Name.StringValue)); + OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => Chassis.Outputs[i].VideoOutFeedback.NameFeedback.StringValue)); } Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); + + AddPostActivationAction(AddFeedbackCollections); + } + + #endregion + + #region Methods + + public void EnableHdcp(uint port) + { + if (port <= Chassis.HdmiInputs.Count) + { + Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn(); + InputHdcpEnableFeedback[InputNames[port]].FireUpdate(); + } + } + + public void DisableHdcp(uint port) + { + if (port <= Chassis.HdmiInputs.Count) + { + Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff(); + InputHdcpEnableFeedback[InputNames[port]].FireUpdate(); + } + } + + #region PostActivate + + public void AddFeedbackCollections() + { + AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback); + AddCollectionsToList(VideoOutputRouteFeedbacks); + AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks, DeviceNameFeedback); + } + + #endregion + + #region FeedbackCollection Methods + + //Add arrays of collections + public void AddCollectionsToList(params FeedbackCollection[] newFbs) + { + foreach (FeedbackCollection fbCollection in newFbs) + { + foreach (var item in newFbs) + { + AddCollectionToList(item); + } + } + } + public void AddCollectionsToList(params FeedbackCollection[] newFbs) + { + foreach (FeedbackCollection fbCollection in newFbs) + { + foreach (var item in newFbs) + { + AddCollectionToList(item); + } + } + } + + public void AddCollectionsToList(params FeedbackCollection[] newFbs) + { + foreach (FeedbackCollection fbCollection in newFbs) + { + foreach (var item in newFbs) + { + AddCollectionToList(item); + } + } + } + + //Add Collections + public void AddCollectionToList(FeedbackCollection newFbs) + { + foreach (var f in newFbs) + { + if (f == null) continue; + + AddFeedbackToList(f); + } + } + + public void AddCollectionToList(FeedbackCollection newFbs) + { + foreach (var f in newFbs) + { + if (f == null) continue; + + AddFeedbackToList(f); + } + } + + public void AddCollectionToList(FeedbackCollection newFbs) + { + foreach (var f in newFbs) + { + if (f == null) continue; + + AddFeedbackToList(f); + } + } + + //Add Individual Feedbacks + public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb) + { + if (newFb == null) return; + + if (!Feedbacks.Contains(newFb)) + { + Feedbacks.Add(newFb); + } + } + + #endregion + + #region IRouting Members + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + // Try to make switch only when necessary. The unit appears to toggle when already selected. + var current = Chassis.HdmiOutputs[(uint)outputSelector].VideoOut; + if (current != Chassis.HdmiInputs[(uint)inputSelector]) + Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = Chassis.HdmiInputs[(uint)inputSelector]; + } + + #endregion + + #endregion + + #region Bridge Linking + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + DeviceNameFeedback["DeviceName"].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]); + + for (uint i = 1; i < Chassis.Inputs.Count; i++) + { + var joinIndex = i - 1; + //Digital + VideoInputSyncFeedbacks[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]); + InputHdcpEnableFeedback[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]); + InputHdcpEnableFeedback[InputNames[i]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]); + trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(i)); + trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(i)); + + //Serial + InputNameFeedbacks[InputNames[i]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]); + } + + for (uint i = 1; i < Chassis.Outputs.Count; i++) + { + var joinIndex = i - 1; + //Analog + VideoOutputRouteFeedbacks[OutputNames[i]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]); + trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteSwitch(a, i, eRoutingSignalType.AudioVideo)); + + //Serial + OutputNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]); + OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]); + } + + Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange); + } + + + #endregion + + #region Events + + void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args) + { + if (args.DeviceOnLine) + { + for (uint i = 1; i <= Chassis.NumberOfInputs; i++) + { + Chassis.Inputs[i].Name.StringValue = InputNames[i]; + } + for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) + { + Chassis.Outputs[i].Name.StringValue = OutputNames[i]; + } + + foreach (var feedback in Feedbacks) + { + feedback.FireUpdate(); + } + } + } void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) @@ -113,36 +313,9 @@ namespace PepperDash.Essentials.DM.Chassis } } - public override bool CustomActivate() - { - var result = Chassis.Register(); - if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(0, this, "Device registration failed: {0}", result); - return false; - } - - - - return base.CustomActivate(); - } - - - - #region IRouting Members - - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - // Try to make switch only when necessary. The unit appears to toggle when already selected. - var current = Chassis.HdmiOutputs[(uint)outputSelector].VideoOut; - if (current != Chassis.HdmiInputs[(uint)inputSelector]) - Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = Chassis.HdmiInputs[(uint)inputSelector]; - } - #endregion - ///////////////////////////////////////////////////// - + #region Factory public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory { @@ -182,5 +355,8 @@ namespace PepperDash.Essentials.DM.Chassis return null; } } + + #endregion + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs index 78794671..4dc79b65 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs @@ -18,9 +18,9 @@ namespace PepperDash.Essentials.DM.Config public ControlPropertiesConfig Control { get; set; } [JsonProperty("inputs")] - public Dictionary Inputs { get; set; } - - [JsonProperty("outputs"] - public Dictionary + public Dictionary Inputs { get; set; } + + [JsonProperty("outputs")] + public Dictionary Outputs { get; set; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs deleted file mode 100644 index 40f958ec..00000000 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -namespace PepperDash.Essentials.DM.Config -{ - public class InputPropertiesConfig - { - public string Name { get; set; } - - public bool DisableHdcp { get; set; } - } -} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index 7fc4f24d..e5a04158 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -112,7 +112,6 @@ - From 696f169ea4d73681dd65512d99cd0cbf093844c9 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 15 May 2020 12:12:13 -0500 Subject: [PATCH 06/52] Adds OnlineStatus Event for Trilist to repropogate data on new connection --- .../Essentials_DM/Chassis/HdMdNxM4kEController.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs index e2f5ff2c..94a9f2de 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs @@ -73,7 +73,6 @@ namespace PepperDash.Essentials.DM.Chassis VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => Chassis.Inputs[i].VideoDetectedFeedback.BoolValue)); InputNameFeedbacks.Add(new StringFeedback(inputName, () => Chassis.Inputs[i].Name.StringValue)); InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue)); - } for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) @@ -263,6 +262,17 @@ namespace PepperDash.Essentials.DM.Chassis } Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange); + + trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => + { + if (args.DeviceOnLine) + { + foreach (var feedback in Feedbacks) + { + feedback.FireUpdate(); + } + } + }); } From 8fe586dfec5291ad850fe526b794f51f9bb1ef4c Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 15 May 2020 14:32:49 -0500 Subject: [PATCH 07/52] Added the original class back and changed updated class slightly; Minor changes to factory --- .../JoinMaps/HdMdNxM4kEControllerJoinMap.cs | 8 + .../Chassis/HdMdNxM4kEBridgeableController.cs | 394 ++++++++++++++++++ .../Chassis/HdMdNxM4kEController.cs | 376 +++-------------- .../Config/HdMdNxM4kEPropertiesConfig.cs | 35 +- .../Config/InputPropertiesConfig.cs | 16 + .../PepperDash_Essentials_DM.csproj | 2 + 6 files changed, 508 insertions(+), 323 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs index 87a0643a..a8a6497b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs @@ -13,6 +13,14 @@ namespace PepperDash.Essentials.Core.Bridges public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata() { Label = "Device Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + [JoinName("EnableAutoRoute")] + public JoinDataComplete EnableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DisableAutoRoute")] + public JoinDataComplete DisableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Disable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); + [JoinName("InputName")] public JoinDataComplete InputName = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 }, new JoinMetadata() { Label = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs new file mode 100644 index 00000000..87cc72cf --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs @@ -0,0 +1,394 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Newtonsoft.Json; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.DM.Config; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.DM.Chassis +{ + [Description("Wrapper class for all HdMdNxM4E switchers")] + public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback + { + private HdMdNxM _Chassis; + private HdMd4x14kE _Chassis4x1; + + public Dictionary InputNames { get; set; } + public Dictionary OutputNames { get; set; } + + public RoutingPortCollection InputPorts { get; private set; } + public RoutingPortCollection OutputPorts { get; private set; } + + public FeedbackCollection VideoInputSyncFeedbacks { get; private set; } + public FeedbackCollection VideoOutputRouteFeedbacks { get; private set; } + public FeedbackCollection InputNameFeedbacks { get; private set; } + public FeedbackCollection OutputNameFeedbacks { get; private set; } + public FeedbackCollection OutputRouteNameFeedbacks { get; private set; } + public FeedbackCollection InputHdcpEnableFeedback { get; private set; } + public FeedbackCollection DeviceNameFeedback { get; private set; } + public FeedbackCollection AutoRouteFeedback { get; private set; } + + #region Constructor + + public HdMdNxM4kEBridgeableController(string key, string name, HdMdNxM chassis, + HdMdNxM4kEBridgeablePropertiesConfig props) + : base(key, name, chassis) + { + _Chassis = chassis; + var _props = props; + + InputNames = props.Inputs; + OutputNames = props.Outputs; + + VideoInputSyncFeedbacks = new FeedbackCollection(); + VideoOutputRouteFeedbacks = new FeedbackCollection(); + InputNameFeedbacks = new FeedbackCollection(); + OutputNameFeedbacks = new FeedbackCollection(); + OutputRouteNameFeedbacks = new FeedbackCollection(); + InputHdcpEnableFeedback = new FeedbackCollection(); + DeviceNameFeedback = new FeedbackCollection(); + AutoRouteFeedback = new FeedbackCollection(); + + InputPorts = new RoutingPortCollection(); + OutputPorts = new RoutingPortCollection(); + + DeviceNameFeedback.Add(new StringFeedback(this.Name, () => this.Name)); + + if (_Chassis.NumberOfInputs == 1) + { + _Chassis4x1 = _Chassis as HdMd4x14kE; + AutoRouteFeedback.Add(new BoolFeedback(this.Name + "-" + InputNames[1], () => _Chassis4x1.AutoModeOnFeedback.BoolValue)); + } + + for (uint i = 1; i <= _Chassis.NumberOfInputs; i++) + { + var inputName = InputNames[i]; + _Chassis.Inputs[i].Name.StringValue = inputName; + + InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, i, this)); + VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[i].VideoDetectedFeedback.BoolValue)); + InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[i].Name.StringValue)); + InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue)); + } + + for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++) + { + var outputName = OutputNames[i]; + _Chassis.Outputs[i].Name.StringValue = outputName; + + OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, i, this)); + VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[i].VideoOutFeedback.Number)); + OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].Name.StringValue)); + OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[i].VideoOutFeedback.NameFeedback.StringValue)); + } + + _Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); + _Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); + + AddPostActivationAction(AddFeedbackCollections); + } + + #endregion + + #region Methods + + public void EnableHdcp(uint port) + { + if (port > _Chassis.NumberOfInputs) return; + if (port <= 0) return; + + _Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn(); + InputHdcpEnableFeedback[InputNames[port]].FireUpdate(); + } + + public void DisableHdcp(uint port) + { + if (port > _Chassis.NumberOfInputs) return; + if (port <= 0) return; + + _Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff(); + InputHdcpEnableFeedback[InputNames[port]].FireUpdate(); + } + + public void EnableAutoRoute() + { + if (_Chassis.NumberOfInputs != 1) return; + + if (_Chassis4x1 == null) return; + + _Chassis4x1.AutoModeOn(); + } + + public void DisableAutoRoute() + { + if (_Chassis.NumberOfInputs != 1) return; + + if (_Chassis4x1 == null) return; + + _Chassis4x1.AutoModeOff(); + } + + #region PostActivate + + public void AddFeedbackCollections() + { + AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback); + AddCollectionsToList(VideoOutputRouteFeedbacks); + AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks, DeviceNameFeedback); + } + + #endregion + + #region FeedbackCollection Methods + + //Add arrays of collections + public void AddCollectionsToList(params FeedbackCollection[] newFbs) + { + foreach (FeedbackCollection fbCollection in newFbs) + { + foreach (var item in newFbs) + { + AddCollectionToList(item); + } + } + } + public void AddCollectionsToList(params FeedbackCollection[] newFbs) + { + foreach (FeedbackCollection fbCollection in newFbs) + { + foreach (var item in newFbs) + { + AddCollectionToList(item); + } + } + } + + public void AddCollectionsToList(params FeedbackCollection[] newFbs) + { + foreach (FeedbackCollection fbCollection in newFbs) + { + foreach (var item in newFbs) + { + AddCollectionToList(item); + } + } + } + + //Add Collections + public void AddCollectionToList(FeedbackCollection newFbs) + { + foreach (var f in newFbs) + { + if (f == null) continue; + + AddFeedbackToList(f); + } + } + + public void AddCollectionToList(FeedbackCollection newFbs) + { + foreach (var f in newFbs) + { + if (f == null) continue; + + AddFeedbackToList(f); + } + } + + public void AddCollectionToList(FeedbackCollection newFbs) + { + foreach (var f in newFbs) + { + if (f == null) continue; + + AddFeedbackToList(f); + } + } + + //Add Individual Feedbacks + public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb) + { + if (newFb == null) return; + + if (!Feedbacks.Contains(newFb)) + { + Feedbacks.Add(newFb); + } + } + + #endregion + + #region IRouting Members + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + // Try to make switch only when necessary. The unit appears to toggle when already selected. + var current = _Chassis.HdmiOutputs[(uint)outputSelector].VideoOut; + if (current != _Chassis.HdmiInputs[(uint)inputSelector]) + _Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = _Chassis.HdmiInputs[(uint)inputSelector]; + } + + #endregion + + #endregion + + #region Bridge Linking + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + bridge.AddJoinMap(Key, joinMap); + + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + DeviceNameFeedback[this.Name].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]); + + if (_Chassis4x1 != null) + { + AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkInputSig(trilist.BooleanInput[joinMap.EnableAutoRoute.JoinNumber]); + AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableAutoRoute.JoinNumber]); + } + + for (uint i = 1; i <= _Chassis.NumberOfInputs; i++) + { + var joinIndex = i - 1; + //Digital + VideoInputSyncFeedbacks[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]); + InputHdcpEnableFeedback[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]); + InputHdcpEnableFeedback[InputNames[i]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]); + trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(i)); + trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(i)); + + //Serial + InputNameFeedbacks[InputNames[i]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]); + } + + for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++) + { + var joinIndex = i - 1; + //Analog + VideoOutputRouteFeedbacks[OutputNames[i]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]); + trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteSwitch(a, i, eRoutingSignalType.AudioVideo)); + + //Serial + OutputNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]); + OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]); + } + + _Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange); + + trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => + { + if (args.DeviceOnLine) + { + foreach (var feedback in Feedbacks) + { + feedback.FireUpdate(); + } + } + }); + } + + + #endregion + + #region Events + + void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args) + { + if (args.DeviceOnLine) + { + for (uint i = 1; i <= _Chassis.NumberOfInputs; i++) + { + _Chassis.Inputs[i].Name.StringValue = InputNames[i]; + } + for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++) + { + _Chassis.Outputs[i].Name.StringValue = OutputNames[i]; + } + + foreach (var feedback in Feedbacks) + { + feedback.FireUpdate(); + } + } + + } + + void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) + { + if (args.EventId == DMOutputEventIds.VideoOutEventId) + { + foreach (var item in VideoOutputRouteFeedbacks) + { + item.FireUpdate(); + } + } + } + + void Chassis_DMInputChange(Switch device, DMInputEventArgs args) + { + if (args.EventId == DMInputEventIds.VideoDetectedEventId) + { + foreach (var item in VideoInputSyncFeedbacks) + { + item.FireUpdate(); + } + } + } + + #endregion + + #region Factory + + public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory + { + public HdMdNxM4kEControllerFactory() + { + TypeNames = new List() { "hdmd4x14ke-bridgeable", "hdmd4x24ke", "hdmd6x24ke" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + var type = dc.Type.ToLower(); + var control = props.Control; + var ipid = control.IpIdInt; + var address = control.TcpSshProperties.Address; + + switch (type) + { + case ("hdmd4x14ke-bridgeable"): + return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props); + case ("hdmd4x24ke"): + return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props); + case ("hdmd6x24ke"): + return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props); + default: + return null; + } + } + } + + #endregion + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs index 94a9f2de..fff3b112 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs @@ -2,371 +2,127 @@ using System.Collections.Generic; using System.Linq; using System.Text; -using Newtonsoft.Json; using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.DM.Config; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM.Chassis { - [Description("Wrapper class for all HdMdNxM4E switchers")] - public class HdMdNxM4kEController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback + public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting { public HdMdNxM Chassis { get; private set; } - public string DeviceName { get; private set; } - - public Dictionary InputNames { get; set; } - public Dictionary OutputNames { get; set; } - public RoutingPortCollection InputPorts { get; private set; } public RoutingPortCollection OutputPorts { get; private set; } - public FeedbackCollection VideoInputSyncFeedbacks { get; private set; } - public FeedbackCollection VideoOutputRouteFeedbacks { get; private set; } - public FeedbackCollection InputNameFeedbacks { get; private set; } - public FeedbackCollection OutputNameFeedbacks { get; private set; } - public FeedbackCollection OutputRouteNameFeedbacks { get; private set; } - public FeedbackCollection InputHdcpEnableFeedback { get; private set; } - public FeedbackCollection DeviceNameFeedback { get; private set; } - - #region Constructor + /// + /// + /// + /// + /// + /// public HdMdNxM4kEController(string key, string name, HdMdNxM chassis, HdMdNxM4kEPropertiesConfig props) - : base(key, name, chassis) + : base(key, name) { Chassis = chassis; - var _props = props; - - DeviceName = name; - - InputNames = props.Inputs; - OutputNames = props.Outputs; - - VideoInputSyncFeedbacks = new FeedbackCollection(); - VideoOutputRouteFeedbacks = new FeedbackCollection(); - InputNameFeedbacks = new FeedbackCollection(); - OutputNameFeedbacks = new FeedbackCollection(); - OutputRouteNameFeedbacks = new FeedbackCollection(); - InputHdcpEnableFeedback = new FeedbackCollection(); - DeviceNameFeedback = new FeedbackCollection(); + // logical ports InputPorts = new RoutingPortCollection(); + for (uint i = 1; i <= 4; i++) + { + InputPorts.Add(new RoutingInputPort("hdmiIn" + i, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, i, this)); + } OutputPorts = new RoutingPortCollection(); + OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this)); - DeviceNameFeedback.Add(new StringFeedback("DeviceName", () => DeviceName)); - - for (uint i = 1; i <= Chassis.NumberOfInputs; i++) + // physical settings + if (props != null && props.Inputs != null) { - var inputName = InputNames[i]; - Chassis.Inputs[i].Name.StringValue = inputName; - - InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, i, this)); - VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => Chassis.Inputs[i].VideoDetectedFeedback.BoolValue)); - InputNameFeedbacks.Add(new StringFeedback(inputName, () => Chassis.Inputs[i].Name.StringValue)); - InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => Chassis.HdmiInputs[i].HdmiInputPort.HdcpSupportOnFeedback.BoolValue)); - } - - for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) - { - var outputName = OutputNames[i]; - Chassis.Outputs[i].Name.StringValue = outputName; - - OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo, - eRoutingPortConnectionType.Hdmi, i, this)); - VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)Chassis.Outputs[i].VideoOutFeedback.Number)); - OutputNameFeedbacks.Add(new StringFeedback(outputName, () => Chassis.Outputs[i].Name.StringValue)); - OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => Chassis.Outputs[i].VideoOutFeedback.NameFeedback.StringValue)); - } - - Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange); - Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange); - - AddPostActivationAction(AddFeedbackCollections); - } - - #endregion - - #region Methods - - public void EnableHdcp(uint port) - { - if (port <= Chassis.HdmiInputs.Count) - { - Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn(); - InputHdcpEnableFeedback[InputNames[port]].FireUpdate(); - } - } - - public void DisableHdcp(uint port) - { - if (port <= Chassis.HdmiInputs.Count) - { - Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff(); - InputHdcpEnableFeedback[InputNames[port]].FireUpdate(); - } - } - - #region PostActivate - - public void AddFeedbackCollections() - { - AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback); - AddCollectionsToList(VideoOutputRouteFeedbacks); - AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks, DeviceNameFeedback); - } - - #endregion - - #region FeedbackCollection Methods - - //Add arrays of collections - public void AddCollectionsToList(params FeedbackCollection[] newFbs) - { - foreach (FeedbackCollection fbCollection in newFbs) - { - foreach (var item in newFbs) + foreach (var kvp in props.Inputs) { - AddCollectionToList(item); - } - } - } - public void AddCollectionsToList(params FeedbackCollection[] newFbs) - { - foreach (FeedbackCollection fbCollection in newFbs) - { - foreach (var item in newFbs) - { - AddCollectionToList(item); + // strip "hdmiIn" + var inputNum = Convert.ToUInt32(kvp.Key.Substring(6)); + + var port = chassis.HdmiInputs[inputNum].HdmiInputPort; + // set hdcp disables + if (kvp.Value.DisableHdcp) + { + Debug.Console(0, this, "Configuration disables HDCP support on {0}", kvp.Key); + port.HdcpSupportOff(); + } + else + port.HdcpSupportOn(); } } } - public void AddCollectionsToList(params FeedbackCollection[] newFbs) + public override bool CustomActivate() { - foreach (FeedbackCollection fbCollection in newFbs) + var result = Chassis.Register(); + if (result != Crestron.SimplSharpPro.eDeviceRegistrationUnRegistrationResponse.Success) { - foreach (var item in newFbs) - { - AddCollectionToList(item); - } + Debug.Console(0, this, "Device registration failed: {0}", result); + return false; } + + return base.CustomActivate(); } - //Add Collections - public void AddCollectionToList(FeedbackCollection newFbs) - { - foreach (var f in newFbs) - { - if (f == null) continue; - AddFeedbackToList(f); - } - } - - public void AddCollectionToList(FeedbackCollection newFbs) - { - foreach (var f in newFbs) - { - if (f == null) continue; - - AddFeedbackToList(f); - } - } - - public void AddCollectionToList(FeedbackCollection newFbs) - { - foreach (var f in newFbs) - { - if (f == null) continue; - - AddFeedbackToList(f); - } - } - - //Add Individual Feedbacks - public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb) - { - if (newFb == null) return; - - if (!Feedbacks.Contains(newFb)) - { - Feedbacks.Add(newFb); - } - } - - #endregion #region IRouting Members public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) { // Try to make switch only when necessary. The unit appears to toggle when already selected. - var current = Chassis.HdmiOutputs[(uint)outputSelector].VideoOut; + var current = Chassis.HdmiOutputs[1].VideoOut; if (current != Chassis.HdmiInputs[(uint)inputSelector]) - Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = Chassis.HdmiInputs[(uint)inputSelector]; + Chassis.HdmiOutputs[1].VideoOut = Chassis.HdmiInputs[(uint)inputSelector]; } #endregion - #endregion + ///////////////////////////////////////////////////// - #region Bridge Linking - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + /// + /// + /// + /// + /// + /// + /// + /// + public static HdMdNxM4kEController GetController(string key, string name, + string type, HdMdNxM4kEPropertiesConfig properties) { - var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) - joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - - bridge.AddJoinMap(Key, joinMap); - - IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); - DeviceNameFeedback["DeviceName"].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]); - - for (uint i = 1; i < Chassis.Inputs.Count; i++) + try { - var joinIndex = i - 1; - //Digital - VideoInputSyncFeedbacks[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]); - InputHdcpEnableFeedback[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]); - InputHdcpEnableFeedback[InputNames[i]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]); - trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(i)); - trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(i)); + var ipid = properties.Control.IpIdInt; + var address = properties.Control.TcpSshProperties.Address; - //Serial - InputNameFeedbacks[InputNames[i]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]); + type = type.ToLower(); + if (type == "hdmd4x14ke") + { + Debug.Console(0, @"The 'hdmd4x14ke' device is not an Essentials Bridgeable device. + If an essentials Bridgeable Device is required, use the 'hdmd4x14ke-bridgeable' type"); + + var chassis = new HdMd4x14kE(ipid, address, Global.ControlSystem); + return new HdMdNxM4kEController(key, name, chassis, properties); + } + return null; } - - for (uint i = 1; i < Chassis.Outputs.Count; i++) + catch (Exception e) { - var joinIndex = i - 1; - //Analog - VideoOutputRouteFeedbacks[OutputNames[i]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]); - trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteSwitch(a, i, eRoutingSignalType.AudioVideo)); - - //Serial - OutputNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]); - OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]); - } - - Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange); - - trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) => - { - if (args.DeviceOnLine) - { - foreach (var feedback in Feedbacks) - { - feedback.FireUpdate(); - } - } - }); - } - - - #endregion - - #region Events - - void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args) - { - if (args.DeviceOnLine) - { - for (uint i = 1; i <= Chassis.NumberOfInputs; i++) - { - Chassis.Inputs[i].Name.StringValue = InputNames[i]; - } - for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) - { - Chassis.Outputs[i].Name.StringValue = OutputNames[i]; - } - - foreach (var feedback in Feedbacks) - { - feedback.FireUpdate(); - } - } - - } - - void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) - { - if (args.EventId == DMOutputEventIds.VideoOutEventId) - { - foreach (var item in VideoOutputRouteFeedbacks) - { - item.FireUpdate(); - } - } - } - - void Chassis_DMInputChange(Switch device, DMInputEventArgs args) - { - if (args.EventId == DMInputEventIds.VideoDetectedEventId) - { - foreach (var item in VideoInputSyncFeedbacks) - { - item.FireUpdate(); - } - } - } - - #endregion - - #region Factory - - public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory - { - public HdMdNxM4kEControllerFactory() - { - TypeNames = new List() { "hdmd4x14ke", "hdmd4x24ke", "hdmd6x24ke" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - - - Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - var type = dc.Type.ToLower(); - var control = props.Control; - var ipid = control.IpIdInt; - var address = control.TcpSshProperties.Address; - - if (type.StartsWith("hdmd4x14ke")) - { - return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props); - } - - else if (type.StartsWith("hdmd4x24ke")) - { - return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props); - } - - else if (type.StartsWith("hdmd6x24ke")) - { - return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props); - } - + Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e); return null; } } - - #endregion - } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs index 4dc79b65..f222694a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/HdMdNxM4kEPropertiesConfig.cs @@ -8,19 +8,28 @@ using Newtonsoft.Json; using PepperDash.Core; namespace PepperDash.Essentials.DM.Config -{ - /// - /// Defines the properties section of HdMdNxM boxes - /// - public class HdMdNxM4kEPropertiesConfig - { - [JsonProperty("control")] - public ControlPropertiesConfig Control { get; set; } - - [JsonProperty("inputs")] - public Dictionary Inputs { get; set; } +{ + /// + /// Defines the properties section of HdMdNxM boxes + /// + public class HdMdNxM4kEPropertiesConfig + { + [JsonProperty("control")] + public ControlPropertiesConfig Control { get; set; } + + [JsonProperty("inputs")] + public Dictionary Inputs { get; set; } + } + + public class HdMdNxM4kEBridgeablePropertiesConfig + { + [JsonProperty("control")] + public ControlPropertiesConfig Control { get; set; } + + [JsonProperty("inputs")] + public Dictionary Inputs { get; set; } [JsonProperty("outputs")] - public Dictionary Outputs { get; set; } - } + public Dictionary Outputs { get; set; } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs b/essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs new file mode 100644 index 00000000..c95c359f --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Config/InputPropertiesConfig.cs @@ -0,0 +1,16 @@ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.DM.Config +{ + public class InputPropertiesConfig + { + public string Name { get; set; } + + public bool DisableHdcp { get; set; } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index e5a04158..61150d80 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -99,7 +99,9 @@ + + From 2a9f6e253b024bb4077ad00adeef28e22f93b293 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 11:06:18 -0500 Subject: [PATCH 08/52] Resolves #201 Improvements to CenRfgwController Addition of Button Extensions Addition of Hrxxx0WirelessRemoteController Addition of InfinetId to EssentialsControlPropertiesConfig Addition of CrestronRemotePropertiesConfig --- .../Hrxxx0WirelessRemoteControllerJoinMap.cs | 238 ++++++++++++++++++ .../Config/Comm and IR/CommFactory.cs | 20 ++ .../DeviceTypeInterfaces/IDPad.cs | 2 +- .../Gateways/CenRfgwController.cs | 139 ++++++++++ .../Gateways/EssentialsRfGatewayConfig.cs | 23 ++ .../PepperDashEssentialsBase/Global/Global.cs | 4 +- .../PepperDash_Essentials_Core.csproj | 10 + .../Remotes/ButtonExtensions.cs | 47 ++++ .../Remotes/CrestronRemotePropertiesConfig.cs | 17 ++ .../Remotes/Hrxx0WirelessRemoteController.cs | 233 +++++++++++++++++ .../Endpoints/Transmitters/DmTxHelpers.cs | 16 +- .../Crestron/Gateways/CenRfgwController.cs | 133 ---------- .../Essentials Devices Common.csproj | 1 - 13 files changed, 738 insertions(+), 145 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/CrestronRemotePropertiesConfig.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs delete mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/Crestron/Gateways/CenRfgwController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs new file mode 100644 index 00000000..f9037aa0 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/Hrxxx0WirelessRemoteControllerJoinMap.cs @@ -0,0 +1,238 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials.Core.Bridges +{ + public class Hrxxx0WirelessRemoteControllerJoinMap : JoinMapBaseAdvanced + { + [JoinName("Power")] + public JoinDataComplete Power = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "Power", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Menu")] + public JoinDataComplete Menu = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 }, + new JoinMetadata() { Label = "Menu", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Guide")] + public JoinDataComplete Guide = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 }, + new JoinMetadata() { Label = "Guide", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Info")] + public JoinDataComplete Info = new JoinDataComplete(new JoinData() { JoinNumber = 4, JoinSpan = 1 }, + new JoinMetadata() { Label = "Info", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeUp")] + public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata() { Label = "VolumeUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("VolumeDown")] + public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 }, + new JoinMetadata() { Label = "VolumeDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadUp")] + public JoinDataComplete DialPadUp = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadDown")] + public JoinDataComplete DialPadDown = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadLeft")] + public JoinDataComplete DialPadLeft = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadLeft", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadRight")] + public JoinDataComplete DialPadRight = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadRight", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("DialPadSelect")] + public JoinDataComplete DialPadSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 }, + new JoinMetadata() { Label = "DialPadSelect", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChannelUp")] + public JoinDataComplete ChannelUp = new JoinDataComplete(new JoinData() { JoinNumber = 12, JoinSpan = 1 }, + new JoinMetadata() { Label = "ChannelUp", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("ChannelDown")] + public JoinDataComplete ChannelDown = new JoinDataComplete(new JoinData() { JoinNumber = 13, JoinSpan = 1 }, + new JoinMetadata() { Label = "ChannelDown", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Mute")] + public JoinDataComplete Mute = new JoinDataComplete(new JoinData() { JoinNumber = 14, JoinSpan = 1 }, + new JoinMetadata() { Label = "Mute", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Exit")] + public JoinDataComplete Exit = new JoinDataComplete(new JoinData() { JoinNumber = 15, JoinSpan = 1 }, + new JoinMetadata() { Label = "Exit", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Last")] + public JoinDataComplete Last = new JoinDataComplete(new JoinData() { JoinNumber = 16, JoinSpan = 1 }, + new JoinMetadata() { Label = "Last", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Play")] + public JoinDataComplete Play = new JoinDataComplete(new JoinData() { JoinNumber = 17, JoinSpan = 1 }, + new JoinMetadata() { Label = "Play", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Pause")] + public JoinDataComplete Pause = new JoinDataComplete(new JoinData() { JoinNumber = 18, JoinSpan = 1 }, + new JoinMetadata() { Label = "Pause", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Rewind")] + public JoinDataComplete Rewind = new JoinDataComplete(new JoinData() { JoinNumber = 19, JoinSpan = 1 }, + new JoinMetadata() { Label = "Rewind", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("FastForward")] + public JoinDataComplete FastForward = new JoinDataComplete(new JoinData() { JoinNumber = 20, JoinSpan = 1 }, + new JoinMetadata() { Label = "FastForward", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("PreviousTrack")] + public JoinDataComplete PreviousTrack = new JoinDataComplete(new JoinData() { JoinNumber = 21, JoinSpan = 1 }, + new JoinMetadata() { Label = "PreviousTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("NextTrack")] + public JoinDataComplete NextTrack = new JoinDataComplete(new JoinData() { JoinNumber = 22, JoinSpan = 1 }, + new JoinMetadata() { Label = "NextTrack", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Stop")] + public JoinDataComplete Stop = new JoinDataComplete(new JoinData() { JoinNumber = 23, JoinSpan = 1 }, + new JoinMetadata() { Label = "Stop", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Record")] + public JoinDataComplete Record = new JoinDataComplete(new JoinData() { JoinNumber = 24, JoinSpan = 1 }, + new JoinMetadata() { Label = "Record", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Dvr")] + public JoinDataComplete Dvr = new JoinDataComplete(new JoinData() { JoinNumber = 25, JoinSpan = 1 }, + new JoinMetadata() { Label = "Dvr", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad1")] + public JoinDataComplete Keypad1 = new JoinDataComplete(new JoinData() { JoinNumber = 26, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad2Abc")] + public JoinDataComplete Keypad2 = new JoinDataComplete(new JoinData() { JoinNumber = 27, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad2Abc", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad3Def")] + public JoinDataComplete Keypad3Def = new JoinDataComplete(new JoinData() { JoinNumber = 28, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad3Def", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad4Ghi")] + public JoinDataComplete Keypad4Ghi = new JoinDataComplete(new JoinData() { JoinNumber = 29, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad4Ghi", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad5Jkl")] + public JoinDataComplete Keypad5Jkl = new JoinDataComplete(new JoinData() { JoinNumber = 30, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad5Jkl", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad6Mno")] + public JoinDataComplete Keypad6Mno = new JoinDataComplete(new JoinData() { JoinNumber = 31, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad6Mno", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad7Pqrs")] + public JoinDataComplete Keypad7Pqrs = new JoinDataComplete(new JoinData() { JoinNumber = 32, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad7Pqrs", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad8Tuv")] + public JoinDataComplete Keypad8Tuv = new JoinDataComplete(new JoinData() { JoinNumber = 33, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad8Tuv", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad9Wxyz")] + public JoinDataComplete Keypad9Wxyz = new JoinDataComplete(new JoinData() { JoinNumber = 34, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad9Wxyz", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Keypad0")] + public JoinDataComplete Keypad0 = new JoinDataComplete(new JoinData() { JoinNumber = 35, JoinSpan = 1 }, + new JoinMetadata() { Label = "Keypad0", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Clear")] + public JoinDataComplete Clear = new JoinDataComplete(new JoinData() { JoinNumber = 36, JoinSpan = 1 }, + new JoinMetadata() { Label = "Clear", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Enter")] + public JoinDataComplete Enter = new JoinDataComplete(new JoinData() { JoinNumber = 37, JoinSpan = 1 }, + new JoinMetadata() { Label = "Enter", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Red")] + public JoinDataComplete Red = new JoinDataComplete(new JoinData() { JoinNumber = 38, JoinSpan = 1 }, + new JoinMetadata() { Label = "Red", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Green")] + public JoinDataComplete Green = new JoinDataComplete(new JoinData() { JoinNumber = 39, JoinSpan = 1 }, + new JoinMetadata() { Label = "Green", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Yellow")] + public JoinDataComplete Yellow = new JoinDataComplete(new JoinData() { JoinNumber = 40, JoinSpan = 1 }, + new JoinMetadata() { Label = "Yellow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Blue")] + public JoinDataComplete Blue = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 1 }, + new JoinMetadata() { Label = "Blue", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom1")] + public JoinDataComplete Custom1 = new JoinDataComplete(new JoinData() { JoinNumber = 42, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom1", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom2")] + public JoinDataComplete Custom2 = new JoinDataComplete(new JoinData() { JoinNumber = 43, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom2", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom3")] + public JoinDataComplete Custom3 = new JoinDataComplete(new JoinData() { JoinNumber = 44, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom3", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom4")] + public JoinDataComplete Custom4 = new JoinDataComplete(new JoinData() { JoinNumber = 45, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom4", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom5")] + public JoinDataComplete Custom5 = new JoinDataComplete(new JoinData() { JoinNumber = 46, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom5", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom6")] + public JoinDataComplete Custom6 = new JoinDataComplete(new JoinData() { JoinNumber = 47, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom6", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom7")] + public JoinDataComplete Custom7 = new JoinDataComplete(new JoinData() { JoinNumber = 48, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom7", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom8")] + public JoinDataComplete Custom8 = new JoinDataComplete(new JoinData() { JoinNumber = 49, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom8", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Custom9")] + public JoinDataComplete Custom9 = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 }, + new JoinMetadata() { Label = "Custom9", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Fav")] + public JoinDataComplete Fav = new JoinDataComplete(new JoinData() { JoinNumber = 51, JoinSpan = 1 }, + new JoinMetadata() { Label = "Fav", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("Home")] + public JoinDataComplete Home = new JoinDataComplete(new JoinData() { JoinNumber = 52, JoinSpan = 1 }, + new JoinMetadata() { Label = "Home", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BatteryLow")] + public JoinDataComplete BatteryLow = new JoinDataComplete(new JoinData() { JoinNumber = 53, JoinSpan = 1 }, + new JoinMetadata() { Label = "BatteryLow", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BatteryCritical")] + public JoinDataComplete BatteryCritical = new JoinDataComplete(new JoinData() { JoinNumber = 54, JoinSpan = 1 }, + new JoinMetadata() { Label = "BatteryCritical", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital }); + + [JoinName("BatteryVoltage")] + public JoinDataComplete BatteryVoltage = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, + new JoinMetadata() { Label = "BatteryVoltage", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog }); + + public Hrxxx0WirelessRemoteControllerJoinMap(uint joinStart) + : base(joinStart, typeof(Hrxxx0WirelessRemoteControllerJoinMap)) + { + } + + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs index 94110fd7..eaf109ef 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs @@ -184,6 +184,26 @@ namespace PepperDash.Essentials.Core throw new FormatException(string.Format("ERROR:Unable to convert Cresnet ID: {0} to hex. Error:\n{1}", CresnetId)); } } + } + + public string InfinetId { get; set; } + + /// + /// Attepmts to provide uiont conversion of string InifinetId + /// + public uint InfinetIdInt + { + get + { + try + { + return Convert.ToUInt32(InfinetId, 16); + } + catch (Exception) + { + throw new FormatException(string.Format("ERROR:Unable to conver Infinet ID: {0} to hex. Error:\n{1}", InfinetId)); + } + } } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs index 2e0f3ae7..d222b47c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IDPad.cs @@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core triList.SetBoolSigAction(141, dev.Right); triList.SetBoolSigAction(142, dev.Select); triList.SetBoolSigAction(130, dev.Menu); - triList.SetBoolSigAction(134, dev.Exit); + triList.SetBoolSigAction(134, dev.Exit); } public static void UnlinkButtons(this IDPad dev, BasicTriList triList) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs new file mode 100644 index 00000000..1fd7da6d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.Gateways; +using Newtonsoft.Json; + + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + [Description("Wrapper class for Crestron Infinet-EX Gateways")] + public class CenRfgwController : CrestronGenericBaseDevice + { + private GatewayBase _Gateway; + public GatewayBase GateWay { get { return _Gateway; } } + + /// + /// Constructor for the on-board gateway + /// + /// + /// + public CenRfgwController(string key, string name, GatewayBase gateway) : + base(key, name, gateway) + { + _Gateway = gateway; + } + + public static CenRfgwController GetNewExGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType) + { + eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true); + try + { + var cs = Global.ControlSystem; + + GatewayBase gw = null; + switch (type) + { + case eExGatewayType.Ethernet: + gw = new CenRfgwEx(ipId, cs); + break; + case eExGatewayType.EthernetShared: + gw = new CenRfgwExEthernetSharable(ipId, cs); + break; + case eExGatewayType.Cresnet: + gw = new CenRfgwExCresnet(cresnetId, cs); + break; + } + return new CenRfgwController(key, name, gw); + } + catch (Exception) + { + Debug.Console(0, "ERROR: Cannot create EX Gateway, id {0}, type {1}", type == eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType); + return null; + } + } + public static CenRfgwController GetNewErGatewayController(string key, string name, ushort ipId, ushort cresnetId, string gatewayType) + { + eExGatewayType type = (eExGatewayType)Enum.Parse(typeof(eExGatewayType), gatewayType, true); + try + { + var cs = Global.ControlSystem; + + GatewayBase gw = null; + switch (type) + { + case eExGatewayType.Ethernet: + gw = new CenErfgwPoe(ipId, cs); + break; + case eExGatewayType.EthernetShared: + gw = new CenErfgwPoeEthernetSharable(ipId, cs); + break; + case eExGatewayType.Cresnet: + gw = new CenErfgwPoeCresnet(cresnetId, cs); + break; + } + return new CenRfgwController(key, name, gw); + } + catch (Exception) + { + Debug.Console(0, "ERROR: Cannot create ER Gateway, id {0}, type {1}", type== eExGatewayType.Cresnet ? cresnetId : ipId, gatewayType); + return null; + } + } + + } + + + + public enum eExGatewayType + { + Ethernet, EthernetShared, Cresnet + } + + + #region Factory + public class CenRfgwControllerFactory : EssentialsDeviceFactory + { + public CenRfgwControllerFactory() + { + TypeNames = new List() { "cenrfgwex", "cenerfgwpoe" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + + Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + var type = dc.Type.ToLower(); + var control = props.Control; + var ipid = control.IpIdInt; + var cresnetId = control.CresnetIdInt; + var gatewayType = props.GatewayType; + + switch (type) + { + case ("cenrfgwex"): + return CenRfgwController.GetNewExGatewayController(dc.Key, dc.Name, + (ushort)ipid, (ushort)cresnetId, gatewayType); + case ("cenerfgwpoe"): + return CenRfgwController.GetNewErGatewayController(dc.Key, dc.Name, + (ushort)ipid, (ushort)cresnetId, gatewayType); + default: + return null; + } + } + } + #endregion + + +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs new file mode 100644 index 00000000..e1ae8c11 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/EssentialsRfGatewayConfig.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + + +namespace PepperDash.Essentials.Core +{ + public class EssentialsRfGatewayConfig + { + [JsonProperty("control")] + public EssentialsControlPropertiesConfig Control { get; set; } + + [JsonProperty("gatewayType")] + public string GatewayType { get; set; } + + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 2f3e1823..b540b3d6 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -17,8 +17,8 @@ namespace PepperDash.Essentials.Core { public static class Global { - public static CrestronControlSystem ControlSystem { get; set; } - + public static CrestronControlSystem ControlSystem { get; set; } + public static LicenseManager LicenseManager { get; set; } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 63b7f580..18b8fc65 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -62,6 +62,10 @@ False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll + + False + ..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll + False ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll @@ -131,6 +135,7 @@ + @@ -177,6 +182,8 @@ + + @@ -222,6 +229,9 @@ + + + diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs new file mode 100644 index 00000000..43941260 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/ButtonExtensions.cs @@ -0,0 +1,47 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; + +namespace PepperDash.Essentials.Core +{ + public static class ButtonExtensions + { + public static Button SetButtonAction(this Button button, Action a) + { + button.UserObject = a; + return button; + } + + public static Button SetButtonAction(this CrestronCollection + [Description("Wrapper class for a Relay")] public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput { public Relay RelayOutput { get; private set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index fd83f2a2..707a8fb8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -13,8 +13,9 @@ using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Core -{ - public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced +{ + [Description("Wrapper class for a Basic IR Display")] + public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced { public IrOutputPortController IrPort { get; private set; } public ushort IrPulseTime { get; set; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 63b7f580..eec0b0b7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -137,8 +137,14 @@ + + + + + + @@ -189,11 +195,6 @@ - - - - - @@ -277,7 +278,6 @@ - diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 72b4bc4c..c4cb58bd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -16,6 +16,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM.AirMedia { + [Description("Wrapper class for an AM-200 or AM-300")] public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IIROutputPorts, IComPorts { public AmX00 AirMedia { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs index 4a335c39..dd07f696 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/Dge100Controller.cs @@ -18,9 +18,7 @@ using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.DM.Endpoints.DGEs { - /// - /// Wrapper class for DGE-100 and DM-DGE-200-C - /// + [Description("Wrapper class for DGE-100")] public class Dge100Controller : CrestronGenericBaseDevice, IComPorts, IIROutputPorts, IHasBasicTriListWithSmartObject, ICec { private readonly Dge100 _dge; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs index d4539e53..31da45b2 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DmDge200CController.cs @@ -20,6 +20,7 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs /// /// Wrapper class for DGE-100 and DM-DGE-200-C /// + [Description("Wrapper class for DM-DGE-200-C")] public class DmDge200CController : Dge100Controller, IRoutingInputsOutputs { private readonly DmDge200C _dge; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs index 876880d1..b67b6584 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc100SController.cs @@ -11,7 +11,8 @@ 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-100-S")] public class DmRmc100SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { 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 9803b5b8..f33dd5be 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc150SController.cs @@ -11,7 +11,8 @@ 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 { 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 27187bcd..ed5bd378 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200CController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-200-C")] + public class DmRmc200CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmc200C _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs index c909098f..6633af15 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200S2Controller.cs @@ -12,7 +12,8 @@ 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-S2")] public class DmRmc200S2Controller : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs index 8d53964b..4ccae3e9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc200SController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-200-S")] + public class DmRmc200SController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmc200S _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs index 850f7458..052f0726 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4KScalerCController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, + /// + [Description("Wrapper Class for DM-RMC-4K-SCALER-C")] + public class DmRmc4kScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, IIROutputPorts, IComPorts, ICec, IRelayPorts { private readonly DmRmc4kScalerC _rmc; 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 b2762c97..92af7ce1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs @@ -6,7 +6,9 @@ using PepperDash.Essentials.Core; namespace PepperDash.Essentials.DM -{ +{ + + [Description("Wrapper Class for DM-RMC-4K-100-C-1G")] public class DmRmc4k100C1GController : DmHdBaseTControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs index e63ad5de..a7c83e35 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kScalerCDspController.cs @@ -12,7 +12,8 @@ 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-4K-SCALER-C-DSP")] public class DmRmc4kScalerCDspController : DmRmcControllerBase, IRoutingInputsOutputs, IBasicVolumeWithFeedback, IIROutputPorts, IComPorts, ICec, IRelayPorts { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs index 946613a8..b5aeaa41 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -7,7 +7,8 @@ using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM -{ +{ + [Description("Wrapper Class for DM-RMC-4K-Z-100-C")] public class DmRmc4kZ100CController : DmRmcX100CController { private readonly DmRmc4kz100C _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs index 81fcf69b..70afc5eb 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZScalerCController.cs @@ -11,6 +11,7 @@ using PepperDash.Core; namespace PepperDash.Essentials.DM { + [Description("Wrapper Class for DM-RMC-4K-Z-SCALER-C")] public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs index 8b2c1e98..d1f2daa1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerCController.cs @@ -12,8 +12,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// - /// - public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-SCALER-C")] + public class DmRmcScalerCController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmcScalerC _rmc; diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs index 1e014063..249a891b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerS2Controller.cs @@ -12,7 +12,8 @@ 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-SCALER-S2")] public class DmRmcScalerS2Controller : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs index ba0f1ad7..bbf64796 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcScalerSController.cs @@ -12,7 +12,8 @@ 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-SCALER-S")] public class DmRmcScalerSController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs index 6fa713ad..920c056f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcX100CController.cs @@ -11,8 +11,9 @@ namespace PepperDash.Essentials.DM /// /// Builds a controller for basic DM-RMCs (both 4K and non-4K) with Com and IR ports and no control functions /// - /// - public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, + /// + [Description("Wrapper Class for DM-RMC-4K-100-C & DM-RMC-100-C")] + public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { private readonly DmRmc100C _rmc; 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 cbe3ebcc..4a83454b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -16,7 +16,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - [Description("Wrapper class for DM-TX-200-C Endpoint")] + [Description("Wrapper class for DM-TX-200-C")] public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx200C2G Tx { get; private set; } 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 dcf5c068..c0336fc5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - [Description("Wrapper class for DM-TX-201-C Endpoint")] + [Description("Wrapper class for DM-TX-201-C")] public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx201C Tx { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs index 27e78256..9780edb9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -14,7 +14,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201S/F transmitters /// - [Description("Wrapper class for DM-TX-201-S/F Endpoint")] + [Description("Wrapper class for DM-TX-201-S/F")] public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx201S Tx { get; private set; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs index c47dc4ac..b74cb13e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -17,8 +17,9 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { - using eVst = DmTx401C.eSourceSelection; - + using eVst = DmTx401C.eSourceSelection; + + [Description("Wrapper class for DM-TX-401-C")] public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx401C Tx { get; private set; } 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 12889528..28e55a4a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -9,8 +9,9 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.DM { using eVst = eX02VideoSourceType; - using eAst = eX02AudioSourceType; - + using eAst = eX02AudioSourceType; + + [Description("Wrapper class for DM-TX-4K-100-C-1G")] public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs index 59d05bf4..26ca429e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -18,8 +18,9 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; - + using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + + [Description("Wrapper class for DM-TX-4K-202-C")] public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts { 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 e2bc74de..9ddaabcc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -18,8 +18,9 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; - + using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + + [Description("Wrapper class for DM-TX-4K-302-C")] public class DmTx4k302CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { 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 dbe1c103..15084479 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs @@ -21,6 +21,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// + [Description("Wrapper class for DM-TX-4K-Z-100-C")] public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback, IIROutputPorts, IComPorts, ICec { 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 b6fa24ee..ccc0417f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -20,6 +20,7 @@ namespace PepperDash.Essentials.DM using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + [Description("Wrapper class for DM-TX-4K-Z-302-C")] public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs index eb3172d9..16c0a2f0 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs @@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { + [Description("Wrapper class for CEN-ODT-C-POE")] public class CenOdtOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider { public CenOdtCPoe OccSensor { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 907e8461..6dd61721 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { + [Description("Wrapper class for Single Technology GLS Occupancy Sensors")] public class GlsOccupancySensorBaseController : CrestronGenericBridgeableBaseDevice, IOccupancyStatusProvider { public GlsOccupancySensorBase OccSensor { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index f7d9943a..26fec016 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -13,6 +13,7 @@ using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Devices.Common.Occupancy { + [Description("Wrapper class for Dual Technology GLS Occupancy Sensors")] public class GlsOdtOccupancySensorController : GlsOccupancySensorBaseController { public new GlsOdtCCn OccSensor { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index 8bf690a6..ec3f11e8 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -15,7 +15,8 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common { - public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower + [Description("Wrapper class for an IR Set Top Box")] + public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower { public IrOutputPortController IrPort { get; private set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 5d01ccc7..13e89040 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -14,9 +14,9 @@ using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common { + [Description("Wrapper class for an IR-Controlled AppleTV")] public class AppleTV : EssentialsBridgeableDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs { - public IrOutputPortController IrPort { get; private set; } public const string StandardDriverName = "Apple AppleTV-v2.ir"; public uint DisplayUiType { get { return DisplayUiConstants.TypeAppleTv; } } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs index 49f96c31..de848406 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/Roku.cs @@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Routing; namespace PepperDash.Essentials.Devices.Common -{ +{ + [Description("Wrapper class for an IR-Controlled Roku")] public class Roku2 : EssentialsDevice, IDPad, ITransport, IUiDisplayInfo, IRoutingOutputs { [Api] From b95c341fca8ed21086b89669ce5be48a911dbb0d Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 21 May 2020 12:05:25 -0500 Subject: [PATCH 14/52] Revised DmBladeChassisController ExecuteNumericSwitch method #207 --- .../Chassis/DmBladeChassisController.cs | 30 +------------------ 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 3f3eae6c..3094c7fd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -575,35 +575,7 @@ namespace PepperDash.Essentials.DM { public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType) { - Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType); - - var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail - var output = Convert.ToUInt32(outputSelector); - // Check to see if there's an off timer waiting on this and if so, cancel - var key = new PortNumberType(output, sigType); - if (input == 0) - { - StartOffTimer(key); - } - else - { - if (RouteOffTimers.ContainsKey(key)) - { - Debug.Console(2, this, "{0} cancelling route off due to new source", output); - RouteOffTimers[key].Stop(); - RouteOffTimers.Remove(key); - } - } - - - - var inCard = input == 0 ? null : Chassis.Inputs[input]; - var outCard = input == 0 ? null : Chassis.Outputs[output]; - - // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES - if ((sigType | eRoutingSignalType.Video) != eRoutingSignalType.Video) return; - Chassis.VideoEnter.BoolValue = true; - Chassis.Outputs[output].VideoOut = inCard; + ExecuteSwitch(inputSelector, outputSelector, sigType); } #endregion From 2a7311ba5087a77b32c39b6e5416269e4e1a0d17 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 21 May 2020 12:17:04 -0500 Subject: [PATCH 15/52] Revised DmChassisController ExecuteNumericSwitch method #207 --- .../Chassis/DmChassisController.cs | 120 +----------------- 1 file changed, 1 insertion(+), 119 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 536905d9..2d9a847f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -1098,125 +1098,7 @@ namespace PepperDash.Essentials.DM public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType) { - Debug.Console(2, this, "Making an awesome DM route from {0} to {1} {2}", inputSelector, outputSelector, sigType); - - var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail - var output = Convert.ToUInt32(outputSelector); - - var chassisSize = (uint)Chassis.NumberOfInputs; //need this to determine USB routing values 8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8 - //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16 - //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32 - - // Check to see if there's an off timer waiting on this and if so, cancel - var key = new PortNumberType(output, sigType); - if (input == 0) - { - StartOffTimer(key); - } - else - { - if (RouteOffTimers.ContainsKey(key)) - { - Debug.Console(2, this, "{0} cancelling route off due to new source", output); - RouteOffTimers[key].Stop(); - RouteOffTimers.Remove(key); - } - } - - var inCard = input == 0 ? null : Chassis.Inputs[input]; - var outCard = input == 0 ? null : Chassis.Outputs[output]; - - // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES - if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) - { - Chassis.VideoEnter.BoolValue = true; - Chassis.Outputs[output].VideoOut = inCard; - } - - if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - { - (Chassis as DmMDMnxn).AudioEnter.BoolValue = true; - Chassis.Outputs[output].AudioOut = inCard; - } - - if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) - { - //using base here because USB can be routed between 2 output cards or 2 input cards - DMInputOutputBase localdmCard; - - Debug.Console(2, this, "Executing USB Output switch.\r\n in:{0} output: {1}", input, output); - - if (input > chassisSize) - { - //wanting to route an output to an output. Subtract chassis size and get output, unless it's 8x8 - //need this to determine USB routing values - //8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8 - //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16 - //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32 - uint outputIndex; - - if (chassisSize == 8) - { - outputIndex = input - 16; - } - else - { - outputIndex = input - chassisSize; - } - localdmCard = Chassis.Outputs[outputIndex]; - } - else - { - localdmCard = inCard; - } - Chassis.USBEnter.BoolValue = true; - if (Chassis.Outputs[output] != null) - { - Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Outputs[input], localdmCard); - Chassis.Outputs[output].USBRoutedTo = localdmCard; - } - } - - if ((sigType & eRoutingSignalType.UsbInput) != eRoutingSignalType.UsbInput) return; - //using base here because USB can be routed between 2 output cards or 2 input cards - DMInputOutputBase dmCard; - - Debug.Console(2, this, "Executing USB Input switch.\r\n in:{0} output: {1}", input, output); - - if (output > chassisSize) - { - //wanting to route an input to an output. Subtract chassis size and get output, unless it's 8x8 - //need this to determine USB routing values - //8x8 -> 1-8 is inputs 1-8, 17-24 is outputs 1-8 - //16x16 1-16 is inputs 1-16, 17-32 is outputs 1-16 - //32x32 1-32 is inputs 1-32, 33-64 is outputs 1-32 - uint outputIndex; - - if (chassisSize == 8) - { - outputIndex = input - 16; - } - else - { - outputIndex = input - chassisSize; - } - dmCard = Chassis.Outputs[outputIndex]; - } - else - { - dmCard = Chassis.Inputs[input]; - } - - - - Chassis.USBEnter.BoolValue = true; - - if (Chassis.Inputs[output] == null) - { - return; - } - Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[output], dmCard); - Chassis.Inputs[output].USBRoutedTo = dmCard; + ExecuteSwitch(inputSelector, outputSelector, sigType); } #endregion From be97fe15daa5e2f2a02823305b3029ea65a97fe0 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 21 May 2020 12:30:26 -0500 Subject: [PATCH 16/52] Added IRoutingNumeric to DmpsRoutingController #207 --- .../Chassis/DmpsRoutingController.cs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 7d8ba747..32352b49 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -18,8 +18,8 @@ using PepperDash.Essentials.DM.Config; using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.DM -{ - public class DmpsRoutingController : EssentialsBridgeableDevice, IRouting, IHasFeedback +{ + public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumeric, IHasFeedback { public CrestronControlSystem Dmps { get; set; } public ISystemControl SystemControl { get; private set; } @@ -661,8 +661,6 @@ namespace PepperDash.Essentials.DM } } } - /// - /// void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args) { Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString()); @@ -724,10 +722,7 @@ namespace PepperDash.Essentials.DM { if (RouteOffTimers.ContainsKey(pnt)) return; - RouteOffTimers[pnt] = new CTimer(o => - { - ExecuteSwitch(0, pnt.Number, pnt.Type); - }, RouteOffTime); + RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(0, pnt.Number, pnt.Type), RouteOffTime); } #region IRouting Members @@ -809,6 +804,15 @@ namespace PepperDash.Essentials.DM } } - #endregion + #endregion + + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType) + { + ExecuteSwitch(inputSelector, outputSelector, sigType); + } + + #endregion } } \ No newline at end of file From aecb36e937e3ef6a6ce3b479aec60d3dd4ecccd2 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 21 May 2020 13:45:29 -0500 Subject: [PATCH 17/52] Added IRoutingNumeric to HdMdNxM4kEBridgeableController #207 --- .../Chassis/HdMdNxM4kEBridgeableController.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs index 87cc72cf..47f4c572 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs @@ -16,7 +16,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM.Chassis { [Description("Wrapper class for all HdMdNxM4E switchers")] - public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback + public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRoutingNumeric, IHasFeedback { private HdMdNxM _Chassis; private HdMd4x14kE _Chassis4x1; @@ -240,6 +240,15 @@ namespace PepperDash.Essentials.DM.Chassis #endregion + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) + { + ExecuteSwitch(inputSelector, outputSelector, signalType); + } + + #endregion + #endregion #region Bridge Linking @@ -389,6 +398,8 @@ namespace PepperDash.Essentials.DM.Chassis } #endregion - + + + } } \ No newline at end of file From e006a4616a9ab93d36cd8219ce562eade56a438b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 21 May 2020 16:02:36 -0500 Subject: [PATCH 18/52] Migrated Comm & IR Folder out of Config #208 --- .../Comm and IR/CecPortController.cs | 0 .../Comm and IR/ComPortController.cs | 0 .../Comm and IR/ComSpecJsonConverter.cs | 0 .../{Config => }/Comm and IR/CommFactory.cs | 0 .../Comm and IR/CommunicationExtras.cs | 0 .../Comm and IR/ConsoleCommMockDevice.cs | 0 .../{Config => }/Comm and IR/GenericComm.cs | 0 .../Comm and IR/GenericHttpClient.cs | 0 .../{Config => }/Comm and IR/IRPortHelper.cs | 0 .../PepperDash_Essentials_Core.csproj | 18 +++++++++--------- 10 files changed, 9 insertions(+), 9 deletions(-) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/CecPortController.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/ComPortController.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/ComSpecJsonConverter.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/CommFactory.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/CommunicationExtras.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/ConsoleCommMockDevice.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/GenericComm.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/GenericHttpClient.cs (100%) rename essentials-framework/Essentials Core/PepperDashEssentialsBase/{Config => }/Comm and IR/IRPortHelper.cs (100%) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CecPortController.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CecPortController.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CecPortController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComPortController.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComPortController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComSpecJsonConverter.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComSpecJsonConverter.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComSpecJsonConverter.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ComSpecJsonConverter.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommFactory.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommFactory.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommunicationExtras.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommunicationExtras.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/CommunicationExtras.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/CommunicationExtras.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ConsoleCommMockDevice.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/ConsoleCommMockDevice.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericHttpClient.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericHttpClient.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericHttpClient.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericHttpClient.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs similarity index 100% rename from essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs rename to essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/IRPortHelper.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 5b7fba6f..55a11a7a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -141,15 +141,15 @@ - - - - - - - - - + + + + + + + + + From 608a9068b9f92dd7f7aa66f152ecd7ff6c35ec3b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 22 May 2020 13:56:18 -0500 Subject: [PATCH 19/52] Updated JoinMetadata to add Description property Updated Hrxx0WirelessRemoteController to remove references to JoinMetadata #198 --- .../JoinMaps/JoinMapBase.cs | 21 +++++--- .../Remotes/Hrxx0WirelessRemoteController.cs | 54 +++++++++++-------- .../Routing/RoutingInterfaces.cs | 16 +++--- .../Chassis/DmBladeChassisController.cs | 21 ++++++-- .../Chassis/DmChassisController.cs | 11 +++- .../Chassis/DmpsRoutingController.cs | 22 ++++---- .../Chassis/HdMdNxM4kEBridgeableController.cs | 15 +++++- 7 files changed, 108 insertions(+), 52 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 31616a6d..8d50596e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; +using System.Linq; +using System.Runtime.InteropServices; using Crestron.SimplSharp.Reflection; using PepperDash.Core; @@ -363,8 +364,12 @@ namespace PepperDash.Essentials.Core /// /// A label for the join to better describe it's usage /// - [JsonProperty("label")] - public string Label { get; set; } + [Obsolete] + [JsonProperty("label")] + public string Label { get { return Description; } set { Description = value; } } + + [JsonProperty("description")] + public string Description { get; set; } /// /// Signal type(s) /// @@ -454,11 +459,13 @@ namespace PepperDash.Essentials.Core name = attribute.Name; Debug.Console(2, "JoinName Attribute value: {0}", name); return name; - } - } + } + } + + [AttributeUsage(AttributeTargets.All)] - public class JoinNameAttribute : Attribute + public class JoinNameAttribute : CAttribute { private string _Name; @@ -472,5 +479,5 @@ namespace PepperDash.Essentials.Core { get { return _Name; } } - } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs index c5f6d82c..cee8b3eb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs @@ -149,7 +149,7 @@ namespace PepperDash.Essentials.Core } #endregion - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, PepperDash.Essentials.Core.Bridges.EiscApiAdvanced bridge) + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new Hrxxx0WirelessRemoteControllerJoinMap(joinStart); @@ -161,33 +161,39 @@ namespace PepperDash.Essentials.Core bridge.AddJoinMap(Key, joinMap); //List ExcludedKeys = new List(); - - - - foreach (Feedback feedback in Feedbacks) + foreach (var feedback in Feedbacks) { - Feedback myFeedback = feedback; + var myFeedback = feedback; - var join = joinMap.Joins.FirstOrDefault(x => x.Value.Metadata.Label.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase)).Value; + var joinData = + joinMap.Joins.FirstOrDefault( + x => + x.Key.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase)); - if (join == null) continue; + if (string.IsNullOrEmpty((joinData.Key))) continue; + + var name = joinData.Key; + var join = joinData.Value; if (join.Metadata.JoinType == eJoinType.Digital) { - Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", join.Metadata.Label, join.JoinNumber); - BoolFeedback someFeedback = myFeedback as BoolFeedback; + Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", name, join.JoinNumber); + var someFeedback = myFeedback as BoolFeedback; + if(someFeedback == null) continue; someFeedback.LinkInputSig(trilist.BooleanInput[join.JoinNumber]); } if (join.Metadata.JoinType == eJoinType.Analog) { - Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", join.Metadata.Label, join.JoinNumber); - IntFeedback someFeedback = myFeedback as IntFeedback; + Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", name, join.JoinNumber); + var someFeedback = myFeedback as IntFeedback; + if (someFeedback == null) continue; someFeedback.LinkInputSig(trilist.UShortInput[join.JoinNumber]); } if (join.Metadata.JoinType == eJoinType.Serial) { - Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", join.Metadata.Label, join.JoinNumber); - StringFeedback someFeedback = myFeedback as StringFeedback; + Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", name, join.JoinNumber); + var someFeedback = myFeedback as StringFeedback; + if (someFeedback == null) continue; someFeedback.LinkInputSig(trilist.StringInput[join.JoinNumber]); } } @@ -201,13 +207,19 @@ namespace PepperDash.Essentials.Core for (uint i = 1; i <= _remote.Button.Count; i++) { Debug.Console(2, this, "Attempting to link join index {0}", i); - var join = joinMap.Joins.FirstOrDefault(o => o.Value.Metadata.Label.Equals(_remote.Button[i].Name.ToString(), StringComparison.InvariantCultureIgnoreCase)).Value; - if (join == null) - { - Debug.Console(2, this, "Join '{0}' is null", i); - continue; - } - Debug.Console(2, this, "Setting User Object for '{0}'", join.Metadata.Label); + var index = i; + var joinData = + joinMap.Joins.FirstOrDefault( + o => + o.Key.Equals(_remote.Button[index].Name.ToString(), + StringComparison.InvariantCultureIgnoreCase)); + + if (string.IsNullOrEmpty((joinData.Key))) continue; + + var join = joinData.Value; + var name = joinData.Key; + + Debug.Console(2, this, "Setting User Object for '{0}'", name); if (join.Metadata.JoinType == eJoinType.Digital) { _remote.Button[i].SetButtonAction((b) => trilist.BooleanInput[join.JoinNumber].BoolValue = b); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 3b288290..2c7d5b17 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -80,24 +80,26 @@ namespace PepperDash.Essentials.Core /// public interface IRouting : IRoutingInputsOutputs { - //void ClearRoute(object outputSelector); void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType); - } - - public interface ITxRouting : IRouting + } + + public interface IRoutingNumeric : IRouting + { + void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); + } + + public interface ITxRouting : IRoutingNumeric { IntFeedback VideoSourceNumericFeedback { get; } IntFeedback AudioSourceNumericFeedback { get; } - void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } /// /// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C) /// - public interface IRmcRouting : IRouting + public interface IRmcRouting : IRoutingNumeric { IntFeedback AudioVideoSourceNumericFeedback { get; } - void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 5e9c3151..3094c7fd 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -21,7 +21,8 @@ namespace PepperDash.Essentials.DM { /// Builds a controller for basic DM-RMCs with Com and IR ports and no control functions /// /// - public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback { + public class DmBladeChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric + { public DMChassisPropertiesConfig PropertiesConfig { get; set; } public Switch Chassis { get; private set; } @@ -563,14 +564,23 @@ namespace PepperDash.Essentials.DM { var outCard = input == 0 ? null : Chassis.Outputs[output]; // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES - if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) { - Chassis.VideoEnter.BoolValue = true; - Chassis.Outputs[output].VideoOut = inCard; - } + if ((sigType | eRoutingSignalType.Video) != eRoutingSignalType.Video) return; + Chassis.VideoEnter.BoolValue = true; + Chassis.Outputs[output].VideoOut = inCard; } #endregion + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType) + { + ExecuteSwitch(inputSelector, outputSelector, sigType); + } + + #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmBladeChassisControllerJoinMap(joinStart); @@ -808,6 +818,7 @@ namespace PepperDash.Essentials.DM { }); } } + } /* diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index b0d4682d..2d9a847f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -21,7 +21,7 @@ namespace PepperDash.Essentials.DM /// /// [Description("Wrapper class for all DM-MD chassis variants from 8x8 to 32x32")] - public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingInputsOutputs, IRouting, IHasFeedback + public class DmChassisController : CrestronGenericBridgeableBaseDevice, IDmSwitch, IRoutingNumeric { public DMChassisPropertiesConfig PropertiesConfig { get; set; } @@ -1094,6 +1094,15 @@ namespace PepperDash.Essentials.DM } #endregion + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType) + { + ExecuteSwitch(inputSelector, outputSelector, sigType); + } + + #endregion + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmChassisControllerJoinMap(joinStart); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 7d8ba747..32352b49 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -18,8 +18,8 @@ using PepperDash.Essentials.DM.Config; using Feedback = PepperDash.Essentials.Core.Feedback; namespace PepperDash.Essentials.DM -{ - public class DmpsRoutingController : EssentialsBridgeableDevice, IRouting, IHasFeedback +{ + public class DmpsRoutingController : EssentialsBridgeableDevice, IRoutingNumeric, IHasFeedback { public CrestronControlSystem Dmps { get; set; } public ISystemControl SystemControl { get; private set; } @@ -661,8 +661,6 @@ namespace PepperDash.Essentials.DM } } } - /// - /// void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args) { Debug.Console(2, this, "DMOutputChange Output: {0} EventId: {1}", args.Number, args.EventId.ToString()); @@ -724,10 +722,7 @@ namespace PepperDash.Essentials.DM { if (RouteOffTimers.ContainsKey(pnt)) return; - RouteOffTimers[pnt] = new CTimer(o => - { - ExecuteSwitch(0, pnt.Number, pnt.Type); - }, RouteOffTime); + RouteOffTimers[pnt] = new CTimer(o => ExecuteSwitch(0, pnt.Number, pnt.Type), RouteOffTime); } #region IRouting Members @@ -809,6 +804,15 @@ namespace PepperDash.Essentials.DM } } - #endregion + #endregion + + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType sigType) + { + ExecuteSwitch(inputSelector, outputSelector, sigType); + } + + #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs index 87cc72cf..47f4c572 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs @@ -16,7 +16,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM.Chassis { [Description("Wrapper class for all HdMdNxM4E switchers")] - public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRouting, IHasFeedback + public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IRoutingNumeric, IHasFeedback { private HdMdNxM _Chassis; private HdMd4x14kE _Chassis4x1; @@ -240,6 +240,15 @@ namespace PepperDash.Essentials.DM.Chassis #endregion + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType) + { + ExecuteSwitch(inputSelector, outputSelector, signalType); + } + + #endregion + #endregion #region Bridge Linking @@ -389,6 +398,8 @@ namespace PepperDash.Essentials.DM.Chassis } #endregion - + + + } } \ No newline at end of file From 2f1592bc62ab4d8a44d19f0c109d7843ffd42da1 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 22 May 2020 14:56:50 -0500 Subject: [PATCH 20/52] Added XML Comments, Obsolete Message, and backer field #214 --- .../JoinMaps/JoinMapBase.cs | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 8d50596e..676299e5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -346,8 +346,10 @@ namespace PepperDash.Essentials.Core /// /// Metadata describing the join /// - public class JoinMetadata - { + public class JoinMetadata + { + private string _description; + /// /// Join number (based on join offset value) /// @@ -362,14 +364,17 @@ namespace PepperDash.Essentials.Core public uint JoinSpan { get; set; } /// - /// A label for the join to better describe it's usage + /// A label for the join to better describe its usage /// - [Obsolete] + [Obsolete("Use Description instead")] [JsonProperty("label")] - public string Label { get { return Description; } set { Description = value; } } + public string Label { get { return _description; } set { _description = value; } } - [JsonProperty("description")] - public string Description { get; set; } + /// + /// A description for the join to better describe its usage + /// + [JsonProperty("description")] + public string Description { get { return _description; } set { _description = value; } } /// /// Signal type(s) /// From 305fe5c372f973db3130871e7514b531487a9891 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Thu, 28 May 2020 14:02:43 -0400 Subject: [PATCH 21/52] added check when adding sink device for if the device is actually a sink --- .../Routing/IRoutingInputsExtensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs index 4ff9f123..aeb08088 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs @@ -152,7 +152,8 @@ namespace PepperDash.Essentials.Core if (outputPortToUse == null) { // it's a sink device - routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort)); + if (destination is IRoutingSinkWithSwitching) + routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort)); } else if (destination is IRouting) { From 62fdd6a5723514fee3e183c46ad21cc9aa8025ce Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 28 May 2020 17:24:24 -0600 Subject: [PATCH 22/52] #219 changes ReleaseAndMakeRoute to IRoutingSinkNoSwitching removes check for IRoutingSinkNoSwitching interface in GetRouteToSource --- .../Routing/IRoutingInputsExtensions.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs index aeb08088..9c71bf2b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs @@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Core /// and then attempts a new Route and if sucessful, stores that RouteDescriptor /// in RouteDescriptorCollection.DefaultCollection /// - public static void ReleaseAndMakeRoute(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType) + public static void ReleaseAndMakeRoute(this IRoutingSinkNoSwitching destination, IRoutingOutputs source, eRoutingSignalType signalType) { destination.ReleaseRoute(); @@ -152,7 +152,6 @@ namespace PepperDash.Essentials.Core if (outputPortToUse == null) { // it's a sink device - if (destination is IRoutingSinkWithSwitching) routeTable.Routes.Add(new RouteSwitchDescriptor(goodInputPort)); } else if (destination is IRouting) From 8d2d45b5cefd188b08d5d3fc84275f00fbcd14bf Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Thu, 28 May 2020 19:37:45 -0400 Subject: [PATCH 23/52] adds IRoutingSink for readability and adds a protection in ExecuteRoutes if the device happens to be IRoutingSinkWithNoSwitching and IRouting like a codec might potentially be --- .../Routing/IRoutingInputsExtensions.cs | 28 ++- .../Routing/RoutingInterfaces.cs | 195 +++++++++--------- 2 files changed, 117 insertions(+), 106 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs index 9c71bf2b..e795018a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/IRoutingInputsExtensions.cs @@ -22,7 +22,7 @@ namespace PepperDash.Essentials.Core /// and then attempts a new Route and if sucessful, stores that RouteDescriptor /// in RouteDescriptorCollection.DefaultCollection /// - public static void ReleaseAndMakeRoute(this IRoutingSinkNoSwitching destination, IRoutingOutputs source, eRoutingSignalType signalType) + public static void ReleaseAndMakeRoute(this IRoutingSink destination, IRoutingOutputs source, eRoutingSignalType signalType) { destination.ReleaseRoute(); @@ -39,7 +39,7 @@ namespace PepperDash.Essentials.Core /// RouteDescriptorCollection.DefaultCollection /// /// - public static void ReleaseRoute(this IRoutingInputs destination) + public static void ReleaseRoute(this IRoutingSink destination) { var current = RouteDescriptorCollection.DefaultCollection.RemoveRouteDescriptor(destination); if (current != null) @@ -56,7 +56,7 @@ namespace PepperDash.Essentials.Core /// of an audio/video route are discovered a route descriptor is returned. If no route is /// discovered, then null is returned /// - public static RouteDescriptor GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType) + public static RouteDescriptor GetRouteToSource(this IRoutingSink destination, IRoutingOutputs source, eRoutingSignalType signalType) { var routeDescr = new RouteDescriptor(source, destination, signalType); // if it's a single signal type, find the route @@ -265,14 +265,20 @@ namespace PepperDash.Essentials.Core foreach (var route in Routes) { Debug.Console(2, "ExecuteRoutes: {0}", route.ToString()); - if (route.SwitchingDevice is IRoutingSinkWithSwitching) - (route.SwitchingDevice as IRoutingSinkWithSwitching).ExecuteSwitch(route.InputPort.Selector); - else if (route.SwitchingDevice is IRouting) - { - (route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType); - route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType); - Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue); - } + if (route.SwitchingDevice is IRoutingSink) + { + var device = route.SwitchingDevice as IRoutingSinkWithSwitching; + if (device == null) + continue; + + device.ExecuteSwitch(route.InputPort.Selector); + } + else if (route.SwitchingDevice is IRouting) + { + (route.SwitchingDevice as IRouting).ExecuteSwitch(route.InputPort.Selector, route.OutputPort.Selector, SignalType); + route.OutputPort.InUseTracker.AddUser(Destination, "destination-" + SignalType); + Debug.Console(2, "Output port {0} routing. Count={1}", route.OutputPort.Key, route.OutputPort.InUseTracker.InUseCountFeedback.UShortValue); + } } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 2c7d5b17..7ea8efd1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -1,86 +1,91 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DM; - -using PepperDash.Core; - - -namespace PepperDash.Essentials.Core -{ - - /// - /// The handler type for a Room's SourceInfoChange - /// - public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type); - - - //******************************************************************************************* - // Interfaces - - /// - /// For rooms with a single presentation source, change event - /// - public interface IHasCurrentSourceInfoChange - { - string CurrentSourceInfoKey { get; set; } - SourceListItem CurrentSourceInfo { get; set; } - event SourceInfoChangeHandler CurrentSourceChange; - } - - /// - /// Defines a class that has a collection of RoutingInputPorts - /// - public interface IRoutingInputs : IKeyed - { - RoutingPortCollection InputPorts { get; } - } - - /// - /// Defines a class that has a collection of RoutingOutputPorts - /// - - public interface IRoutingOutputs : IKeyed - { - RoutingPortCollection OutputPorts { get; } - } - - /// - /// For fixed-source endpoint devices - /// - public interface IRoutingSinkNoSwitching : IRoutingInputs, IHasCurrentSourceInfoChange - { - - } - - /// - /// Endpoint device like a display, that selects inputs - /// - public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching, IHasCurrentSourceInfoChange - { - //void ClearRoute(); - void ExecuteSwitch(object inputSelector); - } - - /// - /// For devices like RMCs, baluns, other devices with no switching. - /// - public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs - { - } - - /// - /// Defines a midpoint device as have internal routing. Any devices in the middle of the - /// signal chain, that do switching, must implement this for routing to work otherwise - /// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough - /// device. - /// - public interface IRouting : IRoutingInputsOutputs - { - void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType); +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DM; + +using PepperDash.Core; + + +namespace PepperDash.Essentials.Core +{ + + /// + /// The handler type for a Room's SourceInfoChange + /// + public delegate void SourceInfoChangeHandler(/*EssentialsRoomBase room,*/ SourceListItem info, ChangeType type); + + + //******************************************************************************************* + // Interfaces + + /// + /// For rooms with a single presentation source, change event + /// + public interface IHasCurrentSourceInfoChange + { + string CurrentSourceInfoKey { get; set; } + SourceListItem CurrentSourceInfo { get; set; } + event SourceInfoChangeHandler CurrentSourceChange; + } + + /// + /// Defines a class that has a collection of RoutingInputPorts + /// + public interface IRoutingInputs : IKeyed + { + RoutingPortCollection InputPorts { get; } + } + + /// + /// Defines a class that has a collection of RoutingOutputPorts + /// + + public interface IRoutingOutputs : IKeyed + { + RoutingPortCollection OutputPorts { get; } + } + + public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange + { + + } + + /// + /// For fixed-source endpoint devices + /// + public interface IRoutingSinkNoSwitching : IRoutingSink + { + + } + + /// + /// Endpoint device like a display, that selects inputs + /// + public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching + { + //void ClearRoute(); + void ExecuteSwitch(object inputSelector); + } + + /// + /// For devices like RMCs, baluns, other devices with no switching. + /// + public interface IRoutingInputsOutputs : IRoutingInputs, IRoutingOutputs + { + } + + /// + /// Defines a midpoint device as have internal routing. Any devices in the middle of the + /// signal chain, that do switching, must implement this for routing to work otherwise + /// the routing algorithm will treat the IRoutingInputsOutputs device as a passthrough + /// device. + /// + public interface IRouting : IRoutingInputsOutputs + { + void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType); } public interface IRoutingNumeric : IRouting @@ -88,10 +93,10 @@ namespace PepperDash.Essentials.Core void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); } - public interface ITxRouting : IRoutingNumeric - { - IntFeedback VideoSourceNumericFeedback { get; } - IntFeedback AudioSourceNumericFeedback { get; } + public interface ITxRouting : IRoutingNumeric + { + IntFeedback VideoSourceNumericFeedback { get; } + IntFeedback AudioSourceNumericFeedback { get; } } /// @@ -100,12 +105,12 @@ namespace PepperDash.Essentials.Core public interface IRmcRouting : IRoutingNumeric { IntFeedback AudioVideoSourceNumericFeedback { get; } - } - - /// - /// Defines an IRoutingOutputs devices as being a source - the start of the chain - /// - public interface IRoutingSource : IRoutingOutputs - { - } + } + + /// + /// Defines an IRoutingOutputs devices as being a source - the start of the chain + /// + public interface IRoutingSource : IRoutingOutputs + { + } } \ No newline at end of file From 4b663eea623c8ab38d9108ddbeae96afcb89adb9 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Thu, 28 May 2020 20:07:33 -0400 Subject: [PATCH 24/52] -IRoutingSinkWithSwitching now inherits directly from IRoutingSink -Marked IRoutingSinkNoSwitching as obsolete -Updated HulldeSpace, VTCRoom, DualDisplayRoom that were casting from IRoutingSinkNoSwitching to IRoutingSink --- .../Room/Types/EssentialsDualDisplayRoom.cs | 2 +- .../Room/Types/EssentialsHuddleSpaceRoom.cs | 6 +++--- PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs | 2 +- .../PepperDashEssentialsBase/Routing/RoutingInterfaces.cs | 6 +++++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs b/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs index 27539ebd..8113174a 100644 --- a/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsDualDisplayRoom.cs @@ -555,7 +555,7 @@ namespace PepperDash.Essentials /// bool DoRoute(SourceRouteListItem route, SourceListItem sourceItem, string sourceItemKey) { - IRoutingSinkNoSwitching dest = null; + IRoutingSink dest = null; if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) dest = DefaultAudioDevice as IRoutingSinkNoSwitching; diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs index b14e563d..cce91635 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleSpaceRoom.cs @@ -71,7 +71,7 @@ namespace PepperDash.Essentials public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; } public IRoutingSinkWithSwitching DefaultDisplay { get; private set; } - public IRoutingSinkNoSwitching DefaultAudioDevice { get; private set; } + public IRoutingSink DefaultAudioDevice { get; private set; } public IBasicVolumeControls DefaultVolumeControls { get; private set; } public bool ExcludeFromGlobalFunctions { get; set; } @@ -471,14 +471,14 @@ namespace PepperDash.Essentials /// bool DoRoute(SourceRouteListItem route) { - IRoutingSinkNoSwitching dest = null; + IRoutingSink dest = null; if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) dest = DefaultAudioDevice; else if (route.DestinationKey.Equals("$defaultDisplay", StringComparison.OrdinalIgnoreCase)) dest = DefaultDisplay; else - dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSinkNoSwitching; + dest = DeviceManager.GetDeviceForKey(route.DestinationKey) as IRoutingSink; if (dest == null) { diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index c5021526..3909316b 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -590,7 +590,7 @@ namespace PepperDash.Essentials /// bool DoRoute(SourceRouteListItem route) { - IRoutingSinkNoSwitching dest = null; + IRoutingSink dest = null; if (route.DestinationKey.Equals("$defaultaudio", StringComparison.OrdinalIgnoreCase)) dest = DefaultAudioDevice as IRoutingSinkNoSwitching; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs index 7ea8efd1..6c8d520b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingInterfaces.cs @@ -48,6 +48,9 @@ namespace PepperDash.Essentials.Core RoutingPortCollection OutputPorts { get; } } + /// + /// For fixed-source endpoint devices + /// public interface IRoutingSink : IRoutingInputs, IHasCurrentSourceInfoChange { @@ -56,6 +59,7 @@ namespace PepperDash.Essentials.Core /// /// For fixed-source endpoint devices /// + [Obsolete] public interface IRoutingSinkNoSwitching : IRoutingSink { @@ -64,7 +68,7 @@ namespace PepperDash.Essentials.Core /// /// Endpoint device like a display, that selects inputs /// - public interface IRoutingSinkWithSwitching : IRoutingSinkNoSwitching + public interface IRoutingSinkWithSwitching : IRoutingSink { //void ClearRoute(); void ExecuteSwitch(object inputSelector); From 5ea79ac94ed601ed63ca3399c5d6a5ad22c361f5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 3 Jun 2020 16:23:57 -0600 Subject: [PATCH 25/52] #227 removes unnecessary methods and fixes debug messages --- PepperDashEssentials/Bridges/EiscBridge.cs | 57 +--------------------- 1 file changed, 1 insertion(+), 56 deletions(-) diff --git a/PepperDashEssentials/Bridges/EiscBridge.cs b/PepperDashEssentials/Bridges/EiscBridge.cs index 4c999f20..984a1d9d 100644 --- a/PepperDashEssentials/Bridges/EiscBridge.cs +++ b/PepperDashEssentials/Bridges/EiscBridge.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.EthernetCommunication; using PepperDash.Core; -using PepperDash.Essentials.Bridges; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; @@ -15,15 +14,11 @@ namespace PepperDash.Essentials.Bridges { public EiscApiPropertiesConfig PropertiesConfig { get; private set; } - protected Dictionary JoinMaps { get; private set; } - public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } public EiscApi(DeviceConfig dc) : base(dc.Key) { - JoinMaps = new Dictionary(); - PropertiesConfig = dc.Properties.ToObject(); //PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); @@ -69,60 +64,10 @@ namespace PepperDash.Essentials.Bridges } Debug.Console(1, this, "Devices Linked."); - }); } - /// - /// Adds a join map - /// - /// - /// - public void AddJoinMap(string deviceKey, JoinMapBaseAdvanced joinMap) - { - if (!JoinMaps.ContainsKey(deviceKey)) - { - JoinMaps.Add(deviceKey, joinMap); - } - else - { - Debug.Console(2, this, "Unable to add join map with key '{0}'. Key already exists in JoinMaps dictionary", deviceKey); - } - } - - /// - /// Prints all the join maps on this bridge - /// - public void PrintJoinMaps() - { - Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X")); - - foreach (var joinMap in JoinMaps) - { - Debug.Console(0, "Join map for device '{0}':", joinMap.Key); - joinMap.Value.PrintJoinMapInfo(); - } - } - - /// - /// Prints the join map for a device by key - /// - /// - public void PrintJoinMapForDevice(string deviceKey) - { - var joinMap = JoinMaps[deviceKey]; - - if (joinMap == null) - { - Debug.Console(0, this, "Unable to find joinMap for device with key: '{0}'", deviceKey); - return; - } - - Debug.Console(0, "Join map for device '{0}' on EISC '{1}':", deviceKey, Key); - joinMap.PrintJoinMapInfo(); - } - /// /// Used for debugging to trigger an action based on a join number and type /// @@ -194,7 +139,7 @@ namespace PepperDash.Essentials.Bridges try { if (Debug.Level >= 1) - Debug.Console(1, this, "EiscApiAdvanced change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); + Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); var uo = args.Sig.UserObject; if (uo == null) return; From eab0d2b1d7659fcc6ff4197fc5bab9e917bb510b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 4 Jun 2020 12:21:47 -0500 Subject: [PATCH 26/52] Added HDMI Output Port to AirMediaController modified RoutingSignalTypes for each of the input ports to use AudioVideo when applicable Resolves #229 --- .../Essentials_DM/AirMedia/AirMediaController.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index c4cb58bd..1794bc3c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -52,13 +52,13 @@ namespace PepperDash.Essentials.DM.AirMedia InputPorts = new RoutingPortCollection(); OutputPorts = new RoutingPortCollection(); - InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.Audio | eRoutingSignalType.Video, + InputPorts.Add(new RoutingInputPort(DmPortName.Osd, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, new Action(SelectPinPointUxLandingPage), this)); - InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + InputPorts.Add(new RoutingInputPort(DmPortName.AirMediaIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Streaming, new Action(SelectAirMedia), this)); - InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)); InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video, @@ -66,10 +66,13 @@ namespace PepperDash.Essentials.DM.AirMedia if (AirMedia is Am300) { - InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + InputPorts.Add(new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.DmCat, new Action(SelectDmIn), this)); } + OutputPorts.Add(new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.AudioVideo, + eRoutingPortConnectionType.Hdmi, null, this)); + AirMedia.AirMedia.AirMediaChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(AirMedia_AirMediaChange); IsInSessionFeedback = new BoolFeedback( new Func(() => AirMedia.AirMedia.StatusFeedback.UShortValue == 0 )); From 9517eaa0b0c875151f7bbe37617afa7398a2b542 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 4 Jun 2020 15:23:20 -0500 Subject: [PATCH 27/52] Adds proper xml string to send to RemoteOccupancyInfo Resovles #226 --- ...lsHuddleSpaceFusionSystemControllerBase.cs | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index 1134f3e2..c964975d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -115,7 +115,10 @@ namespace PepperDash.Essentials.Core.Fusion // For use with occ sensor attached to a scheduling panel in Fusion protected FusionOccupancySensorAsset FusionOccSensor; - public BoolFeedback RoomIsOccupiedFeedback { get; private set; } + public BoolFeedback RoomIsOccupiedFeedback { get; private set; } + + private string _roomOccupancyRemoteString; + public StringFeedback RoomOccupancyRemoteStringFeedback { get; private set; } protected Func RoomIsOccupiedFeedbackFunc { @@ -1365,14 +1368,25 @@ namespace PepperDash.Essentials.Core.Fusion var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig); // Tie to method on occupancy object - //occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b)); + //occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b)); + + + RoomOccupancyRemoteStringFeedback = new StringFeedback(() => _roomOccupancyRemoteString); + Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig); + Room.RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange; + RoomOccupancyRemoteStringFeedback.LinkInputSig(occSensorAsset.RoomOccupancyInfo.InputSig); - - Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig); //} - } - - /// + } + + void RoomIsOccupiedFeedback_OutputChange(object sender, FeedbackEventArgs e) + { + _roomOccupancyRemoteString = e.BoolValue ? @"LocalOccupied" + : @"LocalUnoccupied"; + RoomOccupancyRemoteStringFeedback.FireUpdate(); + } + + /// /// Helper to get the number from the end of a device's key string /// /// -1 if no number matched From d68645ccb00d4a317d90ca5db30f34293e45eb17 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 4 Jun 2020 15:41:34 -0500 Subject: [PATCH 28/52] Changes to the way the XML is built --- .../EssentialsHuddleSpaceFusionSystemControllerBase.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs index c964975d..2fb9db12 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Fusion/EssentialsHuddleSpaceFusionSystemControllerBase.cs @@ -105,7 +105,9 @@ namespace PepperDash.Essentials.Core.Fusion // Default poll time is 5 min unless overridden by config value public long SchedulePollInterval = 300000; - public long PushNotificationTimeout = 5000; + public long PushNotificationTimeout = 5000; + + private const string RemoteOccupancyXml = "Local{0}"; protected Dictionary FusionStaticAssets; @@ -1381,8 +1383,7 @@ namespace PepperDash.Essentials.Core.Fusion void RoomIsOccupiedFeedback_OutputChange(object sender, FeedbackEventArgs e) { - _roomOccupancyRemoteString = e.BoolValue ? @"LocalOccupied" - : @"LocalUnoccupied"; + _roomOccupancyRemoteString = String.Format(RemoteOccupancyXml, e.BoolValue ? "Occupied" : "Unoccupied"); RoomOccupancyRemoteStringFeedback.FireUpdate(); } From ce513ac086bf4d94c3aa2868abd04b836984927f Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 5 Jun 2020 14:55:21 -0500 Subject: [PATCH 29/52] Fixed issue with HdMdNxM4kEBridgeableController related to duplicate joinMap entry Resolves #232 --- .../Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs | 4 ---- .../Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs | 3 ++- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs index a8a6497b..6e5efd6e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/HdMdNxM4kEControllerJoinMap.cs @@ -17,10 +17,6 @@ namespace PepperDash.Essentials.Core.Bridges public JoinDataComplete EnableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, new JoinMetadata() { Label = "Enable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - [JoinName("DisableAutoRoute")] - public JoinDataComplete DisableAutoRoute = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 }, - new JoinMetadata() { Label = "Disable Automatic Routing on 4x1 Switchers", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital }); - [JoinName("InputName")] public JoinDataComplete InputName = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 8 }, new JoinMetadata() { Label = "Device Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs index 47f4c572..f1ed6d5b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs @@ -269,8 +269,9 @@ namespace PepperDash.Essentials.DM.Chassis if (_Chassis4x1 != null) { + trilist.SetSigTrueAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOn()); + trilist.SetSigFalseAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOff()); AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkInputSig(trilist.BooleanInput[joinMap.EnableAutoRoute.JoinNumber]); - AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableAutoRoute.JoinNumber]); } for (uint i = 1; i <= _Chassis.NumberOfInputs; i++) From d34177482e1d32e00915b2f2a40b712b134c6d57 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 9 Jun 2020 10:47:19 -0500 Subject: [PATCH 30/52] Added IRoutingNumeric implementation to AirMediaController Resolves #238 --- .../AirMedia/AirMediaController.cs | 37 +++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 1794bc3c..2cefbd8c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -17,7 +17,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.DM.AirMedia { [Description("Wrapper class for an AM-200 or AM-300")] - public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingInputsOutputs, IIROutputPorts, IComPorts + public class AirMediaController : CrestronGenericBridgeableBaseDevice, IRoutingNumeric, IIROutputPorts, IComPorts { public AmX00 AirMedia { get; private set; } @@ -41,7 +41,7 @@ namespace PepperDash.Essentials.DM.AirMedia public BoolFeedback AutomaticInputRoutingEnabledFeedback { get; private set; } public AirMediaController(string key, string name, AmX00 device, DeviceConfig dc, AirMediaPropertiesConfig props) - :base(key, name, device) + : base(key, name, device) { AirMedia = device; @@ -61,7 +61,7 @@ namespace PepperDash.Essentials.DM.AirMedia InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.Hdmi, new Action(SelectHdmiIn), this)); - InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.Video, + InputPorts.Add(new RoutingInputPort(DmPortName.AirBoardIn, eRoutingSignalType.AudioVideo, eRoutingPortConnectionType.None, new Action(SelectAirboardIn), this)); if (AirMedia is Am300) @@ -75,7 +75,7 @@ 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 )); + 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)); @@ -206,7 +206,7 @@ namespace PepperDash.Essentials.DM.AirMedia /// public void SelectDmIn() { - AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.HDMI; + AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM; } /// @@ -214,7 +214,7 @@ namespace PepperDash.Essentials.DM.AirMedia /// public void SelectHdmiIn() { - AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.DM; + AirMedia.DisplayControl.VideoOut = AmX00DisplayControl.eAirMediaX00VideoSource.HDMI; } public void SelectAirboardIn() @@ -263,6 +263,29 @@ namespace PepperDash.Essentials.DM.AirMedia #endregion + + #region IRoutingNumeric Members + + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType signalType) + { + + if ((signalType & eRoutingSignalType.Video) == eRoutingSignalType.Video) + AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource)input; + } + + #endregion + + #region IRouting Members + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + Debug.Console(2, this, "Input Selector = {0}", inputSelector.ToString()); + var handler = inputSelector as Action; + if (handler == null) return; + handler(); + } + + #endregion } public class AirMediaControllerFactory : EssentialsDeviceFactory @@ -286,7 +309,7 @@ namespace PepperDash.Essentials.DM.AirMedia amDevice = new Crestron.SimplSharpPro.DM.AirMedia.Am300(props.Control.IpIdInt, Global.ControlSystem); return new AirMediaController(dc.Key, dc.Name, amDevice, dc, props); - + } } } \ No newline at end of file From 7fa3031cfa08a22e1327411e5aafa197946195dc Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 9 Jun 2020 10:59:57 -0500 Subject: [PATCH 31/52] Added chack for enum presence in ExecuteNumericSwitch --- .../Essentials_DM/AirMedia/AirMediaController.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 2cefbd8c..0d3b0237 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -268,9 +268,9 @@ namespace PepperDash.Essentials.DM.AirMedia public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType signalType) { - - if ((signalType & eRoutingSignalType.Video) == eRoutingSignalType.Video) - AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource)input; + if ((signalType & eRoutingSignalType.Video) != eRoutingSignalType.Video) return; + if (Enum.IsDefined(typeof (AmX00DisplayControl.eAirMediaX00VideoSource), input)) + AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource) input; } #endregion From 9c4e4c7976775494c5ce1e90f55fde8f519dc34a Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 9 Jun 2020 14:53:47 -0500 Subject: [PATCH 32/52] Added debug text to ExecuteNumericSwitch --- .../Essentials_DM/AirMedia/AirMediaController.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 0d3b0237..0115465a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -269,8 +269,12 @@ namespace PepperDash.Essentials.DM.AirMedia public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType signalType) { if ((signalType & eRoutingSignalType.Video) != eRoutingSignalType.Video) return; - if (Enum.IsDefined(typeof (AmX00DisplayControl.eAirMediaX00VideoSource), input)) - AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource) input; + if (!Enum.IsDefined(typeof (AmX00DisplayControl.eAirMediaX00VideoSource), input)) + { + Debug.Console(2, this, "Invalid Video Source Index : {0}", input); + return; + } + AirMedia.DisplayControl.VideoOut = (AmX00DisplayControl.eAirMediaX00VideoSource) input; } #endregion From 0465a3b9a6de223865814fdd5fee51c5c3bcc421 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Wed, 10 Jun 2020 14:42:05 -0400 Subject: [PATCH 33/52] Fixes name in factory for dmrmc4kzscalerc --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 648909fc..94e2326c 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -307,7 +307,7 @@ namespace PepperDash.Essentials.DM TypeNames = new List { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp", - "dmrmc4kz100c", "dmrmckzscalerc" }; + "dmrmc4kz100c", "dmrmc4kzscalerc" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) From ffbba24b5a24750e51393eb4c287dab2636006a8 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 10 Jun 2020 15:00:09 -0600 Subject: [PATCH 34/52] Updates to PD.Core 1.0.37. Adds IStreamDebugging to ComPortController and adds console command to set levels --- .../Config/Comm and IR/ComPortController.cs | 19 +++++- .../Devices/DeviceManager.cs | 58 +++++++++++++++++++ essentials-framework/pepperdashcore-builds | 2 +- 3 files changed, 76 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs index 3fbfb43d..ddb578d7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/ComPortController.cs @@ -11,8 +11,10 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core { - public class ComPortController : Device, IBasicCommunication + public class ComPortController : Device, IBasicCommunicationWithStreamDebugging { + public CommunicationStreamDebugging StreamDebugging { get; private set; } + public event EventHandler BytesReceived; public event EventHandler TextReceived; @@ -24,6 +26,8 @@ namespace PepperDash.Essentials.Core public ComPortController(string key, Func postActivationFunc, ComPort.ComPortSpec spec, EssentialsControlPropertiesConfig config) : base(key) { + StreamDebugging = new CommunicationStreamDebugging(key); + Spec = spec; AddPostActivationAction(() => @@ -91,7 +95,12 @@ namespace PepperDash.Essentials.Core } var textHandler = TextReceived; if (textHandler != null) + { + if (StreamDebugging.RxStreamDebuggingIsEnabled) + Debug.Console(0, this, "Recevied: '{0}'", s); + textHandler(this, new GenericCommMethodReceiveTextArgs(s)); + } } public override bool Deactivate() @@ -105,7 +114,10 @@ namespace PepperDash.Essentials.Core { if (Port == null) return; - Port.Send(text); + + if (StreamDebugging.TxStreamDebuggingIsEnabled) + Debug.Console(0, this, "Sending {0} characters of text: '{1}'", text.Length, text); + Port.Send(text); } public void SendBytes(byte[] bytes) @@ -113,6 +125,9 @@ namespace PepperDash.Essentials.Core if (Port == null) return; var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length); + if (StreamDebugging.TxStreamDebuggingIsEnabled) + Debug.Console(0, this, "Sending {0} bytes: '{1}'", bytes.Length, ComTextHelper.GetEscapedText(bytes)); + Port.Send(text); } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index 01563db7..aae5427c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -43,6 +43,8 @@ namespace PepperDash.Essentials.Core CrestronConsole.AddNewConsoleCommand(s => CrestronConsole.ConsoleCommandResponse(DeviceJsonApi.GetApiMethods(s)), "apimethods", "", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(SimulateComReceiveOnDevice, "devsimreceive", "Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator); + + CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator); } /// @@ -299,5 +301,61 @@ namespace PepperDash.Essentials.Core } com.SimulateReceive(match.Groups[2].Value); } + + /// + /// Attempts to set the debug level of a device + /// + /// + public static void SetDeviceStreamDebugging(string s) + { + var args = s.Split(' '); + + var deviceKey = args[0]; + var setting = args[1]; + var timeout = args[2]; + + var device = GetDeviceForKey(deviceKey) as IStreamDebugging; + + if (device == null) + { + Debug.Console(0, "Unable to get device with key: {0}", deviceKey); + return; + } + else + { + eStreamDebuggingSetting debugSetting = eStreamDebuggingSetting.Off; + + try + { + debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true); + } + catch + { + Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both"); + return; + } + + if (!string.IsNullOrEmpty(timeout)) + { + try + { + var min = Convert.ToUInt32(timeout); + + device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min); + + } + catch (Exception e) + { + Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes"); + return; + } + } + else + { + device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting); + } + + } + } } } \ No newline at end of file diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 15206840..974d2f47 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5 +Subproject commit 974d2f473c06b2c90b18c06e0f758ca47d466be8 From 1b6669d4efe92dbed791587cb77b50f030ad268a Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 10 Jun 2020 15:04:08 -0600 Subject: [PATCH 35/52] Adds more helpful debug output --- .../PepperDashEssentialsBase/Devices/DeviceManager.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index aae5427c..a1dcba05 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -342,17 +342,19 @@ 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); } catch (Exception e) { - Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes"); + Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e); return; } } else { device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting); + Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting); } } From 625c8700729bbfb13506935709a1cc415f25bf2a Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 10 Jun 2020 15:24:20 -0600 Subject: [PATCH 36/52] merges latest development and updates to PD.Core 1.0.37 again. Adds concole command and method to disable stream debugging on all devices --- .../Devices/DeviceManager.cs | 19 +- .../Display/BasicIrDisplay.cs | 466 +++++++++--------- .../PepperDash_Essentials_Core.csproj | 2 +- 3 files changed, 252 insertions(+), 235 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index a1dcba05..b101b6f1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -45,7 +45,8 @@ namespace PepperDash.Essentials.Core "Simulates incoming data on a com device", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => SetDeviceStreamDebugging(s), "setdevicestreamdebug", "set comm debug [deviceKey] [off/rx/tx/both] ([minutes])", ConsoleAccessLevelEnum.AccessOperator); - } + CrestronConsole.AddNewConsoleCommand(s => DisableAllDeviceStreamDebugging(), "disableallstreamdebug", "disables stream debugging on all devices", ConsoleAccessLevelEnum.AccessOperator); + } /// /// Calls activate steps on all Device class items @@ -359,5 +360,21 @@ namespace PepperDash.Essentials.Core } } + + /// + /// Sets stream debugging settings to off for all devices + /// + public static void DisableAllDeviceStreamDebugging() + { + foreach (var device in AllDevices) + { + var streamDevice = device as IStreamDebugging; + + if (streamDevice != null) + { + streamDevice.StreamDebugging.SetDebuggingWithDefaultTimeout(eStreamDebuggingSetting.Off); + } + } + } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs index 707a8fb8..f06c8380 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/BasicIrDisplay.cs @@ -1,236 +1,236 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Routing; - -namespace PepperDash.Essentials.Core +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Routing; + +namespace PepperDash.Essentials.Core { [Description("Wrapper class for a Basic IR Display")] - public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced - { - public IrOutputPortController IrPort { get; private set; } - public ushort IrPulseTime { get; set; } - - protected override Func PowerIsOnFeedbackFunc - { - get { return () => _PowerIsOn; } - } - protected override Func IsCoolingDownFeedbackFunc - { - get { return () => _IsCoolingDown; } - } - protected override Func IsWarmingUpFeedbackFunc - { - get { return () => _IsWarmingUp; } - } - - bool _PowerIsOn; - bool _IsWarmingUp; - bool _IsCoolingDown; - - public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath) - : base(key, name) - { - IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); - DeviceManager.AddDevice(IrPort); - - PowerIsOnFeedback.OutputChange += (o, a) => { - Debug.Console(2, this, "Power on={0}", _PowerIsOn); - if (_PowerIsOn) StartWarmingTimer(); - else StartCoolingTimer(); - }; - IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); - IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); - - InputPorts.AddRange(new RoutingPortCollection - { - new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false), - new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false), - new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false), - new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false), - new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false), - new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false), - new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false), - }); - } - - public void Hdmi1() - { - IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime); - } - - public void Hdmi2() - { - IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime); - } - - public void Hdmi3() - { - IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime); - } - - public void Hdmi4() - { - IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime); - } - - public void Component1() - { - IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime); - } - - public void Video1() - { - IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime); - } - - public void Antenna() - { - IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime); - } - - #region IPower Members - - public override void PowerOn() - { - IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); - _PowerIsOn = true; - PowerIsOnFeedback.FireUpdate(); - } - - public override void PowerOff() - { - _PowerIsOn = false; - PowerIsOnFeedback.FireUpdate(); - IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); - } - - public override void PowerToggle() - { - _PowerIsOn = false; - PowerIsOnFeedback.FireUpdate(); - IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); - } - - #endregion - - #region IBasicVolumeControls Members - - public void VolumeUp(bool pressRelease) - { - IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease); - } - - public void VolumeDown(bool pressRelease) - { - IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease); - } - - public void MuteToggle() - { - IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200); - } - - #endregion - - void StartWarmingTimer() - { - _IsWarmingUp = true; - IsWarmingUpFeedback.FireUpdate(); - new CTimer(o => { - _IsWarmingUp = false; - IsWarmingUpFeedback.FireUpdate(); - }, 10000); - } - - void StartCoolingTimer() - { - _IsCoolingDown = true; - IsCoolingDownFeedback.FireUpdate(); - new CTimer(o => - { - _IsCoolingDown = false; - IsCoolingDownFeedback.FireUpdate(); - }, 7000); - } - - #region IRoutingSink Members - - /// - /// Typically called by the discovery routing algorithm. - /// - /// A delegate containing the input selector method to call - public override void ExecuteSwitch(object inputSelector) - { - Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString()); - - Action finishSwitch = () => - { - var action = inputSelector as Action; - if (action != null) - action(); - }; - - if (!PowerIsOnFeedback.BoolValue) - { - PowerOn(); - EventHandler oneTimer = null; - oneTimer = (o, a) => - { - if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming - IsWarmingUpFeedback.OutputChange -= oneTimer; - finishSwitch(); - }; - IsWarmingUpFeedback.OutputChange += oneTimer; - } - else // Do it! - finishSwitch(); - } - - #endregion - - public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); - } - } - - public class BasicIrDisplayFactory : EssentialsDeviceFactory - { - public BasicIrDisplayFactory() - { - TypeNames = new List() { "basicirdisplay" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device"); - var ir = IRPortHelper.GetIrPort(dc.Properties); - if (ir != null) - { - var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName); - display.IrPulseTime = 200; // Set default pulse time for IR commands. - return display; - } - - return null; - } - } - + public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced + { + public IrOutputPortController IrPort { get; private set; } + public ushort IrPulseTime { get; set; } + + protected override Func PowerIsOnFeedbackFunc + { + get { return () => _PowerIsOn; } + } + protected override Func IsCoolingDownFeedbackFunc + { + get { return () => _IsCoolingDown; } + } + protected override Func IsWarmingUpFeedbackFunc + { + get { return () => _IsWarmingUp; } + } + + bool _PowerIsOn; + bool _IsWarmingUp; + bool _IsCoolingDown; + + public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath) + : base(key, name) + { + IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); + DeviceManager.AddDevice(IrPort); + + PowerIsOnFeedback.OutputChange += (o, a) => { + Debug.Console(2, this, "Power on={0}", _PowerIsOn); + if (_PowerIsOn) StartWarmingTimer(); + else StartCoolingTimer(); + }; + IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); + IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); + + InputPorts.AddRange(new RoutingPortCollection + { + new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false), + new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false), + new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false), + new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false), + new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false), + new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false), + new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false), + }); + } + + public void Hdmi1() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime); + } + + public void Hdmi2() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime); + } + + public void Hdmi3() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime); + } + + public void Hdmi4() + { + IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime); + } + + public void Component1() + { + IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime); + } + + public void Video1() + { + IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime); + } + + public void Antenna() + { + IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime); + } + + #region IPower Members + + public override void PowerOn() + { + IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); + _PowerIsOn = true; + PowerIsOnFeedback.FireUpdate(); + } + + public override void PowerOff() + { + _PowerIsOn = false; + PowerIsOnFeedback.FireUpdate(); + IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); + } + + public override void PowerToggle() + { + _PowerIsOn = false; + PowerIsOnFeedback.FireUpdate(); + IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); + } + + #endregion + + #region IBasicVolumeControls Members + + public void VolumeUp(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease); + } + + public void VolumeDown(bool pressRelease) + { + IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease); + } + + public void MuteToggle() + { + IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200); + } + + #endregion + + void StartWarmingTimer() + { + _IsWarmingUp = true; + IsWarmingUpFeedback.FireUpdate(); + new CTimer(o => { + _IsWarmingUp = false; + IsWarmingUpFeedback.FireUpdate(); + }, 10000); + } + + void StartCoolingTimer() + { + _IsCoolingDown = true; + IsCoolingDownFeedback.FireUpdate(); + new CTimer(o => + { + _IsCoolingDown = false; + IsCoolingDownFeedback.FireUpdate(); + }, 7000); + } + + #region IRoutingSink Members + + /// + /// Typically called by the discovery routing algorithm. + /// + /// A delegate containing the input selector method to call + public override void ExecuteSwitch(object inputSelector) + { + Debug.Console(2, this, "Switching to input '{0}'", (inputSelector as Action).ToString()); + + Action finishSwitch = () => + { + var action = inputSelector as Action; + if (action != null) + action(); + }; + + if (!PowerIsOnFeedback.BoolValue) + { + PowerOn(); + EventHandler oneTimer = null; + oneTimer = (o, a) => + { + if (IsWarmingUpFeedback.BoolValue) return; // Only catch done warming + IsWarmingUpFeedback.OutputChange -= oneTimer; + finishSwitch(); + }; + IsWarmingUpFeedback.OutputChange += oneTimer; + } + else // Do it! + finishSwitch(); + } + + #endregion + + public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); + } + } + + public class BasicIrDisplayFactory : EssentialsDeviceFactory + { + public BasicIrDisplayFactory() + { + TypeNames = new List() { "basicirdisplay" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new BasicIrDisplay Device"); + var ir = IRPortHelper.GetIrPort(dc.Properties); + if (ir != null) + { + var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName); + display.IrPulseTime = 200; // Set default pulse time for IR commands. + return display; + } + + return null; + } + } + } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 55a11a7a..153b6ad5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -64,7 +64,7 @@ False - ..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll + ..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll False From a67b435565fbecdcd12b683dc46908bdb410dca7 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 10 Jun 2020 13:34:34 -0600 Subject: [PATCH 37/52] fix DM 2-Series chassis RX build dict --- .../Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs | 12 ++++++------ essentials-framework/pepperdashcore-builds | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) 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 94e2326c..a0971c52 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -173,22 +173,22 @@ namespace PepperDash.Essentials.DM {"dmrmcscalers", (k, n,i, d) => new DmRmcScalerSController(k, n, new DmRmcScalerS(i,d))}, { "dmrmcscalers2", - (k, n,i, d) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(d)) + (k, n,i, d) => new DmRmcScalerS2Controller(k, n, new DmRmcScalerS2(i, d)) }, { "dmrmc4kscalerc", - (k, n,i, d) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(d)) + (k, n,i, d) => new DmRmc4kScalerCController(k, n, new DmRmc4kScalerC(i, d)) }, { "dmrmc4kscalercdsp", - (k, n,i, d) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(d)) + (k, n,i, d) => new DmRmc4kScalerCDspController(k, n, new DmRmc4kScalerCDsp(i, d)) }, { "dmrmc4kzscalerc", - (k, n,i, d) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(d)) + (k, n,i, d) => new DmRmc4kZScalerCController(k, n, new DmRmc4kzScalerC(i, d)) }, - {"hdbasetrx", (k,n,i,d) => new HDBaseTRxController(k,n, new HDRx3CB(d))}, - {"dmrmc4k100c1g", (k,n,i,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(d))} + {"hdbasetrx", (k,n,i,d) => new HDBaseTRxController(k,n, new HDRx3CB(i, d))}, + {"dmrmc4k100c1g", (k,n,i,d) => new DmRmc4k100C1GController(k,n, new DmRmc4K100C1G(i, d))} }; } /// diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 974d2f47..15206840 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 974d2f473c06b2c90b18c06e0f758ca47d466be8 +Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5 From c5ad32184224a0beed4873059f7bc7a3f4c6a60d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 10 Jun 2020 16:34:28 -0600 Subject: [PATCH 38/52] fixed submodule commit issue --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 15206840..974d2f47 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 15206840b3e6338f695e4ffba634a72e51ea1be5 +Subproject commit 974d2f473c06b2c90b18c06e0f758ca47d466be8 From b89112bec15193bee10440b66c8fe60b5a9ebf30 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Thu, 11 Jun 2020 21:29:59 -0400 Subject: [PATCH 39/52] Sets preventRegistration to true for dmTx4k100c1g transmitter type. Otherwise device fails and returns without linking up com port. --- .../Endpoints/Transmitters/DmTx4k100Controller.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 28a05e31..d2a9f7bc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -68,8 +68,9 @@ namespace PepperDash.Essentials.DM // Set Ports for CEC HdmiIn.Port = Tx; - } + PreventRegistration = true; + } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { From 26bd0d624eaff7ddc3146605ead0e539cf581fa3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 12 Jun 2020 08:18:56 -0600 Subject: [PATCH 40/52] fixes issue with optional timeout parameter --- .../Devices/DeviceManager.cs | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs index b101b6f1..8cc0e95c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/DeviceManager.cs @@ -313,7 +313,13 @@ namespace PepperDash.Essentials.Core var deviceKey = args[0]; var setting = args[1]; - var timeout = args[2]; + + var timeout= String.Empty; + + if (args.Length >= 3) + { + timeout = args[2]; + } var device = GetDeviceForKey(deviceKey) as IStreamDebugging; @@ -322,42 +328,38 @@ namespace PepperDash.Essentials.Core Debug.Console(0, "Unable to get device with key: {0}", deviceKey); return; } - else - { - eStreamDebuggingSetting debugSetting = eStreamDebuggingSetting.Off; + eStreamDebuggingSetting debugSetting; + + try + { + debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true); + } + catch + { + Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both"); + return; + } + + if (!string.IsNullOrEmpty(timeout)) + { try { - debugSetting = (eStreamDebuggingSetting)Enum.Parse(typeof(eStreamDebuggingSetting), setting, true); - } - catch - { - Debug.Console(0, "Unable to convert setting value. Please use off/rx/tx/both"); - return; - } + var min = Convert.ToUInt32(timeout); - if (!string.IsNullOrEmpty(timeout)) - { - try - { - var min = Convert.ToUInt32(timeout); + device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min); + Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min); - device.StreamDebugging.SetDebuggingWithSpecificTimeout(debugSetting, min); - Debug.Console(0, "Device: '{0}' debug level set to {1) for {2} minutes", deviceKey, debugSetting, min); - - } - catch (Exception e) - { - Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e); - return; - } } - else + catch (Exception e) { - device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting); - Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting); + Debug.Console(0, "Unable to convert minutes or settings value. Please use an integer value for minutes. Errro: {0}", e); } - + } + else + { + device.StreamDebugging.SetDebuggingWithDefaultTimeout(debugSetting); + Debug.Console(0, "Device: '{0}' debug level set to {1) for default time (30 minutes)", deviceKey, debugSetting); } } From 2749fdc2e9cd4eb97abf522b76c4fe57b4adf69c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 17 Jun 2020 12:10:12 -0600 Subject: [PATCH 41/52] update workflows for name change --- .github/scripts/GenerateVersionNumber.ps1 | 4 ++-- .github/workflows/docker.yml | 8 ++++---- .github/workflows/master.yml | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index d9406eea..75a18d37 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -1,4 +1,4 @@ -$latestVersions = $(git tag --merged origin/master) +$latestVersions = $(git tag --merged origin/main) $latestVersion = [version]"0.0.0" Foreach ($version in $latestVersions) { Write-Host $version @@ -18,7 +18,7 @@ $newVersion = [version]$latestVersion $phase = "" $newVersionString = "" switch -regex ($Env:GITHUB_REF) { - '^refs\/heads\/master*.' { + '^refs\/heads\/main*.' { $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build } '^refs\/heads\/feature\/*.' { diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index af91840c..3eb3e42e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -18,8 +18,8 @@ env: VERSION: 0.0.0-buildtype-buildnumber # Defaults to debug for build type BUILD_TYPE: Debug - # Defaults to master as the release branch. Change as necessary - RELEASE_BRANCH: master + # Defaults to main as the release branch. Change as necessary + RELEASE_BRANCH: main jobs: Build_Project: runs-on: windows-latest @@ -189,11 +189,11 @@ jobs: run: git push --tags origin - name: Check Directory run: Get-ChildItem ./ - # This step only runs if the branch is master or release/ runs and pushes the build to the public build repo + # This step only runs if the branch is main or release/ runs and pushes the build to the public build repo Public_Push_Output: needs: Build_Project runs-on: windows-latest - if: contains(github.ref, 'master') || contains(github.ref, '/release/') + if: contains(github.ref, 'main') || contains(github.ref, '/release/') steps: # Checkout the repo - name: check Github ref diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a928d031..7bbbd646 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -1,11 +1,11 @@ -name: Master Build using Docker +name: main Build using Docker on: release: types: - created branches: - - master + - main env: # solution path doesn't need slashes unless there it is multiple folders deep # solution name does not include extension. .sln is assumed @@ -15,8 +15,8 @@ env: VERSION: 0.0.0-buildtype-buildnumber # Defaults to debug for build type BUILD_TYPE: Release - # Defaults to master as the release branch. Change as necessary - RELEASE_BRANCH: master + # Defaults to main as the release branch. Change as necessary + RELEASE_BRANCH: main jobs: Build_Project: runs-on: windows-latest @@ -114,8 +114,8 @@ jobs: Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version # Checkout/Create the branch - - name: Checkout Master branch - run: git checkout master + - name: Checkout main branch + run: git checkout main # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 @@ -151,13 +151,13 @@ jobs: # Push the commit - name: Push to Builds Repo shell: powershell - run: git push -u origin master --force + run: git push -u origin main --force # Push the tags - name: Push tags run: git push --tags origin - name: Check Directory run: Get-ChildItem ./ - # This step only runs if the branch is master or release/ runs and pushes the build to the public build repo + # This step only runs if the branch is main or release/ runs and pushes the build to the public build repo Public_Push_Output: needs: Build_Project runs-on: windows-latest @@ -186,9 +186,9 @@ jobs: Write-Output "::set-env name=VERSION::$version" Remove-Item -Path ./Version/version.txt Remove-Item -Path ./Version - # Checkout master branch + # Checkout main branch - name: Create new branch - run: git checkout master + run: git checkout main # Download the build output into the repo - name: Download Build output uses: actions/download-artifact@v1 @@ -224,7 +224,7 @@ jobs: # Push the commit - name: Push to Builds Repo shell: powershell - run: git push -u origin master --force + run: git push -u origin main --force # Push the tags - name: Push tags run: git push --tags origin From ef50098460757568f61ff64ec184ae9b30f2358c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 17 Jun 2020 19:35:35 -0600 Subject: [PATCH 42/52] update PD Core submodule commit --- essentials-framework/pepperdashcore-builds | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 974d2f47..18cb0c27 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 974d2f473c06b2c90b18c06e0f758ca47d466be8 +Subproject commit 18cb0c273eb8b750f657d74160ad82eff1b24bca From 60d387c792c4a40184d1970197ad1a735a3f9676 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 16:16:24 -0600 Subject: [PATCH 43/52] add in/out AV names to join map --- .../JoinMaps/DmChassisControllerJoinMap.cs | 37 +++++++++++++++++++ essentials-framework/pepperdashcore-builds | 2 +- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index 48c4b59e..d387eeed 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -89,6 +89,43 @@ namespace PepperDash.Essentials.Core.Bridges public JoinDataComplete OutputNames = new JoinDataComplete(new JoinData() { JoinNumber = 301, JoinSpan = 32 }, new JoinMetadata() { Label = "DM Chassis Output Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); + [JoinName("InputVideoNames")] public JoinDataComplete InputVideoNames = + new JoinDataComplete(new JoinData {JoinNumber = 501, JoinSpan = 200}, + new JoinMetadata + { + Description = "Video Input Name", + JoinCapabilities = eJoinCapabilities.ToFromSIMPL, + JoinType = eJoinType.Serial + }); + + [JoinName("InputAudioNames")] + public JoinDataComplete InputAudioNames = + new JoinDataComplete(new JoinData { JoinNumber = 701, JoinSpan = 200 }, + new JoinMetadata + { + Description = "Video Input Name", + JoinCapabilities = eJoinCapabilities.ToFromSIMPL, + JoinType = eJoinType.Serial + }); + [JoinName("OutputVideoNames")] + public JoinDataComplete OutputVideoNames = + new JoinDataComplete(new JoinData { JoinNumber = 901, JoinSpan = 200 }, + new JoinMetadata + { + Description = "Video Input Name", + JoinCapabilities = eJoinCapabilities.ToFromSIMPL, + JoinType = eJoinType.Serial + }); + [JoinName("OutputAudioNames")] + public JoinDataComplete OutputAudioNames = + new JoinDataComplete(new JoinData { JoinNumber = 1101, JoinSpan = 200 }, + new JoinMetadata + { + Description = "Video Input Name", + JoinCapabilities = eJoinCapabilities.ToFromSIMPL, + JoinType = eJoinType.Serial + }); + [JoinName("OutputCurrentVideoInputNames")] public JoinDataComplete OutputCurrentVideoInputNames = new JoinDataComplete(new JoinData() { JoinNumber = 2001, JoinSpan = 32 }, new JoinMetadata() { Label = "DM Chassis Video Output Currently Routed Video Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); diff --git a/essentials-framework/pepperdashcore-builds b/essentials-framework/pepperdashcore-builds index 974d2f47..18cb0c27 160000 --- a/essentials-framework/pepperdashcore-builds +++ b/essentials-framework/pepperdashcore-builds @@ -1 +1 @@ -Subproject commit 974d2f473c06b2c90b18c06e0f758ca47d466be8 +Subproject commit 18cb0c273eb8b750f657d74160ad82eff1b24bca From e5099e9a2afc314b404967f38c81866af2c0d1f5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 17 Jun 2020 12:04:49 -0600 Subject: [PATCH 44/52] started support for 3-Series cards --- .../Crestron IO/Cards/C3CardControllerBase.cs | 16 +++++ .../Crestron IO/Cards/C3Com3Controller.cs | 37 +++++++++++ .../Crestron IO/Cards/CenCi31Controller.cs | 65 +++++++++++++++++++ 3 files changed, 118 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs new file mode 100644 index 00000000..cb9667cf --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs @@ -0,0 +1,16 @@ +using Crestron.SimplSharpPro; +using Crestron.SimplSharpProInternal; +using PepperDash.Essentials.Core; + +namespace PepperDash_Essentials_Core.Crestron_IO.Cards +{ + public class C3CardControllerBase:CrestronGenericBaseDevice + { + private C3Card _card; + + public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware) + { + _card = hardware; + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs new file mode 100644 index 00000000..9e649a52 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs @@ -0,0 +1,37 @@ +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.ThreeSeriesCards; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash_Essentials_Core.Crestron_IO.Cards +{ + public class C3Com3Controller:C3CardControllerBase, IComPorts + { + private readonly C3com3 _card; + + public C3Com3Controller(string key, string name, C3com3 hardware) : base(key, name, hardware) + { + _card = hardware; + } + + #region Implementation of IComPorts + + public CrestronCollection ComPorts + { + get { return _card.ComPorts; } + } + + public int NumberOfComPorts + { + get { return _card.NumberOfComPorts; } + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs new file mode 100644 index 00000000..0c16e876 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs @@ -0,0 +1,65 @@ +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.ThreeSeriesCards; +using Crestron.SimplSharpProInternal; +using Newtonsoft.Json; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash_Essentials_Core.Crestron_IO.Cards +{ + public class CenCi31Controller :CrestronGenericBridgeableBaseDevice + { + private const string CardKeyTemplate = "{0}-card{1}"; + private readonly CenCi31 _cardCage; + private CenCi3Configuration _config; + + private Dictionary> _cardDict; + + public CenCi31Controller(string key, string name, DeviceConfig config, CenCi31 hardware) : base(key, name, hardware) + { + _cardCage = hardware; + _config = config.Properties.ToObject(); + + _cardDict = new Dictionary> + { + { + "c3com3", + (c, s) => + new C3Com3Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardKeyTemplate, key, s), new C3com3(_cardCage)) + }, + }; + + } + + private void GetCards() + { + foreach (var card in _config.Cards) + { + + } + } + + #region Overrides of CrestronGenericBridgeableBaseDevice + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + throw new NotImplementedException(); + } + + #endregion + } + + public class CenCi3Configuration + { + [JsonProperty("cards")] + public Dictionary Cards { get; set; } + } +} \ No newline at end of file From 1bd682525883c122d94ff104cb0d5d10740d0913 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 17 Jun 2020 23:17:45 -0600 Subject: [PATCH 45/52] create classes for all supported cards --- .../Crestron IO/Cards/C3CardControllerBase.cs | 16 +++-- .../Crestron IO/Cards/C3Com3Controller.cs | 12 +--- .../Crestron IO/Cards/C3Io16Controller.cs | 29 ++++++++ .../Crestron IO/Cards/C3Ir8Controller.cs | 29 ++++++++ .../Crestron IO/Cards/C3Ry16Controller.cs | 29 ++++++++ .../Crestron IO/Cards/C3Ry8Controller.cs | 29 ++++++++ .../Crestron IO/Cards/CenCi31Controller.cs | 71 ++++++++++++------- .../PepperDash_Essentials_Core.csproj | 11 +++ 8 files changed, 188 insertions(+), 38 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Io16Controller.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ir8Controller.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry16Controller.cs create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs index cb9667cf..bfb81acd 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3CardControllerBase.cs @@ -1,16 +1,24 @@ -using Crestron.SimplSharpPro; +using System; using Crestron.SimplSharpProInternal; -using PepperDash.Essentials.Core; -namespace PepperDash_Essentials_Core.Crestron_IO.Cards +namespace PepperDash.Essentials.Core.CrestronIO.Cards { public class C3CardControllerBase:CrestronGenericBaseDevice { - private C3Card _card; + private readonly C3Card _card; public C3CardControllerBase(string key, string name, C3Card hardware) : base(key, name, hardware) { _card = hardware; } + + #region Overrides of Object + + public override string ToString() + { + return String.Format("{0} {1}", Key, _card.ToString()); + } + + #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs index 9e649a52..9658b2bb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Com3Controller.cs @@ -1,15 +1,7 @@ -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; using Crestron.SimplSharpPro.ThreeSeriesCards; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -namespace PepperDash_Essentials_Core.Crestron_IO.Cards +namespace PepperDash.Essentials.Core.CrestronIO.Cards { public class C3Com3Controller:C3CardControllerBase, IComPorts { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Io16Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Io16Controller.cs new file mode 100644 index 00000000..bdf4742d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Io16Controller.cs @@ -0,0 +1,29 @@ +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.ThreeSeriesCards; + +namespace PepperDash.Essentials.Core.CrestronIO.Cards +{ + public class C3Io16Controller:C3CardControllerBase,IIOPorts + { + private readonly C3io16 _card; + + public C3Io16Controller(string key, string name, C3io16 hardware) : base(key, name, hardware) + { + _card = hardware; + } + + #region Implementation of IIOPorts + + public CrestronCollection VersiPorts + { + get { return _card.VersiPorts; } + } + + public int NumberOfVersiPorts + { + get { return _card.NumberOfVersiPorts; } + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ir8Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ir8Controller.cs new file mode 100644 index 00000000..c35d2038 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ir8Controller.cs @@ -0,0 +1,29 @@ +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.ThreeSeriesCards; + +namespace PepperDash.Essentials.Core.CrestronIO.Cards +{ + public class C3Ir8Controller:C3CardControllerBase, IIROutputPorts + { + private readonly C3ir8 _card; + + public C3Ir8Controller(string key, string name, C3ir8 hardware) : base(key, name, hardware) + { + _card = hardware; + } + + #region Implementation of IIROutputPorts + + public CrestronCollection IROutputPorts + { + get { return _card.IROutputPorts; } + } + + public int NumberOfIROutputPorts + { + get { return _card.NumberOfIROutputPorts; } + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry16Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry16Controller.cs new file mode 100644 index 00000000..a68ecaf0 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry16Controller.cs @@ -0,0 +1,29 @@ +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.ThreeSeriesCards; + +namespace PepperDash.Essentials.Core.CrestronIO.Cards +{ + public class C3Ry16Controller:C3CardControllerBase, IRelayPorts + { + private readonly C3ry16 _card; + + public C3Ry16Controller(string key, string name, C3ry16 hardware) : base(key, name, hardware) + { + _card = hardware; + } + + #region Implementation of IRelayPorts + + public CrestronCollection RelayPorts + { + get { return _card.RelayPorts; } + } + + public int NumberOfRelayPorts + { + get { return _card.NumberOfRelayPorts; } + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs new file mode 100644 index 00000000..158c04ca --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs @@ -0,0 +1,29 @@ +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.ThreeSeriesCards; + +namespace PepperDash.Essentials.Core.CrestronIO.Cards +{ + public class C3Ry8Controller:C3CardControllerBase, IRelayPorts + { + private readonly C3ry8 _card; + + public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware) + { + _card = hardware + } + + #region Implementation of IRelayPorts + + public CrestronCollection RelayPorts + { + get { return _card.RelayPorts; } + } + + public int NumberOfRelayPorts + { + get { return _card.NumberOfRelayPorts; } + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs index 0c16e876..ddd58e63 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs @@ -1,31 +1,26 @@ 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.ThreeSeriesCards; -using Crestron.SimplSharpProInternal; using Newtonsoft.Json; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; +using PepperDash.Core; using PepperDash.Essentials.Core.Config; -namespace PepperDash_Essentials_Core.Crestron_IO.Cards +namespace PepperDash.Essentials.Core.CrestronIO.Cards { - public class CenCi31Controller :CrestronGenericBridgeableBaseDevice + public class CenCi31Controller : CrestronGenericBaseDevice { private const string CardKeyTemplate = "{0}-card{1}"; + private const uint CardSlot = 1; private readonly CenCi31 _cardCage; - private CenCi3Configuration _config; + private readonly CenCi31Configuration _config; - private Dictionary> _cardDict; + private readonly Dictionary> _cardDict; - public CenCi31Controller(string key, string name, DeviceConfig config, CenCi31 hardware) : base(key, name, hardware) + public CenCi31Controller(string key, string name, CenCi31Configuration config, CenCi31 hardware) : base(key, name, hardware) { _cardCage = hardware; - _config = config.Properties.ToObject(); + + _config = config; _cardDict = new Dictionary> { @@ -37,29 +32,57 @@ namespace PepperDash_Essentials_Core.Crestron_IO.Cards }, }; + GetCards(); } private void GetCards() { - foreach (var card in _config.Cards) + Func cardBuilder; + + if (String.IsNullOrEmpty(_config.Card)) { } + + if (!_cardDict.TryGetValue(_config.Card, out cardBuilder)) + { + Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card); + return; + } + + var device = cardBuilder(_cardCage, CardSlot); + + DeviceManager.AddDevice(device); } + } - #region Overrides of CrestronGenericBridgeableBaseDevice + public class CenCi31Configuration + { + [JsonProperty("card")] + public string Card { get; set; } + } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + public class CenCi3ControllerFactory : EssentialsDeviceFactory + { + public CenCi3ControllerFactory() { - throw new NotImplementedException(); + TypeNames = new List {"cenci31"}; + } + #region Overrides of EssentialsDeviceFactory + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory attempting to build new CEN-CI-1"); + + var controlProperties = CommFactory.GetControlPropertiesConfig(dc); + var ipId = controlProperties.IpIdInt; + + var cardCage = new CenCi31(ipId, Global.ControlSystem); + var config = dc.Properties.ToObject(); + + return new CenCi31Controller(dc.Key, dc.Name, config, cardCage); } #endregion } - - public class CenCi3Configuration - { - [JsonProperty("cards")] - public Dictionary Cards { get; set; } - } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 153b6ad5..bf59a449 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -74,6 +74,10 @@ False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll + + False + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll + False ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll @@ -156,6 +160,13 @@ + + + + + + + From e4a8e89135476cb4a9b0a5073aca3d70539248a6 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 00:20:26 -0600 Subject: [PATCH 46/52] add Cenci33 controller --- .../Crestron IO/Cards/C3Ry8Controller.cs | 2 +- .../Crestron IO/Cards/CenCi33Controller.cs | 130 ++++++++++++++++++ .../PepperDash_Essentials_Core.csproj | 5 +- 3 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs index 158c04ca..2fc5fa1b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/C3Ry8Controller.cs @@ -9,7 +9,7 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards public C3Ry8Controller(string key, string name, C3ry8 hardware) : base(key, name, hardware) { - _card = hardware + _card = hardware; } #region Implementation of IRelayPorts diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs new file mode 100644 index 00000000..73dc4307 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using Crestron.SimplSharpPro.ThreeSeriesCards; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Core.CrestronIO.Cards +{ + public class CenCi33Controller : CrestronGenericBaseDevice + { + private const string CardKeyTemplate = "{0}-card{1}"; + private const string CardNameTemplate = "{0}:{1}:{2}"; + private const uint CardSlots = 3; + private readonly CenCi33 _cardCage; + private readonly CenCi33Configuration _config; + + private readonly Dictionary> _cardDict; + + public CenCi33Controller(string key, string name, CenCi33Configuration config, CenCi33 hardware) : base(key, name, hardware) + { + _cardCage = hardware; + + _config = config; + + _cardDict = new Dictionary> + { + { + "c3com3", + (c, s) => + new C3Com3Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,_cardCage)) + }, + { + "c3io16", + (c, s) => + new C3Io16Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,_cardCage)) + }, + { + "c3ir8", + (c, s) => + new C3Ir8Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,_cardCage)) + }, + { + "c3ry16", + (c, s) => + new C3Ry16Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,_cardCage)) + }, + { + "c3ry8", + (c, s) => + new C3Ry8Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,_cardCage)) + }, + + }; + + GetCards(); + } + + private void GetCards() + { + if (_config.Cards == null) + { + Debug.Console(0, this, "No card configuration for this device found"); + return; + } + + for (uint i = 1; i <= CardSlots; i++) + { + string cardType; + if (!_config.Cards.TryGetValue(i, out cardType)) + { + Debug.Console(1, this, "No card found for slot {0}", i); + continue; + } + + if (String.IsNullOrEmpty(cardType)) + { + Debug.Console(0, this, "No card specified for slot {0}", i); + return; + } + + Func cardBuilder; + if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder)) + { + Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType); + return; + } + + var device = cardBuilder(_cardCage, i); + + DeviceManager.AddDevice(device); + } + } + } + + public class CenCi33Configuration + { + [JsonProperty("cards")] + public Dictionary Cards { get; set; } + } + + public class CenCi33ControllerFactory : EssentialsDeviceFactory + { + public CenCi33ControllerFactory() + { + TypeNames = new List {"cenci33"}; + } + #region Overrides of EssentialsDeviceFactory + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory attempting to build new CEN-CI-3"); + + var controlProperties = CommFactory.GetControlPropertiesConfig(dc); + var ipId = controlProperties.IpIdInt; + + var cardCage = new CenCi33(ipId, Global.ControlSystem); + var config = dc.Properties.ToObject(); + + return new CenCi33Controller(dc.Key, dc.Name, config, cardCage); + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index bf59a449..ff489dad 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -166,7 +166,10 @@ - + + Code + + From 48bc41a69e0d26241c58fc96f2e0ca680302482d Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 00:20:41 -0600 Subject: [PATCH 47/52] update key and name for cards --- .../Crestron IO/Cards/CenCi31Controller.cs | 43 +++++++++++++++---- 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs index ddd58e63..5a7d4e53 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs @@ -9,7 +9,8 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards { public class CenCi31Controller : CrestronGenericBaseDevice { - private const string CardKeyTemplate = "{0}-card{1}"; + private const string CardKeyTemplate = "{0}-card"; + private const string CardNameTemplate = "{0}:{1}:{2}"; private const uint CardSlot = 1; private readonly CenCi31 _cardCage; private readonly CenCi31Configuration _config; @@ -27,9 +28,34 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards { "c3com3", (c, s) => - new C3Com3Controller(String.Format(CardKeyTemplate, key, s), - String.Format(CardKeyTemplate, key, s), new C3com3(_cardCage)) + new C3Com3Controller(String.Format(CardKeyTemplate, key), + String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(_cardCage)) }, + { + "c3io16", + (c, s) => + new C3Io16Controller(String.Format(CardKeyTemplate, key), + String.Format(CardNameTemplate, key, s,"C3Io16"), new C3io16(_cardCage)) + }, + { + "c3ir8", + (c, s) => + new C3Ir8Controller(String.Format(CardKeyTemplate, key), + String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(_cardCage)) + }, + { + "c3ry16", + (c, s) => + new C3Ry16Controller(String.Format(CardKeyTemplate, key), + String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(_cardCage)) + }, + { + "c3ry8", + (c, s) => + new C3Ry8Controller(String.Format(CardKeyTemplate, key), + String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(_cardCage)) + }, + }; GetCards(); @@ -38,13 +64,14 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards private void GetCards() { Func cardBuilder; - + if (String.IsNullOrEmpty(_config.Card)) { - + Debug.Console(0, this, "No card specified"); + return; } - if (!_cardDict.TryGetValue(_config.Card, out cardBuilder)) + if (!_cardDict.TryGetValue(_config.Card.ToLower(), out cardBuilder)) { Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", _config.Card); return; @@ -62,9 +89,9 @@ namespace PepperDash.Essentials.Core.CrestronIO.Cards public string Card { get; set; } } - public class CenCi3ControllerFactory : EssentialsDeviceFactory + public class CenCi31ControllerFactory : EssentialsDeviceFactory { - public CenCi3ControllerFactory() + public CenCi31ControllerFactory() { TypeNames = new List {"cenci31"}; } From 7d97bc118e5e9b08b6eb854c048118a7c8c2b542 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 00:20:55 -0600 Subject: [PATCH 48/52] fix debug message --- .../PepperDashEssentialsBase/Factory/DeviceFactory.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs index 1904867d..e337b7d4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/DeviceFactory.cs @@ -103,7 +103,7 @@ namespace PepperDash.Essentials.Core // Check for types that have been added by plugin dlls. if (FactoryMethods.ContainsKey(typeName)) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from plugin", dc.Type); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loading '{0}' from Essentials Core", dc.Type); return FactoryMethods[typeName].FactoryMethod(dc); } From a1809dccb4cca840732c2ad7827cd20d6a9ebb52 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 10:55:37 -0600 Subject: [PATCH 49/52] add internal card cage support --- .../Cards/InternalCardCageController.cs | 141 ++++++++++++++++++ .../PepperDash_Essentials_Core.csproj | 1 + 2 files changed, 142 insertions(+) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/InternalCardCageController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/InternalCardCageController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/InternalCardCageController.cs new file mode 100644 index 00000000..b362a78d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/InternalCardCageController.cs @@ -0,0 +1,141 @@ +using System; +using System.Collections.Generic; +using Crestron.SimplSharpPro.ThreeSeriesCards; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Core.CrestronIO.Cards +{ + [ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")] + public class InternalCardCageController : EssentialsDevice + { + private const string CardKeyTemplate = "{0}-card{1}"; + private const string CardNameTemplate = "{0}:{1}:{2}"; + private const uint CardSlots = 3; + + private readonly InternalCardCageConfiguration _config; + + private readonly Dictionary> _cardDict; + + public InternalCardCageController(string key, string name, InternalCardCageConfiguration config) : base(key, name) + { + _config = config; + + _cardDict = new Dictionary> + { + { + "c3com3", + (s) => + new C3Com3Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Com3"), new C3com3(s,Global.ControlSystem)) + }, + { + "c3io16", + (s) => + new C3Io16Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Io16"), new C3io16(s,Global.ControlSystem)) + }, + { + "c3ir8", + (s) => + new C3Ir8Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Ir8"), new C3ir8(s,Global.ControlSystem)) + }, + { + "c3ry16", + (s) => + new C3Ry16Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Ry16"), new C3ry16(s,Global.ControlSystem)) + }, + { + "c3ry8", + (s) => + new C3Ry8Controller(String.Format(CardKeyTemplate, key, s), + String.Format(CardNameTemplate, key, s, "C3Ry8"), new C3ry8(s,Global.ControlSystem)) + }, + + }; + + GetCards(); + } + + private void GetCards() + { + if (_config.Cards == null) + { + Debug.Console(0, this, "No card configuration for this device found"); + return; + } + + for (uint i = 1; i <= CardSlots; i++) + { + string cardType; + if (!_config.Cards.TryGetValue(i, out cardType)) + { + Debug.Console(1, this, "No card found for slot {0}", i); + continue; + } + + if (String.IsNullOrEmpty(cardType)) + { + Debug.Console(0, this, "No card specified for slot {0}", i); + return; + } + + Func cardBuilder; + if (!_cardDict.TryGetValue(cardType.ToLower(), out cardBuilder)) + { + Debug.Console(0, "Unable to find factory for 3-Series card type {0}.", cardType); + return; + } + + try + { + var device = cardBuilder(i); + + + DeviceManager.AddDevice(device); + } + catch (InvalidOperationException ex) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Error, + "Unable to add card {0} to internal card cage.\r\nError Message: {1}\r\nStack Trace: {2}", + cardType, ex.Message, ex.StackTrace); + } + } + } + } + + public class InternalCardCageConfiguration + { + [JsonProperty("cards")] + public Dictionary Cards { get; set; } + } + + public class InternalCardCageControllerFactory : EssentialsDeviceFactory + { + public InternalCardCageControllerFactory() + { + TypeNames = new List {"internalcardcage"}; + } + #region Overrides of EssentialsDeviceFactory + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory attempting to build new Internal Card Cage Controller"); + + if (!Global.ControlSystem.SupportsThreeSeriesPlugInCards) + { + Debug.Console(0, Debug.ErrorLogLevel.Warning, "Current control system does NOT support 3-Series cards. Everything is NOT awesome."); + return null; + } + + var config = dc.Properties.ToObject(); + + return new InternalCardCageController(dc.Key, dc.Name, config); + } + + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index ff489dad..55a157b4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -170,6 +170,7 @@ Code + From 49177da82004f66e6b8315a4e967ba2fbd4e50c5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 11:00:36 -0600 Subject: [PATCH 50/52] add config snippets for external card cages --- .../Crestron IO/Cards/CenCi31Controller.cs | 1 + .../Crestron IO/Cards/CenCi33Controller.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs index 5a7d4e53..a6daa591 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi31Controller.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO.Cards { + [ConfigSnippet("\"properties\":{\"card\":\"c3com3\"}")] public class CenCi31Controller : CrestronGenericBaseDevice { private const string CardKeyTemplate = "{0}-card"; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs index 73dc4307..3b054c00 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Cards/CenCi33Controller.cs @@ -7,6 +7,7 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO.Cards { + [ConfigSnippet("\"properties\":{\"cards\":{\"1\":\"c3com3\",\"2\":\"c3ry16\",\"3\":\"c3ry8\"}}")] public class CenCi33Controller : CrestronGenericBaseDevice { private const string CardKeyTemplate = "{0}-card{1}"; From 6b6604b7a9a98b226aa4224fa8484c050986021b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 19 Jun 2020 13:51:43 -0600 Subject: [PATCH 51/52] update bridges and interfaces --- PepperDashEssentials/Bridges/EiscBridge.cs | 18 ++++++++++++--- PepperDashEssentials/Bridges/IBridge.cs | 4 +++- .../Bridges/BridgeBase.cs | 22 +++++-------------- .../Bridges/IBridge.cs | 11 ++-------- 4 files changed, 25 insertions(+), 30 deletions(-) diff --git a/PepperDashEssentials/Bridges/EiscBridge.cs b/PepperDashEssentials/Bridges/EiscBridge.cs index 984a1d9d..1a7ec02a 100644 --- a/PepperDashEssentials/Bridges/EiscBridge.cs +++ b/PepperDashEssentials/Bridges/EiscBridge.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Crestron.SimplSharp.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.EthernetCommunication; using PepperDash.Core; @@ -39,19 +40,31 @@ namespace PepperDash.Essentials.Bridges if (device == null) continue; Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. + if (typeof(IBridge).IsAssignableFrom(device.GetType().GetCType())) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. { Debug.Console(2, this, "'{0}' is IBridge", device.Key); var dev = device as IBridge; + if (dev == null) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Cast to IBridge failed for {0}"); + continue; + } + dev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); } - if (!(device is IBridgeAdvanced)) continue; + if (!typeof(IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) continue; Debug.Console(2, this, "'{0}' is IBridgeAdvanced", device.Key); var advDev = device as IBridgeAdvanced; + if (advDev == null) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Cast to IBridgeAdvanced failed for {0}"); + continue; + } + try { advDev.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, null); @@ -61,7 +74,6 @@ namespace PepperDash.Essentials.Bridges Debug.ConsoleWithLog(0, this, "Please update the bridge config to use EiscBridgeAdvanced with this device: {0}", device.Key); } - } Debug.Console(1, this, "Devices Linked."); diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs index 8bc741ec..497985c7 100644 --- a/PepperDashEssentials/Bridges/IBridge.cs +++ b/PepperDashEssentials/Bridges/IBridge.cs @@ -1,4 +1,5 @@ using System; +using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.Bridges { @@ -6,7 +7,8 @@ namespace PepperDash.Essentials.Bridges /// Defines a device that uses the legacy JoinMapBase for its join map /// [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] - public interface IBridge:Core.Bridges.IBridge + public interface IBridge { + void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); } } \ 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 512401bc..0919335d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -7,7 +7,6 @@ using Crestron.SimplSharpPro.EthernetCommunication; using Newtonsoft.Json; using PepperDash.Core; -using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; //using PepperDash.Essentials.Devices.Common.Cameras; @@ -111,28 +110,17 @@ namespace PepperDash.Essentials.Core.Bridges Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - if (typeof (IBridge).IsAssignableFrom(device.GetType().GetCType())) + if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) { - var basicBridge = device as IBridge; - if (basicBridge != null) - { - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, - "Linking EiscApiAdvanced {0} to device {1} using obsolete join map. Please update the device's join map.", - Key, device.Key); - basicBridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); - } + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, + "{0} is not compatible with this bridge type. Please use 'eiscapi' instead, or updae the device.", + device.Key); continue; } - if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) - { - continue; - } var bridge = device as IBridgeAdvanced; if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); } - - }); } @@ -303,7 +291,7 @@ namespace PepperDash.Essentials.Core.Bridges { public EiscApiAdvancedFactory() { - TypeNames = new List() { "eiscapiadv", "eiscapiadvanced" }; + TypeNames = new List { "eiscapiadv", "eiscapiadvanced" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs index 4aca333a..0c6b44ed 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs @@ -1,19 +1,12 @@ -using System; -using Crestron.SimplSharpPro.DeviceSupport; -using PepperDash.Core; +using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.Core.Bridges { /// /// Defines a device that uses JoinMapBaseAdvanced for its join map /// - public interface IBridgeAdvanced:IKeyed + public interface IBridgeAdvanced { void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } - - public interface IBridge:IKeyed - { - void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); - } } \ No newline at end of file From f98292a4aa0db0e6809e741186a7161467c728f5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 19 Jun 2020 14:32:26 -0600 Subject: [PATCH 52/52] add null check to all internal device LinkToApi methods This allows for backwards compatability with EiscApi bridges. --- .../Comm and IR/GenericComm.cs | 9 ++++++- .../Crestron IO/C2nRts/C2nRthsController.cs | 9 ++++++- .../Inputs/GenericDigitalInputDevice.cs | 9 ++++++- .../Crestron IO/Relay/GenericRelayDevice.cs | 9 ++++++- .../StatusSign/StatusSignController.cs | 9 ++++++- .../Display/DisplayBase.cs | 13 +++++++--- .../Lighting/LightingBase.cs | 9 ++++++- .../Monitoring/SystemMonitorController.cs | 9 ++++++- .../Remotes/Hrxx0WirelessRemoteController.cs | 9 ++++++- .../AirMedia/AirMediaController.cs | 9 ++++++- .../Chassis/DmBladeChassisController.cs | 9 ++++++- .../Chassis/DmChassisController.cs | 9 ++++++- .../Chassis/DmpsAudioOutputController.cs | 9 ++++++- .../Chassis/DmpsRoutingController.cs | 9 ++++++- .../Chassis/HdMdNxM4kEBridgeableController.cs | 9 ++++++- .../DmLite/HdMdxxxCEController.cs | 9 ++++++- .../Endpoints/Receivers/DmRmcHelper.cs | 9 ++++++- .../Endpoints/Transmitters/DmTxHelpers.cs | 9 +++++++ .../Cameras/CameraBase.cs | 10 ++++++-- .../CenOdtOccupancySensorBaseController.cs | 9 ++++++- .../GlsOccupancySensorBaseController.cs | 25 ++++++++----------- .../SetTopBox/IRSetTopBoxBase.cs | 9 ++++++- .../Streaming/AppleTV.cs | 9 ++++++- 23 files changed, 189 insertions(+), 39 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs index 3195bd8b..db5ef9ec 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Comm and IR/GenericComm.cs @@ -76,7 +76,14 @@ namespace PepperDash.Essentials.Core if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } if (CommPort == null) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs index 728b2487..73279368 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -55,7 +55,14 @@ namespace PepperDash.Essentials.Core.CrestronIO if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs index 801127c9..e57e869d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -108,7 +108,14 @@ namespace PepperDash.Essentials.Core.CrestronIO if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } try { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs index f3466683..f76608aa 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -148,7 +148,14 @@ namespace PepperDash.Essentials.Core.CrestronIO if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } if (RelayOutput == null) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs index 89e830e5..1bd22ebe 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -118,7 +118,14 @@ namespace PepperDash.Essentials.Core.CrestronIO if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs index 90ca9e05..5ad143c9 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs @@ -128,9 +128,16 @@ namespace PepperDash.Essentials.Core if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); - - Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs index 66e90d97..1bf8aee8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Lighting/LightingBase.cs @@ -80,7 +80,14 @@ namespace PepperDash.Essentials.Core.Lighting if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs index e9d06304..b523d2c8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Monitoring/SystemMonitorController.cs @@ -209,7 +209,14 @@ namespace PepperDash.Essentials.Core.Monitoring if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(2, this, "Linking API starting at join: {0}", joinStart); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs index cee8b3eb..ff1ef06b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs @@ -158,7 +158,14 @@ namespace PepperDash.Essentials.Core if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } //List ExcludedKeys = new List(); foreach (var feedback in Feedbacks) diff --git a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs index 0115465a..709aa500 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/AirMedia/AirMediaController.cs @@ -114,7 +114,14 @@ namespace PepperDash.Essentials.DM.AirMedia if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Airmedia: {0}", Name); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 817bbbaf..1ac15263 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -590,7 +590,14 @@ namespace PepperDash.Essentials.DM { if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index d5c56e9c..9a28f75f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -1112,7 +1112,14 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index cc7fd7e4..9f839c89 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -111,7 +111,14 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 32352b49..8c36e209 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -163,7 +163,14 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs index f1ed6d5b..1e33069a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEBridgeableController.cs @@ -262,7 +262,14 @@ namespace PepperDash.Essentials.DM.Chassis if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); DeviceNameFeedback[this.Name].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]); diff --git a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs index 4007e9f5..60277c10 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/DmLite/HdMdxxxCEController.cs @@ -230,7 +230,14 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); 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 a0971c52..b3d9b478 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -42,7 +42,14 @@ namespace PepperDash.Essentials.DM if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, rmc, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); 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 b51c729b..7a59daf9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -206,6 +206,15 @@ namespace PepperDash.Essentials.DM protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge) { + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } + Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs index 960b8355..35d696c7 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Cameras/CameraBase.cs @@ -83,8 +83,14 @@ namespace PepperDash.Essentials.Devices.Common.Cameras { CameraControllerJoinMap joinMap = new CameraControllerJoinMap(joinStart); - // Adds the join map to the bridge - bridge.AddJoinMap(cameraDevice.Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } var customJoins = JoinMapHelper.TryGetJoinMapAdvancedForDevice(joinMapKey); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs index 16c0a2f0..c64b62be 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/CenOdtOccupancySensorBaseController.cs @@ -447,7 +447,14 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs index 6dd61721..b6508920 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOccupancySensorBaseController.cs @@ -268,7 +268,14 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, occController, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); @@ -379,25 +386,13 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy { Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); - var typeName = dc.Type.ToLower(); var key = dc.Key; var name = dc.Name; var comm = CommFactory.GetControlPropertiesConfig(dc); - GlsOccupancySensorBase occSensor = null; - - occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); - - if (occSensor != null) - { - return new GlsOccupancySensorBaseController(key, name, occSensor); - } - else - { - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - return null; - } + GlsOccupancySensorBase occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); + return new GlsOccupancySensorBaseController(key, name, occSensor); } } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs index ec3f11e8..71698529 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs @@ -380,7 +380,14 @@ namespace PepperDash.Essentials.Devices.Common if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Display: {0}", Name); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs index 13e89040..1db187f8 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Streaming/AppleTV.cs @@ -153,7 +153,14 @@ namespace PepperDash.Essentials.Devices.Common if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device."); + } Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", GetType().Name);