From dbec871500344933ec61c66ffe75e249dac7e202 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 11:13:43 -0600 Subject: [PATCH 001/150] fixes master.yml action...again --- .github/workflows/master.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index a362ea47..97f9d3e5 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -31,10 +31,7 @@ jobs: git config --global url."https://github.com/".insteadOf "git@github.com:" auth_header="$(git config --local --get http.https://github.com/.extraheader)" git submodule sync --recursive - git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 - # Fetch all tags - - name: Fetch tags - run: git fetch --tags + git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth= # Generate the appropriate version number - name: Set Version Number shell: powershell From 2519fffb58bbf24bfafba91cc3c458385886ba84 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 14:00:56 -0600 Subject: [PATCH 002/150] puts GetJoinMapForDevice method back into JoinMapHelper --- .../PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 8f792659..31616a6d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -27,6 +27,16 @@ namespace PepperDash.Essentials.Core return joinMap; } + /// + /// Attempts to get the serialized join map from config + /// + /// + /// + public static string GetJoinMapForDevice(string joinMapKey) + { + return GetSerializedJoinMapForDevice(joinMapKey); + } + /// /// Attempts to find a custom join map by key and returns it deserialized if found /// From dc9d285de0c885e3c81c125d0873a7423f0cf4b7 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 6 May 2020 14:49:29 -0600 Subject: [PATCH 003/150] Adds condition to support dmc4kzhdo output card type --- .../Chassis/DmChassisController.cs | 7 + .../Essentials_DM/Essentials_DM.csproj | 159 ++++++++++++++++++ 2 files changed, 166 insertions(+) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 7313aece..789116e7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -601,6 +601,13 @@ namespace PepperDash.Essentials.DM var cecPort2 = outputCard.Card2.HdmiOutput; AddDmcHdoPorts(number, cecPort1, cecPort2); } + else if (type == "dmc4kzhdo") + { + var outputCard = new Dmc4kzHdoSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + var cecPort2 = outputCard.Card2.HdmiOutput; + AddDmcHdoPorts(number, cecPort1, cecPort2); + } else if (type == "dmchdo") { var outputCard = new DmcHdoSingle(number, Chassis); diff --git a/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj new file mode 100644 index 00000000..cc9d85c6 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Essentials_DM.csproj @@ -0,0 +1,159 @@ + + + Release + AnyCPU + 9.0.30729 + 2.0 + {9199CE8A-0C9F-4952-8672-3EED798B284F} + Library + Properties + PepperDash.Essentials.DM + PepperDash_Essentials_DM + {0B4745B0-194B-4BB6-8E21-E9057CA92300};{4D628B5B-2FBC-4AA6-8C16-197242AEB884};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + WindowsCE + E2BECB1F-8C8C-41ba-B736-9BE7D946A398 + 5.0 + SmartDeviceProject1 + v3.5 + Windows CE + + + + + .allowedReferenceRelatedFileExtensions + true + full + false + bin\ + DEBUG;TRACE; + prompt + 4 + 512 + true + true + off + + + .allowedReferenceRelatedFileExtensions + none + true + bin\ + prompt + 4 + 512 + true + true + off + + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll + + + + False + ..\..\pepperdashcore-builds\PepperDash_Core.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + False + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll + + + False + ..\..\..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + False + + + False + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {A49AD6C8-FC0A-4CC0-9089-DFB4CF92D2B5} + PepperDash_Essentials_Core + + + + + + + + + rem S# Pro preparation will execute after these operations + + \ No newline at end of file From f7a41f08c4f48e72eda4b642f8c00c2cce814856 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 6 May 2020 15:35:54 -0600 Subject: [PATCH 004/150] fixes audio source feedback and setting audio source 4kz302C does not support audio breakway routing. --- .../Endpoints/Transmitters/DmTx4kz302CController.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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 27340407..c4c1ec6b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -109,7 +109,8 @@ namespace PepperDash.Essentials.DM }); AudioSourceNumericFeedback = new IntFeedback(() => { - return (int)Tx.AudioSourceFeedback; + //Doing this because 4kz302 does not allow for breakaway audio source selection + return (int)Tx.VideoSourceFeedback; }); HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => @@ -250,7 +251,11 @@ namespace PepperDash.Essentials.DM // NOTE: It's possible that this particular TX model may not like the AudioSource property being set. // The SIMPL definition only shows a single analog for AudioVideo Source if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - Tx.AudioSource = (eAst)inputSelector; + { + //it doesn't... + Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key); + //Tx.AudioSource = (eAst) inputSelector; + } } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) From aef491855c2c573466d28a1e4abaca6ec61dae34 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 14 May 2020 17:20:19 -0500 Subject: [PATCH 005/150] 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 006/150] 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 007/150] 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 008/150] 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 f33763ce43b91d50bbcf44a0f3de7757cdf90942 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 15 May 2020 15:20:27 -0600 Subject: [PATCH 009/150] fixes bitwise comparison for routing type --- .../Essentials_DM/Chassis/DmChassisController.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 0af41f48..c6626d81 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -964,26 +964,26 @@ 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) + if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) { Chassis.VideoEnter.BoolValue = true; Chassis.Outputs[output].VideoOut = inCard; } - if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) { (Chassis as DmMDMnxn).AudioEnter.BoolValue = true; Chassis.Outputs[output].AudioOut = inCard; } - if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) + if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) { Chassis.USBEnter.BoolValue = true; if (Chassis.Outputs[output] != null) Chassis.Outputs[output].USBRoutedTo = inCard; } - if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) + if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) { Chassis.USBEnter.BoolValue = true; if (Chassis.Inputs[input] != null) From c9d97e5caefdb79377cf666c815e4bfe4011e565 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 15 May 2020 15:36:32 -0600 Subject: [PATCH 010/150] Adds support for routing In to In or Out to Out for USB for DM Chassis --- .../Chassis/DmChassisController.cs | 61 ++++++++++++++++++- 1 file changed, 59 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index c6626d81..ee76b979 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -944,6 +944,10 @@ namespace PepperDash.Essentials.DM 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) @@ -978,16 +982,69 @@ namespace PepperDash.Essentials.DM if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) { + //using base here because USB can be routed between 2 output cards or 2 input cards + DMInputOutputBase dmCard; + + 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; + } + dmCard = Chassis.Outputs[outputIndex]; + } + else + { + dmCard = inCard; + } Chassis.USBEnter.BoolValue = true; if (Chassis.Outputs[output] != null) - Chassis.Outputs[output].USBRoutedTo = inCard; + Chassis.Outputs[output].USBRoutedTo = dmCard; } if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) { + //using base here because USB can be routed between 2 output cards or 2 input cards + DMInputOutputBase dmCard; + + if (input > 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[input] != null) - Chassis.Inputs[input].USBRoutedTo = outCard; + Chassis.Inputs[input].USBRoutedTo = dmCard; } } #endregion From 57f1db17c34022b6ce84a6857e333545d25b61ea Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 15 May 2020 15:45:37 -0600 Subject: [PATCH 011/150] Added some debug statements --- .../Chassis/DmChassisController.cs | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index ee76b979..a9bd194a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -985,6 +985,8 @@ namespace PepperDash.Essentials.DM //using base here because USB can be routed between 2 output cards or 2 input cards DMInputOutputBase dmCard; + 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 @@ -1010,7 +1012,10 @@ namespace PepperDash.Essentials.DM } Chassis.USBEnter.BoolValue = true; if (Chassis.Outputs[output] != null) + { + Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Outputs[input], dmCard); Chassis.Outputs[output].USBRoutedTo = dmCard; + } } if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) @@ -1018,6 +1023,8 @@ namespace PepperDash.Essentials.DM //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 (input > chassisSize) { //wanting to route an input to an output. Subtract chassis size and get output, unless it's 8x8 @@ -1042,9 +1049,16 @@ namespace PepperDash.Essentials.DM dmCard = Chassis.Inputs[input]; } + + Chassis.USBEnter.BoolValue = true; - if (Chassis.Inputs[input] != null) - Chassis.Inputs[input].USBRoutedTo = dmCard; + + if (Chassis.Inputs[input] == null) + { + return; + } + Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[input], dmCard); + Chassis.Inputs[input].USBRoutedTo = dmCard; } } #endregion From 406e6a912fd74ffc6fa5d9e8ebf4d04c929627db Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 08:52:08 -0600 Subject: [PATCH 012/150] adds Docker Hub login to workflow --- .github/workflows/docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ac1c58be..af91840c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -52,6 +52,12 @@ jobs: run: | Write-Output ${{ env.VERSION }} ./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }} + # Login to Docker + - name: Login to Docker + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} # Build the solutions in the docker image - name: Build Solution shell: powershell From 43ff15ff5ed51da7edd9267c3506fbf93ec173db Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 09:13:38 -0600 Subject: [PATCH 013/150] adds Docker login to master workflow --- .github/workflows/master.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 87da915e..a928d031 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -44,6 +44,12 @@ jobs: run: | Write-Output ${{ env.VERSION }} ./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }} + # Login to Docker + - name: Login to Docker + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} # Build the solutions in the docker image - name: Build Solution shell: powershell From 19c4428dc854937e7c4d15b40ca033b69a526dea Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 10:21:46 -0600 Subject: [PATCH 014/150] adds feedback joins for Audio & USB Breakway --- .../JoinMaps/DmChassisControllerJoinMap.cs | 19 +++++++++++++++++++ .../Chassis/DmChassisController.cs | 11 +++++++++++ 2 files changed, 30 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs index 9406678a..48c4b59e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/DmChassisControllerJoinMap.cs @@ -9,6 +9,25 @@ namespace PepperDash.Essentials.Core.Bridges { public class DmChassisControllerJoinMap : JoinMapBaseAdvanced { + [JoinName("EnableAudioBreakaway")] + public JoinDataComplete EnableAudioBreakaway = new JoinDataComplete( + new JoinData {JoinNumber = 4, JoinSpan = 1}, + new JoinMetadata + { + Label = "DM Chassis enable audio breakaway routing", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("EnableUsbBreakaway")] + public JoinDataComplete EnableUsbBreakaway = new JoinDataComplete( + new JoinData { JoinNumber = 5, JoinSpan = 1 }, + new JoinMetadata + { + Label = "DM Chassis enable USB breakaway routing", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); [JoinName("SystemId")] public JoinDataComplete SystemId = new JoinDataComplete(new JoinData() { JoinNumber = 10, JoinSpan = 1 }, diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index a9bd194a..91d35ac1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -42,6 +42,8 @@ namespace PepperDash.Essentials.DM public IntFeedback SystemIdFeebdack { get; private set; } public BoolFeedback SystemIdBusyFeedback { get; private set; } + public BoolFeedback EnableAudioBreakawayFeedback { get; private set; } + public BoolFeedback EnableUsbBreakawayFeedback { get; private set; } public Dictionary InputCardHdcpCapabilityFeedbacks { get; private set; } @@ -210,6 +212,11 @@ namespace PepperDash.Essentials.DM SystemIdFeebdack = new IntFeedback(() => { return (Chassis as DmMDMnxn).SystemIdFeedback.UShortValue; }); SystemIdBusyFeedback = new BoolFeedback(() => { return (Chassis as DmMDMnxn).SystemIdBusy.BoolValue; }); + EnableAudioBreakawayFeedback = + new BoolFeedback(() => (Chassis as DmMDMnxn).EnableAudioBreakawayFeedback.BoolValue); + EnableUsbBreakawayFeedback = + new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue); + InputCardHdcpCapabilityFeedbacks = new Dictionary(); InputCardHdcpCapabilityTypes = new Dictionary(); @@ -927,6 +934,10 @@ namespace PepperDash.Essentials.DM (Chassis as DmMDMnxn).EnableAudioBreakaway.BoolValue = true; (Chassis as DmMDMnxn).EnableUSBBreakaway.BoolValue = true; + + EnableAudioBreakawayFeedback.FireUpdate(); + EnableUsbBreakawayFeedback.FireUpdate(); + if (InputNames != null) foreach (var kvp in InputNames) Chassis.Inputs[kvp.Key].Name.StringValue = kvp.Value; From 46ecb676c0084a3b99c1025b7c1a8318f87e0daf Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 11:32:44 -0600 Subject: [PATCH 015/150] Fixes USB Routing for routing via Inputs and input to input Also adds feedbacks for Audio Breakaway and USB Breakaway status --- .../StatusSign/StatusSignController.cs | 310 +++++++++--------- .../Chassis/DmChassisController.cs | 41 ++- 2 files changed, 192 insertions(+), 159 deletions(-) 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 df8f778a..89e830e5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -1,127 +1,127 @@ -using System; -using System.Collections.Generic; -using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.GeneralIO; -using Newtonsoft.Json; -using PepperDash.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.Core.Config; - -namespace PepperDash.Essentials.Core.CrestronIO -{ - [Description("Wrapper class for the Crestron StatusSign device")] - public class StatusSignController : CrestronGenericBridgeableBaseDevice - { - private readonly StatusSign _device; - - public BoolFeedback RedLedEnabledFeedback { get; private set; } - public BoolFeedback GreenLedEnabledFeedback { get; private set; } - public BoolFeedback BlueLedEnabledFeedback { get; private set; } - - public IntFeedback RedLedBrightnessFeedback { get; private set; } - public IntFeedback GreenLedBrightnessFeedback { get; private set; } - public IntFeedback BlueLedBrightnessFeedback { get; private set; } - - public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware) - { - _device = hardware as StatusSign; - - RedLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Red] - .ControlFeedback.BoolValue); - GreenLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Green] - .ControlFeedback.BoolValue); - BlueLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Blue] - .ControlFeedback.BoolValue); - - RedLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Red].BrightnessFeedback); - GreenLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Green].BrightnessFeedback); - BlueLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback); - - if (_device != null) _device.BaseEvent += _device_BaseEvent; - } - - void _device_BaseEvent(GenericBase device, BaseEventArgs args) - { - switch (args.EventId) - { - case StatusSign.LedBrightnessFeedbackEventId: - RedLedBrightnessFeedback.FireUpdate(); - GreenLedBrightnessFeedback.FireUpdate(); - BlueLedBrightnessFeedback.FireUpdate(); - break; - case StatusSign.LedControlFeedbackEventId: - RedLedEnabledFeedback.FireUpdate(); - GreenLedEnabledFeedback.FireUpdate(); - BlueLedEnabledFeedback.FireUpdate(); - break; - } - } - - public void EnableLedControl(bool red, bool green, bool blue) - { - _device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red; - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green; - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue; - } - - public void SetColor(uint red, uint green, uint blue) - { - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red); - } - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green); - } - - try - { - _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness = - (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue); - } - catch (InvalidOperationException) - { - Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); - } - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) +using System; +using System.Collections.Generic; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.Core.Config; + +namespace PepperDash.Essentials.Core.CrestronIO +{ + [Description("Wrapper class for the Crestron StatusSign device")] + public class StatusSignController : CrestronGenericBridgeableBaseDevice + { + private readonly StatusSign _device; + + public BoolFeedback RedLedEnabledFeedback { get; private set; } + public BoolFeedback GreenLedEnabledFeedback { get; private set; } + public BoolFeedback BlueLedEnabledFeedback { get; private set; } + + public IntFeedback RedLedBrightnessFeedback { get; private set; } + public IntFeedback GreenLedBrightnessFeedback { get; private set; } + public IntFeedback BlueLedBrightnessFeedback { get; private set; } + + public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware) { - var joinMap = new StatusSignControllerJoinMap(joinStart); - - var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); - - if (!string.IsNullOrEmpty(joinMapSerialized)) + _device = hardware as StatusSign; + + RedLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint) StatusSign.Led.eLedColor.Red] + .ControlFeedback.BoolValue); + GreenLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint) StatusSign.Led.eLedColor.Green] + .ControlFeedback.BoolValue); + BlueLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint) StatusSign.Led.eLedColor.Blue] + .ControlFeedback.BoolValue); + + RedLedBrightnessFeedback = + new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Red].BrightnessFeedback); + GreenLedBrightnessFeedback = + new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Green].BrightnessFeedback); + BlueLedBrightnessFeedback = + new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback); + + if (_device != null) _device.BaseEvent += _device_BaseEvent; + } + + void _device_BaseEvent(GenericBase device, BaseEventArgs args) + { + switch (args.EventId) + { + case StatusSign.LedBrightnessFeedbackEventId: + RedLedBrightnessFeedback.FireUpdate(); + GreenLedBrightnessFeedback.FireUpdate(); + BlueLedBrightnessFeedback.FireUpdate(); + break; + case StatusSign.LedControlFeedbackEventId: + RedLedEnabledFeedback.FireUpdate(); + GreenLedEnabledFeedback.FireUpdate(); + BlueLedEnabledFeedback.FireUpdate(); + break; + } + } + + public void EnableLedControl(bool red, bool green, bool blue) + { + _device.Leds[(uint) StatusSign.Led.eLedColor.Red].Control.BoolValue = red; + _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Control.BoolValue = green; + _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Control.BoolValue = blue; + } + + public void SetColor(uint red, uint green, uint blue) + { + try + { + _device.Leds[(uint)StatusSign.Led.eLedColor.Red].Brightness = + (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(red); + } + catch (InvalidOperationException) + { + Debug.Console(1, this, "Error converting value to Red LED brightness. value: {0}", red); + } + try + { + _device.Leds[(uint)StatusSign.Led.eLedColor.Green].Brightness = + (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(green); + } + catch (InvalidOperationException) + { + Debug.Console(1, this, "Error converting value to Green LED brightness. value: {0}", green); + } + + try + { + _device.Leds[(uint)StatusSign.Led.eLedColor.Blue].Brightness = + (StatusSign.Led.eBrightnessPercentageValues)SimplSharpDeviceHelper.PercentToUshort(blue); + } + catch (InvalidOperationException) + { + Debug.Console(1, this, "Error converting value to Blue LED brightness. value: {0}", blue); + } + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new StatusSignControllerJoinMap(joinStart); + + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) joinMap = JsonConvert.DeserializeObject(joinMapSerialized); - bridge.AddJoinMap(Key, joinMap); - - Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - + bridge.AddJoinMap(Key, joinMap); + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + trilist.SetBoolSigAction(joinMap.RedControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetBoolSigAction(joinMap.GreenControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); trilist.SetBoolSigAction(joinMap.BlueControl.JoinNumber, b => EnableControl(trilist, joinMap, this)); @@ -139,44 +139,44 @@ namespace PepperDash.Essentials.Core.CrestronIO RedLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.RedLed.JoinNumber]); BlueLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.BlueLed.JoinNumber]); - GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); - } - - private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) + GreenLedBrightnessFeedback.LinkInputSig(trilist.UShortInput[joinMap.GreenLed.JoinNumber]); + } + + private static void EnableControl(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) { var redEnable = triList.BooleanOutput[joinMap.RedControl.JoinNumber].BoolValue; var greenEnable = triList.BooleanOutput[joinMap.GreenControl.JoinNumber].BoolValue; - var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; - device.EnableLedControl(redEnable, greenEnable, blueEnable); - } - - private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, - StatusSignController device) + var blueEnable = triList.BooleanOutput[joinMap.BlueControl.JoinNumber].BoolValue; + device.EnableLedControl(redEnable, greenEnable, blueEnable); + } + + private static void SetColor(BasicTriList triList, StatusSignControllerJoinMap joinMap, + StatusSignController device) { var redBrightness = triList.UShortOutput[joinMap.RedLed.JoinNumber].UShortValue; var greenBrightness = triList.UShortOutput[joinMap.GreenLed.JoinNumber].UShortValue; - var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; - - device.SetColor(redBrightness, greenBrightness, blueBrightness); - } - } - - public class StatusSignControllerFactory : EssentialsDeviceFactory - { - public StatusSignControllerFactory() - { - TypeNames = new List() { "statussign" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new StatusSign Device"); - - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - - return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem)); - } - } + var blueBrightness = triList.UShortOutput[joinMap.BlueLed.JoinNumber].UShortValue; + + device.SetColor(redBrightness, greenBrightness, blueBrightness); + } + } + + public class StatusSignControllerFactory : EssentialsDeviceFactory + { + public StatusSignControllerFactory() + { + TypeNames = new List() { "statussign" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new StatusSign Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem)); + } + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 91d35ac1..b0d4682d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using Crestron.SimplSharp; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Cards; @@ -383,6 +384,11 @@ namespace PepperDash.Essentials.DM } } + private void ChassisOnBaseEvent(GenericBase device, BaseEventArgs args) + { + + } + /// /// /// @@ -775,6 +781,20 @@ namespace PepperDash.Essentials.DM SystemIdBusyFeedback.FireUpdate(); break; } + case DMSystemEventIds.AudioBreakawayEventId: + { + Debug.Console(2, this, "AudioBreakaway Event: value: {0}", + (Chassis as DmMDMnxn).EnableAudioBreakawayFeedback.BoolValue); + EnableAudioBreakawayFeedback.FireUpdate(); + break; + } + case DMSystemEventIds.USBBreakawayEventId: + { + Debug.Console(2, this, "USBBreakaway Event: value: {0}", + (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue); + EnableUsbBreakawayFeedback.FireUpdate(); + break; + } } } @@ -1036,7 +1056,7 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, "Executing USB Input switch.\r\n in:{0} output: {1}", input, output); - if (input > chassisSize) + 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 @@ -1064,12 +1084,12 @@ namespace PepperDash.Essentials.DM Chassis.USBEnter.BoolValue = true; - if (Chassis.Inputs[input] == null) + if (Chassis.Inputs[output] == null) { return; } - Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[input], dmCard); - Chassis.Inputs[input].USBRoutedTo = dmCard; + Debug.Console(2, this, "Routing USB for input {0} to {1}", Chassis.Inputs[output], dmCard); + Chassis.Inputs[output].USBRoutedTo = dmCard; } } #endregion @@ -1105,6 +1125,19 @@ namespace PepperDash.Essentials.DM SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]); SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId.JoinNumber]); + EnableAudioBreakawayFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableAudioBreakaway.JoinNumber]); + EnableUsbBreakawayFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnableUsbBreakaway.JoinNumber]); + + trilist.OnlineStatusChange += (o, a) => + { + if (!a.DeviceOnLine) return; + + EnableAudioBreakawayFeedback.FireUpdate(); + EnableUsbBreakawayFeedback.FireUpdate(); + SystemIdBusyFeedback.FireUpdate(); + SystemIdFeebdack.FireUpdate(); + }; + // Link up outputs for (uint i = 1; i <= Chassis.NumberOfOutputs; i++) { From 39f25cc9db72c90c4398aeacd88e76b9dd6eec6e Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 12:43:00 -0600 Subject: [PATCH 016/150] Adds GetJoinMapForDevice method back somehow was missing from dev branch... --- .../PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 8f792659..fea4bbf1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -27,6 +27,11 @@ namespace PepperDash.Essentials.Core return joinMap; } + public static string GetJoinMapForDevice(string joinMapKey) + { + return GetSerializedJoinMapForDevice(joinMapKey); + } + /// /// Attempts to find a custom join map by key and returns it deserialized if found /// From 476d661ecee4f842b3efcfc59d8d3df598301b61 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 18 May 2020 17:47:14 -0600 Subject: [PATCH 017/150] removed duplicate method that somehow crept in... --- .../PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 0eb626f5..31616a6d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -27,11 +27,6 @@ namespace PepperDash.Essentials.Core return joinMap; } - public static string GetJoinMapForDevice(string joinMapKey) - { - return GetSerializedJoinMapForDevice(joinMapKey); - } - /// /// Attempts to get the serialized join map from config /// From 496b70f73ff60f951cc987609fc5c8b1936d6686 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 20 May 2020 08:43:18 -0600 Subject: [PATCH 018/150] Added event handler for VgaInput.Stream added logic to fire various feedback updates as required --- .../Transmitters/DmTx200Controller.cs | 151 ++++++++---------- .../Endpoints/Transmitters/DmTxHelpers.cs | 2 +- 2 files changed, 65 insertions(+), 88 deletions(-) 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 e75a9d55..32729092 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -1,8 +1,4 @@ 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.DM; @@ -12,7 +8,6 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { @@ -21,7 +16,7 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters /// - public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls + public class DmTx200Controller : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx200C2G Tx { get; private set; } @@ -52,15 +47,10 @@ namespace PepperDash.Essentials.DM Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog || Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable) return Tx.VideoSourceFeedback; - else // auto - { - if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue) - return DmTx200Base.eSourceSelection.Digital; - else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue) - return DmTx200Base.eSourceSelection.Analog; - else - return DmTx200Base.eSourceSelection.Disable; - } + if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue) + return DmTx200Base.eSourceSelection.Digital; + + return Tx.VgaInput.SyncDetectedFeedback.BoolValue ? DmTx200Base.eSourceSelection.Analog : DmTx200Base.eSourceSelection.Disable; } } @@ -106,45 +96,28 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualActiveVideoInput.ToString()); - Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); + Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent; + Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange; Tx.BaseEvent += Tx_BaseEvent; - Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); + Tx.OnlineStatusChange += Tx_OnlineStatusChange; - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); - HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => - { - if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) - return 1; - else - return 0; - }); + HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0); HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; - HdmiVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; - }); + HdmiVideoSyncFeedback = new BoolFeedback(() => tx.HdmiInput.SyncDetectedFeedback.BoolValue); - VgaVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; - }); + VgaVideoSyncFeedback = new BoolFeedback(() => tx.VgaInput.SyncDetectedFeedback.BoolValue); FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); - tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange; var combinedFuncs = new VideoStatusFuncsWrapper @@ -153,20 +126,13 @@ namespace PepperDash.Essentials.DM (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), - HdcpStateFeedbackFunc = () => - { - if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) - return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString(); - return ""; - }, + HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "", VideoResolutionFeedbackFunc = () => { if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) return tx.HdmiInput.VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) - return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); - return ""; + return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : ""; }, VideoSyncFeedbackFunc = () => (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital @@ -195,18 +161,32 @@ namespace PepperDash.Essentials.DM DmOutput.Port = Tx.DmOutput; } - void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) + private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + switch (args.EventId) + { + case EndpointInputStreamEventIds.FreeRunFeedbackEventId: + FreeRunEnabledFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; + } + } + + void VideoControls_ControlChange(object sender, GenericEventArgs args) { var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); - if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + switch (id) { - VgaBrightnessFeedback.FireUpdate(); - } - else if (id == VideoControlsEventIds.ContrastFeedbackEventId) - { - VgaContrastFeedback.FireUpdate(); + case VideoControlsEventIds.BrightnessFeedbackEventId: + VgaBrightnessFeedback.FireUpdate(); + break; + case VideoControlsEventIds.ContrastFeedbackEventId: + VgaContrastFeedback.FireUpdate(); + break; } } @@ -233,7 +213,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (HdmiVideoSyncFeedback != null) { @@ -253,14 +233,7 @@ namespace PepperDash.Essentials.DM /// public void SetFreeRunEnabled(bool enable) { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; } /// @@ -323,32 +296,35 @@ namespace PepperDash.Essentials.DM var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + switch (id) { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; } } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + switch (args.EventId) { - HdmiInHdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - HdmiInHdcpCapabilityFeedback.FireUpdate(); + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; } } @@ -357,11 +333,12 @@ namespace PepperDash.Essentials.DM /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + return; } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// 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 9fe81c92..bcdf1fbe 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -294,7 +294,7 @@ namespace PepperDash.Essentials.DM if (txFreeRun != null) { txFreeRun.FreeRunEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.FreeRunEnabled.JoinNumber]); - trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, new Action(txFreeRun.SetFreeRunEnabled)); + trilist.SetBoolSigAction(joinMap.FreeRunEnabled.JoinNumber, txFreeRun.SetFreeRunEnabled); } var txVga = tx as IVgaBrightnessContrastControls; From 2a9f6e253b024bb4077ad00adeef28e22f93b293 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 11:06:18 -0500 Subject: [PATCH 019/150] 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 /// public void SetFreeRunEnabled(bool enable) - { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } + { + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; } /// @@ -329,40 +318,40 @@ namespace PepperDash.Essentials.DM void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { var id = args.EventId; - Debug.Console(2, this, "EventId {0}", args.EventId); - - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } - + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; + } - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) - { - HdmiInHdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - HdmiInHdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId) - { - FreeRunEnabledFeedback.FireUpdate(); - } } /// @@ -370,11 +359,12 @@ namespace PepperDash.Essentials.DM /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + return; + } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// From e0e9fc2ce4e6f7d80e4f95caf15e6373f8302760 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 12:57:16 -0500 Subject: [PATCH 021/150] Updated DmTx201SController Added Decription Attribute to 200 and both 201 classes --- .../Transmitters/DmTx200Controller.cs | 3 +- .../Transmitters/DmTx201CController.cs | 30 ++-- .../Transmitters/DmTx201SController.cs | 152 ++++++++---------- 3 files changed, 82 insertions(+), 103 deletions(-) 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 32729092..e2c411eb 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -15,7 +15,8 @@ namespace PepperDash.Essentials.DM /// /// Controller class for all DM-TX-201C/S/F transmitters - /// + /// + [Description("Wrapper class for DM-TX-200-C Endpoint")] 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 21ef967a..91a011d0 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -1,29 +1,23 @@ -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.DM; -using Crestron.SimplSharpPro.DM.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -using PepperDash.Core; -using PepperDash.Essentials.Core; +using System; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { - // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - /// /// Controller class for all DM-TX-201C/S/F transmitters - /// + /// + [Description("Wrapper class for DM-TX-201-C Endpoint")] public class DmTx201CController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { - public DmTx201C Tx { get; private set; } // uses the 201S class as it is the base class for the 201C + public DmTx201C Tx { get; private set; } public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } public RoutingInputPortWithVideoStatuses VgaInput { 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 23e93b5d..fc7be4d9 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -1,8 +1,4 @@ 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.DM; @@ -12,18 +8,16 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { - // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - /// - /// Controller class for all DM-TX-201C/S/F transmitters + /// Controller class for all DM-TX-201S/F transmitters /// - public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFeedback, IHasFreeRun, IVgaBrightnessContrastControls + [Description("Wrapper class for DM-TX-201-S/F Endpoint")] + public class DmTx201SController : DmTxControllerBase, ITxRouting, IHasFreeRun, IVgaBrightnessContrastControls { - public DmTx201S Tx { get; private set; } // uses the 201S class as it is the base class for the 201C + public DmTx201S Tx { get; private set; } public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } public RoutingInputPortWithVideoStatuses VgaInput { get; private set; } @@ -107,43 +101,29 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualActiveVideoInput.ToString()); - Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); + Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent; + Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange; Tx.BaseEvent += Tx_BaseEvent; Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => - { - if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) - return 1; - else - return 0; - }); + (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0)); - HdmiVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; - }); + HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue); - VgaVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; - }); + VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue); FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); - tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); + tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange; HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; @@ -153,21 +133,17 @@ namespace PepperDash.Essentials.DM (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), - HdcpStateFeedbackFunc = () => - { - if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) - return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString(); - return ""; - }, + HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? + tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "", VideoResolutionFeedbackFunc = () => { if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) return tx.HdmiInput.VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) - return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); - return ""; + return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? + tx.VgaInput.VideoAttributes.GetVideoResolutionString() : ""; }, + VideoSyncFeedbackFunc = () => (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital && tx.HdmiInput.SyncDetectedFeedback.BoolValue) @@ -203,13 +179,14 @@ namespace PepperDash.Essentials.DM var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); - if (id == VideoControlsEventIds.BrightnessFeedbackEventId) + switch (id) { - VgaBrightnessFeedback.FireUpdate(); - } - else if (id == VideoControlsEventIds.ContrastFeedbackEventId) - { - VgaContrastFeedback.FireUpdate(); + case VideoControlsEventIds.BrightnessFeedbackEventId: + VgaBrightnessFeedback.FireUpdate(); + break; + case VideoControlsEventIds.ContrastFeedbackEventId: + VgaContrastFeedback.FireUpdate(); + break; } } @@ -221,6 +198,19 @@ namespace PepperDash.Essentials.DM } + private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + switch (args.EventId) + { + case EndpointInputStreamEventIds.FreeRunFeedbackEventId: + FreeRunEnabledFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; + } + } + public override bool CustomActivate() { Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId); @@ -235,7 +225,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (HdmiVideoSyncFeedback != null) { @@ -255,14 +245,7 @@ namespace PepperDash.Essentials.DM /// public void SetFreeRunEnabled(bool enable) { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; } /// @@ -331,38 +314,38 @@ namespace PepperDash.Essentials.DM var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + switch (id) { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } - } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + switch (args.EventId) { - HdmiInHdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - HdmiInHdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.FreeRunFeedbackEventId) - { - FreeRunEnabledFeedback.FireUpdate(); + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; } + } /// @@ -370,11 +353,12 @@ namespace PepperDash.Essentials.DM /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + return; } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// From 102535cd0436f099d24eabd3d8ff72c0f8d23899 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 13:42:39 -0500 Subject: [PATCH 022/150] Updated DmTx401CController #200 --- .../Transmitters/DmTx200Controller.cs | 7 +- .../Transmitters/DmTx201CController.cs | 2 +- .../Transmitters/DmTx201SController.cs | 2 +- .../Transmitters/DmTx401CController.cs | 255 ++++++++++-------- 4 files changed, 145 insertions(+), 121 deletions(-) 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 e2c411eb..cbe3ebcc 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx200Controller.cs @@ -146,9 +146,10 @@ namespace PepperDash.Essentials.DM }; AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); - DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this); + DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, null, this); AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, @@ -324,7 +325,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - VgaVideoSyncFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); break; } } 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 91a011d0..dcf5c068 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201CController.cs @@ -342,7 +342,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - VgaVideoSyncFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); break; } 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 fc7be4d9..27e78256 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx201SController.cs @@ -342,7 +342,7 @@ namespace PepperDash.Essentials.DM HdmiInHdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: - VgaVideoSyncFeedback.FireUpdate(); + HdmiVideoSyncFeedback.FireUpdate(); break; } 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 46cae247..c47dc4ac 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx401CController.cs @@ -19,12 +19,10 @@ namespace PepperDash.Essentials.DM { using eVst = DmTx401C.eSourceSelection; - public class DmTx401CController : DmTxControllerBase, ITxRouting, IHasFeedback, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls + public class DmTx401CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts, IHasFreeRun, IVgaBrightnessContrastControls { public DmTx401C Tx { get; private set; } - - public RoutingInputPortWithVideoStatuses HdmiIn { get; private set; } public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; } public RoutingInputPortWithVideoStatuses VgaIn { get; private set; } @@ -114,53 +112,38 @@ namespace PepperDash.Essentials.DM VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); CompositeIn = new RoutingInputPortWithVideoStatuses(DmPortName.CompositeIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, eVst.Composite, this, - VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); + VideoStatusHelper.GetVgaInputStatusFuncs(tx.VgaInput)); + + Tx.HdmiInput.InputStreamChange += HdmiInputStreamChangeEvent; + Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChangeEvent; + Tx.BaseEvent += Tx_BaseEvent; + Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange; + tx.VgaInput.VideoControls.ControlChange += VideoControls_ControlChange; - Tx.BaseEvent += Tx_BaseEvent; ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", - () => ActualVideoInput.ToString()); + () => ActualVideoInput.ToString()); + + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); + + HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0); - HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => - { - if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue) - return 1; - else - return 0; - }); - - HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; - - DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => - { - return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; - }); - - HdmiVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; - }); - - VgaVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; - }); + HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; + + DisplayPortVideoSyncFeedback = new BoolFeedback("DisplayPortVideoSync", () => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue); + + HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue); + + VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue); FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); VgaBrightnessFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.BrightnessFeedback.UShortValue); + VgaContrastFeedback = new IntFeedback(() => tx.VgaInput.VideoControls.ContrastFeedback.UShortValue); - tx.VgaInput.VideoControls.ControlChange += new Crestron.SimplSharpPro.DeviceSupport.GenericEventHandler(VideoControls_ControlChange); var combinedFuncs = new VideoStatusFuncsWrapper { @@ -238,7 +221,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (HdmiVideoSyncFeedback != null) { @@ -298,86 +281,82 @@ namespace PepperDash.Essentials.DM Tx.VideoSource = (eVst)inputSelector; if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) Tx.AudioSource = (eVst)inputSelector; + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } + } + + void VideoControls_ControlChange(object sender, GenericEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case VideoControlsEventIds.BrightnessFeedbackEventId: + VgaBrightnessFeedback.FireUpdate(); + break; + case VideoControlsEventIds.ContrastFeedbackEventId: + VgaContrastFeedback.FireUpdate(); + break; + } } - - void Tx_BaseEvent(GenericBase device, BaseEventArgs args) - { - var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } - } - - void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) - { - var id = args.EventId; - Debug.Console(2, this, "EventId {0}", args.EventId); - - if (id == VideoControlsEventIds.BrightnessFeedbackEventId) - { - VgaBrightnessFeedback.FireUpdate(); - } - else if (id == VideoControlsEventIds.ContrastFeedbackEventId) - { - VgaContrastFeedback.FireUpdate(); - } - } - - /// - /// Enables or disables free run - /// - /// - public void SetFreeRunEnabled(bool enable) - { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } - } - - /// - /// Sets the VGA brightness level - /// - /// - public void SetVgaBrightness(ushort level) - { - Tx.VgaInput.VideoControls.Brightness.UShortValue = level; - } - - /// - /// Sets the VGA contrast level - /// - /// - public void SetVgaContrast(ushort level) - { - Tx.VgaInput.VideoControls.Contrast.UShortValue = level; + + /// + /// Enables or disables free run + /// + /// + public void SetFreeRunEnabled(bool enable) + { + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; + } + + /// + /// Sets the VGA brightness level + /// + /// + public void SetVgaBrightness(ushort level) + { + Tx.VgaInput.VideoControls.Brightness.UShortValue = level; + } + + /// + /// Sets the VGA contrast level + /// + /// + public void SetVgaContrast(ushort level) + { + Tx.VgaInput.VideoControls.Contrast.UShortValue = level; } /// /// Relays the input stream change to the appropriate RoutingInputPort. - /// - void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } - } + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + return; + } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } /// /// Relays the VideoAttributes change to a RoutingInputPort @@ -407,7 +386,51 @@ namespace PepperDash.Essentials.DM AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); break; } - } + } + + void HdmiInputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + HdmiVideoSyncFeedback.FireUpdate(); + break; + } + } + + void DisplayPortInputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + DisplayPortVideoSyncFeedback.FireUpdate(); + break; + } + } + + private void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + switch (args.EventId) + { + case EndpointInputStreamEventIds.FreeRunFeedbackEventId: + FreeRunEnabledFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; + } + } + #region IIROutputPorts Members From 76abd05830abe554d26fa0ab2dec83eef69309c2 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 13:55:37 -0500 Subject: [PATCH 023/150] Updated DmTx4k202CController #200 --- .../Transmitters/DmTx4k202CController.cs | 109 ++++++++---------- 1 file changed, 48 insertions(+), 61 deletions(-) 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 460876b4..0f9fa19d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -98,38 +98,21 @@ namespace PepperDash.Essentials.DM Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; - Tx.BaseEvent += Tx_BaseEvent; + Tx.BaseEvent += Tx_BaseEvent; + + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); - HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => - { - return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback; - }); + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); - HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => - { - return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback; - }); + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - Hdmi1VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; - }); + Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); - Hdmi2VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; - }); + Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); var combinedFuncs = new VideoStatusFuncsWrapper { @@ -285,52 +268,56 @@ namespace PepperDash.Essentials.DM void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); + break; } } void Tx_BaseEvent(GenericBase device, BaseEventArgs args) - { - var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } } /// /// Relays the input stream change to the appropriate RoutingInputPort. /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } + { + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + return; + } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// From dd0a52c1a2008acd9d086534f5bb269b5e7c11dd Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 14:10:27 -0500 Subject: [PATCH 024/150] Updated dmTx402302CController Updated DmTx4k202CController #200 --- .../Transmitters/DmTx4k202CController.cs | 55 ++-- .../Transmitters/DmTx4k302CController.cs | 240 ++++++++---------- 2 files changed, 139 insertions(+), 156 deletions(-) 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 0f9fa19d..59d05bf4 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -186,7 +186,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (Hdmi1VideoSyncFeedback != null) { @@ -200,64 +200,65 @@ namespace PepperDash.Essentials.DM LinkDmTxToApi(this, trilist, joinMap, bridge); } - public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) - { - Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); - - if (type == eRoutingSignalType.Video) - { - switch (input) - { - case 0: + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) + { + Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); + + switch (type) + { + case eRoutingSignalType.Video: + switch (input) + { + case 0: { ExecuteSwitch(eVst.Auto, null, type); break; } - case 1: + case 1: { ExecuteSwitch(HdmiIn1.Selector, null, type); break; } - case 2: + case 2: { ExecuteSwitch(HdmiIn2.Selector, null, type); break; } - case 3: + case 3: { ExecuteSwitch(eVst.AllDisabled, null, type); break; } - } - } - else if (type == eRoutingSignalType.Audio) - { - switch (input) - { - case 0: + } + break; + case eRoutingSignalType.Audio: + switch (input) + { + case 0: { ExecuteSwitch(eAst.Auto, null, type); break; } - case 1: + case 1: { ExecuteSwitch(eAst.Hdmi1, null, type); break; } - case 2: + case 2: { ExecuteSwitch(eAst.Hdmi2, null, type); break; } - case 3: + case 3: { ExecuteSwitch(eAst.AllDisabled, null, type); break; } - } - } - } - + } + break; + } + } + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) { if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) 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 7d787051..4e0c7fec 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -105,44 +105,24 @@ namespace PepperDash.Essentials.DM () => ActualActiveVideoInput.ToString()); Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; - Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; + Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; + Tx.VgaInput.InputStreamChange += VgaInputOnInputStreamChange; Tx.BaseEvent += Tx_BaseEvent; - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); - HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => - { - return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback; - }); + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); - HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => - { - return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback; - }); + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - Hdmi1VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; - }); + Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); - Hdmi2VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; - }); + Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); - VgaVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue; - }); + VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue); FreeRunEnabledFeedback = new BoolFeedback(() => tx.VgaInput.FreeRunFeedback == eDmFreeRunSetting.Enabled); @@ -164,9 +144,7 @@ namespace PepperDash.Essentials.DM { if (ActualActiveVideoInput == eVst.Hdmi1) return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); - if (ActualActiveVideoInput == eVst.Hdmi2) - return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); - return ""; + return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : ""; }, VideoResolutionFeedbackFunc = () => @@ -175,9 +153,7 @@ namespace PepperDash.Essentials.DM return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); if (ActualActiveVideoInput == eVst.Hdmi2) return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == eVst.Vga) - return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); - return ""; + return ActualActiveVideoInput == eVst.Vga ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : ""; }, VideoSyncFeedbackFunc = () => (ActualActiveVideoInput == eVst.Hdmi1 @@ -209,20 +185,34 @@ namespace PepperDash.Essentials.DM HdmiIn2.Port = Tx.HdmiInputs[2]; HdmiLoopOut.Port = Tx.HdmiOutput; DmOut.Port = Tx.DmOutput; - } + } + + void VgaInputOnInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + switch (args.EventId) + { + case EndpointInputStreamEventIds.FreeRunFeedbackEventId: + FreeRunEnabledFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + VgaVideoSyncFeedback.FireUpdate(); + break; + } + } void VideoControls_ControlChange(object sender, Crestron.SimplSharpPro.DeviceSupport.GenericEventArgs args) { var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); - if (id == VideoControlsEventIds.BrightnessFeedbackEventId) - { - VgaBrightnessFeedback.FireUpdate(); - } - else if (id == VideoControlsEventIds.ContrastFeedbackEventId) - { - VgaContrastFeedback.FireUpdate(); + switch (id) + { + case VideoControlsEventIds.BrightnessFeedbackEventId: + VgaBrightnessFeedback.FireUpdate(); + break; + case VideoControlsEventIds.ContrastFeedbackEventId: + VgaContrastFeedback.FireUpdate(); + break; } } @@ -246,7 +236,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (Hdmi1VideoSyncFeedback != null) { @@ -268,18 +258,11 @@ namespace PepperDash.Essentials.DM /// Enables or disables free run /// /// - public void SetFreeRunEnabled(bool enable) - { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } - } - + public void SetFreeRunEnabled(bool enable) + { + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; + } + /// /// Sets the VGA brightness level /// @@ -300,74 +283,75 @@ namespace PepperDash.Essentials.DM - public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) - { - Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); - - if (type == eRoutingSignalType.Video) - { - switch (input) - { - case 0: + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) + { + Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); + + switch (type) + { + case eRoutingSignalType.Video: + switch (input) + { + case 0: { ExecuteSwitch(eVst.Auto, null, type); break; } - case 1: + case 1: { ExecuteSwitch(HdmiIn1.Selector, null, type); break; } - case 2: + case 2: { ExecuteSwitch(HdmiIn2.Selector, null, type); break; } - case 3: + case 3: { ExecuteSwitch(VgaIn.Selector, null, type); break; } - case 4: + case 4: { ExecuteSwitch(eVst.AllDisabled, null, type); break; } - } - } - else if (type == eRoutingSignalType.Audio) - { - switch (input) - { - case 0: + } + break; + case eRoutingSignalType.Audio: + switch (input) + { + case 0: { ExecuteSwitch(eAst.Auto, null, type); break; } - case 1: + case 1: { ExecuteSwitch(eAst.Hdmi1, null, type); break; } - case 2: + case 2: { ExecuteSwitch(eAst.Hdmi2, null, type); break; } - case 3: + case 3: { ExecuteSwitch(eAst.AudioIn, null, type); break; } - case 4: + case 4: { ExecuteSwitch(eAst.AllDisabled, null, type); break; } - } - } - } - + } + break; + } + } + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) { if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) @@ -376,54 +360,52 @@ namespace PepperDash.Essentials.DM Tx.AudioSource = (eAst)inputSelector; } - void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) - { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - } - - void Tx_BaseEvent(GenericBase device, BaseEventArgs args) - { - var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) - { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); - } - } - - /// + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) + HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + else if (inputStream == Tx.HdmiInputs[2]) + HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) + HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + else if (inputStream == Tx.HdmiInputs[2]) + HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + } + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + switch (id) + { + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } + } + + /// /// Relays the input stream change to the appropriate RoutingInputPort. /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } + { + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return; + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// From d0ee05def9d836549ca95be1956564acc2304167 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 14:19:19 -0500 Subject: [PATCH 025/150] Updated DmTx4kz100Controller Updated DmTx4k302CController #200 --- .../Transmitters/DmTx4k302CController.cs | 16 ++--- .../Transmitters/DmTx4kz100Controller.cs | 72 ++++++++----------- 2 files changed, 36 insertions(+), 52 deletions(-) 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 4e0c7fec..e2bc74de 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k302CController.cs @@ -367,16 +367,16 @@ namespace PepperDash.Essentials.DM switch (args.EventId) { case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); break; case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); break; } } 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 036602d3..dbe1c103 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs @@ -93,9 +93,9 @@ namespace PepperDash.Essentials.DM ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", () => ActualActiveVideoInput.ToString()); - Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent); + Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent; Tx.BaseEvent += Tx_BaseEvent; - Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange); + Tx.OnlineStatusChange += Tx_OnlineStatusChange; HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => @@ -108,10 +108,7 @@ namespace PepperDash.Essentials.DM HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; - HdmiVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue; - }); + HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue); var combinedFuncs = new VideoStatusFuncsWrapper @@ -120,20 +117,13 @@ namespace PepperDash.Essentials.DM (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue), - HdcpStateFeedbackFunc = () => - { - if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) - return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString(); - return ""; - }, + HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "", VideoResolutionFeedbackFunc = () => { if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital) return tx.HdmiInput.VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog) - return tx.VgaInput.VideoAttributes.GetVideoResolutionString(); - return ""; + return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : ""; }, VideoSyncFeedbackFunc = () => (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital @@ -180,7 +170,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (HdmiVideoSyncFeedback != null) { @@ -196,14 +186,7 @@ namespace PepperDash.Essentials.DM /// public void SetFreeRunEnabled(bool enable) { - if (enable) - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled; - } - else - { - Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled; - } + Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled; } /// @@ -230,16 +213,15 @@ namespace PepperDash.Essentials.DM var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + switch (id) { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + break; } } @@ -247,13 +229,17 @@ namespace PepperDash.Essentials.DM { Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + switch (args.EventId) { - HdmiInHdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - HdmiInHdcpCapabilityFeedback.FireUpdate(); + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + HdmiInHdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + HdmiVideoSyncFeedback.FireUpdate(); + break; } } @@ -262,11 +248,9 @@ namespace PepperDash.Essentials.DM /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return; + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// From 4f5b649b1ddb9d2a88188e7f27f99d0bdb9f42f0 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 14:30:54 -0500 Subject: [PATCH 026/150] Updated DmTx4kz302CController #200 --- .../Transmitters/DmTx4kz302CController.cs | 112 ++++++++---------- 1 file changed, 49 insertions(+), 63 deletions(-) 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 c0aebfae..b6fa24ee 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -104,43 +104,23 @@ namespace PepperDash.Essentials.DM Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; + Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChange; Tx.BaseEvent += Tx_BaseEvent; - VideoSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.VideoSourceFeedback; - }); - AudioSourceNumericFeedback = new IntFeedback(() => - { - return (int)Tx.AudioSourceFeedback; - }); + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); - HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => - { - return (int)tx.HdmiInputs[1].HdcpCapabilityFeedback; - }); + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); - HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => - { - return (int)tx.HdmiInputs[2].HdcpCapabilityFeedback; - }); + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - Hdmi1VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue; - }); + Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); - Hdmi2VideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue; - }); + Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); - DisplayPortVideoSyncFeedback = new BoolFeedback(() => - { - return (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue; - }); + DisplayPortVideoSyncFeedback = new BoolFeedback(() => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue); var combinedFuncs = new VideoStatusFuncsWrapper @@ -155,9 +135,7 @@ namespace PepperDash.Essentials.DM { if (ActualActiveVideoInput == eVst.Hdmi1) return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); - if (ActualActiveVideoInput == eVst.Hdmi2) - return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); - return ""; + return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : ""; }, VideoResolutionFeedbackFunc = () => @@ -166,9 +144,7 @@ namespace PepperDash.Essentials.DM return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); if (ActualActiveVideoInput == eVst.Hdmi2) return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == eVst.Vga) - return tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString(); - return ""; + return ActualActiveVideoInput == eVst.Vga ? tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString() : ""; }, VideoSyncFeedbackFunc = () => (ActualActiveVideoInput == eVst.Hdmi1 @@ -202,6 +178,18 @@ namespace PepperDash.Essentials.DM DmOut.Port = Tx.DmOutput; } + void DisplayPortInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + DisplayPortVideoSyncFeedback.FireUpdate(); + break; + } + } + public override bool CustomActivate() @@ -222,7 +210,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (Hdmi1VideoSyncFeedback != null) { @@ -291,37 +279,37 @@ namespace PepperDash.Essentials.DM { Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); - if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId) + switch (args.EventId) { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); - } - else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId) - { - if (inputStream == Tx.HdmiInputs[1]) - HdmiIn1HdcpCapabilityFeedback.FireUpdate(); - else if (inputStream == Tx.HdmiInputs[2]) - HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); + break; } } void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { var id = args.EventId; - if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId) + switch (id) { - Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); - VideoSourceNumericFeedback.FireUpdate(); - ActiveVideoInputFeedback.FireUpdate(); - } - - // ------------------------------ incomplete ----------------------------------------- - else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId) - { - Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); - AudioSourceNumericFeedback.FireUpdate(); + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + VideoSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; } } @@ -330,11 +318,9 @@ namespace PepperDash.Essentials.DM /// void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) { - if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) - { - inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return; + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); } /// From 0dad34893e99bd88723864ffe09a4b78bab57440 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 16:44:38 -0500 Subject: [PATCH 027/150] Updated GenericRelayDevice #205 --- .../Crestron IO/Relay/GenericRelayDevice.cs | 189 ++++++++++++------ 1 file changed, 125 insertions(+), 64 deletions(-) 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 b79a8253..3eccb1e4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -29,9 +29,64 @@ namespace PepperDash.Essentials.Core.CrestronIO RelayOutput = relay; RelayOutput.Register(); - RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange); - } - + RelayOutput.StateChange += RelayOutput_StateChange; + } + + public GenericRelayDevice(string key, string name, Func postActivationFunc, + IOPortConfig config) + : base(key, name ) + { + + AddPostActivationAction(() => + { + RelayOutput = postActivationFunc(config); + + RelayOutput.Register(); + + RelayOutput.StateChange += RelayOutput_StateChange; + + }); + } + + private static Relay GetRelay(IOPortConfig dc) + { + + IRelayPorts relayDevice; + + if(dc.PortDeviceKey.Equals("processor")) + { + if (!Global.ControlSystem.SupportsRelay) + { + Debug.Console(0, "GetRelayDevice: Processor does not support relays"); + return null; + } + relayDevice = Global.ControlSystem; + } + else + { + var relayDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IRelayPorts; + if (relayDev == null) + { + Debug.Console(0, "GetRelayDevice: Device {0} is not a valid device", dc.PortDeviceKey); + return null; + } + relayDevice = relayDev; + } + if (relayDevice == null) + { + Debug.Console(0, "GetRelayDevice: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey); + return null; + } + + if (dc.PortNumber > relayDevice.NumberOfRelayPorts) + { + Debug.Console(0, "GetRelayDevice: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber); + } + + return relayDevice.RelayPorts[dc.PortNumber]; + + } + void RelayOutput_StateChange(Relay relay, RelayEventArgs args) { OutputIsOnFeedback.FireUpdate(); @@ -99,76 +154,82 @@ namespace PepperDash.Essentials.Core.CrestronIO // feedback for relay state OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); - } - } + } + + public class GenericRelayDeviceFactory : EssentialsDeviceFactory + { + public GenericRelayDeviceFactory() + { + TypeNames = new List() { "relayoutput" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + if (props == null) return null; + + var portDevice = new GenericRelayDevice(dc.Key, dc.Name, GetRelay, props); + + return portDevice; + + + /* + if (props.PortDeviceKey == "processor") + portDevice = Global.ControlSystem as IRelayPorts; + else + portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts; - public class GenericRelayDeviceFactory : EssentialsDeviceFactory - { - public GenericRelayDeviceFactory() - { - TypeNames = new List() { "relayoutput" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - var key = dc.Key; - - IRelayPorts portDevice; - - if (props.PortDeviceKey == "processor") - portDevice = Global.ControlSystem as IRelayPorts; - else - portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IRelayPorts; - - if (portDevice == null) - Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key); - else - { - var cs = (portDevice as CrestronControlSystem); - - if (cs != null) - { - // The relay is on a control system processor - if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts) - { - Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays"); - return null; - } - } + if (portDevice == null) + Debug.Console(0, "Unable to add relay device with key '{0}'. Port Device does not support relays", key); else { - // The relay is on another device type + var cs = (portDevice as CrestronControlSystem); - if (props.PortNumber > portDevice.NumberOfRelayPorts) + if (cs != null) { - Debug.Console(0, "Port Device: {0} does not have enough relays"); - return null; + // The relay is on a control system processor + if (!cs.SupportsRelay || props.PortNumber > cs.NumberOfRelayPorts) + { + Debug.Console(0, "Port Device: {0} does not support relays or does not have enough relays"); + return null; + } } - } - - Relay relay = portDevice.RelayPorts[props.PortNumber]; - - if (!relay.Registered) - { - if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success) - return new GenericRelayDevice(key, relay); else - Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); + { + // The relay is on another device type + + if (props.PortNumber > portDevice.NumberOfRelayPorts) + { + Debug.Console(0, "Port Device: {0} does not have enough relays"); + return null; + } + } + + Relay relay = portDevice.RelayPorts[props.PortNumber]; + + if (!relay.Registered) + { + if (relay.Register() == eDeviceRegistrationUnRegistrationResponse.Success) + return new GenericRelayDevice(key, relay); + else + Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); + } + else + { + return new GenericRelayDevice(key, relay); + } + + // Future: Check if portDevice is 3-series card or other non control system that supports versiports } - else - { - return new GenericRelayDevice(key, relay); - } - - // Future: Check if portDevice is 3-series card or other non control system that supports versiports - } - - return null; - + */ + + } } + } + } \ No newline at end of file From 19e78d649fc0c49cc30855fdbbcf3f4f41778321 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 17:07:58 -0500 Subject: [PATCH 028/150] Updated GenericDigitalInputDevice Compatibility Update to GenericRelayDevice #205 --- .../Inputs/GenericDigitalInputDevice.cs | 206 +++++++++--------- .../Crestron IO/Relay/GenericRelayDevice.cs | 91 +++++--- 2 files changed, 156 insertions(+), 141 deletions(-) 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 774c7490..4c499b6b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -26,23 +26,78 @@ namespace PepperDash.Essentials.Core.CrestronIO return () => InputPort.State; } } - - public GenericDigitalInputDevice(string key, DigitalInput inputPort): - base(key) - { - InputStateFeedback = new BoolFeedback(InputStateFeedbackFunc); - - InputPort = inputPort; - - InputPort.StateChange += InputPort_StateChange; - - } - + + + public GenericDigitalInputDevice(string key, string name, Func postActivationFunc, + IOPortConfig config) + : base(key, name) + { + + AddPostActivationAction(() => + { + InputPort = postActivationFunc(config); + + InputPort.Register(); + + InputPort.StateChange += InputPort_StateChange; + + }); + } + + #region Events + void InputPort_StateChange(DigitalInput digitalInput, DigitalInputEventArgs args) { - InputStateFeedback.FireUpdate(); - } - + InputStateFeedback.FireUpdate(); + } + + #endregion + + #region PreActivate + + private static DigitalInput GetDigitalInput(IOPortConfig dc) + { + IDigitalInputPorts ioPortDevice; + + if (dc.PortDeviceKey.Equals("processor")) + { + if (!Global.ControlSystem.SupportsDigitalInput) + { + Debug.Console(0, "GetDigitalInput: Processor does not support Digital Inputs"); + return null; + } + ioPortDevice = Global.ControlSystem; + } + else + { + var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IDigitalInputPorts; + if (ioPortDev == null) + { + Debug.Console(0, "GetDigitalInput: Device {0} is not a valid device", dc.PortDeviceKey); + return null; + } + ioPortDevice = ioPortDev; + } + if (ioPortDevice == null) + { + Debug.Console(0, "GetDigitalInput: Device '0' is not a valid IRelayPorts Device", dc.PortDeviceKey); + return null; + } + + if (dc.PortNumber > ioPortDevice.NumberOfDigitalInputPorts) + { + Debug.Console(0, "GetDigitalInput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber); + } + + return ioPortDevice.DigitalInputPorts[dc.PortNumber]; + + + } + + #endregion + + #region Bridge Linking + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new IDigitalInputJoinMap(joinStart); @@ -65,98 +120,37 @@ namespace PepperDash.Essentials.Core.CrestronIO { Debug.Console(1, this, "Unable to link device '{0}'. Input is null", Key); Debug.Console(1, this, "Error: {0}", e); - } - } + } + } + + #endregion + + #region Factory + + public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory + { + public GenericDigitalInputDeviceFactory() + { + TypeNames = new List() { "digitalinput" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new Generic Relay Device"); + + var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + + if (props == null) return null; + + var portDevice = new GenericDigitalInputDevice(dc.Key, dc.Name, GetDigitalInput, props); + + return portDevice; + } + } + + #endregion + } - public class GenericDigitalInputDeviceFactory : EssentialsDeviceFactory - { - public GenericDigitalInputDeviceFactory() - { - TypeNames = new List() { "digitalinput" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new Digtal Input Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - - IDigitalInputPorts portDevice; - - if (props.PortDeviceKey == "processor") - portDevice = Global.ControlSystem as IDigitalInputPorts; - else - portDevice = DeviceManager.GetDeviceForKey(props.PortDeviceKey) as IDigitalInputPorts; - - if (portDevice == null) - Debug.Console(0, "ERROR: Unable to add digital input device with key '{0}'. Port Device does not support digital inputs", dc.Key); - else - { - var cs = (portDevice as CrestronControlSystem); - if (cs == null) - { - Debug.Console(0, "ERROR: Port device for [{0}] is not control system", props.PortDeviceKey); - return null; - } - - if (cs.SupportsVersiport) - { - Debug.Console(1, "Attempting to add Digital Input device to Versiport port '{0}'", props.PortNumber); - - if (props.PortNumber > cs.NumberOfVersiPorts) - { - Debug.Console(0, "WARNING: Cannot add Vesiport {0} on {1}. Out of range", - props.PortNumber, props.PortDeviceKey); - return null; - } - - Versiport vp = cs.VersiPorts[props.PortNumber]; - - if (!vp.Registered) - { - var regSuccess = vp.Register(); - if (regSuccess == eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(1, "Successfully Created Digital Input Device on Versiport"); - return new GenericVersiportDigitalInputDevice(dc.Key, vp, props); - } - else - { - Debug.Console(0, "WARNING: Attempt to register versiport {0} on device with key '{1}' failed: {2}", - props.PortNumber, props.PortDeviceKey, regSuccess); - return null; - } - } - } - else if (cs.SupportsDigitalInput) - { - Debug.Console(1, "Attempting to add Digital Input device to Digital Input port '{0}'", props.PortNumber); - - if (props.PortNumber > cs.NumberOfDigitalInputPorts) - { - Debug.Console(0, "WARNING: Cannot register DIO port {0} on {1}. Out of range", - props.PortNumber, props.PortDeviceKey); - return null; - } - - DigitalInput digitalInput = cs.DigitalInputPorts[props.PortNumber]; - - if (!digitalInput.Registered) - { - if (digitalInput.Register() == eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(1, "Successfully Created Digital Input Device on Digital Input"); - return new GenericDigitalInputDevice(dc.Key, digitalInput); - } - else - Debug.Console(0, "WARNING: Attempt to register digital input {0} on device with key '{1}' failed.", - props.PortNumber, props.PortDeviceKey); - } - } - } - return null; - } - } } \ No newline at end of file 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 3eccb1e4..6198be9f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -19,22 +19,23 @@ namespace PepperDash.Essentials.Core.CrestronIO { public Relay RelayOutput { get; private set; } - public BoolFeedback OutputIsOnFeedback { get; private set; } - - public GenericRelayDevice(string key, Relay relay): - base(key) - { - OutputIsOnFeedback = new BoolFeedback(new Func(() => RelayOutput.State)); - - RelayOutput = relay; - RelayOutput.Register(); - - RelayOutput.StateChange += RelayOutput_StateChange; + public BoolFeedback OutputIsOnFeedback { get; private set; } + + //Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor + public GenericRelayDevice(string key, Relay relay) : + base(key) + { + OutputIsOnFeedback = new BoolFeedback(new Func(() => RelayOutput.State)); + + RelayOutput = relay; + RelayOutput.Register(); + + RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange); } public GenericRelayDevice(string key, string name, Func postActivationFunc, IOPortConfig config) - : base(key, name ) + : base(key, name) { AddPostActivationAction(() => @@ -48,6 +49,8 @@ namespace PepperDash.Essentials.Core.CrestronIO }); } + #region PreActivate + private static Relay GetRelay(IOPortConfig dc) { @@ -84,31 +87,40 @@ namespace PepperDash.Essentials.Core.CrestronIO } return relayDevice.RelayPorts[dc.PortNumber]; - } + #endregion + + #region Events + void RelayOutput_StateChange(Relay relay, RelayEventArgs args) { - OutputIsOnFeedback.FireUpdate(); + OutputIsOnFeedback.FireUpdate(); } - public void OpenRelay() - { - RelayOutput.State = false; - } - - public void CloseRelay() - { - RelayOutput.State = true; - } - - public void ToggleRelayState() - { - if (RelayOutput.State == true) - OpenRelay(); - else - CloseRelay(); + #endregion + + #region Methods + + public void OpenRelay() + { + RelayOutput.State = false; + } + + public void CloseRelay() + { + RelayOutput.State = true; + } + + public void ToggleRelayState() + { + if (RelayOutput.State == true) + OpenRelay(); + else + CloseRelay(); } + + #endregion #region ISwitchedOutput Members @@ -122,8 +134,10 @@ namespace PepperDash.Essentials.Core.CrestronIO OpenRelay(); } - #endregion - + #endregion + + #region Bridge Linking + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GenericRelayControllerJoinMap(joinStart); @@ -153,9 +167,13 @@ namespace PepperDash.Essentials.Core.CrestronIO // feedback for relay state - OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); + OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]); } + #endregion + + #region Factory + public class GenericRelayDeviceFactory : EssentialsDeviceFactory { public GenericRelayDeviceFactory() @@ -227,8 +245,11 @@ namespace PepperDash.Essentials.Core.CrestronIO */ } - } - + } + + #endregion + + } From 190697d855141abf24e1706108f95f11c7d21e7a Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 21:53:48 -0500 Subject: [PATCH 029/150] Updated IRPortHelper Updated IrOurputPortController #205 Please Check my work - I'm a little less confident in this one --- .../Config/Comm and IR/IRPortHelper.cs | 189 ++++++++++++------ .../Devices/IrOutputPortController.cs | 26 ++- 2 files changed, 152 insertions(+), 63 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs index 015b03ea..28a7eb9f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/IRPortHelper.cs @@ -78,70 +78,145 @@ namespace PepperDash.Essentials.Core portDevKey, portNum); return port; } - } + } + + public static IROutputPort GetIrOutputPort(DeviceConfig dc) + { + var irControllerKey = dc.Key + "-ir"; + if (dc.Properties == null) + { + Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", dc.Key); + return null; + } + + var control = dc.Properties["control"]; + if (control == null) + { + Debug.Console(0, + "WARNING: Device config does not include control properties. IR will not function for {0}", dc.Key); + return null; + } + + var portDevKey = control.Value("controlPortDevKey"); + var portNum = control.Value("controlPortNumber"); + IIROutputPorts irDev = null; + + if (portDevKey == null) + { + Debug.Console(0, "WARNING: control properties is missing ir device for {0}", dc.Key); + return null; + } + + if (portNum == 0) + { + Debug.Console(0, "WARNING: control properties is missing ir port number for {0}", dc.Key); + return null; + } + + if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) + || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) + irDev = Global.ControlSystem; + else + irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; + + if (irDev == null) + { + Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey); + return null; + } + if (portNum >= irDev.NumberOfIROutputPorts) + { + Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range", + portDevKey, portNum); + return null; + } + + + var port = irDev.IROutputPorts[portNum]; + + port.LoadIRDriver(Global.FilePathPrefix + "IR" + Global.DirectorySeparator + control["irFile"].Value()); + + return port; + + } + + public static IrOutputPortController GetIrOutputPortController(DeviceConfig config) + { + Debug.Console(1, "Attempting to create new Ir Port Controller"); + + if (config == null) + { + return null; + } + + var irDevice = new IrOutputPortController(config.Key, GetIrOutputPort, config); + + return irDevice; + } + + /* + /// + /// Returns a ready-to-go IrOutputPortController from a DeviceConfig object. + /// + public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf) + { + var irControllerKey = devConf.Key + "-ir"; + if (devConf.Properties == null) + { + Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key); + return new IrOutputPortController(irControllerKey, null, ""); + } - /// - /// Returns a ready-to-go IrOutputPortController from a DeviceConfig object. - /// - public static IrOutputPortController GetIrOutputPortController(DeviceConfig devConf) - { - var irControllerKey = devConf.Key + "-ir"; - if (devConf.Properties == null) - { - Debug.Console(0, "[{0}] WARNING: Device config does not include properties. IR will not function.", devConf.Key); - return new IrOutputPortController(irControllerKey, null, ""); - } + var control = devConf.Properties["control"]; + if (control == null) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function"); + return c; + } - var control = devConf.Properties["control"]; - if (control == null) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: Device config does not include control properties. IR will not function"); - return c; - } + var portDevKey = control.Value("controlPortDevKey"); + var portNum = control.Value("controlPortNumber"); + IIROutputPorts irDev = null; - var portDevKey = control.Value("controlPortDevKey"); - var portNum = control.Value("controlPortNumber"); - IIROutputPorts irDev = null; + if (portDevKey == null) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: control properties is missing ir device"); + return c; + } - if (portDevKey == null) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: control properties is missing ir device"); - return c; - } + if (portNum == 0) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: control properties is missing ir port number"); + return c; + } - if (portNum == 0) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: control properties is missing ir port number"); - return c; - } + if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) + || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) + irDev = Global.ControlSystem; + else + irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; - if (portDevKey.Equals("controlSystem", StringComparison.OrdinalIgnoreCase) - || portDevKey.Equals("processor", StringComparison.OrdinalIgnoreCase)) - irDev = Global.ControlSystem; - else - irDev = DeviceManager.GetDeviceForKey(portDevKey) as IIROutputPorts; + if (irDev == null) + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey); + return c; + } - if (irDev == null) - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: device with IR ports '{0}' not found", portDevKey); - return c; - } - - if (portNum <= irDev.NumberOfIROutputPorts) // success! - return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum], - IrDriverPathPrefix + control["irFile"].Value()); - else - { - var c = new IrOutputPortController(irControllerKey, null, ""); - Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range", - portDevKey, portNum); - return c; - } - } + if (portNum <= irDev.NumberOfIROutputPorts) // success! + return new IrOutputPortController(irControllerKey, irDev.IROutputPorts[portNum], + IrDriverPathPrefix + control["irFile"].Value()); + else + { + var c = new IrOutputPortController(irControllerKey, null, ""); + Debug.Console(0, c, "WARNING: device '{0}' IR port {1} out of range", + portDevKey, portNum); + return c; + } + }*/ } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs index 67a74ed7..ecfca4f8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Devices/IrOutputPortController.cs @@ -3,7 +3,10 @@ using System.Collections.Generic; using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharpPro; -using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; +using Newtonsoft.Json.Linq; +using PepperDash.Essentials.Core.Config; + using PepperDash.Core; @@ -37,9 +40,21 @@ namespace PepperDash.Essentials.Core return; } LoadDriver(irDriverFilepath); - } - - /// + } + + public IrOutputPortController(string key, Func postActivationFunc, + DeviceConfig config) + : base(key) + { + AddPostActivationAction(() => + { + IrPort = postActivationFunc(config); + }); + } + + + + /// /// Loads the IR driver at path /// /// @@ -118,7 +133,6 @@ namespace PepperDash.Essentials.Core { Debug.Console(2, this, "Device {0}: IR Driver {1} does not contain command {2}", Key, IrPort.IRDriverFileNameByIRDriverId(IrPortUid), command); - } - + } } } \ No newline at end of file From ef4b0441d3dcfd9521d5f1a9eb27defe25770243 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 22:10:29 -0500 Subject: [PATCH 030/150] Added new interface IRoutingNumeric Updated DmChassisController Updated DmBladeChassisController Cleaned up some redundant interface referencing in RoutingInterfaces #192 --- .../Routing/RoutingInterfaces.cs | 16 ++- .../Chassis/DmBladeChassisController.cs | 49 ++++++- .../Chassis/DmChassisController.cs | 129 +++++++++++++++++- 3 files changed, 181 insertions(+), 13 deletions(-) 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..3f3eae6c 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,51 @@ 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) + { + 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; + } + + #endregion + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmBladeChassisControllerJoinMap(joinStart); @@ -808,6 +846,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..536905d9 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,133 @@ namespace PepperDash.Essentials.DM } #endregion + #region IRoutingNumeric Members + + 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; + } + + #endregion + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new DmChassisControllerJoinMap(joinStart); From 3c7495aaa11cf59e2dfb5306b42e373955d04761 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 20 May 2020 23:27:21 -0500 Subject: [PATCH 031/150] Added Description Attributes to Bridgeable Classes #210 --- .../Comm and IR/DELETE ComPortController.cs | 105 ------------------ .../Inputs/GenericDigitalInputDevice.cs | 3 +- .../Crestron IO/Relay/GenericRelayDevice.cs | 3 +- .../Display/BasicIrDisplay.cs | 5 +- .../PepperDash_Essentials_Core.csproj | 12 +- .../AirMedia/AirMediaController.cs | 1 + .../Endpoints/DGEs/Dge100Controller.cs | 4 +- .../Endpoints/DGEs/DmDge200CController.cs | 1 + .../Receivers/DmRmc100SController.cs | 3 +- .../Receivers/DmRmc150SController.cs | 3 +- .../Receivers/DmRmc200CController.cs | 5 +- .../Receivers/DmRmc200S2Controller.cs | 3 +- .../Receivers/DmRmc200SController.cs | 5 +- .../Receivers/DmRmc4KScalerCController.cs | 5 +- .../Receivers/DmRmc4k100C1GController.cs | 4 +- .../Receivers/DmRmc4kScalerCDspController.cs | 3 +- .../Receivers/DmRmc4kZ100CController.cs | 3 +- .../Receivers/DmRmc4kZScalerCController.cs | 1 + .../Receivers/DmRmcScalerCController.cs | 5 +- .../Receivers/DmRmcScalerS2Controller.cs | 3 +- .../Receivers/DmRmcScalerSController.cs | 3 +- .../Receivers/DmRmcX100CController.cs | 5 +- .../Transmitters/DmTx200Controller.cs | 2 +- .../Transmitters/DmTx201CController.cs | 2 +- .../Transmitters/DmTx201SController.cs | 2 +- .../Transmitters/DmTx401CController.cs | 5 +- .../Transmitters/DmTx4k100Controller.cs | 5 +- .../Transmitters/DmTx4k202CController.cs | 5 +- .../Transmitters/DmTx4k302CController.cs | 5 +- .../Transmitters/DmTx4kz100Controller.cs | 1 + .../Transmitters/DmTx4kz302CController.cs | 1 + .../CenOdtOccupancySensorBaseController.cs | 1 + .../GlsOccupancySensorBaseController.cs | 1 + .../GlsOdtOccupancySensorController.cs | 1 + .../SetTopBox/IRSetTopBoxBase.cs | 3 +- .../Streaming/AppleTV.cs | 2 +- .../Streaming/Roku.cs | 3 +- 37 files changed, 74 insertions(+), 150 deletions(-) delete mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs deleted file mode 100644 index ece72b20..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/DELETE ComPortController.cs +++ /dev/null @@ -1,105 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - public class ComPortController : Device, IBasicCommunication - { - public event EventHandler BytesReceived; - public event EventHandler TextReceived; - - ComPort Port; - ComPort.ComPortSpec Spec; - - public ComPortController(string key, IComPorts ComDevice, uint comPortNum, ComPort.ComPortSpec spec) - : base(key) - { - Port = ComDevice.ComPorts[comPortNum]; - Spec = spec; - - Debug.Console(2, "Creating com port '{0}'", key); - Debug.Console(2, "Com port spec:\r{0}", JsonConvert.SerializeObject(spec)); - } - - /// - /// Creates a ComPort if the parameters are correct. Returns and logs errors if not - /// - public static ComPortController GetComPortController(string key, - IComPorts comDevice, uint comPortNum, ComPort.ComPortSpec spec) - { - Debug.Console(1, "Creating com port '{0}'", key); - if (comDevice == null) - throw new ArgumentNullException("comDevice"); - if (string.IsNullOrEmpty(key)) - throw new ArgumentNullException("key"); - if (comPortNum > comDevice.NumberOfComPorts) - { - Debug.Console(0, "[{0}] Com port {1} out of range on {2}", - key, comPortNum, comDevice.GetType().Name); - return null; - } - var port = new ComPortController(key, comDevice, comPortNum, spec); - return port; - } - - /// - /// Registers port and sends ComSpec - /// - /// false if either register or comspec fails - public override bool CustomActivate() - { - var result = Port.Register(); - if (result != eDeviceRegistrationUnRegistrationResponse.Success) - { - Debug.Console(0, this, "Cannot register Com port: {0}", result); - return false; - } - var specResult = Port.SetComPortSpec(Spec); - if (specResult != 0) - { - Debug.Console(0, this, "Cannot set comspec"); - return false; - } - Port.SerialDataReceived += new ComPortDataReceivedEvent(Port_SerialDataReceived); - return true; - } - - void Port_SerialDataReceived(ComPort ReceivingComPort, ComPortSerialDataEventArgs args) - { - if (BytesReceived != null) - { - var bytes = Encoding.GetEncoding(28591).GetBytes(args.SerialData); - BytesReceived(this, new GenericCommMethodReceiveBytesArgs(bytes)); - } - if(TextReceived != null) - TextReceived(this, new GenericCommMethodReceiveTextArgs(args.SerialData)); - } - - public override bool Deactivate() - { - return Port.UnRegister() == eDeviceRegistrationUnRegistrationResponse.Success; - } - - #region IBasicCommunication Members - - public void SendText(string text) - { - Port.Send(text); - } - - public void SendBytes(byte[] bytes) - { - - var text = Encoding.GetEncoding(28591).GetString(bytes, 0, bytes.Length); - Port.Send(text); - } - - #endregion - } -} \ No newline at end of file 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 774c7490..72b2e893 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Inputs/GenericDigitalInputDevice.cs @@ -12,7 +12,8 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO -{ +{ + [Description("Wrapper class for Digital Input")] public class GenericDigitalInputDevice : EssentialsBridgeableDevice, IDigitalInput { public DigitalInput InputPort { get; private set; } 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 b79a8253..00bbb31b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -14,7 +14,8 @@ namespace PepperDash.Essentials.Core.CrestronIO { /// /// Represents a generic device controlled by relays - /// + /// + [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 032/150] 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 033/150] 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 034/150] 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 035/150] 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 036/150] 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 037/150] 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 038/150] 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 7bfc82c3cce66855648ad3da976f489854d6d371 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 27 May 2020 09:50:50 -0600 Subject: [PATCH 039/150] #215 fix for incorrect cast in LinkToApi method --- .../PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs | 2 +- .../Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs index 74122905..3195bd8b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/Comm and IR/GenericComm.cs @@ -96,7 +96,7 @@ namespace PepperDash.Essentials.Core trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig); - var sComm = this as ISocketStatus; + var sComm = CommPort as ISocketStatus; if (sComm == null) return; sComm.ConnectionChange += (s, a) => { 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..fd9771d1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -84,7 +84,7 @@ False - ..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll From 305fe5c372f973db3130871e7514b531487a9891 Mon Sep 17 00:00:00 2001 From: Nick Genovese Date: Thu, 28 May 2020 14:02:43 -0400 Subject: [PATCH 040/150] 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 041/150] #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 042/150] 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 043/150] -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 37e1e50b947178b4925b2697d03786eb6fa163dc Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 1 Jun 2020 10:38:45 -0600 Subject: [PATCH 044/150] #222 changes updates for EDID Feedbacks --- .../Receivers/DmRmc4kZ100CController.cs | 23 +++++++++++++++---- 1 file changed, 18 insertions(+), 5 deletions(-) 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..3d7ef855 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4kZ100CController.cs @@ -23,18 +23,31 @@ namespace PepperDash.Essentials.DM EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; - _rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; + + //removed to prevent NullReferenceException + //_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange; } void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) { - if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || - args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId) + switch (args.EventId) { - VideoOutputResolutionFeedback.FireUpdate(); + case EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId: + case EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId: + case EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId: + VideoOutputResolutionFeedback.FireUpdate(); + break; + case EndpointOutputStreamEventIds.HotplugDetectedEventId: + if (_rmc.HdmiOutput.ConnectedDevice == null) return; + EdidManufacturerFeedback.FireUpdate(); + EdidNameFeedback.FireUpdate(); + EdidPreferredTimingFeedback.FireUpdate(); + EdidSerialNumberFeedback.FireUpdate(); + break; } } + /* void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) { switch (args.EventId) @@ -52,7 +65,7 @@ namespace PepperDash.Essentials.DM EdidSerialNumberFeedback.FireUpdate(); break; } - } + }*/ public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { From 083a3662e0cf9e5698d9e3a7af53f6ca2068f90f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 1 Jun 2020 13:31:32 -0600 Subject: [PATCH 045/150] adds DmTx4kz202CController class fixes errors in DmTx4kz302CController that were fixed in a previous commit but were not merged into dev --- .../Transmitters/DmTx4k202CController.cs | 618 +++++++++--------- .../Transmitters/DmTx4kz202CController.cs | 359 ++++++++++ .../Transmitters/DmTx4kz302CController.cs | 41 +- .../Endpoints/Transmitters/DmTxHelpers.cs | 6 +- .../PepperDash_Essentials_DM.csproj | 1 + 5 files changed, 688 insertions(+), 337 deletions(-) create mode 100644 essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs 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..0486e2c7 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k202CController.cs @@ -1,205 +1,205 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.DM; -using Crestron.SimplSharpPro.DM.Endpoints; -using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.DM.Config; - -namespace PepperDash.Essentials.DM -{ - using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; - - public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback, - IIROutputPorts, IComPorts - { - public DmTx4kX02CBase Tx { get; private set; } - - public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; } - public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } - public RoutingOutputPort DmOut { get; private set; } - public RoutingOutputPort HdmiLoopOut { get; private set; } - - public override StringFeedback ActiveVideoInputFeedback { get; protected set; } - public IntFeedback VideoSourceNumericFeedback { get; protected set; } - public IntFeedback AudioSourceNumericFeedback { get; protected set; } - public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } - public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } - public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } - public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } - - //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } - //public override ushort HdcpSupportCapability { get; protected set; } - - /// - /// Helps get the "real" inputs, including when in Auto - /// - public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput - { - get - { - if (Tx.VideoSourceFeedback != eVst.Auto) - return Tx.VideoSourceFeedback; - else // auto - { - if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) - return eVst.Hdmi1; - else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) - return eVst.Hdmi2; - else - return eVst.AllDisabled; - } - } - } - public RoutingPortCollection InputPorts - { - get - { - return new RoutingPortCollection - { - HdmiIn1, - HdmiIn2, - AnyVideoInput - }; - } - } - public RoutingPortCollection OutputPorts - { - get - { - return new RoutingPortCollection { DmOut, HdmiLoopOut }; - } - } - public DmTx4k202CController(string key, string name, DmTx4kX02CBase tx) - : base(key, name, tx) - { - Tx = tx; - - HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this, - VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1])); - HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this, - VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2])); - ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", - () => ActualActiveVideoInput.ToString()); - - - - Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; - Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +//using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; +using PepperDash.Essentials.DM.Config; + +namespace PepperDash.Essentials.DM +{ + using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; + using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + + public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback, + IIROutputPorts, IComPorts + { + public DmTx4k202C Tx { get; private set; } + + public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; } + public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } + public RoutingOutputPort DmOut { get; private set; } + public RoutingOutputPort HdmiLoopOut { get; private set; } + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } + public IntFeedback VideoSourceNumericFeedback { get; protected set; } + public IntFeedback AudioSourceNumericFeedback { get; protected set; } + public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } + public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } + public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } + + //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } + //public override ushort HdcpSupportCapability { get; protected set; } + + /// + /// Helps get the "real" inputs, including when in Auto + /// + public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput + { + get + { + if (Tx.VideoSourceFeedback != eVst.Auto) + return Tx.VideoSourceFeedback; + else // auto + { + if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi1; + else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi2; + else + return eVst.AllDisabled; + } + } + } + public RoutingPortCollection InputPorts + { + get + { + return new RoutingPortCollection + { + HdmiIn1, + HdmiIn2, + AnyVideoInput + }; + } + } + public RoutingPortCollection OutputPorts + { + get + { + return new RoutingPortCollection { DmOut, HdmiLoopOut }; + } + } + public DmTx4k202CController(string key, string name, DmTx4k202C tx) + : base(key, name, tx) + { + Tx = tx; + + HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1])); + HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2])); + ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", + () => ActualActiveVideoInput.ToString()); + + + + Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; + Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; Tx.BaseEvent += Tx_BaseEvent; - VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); - - AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); - - HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); - - HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); - - HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; - - Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); - - Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); - - var combinedFuncs = new VideoStatusFuncsWrapper - { - HdcpActiveFeedbackFunc = () => - (ActualActiveVideoInput == eVst.Hdmi1 - && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue) - || (ActualActiveVideoInput == eVst.Hdmi2 - && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), - - HdcpStateFeedbackFunc = () => - { - if (ActualActiveVideoInput == eVst.Hdmi1) - return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); - if (ActualActiveVideoInput == eVst.Hdmi2) - return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); - return ""; - }, - - VideoResolutionFeedbackFunc = () => - { - if (ActualActiveVideoInput == eVst.Hdmi1) - return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); - if (ActualActiveVideoInput == eVst.Hdmi2) - return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); - return ""; - }, - VideoSyncFeedbackFunc = () => - (ActualActiveVideoInput == eVst.Hdmi1 - && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) - || (ActualActiveVideoInput == eVst.Hdmi2 - && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) - - }; - - AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, - eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); - - DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.DmCat, null, this); - HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, - eRoutingPortConnectionType.Hdmi, null, this); - - - AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, - AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, - AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, - AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, - Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback); - - // Set Ports for CEC - HdmiIn1.Port = Tx.HdmiInputs[1]; - HdmiIn2.Port = Tx.HdmiInputs[2]; - HdmiLoopOut.Port = Tx.HdmiOutput; - DmOut.Port = Tx.DmOutput; - } - - - - public override bool CustomActivate() - { - // Link up all of these damned events to the various RoutingPorts via a helper handler - Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId); - Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId); - - Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId); - Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId); - - // Base does register and sets up comm monitoring. - return base.CustomActivate(); - } - - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) - { - var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); - - if (Hdmi1VideoSyncFeedback != null) + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); + + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); + + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); + + HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + + Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); + + Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); + + var combinedFuncs = new VideoStatusFuncsWrapper { - Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); - } - if (Hdmi2VideoSyncFeedback != null) + HdcpActiveFeedbackFunc = () => + (ActualActiveVideoInput == eVst.Hdmi1 + && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Hdmi2 + && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), + + HdcpStateFeedbackFunc = () => + { + if (ActualActiveVideoInput == eVst.Hdmi1) + return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); + return ""; + }, + + VideoResolutionFeedbackFunc = () => + { + if (ActualActiveVideoInput == eVst.Hdmi1) + return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); + return ""; + }, + VideoSyncFeedbackFunc = () => + (ActualActiveVideoInput == eVst.Hdmi1 + && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Hdmi2 + && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + + }; + + AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + + DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, null, this); + HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + + AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, + AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, + AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback); + + // Set Ports for CEC + HdmiIn1.Port = Tx.HdmiInputs[1]; + HdmiIn2.Port = Tx.HdmiInputs[2]; + HdmiLoopOut.Port = Tx.HdmiOutput; + DmOut.Port = Tx.DmOutput; + } + + + + public override bool CustomActivate() + { + // Link up all of these damned events to the various RoutingPorts via a helper handler + Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId); + Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId); + + Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId); + Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId); + + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (Hdmi1VideoSyncFeedback != null) { - Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); - } - - LinkDmTxToApi(this, trilist, joinMap, bridge); - } - + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); + } + if (Hdmi2VideoSyncFeedback != null) + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); + } + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) { Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); @@ -207,68 +207,68 @@ namespace PepperDash.Essentials.DM switch (type) { case eRoutingSignalType.Video: - switch (input) - { - case 0: - { - ExecuteSwitch(eVst.Auto, null, type); - break; - } - case 1: - { - ExecuteSwitch(HdmiIn1.Selector, null, type); - break; - } - case 2: - { - ExecuteSwitch(HdmiIn2.Selector, null, type); - break; - } - case 3: - { - ExecuteSwitch(eVst.AllDisabled, null, type); - break; - } + switch (input) + { + case 0: + { + ExecuteSwitch(eVst.Auto, null, type); + break; + } + case 1: + { + ExecuteSwitch(HdmiIn1.Selector, null, type); + break; + } + case 2: + { + ExecuteSwitch(HdmiIn2.Selector, null, type); + break; + } + case 3: + { + ExecuteSwitch(eVst.AllDisabled, null, type); + break; + } } break; case eRoutingSignalType.Audio: - switch (input) - { - case 0: - { - ExecuteSwitch(eAst.Auto, null, type); - break; - } - case 1: - { - ExecuteSwitch(eAst.Hdmi1, null, type); - break; - } - case 2: - { - ExecuteSwitch(eAst.Hdmi2, null, type); - break; - } - case 3: - { - ExecuteSwitch(eAst.AllDisabled, null, type); - break; - } + switch (input) + { + case 0: + { + ExecuteSwitch(eAst.Auto, null, type); + break; + } + case 1: + { + ExecuteSwitch(eAst.Hdmi1, null, type); + break; + } + case 2: + { + ExecuteSwitch(eAst.Hdmi2, null, type); + break; + } + case 3: + { + ExecuteSwitch(eAst.AllDisabled, null, type); + break; + } } break; } } - public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) - { - if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) - Tx.VideoSource = (eVst)inputSelector; - if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - Tx.AudioSource = (eAst)inputSelector; - } - - void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) - { + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) + Tx.VideoSource = (eVst)inputSelector; + if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + Tx.AudioSource = (eAst)inputSelector; + } + + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); switch (args.EventId) @@ -285,10 +285,10 @@ namespace PepperDash.Essentials.DM if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); break; - } - } - - void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + } + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) { var id = args.EventId; Debug.Console(2, this, "EventId {0}", args.EventId); @@ -305,63 +305,63 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); AudioSourceNumericFeedback.FireUpdate(); break; - } - } - - /// - /// Relays the input stream change to the appropriate RoutingInputPort. - /// - void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + } + } + + /// + /// Relays the input stream change to the appropriate RoutingInputPort. + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) { if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) { return; } inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); - } - - /// - /// Relays the VideoAttributes change to a RoutingInputPort - /// - void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) - { - //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds - //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", - // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); - switch (eventId) - { - case VideoAttributeEventIds.HdcpActiveFeedbackEventId: - inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate(); - break; - case VideoAttributeEventIds.HdcpStateFeedbackEventId: - inputPort.VideoStatus.HdcpStateFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate(); - break; - case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId: - case VideoAttributeEventIds.VerticalResolutionFeedbackEventId: - inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); - break; - case VideoAttributeEventIds.FramesPerSecondFeedbackEventId: - inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); - AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); - break; - } - } - - - - - #region IIROutputPorts Members - public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } - public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } - #endregion - - #region IComPorts Members - public CrestronCollection ComPorts { get { return Tx.ComPorts; } } - public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } } - #endregion - } + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } + + /// + /// Relays the VideoAttributes change to a RoutingInputPort + /// + void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds + //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", + // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); + switch (eventId) + { + case VideoAttributeEventIds.HdcpActiveFeedbackEventId: + inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.HdcpStateFeedbackEventId: + inputPort.VideoStatus.HdcpStateFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId: + case VideoAttributeEventIds.VerticalResolutionFeedbackEventId: + inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.FramesPerSecondFeedbackEventId: + inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); + break; + } + } + + + + + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Tx.ComPorts; } } + public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } } + #endregion + } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs new file mode 100644 index 00000000..add96e98 --- /dev/null +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz202CController.cs @@ -0,0 +1,359 @@ +using Crestron.SimplSharpPro; +//using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.DM; +using Crestron.SimplSharpPro.DM.Endpoints; +using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Bridges; + +namespace PepperDash.Essentials.DM +{ + using eVst = eX02VideoSourceType; + using eAst = eX02AudioSourceType; + + public class DmTx4kz202CController : DmTxControllerBase, ITxRouting, + IIROutputPorts, IComPorts + { + public DmTx4kz202C Tx { get; private set; } + + public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; } + public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } + public RoutingOutputPort DmOut { get; private set; } + public RoutingOutputPort HdmiLoopOut { get; private set; } + + public override StringFeedback ActiveVideoInputFeedback { get; protected set; } + public IntFeedback VideoSourceNumericFeedback { get; protected set; } + public IntFeedback AudioSourceNumericFeedback { get; protected set; } + public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; } + public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } + public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } + public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; } + + //public override IntFeedback HdcpSupportAllFeedback { get; protected set; } + //public override ushort HdcpSupportCapability { get; protected set; } + + /// + /// Helps get the "real" inputs, including when in Auto + /// + public eX02VideoSourceType ActualActiveVideoInput + { + get + { + if (Tx.VideoSourceFeedback != eVst.Auto) + return Tx.VideoSourceFeedback; + + if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi1; + + return Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue ? eVst.Hdmi2 : eVst.AllDisabled; + } + } + public RoutingPortCollection InputPorts + { + get + { + return new RoutingPortCollection + { + HdmiIn1, + HdmiIn2, + AnyVideoInput + }; + } + } + public RoutingPortCollection OutputPorts + { + get + { + return new RoutingPortCollection { DmOut, HdmiLoopOut }; + } + } + public DmTx4kz202CController(string key, string name, DmTx4kz202C tx) + : base(key, name, tx) + { + Tx = tx; + + HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1])); + HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this, + VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2])); + ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", + () => ActualActiveVideoInput.ToString()); + + + + Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; + Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; + Tx.BaseEvent += Tx_BaseEvent; + + VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + + //Return VideoSourceFeedback here as DM-TX-4KZ-202-C does not support audio breakaway + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); + + HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); + + HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); + + HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; + + Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); + + Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); + + var combinedFuncs = new VideoStatusFuncsWrapper + { + HdcpActiveFeedbackFunc = () => + (ActualActiveVideoInput == eVst.Hdmi1 + && tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Hdmi2 + && tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), + + HdcpStateFeedbackFunc = () => + { + if (ActualActiveVideoInput == eVst.Hdmi1) + return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString(); + return ""; + }, + + VideoResolutionFeedbackFunc = () => + { + if (ActualActiveVideoInput == eVst.Hdmi1) + return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); + if (ActualActiveVideoInput == eVst.Hdmi2) + return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString(); + return ""; + }, + VideoSyncFeedbackFunc = () => + (ActualActiveVideoInput == eVst.Hdmi1 + && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + || (ActualActiveVideoInput == eVst.Hdmi2 + && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + + }; + + AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, + eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); + + DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.DmCat, null, this); + HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, + eRoutingPortConnectionType.Hdmi, null, this); + + + AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, + AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, + AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback, + AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, + Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback); + + // Set Ports for CEC + HdmiIn1.Port = Tx.HdmiInputs[1]; + HdmiIn2.Port = Tx.HdmiInputs[2]; + HdmiLoopOut.Port = Tx.HdmiOutput; + DmOut.Port = Tx.DmOutput; + } + + + + public override bool CustomActivate() + { + // Link up all of these damned events to the various RoutingPorts via a helper handler + Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId); + Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId); + + Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId); + Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId); + + // Base does register and sets up comm monitoring. + return base.CustomActivate(); + } + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); + + if (Hdmi1VideoSyncFeedback != null) + { + Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); + } + if (Hdmi2VideoSyncFeedback != null) + { + Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); + } + + LinkDmTxToApi(this, trilist, joinMap, bridge); + } + + public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) + { + Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); + + switch (type) + { + case eRoutingSignalType.Video: + switch (input) + { + case 0: + { + ExecuteSwitch(eVst.Auto, null, type); + break; + } + case 1: + { + ExecuteSwitch(HdmiIn1.Selector, null, type); + break; + } + case 2: + { + ExecuteSwitch(HdmiIn2.Selector, null, type); + break; + } + case 3: + { + ExecuteSwitch(eVst.AllDisabled, null, type); + break; + } + } + break; + case eRoutingSignalType.Audio: + switch (input) + { + case 0: + { + ExecuteSwitch(eAst.Auto, null, type); + break; + } + case 1: + { + ExecuteSwitch(eAst.Hdmi1, null, type); + break; + } + case 2: + { + ExecuteSwitch(eAst.Hdmi2, null, type); + break; + } + case 3: + { + ExecuteSwitch(eAst.AllDisabled, null, type); + break; + } + } + break; + } + } + + public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) + { + if ((signalType & eRoutingSignalType.Video) == eRoutingSignalType.Video) + Tx.VideoSource = (eVst)inputSelector; + if(((signalType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)) + Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key); + } + + void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) + { + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + + switch (args.EventId) + { + case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); + break; + case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: + if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); + if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); + break; + } + } + + void Tx_BaseEvent(GenericBase device, BaseEventArgs args) + { + var id = args.EventId; + Debug.Console(2, this, "EventId {0}", args.EventId); + + switch (id) + { + case EndpointTransmitterBase.VideoSourceFeedbackEventId: + Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); + ActiveVideoInputFeedback.FireUpdate(); + VideoSourceNumericFeedback.FireUpdate(); + AudioSourceNumericFeedback.FireUpdate(); + ActiveVideoInputFeedback.FireUpdate(); + break; + case EndpointTransmitterBase.AudioSourceFeedbackEventId: + Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); + AudioSourceNumericFeedback.FireUpdate(); + break; + } + } + + /// + /// Relays the input stream change to the appropriate RoutingInputPort. + /// + void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) + { + return; + } + inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); + } + + /// + /// Relays the VideoAttributes change to a RoutingInputPort + /// + void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) + { + //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds + //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", + // args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); + switch (eventId) + { + case VideoAttributeEventIds.HdcpActiveFeedbackEventId: + inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.HdcpStateFeedbackEventId: + inputPort.VideoStatus.HdcpStateFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId: + case VideoAttributeEventIds.VerticalResolutionFeedbackEventId: + inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); + break; + case VideoAttributeEventIds.FramesPerSecondFeedbackEventId: + inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); + AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); + break; + } + } + + + + + #region IIROutputPorts Members + public CrestronCollection IROutputPorts { get { return Tx.IROutputPorts; } } + public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } + #endregion + + #region IComPorts Members + public CrestronCollection ComPorts { get { return Tx.ComPorts; } } + public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } } + #endregion + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs index b6fa24ee..9b4bd0aa 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz302CController.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; //using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; @@ -13,14 +8,13 @@ using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; -using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { - using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; - using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; + using eVst = eX02VideoSourceType; + using eAst = eX02AudioSourceType; - public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback, + public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IIROutputPorts, IComPorts { public DmTx4kz302C Tx { get; private set; } @@ -46,23 +40,18 @@ namespace PepperDash.Essentials.DM /// /// Helps get the "real" inputs, including when in Auto /// - public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput + public eX02VideoSourceType ActualActiveVideoInput { get { if (Tx.VideoSourceFeedback != eVst.Auto) return Tx.VideoSourceFeedback; - else // auto - { - if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) - return eVst.Hdmi1; - else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) - return eVst.Hdmi2; - else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) - return eVst.Vga; - else - return eVst.AllDisabled; - } + if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi1; + if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) + return eVst.Hdmi2; + + return Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue ? eVst.Vga : eVst.AllDisabled; } } public RoutingPortCollection InputPorts @@ -108,7 +97,7 @@ namespace PepperDash.Essentials.DM Tx.BaseEvent += Tx_BaseEvent; VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); - AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); + AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); @@ -272,12 +261,14 @@ namespace PepperDash.Essentials.DM // NOTE: It's possible that this particular TX model may not like the AudioSource property being set. // The SIMPL definition only shows a single analog for AudioVideo Source if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - Tx.AudioSource = (eAst)inputSelector; + //it doesn't + Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key); + //Tx.AudioSource = (eAst)inputSelector; } void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) { - Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); + Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); switch (args.EventId) { 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 bcdf1fbe..bb72306b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -52,7 +52,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4kz202")) - return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem)); + return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4k302")) return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem)); if (typeName.StartsWith("dmtx4kz302")) @@ -115,7 +115,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz202")) - return new DmTx4k202CController(key, name, new DmTx4kz202C(chassis.Inputs[num])); + return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k302")) return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz302")) @@ -138,7 +138,7 @@ namespace PepperDash.Essentials.DM if (typeName.StartsWith("dmtx4k202")) return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz202")) - return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num])); + return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4k302")) return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num])); if (typeName.StartsWith("dmtx4kz302")) 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 fd9771d1..e766390f 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -103,6 +103,7 @@ + From 5ea79ac94ed601ed63ca3399c5d6a5ad22c361f5 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 3 Jun 2020 16:23:57 -0600 Subject: [PATCH 046/150] #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 047/150] 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 048/150] 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 049/150] 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 050/150] 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 4f4c8cba0453f29717846b73c959ce6018f2d7c5 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Sun, 7 Jun 2020 16:11:17 -0600 Subject: [PATCH 051/150] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 05f0953c..218b7eb5 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ PepperDash Essentials is an open source Crestron framework that can be configure Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other. ## Minimum Requirements -- Essentials Framework runs on any Crestron 3-series processor or Crestron's VC-4 platform. +- Essentials Framework runs on any Crestron 3-series processor, 4-series processor or Crestron's VC-4 platform. - To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required. - Crestron's Simpl# Plugin is also required (must be obtained from Crestron). From e94e8b60a6c46dc9e8aa9f7e6a9a723d0c0ee991 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Sun, 7 Jun 2020 16:36:00 -0600 Subject: [PATCH 052/150] Bolds 4-series --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 218b7eb5..310b4b8a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ PepperDash Essentials is an open source Crestron framework that can be configure Essentials Framework is a collection of C# / Simpl# Pro libraries that can be utilized in several different manners. It is currently operating as a 100% configuration-driven system, and can be extended to add different workflows and behaviors, either through the addition of further device "types" or via the plug-in mechanism. The framework is a collection of "things" that are all related and interconnected, but in general do not have dependencies on each other. ## Minimum Requirements -- Essentials Framework runs on any Crestron 3-series processor, 4-series processor or Crestron's VC-4 platform. +- Essentials Framework runs on any Crestron 3-series processor, **4-series** processor or Crestron's VC-4 platform. - To edit and compile the source, Microsoft Visual Studio 2008 Professional with SP1 is required. - Crestron's Simpl# Plugin is also required (must be obtained from Crestron). From d34177482e1d32e00915b2f2a40b712b134c6d57 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 9 Jun 2020 10:47:19 -0500 Subject: [PATCH 053/150] 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 054/150] 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 0525f76b6bdaea86f484e587bdf3c439c82d6829 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 9 Jun 2020 10:57:17 -0600 Subject: [PATCH 055/150] Added IBridge to Core made existing IBridge inherit from it for backwards compatabilty --- PepperDashEssentials/Bridges/IBridge.cs | 4 +--- .../PepperDashEssentialsBase/Bridges/IBridge.cs | 8 +++++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs index 497985c7..8bc741ec 100644 --- a/PepperDashEssentials/Bridges/IBridge.cs +++ b/PepperDashEssentials/Bridges/IBridge.cs @@ -1,5 +1,4 @@ using System; -using Crestron.SimplSharpPro.DeviceSupport; namespace PepperDash.Essentials.Bridges { @@ -7,8 +6,7 @@ namespace PepperDash.Essentials.Bridges /// Defines a device that uses the legacy JoinMapBase for its join map /// [Obsolete("IBridgeAdvanced should be used going forward with JoinMapBaseAdvanced")] - public interface IBridge + public interface IBridge:Core.Bridges.IBridge { - void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs index 1f10e554..4aca333a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/IBridge.cs @@ -1,13 +1,19 @@ using System; using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Core; namespace PepperDash.Essentials.Core.Bridges { /// /// Defines a device that uses JoinMapBaseAdvanced for its join map /// - public interface IBridgeAdvanced + public interface IBridgeAdvanced:IKeyed { void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } + + public interface IBridge:IKeyed + { + void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); + } } \ No newline at end of file From cc6d94b1886a98cee84d000b24cbb4fc29864bde Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 9 Jun 2020 10:57:42 -0600 Subject: [PATCH 056/150] Updates EiscApiAdvanced for backwards compatibility --- .../Bridges/BridgeBase.cs | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index 5bde418f..512401bc 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -110,15 +110,24 @@ namespace PepperDash.Essentials.Core.Bridges if (device == null) continue; Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - //if (device is IBridge) // Check for this first to allow bridges in plugins to override existing bridges that apply to the same type. - //{ - // Debug.Console(2, this, "'{0}' is IBridge", device.Key); - //} + + if (typeof (IBridge).IsAssignableFrom(device.GetType().GetCType())) + { + var basicBridge = device as IBridge; + if (basicBridge != null) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, + "Linking EiscApiAdvanced {0} to device {1} using obsolete join map. Please update the device's join map.", + Key, device.Key); + basicBridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + } + continue; + } + if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) { continue; } - var bridge = device as IBridgeAdvanced; if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); } From 2ace6ef6bc7a3fefc6b7e054d4c5f990c270ee9b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 9 Jun 2020 13:05:56 -0600 Subject: [PATCH 057/150] adds BasicDmTxControllerBase back in --- .../Endpoints/Transmitters/DmTxHelpers.cs | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) 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 bb72306b..9961a2e1 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -27,7 +27,7 @@ namespace PepperDash.Essentials.DM /// /// /// - public static DmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) + public static BasicDmTxControllerBase GetDmTxController(string key, string name, string typeName, DmTxPropertiesConfig props) { // switch on type name... later... @@ -157,11 +157,20 @@ namespace PepperDash.Essentials.DM } } + public abstract class BasicDmTxControllerBase : CrestronGenericBridgeableBaseDevice + { + protected BasicDmTxControllerBase(string key, string name, GenericBase hardware) + : base(key, name, hardware) + { + + } + } + /// /// /// [Description("Wrapper class for all DM-TX variants")] - public abstract class DmTxControllerBase : CrestronGenericBridgeableBaseDevice + public abstract class DmTxControllerBase : BasicDmTxControllerBase { public virtual void SetPortHdcpCapability(eHdcpCapabilityType hdcpMode, uint port) { } public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; } @@ -197,13 +206,7 @@ namespace PepperDash.Essentials.DM protected void LinkDmTxToApi(DmTxControllerBase tx, BasicTriList trilist, DmTxControllerJoinMap joinMap, EiscApiAdvanced bridge) { - if (tx.Hardware is DmHDBasedTEndPoint) - { - Debug.Console(1, tx, "No properties to link. Skipping device {0}", tx.Name); - return; - } - - Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(1, tx, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); tx.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); tx.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber]); From 81d9261a73d945e9c7aeaf8651305c862369cc7a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 9 Jun 2020 13:06:25 -0600 Subject: [PATCH 058/150] Changes base class to BasicDmTxControllerBase --- .../Endpoints/Transmitters/DmTx4k100Controller.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) 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..28a05e31 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -3,6 +3,7 @@ using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; +using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; @@ -11,7 +12,7 @@ namespace PepperDash.Essentials.DM using eVst = eX02VideoSourceType; using eAst = eX02AudioSourceType; - public class DmTx4k100Controller : DmTxControllerBase, IRoutingInputsOutputs, + public class DmTx4k100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs, IIROutputPorts, IComPorts, ICec { public DmTx4K100C1G Tx { get; private set; } @@ -72,9 +73,7 @@ namespace PepperDash.Essentials.DM public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { - DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey); - - LinkDmTxToApi(this, trilist, joinMap, bridge); + Debug.Console(1, this, "No properties to link. Skipping device {0}", Name); } #region IIROutputPorts Members @@ -90,7 +89,5 @@ namespace PepperDash.Essentials.DM #region ICec Members public Cec StreamCec { get { return Tx.StreamCec; } } #endregion - - public override StringFeedback ActiveVideoInputFeedback { get; protected set; } } } \ No newline at end of file From 486d6db7d88eeac6a01a6fd70e509de2af6b2e05 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 9 Jun 2020 13:06:40 -0600 Subject: [PATCH 059/150] fixes casting issues --- .../Essentials_DM/Chassis/DmChassisController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index b0d4682d..d112d162 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -1154,9 +1154,9 @@ namespace PepperDash.Essentials.DM { Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); var txKey = TxDictionary[ioSlot]; - var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; + var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase; - var advancedTxDevice = basicTxDevice; + var advancedTxDevice = basicTxDevice as DmTxControllerBase; if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps || Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps From 9c4e4c7976775494c5ce1e90f55fde8f519dc34a Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 9 Jun 2020 14:53:47 -0500 Subject: [PATCH 060/150] 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 a0ef356bac3abcb67f8b429a8934a966145f0b8b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Tue, 9 Jun 2020 14:40:11 -0600 Subject: [PATCH 061/150] Fix casts in DmBladeChassisController --- .../Essentials_DM/Chassis/DmBladeChassisController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index 5e9c3151..9e42ff38 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -599,7 +599,7 @@ namespace PepperDash.Essentials.DM { { Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot); var txKey = TxDictionary[ioSlot]; - var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as DmTxControllerBase; + var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase; var advancedTxDevice = basicTxDevice as DmTxControllerBase; From 0465a3b9a6de223865814fdd5fee51c5c3bcc421 Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Wed, 10 Jun 2020 14:42:05 -0400 Subject: [PATCH 062/150] 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 063/150] 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 064/150] 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 065/150] 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 066/150] 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 067/150] 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 068/150] 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 069/150] 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 070/150] 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 071/150] 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 37686044d4153c4626696e1389587105edf1ffbe Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 17 Jun 2020 22:15:01 -0600 Subject: [PATCH 072/150] Adds latest release link --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 310b4b8a..e411cabf 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ # PepperDash Essentials Framework (c) 2020 +## [Latest Release](https://github.com/PepperDash/Essentials/releases/latest) + ## License Provided under MIT license From 60d387c792c4a40184d1970197ad1a735a3f9676 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 18 Jun 2020 16:16:24 -0600 Subject: [PATCH 073/150] 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 074/150] 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 075/150] 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 076/150] 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 077/150] 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 078/150] 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 079/150] 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 080/150] 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 081/150] 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 082/150] 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); From fd1de75a1d14e87847dc8227f17291102985b19e Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 24 Jun 2020 10:44:57 -0500 Subject: [PATCH 083/150] Updated CiscoSpark to work with ce9.13 Resolves #277 --- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index cad7a18c..05bd7b01 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -601,9 +601,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco //JsonSerializerSettings settings = new JsonSerializerSettings(); //settings.NullValueHandling = NullValueHandling.Ignore; //settings.MissingMemberHandling = MissingMemberHandling.Ignore; - //settings.ObjectCreationHandling = ObjectCreationHandling.Auto; - - if (response.IndexOf("\"Status\":{") > -1) + //settings.ObjectCreationHandling = ObjectCreationHandling.Auto; + + if (response.IndexOf("\"Status\":{") > -1 || response.IndexOf("\"Status\": {") > -1) { // Status Message @@ -775,8 +775,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco if (!SyncState.InitialConfigurationMessageWasReceived) SendText("xConfiguration"); } - } - else if (response.IndexOf("\"Configuration\":{") > -1) + } + else if (response.IndexOf("\"Configuration\":{") > -1 || response.IndexOf("\"Configuration\": {") > -1) { // Configuration Message @@ -791,39 +791,39 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } } - } - else if (response.IndexOf("\"Event\":{") > -1) - { - if (response.IndexOf("\"CallDisconnect\":{") > -1) + } + else if (response.IndexOf("\"Event\":{") > -1 || response.IndexOf("\"Event\": {") > -1) + { + if (response.IndexOf("\"CallDisconnect\":{") > -1 || response.IndexOf("\"CallDisconnect\": {") > -1) { CiscoCodecEvents.RootObject eventReceived = new CiscoCodecEvents.RootObject(); JsonConvert.PopulateObject(response, eventReceived); EvalutateDisconnectEvent(eventReceived); - } - else if (response.IndexOf("\"Bookings\":{") > -1) // The list has changed, reload it + } + else if (response.IndexOf("\"Bookings\":{") > -1 || response.IndexOf("\"Bookings\": {") > -1) // The list has changed, reload it { GetBookings(null); } - } - else if (response.IndexOf("\"CommandResponse\":{") > -1) + } + else if (response.IndexOf("\"CommandResponse\":{") > -1 || response.IndexOf("\"CommandResponse\": {") > -1) { - // CommandResponse Message - - if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1) + // CommandResponse Message + + if (response.IndexOf("\"CallHistoryRecentsResult\":{") > -1 || response.IndexOf("\"CallHistoryRecentsResult\": {") > -1) { var codecCallHistory = new CiscoCallHistory.RootObject(); JsonConvert.PopulateObject(response, codecCallHistory); CallHistory.ConvertCiscoCallHistoryToGeneric(codecCallHistory.CommandResponse.CallHistoryRecentsResult.Entry); - } - else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1) + } + else if (response.IndexOf("\"CallHistoryDeleteEntryResult\":{") > -1 || response.IndexOf("\"CallHistoryDeleteEntryResult\": {") > -1) { GetCallHistory(); - } - else if (response.IndexOf("\"PhonebookSearchResult\":{") > -1) + } + else if (response.IndexOf("\"PhonebookSearchResult\":{") > -1 || response.IndexOf("\"PhonebookSearchResult\": {") > -1) { var codecPhonebookResponse = new CiscoCodecPhonebook.RootObject(); From 844565628927ee6abb1ae0dbe5b1b37d57e2b8d3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Thu, 25 Jun 2020 08:19:08 -0600 Subject: [PATCH 084/150] fix constructor to initialize feedback --- .../Crestron IO/Relay/GenericRelayDevice.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 f76608aa..050ac23b 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/Relay/GenericRelayDevice.cs @@ -31,13 +31,14 @@ namespace PepperDash.Essentials.Core.CrestronIO RelayOutput = relay; RelayOutput.Register(); - RelayOutput.StateChange += new RelayEventHandler(RelayOutput_StateChange); + RelayOutput.StateChange += RelayOutput_StateChange; } public GenericRelayDevice(string key, string name, Func postActivationFunc, IOPortConfig config) : base(key, name) { + OutputIsOnFeedback = new BoolFeedback(() => RelayOutput.State); AddPostActivationAction(() => { @@ -46,7 +47,6 @@ namespace PepperDash.Essentials.Core.CrestronIO RelayOutput.Register(); RelayOutput.StateChange += RelayOutput_StateChange; - }); } From 001933bac39272e22c4b3fbfa540e4305ea80160 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Thu, 25 Jun 2020 10:12:30 -0500 Subject: [PATCH 085/150] Change base class on HdMdNxM4kEController to be CrestronGenericBaseDevice Add required Factory class to HdMdNxM4kEController Fixes #280 --- .../Chassis/HdMdNxM4kEController.cs | 37 ++++++++++++++++++- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs index fff3b112..57c52627 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/HdMdNxM4kEController.cs @@ -4,14 +4,16 @@ using System.Linq; using System.Text; using Crestron.SimplSharp; using Crestron.SimplSharpPro.DM; +using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM.Chassis { - public class HdMdNxM4kEController : Device, IRoutingInputsOutputs, IRouting + public class HdMdNxM4kEController : CrestronGenericBaseDevice, IRoutingInputsOutputs, IRouting { public HdMdNxM Chassis { get; private set; } @@ -27,7 +29,7 @@ namespace PepperDash.Essentials.DM.Chassis /// public HdMdNxM4kEController(string key, string name, HdMdNxM chassis, HdMdNxM4kEPropertiesConfig props) - : base(key, name) + : base(key, name, chassis) { Chassis = chassis; @@ -99,6 +101,8 @@ namespace PepperDash.Essentials.DM.Chassis /// /// /// + /// /* + /* public static HdMdNxM4kEController GetController(string key, string name, string type, HdMdNxM4kEPropertiesConfig properties) { @@ -123,6 +127,35 @@ namespace PepperDash.Essentials.DM.Chassis Debug.Console(0, "ERROR Creating device key {0}: \r{1}", key, e); return null; } + }*/ + + #region Factory + + public class HdMdNxM4kEFactory : EssentialsDeviceFactory + { + public HdMdNxM4kEFactory() + { + TypeNames = new List() {"hdmd4x14ke"}; + } + + + 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; + + return new HdMdNxM4kEController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props); + + } } + + #endregion + } } \ No newline at end of file From 8d8899f9aca591b1f356ec5915bb20bf3d4b5609 Mon Sep 17 00:00:00 2001 From: Jonathan Avila Date: Sat, 27 Jun 2020 15:44:51 -0400 Subject: [PATCH 086/150] Resolves #262 Register device when using internal RF gateway --- .../Remotes/Hrxx0WirelessRemoteController.cs | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs index ff1ef06b..746f449f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs @@ -112,17 +112,29 @@ namespace PepperDash.Essentials.Core return null; } + Hr1x0WirelessRemoteBase remoteBase; switch (type) { case ("hr100"): - return new Hr100(rfId, gateway); + remoteBase = new Hr100(rfId, gateway); + break; case ("hr150"): - return new Hr150(rfId, gateway); + remoteBase = new Hr150(rfId, gateway); + break; case ("hr310"): - return new Hr310(rfId, gateway); + remoteBase = new Hr310(rfId, gateway); + break; default: return null; } + + // register the device when using an internal RF gateway + if (props.GatewayDeviceKey == "processor") + { + remoteBase.RegisterWithLogging(config.Key); + } + + return remoteBase; } static void gateway_BaseEvent(GenericBase device, BaseEventArgs args) @@ -249,4 +261,4 @@ namespace PepperDash.Essentials.Core trilist.BooleanInput[join].BoolValue = b; } } -} \ No newline at end of file +} From 80c98c60ca24d11bad1e85eb93328a527b7a8594 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:22:09 -0600 Subject: [PATCH 087/150] changed master -> main and added pull-request workflow --- .github/workflows/{master.yml => main.yml} | 0 .github/workflows/pull-request.yml | 266 +++++++++++++++++++++ 2 files changed, 266 insertions(+) rename .github/workflows/{master.yml => main.yml} (100%) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/master.yml b/.github/workflows/main.yml similarity index 100% rename from .github/workflows/master.yml rename to .github/workflows/main.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..aad90bca --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,266 @@ +name: Pull Request Build Using Docker + +on: + pull_request: + branches: + - development + +env: + # solution path doesn't need slashes unless there it is multiple folders deep + # solution name does not include extension. .sln is assumed + SOLUTION_PATH: PepperDashEssentials + SOLUTION_FILE: PepperDashEssentials + # Do not edit this, we're just creating it here + VERSION: 0.0.0-buildtype-buildnumber + # Defaults to debug for build type + BUILD_TYPE: Debug + # Defaults to main as the release branch. Change as necessary + RELEASE_BRANCH: main +jobs: + Build_Project: + runs-on: windows-latest + steps: + # First we checkout the source repo + - name: Checkout repo + uses: actions/checkout@v2 + with: + fetch-depth: 0 + # And any submodules + - name: Checkout submodules + shell: bash + run: | + git config --global url."https://github.com/".insteadOf "git@github.com:" + auth_header="$(git config --local --get http.https://github.com/.extraheader)" + git submodule sync --recursive + git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 + # Fetch all tags + - name: Fetch tags + run: git fetch --tags + # Generate the appropriate version number + - name: Set Version Number + shell: powershell + run: | + $version = ./.github/scripts/GenerateVersionNumber.ps1 + Write-Output "::set-env name=VERSION::$version" + # Use the version number to set the version of the assemblies + - name: Update AssemblyInfo.cs + shell: powershell + run: | + Write-Output ${{ env.VERSION }} + ./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }} + # Login to Docker + - name: Login to Docker + uses: azure/docker-login@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + # Build the solutions in the docker image + - name: Build Solution + shell: powershell + run: | + Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)" + # Zip up the output files as needed + - name: Zip Build Output + shell: powershell + run: ./.github/scripts/ZipBuildOutput.ps1 + # Write the version to a file to be consumed by the push jobs + - name: Write Version + run: Write-Output "$($Env:VERSION)" | Out-File -FilePath "$($Env:GITHUB_HOME)\output\version.txt" + # Upload the build output as an artifact + - name: Upload Build Output + uses: actions/upload-artifact@v1 + with: + name: Build + path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + # Upload the Version file as an artifact + - name: Upload version.txt + uses: actions/upload-artifact@v1 + with: + name: Version + path: ${{env.GITHUB_HOME}}\output\version.txt + # Create the release on the source repo + - name: Create tag for non-rc builds + if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') + run: | + git tag $($Env:VERSION) + git push --tags origin + - name: Create Release + id: create_release + # using contributor's version to allow for pointing at the right commit + if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-') + uses: fleskesvor/create-release@feature/support-target-commitish + with: + tag_name: ${{ env.VERSION }} + release_name: ${{ env.VERSION }} + prerelease: ${{contains('debug', env.BUILD_TYPE)}} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Upload the build package to the release + - name: Upload Release Package + if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-') + id: upload_release + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + asset_name: ${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip + asset_content_type: application/zip + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # This step always runs and pushes the build to the internal build rep + Internal_Push_Output: + needs: Build_Project + runs-on: windows-latest + steps: + - name: check Github ref + run: ${{toJson(github.ref)}} + # Checkout the repo + - name: Checkout Builds Repo + uses: actions/checkout@v2 + with: + token: ${{ secrets.BUILDS_TOKEN }} + repository: PepperDash-Engineering/essentials-builds + ref: ${{ Env.GITHUB_REF }} + # Download the version artifact from the build job + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Check Directory + run: Get-ChildItem "./" + # Set the version number environment variable from the file we just downloaded + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + # Checkout/Create the branch + - name: Create new branch + run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + # Download the build output into the repo + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Check directory + run: Get-ChildItem ./ + # Unzip the build package file + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Check directory again + run: Get-ChildItem ./ + # Copy Contents of output folder to root directory + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + # Commits the build output to the branch and tags it with the version + - name: Commit build output and tag the commit + shell: powershell + run: | + git config user.email "actions@pepperdash.com" + git config user.name "GitHub Actions" + git add . + $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" + Write-Host "Commit: $commit" + git commit -m $commit + git tag $($Env:VERSION) + # Push the commit + - name: Push to Builds Repo + shell: powershell + run: | + $branch = $($Env:GITHUB_REF) -replace "refs/heads/" + Write-Host "Branch: $branch" + git push -u origin $($branch) --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 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, 'main') || contains(github.ref, '/release/') + steps: + # Checkout the repo + - name: check Github ref + run: ${{toJson(github.ref)}} + - name: Checkout Builds Repo + uses: actions/checkout@v2 + with: + token: ${{ secrets.BUILDS_TOKEN }} + repository: PepperDash/Essentials-Builds + ref: ${{ Env.GITHUB_REF }} + # Download the version artifact from the build job + - name: Download Build Version Info + uses: actions/download-artifact@v1 + with: + name: Version + - name: Check Directory + run: Get-ChildItem "./" + # Set the version number environment variable from the file we just downloaded + - name: Set Version Number + shell: powershell + run: | + Get-ChildItem "./Version" + $version = Get-Content -Path ./Version/version.txt + Write-Host "Version: $version" + Write-Output "::set-env name=VERSION::$version" + Remove-Item -Path ./Version/version.txt + Remove-Item -Path ./Version + # Checkout/Create the branch + - name: Create new branch + run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") + # Download the build output into the repo + - name: Download Build output + uses: actions/download-artifact@v1 + with: + name: Build + path: ./ + - name: Check directory + run: Get-ChildItem ./ + # Unzip the build package file + - name: Unzip Build file + run: | + Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ + Remove-Item -Path .\*.zip + - name: Check directory again + run: Get-ChildItem ./ + # Copy Contents of output folder to root directory + - name: Copy Files to root & delete output directory + run: | + Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") + Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ + Remove-Item -Path .\output -Recurse + # Commits the build output to the branch and tags it with the version + - name: Commit build output and tag the commit + shell: powershell + run: | + git config user.email "actions@pepperdash.com" + git config user.name "GitHub Actions" + git add . + $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" + Write-Host "Commit: $commit" + git commit -m $commit + git tag $($Env:VERSION) + # Push the commit + - name: Push to Builds Repo + shell: powershell + run: | + $branch = $($Env:GITHUB_REF) -replace "refs/heads/" + Write-Host "Branch: $branch" + git push -u origin $($branch) --force + # Push the tags + - name: Push tags + run: git push --tags origin + - name: Check Directory + run: Get-ChildItem ./ From 91464d8ec15bcd505c83fe5fcd241c879c1e96f1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:35:24 -0600 Subject: [PATCH 088/150] remove new workflow and add pull-request trigger to existing workflow --- .github/workflows/docker.yml | 3 + .github/workflows/pull-request.yml | 266 ----------------------------- 2 files changed, 3 insertions(+), 266 deletions(-) delete mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3eb3e42e..f823491b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,6 +8,9 @@ on: - bugfix/* - release/* - development + pull_request: + branches: + - development env: # solution path doesn't need slashes unless there it is multiple folders deep diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index aad90bca..00000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,266 +0,0 @@ -name: Pull Request Build Using Docker - -on: - pull_request: - branches: - - development - -env: - # solution path doesn't need slashes unless there it is multiple folders deep - # solution name does not include extension. .sln is assumed - SOLUTION_PATH: PepperDashEssentials - SOLUTION_FILE: PepperDashEssentials - # Do not edit this, we're just creating it here - VERSION: 0.0.0-buildtype-buildnumber - # Defaults to debug for build type - BUILD_TYPE: Debug - # Defaults to main as the release branch. Change as necessary - RELEASE_BRANCH: main -jobs: - Build_Project: - runs-on: windows-latest - steps: - # First we checkout the source repo - - name: Checkout repo - uses: actions/checkout@v2 - with: - fetch-depth: 0 - # And any submodules - - name: Checkout submodules - shell: bash - run: | - git config --global url."https://github.com/".insteadOf "git@github.com:" - auth_header="$(git config --local --get http.https://github.com/.extraheader)" - git submodule sync --recursive - git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 - # Fetch all tags - - name: Fetch tags - run: git fetch --tags - # Generate the appropriate version number - - name: Set Version Number - shell: powershell - run: | - $version = ./.github/scripts/GenerateVersionNumber.ps1 - Write-Output "::set-env name=VERSION::$version" - # Use the version number to set the version of the assemblies - - name: Update AssemblyInfo.cs - shell: powershell - run: | - Write-Output ${{ env.VERSION }} - ./.github/scripts/UpdateAssemblyVersion.ps1 ${{ env.VERSION }} - # Login to Docker - - name: Login to Docker - uses: azure/docker-login@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_TOKEN }} - # Build the solutions in the docker image - - name: Build Solution - shell: powershell - run: | - Invoke-Expression "docker run --rm --mount type=bind,source=""$($Env:GITHUB_WORKSPACE)"",target=""c:/project"" pepperdash/sspbuilder c:\cihelpers\vsidebuild.exe -Solution ""c:\project\$($Env:SOLUTION_FILE).sln"" -BuildSolutionConfiguration $($ENV:BUILD_TYPE)" - # Zip up the output files as needed - - name: Zip Build Output - shell: powershell - run: ./.github/scripts/ZipBuildOutput.ps1 - # Write the version to a file to be consumed by the push jobs - - name: Write Version - run: Write-Output "$($Env:VERSION)" | Out-File -FilePath "$($Env:GITHUB_HOME)\output\version.txt" - # Upload the build output as an artifact - - name: Upload Build Output - uses: actions/upload-artifact@v1 - with: - name: Build - path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip - # Upload the Version file as an artifact - - name: Upload version.txt - uses: actions/upload-artifact@v1 - with: - name: Version - path: ${{env.GITHUB_HOME}}\output\version.txt - # Create the release on the source repo - - name: Create tag for non-rc builds - if: contains(env.VERSION, 'alpha') || contains(env.VERSION, 'beta') - run: | - git tag $($Env:VERSION) - git push --tags origin - - name: Create Release - id: create_release - # using contributor's version to allow for pointing at the right commit - if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-') - uses: fleskesvor/create-release@feature/support-target-commitish - with: - tag_name: ${{ env.VERSION }} - release_name: ${{ env.VERSION }} - prerelease: ${{contains('debug', env.BUILD_TYPE)}} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Upload the build package to the release - - name: Upload Release Package - if: contains(env.VERSION,'-rc-') || contains(env.VERSION,'-hotfix-') - id: upload_release - uses: actions/upload-release-asset@v1 - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip - asset_name: ${{ env.SOLUTION_FILE}}-${{ env.VERSION}}.zip - asset_content_type: application/zip - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # This step always runs and pushes the build to the internal build rep - Internal_Push_Output: - needs: Build_Project - runs-on: windows-latest - steps: - - name: check Github ref - run: ${{toJson(github.ref)}} - # Checkout the repo - - name: Checkout Builds Repo - uses: actions/checkout@v2 - with: - token: ${{ secrets.BUILDS_TOKEN }} - repository: PepperDash-Engineering/essentials-builds - ref: ${{ Env.GITHUB_REF }} - # Download the version artifact from the build job - - name: Download Build Version Info - uses: actions/download-artifact@v1 - with: - name: Version - - name: Check Directory - run: Get-ChildItem "./" - # Set the version number environment variable from the file we just downloaded - - name: Set Version Number - shell: powershell - run: | - Get-ChildItem "./Version" - $version = Get-Content -Path ./Version/version.txt - Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" - Remove-Item -Path ./Version/version.txt - Remove-Item -Path ./Version - # Checkout/Create the branch - - name: Create new branch - run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") - # Download the build output into the repo - - name: Download Build output - uses: actions/download-artifact@v1 - with: - name: Build - path: ./ - - name: Check directory - run: Get-ChildItem ./ - # Unzip the build package file - - name: Unzip Build file - run: | - Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ - Remove-Item -Path .\*.zip - - name: Check directory again - run: Get-ChildItem ./ - # Copy Contents of output folder to root directory - - name: Copy Files to root & delete output directory - run: | - Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") - Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ - Remove-Item -Path .\output -Recurse - # Commits the build output to the branch and tags it with the version - - name: Commit build output and tag the commit - shell: powershell - run: | - git config user.email "actions@pepperdash.com" - git config user.name "GitHub Actions" - git add . - $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" - Write-Host "Commit: $commit" - git commit -m $commit - git tag $($Env:VERSION) - # Push the commit - - name: Push to Builds Repo - shell: powershell - run: | - $branch = $($Env:GITHUB_REF) -replace "refs/heads/" - Write-Host "Branch: $branch" - git push -u origin $($branch) --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 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, 'main') || contains(github.ref, '/release/') - steps: - # Checkout the repo - - name: check Github ref - run: ${{toJson(github.ref)}} - - name: Checkout Builds Repo - uses: actions/checkout@v2 - with: - token: ${{ secrets.BUILDS_TOKEN }} - repository: PepperDash/Essentials-Builds - ref: ${{ Env.GITHUB_REF }} - # Download the version artifact from the build job - - name: Download Build Version Info - uses: actions/download-artifact@v1 - with: - name: Version - - name: Check Directory - run: Get-ChildItem "./" - # Set the version number environment variable from the file we just downloaded - - name: Set Version Number - shell: powershell - run: | - Get-ChildItem "./Version" - $version = Get-Content -Path ./Version/version.txt - Write-Host "Version: $version" - Write-Output "::set-env name=VERSION::$version" - Remove-Item -Path ./Version/version.txt - Remove-Item -Path ./Version - # Checkout/Create the branch - - name: Create new branch - run: git checkout -b $($Env:GITHUB_REF -replace "refs/heads/") - # Download the build output into the repo - - name: Download Build output - uses: actions/download-artifact@v1 - with: - name: Build - path: ./ - - name: Check directory - run: Get-ChildItem ./ - # Unzip the build package file - - name: Unzip Build file - run: | - Get-ChildItem .\*.zip | Expand-Archive -DestinationPath .\ - Remove-Item -Path .\*.zip - - name: Check directory again - run: Get-ChildItem ./ - # Copy Contents of output folder to root directory - - name: Copy Files to root & delete output directory - run: | - Remove-Item -Path .\* -Include @("*.cpz","*.md","*.cplz","*.json","*.dll","*.clz") - Get-ChildItem -Path .\output\* | Copy-Item -Destination .\ - Remove-Item -Path .\output -Recurse - # Commits the build output to the branch and tags it with the version - - name: Commit build output and tag the commit - shell: powershell - run: | - git config user.email "actions@pepperdash.com" - git config user.name "GitHub Actions" - git add . - $commit = "Build $($Env:GITHUB_RUN_NUMBER) from commit: https://github.com/$($Env:GITHUB_REPOSITORY)/commit/$($Env:GITHUB_SHA)" - Write-Host "Commit: $commit" - git commit -m $commit - git tag $($Env:VERSION) - # Push the commit - - name: Push to Builds Repo - shell: powershell - run: | - $branch = $($Env:GITHUB_REF) -replace "refs/heads/" - Write-Host "Branch: $branch" - git push -u origin $($branch) --force - # Push the tags - - name: Push tags - run: git push --tags origin - - name: Check Directory - run: Get-ChildItem ./ From ea3cb6eb8054092881cd9b42e25d53776da6dda6 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:42:13 -0600 Subject: [PATCH 089/150] added check for GITHUB_REF --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f823491b..1656a4c0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -47,6 +47,7 @@ jobs: - name: Set Version Number shell: powershell run: | + Write-Output ${{ env.GITHUB_REF }} $version = ./.github/scripts/GenerateVersionNumber.ps1 Write-Output "::set-env name=VERSION::$version" # Use the version number to set the version of the assemblies From 51f5d7e07bef77852824142a756fb70845443d1c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:46:26 -0600 Subject: [PATCH 090/150] added print info step --- .github/workflows/docker.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1656a4c0..388c68d3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -43,11 +43,12 @@ jobs: # Fetch all tags - name: Fetch tags run: git fetch --tags + - name: print Info + run: toJson(${{ github }}) # Generate the appropriate version number - name: Set Version Number shell: powershell run: | - Write-Output ${{ env.GITHUB_REF }} $version = ./.github/scripts/GenerateVersionNumber.ps1 Write-Output "::set-env name=VERSION::$version" # Use the version number to set the version of the assemblies From 48220b8fe97e0e9beea0b0bb8ea8157aa85633b6 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:47:57 -0600 Subject: [PATCH 091/150] fix expression syntax --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 388c68d3..3e6969b5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: - name: Fetch tags run: git fetch --tags - name: print Info - run: toJson(${{ github }}) + run: toJson(github) # Generate the appropriate version number - name: Set Version Number shell: powershell From 44f6b465d4a51fd01b94171c5727c1f0d3afaaff Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:49:39 -0600 Subject: [PATCH 092/150] really fix expression syntax --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3e6969b5..3479055e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: - name: Fetch tags run: git fetch --tags - name: print Info - run: toJson(github) + run: ${{ toJson(github) }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 67cdd8bfa6f14e6c4405b3ffffeae650d6c4cd1f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:52:44 -0600 Subject: [PATCH 093/150] add print env step --- .github/workflows/docker.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3479055e..61034efc 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -43,8 +43,10 @@ jobs: # Fetch all tags - name: Fetch tags run: git fetch --tags - - name: print Info - run: ${{ toJson(github) }} + - name: print github info + run: ${{ github }} + - name: print env Info + run: ${{env}} # Generate the appropriate version number - name: Set Version Number shell: powershell From a03e6824c502ffa3c83a46e29dde0e00c175f5a1 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:55:05 -0600 Subject: [PATCH 094/150] trying to get environment variables --- .github/workflows/docker.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 61034efc..bcc4e5a0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -43,10 +43,8 @@ jobs: # Fetch all tags - name: Fetch tags run: git fetch --tags - - name: print github info - run: ${{ github }} - - name: print env Info - run: ${{env}} + - name: print env info + run: ${{ toJson(env) }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 1f21b573e2c9ccff51d8c7a70e5961590c24420f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 13:57:00 -0600 Subject: [PATCH 095/150] print GITHUB_REF --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bcc4e5a0..706a6578 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: - name: Fetch tags run: git fetch --tags - name: print env info - run: ${{ toJson(env) }} + run: ${{ env.GITHUB_REF }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 2e788d19177a2e7cbdd295e12869ece6ad621ccd Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:05:44 -0600 Subject: [PATCH 096/150] figuring out what ref to use --- .github/workflows/docker.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 706a6578..6bfe58d9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,10 @@ jobs: - name: Fetch tags run: git fetch --tags - name: print env info - run: ${{ env.GITHUB_REF }} + run: | + ${{ env.GITHUB_REF }} + ${{ env.GITHUB_HEAD_REF }} + ${{ env.GITHUB_BASE_REF }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 4d4230d9f40e719e2cb04a7ff9388e590a238ae9 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:13:43 -0600 Subject: [PATCH 097/150] getting all env variables --- .github/workflows/docker.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 6bfe58d9..ba2f75f5 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,10 +44,7 @@ jobs: - name: Fetch tags run: git fetch --tags - name: print env info - run: | - ${{ env.GITHUB_REF }} - ${{ env.GITHUB_HEAD_REF }} - ${{ env.GITHUB_BASE_REF }} + run: ${{ env }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 6b908e18de131ead66639ac1a52f46a613f4dc11 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:18:14 -0600 Subject: [PATCH 098/150] updating script for forked builds --- .github/scripts/GenerateVersionNumber.ps1 | 55 ++++++++++++----------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index 75a18d37..a0b35b69 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -17,31 +17,36 @@ Foreach ($version in $latestVersions) { $newVersion = [version]$latestVersion $phase = "" $newVersionString = "" -switch -regex ($Env:GITHUB_REF) { - '^refs\/heads\/main*.' { - $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build - } - '^refs\/heads\/feature\/*.' { - $phase = 'alpha' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/release\/*.' { - $splitRef = $Env:GITHUB_REF -split "/" - $version = [version]($splitRef[-1] -replace "v", "") - $phase = 'rc' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/development*.' { - $phase = 'beta' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/hotfix\/*.' { - $phase = 'hotfix' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/bugfix\/*.' { - $phase = 'hotfix' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER +if(!$Env:GITHUB_REF) { + $phase = 'fork' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER +} else { + switch -regex ($Env:GITHUB_REF) { + '^refs\/heads\/main*.' { + $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build + } + '^refs\/heads\/feature\/*.' { + $phase = 'alpha' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/release\/*.' { + $splitRef = $Env:GITHUB_REF -split "/" + $version = [version]($splitRef[-1] -replace "v", "") + $phase = 'rc' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/development*.' { + $phase = 'beta' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/hotfix\/*.' { + $phase = 'hotfix' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/bugfix\/*.' { + $phase = 'hotfix' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } } } From 5f04190e6aa237cf146955bfae21133790cce207 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:19:28 -0600 Subject: [PATCH 099/150] removed info print name --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ba2f75f5..738e6211 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -44,7 +44,7 @@ jobs: - name: Fetch tags run: git fetch --tags - name: print env info - run: ${{ env }} + run: ${{ toJson() }} # Generate the appropriate version number - name: Set Version Number shell: powershell From c7363c6434856a61e6c6014393965ccd1cad7308 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:20:36 -0600 Subject: [PATCH 100/150] removed print step --- .github/workflows/docker.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 738e6211..f823491b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -43,8 +43,6 @@ jobs: # Fetch all tags - name: Fetch tags run: git fetch --tags - - name: print env info - run: ${{ toJson() }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 6160580f0817a03b8c75eb3fde1242e1f0c924ba Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:26:43 -0600 Subject: [PATCH 101/150] removed submodule checkout and moved it to checkout action --- .github/workflows/docker.yml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f823491b..315fbd67 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -32,14 +32,7 @@ jobs: uses: actions/checkout@v2 with: fetch-depth: 0 - # And any submodules - - name: Checkout submodules - shell: bash - run: | - git config --global url."https://github.com/".insteadOf "git@github.com:" - auth_header="$(git config --local --get http.https://github.com/.extraheader)" - git submodule sync --recursive - git -c "http.extraheader=$auth_header" -c protocol.version=2 submodule update --init --force --recursive --depth=1 + submodules: true # Fetch all tags - name: Fetch tags run: git fetch --tags From 708d4c266e53f45688e590f639c6e6e20867b378 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:28:02 -0600 Subject: [PATCH 102/150] adding some print info back --- .github/workflows/docker.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 315fbd67..481045eb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -36,6 +36,10 @@ jobs: # Fetch all tags - name: Fetch tags run: git fetch --tags + - name: print info + run: | + ${{ toJson(github) }} + ${{ toJson(env) }} # Generate the appropriate version number - name: Set Version Number shell: powershell From acdff4ad670f6a329e7351eda30680e8bf1a8ff3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:31:05 -0600 Subject: [PATCH 103/150] add string IsNullOrEmpty check --- .github/scripts/GenerateVersionNumber.ps1 | 2 +- .github/workflows/docker.yml | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index a0b35b69..78143388 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -17,7 +17,7 @@ Foreach ($version in $latestVersions) { $newVersion = [version]$latestVersion $phase = "" $newVersionString = "" -if(!$Env:GITHUB_REF) { +if([string]::IsNullOrEmpty($Env:GITHUB_REF)) { $phase = 'fork' $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER } else { diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 481045eb..315fbd67 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -36,10 +36,6 @@ jobs: # Fetch all tags - name: Fetch tags run: git fetch --tags - - name: print info - run: | - ${{ toJson(github) }} - ${{ toJson(env) }} # Generate the appropriate version number - name: Set Version Number shell: powershell From 83ca3ee3509fec28315da54e7c99b85f4cdf2c59 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:34:23 -0600 Subject: [PATCH 104/150] printing things in powershell --- .github/scripts/GenerateVersionNumber.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index 78143388..75897bf6 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -1,5 +1,8 @@ $latestVersions = $(git tag --merged origin/main) $latestVersion = [version]"0.0.0" +Write-Host "GITHUB_REF: $($Env:GITHUB_REF)" +Write-Host "GITHUB_HEAD_REF: $($Env:GITHUB_HEAD_REF)" +Write-Host "GITHUB_BASE_REF: $($Env:GITHUB_BASE_REF)" Foreach ($version in $latestVersions) { Write-Host $version try { From a26c951dbae8b69554284e8fd99ca28150eadd77 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 29 Jun 2020 14:47:54 -0600 Subject: [PATCH 105/150] add logic to add pr postfix for pr triggered builds --- .github/scripts/GenerateVersionNumber.ps1 | 62 ++++++++++++----------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/.github/scripts/GenerateVersionNumber.ps1 b/.github/scripts/GenerateVersionNumber.ps1 index 75897bf6..9cccbf43 100644 --- a/.github/scripts/GenerateVersionNumber.ps1 +++ b/.github/scripts/GenerateVersionNumber.ps1 @@ -20,37 +20,39 @@ Foreach ($version in $latestVersions) { $newVersion = [version]$latestVersion $phase = "" $newVersionString = "" -if([string]::IsNullOrEmpty($Env:GITHUB_REF)) { - $phase = 'fork' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER -} else { - switch -regex ($Env:GITHUB_REF) { - '^refs\/heads\/main*.' { - $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build - } - '^refs\/heads\/feature\/*.' { - $phase = 'alpha' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/release\/*.' { - $splitRef = $Env:GITHUB_REF -split "/" - $version = [version]($splitRef[-1] -replace "v", "") - $phase = 'rc' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/development*.' { - $phase = 'beta' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/hotfix\/*.' { - $phase = 'hotfix' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } - '^refs\/heads\/bugfix\/*.' { - $phase = 'hotfix' - $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER - } + +switch -regex ($Env:GITHUB_REF) { + '^refs\/pull\/*.' { + $splitRef = $Env:GITHUB_REF -split "/" + $phase = "pr$($splitRef[2])" + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER } + '^refs\/heads\/main*.' { + $newVersionString = "{0}.{1}.{2}" -f $newVersion.Major, $newVersion.Minor, $newVersion.Build + } + '^refs\/heads\/feature\/*.' { + $phase = 'alpha' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/release\/*.' { + $splitRef = $Env:GITHUB_REF -split "/" + $version = [version]($splitRef[-1] -replace "v", "") + $phase = 'rc' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $version.Major, $version.Minor, $version.Build, $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/development*.' { + $phase = 'beta' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/hotfix\/*.' { + $phase = 'hotfix' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + '^refs\/heads\/bugfix\/*.' { + $phase = 'hotfix' + $newVersionString = "{0}.{1}.{2}-{3}-{4}" -f $newVersion.Major, $newVersion.Minor, ($newVersion.Build + 1), $phase, $Env:GITHUB_RUN_NUMBER + } + } From 5d1aa3b0247fd1ede554b0c6af4155884d7c7fbb Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 30 Jun 2020 11:01:46 -0500 Subject: [PATCH 106/150] Added a null check to determining SIP information Resolves #290 --- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 33 ++++++++++++------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index 05bd7b01..ffcffbac 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -1658,7 +1658,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { get { - if (CodecStatus.Status.SIP.Registration.Count > 0) + if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.Registration.Count > 0) { var match = Regex.Match(CodecStatus.Status.SIP.Registration[0].URI.Value, @"(\d+)"); // extract numbers only if (match.Success) @@ -1678,17 +1678,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco return string.Empty; } } - } - public override string SipUri - { - get - { - if (CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null) - return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value; - else - return string.Empty; - } - } + } + + public override string SipUri + { + get + { + if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null) + { + return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value; + } + else if (CodecStatus.Status.UserInterface != null && + CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value != null) + { + return CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value; + } + else + return string.Empty; + } + } + public override bool AutoAnswerEnabled { get From e1c93cc13a4e0142cca5bdc718d332bb60c04ea8 Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Tue, 30 Jun 2020 12:03:48 -0500 Subject: [PATCH 107/150] Updates to correct 'hardware' references accidentally changed to 'sensor'. Updated SIMPLBridge example config to include GLS-PART-CN configuration Resolves #270 --- .../SIMPLBridgeExample_configurationFile.json | 17 + .../JoinMaps/GlsPartitionSensorJoinMap.cs | 130 +++ .../JoinMaps/JoinMapBase.cs | 958 +++++++++--------- .../PepperDash_Essentials_Core.csproj | 1 + .../Essentials Devices Common.csproj | 2 + .../GlsPartitionSensorController.cs | 257 +++++ .../GlsPartitionSensorControllerFactory.cs | 39 + 7 files changed, 925 insertions(+), 479 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs create mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs create mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs diff --git a/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json b/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json index 3fb02ce8..f66add0c 100644 --- a/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json +++ b/PepperDashEssentials/Example Configuration/SIMPLBridging/SIMPLBridgeExample_configurationFile.json @@ -175,6 +175,10 @@ { "deviceKey": "gls-odt-1", "joinStart": 2751 + }, + { + "deviceKey": "gls-part-1", + "joinStart": 2781 } ] } @@ -427,6 +431,19 @@ "method": "cresnet" } } + }, + { + "key": "gls-part-1", + "uid": 19, + "name": "GLS-PART-CN 1", + "type": "glspartcn", + "group": "partition", + "properties": { + "control": { + "cresnetId": "90", + "method": "cresnet" + } + } } ], "rooms": [], diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs new file mode 100644 index 00000000..cc554790 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/GlsPartitionSensorJoinMap.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using PepperDash.Essentials.Core; + +namespace PepperDash_Essentials_Core.Bridges.JoinMaps +{ + public class GlsPartitionSensorJoinMap : JoinMapBaseAdvanced + { + [JoinName("IsOnline")] + public JoinDataComplete IsOnline = new JoinDataComplete( + new JoinData() + { + JoinNumber = 1, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Is Online", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("Name")] + public JoinDataComplete Name = new JoinDataComplete( + new JoinData() + { + JoinNumber = 1, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Name", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Serial + }); + + [JoinName("Enable")] + public JoinDataComplete Enable = new JoinDataComplete( + new JoinData() + { + JoinNumber = 2, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Enable", + JoinCapabilities = eJoinCapabilities.ToFromSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("PartitionSensed")] + public JoinDataComplete PartitionSensed = new JoinDataComplete( + new JoinData() + { + JoinNumber = 3, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Partition Sensed", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("PartitionNotSensed")] + public JoinDataComplete PartitionNotSensed = new JoinDataComplete( + new JoinData() + { + JoinNumber = 4, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Partition Not Sensed", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("IncreaseSensitivity")] + public JoinDataComplete IncreaseSensitivity = new JoinDataComplete( + new JoinData() + { + JoinNumber = 6, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Increase Sensitivity", + JoinCapabilities = eJoinCapabilities.FromSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("DecreaseSensitivity")] + public JoinDataComplete DecreaseSensitivity = new JoinDataComplete( + new JoinData() + { + JoinNumber = 7, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Decrease Sensitivity", + JoinCapabilities = eJoinCapabilities.FromSIMPL, + JoinType = eJoinType.Digital + }); + + [JoinName("Sensitivity")] + public JoinDataComplete Sensitivity = new JoinDataComplete( + new JoinData() + { + JoinNumber = 2, + JoinSpan = 1 + }, + new JoinMetadata() + { + Description = "Sensor Sensitivity", + JoinCapabilities = eJoinCapabilities.ToFromSIMPL, + JoinType = eJoinType.Analog + }); + + public GlsPartitionSensorJoinMap(uint joinStart) + : base(joinStart, typeof (GlsPartitionSensorJoinMap)) + { + + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs index 676299e5..ba6b3482 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/JoinMaps/JoinMapBase.cs @@ -1,488 +1,488 @@ -using System; -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; -using Crestron.SimplSharp.Reflection; - -using PepperDash.Core; -using PepperDash.Essentials.Core.Config; - -using Newtonsoft.Json; - -namespace PepperDash.Essentials.Core -{ - public static class JoinMapHelper - { - /// - /// Attempts to get the serialized join map from config - /// - /// - /// - public static string GetSerializedJoinMapForDevice(string joinMapKey) - { - if (string.IsNullOrEmpty(joinMapKey)) - return null; - - var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey]; - - return joinMap; - } - - /// - /// Attempts to get the serialized join map from config - /// - /// - /// - public static string GetJoinMapForDevice(string joinMapKey) - { - return GetSerializedJoinMapForDevice(joinMapKey); - } - - /// - /// Attempts to find a custom join map by key and returns it deserialized if found - /// - /// - /// - public static Dictionary TryGetJoinMapAdvancedForDevice(string joinMapKey) - { - if (string.IsNullOrEmpty(joinMapKey)) - return null; - - var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey]; - - if (joinMapSerialzed == null) return null; - - var joinMapData = JsonConvert.DeserializeObject>(joinMapSerialzed); - - return joinMapData; - } - - } - - /// - /// Base class for join maps - /// - [Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")] - public abstract class JoinMapBase - { - /// - /// Modifies all the join numbers by adding the offset. This should never be called twice - /// - /// - public abstract void OffsetJoinNumbers(uint joinStart); - - /// - /// The collection of joins and associated metadata - /// - public Dictionary Joins = new Dictionary(); - - /// - /// Prints the join information to console - /// - public void PrintJoinMapInfo() - { - Debug.Console(0, "{0}:\n", GetType().Name); - - // Get the joins of each type and print them - Debug.Console(0, "Digitals:"); - var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); - Debug.Console(2, "Found {0} Digital Joins", digitals.Count); - PrintJoinList(GetSortedJoins(digitals)); - - Debug.Console(0, "Analogs:"); - var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); - Debug.Console(2, "Found {0} Analog Joins", analogs.Count); - PrintJoinList(GetSortedJoins(analogs)); - - Debug.Console(0, "Serials:"); - var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); - Debug.Console(2, "Found {0} Serial Joins", serials.Count); - PrintJoinList(GetSortedJoins(serials)); - - } - - /// - /// Returns a sorted list by JoinNumber - /// - /// - /// - List> GetSortedJoins(Dictionary joins) - { - var sortedJoins = joins.ToList(); - - sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber)); - - return sortedJoins; - } - - void PrintJoinList(List> joins) - { - foreach (var join in joins) - { - Debug.Console(0, - @"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'", - join.Value.JoinNumber, - join.Value.Label, - join.Value.JoinSpan, - join.Value.JoinType.ToString(), - join.Value.JoinCapabilities.ToString()); - } - } - - /// - /// Returns the join number for the join with the specified key - /// - /// - /// - public uint GetJoinForKey(string key) - { - return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0; - } - - /// - /// Returns the join span for the join with the specified key - /// - /// - /// - public uint GetJoinSpanForKey(string key) - { - return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0; - } - } - - /// - /// Base class for join maps - /// - public abstract class JoinMapBaseAdvanced - { - protected uint JoinOffset; - - /// - /// The collection of joins and associated metadata - /// - public Dictionary Joins { get; private set; } - - protected JoinMapBaseAdvanced(uint joinStart) - { - Joins = new Dictionary(); - - JoinOffset = joinStart - 1; - } - - protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart) - { - AddJoins(type); - } - - protected void AddJoins(Type type) - { - // Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset - //Joins = this.GetType() - // .GetCType() - // .GetFields(BindingFlags.Public | BindingFlags.Instance) - // .Where(field => field.IsDefined(typeof(JoinNameAttribute), true)) - // .Select(field => (JoinDataComplete)field.GetValue(this)) - // .ToDictionary(join => join.GetNameAttribute(), join => - // { - // join.SetJoinOffset(_joinOffset); - // return join; - // }); - - //type = this.GetType(); <- this wasn't working because 'this' was always the base class, never the derived class - var fields = - type.GetCType() - .GetFields(BindingFlags.Public | BindingFlags.Instance) - .Where(f => f.IsDefined(typeof (JoinNameAttribute), true)); - - foreach (var field in fields) - { - var childClass = Convert.ChangeType(this, type, null); - - var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields. - - if (value == null) - { - Debug.Console(0, "Unable to caset base class to {0}", type.Name); - continue; - } - - value.SetJoinOffset(JoinOffset); - - var joinName = value.GetNameAttribute(field); - - if (String.IsNullOrEmpty(joinName)) continue; - - Joins.Add(joinName, value); - } - - - PrintJoinMapInfo(); - } - - /// - /// Prints the join information to console - /// - public void PrintJoinMapInfo() - { - Debug.Console(0, "{0}:\n", GetType().Name); - - // Get the joins of each type and print them - Debug.Console(0, "Digitals:"); - var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); - Debug.Console(2, "Found {0} Digital Joins", digitals.Count); - PrintJoinList(GetSortedJoins(digitals)); - - Debug.Console(0, "Analogs:"); - var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); - Debug.Console(2, "Found {0} Analog Joins", analogs.Count); - PrintJoinList(GetSortedJoins(analogs)); - - Debug.Console(0, "Serials:"); - var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); - Debug.Console(2, "Found {0} Serial Joins", serials.Count); - PrintJoinList(GetSortedJoins(serials)); - - } - - /// - /// Returns a sorted list by JoinNumber - /// - /// - /// - List> GetSortedJoins(Dictionary joins) - { - var sortedJoins = joins.ToList(); - - sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber)); - - return sortedJoins; - } - - void PrintJoinList(List> joins) - { - foreach (var join in joins) - { - Debug.Console(0, - @"Join Number: {0} | JoinSpan: '{1}' | Label: '{2}' | Type: '{3}' | Capabilities: '{4}'", - join.Value.JoinNumber, - join.Value.JoinSpan, - join.Value.Metadata.Label, - join.Value.Metadata.JoinType.ToString(), - join.Value.Metadata.JoinCapabilities.ToString()); - } - } - - /// - /// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom - /// - /// - public void SetCustomJoinData(Dictionary joinData) - { - foreach (var customJoinData in joinData) - { - var join = Joins[customJoinData.Key]; - - if (join != null) - { - join.SetCustomJoinData(customJoinData.Value); - } - else - { - Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key); - } - } - - PrintJoinMapInfo(); - } - - ///// - ///// Returns the join number for the join with the specified key - ///// - ///// - ///// - //public uint GetJoinForKey(string key) - //{ - // return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0; - //} - - - ///// - ///// Returns the join span for the join with the specified key - ///// - ///// - ///// - //public uint GetJoinSpanForKey(string key) - //{ - // return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0; - //} - } - - /// - /// Read = Provides feedback to SIMPL - /// Write = Responds to sig values from SIMPL - /// - [Flags] - public enum eJoinCapabilities - { - None = 0, - ToSIMPL = 1, - FromSIMPL = 2, - ToFromSIMPL = ToSIMPL | FromSIMPL - } - - [Flags] - public enum eJoinType - { - None = 0, - Digital = 1, - Analog = 2, - Serial = 4, - DigitalAnalog = Digital | Analog, - DigitalSerial = Digital | Serial, - AnalogSerial = Analog | Serial, - DigitalAnalogSerial = Digital | Analog | Serial - } - - /// - /// Metadata describing the join - /// - public class JoinMetadata +using Crestron.SimplSharp.Reflection; + +using PepperDash.Core; +using PepperDash.Essentials.Core.Config; + +using Newtonsoft.Json; + +namespace PepperDash.Essentials.Core +{ + public static class JoinMapHelper { - private string _description; - - /// - /// Join number (based on join offset value) - /// - [JsonProperty("joinNumber")] - [Obsolete] - public uint JoinNumber { get; set; } - /// - /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range - /// - [Obsolete] - [JsonProperty("joinSpan")] - public uint JoinSpan { get; set; } - - /// - /// A label for the join to better describe its usage - /// - [Obsolete("Use Description instead")] - [JsonProperty("label")] - public string Label { get { return _description; } set { _description = value; } } - /// - /// A description for the join to better describe its usage - /// - [JsonProperty("description")] - public string Description { get { return _description; } set { _description = value; } } - /// - /// Signal type(s) - /// - [JsonProperty("joinType")] - public eJoinType JoinType { get; set; } - /// - /// Indicates whether the join is read and/or write - /// - [JsonProperty("joinCapabilities")] - public eJoinCapabilities JoinCapabilities { get; set; } - /// - /// Indicates a set of valid values (particularly if this translates to an enum - /// - [JsonProperty("validValues")] - public string[] ValidValues { get; set; } - - } - - /// - /// Data describing the join. Can be - /// - public class JoinData - { - /// - /// Join number (based on join offset value) - /// - [JsonProperty("joinNumber")] - public uint JoinNumber { get; set; } - /// - /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range - /// - [JsonProperty("joinSpan")] - public uint JoinSpan { get; set; } - } - - /// - /// A class to aggregate the JoinData and JoinMetadata for a join - /// - public class JoinDataComplete - { - private uint _joinOffset; - - private JoinData _data; - public JoinMetadata Metadata { get; set; } - - public JoinDataComplete(JoinData data, JoinMetadata metadata) - { - _data = data; - Metadata = metadata; - } - - /// - /// Sets the join offset value - /// - /// - public void SetJoinOffset(uint joinOffset) - { - _joinOffset = joinOffset; - } - - /// - /// The join number (including the offset) - /// - public uint JoinNumber - { - get { return _data.JoinNumber+ _joinOffset; } - set { _data.JoinNumber = value; } - } - - public uint JoinSpan - { - get { return _data.JoinSpan; } - } - - public void SetCustomJoinData(JoinData customJoinData) - { - _data = customJoinData; - } - - public string GetNameAttribute(MemberInfo memberInfo) - { - var name = string.Empty; - var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute)); - - if (attribute == null) return name; - - name = attribute.Name; - Debug.Console(2, "JoinName Attribute value: {0}", name); - return name; + /// Attempts to get the serialized join map from config + /// + /// + /// + public static string GetSerializedJoinMapForDevice(string joinMapKey) + { + if (string.IsNullOrEmpty(joinMapKey)) + return null; + + var joinMap = ConfigReader.ConfigObject.JoinMaps[joinMapKey]; + + return joinMap; + } + + /// + /// Attempts to get the serialized join map from config + /// + /// + /// + public static string GetJoinMapForDevice(string joinMapKey) + { + return GetSerializedJoinMapForDevice(joinMapKey); + } + + /// + /// Attempts to find a custom join map by key and returns it deserialized if found + /// + /// + /// + public static Dictionary TryGetJoinMapAdvancedForDevice(string joinMapKey) + { + if (string.IsNullOrEmpty(joinMapKey)) + return null; + + var joinMapSerialzed = ConfigReader.ConfigObject.JoinMaps[joinMapKey]; + + if (joinMapSerialzed == null) return null; + + var joinMapData = JsonConvert.DeserializeObject>(joinMapSerialzed); + + return joinMapData; + } + + } + + /// + /// Base class for join maps + /// + [Obsolete("This is being deprecated in favor of JoinMapBaseAdvanced")] + public abstract class JoinMapBase + { + /// + /// Modifies all the join numbers by adding the offset. This should never be called twice + /// + /// + public abstract void OffsetJoinNumbers(uint joinStart); + + /// + /// The collection of joins and associated metadata + /// + public Dictionary Joins = new Dictionary(); + + /// + /// Prints the join information to console + /// + public void PrintJoinMapInfo() + { + Debug.Console(0, "{0}:\n", GetType().Name); + + // Get the joins of each type and print them + Debug.Console(0, "Digitals:"); + var digitals = Joins.Where(j => (j.Value.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Digital Joins", digitals.Count); + PrintJoinList(GetSortedJoins(digitals)); + + Debug.Console(0, "Analogs:"); + var analogs = Joins.Where(j => (j.Value.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Analog Joins", analogs.Count); + PrintJoinList(GetSortedJoins(analogs)); + + Debug.Console(0, "Serials:"); + var serials = Joins.Where(j => (j.Value.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Serial Joins", serials.Count); + PrintJoinList(GetSortedJoins(serials)); + + } + + /// + /// Returns a sorted list by JoinNumber + /// + /// + /// + List> GetSortedJoins(Dictionary joins) + { + var sortedJoins = joins.ToList(); + + sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber)); + + return sortedJoins; + } + + void PrintJoinList(List> joins) + { + foreach (var join in joins) + { + Debug.Console(0, + @"Join Number: {0} | Label: '{1}' | JoinSpan: '{2}' | Type: '{3}' | Capabilities: '{4}'", + join.Value.JoinNumber, + join.Value.Label, + join.Value.JoinSpan, + join.Value.JoinType.ToString(), + join.Value.JoinCapabilities.ToString()); + } + } + + /// + /// Returns the join number for the join with the specified key + /// + /// + /// + public uint GetJoinForKey(string key) + { + return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0; + } + + /// + /// Returns the join span for the join with the specified key + /// + /// + /// + public uint GetJoinSpanForKey(string key) + { + return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0; } } - - - [AttributeUsage(AttributeTargets.All)] - public class JoinNameAttribute : CAttribute - { - private string _Name; - - public JoinNameAttribute(string name) - { - Debug.Console(2, "Setting Attribute Name: {0}", name); - _Name = name; - } - - public string Name - { - get { return _Name; } - } + /// + /// Base class for join maps + /// + public abstract class JoinMapBaseAdvanced + { + protected uint JoinOffset; + + /// + /// The collection of joins and associated metadata + /// + public Dictionary Joins { get; private set; } + + protected JoinMapBaseAdvanced(uint joinStart) + { + Joins = new Dictionary(); + + JoinOffset = joinStart - 1; + } + + protected JoinMapBaseAdvanced(uint joinStart, Type type):this(joinStart) + { + AddJoins(type); + } + + protected void AddJoins(Type type) + { + // Add all the JoinDataComplete properties to the Joins Dictionary and pass in the offset + //Joins = this.GetType() + // .GetCType() + // .GetFields(BindingFlags.Public | BindingFlags.Instance) + // .Where(field => field.IsDefined(typeof(JoinNameAttribute), true)) + // .Select(field => (JoinDataComplete)field.GetValue(this)) + // .ToDictionary(join => join.GetNameAttribute(), join => + // { + // join.SetJoinOffset(_joinOffset); + // return join; + // }); + + //type = this.GetType(); <- this wasn't working because 'this' was always the base class, never the derived class + var fields = + type.GetCType() + .GetFields(BindingFlags.Public | BindingFlags.Instance) + .Where(f => f.IsDefined(typeof (JoinNameAttribute), true)); + + foreach (var field in fields) + { + var childClass = Convert.ChangeType(this, type, null); + + var value = field.GetValue(childClass) as JoinDataComplete; //this here is JoinMapBaseAdvanced, not the child class. JoinMapBaseAdvanced has no fields. + + if (value == null) + { + Debug.Console(0, "Unable to caset base class to {0}", type.Name); + continue; + } + + value.SetJoinOffset(JoinOffset); + + var joinName = value.GetNameAttribute(field); + + if (String.IsNullOrEmpty(joinName)) continue; + + Joins.Add(joinName, value); + } + + + PrintJoinMapInfo(); + } + + /// + /// Prints the join information to console + /// + public void PrintJoinMapInfo() + { + Debug.Console(0, "{0}:\n", GetType().Name); + + // Get the joins of each type and print them + Debug.Console(0, "Digitals:"); + var digitals = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Digital) == eJoinType.Digital).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Digital Joins", digitals.Count); + PrintJoinList(GetSortedJoins(digitals)); + + Debug.Console(0, "Analogs:"); + var analogs = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Analog) == eJoinType.Analog).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Analog Joins", analogs.Count); + PrintJoinList(GetSortedJoins(analogs)); + + Debug.Console(0, "Serials:"); + var serials = Joins.Where(j => (j.Value.Metadata.JoinType & eJoinType.Serial) == eJoinType.Serial).ToDictionary(j => j.Key, j => j.Value); + Debug.Console(2, "Found {0} Serial Joins", serials.Count); + PrintJoinList(GetSortedJoins(serials)); + + } + + /// + /// Returns a sorted list by JoinNumber + /// + /// + /// + List> GetSortedJoins(Dictionary joins) + { + var sortedJoins = joins.ToList(); + + sortedJoins.Sort((pair1, pair2) => pair1.Value.JoinNumber.CompareTo(pair2.Value.JoinNumber)); + + return sortedJoins; + } + + void PrintJoinList(List> joins) + { + foreach (var join in joins) + { + Debug.Console(0, + @"Join Number: {0} | JoinSpan: '{1}' | Label: '{2}' | Type: '{3}' | Capabilities: '{4}'", + join.Value.JoinNumber, + join.Value.JoinSpan, + join.Value.Metadata.Label, + join.Value.Metadata.JoinType.ToString(), + join.Value.Metadata.JoinCapabilities.ToString()); + } + } + + /// + /// Attempts to find the matching key for the custom join and if found overwrites the default JoinData with the custom + /// + /// + public void SetCustomJoinData(Dictionary joinData) + { + foreach (var customJoinData in joinData) + { + var join = Joins[customJoinData.Key]; + + if (join != null) + { + join.SetCustomJoinData(customJoinData.Value); + } + else + { + Debug.Console(2, "No mathcing key found in join map for: '{0}'", customJoinData.Key); + } + } + + PrintJoinMapInfo(); + } + + ///// + ///// Returns the join number for the join with the specified key + ///// + ///// + ///// + //public uint GetJoinForKey(string key) + //{ + // return Joins.ContainsKey(key) ? Joins[key].JoinNumber : 0; + //} + + + ///// + ///// Returns the join span for the join with the specified key + ///// + ///// + ///// + //public uint GetJoinSpanForKey(string key) + //{ + // return Joins.ContainsKey(key) ? Joins[key].JoinSpan : 0; + //} + } + + /// + /// Read = Provides feedback to SIMPL + /// Write = Responds to sig values from SIMPL + /// + [Flags] + public enum eJoinCapabilities + { + None = 0, + ToSIMPL = 1, + FromSIMPL = 2, + ToFromSIMPL = ToSIMPL | FromSIMPL + } + + [Flags] + public enum eJoinType + { + None = 0, + Digital = 1, + Analog = 2, + Serial = 4, + DigitalAnalog = Digital | Analog, + DigitalSerial = Digital | Serial, + AnalogSerial = Analog | Serial, + DigitalAnalogSerial = Digital | Analog | Serial + } + + /// + /// Metadata describing the join + /// + public class JoinMetadata + { + private string _description; + + /// + /// Join number (based on join offset value) + /// + [JsonProperty("joinNumber")] + [Obsolete] + public uint JoinNumber { get; set; } + /// + /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range + /// + [Obsolete] + [JsonProperty("joinSpan")] + public uint JoinSpan { get; set; } + + /// + /// A label for the join to better describe its usage + /// + [Obsolete("Use Description instead")] + [JsonProperty("label")] + public string Label { get { return _description; } set { _description = value; } } + + /// + /// A description for the join to better describe its usage + /// + [JsonProperty("description")] + public string Description { get { return _description; } set { _description = value; } } + /// + /// Signal type(s) + /// + [JsonProperty("joinType")] + public eJoinType JoinType { get; set; } + /// + /// Indicates whether the join is read and/or write + /// + [JsonProperty("joinCapabilities")] + public eJoinCapabilities JoinCapabilities { get; set; } + /// + /// Indicates a set of valid values (particularly if this translates to an enum + /// + [JsonProperty("validValues")] + public string[] ValidValues { get; set; } + + } + + /// + /// Data describing the join. Can be + /// + public class JoinData + { + /// + /// Join number (based on join offset value) + /// + [JsonProperty("joinNumber")] + public uint JoinNumber { get; set; } + /// + /// Join range span. If join indicates the start of a range of joins, this indicated the maximum number of joins in the range + /// + [JsonProperty("joinSpan")] + public uint JoinSpan { get; set; } + } + + /// + /// A class to aggregate the JoinData and JoinMetadata for a join + /// + public class JoinDataComplete + { + private uint _joinOffset; + + private JoinData _data; + public JoinMetadata Metadata { get; set; } + + public JoinDataComplete(JoinData data, JoinMetadata metadata) + { + _data = data; + Metadata = metadata; + } + + /// + /// Sets the join offset value + /// + /// + public void SetJoinOffset(uint joinOffset) + { + _joinOffset = joinOffset; + } + + /// + /// The join number (including the offset) + /// + public uint JoinNumber + { + get { return _data.JoinNumber+ _joinOffset; } + set { _data.JoinNumber = value; } + } + + public uint JoinSpan + { + get { return _data.JoinSpan; } + } + + public void SetCustomJoinData(JoinData customJoinData) + { + _data = customJoinData; + } + + public string GetNameAttribute(MemberInfo memberInfo) + { + var name = string.Empty; + var attribute = (JoinNameAttribute)CAttribute.GetCustomAttribute(memberInfo, typeof(JoinNameAttribute)); + + if (attribute == null) return name; + + name = attribute.Name; + Debug.Console(2, "JoinName Attribute value: {0}", name); + return name; + } + } + + + + [AttributeUsage(AttributeTargets.All)] + public class JoinNameAttribute : CAttribute + { + private string _Name; + + public JoinNameAttribute(string name) + { + Debug.Console(2, "Setting Attribute Name: {0}", name); + _Name = name; + } + + public string Name + { + get { return _Name; } + } } } \ 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 55a157b4..f4eeabe5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -137,6 +137,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index ba12a129..78a6e565 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -116,6 +116,8 @@ + + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs new file mode 100644 index 00000000..256b2496 --- /dev/null +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs @@ -0,0 +1,257 @@ +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.GeneralIO; +using Newtonsoft.Json; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Bridges; +using PepperDash_Essentials_Core.Bridges.JoinMaps; + +namespace PepperDash.Essentials.Devices.Common.PartitionSensor +{ + [Description("Wrapper class for GLS Cresnet Partition Sensor")] + public class GlsPartitionSensorController : CrestronGenericBridgeableBaseDevice + { + public GlsPartCn PartitionSensor { get; private set; } + + public StringFeedback NameFeedback { get; private set; } + + public BoolFeedback EnableFeedback { get; private set; } + + public BoolFeedback PartitionSensedFeedback { get; private set; } + public BoolFeedback PartitionNotSensedFeedback { get; private set; } + + public IntFeedback SensitivityFeedback { get; private set; } + + public bool InTestMode { get; private set; } + public bool TestEnableFeedback { get; private set; } + public bool TestPartitionSensedFeedback { get; private set; } + public int TestSensitivityFeedback { get; private set; } + + public Func NameFeedbackFunc + { + get { return () => Name; } + } + + public Func EnableFeedbackFunc + { + get { return () => InTestMode ? TestEnableFeedback : PartitionSensor.EnableFeedback.BoolValue; } + } + + public Func PartitionSensedFeedbackFunc + { + get { return () => InTestMode ? TestPartitionSensedFeedback : PartitionSensor.PartitionSensedFeedback.BoolValue; } + } + + public Func PartitionNotSensedFeedbackFunc + { + get { return () => InTestMode ? TestPartitionSensedFeedback : PartitionSensor.PartitionNotSensedFeedback.BoolValue; } + } + + public Func SensitivityFeedbackFunc + { + get { return () => InTestMode ? TestSensitivityFeedback : PartitionSensor.SensitivityFeedback.UShortValue; } + } + + /// + /// Constructor + /// + /// + /// + /// + public GlsPartitionSensorController(string key, string name, GlsPartCn hardware) + : base(key, name, hardware) + { + PartitionSensor = hardware; + + NameFeedback = new StringFeedback(NameFeedbackFunc); + EnableFeedback = new BoolFeedback(EnableFeedbackFunc); + PartitionSensedFeedback = new BoolFeedback(PartitionSensedFeedbackFunc); + PartitionNotSensedFeedback = new BoolFeedback(PartitionNotSensedFeedbackFunc); + SensitivityFeedback = new IntFeedback(SensitivityFeedbackFunc); + + if (PartitionSensor != null) PartitionSensor.BaseEvent += PartitionSensor_BaseEvent; + } + + + private void PartitionSensor_BaseEvent(GenericBase device, BaseEventArgs args) + { + Debug.Console(2, this, "EventId: {0}, Index: {1}", args.EventId, args.Index); + + switch (args.EventId) + { + case (GlsPartCn.EnableFeedbackEventId): + { + EnableFeedback.FireUpdate(); + break; + } + case (GlsPartCn.PartitionSensedFeedbackEventId): + { + PartitionSensedFeedback.FireUpdate(); + break; + } + case (GlsPartCn.PartitionNotSensedFeedbackEventId): + { + PartitionNotSensedFeedback.FireUpdate(); + break; + } + case (GlsPartCn.SensitivityFeedbackEventId): + { + SensitivityFeedback.FireUpdate(); + break; + } + default: + { + Debug.Console(2, this, "args.EventId: {0}", args.EventId); + break; + } + } + } + + public void SetTestMode(bool mode) + { + InTestMode = mode; + Debug.Console(1, this, "InTestMode: {0}", InTestMode.ToString()); + } + + public void SetTestEnableState(bool state) + { + if (InTestMode) + { + TestEnableFeedback = state; + Debug.Console(1, this, "TestEnableFeedback: {0}", TestEnableFeedback.ToString()); + return; + } + + Debug.Console(1, this, "InTestMode: {0}, unable to set enable state: {1}", InTestMode.ToString(), state.ToString()); + } + + public void SetTestPartitionSensedState(bool state) + { + if (InTestMode) + { + TestPartitionSensedFeedback = state; + Debug.Console(1, this, "TestPartitionSensedFeedback: {0}", TestPartitionSensedFeedback.ToString()); + return; + } + + Debug.Console(1, this, "InTestMode: {0}, unable to set partition state: {1}", InTestMode.ToString(), state.ToString()); + } + + public void SetTestSensitivityValue(int value) + { + if (InTestMode) + { + TestSensitivityFeedback = value; + Debug.Console(1, this, "TestSensitivityFeedback: {0}", TestSensitivityFeedback); + return; + } + + Debug.Console(1, this, "InTestMode: {0}, unable to set sensitivity value: {1}", InTestMode.ToString(), value); + } + + public void SetEnableState(bool state) + { + if (PartitionSensor == null) + return; + + PartitionSensor.Enable.BoolValue = state; + } + + public void IncreaseSensitivity() + { + if (PartitionSensor == null) + return; + + PartitionSensor.IncreaseSensitivity(); + } + + public void DecreaseSensitivity() + { + if (PartitionSensor == null) + return; + + PartitionSensor.DecreaseSensitivity(); + } + + public void SetSensitivity(ushort value) + { + if (PartitionSensor == null) + return; + + PartitionSensor.Sensitivity.UShortValue = (ushort)value; + } + + + public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) + { + var joinMap = new GlsPartitionSensorJoinMap(joinStart); + var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); + + if (!string.IsNullOrEmpty(joinMapSerialized)) + joinMap = JsonConvert.DeserializeObject(joinMapSerialized); + + if (bridge != null) + { + bridge.AddJoinMap(Key, joinMap); + } + else + { + Debug.Console(0, this, "Please update config to use 'type': 'EiscApiAdvanced' to get all join map features for this device"); + } + + Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, this, "Linking to Bridge Type {0}", GetType().Name); + + // link input from simpl + trilist.SetSigTrueAction(joinMap.Enable.JoinNumber, () => SetEnableState(true)); + trilist.SetSigFalseAction(joinMap.Enable.JoinNumber, () => SetEnableState(false)); + trilist.SetSigTrueAction(joinMap.IncreaseSensitivity.JoinNumber, IncreaseSensitivity); + trilist.SetSigTrueAction(joinMap.DecreaseSensitivity.JoinNumber, DecreaseSensitivity); + trilist.SetUShortSigAction(joinMap.Sensitivity.JoinNumber, SetSensitivity); + + // link output to simpl + IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); + EnableFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Enable.JoinNumber]); + PartitionSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionSensed.JoinNumber]); + PartitionNotSensedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]); + SensitivityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Sensitivity.JoinNumber]); + + FeedbacksFireUpdates(); + + // update when device is online + PartitionSensor.OnlineStatusChange += (o, a) => + { + if (a.DeviceOnLine) + { + FeedbacksFireUpdates(); + } + }; + + // update when trilist is online + trilist.OnlineStatusChange += (o, a) => + { + if (a.DeviceOnLine) + { + FeedbacksFireUpdates(); + } + }; + } + + private void FeedbacksFireUpdates() + { + IsOnline.FireUpdate(); + NameFeedback.FireUpdate(); + EnableFeedback.FireUpdate(); + PartitionSensedFeedback.FireUpdate(); + PartitionNotSensedFeedback.FireUpdate(); + SensitivityFeedback.FireUpdate(); + } + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs new file mode 100644 index 00000000..543fc799 --- /dev/null +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.GeneralIO; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Devices.Common.Occupancy; + +namespace PepperDash.Essentials.Devices.Common.PartitionSensor +{ + public class GlsPartitionSensorControllerFactory : EssentialsDeviceFactory + { + public GlsPartitionSensorControllerFactory() + { + TypeNames = new List() { "glspartcn" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(2, "Factory Attempting to create new GLS-PART-CN Device"); + + var typeName = dc.Type.ToLower(); + var key = dc.Key; + var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); + if (comm == null) + { + Debug.Console(0, "ERROR: Control Properties Config are null"); + return null; + } + + var sensor = new GlsPartCn(comm.CresnetIdInt, Global.ControlSystem); + return new GlsPartitionSensorController(dc.Key, dc.Name, sensor); + } + } +} \ No newline at end of file From 495bf70d3ac51ca25a5ba419e7322849003b1a02 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 30 Jun 2020 14:46:46 -0500 Subject: [PATCH 108/150] Changes to CrestronGenericBridgeableBaseDevice and CrestronGenericBaseDevice to allow it to take a func in an overloaded constructor Addresses #292 --- .../Crestron IO/C2nRts/C2nRthsController.cs | 3 ++- .../Crestron/CrestronGenericBaseDevice.cs | 27 ++++++++++++++++++- 2 files changed, 28 insertions(+), 2 deletions(-) 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 73279368..2ec1dd49 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -18,7 +18,8 @@ namespace PepperDash.Essentials.Core.CrestronIO public IntFeedback TemperatureFeedback { get; private set; } public IntFeedback HumidityFeedback { get; private set; } - public C2nRthsController(string key, string name, GenericBase hardware) : base(key, name, hardware) + public C2nRthsController(string key, string name, GenericBase hardware) + : base(key, name, hardware) { _device = hardware as C2nRths; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 7866075f..0ad6e135 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -1,7 +1,9 @@ -using System.Linq; +using System; +using System.Linq; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; +using PepperDash.Core.JsonStandardObjects; using PepperDash.Essentials.Core.Bridges; namespace PepperDash.Essentials.Core @@ -42,6 +44,24 @@ namespace PepperDash.Essentials.Core CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); } + protected CrestronGenericBaseDevice(string key, string name) + : base(key, name) + { + Feedbacks = new FeedbackCollection(); + + } + + protected void RegisterCrestronGenericBase(GenericBase hardware) + { + Hardware = hardware; + IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); + IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); + IpConnectionsText = new StringFeedback("IpConnectionsText", () => Hardware.ConnectedIpList != null ? string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty); + AddToFeedbackList(IsOnline, IpConnectionsText); + + CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); + } + /// /// Make sure that overriding classes call this! /// Registers the Crestron device, connects up to the base events, starts communication monitor @@ -135,6 +155,11 @@ namespace PepperDash.Essentials.Core { } + protected CrestronGenericBridgeableBaseDevice(string key, string name) + : base(key, name) + { + } + public abstract void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge); } From f954043981dbad95928412849fa69c3c3430e01b Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 30 Jun 2020 14:48:31 -0500 Subject: [PATCH 109/150] Updated C2NRthsController Class to build new devices in PreActivate Method Addresses #292 --- .../Crestron IO/C2nRts/C2nRthsController.cs | 97 +++++++++++++++---- 1 file changed, 78 insertions(+), 19 deletions(-) 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 2ec1dd49..9d2b50ac 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; @@ -11,22 +12,38 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO { [Description("Wrapper class for the C2N-RTHS sensor")] - public class C2nRthsController : CrestronGenericBridgeableBaseDevice + public class C2nRthsController : CrestronGenericBridgeableBaseDevice, IOnline { - private readonly C2nRths _device; + private C2nRths _device; public IntFeedback TemperatureFeedback { get; private set; } public IntFeedback HumidityFeedback { get; private set; } + public BoolFeedback IsOnline { get; private set; } - public C2nRthsController(string key, string name, GenericBase hardware) - : base(key, name, hardware) + public C2nRthsController(string key, Func preActivationFunc, + DeviceConfig config) + : base(key, config.Name) { - _device = hardware as C2nRths; - TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); - HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); + AddPreActivationAction(() => + { + _device = preActivationFunc(config); - if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; + RegisterCrestronGenericBase(_device); + + TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); + HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); + IsOnline = new BoolFeedback(() => _device.IsOnline); + + if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; + if (_device != null) _device.OnlineStatusChange += _device_OnlineStatusChange; + + }); + } + + void _device_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) + { + IsOnline.FireUpdate(); } private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) @@ -77,24 +94,66 @@ namespace PepperDash.Essentials.Core.CrestronIO HumidityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Humidity.JoinNumber]); trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; - } - } - public class C2nRthsControllerFactory : EssentialsDeviceFactory - { - public C2nRthsControllerFactory() - { - TypeNames = new List() { "c2nrths" }; + trilist.OnlineStatusChange += (d, args) => + { + if (!args.DeviceOnLine) return; + + UpdateFeedbacksWhenOnline(); + + trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; + }; } - public override EssentialsDevice BuildDevice(DeviceConfig dc) + private void UpdateFeedbacksWhenOnline() { - Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); + IsOnline.FireUpdate(); + TemperatureFeedback.FireUpdate(); + HumidityFeedback.FireUpdate(); + } + #region PreActivation + + private static C2nRths GetC2nRthsDevice(DeviceConfig dc) + { var control = CommFactory.GetControlPropertiesConfig(dc); var cresnetId = control.CresnetIdInt; + var branchId = control.ControlPortNumber; + var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - return new C2nRthsController(dc.Key, dc.Name, new C2nRths(cresnetId, Global.ControlSystem)); + if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths"); + return new C2nRths(cresnetId, Global.ControlSystem); + } + var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; + + if (cresnetBridge != null) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new C2nRths"); + return new C2nRths(cresnetId, cresnetBridge.Branches[branchId]); + } + Debug.Console(0, "Device {0} is not a valid cresnet master", branchId); + return null; + } + #endregion + + public class C2nRthsControllerFactory : EssentialsDeviceFactory + { + public C2nRthsControllerFactory() + { + TypeNames = new List() { "c2nrths" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new C2nRthsController(dc.Key, GetC2nRthsDevice, dc); + } } } } \ No newline at end of file From b694f7640a7e280e7b7592ad3cb4265dd73c7736 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 30 Jun 2020 15:05:42 -0500 Subject: [PATCH 110/150] Minor Fixes to CrestronGenericBaseDevice Update StatusSignController constructor and factory to build device in PreActivation phase Addresses #292 --- .../Crestron IO/C2nRts/C2nRthsController.cs | 13 +-- .../StatusSign/StatusSignController.cs | 102 ++++++++++++------ 2 files changed, 69 insertions(+), 46 deletions(-) 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 9d2b50ac..4a82fe09 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/C2nRts/C2nRthsController.cs @@ -12,13 +12,12 @@ using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.CrestronIO { [Description("Wrapper class for the C2N-RTHS sensor")] - public class C2nRthsController : CrestronGenericBridgeableBaseDevice, IOnline + public class C2nRthsController : CrestronGenericBridgeableBaseDevice { private C2nRths _device; public IntFeedback TemperatureFeedback { get; private set; } public IntFeedback HumidityFeedback { get; private set; } - public BoolFeedback IsOnline { get; private set; } public C2nRthsController(string key, Func preActivationFunc, DeviceConfig config) @@ -33,18 +32,11 @@ namespace PepperDash.Essentials.Core.CrestronIO TemperatureFeedback = new IntFeedback(() => _device.TemperatureFeedback.UShortValue); HumidityFeedback = new IntFeedback(() => _device.HumidityFeedback.UShortValue); - IsOnline = new BoolFeedback(() => _device.IsOnline); if (_device != null) _device.BaseEvent += DeviceOnBaseEvent; - if (_device != null) _device.OnlineStatusChange += _device_OnlineStatusChange; - }); } - void _device_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args) - { - IsOnline.FireUpdate(); - } private void DeviceOnBaseEvent(GenericBase device, BaseEventArgs args) { @@ -149,9 +141,6 @@ namespace PepperDash.Essentials.Core.CrestronIO { Debug.Console(1, "Factory Attempting to create new C2N-RTHS Device"); - var control = CommFactory.GetControlPropertiesConfig(dc); - var cresnetId = control.CresnetIdInt; - return new C2nRthsController(dc.Key, GetC2nRthsDevice, dc); } } 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 1bd22ebe..c316c9b4 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron IO/StatusSign/StatusSignController.cs @@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core.CrestronIO [Description("Wrapper class for the Crestron StatusSign device")] public class StatusSignController : CrestronGenericBridgeableBaseDevice { - private readonly StatusSign _device; + private StatusSign _device; public BoolFeedback RedLedEnabledFeedback { get; private set; } public BoolFeedback GreenLedEnabledFeedback { get; private set; } @@ -23,34 +23,40 @@ namespace PepperDash.Essentials.Core.CrestronIO public IntFeedback GreenLedBrightnessFeedback { get; private set; } public IntFeedback BlueLedBrightnessFeedback { get; private set; } - public StatusSignController(string key, string name, GenericBase hardware) : base(key, name, hardware) + public StatusSignController(string key, Func preActivationFunc, DeviceConfig config) : base(key, config.Name) { - _device = hardware as StatusSign; + AddPreActivationAction(() => + { + _device = preActivationFunc(config); - RedLedEnabledFeedback = + RegisterCrestronGenericBase(_device); + + RedLedEnabledFeedback = new BoolFeedback( () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Red] - .ControlFeedback.BoolValue); - GreenLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Green] - .ControlFeedback.BoolValue); - BlueLedEnabledFeedback = - new BoolFeedback( - () => - _device.Leds[(uint) StatusSign.Led.eLedColor.Blue] + _device.Leds[(uint)StatusSign.Led.eLedColor.Red] .ControlFeedback.BoolValue); + GreenLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint)StatusSign.Led.eLedColor.Green] + .ControlFeedback.BoolValue); + BlueLedEnabledFeedback = + new BoolFeedback( + () => + _device.Leds[(uint)StatusSign.Led.eLedColor.Blue] + .ControlFeedback.BoolValue); - RedLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Red].BrightnessFeedback); - GreenLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Green].BrightnessFeedback); - BlueLedBrightnessFeedback = - new IntFeedback(() => (int) _device.Leds[(uint) StatusSign.Led.eLedColor.Blue].BrightnessFeedback); + RedLedBrightnessFeedback = + new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Red].BrightnessFeedback); + GreenLedBrightnessFeedback = + new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Green].BrightnessFeedback); + BlueLedBrightnessFeedback = + new IntFeedback(() => (int)_device.Leds[(uint)StatusSign.Led.eLedColor.Blue].BrightnessFeedback); - if (_device != null) _device.BaseEvent += _device_BaseEvent; + if (_device != null) _device.BaseEvent += _device_BaseEvent; + + }); } void _device_BaseEvent(GenericBase device, BaseEventArgs args) @@ -167,23 +173,51 @@ namespace PepperDash.Essentials.Core.CrestronIO device.SetColor(redBrightness, greenBrightness, blueBrightness); } - } - public class StatusSignControllerFactory : EssentialsDeviceFactory - { - public StatusSignControllerFactory() + #region PreActivation + + private static StatusSign GetStatusSignDevice(DeviceConfig dc) { - TypeNames = new List() { "statussign" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - Debug.Console(1, "Factory Attempting to create new StatusSign Device"); - var control = CommFactory.GetControlPropertiesConfig(dc); var cresnetId = control.CresnetIdInt; + var branchId = control.ControlPortNumber; + var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - return new StatusSignController(dc.Key, dc.Name, new StatusSign(cresnetId, Global.ControlSystem)); + if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign"); + return new StatusSign(cresnetId, Global.ControlSystem); + } + var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; + + if (cresnetBridge != null) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new StatusSign"); + return new StatusSign(cresnetId, cresnetBridge.Branches[branchId]); + } + Debug.Console(0, "Device {0} is not a valid cresnet master", branchId); + return null; + } + #endregion + + public class StatusSignControllerFactory : EssentialsDeviceFactory + { + public StatusSignControllerFactory() + { + TypeNames = new List() { "statussign" }; + } + + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new StatusSign Device"); + + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + + return new StatusSignController(dc.Key, GetStatusSignDevice, dc); + } } } + + } \ No newline at end of file From ac379763ce61082f02668ca849a65a45e69cda3f Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 30 Jun 2020 15:25:20 -0500 Subject: [PATCH 111/150] Updates to Cresnet OccSensor Classes Addresses #292 --- .../GlsOccupancySensorBaseController.cs | 169 ++++++++++++------ .../GlsOdtOccupancySensorController.cs | 88 +++++---- 2 files changed, 169 insertions(+), 88 deletions(-) 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 b6508920..9ee0de95 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 @@ -55,38 +55,57 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy } } - public GlsOccupancySensorBaseController(string key, string name, GlsOccupancySensorBase sensor) - : base(key, name, sensor) + public GlsOccupancySensorBaseController(string key, Func preActivationFunc, + DeviceConfig config) + : base(key, config.Name) + { + + + AddPreActivationAction(() => + { + OccSensor = preActivationFunc(config); + + RegisterCrestronGenericBase(OccSensor); + + RegisterGlsOdtSensorBaseController(); + + }); + } + + public GlsOccupancySensorBaseController(string key, string name) : base(key, name) {} + + protected void RegisterGlsOdtSensorBaseController() { - OccSensor = sensor; - RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); - PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue); + PirSensorEnabledFeedback = new BoolFeedback(() => OccSensor.PirEnabledFeedback.BoolValue); - LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); + LedFlashEnabledFeedback = new BoolFeedback(() => OccSensor.LedFlashEnabledFeedback.BoolValue); - ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); + ShortTimeoutEnabledFeedback = new BoolFeedback(() => OccSensor.ShortTimeoutEnabledFeedback.BoolValue); - PirSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); + PirSensitivityInVacantStateFeedback = + new IntFeedback(() => OccSensor.PirSensitivityInVacantStateFeedback.UShortValue); - PirSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue); + PirSensitivityInOccupiedStateFeedback = + new IntFeedback(() => OccSensor.PirSensitivityInOccupiedStateFeedback.UShortValue); - CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); + CurrentTimeoutFeedback = new IntFeedback(() => OccSensor.CurrentTimeoutFeedback.UShortValue); - LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue); + LocalTimoutFeedback = new IntFeedback(() => OccSensor.LocalTimeoutFeedback.UShortValue); - GraceOccupancyDetectedFeedback = new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); + GraceOccupancyDetectedFeedback = + new BoolFeedback(() => OccSensor.GraceOccupancyDetectedFeedback.BoolValue); - RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue); + RawOccupancyFeedback = new BoolFeedback(() => OccSensor.RawOccupancyFeedback.BoolValue); - InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); + InternalPhotoSensorValue = new IntFeedback(() => OccSensor.InternalPhotoSensorValueFeedback.UShortValue); - ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue); + ExternalPhotoSensorValue = new IntFeedback(() => OccSensor.ExternalPhotoSensorValueFeedback.UShortValue); - OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); + OccSensor.BaseEvent += new Crestron.SimplSharpPro.BaseEventHandler(OccSensor_BaseEvent); - OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(OccSensor_GlsOccupancySensorChange); + OccSensor.GlsOccupancySensorChange += OccSensor_GlsOccupancySensorChange; } @@ -97,40 +116,56 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy /// protected virtual void OccSensor_GlsOccupancySensorChange(GlsOccupancySensorBase device, GlsOccupancySensorChangeEventArgs args) { - if (args.EventId == GlsOccupancySensorBase.PirEnabledFeedbackEventId) - PirSensorEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId) - LedFlashEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId) - ShortTimeoutEnabledFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId) - PirSensitivityInOccupiedStateFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId) - PirSensitivityInVacantStateFeedback.FireUpdate(); + switch (args.EventId) + { + case GlsOccupancySensorBase.PirEnabledFeedbackEventId: + PirSensorEnabledFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.LedFlashEnabledFeedbackEventId: + LedFlashEnabledFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.ShortTimeoutEnabledFeedbackEventId: + ShortTimeoutEnabledFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.PirSensitivityInOccupiedStateFeedbackEventId: + PirSensitivityInOccupiedStateFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.PirSensitivityInVacantStateFeedbackEventId: + PirSensitivityInVacantStateFeedback.FireUpdate(); + break; + } } protected virtual void OccSensor_BaseEvent(Crestron.SimplSharpPro.GenericBase device, Crestron.SimplSharpPro.BaseEventArgs args) { Debug.Console(2, this, "GlsOccupancySensorChange EventId: {0}", args.EventId); - if (args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId - || args.EventId == Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId) + switch (args.EventId) { - Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); - RoomIsOccupiedFeedback.FireUpdate(); + case Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomVacantFeedbackEventId: + case Crestron.SimplSharpPro.GeneralIO.GlsOccupancySensorBase.RoomOccupiedFeedbackEventId: + Debug.Console(1, this, "Occupancy State: {0}", OccSensor.OccupancyDetectedFeedback.BoolValue); + RoomIsOccupiedFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.TimeoutFeedbackEventId: + CurrentTimeoutFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.TimeoutLocalFeedbackEventId: + LocalTimoutFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId: + GraceOccupancyDetectedFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.RawOccupancyFeedbackEventId: + RawOccupancyFeedback.FireUpdate(); + break; + case GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId: + InternalPhotoSensorValue.FireUpdate(); + break; + case GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId: + ExternalPhotoSensorValue.FireUpdate(); + break; } - else if (args.EventId == GlsOccupancySensorBase.TimeoutFeedbackEventId) - CurrentTimeoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.TimeoutLocalFeedbackEventId) - LocalTimoutFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.GraceOccupancyDetectedFeedbackEventId) - GraceOccupancyDetectedFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.RawOccupancyFeedbackEventId) - RawOccupancyFeedback.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.InternalPhotoSensorValueFeedbackEventId) - InternalPhotoSensorValue.FireUpdate(); - else if (args.EventId == GlsOccupancySensorBase.ExternalPhotoSensorValueFeedbackEventId) - ExternalPhotoSensorValue.FireUpdate(); } public void SetTestMode(bool mode) @@ -373,27 +408,51 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy { LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); } - } - public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory - { - public GlsOccupancySensorBaseControllerFactory() + #region PreActivation + + private static GlsOirCCn GetGlsOirCCn(DeviceConfig dc) { - TypeNames = new List() { "glsoirccn" }; + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + var branchId = control.ControlPortNumber; + var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; + + if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn"); + return new GlsOirCCn(cresnetId, Global.ControlSystem); + } + var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; + + if (cresnetBridge != null) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOirCCn"); + return new GlsOirCCn(cresnetId, cresnetBridge.Branches[branchId]); + } + Debug.Console(0, "Device {0} is not a valid cresnet master", branchId); + return null; } + #endregion - public override EssentialsDevice BuildDevice(DeviceConfig dc) + public class GlsOccupancySensorBaseControllerFactory : EssentialsDeviceFactory { - Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + public GlsOccupancySensorBaseControllerFactory() + { + TypeNames = new List() { "glsoirccn" }; + } - var key = dc.Key; - var name = dc.Name; - var comm = CommFactory.GetControlPropertiesConfig(dc); - GlsOccupancySensorBase occSensor = new GlsOirCCn(comm.CresnetIdInt, Global.ControlSystem); + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + return new GlsOccupancySensorBaseController(dc.Key, GetGlsOirCCn, dc); + } - return new GlsOccupancySensorBaseController(key, name, occSensor); } } + + } \ No newline at end of file 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 26fec016..4eef3d2d 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 @@ -35,26 +35,35 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy public BoolFeedback RawOccupancyUsFeedback { get; private set; } - public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor) - : base(key, name, sensor) + public GlsOdtOccupancySensorController(string key, Func preActivationFunc, + DeviceConfig config) + : base(key, config.Name) { - OccSensor = sensor; + AddPreActivationAction(() => + { + OccSensor = preActivationFunc(config); - AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); + RegisterCrestronGenericBase(OccSensor); - OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); + RegisterGlsOdtSensorBaseController(); - UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue); + AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); - UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue); + OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); - RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue); + UltrasonicAEnabledFeedback = new BoolFeedback(() => OccSensor.UsAEnabledFeedback.BoolValue); - RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue); + UltrasonicBEnabledFeedback = new BoolFeedback(() => OccSensor.UsBEnabledFeedback.BoolValue); - UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue); + RawOccupancyPirFeedback = new BoolFeedback(() => OccSensor.RawOccupancyPirFeedback.BoolValue); - UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); + RawOccupancyUsFeedback = new BoolFeedback(() => OccSensor.RawOccupancyUsFeedback.BoolValue); + + UltrasonicSensitivityInVacantStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInVacantStateFeedback.UShortValue); + + UltrasonicSensitivityInOccupiedStateFeedback = new IntFeedback(() => OccSensor.UsSensitivityInOccupiedStateFeedback.UShortValue); + + }); } /// @@ -160,38 +169,51 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy { LinkOccSensorToApi(this, trilist, joinStart, joinMapKey, bridge); } - } - public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory - { - public GlsOdtOccupancySensorControllerFactory() + #region PreActivation + + private static GlsOdtCCn GetGlsOdtCCn(DeviceConfig dc) { - TypeNames = new List() { "glsodtccn" }; - } + var control = CommFactory.GetControlPropertiesConfig(dc); + var cresnetId = control.CresnetIdInt; + var branchId = control.ControlPortNumber; + var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; - public override EssentialsDevice BuildDevice(DeviceConfig dc) - { - 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); - - var occSensor = new GlsOdtCCn(comm.CresnetIdInt, Global.ControlSystem); - - if (occSensor != null) + if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) { - return new GlsOdtOccupancySensorController(key, name, occSensor); + Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn"); + return new GlsOdtCCn(cresnetId, Global.ControlSystem); } - else + var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; + + if (cresnetBridge != null) { - Debug.Console(0, "ERROR: Unable to create Occupancy Sensor Device. Key: '{0}'", key); - return null; + Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn"); + return new GlsOdtCCn(cresnetId, cresnetBridge.Branches[branchId]); + } + Debug.Console(0, "Device {0} is not a valid cresnet master", branchId); + return null; + } + #endregion + + public class GlsOdtOccupancySensorControllerFactory : EssentialsDeviceFactory + { + public GlsOdtOccupancySensorControllerFactory() + { + TypeNames = new List() { "glsodtccn" }; } + public override EssentialsDevice BuildDevice(DeviceConfig dc) + { + Debug.Console(1, "Factory Attempting to create new GlsOccupancySensorBaseController Device"); + + return new GlsOdtOccupancySensorController(dc.Key, GetGlsOdtCCn, dc); + } + } } + + } \ No newline at end of file From ea86c8b63987c7d110a1fcbb6edb639940a706ff Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Tue, 30 Jun 2020 17:32:50 -0500 Subject: [PATCH 112/150] Removed funcs and updated feedbacks in constructor --- .../GlsPartitionSensorController.cs | 75 +++++-------------- .../GlsPartitionSensorControllerFactory.cs | 14 +--- 2 files changed, 23 insertions(+), 66 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs index 256b2496..29847144 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorController.cs @@ -1,15 +1,9 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.GeneralIO; using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Bridges; using PepperDash_Essentials_Core.Bridges.JoinMaps; @@ -18,15 +12,12 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor [Description("Wrapper class for GLS Cresnet Partition Sensor")] public class GlsPartitionSensorController : CrestronGenericBridgeableBaseDevice { - public GlsPartCn PartitionSensor { get; private set; } + private readonly GlsPartCn _partitionSensor; public StringFeedback NameFeedback { get; private set; } - public BoolFeedback EnableFeedback { get; private set; } - public BoolFeedback PartitionSensedFeedback { get; private set; } public BoolFeedback PartitionNotSensedFeedback { get; private set; } - public IntFeedback SensitivityFeedback { get; private set; } public bool InTestMode { get; private set; } @@ -34,31 +25,6 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor public bool TestPartitionSensedFeedback { get; private set; } public int TestSensitivityFeedback { get; private set; } - public Func NameFeedbackFunc - { - get { return () => Name; } - } - - public Func EnableFeedbackFunc - { - get { return () => InTestMode ? TestEnableFeedback : PartitionSensor.EnableFeedback.BoolValue; } - } - - public Func PartitionSensedFeedbackFunc - { - get { return () => InTestMode ? TestPartitionSensedFeedback : PartitionSensor.PartitionSensedFeedback.BoolValue; } - } - - public Func PartitionNotSensedFeedbackFunc - { - get { return () => InTestMode ? TestPartitionSensedFeedback : PartitionSensor.PartitionNotSensedFeedback.BoolValue; } - } - - public Func SensitivityFeedbackFunc - { - get { return () => InTestMode ? TestSensitivityFeedback : PartitionSensor.SensitivityFeedback.UShortValue; } - } - /// /// Constructor /// @@ -68,15 +34,15 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor public GlsPartitionSensorController(string key, string name, GlsPartCn hardware) : base(key, name, hardware) { - PartitionSensor = hardware; + _partitionSensor = hardware; - NameFeedback = new StringFeedback(NameFeedbackFunc); - EnableFeedback = new BoolFeedback(EnableFeedbackFunc); - PartitionSensedFeedback = new BoolFeedback(PartitionSensedFeedbackFunc); - PartitionNotSensedFeedback = new BoolFeedback(PartitionNotSensedFeedbackFunc); - SensitivityFeedback = new IntFeedback(SensitivityFeedbackFunc); + NameFeedback = new StringFeedback(() => Name); + EnableFeedback = new BoolFeedback(() => _partitionSensor.EnableFeedback.BoolValue); + PartitionSensedFeedback = new BoolFeedback(() => _partitionSensor.PartitionSensedFeedback.BoolValue); + PartitionNotSensedFeedback = new BoolFeedback(() => _partitionSensor.PartitionNotSensedFeedback.BoolValue); + SensitivityFeedback = new IntFeedback(() => _partitionSensor.SensitivityFeedback.UShortValue); - if (PartitionSensor != null) PartitionSensor.BaseEvent += PartitionSensor_BaseEvent; + if (_partitionSensor != null) _partitionSensor.BaseEvent += PartitionSensor_BaseEvent; } @@ -108,7 +74,7 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor } default: { - Debug.Console(2, this, "args.EventId: {0}", args.EventId); + Debug.Console(2, this, "Unhandled args.EventId: {0}", args.EventId); break; } } @@ -158,37 +124,36 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor public void SetEnableState(bool state) { - if (PartitionSensor == null) + if (_partitionSensor == null) return; - PartitionSensor.Enable.BoolValue = state; + _partitionSensor.Enable.BoolValue = state; } public void IncreaseSensitivity() { - if (PartitionSensor == null) + if (_partitionSensor == null) return; - PartitionSensor.IncreaseSensitivity(); + _partitionSensor.IncreaseSensitivity(); } public void DecreaseSensitivity() { - if (PartitionSensor == null) + if (_partitionSensor == null) return; - PartitionSensor.DecreaseSensitivity(); + _partitionSensor.DecreaseSensitivity(); } public void SetSensitivity(ushort value) { - if (PartitionSensor == null) + if (_partitionSensor == null) return; - PartitionSensor.Sensitivity.UShortValue = (ushort)value; + _partitionSensor.Sensitivity.UShortValue = value; } - public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) { var joinMap = new GlsPartitionSensorJoinMap(joinStart); @@ -220,13 +185,13 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); EnableFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Enable.JoinNumber]); PartitionSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionSensed.JoinNumber]); - PartitionNotSensedFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]); + PartitionNotSensedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PartitionNotSensed.JoinNumber]); SensitivityFeedback.LinkInputSig(trilist.UShortInput[joinMap.Sensitivity.JoinNumber]); FeedbacksFireUpdates(); // update when device is online - PartitionSensor.OnlineStatusChange += (o, a) => + _partitionSensor.OnlineStatusChange += (o, a) => { if (a.DeviceOnLine) { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs index 543fc799..a60637f7 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/PartitionSensor/GlsPartitionSensorControllerFactory.cs @@ -1,13 +1,8 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; +using System.Collections.Generic; using Crestron.SimplSharpPro.GeneralIO; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Devices.Common.Occupancy; namespace PepperDash.Essentials.Devices.Common.PartitionSensor { @@ -21,14 +16,11 @@ namespace PepperDash.Essentials.Devices.Common.PartitionSensor public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(2, "Factory Attempting to create new GLS-PART-CN Device"); - - var typeName = dc.Type.ToLower(); - var key = dc.Key; - var name = dc.Name; + var comm = CommFactory.GetControlPropertiesConfig(dc); if (comm == null) { - Debug.Console(0, "ERROR: Control Properties Config are null"); + Debug.Console(0, "ERROR: Control Properties Config for {0} is null", dc.Key); return null; } From 0a3f2bb524d75b1800141ad02291a8f9f96cc930 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 1 Jul 2020 10:35:57 -0500 Subject: [PATCH 113/150] WIP Cresnet Gateway SUpport --- .../Factory/ReadyEventArgs.cs | 30 ++ .../Gateways/CenRfgwController.cs | 272 ++++++++++-------- .../PepperDash_Essentials_Core.csproj | 1 + .../Remotes/Hrxx0WirelessRemoteController.cs | 45 ++- .../Chassis/DmChassisController.cs | 1 + 5 files changed, 232 insertions(+), 117 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs new file mode 100644 index 00000000..6999bd74 --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash_Essentials_Core +{ + public delegate void IsReadyEventHandler(object source, IsReadyEventArgs e); + + public class IsReadyEventArgs : EventArgs + { + private readonly bool _EventData; + + public IsReadyEventArgs(bool data) + { + _EventData = data; + } + + public bool GetData() + { + return _EventData; + } + } + + public interface IHasReady + { + event IsReadyEventHandler IsReady; + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs index 1fd7da6d..767714d1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs @@ -6,134 +6,182 @@ using Crestron.SimplSharp; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.Gateways; using Newtonsoft.Json; +using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; +using PepperDash_Essentials_Core; -namespace PepperDash.Essentials.Core +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 - } + [Description("Wrapper class for Crestron Infinet-EX Gateways")] + public class CenRfgwController : CrestronGenericBaseDevice, IHasReady + { + public event IsReadyEventHandler IsReady; + private GatewayBase _gateway; - #region Factory - public class CenRfgwControllerFactory : EssentialsDeviceFactory - { - public CenRfgwControllerFactory() - { - TypeNames = new List() { "cenrfgwex", "cenerfgwpoe" }; - } - - public override EssentialsDevice BuildDevice(DeviceConfig dc) + public GatewayBase GateWay { + get { return _gateway; } + } - Debug.Console(1, "Factory Attempting to create new CEN-GWEXER Device"); - - var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); + /// + /// Constructor for the on-board gateway + /// + /// + /// + public CenRfgwController(string key, string name, GatewayBase gateway) : + base(key, name, gateway) + { + _gateway = gateway; + IsReady(this, new IsReadyEventArgs(true)); + } - var type = dc.Type.ToLower(); - var control = props.Control; - var ipid = control.IpIdInt; - var cresnetId = control.CresnetIdInt; - var gatewayType = props.GatewayType; - - switch (type) + public CenRfgwController(string key, Func preActivationFunc, DeviceConfig config) : + base(key, config.Name) + { + IsReady(this, new IsReadyEventArgs(false)); + AddPreActivationAction(() => { - 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; - } + _gateway = preActivationFunc(config); + + RegisterCrestronGenericBase(_gateway); + IsReady(this, new IsReadyEventArgs(true)); + + }); + } + + public static GatewayBase GetNewIpRfGateway(DeviceConfig dc) + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var name = dc.Name; + var type = dc.Type; + var key = dc.Key; + var ipId = control.IpIdInt; + + if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenRfgwEx(ipId, Global.ControlSystem); + } + if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenErfgwPoe(ipId, Global.ControlSystem); + } + return null; + } + + public static GatewayBase GetNewSharedIpRfGateway(DeviceConfig dc) + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var ipId = control.IpIdInt; + + if (dc.Type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenRfgwExEthernetSharable(ipId, Global.ControlSystem); + } + if (dc.Type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenErfgwPoeEthernetSharable(ipId, Global.ControlSystem); + } + return null; + } + + public static GatewayBase GetCenRfgwCresnetController(DeviceConfig dc) + { + var control = CommFactory.GetControlPropertiesConfig(dc); + var type = dc.Type; + var cresnetId = control.CresnetIdInt; + var branchId = control.ControlPortNumber; + var parentKey = string.IsNullOrEmpty(control.ControlPortDevKey) ? "processor" : control.ControlPortDevKey; + + if (parentKey.Equals("processor", StringComparison.CurrentCultureIgnoreCase)) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn"); + if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenErfgwPoeCresnet(cresnetId, Global.ControlSystem); + } + if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenRfgwExCresnet(cresnetId, Global.ControlSystem); + } + } + var cresnetBridge = DeviceManager.GetDeviceForKey(parentKey) as ICresnetBridge; + + if (cresnetBridge != null) + { + Debug.Console(0, "Device {0} is a valid cresnet master - creating new GlsOdtCCn"); + + if (type.Equals("cenerfgwpoe", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenErfgwPoeCresnet(cresnetId, cresnetBridge.Branches[branchId]); + } + if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) + { + return new CenRfgwExCresnet(cresnetId, cresnetBridge.Branches[branchId]); + } + } + Debug.Console(0, "Device {0} is not a valid cresnet master", branchId); + 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; + + eExGatewayType gatewayType = + (eExGatewayType) Enum.Parse(typeof (eExGatewayType), props.GatewayType, true); + + switch (gatewayType) + { + case (eExGatewayType.Ethernet): + return new CenRfgwController(dc.Key, dc.Name, CenRfgwController.GetNewIpRfGateway(dc)); + case (eExGatewayType.EthernetShared): + return new CenRfgwController(dc.Key, dc.Name, CenRfgwController.GetNewSharedIpRfGateway(dc)); + case (eExGatewayType.Cresnet): + return new CenRfgwController(dc.Key, CenRfgwController.GetCenRfgwCresnetController, dc); + } + return null; + } } } + #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 55a157b4..4e1676fb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -192,6 +192,7 @@ + diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs index 746f449f..dd52257e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs @@ -21,6 +21,8 @@ namespace PepperDash.Essentials.Core [Description("Wrapper class for all HR-Series remotes")] public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback { + private CenRfgwController _gateway; + private Hr1x0WirelessRemoteBase _remote; public FeedbackCollection Feedbacks { get; set; } @@ -33,6 +35,39 @@ namespace PepperDash.Essentials.Core { Feedbacks = new FeedbackCollection(); + var props = JsonConvert.DeserializeObject(config.Properties.ToString()); + + var type = config.Type; + var rfId = (uint)props.Control.InfinetIdInt; + + GatewayBase gateway; + + if (props.GatewayDeviceKey == "processor") + { + gateway = Global.ControlSystem.ControllerRFGatewayDevice; + } + + else + { + var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController; + if (gatewayDev == null) + { + Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey); + } + if (gatewayDev != null) + { + Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey); + gateway = gatewayDev.GateWay; + _gateway = gatewayDev; + } + } + + if (_gateway != null) + { + _gateway.IsReady += new PepperDash_Essentials_Core.IsReadyEventHandler(_gateway_IsReady); + } + + AddPreActivationAction(() => { _remote = preActivationFunc(config); @@ -47,6 +82,11 @@ namespace PepperDash.Essentials.Core }); } + void _gateway_IsReady(object source, PepperDash_Essentials_Core.IsReadyEventArgs e) + { + throw new NotImplementedException(); + } + void _remote_BaseEvent(GenericBase device, BaseEventArgs args) { if(args.EventId == Hr1x0EventIds.BatteryCriticalFeedbackEventId) @@ -137,11 +177,6 @@ namespace PepperDash.Essentials.Core return remoteBase; } - static void gateway_BaseEvent(GenericBase device, BaseEventArgs args) - { - throw new NotImplementedException(); - } - #endregion #region Factory diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 9a28f75f..9cd0c655 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -614,6 +614,7 @@ namespace PepperDash.Essentials.DM var cecPort2 = outputCard.Card2.HdmiOutput; AddDmcHdoPorts(number, cecPort1, cecPort2); } + else if (type == "dmchdo") { var outputCard = new DmcHdoSingle(number, Chassis); From 9596d0f3c349c636d17af1c9f7107b2d1a33f01c Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 1 Jul 2020 10:44:28 -0500 Subject: [PATCH 114/150] Adds Dmc4kzHdo Resolves #294 --- .../Essentials_DM/Chassis/DmChassisController.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 9a28f75f..8aeb6668 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -614,6 +614,13 @@ namespace PepperDash.Essentials.DM var cecPort2 = outputCard.Card2.HdmiOutput; AddDmcHdoPorts(number, cecPort1, cecPort2); } + else if (type == "dmc4kzhdo") + { + var outputCard = new Dmc4kzHdoSingle(number, Chassis); + var cecPort1 = outputCard.Card1.HdmiOutput; + var cecPort2 = outputCard.Card2.HdmiOutput; + AddDmcHdoPorts(number, cecPort1, cecPort2); + } else if (type == "dmchdo") { var outputCard = new DmcHdoSingle(number, Chassis); From 2fea151089d178728660c29f14bef0aca69764fe Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Wed, 1 Jul 2020 16:03:32 -0500 Subject: [PATCH 115/150] Changes to CrestronGenericBase Refactor RfGatewayController new IHasReady interface Updates to Hrxx0WirelessRemoteController merge in development Addresses #292 --- .../Crestron/CrestronGenericBaseDevice.cs | 2 +- .../Factory/ReadyEventArgs.cs | 14 ++---- .../Gateways/CenRfgwController.cs | 48 +++++++++++-------- .../Remotes/Hrxx0WirelessRemoteController.cs | 47 +++++++++++------- 4 files changed, 62 insertions(+), 49 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs index 0ad6e135..9db81122 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs @@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core /// public abstract class CrestronGenericBaseDevice : EssentialsDevice, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking { - public virtual GenericBase Hardware { get; protected set; } + protected GenericBase Hardware; /// /// Returns a list containing the Outputs that we want to expose. diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs index 6999bd74..89c0b7b3 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Factory/ReadyEventArgs.cs @@ -6,25 +6,19 @@ using Crestron.SimplSharp; namespace PepperDash_Essentials_Core { - public delegate void IsReadyEventHandler(object source, IsReadyEventArgs e); - public class IsReadyEventArgs : EventArgs { - private readonly bool _EventData; + public bool IsReady { get; set; } public IsReadyEventArgs(bool data) { - _EventData = data; - } - - public bool GetData() - { - return _EventData; + IsReady = data; } } public interface IHasReady { - event IsReadyEventHandler IsReady; + event EventHandler IsReadyEvent; + bool IsReady { get; } } } \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs index 767714d1..ba185e4f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Gateways/CenRfgwController.cs @@ -20,7 +20,9 @@ namespace PepperDash.Essentials.Core [Description("Wrapper class for Crestron Infinet-EX Gateways")] public class CenRfgwController : CrestronGenericBaseDevice, IHasReady { - public event IsReadyEventHandler IsReady; + public event EventHandler IsReadyEvent; + + public bool IsReady { get; private set; } private GatewayBase _gateway; @@ -34,23 +36,27 @@ namespace PepperDash.Essentials.Core /// /// /// + /// public CenRfgwController(string key, string name, GatewayBase gateway) : base(key, name, gateway) { _gateway = gateway; - IsReady(this, new IsReadyEventArgs(true)); + IsReady = true; + FireIsReadyEvent(IsReady); } public CenRfgwController(string key, Func preActivationFunc, DeviceConfig config) : base(key, config.Name) { - IsReady(this, new IsReadyEventArgs(false)); + IsReady = false; + FireIsReadyEvent(IsReady); AddPreActivationAction(() => { _gateway = preActivationFunc(config); + IsReady = true; RegisterCrestronGenericBase(_gateway); - IsReady(this, new IsReadyEventArgs(true)); + FireIsReadyEvent(IsReady); }); } @@ -58,9 +64,7 @@ namespace PepperDash.Essentials.Core public static GatewayBase GetNewIpRfGateway(DeviceConfig dc) { var control = CommFactory.GetControlPropertiesConfig(dc); - var name = dc.Name; var type = dc.Type; - var key = dc.Key; var ipId = control.IpIdInt; if (type.Equals("cenrfgwex", StringComparison.InvariantCultureIgnoreCase)) @@ -74,6 +78,15 @@ namespace PepperDash.Essentials.Core return null; } + private void FireIsReadyEvent(bool data) + { + var handler = IsReadyEvent; + if (handler == null) return; + + handler(this, new IsReadyEventArgs(data)); + + } + public static GatewayBase GetNewSharedIpRfGateway(DeviceConfig dc) { var control = CommFactory.GetControlPropertiesConfig(dc); @@ -135,7 +148,7 @@ namespace PepperDash.Essentials.Core - public enum eExGatewayType + public enum EExGatewayType { Ethernet, EthernetShared, @@ -159,22 +172,17 @@ namespace PepperDash.Essentials.Core var props = JsonConvert.DeserializeObject(dc.Properties.ToString()); - var type = dc.Type.ToLower(); - var control = props.Control; - var ipid = control.IpIdInt; - var cresnetId = control.CresnetIdInt; - - eExGatewayType gatewayType = - (eExGatewayType) Enum.Parse(typeof (eExGatewayType), props.GatewayType, true); + EExGatewayType gatewayType = + (EExGatewayType) Enum.Parse(typeof (EExGatewayType), props.GatewayType, true); switch (gatewayType) { - case (eExGatewayType.Ethernet): - return new CenRfgwController(dc.Key, dc.Name, CenRfgwController.GetNewIpRfGateway(dc)); - case (eExGatewayType.EthernetShared): - return new CenRfgwController(dc.Key, dc.Name, CenRfgwController.GetNewSharedIpRfGateway(dc)); - case (eExGatewayType.Cresnet): - return new CenRfgwController(dc.Key, CenRfgwController.GetCenRfgwCresnetController, dc); + case (EExGatewayType.Ethernet): + return new CenRfgwController(dc.Key, dc.Name, GetNewIpRfGateway(dc)); + case (EExGatewayType.EthernetShared): + return new CenRfgwController(dc.Key, dc.Name, GetNewSharedIpRfGateway(dc)); + case (EExGatewayType.Cresnet): + return new CenRfgwController(dc.Key, GetCenRfgwCresnetController, dc); } return null; } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs index dd52257e..311df7f1 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Remotes/Hrxx0WirelessRemoteController.cs @@ -29,6 +29,8 @@ namespace PepperDash.Essentials.Core public CrestronCollection