From 8f319a44053e1d488b11ce165b37905822517a5f Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 16 Sep 2020 09:55:58 -0600 Subject: [PATCH 1/4] making changes for adding VC4 bridge --- .../Bridges/BridgeBase.cs | 58 +++++++++++-------- .../Bridges/VirtualControlEiscApiAdvanced.cs | 7 +++ .../PepperDashEssentialsBase/Global/Global.cs | 2 + .../PepperDash_Essentials_Core.csproj | 7 ++- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 1 + 5 files changed, 47 insertions(+), 28 deletions(-) create mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index ec6c2ebe..9631ead5 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -96,40 +96,48 @@ namespace PepperDash.Essentials.Core.Bridges Eisc.SigChange += Eisc_SigChange; - AddPostActivationAction( () => + AddPostActivationAction(LinkDevices); + } + + private void LinkDevices() + { + Debug.Console(1, this, "Linking Devices..."); + + foreach (var d in PropertiesConfig.Devices) { - Debug.Console(1, this, "Linking Devices..."); + var device = DeviceManager.GetDeviceForKey(d.DeviceKey); - foreach (var d in PropertiesConfig.Devices) + if (device == null) { - var device = DeviceManager.GetDeviceForKey(d.DeviceKey); - - if (device == null) continue; - - Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - - if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) - { - 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; - } - - var bridge = device as IBridgeAdvanced; - if (bridge != null) bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + continue; } - var registerResult = Eisc.Register(); + Debug.Console(1, this, "Linking Device: '{0}'", device.Key); - if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success) + if (!typeof (IBridgeAdvanced).IsAssignableFrom(device.GetType().GetCType())) { - Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult); - return; + 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; } - Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful"); - }); + var bridge = device as IBridgeAdvanced; + if (bridge != null) + { + bridge.LinkToApi(Eisc, d.JoinStart, d.JoinMapKey, this); + } + } + + var registerResult = Eisc.Register(); + + if (registerResult != eDeviceRegistrationUnRegistrationResponse.Success) + { + Debug.Console(2, this, Debug.ErrorLogLevel.Error, "Registration result: {0}", registerResult); + return; + } + + Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "EISC registration successful"); } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs new file mode 100644 index 00000000..35de694d --- /dev/null +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs @@ -0,0 +1,7 @@ +namespace PepperDash.Essentials.Core.Bridges +{ + public class VirtualControlEiscApiAdvanced + { + + } +} \ 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 b540b3d6..437c3bbb 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -19,6 +19,8 @@ namespace PepperDash.Essentials.Core { public static CrestronControlSystem ControlSystem { get; set; } + public static eDevicePlatform Platform { get { return CrestronEnvironment.DevicePlatform; } } + 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 ae420105..ed70ab1d 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -98,12 +98,12 @@ False - ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpCustomAttributesInterface.dll False False - ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpHelperInterface.dll False @@ -113,7 +113,7 @@ False - ..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpPro.exe False @@ -158,6 +158,7 @@ + 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 9759cfdd..b2591475 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 @@ -2006,6 +2006,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new Cisco Codec Device"); + var comm = CommFactory.CreateCommForDevice(dc); return new VideoCodec.Cisco.CiscoSparkCodec(dc, comm); } From 0fc6a73b30b1423c28d48e84c0e06e28f1b27dfc Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 25 Sep 2020 08:46:52 -0600 Subject: [PATCH 2/4] adjust factory and constructor for EiscApiAdvanced Keep SystemMonitor from getting instantiated if we're on a VC-4 instance --- PepperDashEssentials/ControlSystem.cs | 6 +++- .../Bridges/BridgeBase.cs | 36 ++++++++++++++----- .../Bridges/VirtualControlEiscApiAdvanced.cs | 7 ---- .../PepperDash_Essentials_Core.csproj | 1 - 4 files changed, 33 insertions(+), 17 deletions(-) delete mode 100644 essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8803dc6c..9802c176 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -327,7 +327,11 @@ namespace PepperDash.Essentials DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); // Add global System Monitor device - DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); + if (CrestronEnvironment.DevicePlatform == eDevicePlatform.Appliance) + { + DeviceManager.AddDevice( + new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); + } foreach (var devConf in ConfigReader.ConfigObject.Devices) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index 9631ead5..91c51f49 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using Crestron.SimplSharp.Reflection; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.EthernetCommunication; using Newtonsoft.Json; @@ -82,9 +83,9 @@ namespace PepperDash.Essentials.Core.Bridges protected Dictionary JoinMaps { get; private set; } - public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } + public BasicTriList Eisc { get; private set; } - public EiscApiAdvanced(DeviceConfig dc) : + public EiscApiAdvanced(DeviceConfig dc, BasicTriList eisc) : base(dc.Key) { JoinMaps = new Dictionary(); @@ -92,7 +93,7 @@ namespace PepperDash.Essentials.Core.Bridges PropertiesConfig = dc.Properties.ToObject(); //PropertiesConfig = JsonConvert.DeserializeObject(dc.Properties.ToString()); - Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(PropertiesConfig.Control.IpIdInt, PropertiesConfig.Control.TcpSshProperties.Address, Global.ControlSystem); + Eisc = eisc; Eisc.SigChange += Eisc_SigChange; @@ -160,7 +161,7 @@ namespace PepperDash.Essentials.Core.Bridges /// /// Prints all the join maps on this bridge /// - public void PrintJoinMaps() + public virtual void PrintJoinMaps() { Debug.Console(0, this, "Join Maps for EISC IPID: {0}", Eisc.ID.ToString("X")); @@ -255,7 +256,7 @@ namespace PepperDash.Essentials.Core.Bridges /// /// /// - void Eisc_SigChange(object currentDevice, SigEventArgs args) + protected void Eisc_SigChange(object currentDevice, SigEventArgs args) { try { @@ -307,15 +308,34 @@ namespace PepperDash.Essentials.Core.Bridges { public EiscApiAdvancedFactory() { - TypeNames = new List { "eiscapiadv", "eiscapiadvanced" }; + TypeNames = new List { "eiscapiadv", "eiscapiadvanced", "vceiscapiadv", "vceiscapiadvanced" }; } public override EssentialsDevice BuildDevice(DeviceConfig dc) { Debug.Console(1, "Factory Attempting to create new EiscApiAdvanced Device"); - return new EiscApiAdvanced(dc); - + var controlProperties = dc.Properties["control"].ToObject(); + + switch (dc.Type) + { + case "eiscapiadv": + case "eiscapiadvanced": + { + var eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(controlProperties.IpIdInt, + controlProperties.TcpSshProperties.Address, Global.ControlSystem); + return new EiscApiAdvanced(dc, eisc); + } + case "vceiscapiadv": + case "vceiscapiadvanced": + { + var eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId, + Global.ControlSystem); + return new EiscApiAdvanced(dc, eisc); + } + default: + return null; + } } } diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs deleted file mode 100644 index 35de694d..00000000 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/VirtualControlEiscApiAdvanced.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace PepperDash.Essentials.Core.Bridges -{ - public class VirtualControlEiscApiAdvanced - { - - } -} \ 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 ed70ab1d..ee97115f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -158,7 +158,6 @@ - From d2eadcd2f5465736cf335163491b2cdae83a120b Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 25 Sep 2020 10:42:41 -0600 Subject: [PATCH 3/4] Use InitialParametersClass.RoomId instead of Config --- .../PepperDashEssentialsBase/Bridges/BridgeBase.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs index 91c51f49..13d1948a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/BridgeBase.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Crestron.SimplSharp; using Crestron.SimplSharp.Reflection; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DeviceSupport; @@ -329,7 +330,7 @@ namespace PepperDash.Essentials.Core.Bridges case "vceiscapiadv": case "vceiscapiadvanced": { - var eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, controlProperties.RoomId, + var eisc = new VirtualControlEISCClient(controlProperties.IpIdInt, InitialParametersClass.RoomId, Global.ControlSystem); return new EiscApiAdvanced(dc, eisc); } From c7ccac2fe6e96b0341954c71999554472d79199a Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Wed, 30 Sep 2020 16:40:58 -0600 Subject: [PATCH 4/4] fix merge issue --- .../Essentials Core/PepperDashEssentialsBase/Global/Global.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index f0a71436..4a846df7 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -22,6 +22,8 @@ namespace PepperDash.Essentials.Core public static eDevicePlatform Platform { get { return CrestronEnvironment.DevicePlatform; } } + public static Dictionary EthernetAdapterInfoCollection { get; private set; } + public static LicenseManager LicenseManager { get; set; } ///