From 47fb805766798b3f45a597c4c681b558b64ba0ca Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Tue, 28 May 2019 19:25:18 -0700 Subject: [PATCH 01/27] Added IBridge to make it easier to deal with calling the linkToApi method. Added as an else if in EiscApI to ensure backwards compatibility. --- PepperDashEssentials/Bridges/BridgeBase.cs | 5 +++++ PepperDashEssentials/Bridges/IBridge.cs | 14 ++++++++++++++ PepperDashEssentials/PepperDashEssentials.csproj | 1 + essentials-framework | 2 +- 4 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 PepperDashEssentials/Bridges/IBridge.cs diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index e6ecf1c0..9cfcc08a 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -123,6 +123,11 @@ namespace PepperDash.Essentials.Bridges { (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; + } + else if (device is IBridge) + { + (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; } //else if (device is LightingBase) //{ diff --git a/PepperDashEssentials/Bridges/IBridge.cs b/PepperDashEssentials/Bridges/IBridge.cs new file mode 100644 index 00000000..d86a1d1d --- /dev/null +++ b/PepperDashEssentials/Bridges/IBridge.cs @@ -0,0 +1,14 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +namespace PepperDash.Essentials.Bridges +{ + public interface IBridge + { + void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey); + } +} \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index b454f4b4..4a5ad292 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -127,6 +127,7 @@ + diff --git a/essentials-framework b/essentials-framework index 75c2bf81..a801b08d 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 75c2bf819a3b7e6c37a3d6b0c7b11cc273043b12 +Subproject commit a801b08d38a9ba6e8a973c58d7b7715424b25839 From 288c9bb04c4d0d4146f16a9244bc99ffc17d7fde Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Thu, 6 Jun 2019 11:31:17 -0600 Subject: [PATCH 02/27] Added ALL 8x8 - 32x32 chassis varieties --- PepperDashEssentials/Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 83beada4..aee2b8e7 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.0.*")] +[assembly: AssemblyVersion("1.4.5.*")] diff --git a/essentials-framework b/essentials-framework index 75c2bf81..2c636c33 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 75c2bf819a3b7e6c37a3d6b0c7b11cc273043b12 +Subproject commit 2c636c3347a406c4254d895789f40dd183f00ca9 From 8585977f715b1e87d36ad98fd6a953dbda1390a8 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Thu, 6 Jun 2019 15:51:17 -0600 Subject: [PATCH 03/27] ECS-1108, ECS-1109. Added construction for endpoints on CPU3 chassis --- devjson commands.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devjson commands.json b/devjson commands.json index 4f0aa69e..e6251e87 100644 --- a/devjson commands.json +++ b/devjson commands.json @@ -34,4 +34,7 @@ devjson:3 {"deviceKey":"room1.RoomOccupancy.RoomIsOccupiedFeedback","methodName" devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["xcommand dial number: 10.11.50.211\r"]} -devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []} \ No newline at end of file +devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []} + + +devjson:2 {"deviceKey":"display01Comm-com", "methodName":"SendText", "params": [ "I'M GETTING TIRED OF THIS" ]} \ No newline at end of file From 3ceecd3fbed7adb691d02b34dccae53d7f7d1d6d Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Mon, 10 Jun 2019 11:59:09 -0600 Subject: [PATCH 04/27] Modified volumes format; added config for VC cameras and recents --- .../Messengers/Ddvc01VtcMessenger.cs | 17 ++ .../RoomBridges/CotijaDdvc01RoomBridge.cs | 172 +++++++++++++----- PepperDashEssentials/AppServer/Volumes.cs | 11 +- PepperDashEssentials/ControlSystem.cs | 6 - .../Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 6 files changed, 150 insertions(+), 60 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index d6f20ab4..fbddf075 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -123,6 +123,15 @@ namespace PepperDash.Essentials.AppServer.Messengers /// const uint BCameraModeOff = 833; + /// + /// 841 + /// + const uint BCameraSelfView = 841; + + /// + /// 842 + /// + const uint BCameraLayout = 842; /********* Ushorts *********/ @@ -330,6 +339,11 @@ namespace PepperDash.Essentials.AppServer.Messengers EISC.SetSigTrueAction(BCameraModeManual, () => PostCameraMode()); EISC.SetSigTrueAction(BCameraModeOff, () => PostCameraMode()); + EISC.SetBoolSigAction(BCameraSelfView, b => PostStatusMessage(new + { + cameraSelfView = b + })); + EISC.SetUShortSigAction(UCameraNumberSelect, (u) => PostSelectedCamera()); @@ -356,6 +370,8 @@ namespace PepperDash.Essentials.AppServer.Messengers addAction("/cameraModeAuto", BCameraModeAuto); addAction("/cameraModeManual", BCameraModeManual); addAction("/cameraModeOff", BCameraModeOff); + addAction("/cameraSelfView", BCameraSelfView); + addAction("/cameraLayout", BCameraLayout); asc.AddAction("/cameraSelect", new Action(SelectCamera)); @@ -437,6 +453,7 @@ namespace PepperDash.Essentials.AppServer.Messengers { calls = GetCurrentCallList(), cameraMode = GetCameraMode(), + cameraSelfView = EISC.GetBool(BCameraSelfView), currentCallString = EISC.GetString(SCurrentCallNumber), currentDialString = EISC.GetString(SCurrentDialString), directoryContactSelected = new diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index fdd73989..c59a5026 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -27,6 +27,11 @@ namespace PepperDash.Essentials.Room.Cotija /// public const uint RoomIsOn = 301; + /// + /// 12 + /// + public const uint PrivacyMute = 12; + /// /// 41 /// @@ -38,15 +43,15 @@ namespace PepperDash.Essentials.Room.Cotija /// /// 51 /// - public const uint ActivitySharePress = 51; + public const uint ActivityShare = 51; /// /// 52 /// - public const uint ActivityPhoneCallPress = 52; + public const uint ActivityPhoneCall = 52; /// /// 53 /// - public const uint ActivityVideoCallPress = 53; + public const uint ActivityVideoCall = 53; /// /// 1 @@ -85,6 +90,14 @@ namespace PepperDash.Essentials.Room.Cotija /// public const uint ConfigIsReady = 501; /// + /// 502 + /// + public const uint HideVideoConfRecents = 502; + /// + /// 503 + /// + public const uint ShowCameraWhenNotInCall = 503; + /// /// 601 /// public const uint SourceShareDisableStartJoin = 601; @@ -319,16 +332,26 @@ namespace PepperDash.Essentials.Room.Cotija })); Parent.AddAction(@"/room/room1/defaultsource", new Action(() => - EISC.PulseBool(BoolJoin.ActivitySharePress))); + EISC.PulseBool(BoolJoin.ActivityShare))); Parent.AddAction(@"/room/room1/activityVideo", new Action(() => - EISC.PulseBool(BoolJoin.ActivityVideoCallPress))); + EISC.PulseBool(BoolJoin.ActivityVideoCall))); Parent.AddAction(@"/room/room1/activityPhone", new Action(() => - EISC.PulseBool(BoolJoin.ActivityPhoneCallPress))); + EISC.PulseBool(BoolJoin.ActivityPhoneCall))); Parent.AddAction(@"/room/room1/volumes/master/level", new Action(u => EISC.SetUshort(UshortJoin.MasterVolumeLevel, u))); Parent.AddAction(@"/room/room1/volumes/master/muteToggle", new Action(() => EISC.PulseBool(BoolJoin.MasterVolumeIsMuted))); + Parent.AddAction(@"/room/room1/volumes/master/privacyMuteToggle", new Action(() => + EISC.PulseBool(BoolJoin.PrivacyMute))); + for (uint i = 2; i <= 7; i++) + { + var index = i; + Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/level", index), new Action(u => + EISC.SetUshort(index, u))); + Parent.AddAction(string.Format(@"/room/room1/volumes/level-{0}/muteToggle", index), new Action(() => + EISC.PulseBool(index))); + } Parent.AddAction(@"/room/room1/shutdownStart", new Action(() => EISC.PulseBool(BoolJoin.ShutdownStart))); @@ -387,7 +410,6 @@ namespace PepperDash.Essentials.Room.Cotija } } })); - EISC.SetBoolSigAction(BoolJoin.MasterVolumeIsMuted, b => PostStatusMessage(new { @@ -399,6 +421,48 @@ namespace PepperDash.Essentials.Room.Cotija } } })); + EISC.SetBoolSigAction(BoolJoin.PrivacyMute, b => + PostStatusMessage(new + { + volumes = new + { + master = new + { + privacyMuted = b + } + } + })); + + for (uint i = 2; i <= 7; i++) + { + var index = i; // local scope for lambdas + EISC.SetUShortSigAction(index, u => // start at join 2 + { + // need a dict in order to create the level-n property on auxFaders + var dict = new Dictionary(); + dict.Add("level-" + index, new { level = u }); + PostStatusMessage(new + { + volumes = new + { + auxFaders = dict, + } + }); + }); + EISC.SetBoolSigAction(index, b => + { + // need a dict in order to create the level-n property on auxFaders + var dict = new Dictionary(); + dict.Add("level-" + index, new { muted = b }); + PostStatusMessage(new + { + volumes = new + { + auxFaders = dict, + } + }); + }); + } // shutdown things @@ -421,6 +485,23 @@ namespace PepperDash.Essentials.Room.Cotija // Config things EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues); + + // Activity modes + EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(3)); + EISC.SetSigTrueAction(BoolJoin.ActivityShare, () => UpdateActivity(1)); + EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(2)); + } + + + /// + /// Updates activity states + /// + void UpdateActivity(int mode) + { + PostStatusMessage(new + { + activityMode = mode, + }); } /// @@ -471,17 +552,6 @@ namespace PepperDash.Essentials.Room.Cotija rmProps.RoomPhoneNumber = EISC.StringOutput[StringJoin.ConfigRoomPhoneNumber].StringValue; rmProps.RoomURI = EISC.StringOutput[StringJoin.ConfigRoomURI].StringValue; rmProps.SpeedDials = new List(); - // add speed dials as long as there are more - up to 4 - -#warning fix speed dials - 512-515 names, 516-519 numbers - for (uint i = 512; i <= 519; i = i + 2) - { - var num = EISC.StringOutput[i].StringValue; - if (string.IsNullOrEmpty(num)) - break; - var name = EISC.StringOutput[i + 1].StringValue; - rmProps.SpeedDials.Add(new DDVC01SpeedDial { Number = num, Name = name}); - } // This MAY need a check rmProps.AudioCodecKey = "audioCodec"; @@ -575,7 +645,7 @@ namespace PepperDash.Essentials.Room.Cotija co.SourceLists.Add("default", newSl); - // build "audioCodec" config if we need + // Build "audioCodec" config if we need if (!string.IsNullOrEmpty(rmProps.AudioCodecKey)) { var acFavs = new List(); @@ -610,25 +680,11 @@ namespace PepperDash.Essentials.Room.Cotija co.Devices.Add(acConf); } + // Build Video codec config if (!string.IsNullOrEmpty(rmProps.VideoCodecKey)) { -#warning Break out these video codec favs + // No favorites, for now? var favs = new List(); - for (uint i = 0; i < 4; i++) - { - if (!EISC.GetBool(BoolJoin.SpeedDialVisibleStartJoin + i)) - { - break; - } - favs.Add(new PepperDash.Essentials.Devices.Common.Codec.CodecActiveCallItem() - { - Name = EISC.GetString(StringJoin.SpeedDialNameStartJoin + i), - Number = EISC.GetString(StringJoin.SpeedDialNumberStartJoin + i), - Type = PepperDash.Essentials.Devices.Common.Codec.eCodecCallType.Audio - }); - } - - // cameras var camsProps = new List(); @@ -658,6 +714,8 @@ namespace PepperDash.Essentials.Room.Cotija { favorites = favs, cameras = camsProps, + hideRecents = EISC.BooleanOutput[BoolJoin.HideVideoConfRecents].BoolValue, + showCamerasWhenNotInCall = EISC.BooleanOutput[BoolJoin.ShowCameraWhenNotInCall].BoolValue, }; var str = "videoCodec"; var conf = new DeviceConfig() @@ -689,39 +747,41 @@ namespace PepperDash.Essentials.Room.Cotija { if (ConfigIsLoaded) { - var count = EISC.UShortOutput[801].UShortValue; + var count = EISC.UShortOutput[101].UShortValue; Debug.Console(1, this, "The Fader Count is : {0}", count); // build volumes object, serialize and put in content of method below - var auxFaders = new List(); - // Create auxFaders - for (uint i = 2; i <= count; i++) - { - auxFaders.Add( - new Volume(string.Format("level-{0}", i), - EISC.UShortOutput[i].UShortValue, - EISC.BooleanOutput[i].BoolValue, - EISC.StringOutput[800 + i].StringValue, - true, - "someting.png")); - } + var auxFaderDict = new Dictionary(); + for (uint i = 2; i <= count; i++) + { + auxFaderDict.Add("level-" + i, + new Volume("level-" + i, + EISC.UShortOutput[i].UShortValue, + EISC.BooleanOutput[i].BoolValue, + EISC.StringOutput[i].StringValue, + true, + "someting.png")); + } var volumes = new Volumes(); volumes.Master = new Volume("master", EISC.UShortOutput[UshortJoin.MasterVolumeLevel].UShortValue, EISC.BooleanOutput[BoolJoin.MasterVolumeIsMuted].BoolValue, - EISC.StringOutput[801].StringValue, + EISC.StringOutput[1].StringValue, true, "something.png"); + volumes.Master.HasPrivacyMute = true; + volumes.Master.PrivacyMuted = EISC.BooleanOutput[BoolJoin.PrivacyMute].BoolValue; - volumes.AuxFaders = auxFaders; + volumes.AuxFaders = auxFaderDict; PostStatusMessage(new { + activityMode = GetActivityMode(), isOn = EISC.BooleanOutput[BoolJoin.RoomIsOn].BoolValue, selectedSourceKey = EISC.StringOutput[StringJoin.SelectedSourceKey].StringValue, volumes = volumes @@ -736,6 +796,18 @@ namespace PepperDash.Essentials.Room.Cotija } } + /// + /// Returns the activity mode int + /// + /// + int GetActivityMode() + { + if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 3; + else if (EISC.BooleanOutput[BoolJoin.ActivityShare].BoolValue) return 1; + else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 2; + return 0; + } + /// /// Helper for posting status message /// diff --git a/PepperDashEssentials/AppServer/Volumes.cs b/PepperDashEssentials/AppServer/Volumes.cs index 38de8ef2..cf22181a 100644 --- a/PepperDashEssentials/AppServer/Volumes.cs +++ b/PepperDashEssentials/AppServer/Volumes.cs @@ -14,11 +14,11 @@ namespace PepperDash.Essentials.Room.Cotija public Volume Master { get; set; } [JsonProperty("auxFaders")] - public List AuxFaders { get; set; } + public Dictionary AuxFaders { get; set; } public Volumes() { - AuxFaders = new List(); + AuxFaders = new Dictionary(); } } @@ -39,6 +39,13 @@ namespace PepperDash.Essentials.Room.Cotija [JsonProperty("hasMute")] public bool HasMute { get; set; } + [JsonProperty("hasPrivacyMute")] + public bool HasPrivacyMute { get; set; } + + [JsonProperty("privacyMuted")] + public bool PrivacyMuted { get; set; } + + [JsonProperty("muteIcon")] public string MuteIcon { get; set; } diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8124beb7..e2333ac0 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -193,17 +193,11 @@ namespace PepperDash.Essentials var dir = Global.FilePathPrefix + "plugins"; if (Directory.Exists(dir)) { - // TODO Clear out or create localPlugins folder (maybe in program slot folder) - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins"); var di = new DirectoryInfo(dir); var files = di.GetFiles("*.dll"); foreach (FileInfo fi in files) { - // TODO COPY plugin to loadedPlugins folder - - // TODO LOAD that loadedPlugins dll file - var assy = Assembly.LoadFrom(fi.FullName); var ver = assy.GetName().Version; var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index aee2b8e7..3be0f536 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.5.*")] +[assembly: AssemblyVersion("1.4.6.*")] diff --git a/essentials-framework b/essentials-framework index 2c636c33..847b3e04 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 2c636c3347a406c4254d895789f40dd183f00ca9 +Subproject commit 847b3e044ddc099da5e2ba8baf991e36859bd8f6 From 68064c7194b9725c5df9b637221d04969fea8a47 Mon Sep 17 00:00:00 2001 From: Heath Volmer Date: Tue, 11 Jun 2019 10:15:38 -0600 Subject: [PATCH 05/27] Various fixes --- .../AppServer/Messengers/Ddvc01AtcMessenger.cs | 8 +++++--- .../AppServer/Messengers/Ddvc01VtcMessenger.cs | 4 +++- .../RoomBridges/CotijaDdvc01RoomBridge.cs | 14 ++++++-------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs index b578018b..72e2f8d3 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01AtcMessenger.cs @@ -19,7 +19,8 @@ namespace PepperDash.Essentials.AppServer.Messengers /// /// 221 /// - const uint BDialHangup = 221; + const uint BDialHangupOnHook = 221; + /// /// 251 /// @@ -134,7 +135,7 @@ namespace PepperDash.Essentials.AppServer.Messengers { CurrentCallItem.Status = (eCodecCallStatus)Enum.Parse(typeof(eCodecCallStatus), s, true); //GetCurrentCallList(); - SendCallsList(); + SendFullStatus(); }); EISC.SetStringSigAction(SCurrentCallNumber, s => @@ -162,7 +163,8 @@ namespace PepperDash.Essentials.AppServer.Messengers // Add straight pulse calls Action addAction = (s, u) => AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); - addAction("/endCallById", BDialHangup); + addAction("/endCallById", BDialHangupOnHook); + addAction("/endAllCalls", BDialHangupOnHook); addAction("/acceptById", BIncomingAnswer); addAction("/rejectById", BIncomingReject); addAction("/speedDial1", BSpeedDial1); diff --git a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs index fbddf075..b05bc93b 100644 --- a/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/Ddvc01VtcMessenger.cs @@ -361,6 +361,7 @@ namespace PepperDash.Essentials.AppServer.Messengers Action addAction = (s, u) => AppServerController.AddAction(MessagePath + s, new Action(() => EISC.PulseBool(u, 100))); addAction("/endCallById", BDialHangup); + addAction("/endAllCalls", BDialHangup); addAction("/acceptById", BIncomingAnswer); addAction("/rejectById", BIncomingReject); addAction("/speedDial1", BSpeedDial1); @@ -465,8 +466,9 @@ namespace PepperDash.Essentials.AppServer.Messengers isInCall = EISC.GetString(SHookState) == "Connected", hasDirectory = true, hasDirectorySearch = false, - hasRecents = true, + hasRecents = !EISC.BooleanOutput[502].BoolValue, hasCameras = true, + showCamerasWhenNotInCall = EISC.BooleanOutput[503].BoolValue, selectedCamera = GetSelectedCamera(), }); } diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index c59a5026..1720778c 100644 --- a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -333,10 +333,10 @@ namespace PepperDash.Essentials.Room.Cotija Parent.AddAction(@"/room/room1/defaultsource", new Action(() => EISC.PulseBool(BoolJoin.ActivityShare))); - Parent.AddAction(@"/room/room1/activityVideo", new Action(() => - EISC.PulseBool(BoolJoin.ActivityVideoCall))); Parent.AddAction(@"/room/room1/activityPhone", new Action(() => EISC.PulseBool(BoolJoin.ActivityPhoneCall))); + Parent.AddAction(@"/room/room1/activityVideo", new Action(() => + EISC.PulseBool(BoolJoin.ActivityVideoCall))); Parent.AddAction(@"/room/room1/volumes/master/level", new Action(u => EISC.SetUshort(UshortJoin.MasterVolumeLevel, u))); @@ -487,9 +487,9 @@ namespace PepperDash.Essentials.Room.Cotija EISC.SetSigTrueAction(BoolJoin.ConfigIsReady, LoadConfigValues); // Activity modes - EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(3)); EISC.SetSigTrueAction(BoolJoin.ActivityShare, () => UpdateActivity(1)); - EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(2)); + EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(2)); + EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(3)); } @@ -714,8 +714,6 @@ namespace PepperDash.Essentials.Room.Cotija { favorites = favs, cameras = camsProps, - hideRecents = EISC.BooleanOutput[BoolJoin.HideVideoConfRecents].BoolValue, - showCamerasWhenNotInCall = EISC.BooleanOutput[BoolJoin.ShowCameraWhenNotInCall].BoolValue, }; var str = "videoCodec"; var conf = new DeviceConfig() @@ -802,9 +800,9 @@ namespace PepperDash.Essentials.Room.Cotija /// int GetActivityMode() { - if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 3; + if (EISC.BooleanOutput[BoolJoin.ActivityPhoneCall].BoolValue) return 2; else if (EISC.BooleanOutput[BoolJoin.ActivityShare].BoolValue) return 1; - else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 2; + else if (EISC.BooleanOutput[BoolJoin.ActivityVideoCall].BoolValue) return 3; return 0; } From a8f1f77d4875e9b73be2ab015a6eec8cbd1f91c4 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 11 Jun 2019 11:58:57 -0600 Subject: [PATCH 06/27] Adds README.md with basic process instructions for repo maintenance cycle --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..bedf0595 --- /dev/null +++ b/README.md @@ -0,0 +1,16 @@ +# Pepperdash Essentials + +#### How to merge + + +## Essentials Framework + +- If any external references have changed (like PepperDash.Core), make not of them in the commit in Framework + + +- Make changes +- Build +- Test on your system +- Commit and push to framework +- Commit and push to essentials +- Curse a whole lot when you try to figure out how to then get developments all synced up From ae23e48fd0a73c0840539007f4e0c744dd2e86f4 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 11 Jun 2019 22:09:20 -0600 Subject: [PATCH 07/27] Resolves issue with GenericRelay factory not returning device if portDeviceKey maps to a device that is not of type CrestronControlSystem --- PepperDashEssentials/ControlSystem.cs | 2 -- essentials-framework | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8124beb7..9069bef4 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -356,8 +356,6 @@ namespace PepperDash.Essentials newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf); if (newDev == null) newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.BridgeFactory.GetDevice(devConf); //if (newDev == null) // might want to consider the ability to override an essentials "type" //{ diff --git a/essentials-framework b/essentials-framework index 2c636c33..11f52e17 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 2c636c3347a406c4254d895789f40dd183f00ca9 +Subproject commit 11f52e170e452a2397b3dc0d685abe11345ae424 From 1b599ff8637625926a1956fa885e8e780bf2de7d Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 11 Jun 2019 22:10:46 -0600 Subject: [PATCH 08/27] Updated Assembly version to 1.4.6 --- PepperDashEssentials/Properties/AssemblyInfo.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index aee2b8e7..3be0f536 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.5.*")] +[assembly: AssemblyVersion("1.4.6.*")] From f82816729b9588c1b734a747c2f795ae680817a8 Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Thu, 13 Jun 2019 19:44:14 -0700 Subject: [PATCH 09/27] DID Not commit separately but also made bridge eisc uo actions use a threadpool thread. Fix the load plugin to load dlls before calling the load plugin method. Also added capability to place a cplz and unzip and load. The crestron dlls will throw exceptions so catching them and printing to console if debug is enabled to hide the messages from log and user as they can look like a problem when they are not. IMPORTANT we may need to add some logic to deal with multiple cplz's unzipping as the files will auto overwrite. See JIRA ticket ECS-1113 --- PepperDashEssentials/Bridges/BridgeFactory.cs | 14 +- PepperDashEssentials/ControlSystem.cs | 611 +++++++++--------- 2 files changed, 329 insertions(+), 296 deletions(-) diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index 8b9ba75c..923ee59f 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -128,13 +128,13 @@ public class BridgeApiEisc { if (Debug.Level >= 1) Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); - var uo = args.Sig.UserObject; - if (uo is Action) - (uo as Action)(args.Sig.BoolValue); - else if (uo is Action) - (uo as Action)(args.Sig.UShortValue); - else if (uo is Action) - (uo as Action)(args.Sig.StringValue); + var uo = args.Sig.UserObject; + if (uo is Action) + CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.BoolValue), args); + else if (uo is Action) + CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.UShortValue), args); + else if (uo is Action) + CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.StringValue), args); } } } diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8124beb7..44ebc31f 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -19,35 +19,35 @@ using PepperDash.Essentials.Room.Cotija; namespace PepperDash.Essentials { - public class ControlSystem : CrestronControlSystem - { + public class ControlSystem : CrestronControlSystem + { HttpLogoServer LogoServer; - List FactoryObjects = new List(); + List FactoryObjects = new List(); - public ControlSystem() - : base() - { - Thread.MaxNumberOfUserThreads = 400; - Global.ControlSystem = this; - DeviceManager.Initialize(this); - } + public ControlSystem() + : base() + { + Thread.MaxNumberOfUserThreads = 400; + Global.ControlSystem = this; + DeviceManager.Initialize(this); + } - /// - /// Git 'er goin' - /// - public override void InitializeSystem() - { + /// + /// Git 'er goin' + /// + public override void InitializeSystem() + { DeterminePlatform(); //CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Loads configuration file", // ConsoleAccessLevelEnum.AccessOperator); - // CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s); - }, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator); + // CrestronConsole.AddNewConsoleCommand(S => { ConfigWriter.WriteConfigFile(null); }, "writeconfig", "writes the current config to a file", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "CONSOLE MESSAGE: {0}", s); + }, "appdebugmessage", "Writes message to log", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand(s => { @@ -56,23 +56,23 @@ namespace PepperDash.Essentials }, "listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - CrestronConsole.ConsoleCommandResponse - ("Current running configuration. This is the merged system and template configuration"); - CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject - (ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented)); - }, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => + { + CrestronConsole.ConsoleCommandResponse + ("Current running configuration. This is the merged system and template configuration"); + CrestronConsole.ConsoleCommandResponse(Newtonsoft.Json.JsonConvert.SerializeObject + (ConfigReader.ConfigObject, Newtonsoft.Json.Formatting.Indented)); + }, "showconfig", "Shows the current running merged config", ConsoleAccessLevelEnum.AccessOperator); - CrestronConsole.AddNewConsoleCommand(s => - { - CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" + - "System URL: {0}\r" + - "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); - }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); + CrestronConsole.AddNewConsoleCommand(s => + { + CrestronConsole.ConsoleCommandResponse("This system can be found at the following URLs:\r" + + "System URL: {0}\r" + + "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); + }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); GoWithLoad(); - } + } /// /// Determines if the program is running on a processor (appliance) or server (VC-4). @@ -100,11 +100,11 @@ namespace PepperDash.Essentials Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials v{0} on 3-series Appliance", versionString); // Check if User/ProgramX exists - if(Directory.Exists(directoryPrefix + dirSeparator + "User" + if (Directory.Exists(directoryPrefix + dirSeparator + "User" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber))) { Debug.Console(0, @"User/program{0} directory found", InitialParametersClass.ApplicationNumber); - filePathPrefix = directoryPrefix + dirSeparator + "User" + filePathPrefix = directoryPrefix + dirSeparator + "User" + dirSeparator + string.Format("program{0}", InitialParametersClass.ApplicationNumber) + dirSeparator; } // Check if Nvram/Programx exists @@ -134,165 +134,198 @@ namespace PepperDash.Essentials Global.SetFilePathPrefix(filePathPrefix); } - /// - /// Do it, yo - /// - public void GoWithLoad() - { - try - { + /// + /// Do it, yo + /// + public void GoWithLoad() + { + try + { Debug.Console(0, Debug.ErrorLogLevel.Notice, "Starting Essentials load from configuration"); - var filesReady = SetupFilesystem(); - if (filesReady) - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins"); - LoadPlugins(); + var filesReady = SetupFilesystem(); + if (filesReady) + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Checking for plugins"); + LoadPlugins(); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Folder structure verified. Loading config..."); - if (!ConfigReader.LoadConfig2()) - return; + if (!ConfigReader.LoadConfig2()) + return; - Load(); + Load(); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Essentials load complete\r" + - "-------------------------------------------------------------"); - } - else - { - Debug.Console(0, - "------------------------------------------------\r" + - "------------------------------------------------\r" + - "------------------------------------------------\r" + - "Essentials file structure setup completed.\r" + - "Please load config, sgd and ir files and\r" + - "restart program.\r" + - "------------------------------------------------\r" + - "------------------------------------------------\r" + - "------------------------------------------------"); - } + "-------------------------------------------------------------"); + } + else + { + Debug.Console(0, + "------------------------------------------------\r" + + "------------------------------------------------\r" + + "------------------------------------------------\r" + + "Essentials file structure setup completed.\r" + + "Please load config, sgd and ir files and\r" + + "restart program.\r" + + "------------------------------------------------\r" + + "------------------------------------------------\r" + + "------------------------------------------------"); + } } - catch (Exception e) - { - Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e); + catch (Exception e) + { + Debug.Console(0, "FATAL INITIALIZE ERROR. System is in an inconsistent state:\r{0}", e); - } + } // Notify the OS that the program intitialization has completed SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; - } + } - /// - /// Initial simple implementation. Reads user/programN/plugins folder and - /// use - /// - void LoadPlugins() - { - var dir = Global.FilePathPrefix + "plugins"; - if (Directory.Exists(dir)) - { - // TODO Clear out or create localPlugins folder (maybe in program slot folder) + /// + /// Initial simple implementation. Reads user/programN/plugins folder and + /// use + /// + void LoadPlugins() + { + var dir = Global.FilePathPrefix + "plugins"; + if (Directory.Exists(dir)) + { + // TODO Clear out or create localPlugins folder (maybe in program slot folder) - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins"); - var di = new DirectoryInfo(dir); - var files = di.GetFiles("*.dll"); - foreach (FileInfo fi in files) - { - // TODO COPY plugin to loadedPlugins folder + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Plugins directory found, checking for factory plugins"); + var di = new DirectoryInfo(dir); + var zFiles = di.GetFiles("*.cplz"); + foreach (var fi in zFiles) + { + Debug.Console(0, "Found cplz: {0}. Unzipping into plugins directory", fi.Name); + var result = CrestronZIP.Unzip(fi.FullName, di.FullName); + Debug.Console(0, "UnZip Result: {0}", result.ToString()); + fi.Delete(); + } + var files = di.GetFiles("*.dll"); + Dictionary assyList = new Dictionary(); + foreach (FileInfo fi in files) + { + // TODO COPY plugin to loadedPlugins folder + // TODO LOAD that loadedPlugins dll file + try + { + var assy = Assembly.LoadFrom(fi.FullName); + var ver = assy.GetName().Version; + var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); + assyList.Add(fi.FullName, assy); + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loaded plugin file '{0}', version {1}", fi.FullName, verStr); + } + catch + { + Debug.Console(2, "Assembly {0} is not a custom assembly", fi.FullName); + continue; //catching any load issues and continuing. There will be exceptions loading Crestron .dlls from the cplz Probably should do something different here + } + } + foreach (var assy in assyList) + { + // iteratate this assembly's classes, looking for "LoadPlugin()" methods + try + { + var types = assy.Value.GetTypes(); + foreach (var type in types) + { + try + { + var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static); + var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin")); + if (loadPlugin != null) + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", assy.Key, type.FullName); + loadPlugin.Invoke(null, null); + } + } + catch + { + Debug.Console(2, "Load Plugin not found. {0} is not a plugin assembly", assy.Value.FullName); + continue; + } - // TODO LOAD that loadedPlugins dll file + } + } + catch + { + Debug.Console(2, "Assembly {0} is not a custom assembly. Types cannot be loaded.", assy.Value.FullName); + continue; + } + } + // plugin dll will be loaded. Any classes in plugin should have a static constructor + // that registers that class with the Core.DeviceFactory + } + } - var assy = Assembly.LoadFrom(fi.FullName); - var ver = assy.GetName().Version; - var verStr = string.Format("{0}.{1}.{2}.{3}", ver.Major, ver.Minor, ver.Build, ver.Revision); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Loaded plugin file '{0}', version {1}", fi.FullName, verStr); + /// + /// Verifies filesystem is set up. IR, SGD, and programX folders + /// + bool SetupFilesystem() + { + Debug.Console(0, "Verifying and/or creating folder structure"); + var configDir = Global.FilePathPrefix; + var configExists = Directory.Exists(configDir); + if (!configExists) + Directory.Create(configDir); - // iteratate this assembly's classes, looking for "LoadPlugin()" methods - var types = assy.GetTypes(); - foreach (var type in types) - { - var methods = type.GetMethods(BindingFlags.Public | BindingFlags.Static); - var loadPlugin = methods.FirstOrDefault(m => m.Name.Equals("LoadPlugin")); - if (loadPlugin != null) - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Adding type {0}", fi.FullName, type.FullName); - loadPlugin.Invoke(null, null); - } - - } - - // plugin dll will be loaded. Any classes in plugin should have a static constructor - // that registers that class with the Core.DeviceFactory - } - } - } - - /// - /// Verifies filesystem is set up. IR, SGD, and programX folders - /// - bool SetupFilesystem() - { - Debug.Console(0, "Verifying and/or creating folder structure"); - var configDir = Global.FilePathPrefix; - var configExists = Directory.Exists(configDir); - if (!configExists) - Directory.Create(configDir); - - var irDir = Global.FilePathPrefix + "ir"; - if (!Directory.Exists(irDir)) - Directory.Create(irDir); + var irDir = Global.FilePathPrefix + "ir"; + if (!Directory.Exists(irDir)) + Directory.Create(irDir); var sgdDir = Global.FilePathPrefix + "sgd"; - if (!Directory.Exists(sgdDir)) - Directory.Create(sgdDir); + if (!Directory.Exists(sgdDir)) + Directory.Create(sgdDir); - return configExists; - } + return configExists; + } - ///// - ///// - ///// - ///// - //public void EnablePortalSync(string s) - //{ - // if (s.ToLower() == "enable") - // { - // CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled"); - // } - //} + ///// + ///// + ///// + ///// + //public void EnablePortalSync(string s) + //{ + // if (s.ToLower() == "enable") + // { + // CrestronConsole.ConsoleCommandResponse("Portal Sync features enabled"); + // } + //} - /// - /// - /// - public void TearDown() - { - Debug.Console(0, "Tearing down existing system"); - DeviceManager.DeactivateAll(); + /// + /// + /// + public void TearDown() + { + Debug.Console(0, "Tearing down existing system"); + DeviceManager.DeactivateAll(); - TieLineCollection.Default.Clear(); + TieLineCollection.Default.Clear(); - foreach (var key in DeviceManager.GetDevices()) - DeviceManager.RemoveDevice(key); + foreach (var key in DeviceManager.GetDevices()) + DeviceManager.RemoveDevice(key); - Debug.Console(0, "Tear down COMPLETE"); - } + Debug.Console(0, "Tear down COMPLETE"); + } - /// - /// - /// - void Load() - { - LoadDevices(); - LoadTieLines(); - LoadRooms(); - LoadLogoServer(); + /// + /// + /// + void Load() + { + LoadDevices(); + LoadTieLines(); + LoadRooms(); + LoadLogoServer(); - DeviceManager.ActivateAll(); + DeviceManager.ActivateAll(); LinkSystemMonitorToAppServer(); - } + } void LinkSystemMonitorToAppServer() { @@ -309,28 +342,28 @@ namespace PepperDash.Essentials messenger.RegisterWithAppServer(appServer); - DeviceManager.AddDevice(messenger); + DeviceManager.AddDevice(messenger); } } - /// - /// Reads all devices from config and adds them to DeviceManager - /// - public void LoadDevices() - { - // Build the processor wrapper class - DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); + /// + /// Reads all devices from config and adds them to DeviceManager + /// + public void LoadDevices() + { + // Build the processor wrapper class + DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); // Add global System Monitor device DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); - foreach (var devConf in ConfigReader.ConfigObject.Devices) - { + foreach (var devConf in ConfigReader.ConfigObject.Devices) + { - try - { + try + { Debug.Console(0, Debug.ErrorLogLevel.Notice, "Creating device '{0}', type '{1}'", devConf.Key, devConf.Type); - // Skip this to prevent unnecessary warnings + // Skip this to prevent unnecessary warnings if (devConf.Key == "processor") { if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower()) @@ -341,94 +374,94 @@ namespace PepperDash.Essentials continue; } - // Try local factories first - var newDev = DeviceFactory.GetDevice(devConf); + // Try local factories first + var newDev = DeviceFactory.GetDevice(devConf); if (newDev == null) newDev = BridgeFactory.GetDevice(devConf); - // Then associated library factories + // Then associated library factories if (newDev == null) newDev = PepperDash.Essentials.Core.DeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); - if (newDev == null) - newDev = PepperDash.Essentials.BridgeFactory.GetDevice(devConf); + if (newDev == null) + newDev = PepperDash.Essentials.Devices.Common.DeviceFactory.GetDevice(devConf); + if (newDev == null) + newDev = PepperDash.Essentials.DM.DeviceFactory.GetDevice(devConf); + if (newDev == null) + newDev = PepperDash.Essentials.Devices.Displays.DisplayDeviceFactory.GetDevice(devConf); + if (newDev == null) + newDev = PepperDash.Essentials.BridgeFactory.GetDevice(devConf); - //if (newDev == null) // might want to consider the ability to override an essentials "type" - //{ - // // iterate plugin factories - // foreach (var f in FactoryObjects) - // { - // var cresFactory = f as IGetCrestronDevice; - // if (cresFactory != null) - // { - // newDev = cresFactory.GetDevice(devConf, this); - // } - // } - //} + //if (newDev == null) // might want to consider the ability to override an essentials "type" + //{ + // // iterate plugin factories + // foreach (var f in FactoryObjects) + // { + // var cresFactory = f as IGetCrestronDevice; + // if (cresFactory != null) + // { + // newDev = cresFactory.GetDevice(devConf, this); + // } + // } + //} - if (newDev != null) - DeviceManager.AddDevice(newDev); - else + if (newDev != null) + DeviceManager.AddDevice(newDev); + else Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Cannot load unknown device type '{0}', key '{1}'.", devConf.Type, devConf.Key); - } - catch (Exception e) - { + } + catch (Exception e) + { Debug.Console(0, Debug.ErrorLogLevel.Notice, "ERROR: Creating device {0}. Skipping device. \r{1}", devConf.Key, e); - } - } + } + } Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Devices Loaded."); - } + } - /// - /// Helper method to load tie lines. This should run after devices have loaded - /// - public void LoadTieLines() - { - // In the future, we can't necessarily just clear here because devices - // might be making their own internal sources/tie lines + /// + /// Helper method to load tie lines. This should run after devices have loaded + /// + public void LoadTieLines() + { + // In the future, we can't necessarily just clear here because devices + // might be making their own internal sources/tie lines - var tlc = TieLineCollection.Default; - //tlc.Clear(); - if (ConfigReader.ConfigObject.TieLines == null) - { - return; - } + var tlc = TieLineCollection.Default; + //tlc.Clear(); + if (ConfigReader.ConfigObject.TieLines == null) + { + return; + } - foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines) - { - var newTL = tieLineConfig.GetTieLine(); - if (newTL != null) - tlc.Add(newTL); - } + foreach (var tieLineConfig in ConfigReader.ConfigObject.TieLines) + { + var newTL = tieLineConfig.GetTieLine(); + if (newTL != null) + tlc.Add(newTL); + } Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Tie Lines Loaded."); - } + } - /// - /// Reads all rooms from config and adds them to DeviceManager - /// - public void LoadRooms() - { - if (ConfigReader.ConfigObject.Rooms == null) - { - Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms"); - return; - } + /// + /// Reads all rooms from config and adds them to DeviceManager + /// + public void LoadRooms() + { + if (ConfigReader.ConfigObject.Rooms == null) + { + Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms"); + return; + } - foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) - { + foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) + { var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase; - if (room != null) - { + if (room != null) + { if (room is EssentialsHuddleSpaceRoom) { DeviceManager.AddDevice(room); @@ -438,10 +471,10 @@ namespace PepperDash.Essentials Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); - // Cotija bridge - var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom); - AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present - DeviceManager.AddDevice(bridge); + // Cotija bridge + var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom); + AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present + DeviceManager.AddDevice(bridge); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Cotija Bridge Added..."); } @@ -452,60 +485,60 @@ namespace PepperDash.Essentials Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion"); DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController((EssentialsHuddleVtc1Room)room, 0xf1)); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); - // Cotija bridge - var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room); - AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present - DeviceManager.AddDevice(bridge); - } + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Cotija Bridge..."); + // Cotija bridge + var bridge = new CotijaEssentialsHuddleSpaceRoomBridge(room); + AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present + DeviceManager.AddDevice(bridge); + } else { Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion"); DeviceManager.AddDevice(room); } - } - else + } + else Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); - } + } Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded."); - } + } - /// - /// Helps add the post activation steps that link bridges to main controller - /// - /// - void AddBridgePostActivationHelper(CotijaBridgeBase bridge) - { - bridge.AddPostActivationAction(() => - { - var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController; - if (parent == null) - { - Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present"); - return; - } - Debug.Console(0, bridge, "Linking to parent controller"); - bridge.AddParent(parent); - parent.AddBridge(bridge); - }); - } + /// + /// Helps add the post activation steps that link bridges to main controller + /// + /// + void AddBridgePostActivationHelper(CotijaBridgeBase bridge) + { + bridge.AddPostActivationAction(() => + { + var parent = DeviceManager.AllDevices.FirstOrDefault(d => d.Key == "appServer") as CotijaSystemController; + if (parent == null) + { + Debug.Console(0, bridge, "ERROR: Cannot connect app server room bridge. System controller not present"); + return; + } + Debug.Console(0, bridge, "Linking to parent controller"); + bridge.AddParent(parent); + parent.AddBridge(bridge); + }); + } - /// - /// Fires up a logo server if not already running - /// - void LoadLogoServer() - { - try - { + /// + /// Fires up a logo server if not already running + /// + void LoadLogoServer() + { + try + { LogoServer = new HttpLogoServer(8080, Global.DirectorySeparator + "html" + Global.DirectorySeparator + "logo"); } - catch (Exception) - { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program"); - } - } - } + catch (Exception) + { + Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: Logo server cannot be started. Likely already running in another program"); + } + } + } } From 6efec400b8a1b53bb90e8befdab3635c346d12b9 Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Thu, 13 Jun 2019 20:05:38 -0700 Subject: [PATCH 10/27] add invoke to bridgeapieisc --- PepperDashEssentials/Bridges/BridgeFactory.cs | 240 +++++++++--------- 1 file changed, 119 insertions(+), 121 deletions(-) diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index 923ee59f..6adeeafc 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -13,129 +13,127 @@ using PepperDash.Essentials.Bridges; using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.EthernetCommunication; -namespace PepperDash.Essentials - +namespace PepperDash.Essentials { -public class BridgeFactory -{ - public static IKeyed GetDevice(DeviceConfig dc) - { - // ? why is this static JTA 2018-06-13? - - var key = dc.Key; - var name = dc.Name; - var type = dc.Type; - var properties = dc.Properties; - var propAnon = new { }; - - var typeName = dc.Type.ToLower(); - var groupName = dc.Group.ToLower(); + public class BridgeFactory + { + public static IKeyed GetDevice(DeviceConfig dc) + { + // ? why is this static JTA 2018-06-13? - //Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString()); + var key = dc.Key; + var name = dc.Name; + var type = dc.Type; + var properties = dc.Properties; + var propAnon = new { }; - if (typeName == "eiscapi") - { - return new EiscApi(dc); - } + var typeName = dc.Type.ToLower(); + var groupName = dc.Group.ToLower(); - return null; - } + //Debug.Console(2, "Name {0}, Key {1}, Type {2}, Properties {3}", name, key, type, properties.ToString()); + + if (typeName == "eiscapi") + { + return new EiscApi(dc); + } + + return null; + } + } + + + public class CommBridge : Device + { + public CommBridgeProperties Properties { get; private set; } + + public List CommDevices { get; private set; } + + public CommBridge(string key, string name, JToken properties) + : base(key, name) + { + Properties = JsonConvert.DeserializeObject(properties.ToString()); + } + + public override bool CustomActivate() + { + // Create EiscApis + if (Properties.Eiscs != null) + { + foreach (var eisc in Properties.Eiscs) + { + var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname); + } + } + + foreach (var deviceKey in Properties.CommDevices) + { + var device = DeviceManager.GetDeviceForKey(deviceKey); + + if (device != null) + { + Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key); + CommDevices.Add(device as IBasicCommunication); + } + else + { + Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey); + } + } + + // Iterate through all the CommDevices and link up their Actions and Feedbacks + + Debug.Console(0, "Bridge {0} Activated", this.Name); + + return true; + } + } + + + public class EiscBridgeProperties + { + public string ParentDeviceKey { get; set; } + public eApiType ApiType { get; set; } + public List Eiscs { get; set; } + public string ApiOverrideFilePath { get; set; } + + public class EiscProperties + { + public string IpId { get; set; } + public string Hostname { get; set; } + } + } + + public class CommBridgeProperties : EiscBridgeProperties + { + public List CommDevices { get; set; } + } + + public enum eApiType { Eisc = 0 } + + public class BridgeApiEisc + { + public uint Ipid { get; private set; } + public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } + + public BridgeApiEisc(string ipid, string hostname) + { + Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber); + Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem); + Eisc.Register(); + Eisc.SigChange += Eisc_SigChange; + Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid); + } + void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) + { + if (Debug.Level >= 1) + Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); + var uo = args.Sig.UserObject; + if (uo is Action) + CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.BoolValue), args); + else if (uo is Action) + CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.UShortValue), args); + else if (uo is Action) + CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.StringValue), args); + } + } } - - -public class CommBridge : Device -{ - public CommBridgeProperties Properties { get; private set; } - - public List CommDevices { get; private set; } - - public CommBridge(string key, string name, JToken properties) - : base(key, name) - { - Properties = JsonConvert.DeserializeObject(properties.ToString()); - } - - public override bool CustomActivate() - { - // Create EiscApis - if (Properties.Eiscs != null) - { - foreach (var eisc in Properties.Eiscs) - { - var ApiEisc = new BridgeApiEisc(eisc.IpId, eisc.Hostname); - } - } - - foreach (var deviceKey in Properties.CommDevices) - { - var device = DeviceManager.GetDeviceForKey(deviceKey); - - if (device != null) - { - Debug.Console(0, "deviceKey {0} Found in Device Manager", device.Key); - CommDevices.Add(device as IBasicCommunication); - } - else - { - Debug.Console(0, "deviceKey {0} Not Found in Device Manager", deviceKey); - } - } - - // Iterate through all the CommDevices and link up their Actions and Feedbacks - - Debug.Console(0, "Bridge {0} Activated", this.Name); - - return true; - } -} - - -public class EiscBridgeProperties -{ - public string ParentDeviceKey { get; set; } - public eApiType ApiType { get; set; } - public List Eiscs { get; set; } - public string ApiOverrideFilePath { get; set; } - - public class EiscProperties - { - public string IpId { get; set; } - public string Hostname { get; set; } - } -} - -public class CommBridgeProperties : EiscBridgeProperties -{ - public List CommDevices { get; set; } -} - -public enum eApiType { Eisc = 0 } - -public class BridgeApiEisc -{ - public uint Ipid { get; private set; } - public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } - - public BridgeApiEisc(string ipid, string hostname) - { - Ipid = (UInt32)int.Parse(ipid, System.Globalization.NumberStyles.HexNumber); - Eisc = new ThreeSeriesTcpIpEthernetIntersystemCommunications(Ipid, hostname, Global.ControlSystem); - Eisc.Register(); - Eisc.SigChange += Eisc_SigChange; - Debug.Console(0, "BridgeApiEisc Created at Ipid {0}", ipid); - } - void Eisc_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) - { - if (Debug.Level >= 1) - Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); - var uo = args.Sig.UserObject; - if (uo is Action) - CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.BoolValue), args); - else if (uo is Action) - CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.UShortValue), args); - else if (uo is Action) - CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.StringValue), args); - } -} -} - \ No newline at end of file From 22722fca21406efa58eabfac81550de96fb30e56 Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Thu, 13 Jun 2019 20:06:43 -0700 Subject: [PATCH 11/27] update core ref to add PDC-14 and 15 features for testing kpmg --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index 75c2bf81..464de091 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 75c2bf819a3b7e6c37a3d6b0c7b11cc273043b12 +Subproject commit 464de0916dbc28da46d4092161c9c9a45f13d256 From f2c2cd423da9f7d9ac71a32ca4360f213607ea4d Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Fri, 14 Jun 2019 15:23:05 -0700 Subject: [PATCH 12/27] Remove the crestron invoke from the eisc change event. Not good as it could spool a lot of threads --- PepperDashEssentials/Bridges/BridgeFactory.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/PepperDashEssentials/Bridges/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index 6adeeafc..38cd117e 100644 --- a/PepperDashEssentials/Bridges/BridgeFactory.cs +++ b/PepperDashEssentials/Bridges/BridgeFactory.cs @@ -129,11 +129,11 @@ namespace PepperDash.Essentials Debug.Console(1, "BridgeApiEisc change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); var uo = args.Sig.UserObject; if (uo is Action) - CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.BoolValue), args); + (uo as Action)(args.Sig.BoolValue); else if (uo is Action) - CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.UShortValue), args); + (uo as Action)(args.Sig.UShortValue); else if (uo is Action) - CrestronInvoke.BeginInvoke(o => (uo as Action)((o as SigEventArgs).Sig.StringValue), args); + (uo as Action)(args.Sig.StringValue); } } } From fe172098b9ab58cdf9154a31934ce4ddf27d1cd8 Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Fri, 14 Jun 2019 15:50:21 -0700 Subject: [PATCH 13/27] updated core --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index 464de091..f9feb174 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 464de0916dbc28da46d4092161c9c9a45f13d256 +Subproject commit f9feb174eb56f39c93cda4dfe217513f79d8a64d From aff4e5a61f83b8a64380ad2f334691a765bafed9 Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Fri, 14 Jun 2019 19:18:50 -0700 Subject: [PATCH 14/27] update core ref --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index f9feb174..9d62e174 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit f9feb174eb56f39c93cda4dfe217513f79d8a64d +Subproject commit 9d62e174e2b993ae974a6d09f7f54a8f16bc2924 From b7ed1d8238da695c1d52fd98b00f8c87aff4c8b4 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 18 Jun 2019 14:04:00 -0600 Subject: [PATCH 15/27] Updates Assembly version number to 1.4.7 --- PepperDashEssentials/Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 3be0f536..edca0cd0 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.6.*")] +[assembly: AssemblyVersion("1.4.7.*")] diff --git a/essentials-framework b/essentials-framework index 11f52e17..b1b64f74 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 11f52e170e452a2397b3dc0d685abe11345ae424 +Subproject commit b1b64f746cdcceb07a2322a8220c3b221352da68 From 327a9a5f6bc71f87347ba7bbc23b1cbf12437287 Mon Sep 17 00:00:00 2001 From: Joshua Gutenplan Date: Tue, 18 Jun 2019 16:56:51 -0700 Subject: [PATCH 16/27] Update compile to include pdc feature/MultipleServerUpdates --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index 9d62e174..4886a542 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 9d62e174e2b993ae974a6d09f7f54a8f16bc2924 +Subproject commit 4886a5427647b1cb2d5d939dc97515703cf96ceb From 935f2c4bf4c83f1e5996215e77f81f471a410e61 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 20 Jun 2019 15:25:13 -0600 Subject: [PATCH 17/27] Increments Assembly version and includes bugfix to set DmChassisController.EnableAudioBreakaway.BoolValue to true. --- .../Bridges/DmChassisControllerBridge.cs | 214 +++++++++--------- .../Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 3 files changed, 109 insertions(+), 109 deletions(-) diff --git a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs index d864787c..e0ff3c52 100644 --- a/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmChassisControllerBridge.cs @@ -1,38 +1,38 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; - -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.DM; - -namespace PepperDash.Essentials.Bridges -{ - public static class DmChassisControllerApiExtentions - { - public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) - { - var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmChassisControllerJoinMap; - - if (joinMap == null) - joinMap = new DmChassisControllerJoinMap(); - - joinMap.OffsetJoinNumbers(joinStart); - - Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); - - dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); - - // Link up outputs - for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs - 1; i++) - { - var ioSlot = i; - - // Control - trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video))); +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.DM; + +namespace PepperDash.Essentials.Bridges +{ + public static class DmChassisControllerApiExtentions + { + public static void LinkToApi(this DmChassisController dmChassis, BasicTriList trilist, uint joinStart, string joinMapKey) + { + var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DmChassisControllerJoinMap; + + if (joinMap == null) + joinMap = new DmChassisControllerJoinMap(); + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, dmChassis, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + + dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + + // Link up outputs + for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs - 1; i++) + { + var ioSlot = i; + + // Control + trilist.SetUShortSigAction(joinMap.OutputVideo + ioSlot, new Action(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video))); trilist.SetUShortSigAction(joinMap.OutputAudio + ioSlot, new Action(o => dmChassis.ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio))); if (dmChassis.TxDictionary.ContainsKey(ioSlot)) { @@ -55,76 +55,76 @@ namespace PepperDash.Essentials.Bridges var RxKey = dmChassis.RxDictionary[ioSlot]; var RxDevice = DeviceManager.GetDeviceForKey(RxKey) as DmRmcControllerBase; RxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); - } - // Feedback - dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); - dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); - - dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); - - dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); - dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); - dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); - dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); - // dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); - // dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); - } - } - - - public class DmChassisControllerJoinMap : JoinMapBase - { - public uint IsOnline { get; set; } - public uint OutputVideo { get; set; } - public uint OutputAudio { get; set; } - public uint VideoSyncStatus { get; set; } - public uint InputNames { get; set; } - public uint OutputNames { get; set; } - public uint OutputCurrentVideoInputNames { get; set; } - public uint OutputCurrentAudioInputNames { get; set; } - public uint InputCurrentResolution { get; set; } - public uint InputEndpointOnline { get; set; } - public uint OutputEndpointOnline { get; set; } - //public uint HdcpSupport { get; set; } - //public uint HdcpSupportCapability { get; set; } - - - public DmChassisControllerJoinMap() - { - IsOnline = 11; - OutputVideo = 100; //101-299 - OutputAudio = 300; //301-499 - VideoSyncStatus = 100; //101-299 - InputNames = 100; //101-299 - OutputNames = 300; //301-499 - OutputCurrentVideoInputNames = 2000; //2001-2199 - OutputCurrentAudioInputNames = 2200; //2201-2399 - InputCurrentResolution = 2400; // 2401-2599 - InputEndpointOnline = 500; - OutputEndpointOnline = 700; - //HdcpSupport = 1000; //1001-1199 - //HdcpSupportCapability = 1200; //1201-1399 - - } - - public override void OffsetJoinNumbers(uint joinStart) - { - var joinOffset = joinStart - 1; - - IsOnline = IsOnline + joinOffset; - OutputVideo = OutputVideo + joinOffset; - OutputAudio = OutputAudio + joinOffset; - VideoSyncStatus = VideoSyncStatus + joinOffset; - InputNames = InputNames + joinOffset; - OutputNames = OutputNames + joinOffset; - OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; - OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; - InputCurrentResolution = InputCurrentResolution + joinOffset; - InputEndpointOnline = InputEndpointOnline + joinOffset; - OutputEndpointOnline = OutputEndpointOnline + joinOffset; - //HdcpSupport = HdcpSupport + joinOffset; - //HdcpSupportCapability = HdcpSupportCapability + joinOffset; - } - } - } + } + // Feedback + dmChassis.VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo + ioSlot]); + dmChassis.AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio + ioSlot]); + + dmChassis.VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus + ioSlot]); + + dmChassis.OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames + ioSlot]); + dmChassis.InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames + ioSlot]); + dmChassis.OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames + ioSlot]); + dmChassis.OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames + ioSlot]); + // dmChassis.InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline + ioSlot]); + // dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + } + } + + + public class DmChassisControllerJoinMap : JoinMapBase + { + public uint IsOnline { get; set; } + public uint OutputVideo { get; set; } + public uint OutputAudio { get; set; } + public uint VideoSyncStatus { get; set; } + public uint InputNames { get; set; } + public uint OutputNames { get; set; } + public uint OutputCurrentVideoInputNames { get; set; } + public uint OutputCurrentAudioInputNames { get; set; } + public uint InputCurrentResolution { get; set; } + public uint InputEndpointOnline { get; set; } + public uint OutputEndpointOnline { get; set; } + //public uint HdcpSupport { get; set; } + //public uint HdcpSupportCapability { get; set; } + + + public DmChassisControllerJoinMap() + { + IsOnline = 11; + OutputVideo = 100; //101-299 + OutputAudio = 300; //301-499 + VideoSyncStatus = 100; //101-299 + InputNames = 100; //101-299 + OutputNames = 300; //301-499 + OutputCurrentVideoInputNames = 2000; //2001-2199 + OutputCurrentAudioInputNames = 2200; //2201-2399 + InputCurrentResolution = 2400; // 2401-2599 + InputEndpointOnline = 500; + OutputEndpointOnline = 700; + //HdcpSupport = 1000; //1001-1199 + //HdcpSupportCapability = 1200; //1201-1399 + + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + OutputVideo = OutputVideo + joinOffset; + OutputAudio = OutputAudio + joinOffset; + VideoSyncStatus = VideoSyncStatus + joinOffset; + InputNames = InputNames + joinOffset; + OutputNames = OutputNames + joinOffset; + OutputCurrentVideoInputNames = OutputCurrentVideoInputNames + joinOffset; + OutputCurrentAudioInputNames = OutputCurrentAudioInputNames + joinOffset; + InputCurrentResolution = InputCurrentResolution + joinOffset; + InputEndpointOnline = InputEndpointOnline + joinOffset; + OutputEndpointOnline = OutputEndpointOnline + joinOffset; + //HdcpSupport = HdcpSupport + joinOffset; + //HdcpSupportCapability = HdcpSupportCapability + joinOffset; + } + } + } } \ No newline at end of file diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index edca0cd0..7c6b2ed7 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.7.*")] +[assembly: AssemblyVersion("1.4.8.*")] diff --git a/essentials-framework b/essentials-framework index b1b64f74..3c0a5e80 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit b1b64f746cdcceb07a2322a8220c3b221352da68 +Subproject commit 3c0a5e80b29d66c154ad7b3c0774c2cf514dcaf2 From c15adea02ee7c62718454d8a59e9ccfbdb62745b Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 21 Jun 2019 11:17:55 -0600 Subject: [PATCH 18/27] Updates assembly version to include bugfix for ecs-1115 --- PepperDashEssentials/Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 7c6b2ed7..f5bdcfd9 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.8.*")] +[assembly: AssemblyVersion("1.4.9.*")] diff --git a/essentials-framework b/essentials-framework index 3c0a5e80..433f71da 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 3c0a5e80b29d66c154ad7b3c0774c2cf514dcaf2 +Subproject commit 433f71da3e8381834ba3c9207622fae16f639ba9 From af12a81c007d3ab336d45f9ac9d45282b20cfdd6 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Mon, 24 Jun 2019 15:16:20 -0600 Subject: [PATCH 19/27] Updates DisplayControllerBridge to support BasicIrDisplay types, adds Samsung IR driver file, updates SetupFileSystem in ControlSystem.cs to build plugin folder --- IR Drivers/samsung_un_series.ir | Bin 0 -> 5264 bytes .../Bridges/DisplayControllerBridge.cs | 56 +++++++++++------- PepperDashEssentials/ControlSystem.cs | 4 ++ PepperDashEssentials/Factory/DeviceFactory.cs | 14 ++--- .../Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 6 files changed, 48 insertions(+), 30 deletions(-) create mode 100644 IR Drivers/samsung_un_series.ir diff --git a/IR Drivers/samsung_un_series.ir b/IR Drivers/samsung_un_series.ir new file mode 100644 index 0000000000000000000000000000000000000000..cd6401d01a2ba910c38d5742fd93ea7418377a63 GIT binary patch literal 5264 zcma);druoj6vgj8yu0QVa55z1g&`rlLcsR$hJdlx*kF6juI-TggkiSH|c6UeSZ4&m#63H_vfeS z^OLuy>DTYxsMYB==ibkmrObLJll&z*d3*l;?DPI#TlI8A?dEUx??&4GquI9qG>nr! zO~Wu}O>@RFr)_&YVW%B?!nG&IjNujY-Kz1~nmM>`?rj*aH_Z=Q=C|8s`nfT&W2AS@ z{ylS~V%P^p;?QuahFdedx{(ZwzJ}3%WDJCc71{HNkA`75A5Ej#_C8uhx!7!{{&HJq zU!A@CaMrEg{cRXvf(14tzyTLLNJ1a7>OOSyq**vTXZ^dg%a)Qg-uL_ctEV9C0}SaR-2 zv8`m>6qc-av*P={+VvLItS6}E+|l-aUUl8Zl1>vDEc#gNr9vT*sWqcSwy5mo8l9-}%C}{%=q|s^mxG{hrPb)u$M(#j0eigRFI!v#Qdn zEnD>!D_FG}Yu3@a6)suPg87d$zJSS5y0ts-J^bL#$y6#ejIWD|OZC>z)Uc2y%Meam zAc>5{Gg_8}ly*u;n`L5Ob&+_Vvb~g6c9criy&mGHzqzEgoV7xGH8r)z^D2k#P z2$qSvu^k1Kw^5!!V`PuQP~L8{Oq>~|fC&nDhh@l69JkJ3tQSUO$SE};@3PDl31Wr3 z$1>PR(_;|oOUU~?qe4JW_|{oJ;2CVB_Ac{~WzZREppwFc9A_EaJ#NQ^V$v*wBJnpV z3OUgWgS~{Qhste|WyqOg(4b}>v5Xc#q{}?!nM+$l2|2|wIst7?dwX(?ng7(^U<6Q& zUP4Y^WB&hlo2(I`A41MtV?Lpy^FkrYLCD$O80@Cl@Ltcc49;;iZz1P-=86W=LOx{~ zI!l^F%L%!_G8e<6h%zbUGnUb}!lIC?EJJf(253?} zgK2DOuGu`fi!MHAk zgnZ62sDe;;C?R)vhWZtQgQ>TWyDUQoN!Gedz6a*N$qBi~GI|i2hYSi?U>QBT9tzh& z7I}uErno5uA$^unTkE9B8Q#$n%jg8I>g@AOe4>Km g8Qfia>oP|ygPUt_T_$811T>^W5HjMKYmk6{0Z7h+(EtDd literal 0 HcmV?d00001 diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index 1bf73c46..ba4da8d0 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -18,10 +18,9 @@ namespace PepperDash.Essentials.Bridges public static int InputNumber; public static IntFeedback InputNumberFeedback; public static List InputKeys = new List(); - public static void LinkToApi(this PepperDash.Essentials.Core.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) + public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) { - JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; _TriList = trilist; @@ -31,17 +30,31 @@ namespace PepperDash.Essentials.Bridges } JoinMap.OffsetJoinNumbers(joinStart); + Debug.Console(1, "Linking to Trilist '{0}'", _TriList.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString()); - _TriList.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString(); - - InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); - InputNumberFeedback.LinkInputSig(_TriList.UShortInput[JoinMap.InputSelect]); - var commMonitor = displayDevice as ICommunicationMonitor; - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); + _TriList.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString(); - // Poewer Off + var commMonitor = displayDevice as ICommunicationMonitor; + if (commMonitor != null) + { + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); + } + + // Two way feedbacks + var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase; + if (twoWayDisplay != null) + { + trilist.SetBool(JoinMap.IsTwoWayDisplay, true); + + twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); + + InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); + InputNumberFeedback.LinkInputSig(_TriList.UShortInput[JoinMap.InputSelect]); + } + + // Power Off trilist.SetSigTrueAction(JoinMap.PowerOff, () => { InputNumber = 102; @@ -73,7 +86,6 @@ namespace PepperDash.Essentials.Bridges count++; } - displayDevice.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); trilist.SetUShortSigAction(JoinMap.InputSelect, (a) => { if (a == 0) @@ -91,7 +103,8 @@ namespace PepperDash.Essentials.Bridges displayDevice.PowerToggle(); } - InputNumberFeedback.FireUpdate(); + if (displayDevice is PepperDash.Essentials.Core.TwoWayDisplayBase) + InputNumberFeedback.FireUpdate(); }); @@ -134,10 +147,9 @@ namespace PepperDash.Essentials.Bridges public uint PowerOff { get; set; } public uint InputSelect { get; set; } public uint PowerOn { get; set; } + public uint IsTwoWayDisplay { get; set; } public uint SelectScene { get; set; } - public uint LightingSceneOffset { get; set; } public uint ButtonVisibilityOffset { get; set; } - public uint IntegrationIdSet { get; set; } public DisplayControllerJoinMap() { @@ -145,15 +157,17 @@ namespace PepperDash.Essentials.Bridges IsOnline = 50; PowerOff = 1; PowerOn = 2; - InputSelect = 4; - IntegrationIdSet = 1; - LightingSceneOffset = 10; + IsTwoWayDisplay = 3; ButtonVisibilityOffset = 40; - Name = 1; - InputNamesOffset = 10; - InputSelectOffset = 4; + InputSelectOffset = 4; + // Analog - } + InputSelect = 4; + + // Serial + Name = 1; + InputNamesOffset = 10; + } public override void OffsetJoinNumbers(uint joinStart) { @@ -162,8 +176,8 @@ namespace PepperDash.Essentials.Bridges IsOnline = IsOnline + joinOffset; PowerOff = PowerOff + joinOffset; PowerOn = PowerOn + joinOffset; + IsTwoWayDisplay = IsTwoWayDisplay + joinOffset; SelectScene = SelectScene + joinOffset; - LightingSceneOffset = LightingSceneOffset + joinOffset; ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; Name = Name + joinOffset; InputNamesOffset = InputNamesOffset + joinOffset; diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 9069bef4..25d1c431 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -248,6 +248,10 @@ namespace PepperDash.Essentials if (!Directory.Exists(sgdDir)) Directory.Create(sgdDir); + var pluginDir = Global.FilePathPrefix + "plugins"; + if (!Directory.Exists(pluginDir)) + Directory.Create(pluginDir); + return configExists; } diff --git a/PepperDashEssentials/Factory/DeviceFactory.cs b/PepperDashEssentials/Factory/DeviceFactory.cs index 86612747..8e83fb9d 100644 --- a/PepperDashEssentials/Factory/DeviceFactory.cs +++ b/PepperDashEssentials/Factory/DeviceFactory.cs @@ -43,13 +43,13 @@ namespace PepperDash.Essentials return new Device(key, name); } - // MOVE into something else??? - else if (typeName == "basicirdisplay") - { - var ir = IRPortHelper.GetIrPort(properties); - if (ir != null) - return new BasicIrDisplay(key, name, ir.Port, ir.FileName); - } + //// MOVE into something else??? + //else if (typeName == "basicirdisplay") + //{ + // var ir = IRPortHelper.GetIrPort(properties); + // if (ir != null) + // return new BasicIrDisplay(key, name, ir.Port, ir.FileName); + //} else if (typeName == "commmock") { diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index f5bdcfd9..55f4a128 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.9.*")] +[assembly: AssemblyVersion("1.4.10.*")] diff --git a/essentials-framework b/essentials-framework index 433f71da..1675b98b 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 433f71da3e8381834ba3c9207622fae16f639ba9 +Subproject commit 1675b98b87a37a915081fff64e79cdc062147588 From 53e0599e2ad3c8f5ec8cd706339f88d7b48578c1 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 25 Jun 2019 13:43:21 -0600 Subject: [PATCH 20/27] Resolves ecs-1117. Tested at Einstein --- PepperDashEssentials/Bridges/BridgeBase.cs | 66 ++++++++++++++++++- .../Bridges/DisplayControllerBridge.cs | 4 +- devjson commands.json | 1 + 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index e6ecf1c0..ecd5c26c 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -56,7 +56,6 @@ namespace PepperDash.Essentials.Bridges public ThreeSeriesTcpIpEthernetIntersystemCommunications Eisc { get; private set; } - public EiscApi(DeviceConfig dc) : base(dc.Key) { @@ -93,9 +92,9 @@ namespace PepperDash.Essentials.Bridges // (device as CameraBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); // continue; //} - else if (device is PepperDash.Essentials.Core.TwoWayDisplayBase) + else if (device is PepperDash.Essentials.Core.DisplayBase) { - (device as TwoWayDisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + (device as DisplayBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } else if (device is DmChassisController) @@ -141,6 +140,66 @@ namespace PepperDash.Essentials.Bridges }); } + /// + /// Used for debugging to trigger an action based on a join number and type + /// + /// + /// + public void ExecuteJoinAction(uint join, string type, object state) + { + try + { + switch (type.ToLower()) + { + case "digital": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToBoolean(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + case "analog": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToUInt16(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); break; + } + case "serial": + { + var uo = Eisc.BooleanOutput[join].UserObject as Action; + if (uo != null) + { + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); + uo(Convert.ToString(state)); + } + else + Debug.Console(1, this, "User Action is null. Nothing to Execute"); + break; + } + default: + { + Debug.Console(1, "Unknown join type. Use digital/serial/analog"); + break; + } + } + } + catch (Exception e) + { + Debug.Console(1, this, "Error: {0}", e); + } + + } + /// /// Handles incoming sig changes /// @@ -151,6 +210,7 @@ namespace PepperDash.Essentials.Bridges if (Debug.Level >= 1) Debug.Console(1, this, "EiscApi change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); var uo = args.Sig.UserObject; + Debug.Console(1, this, "Executing Action: {0}", uo.ToString()); if (uo is Action) (uo as Action)(args.Sig.BoolValue); else if (uo is Action) diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index ba4da8d0..b787b2d7 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -42,6 +42,8 @@ namespace PepperDash.Essentials.Bridges commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); } + InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); + // Two way feedbacks var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase; if (twoWayDisplay != null) @@ -50,7 +52,7 @@ namespace PepperDash.Essentials.Bridges twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); - InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); + InputNumberFeedback.LinkInputSig(_TriList.UShortInput[JoinMap.InputSelect]); } diff --git a/devjson commands.json b/devjson commands.json index e6251e87..9d8ed35d 100644 --- a/devjson commands.json +++ b/devjson commands.json @@ -36,5 +36,6 @@ devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"SendText", "params": ["x devjson:2 {"deviceKey":"codec-comms-ssh", "methodName":"Connect", "params": []} +devjson:1 {"deviceKey":"commBridge", "methodName":"ExecuteJoinAction", "params":[ 301, "digital", true ]} devjson:2 {"deviceKey":"display01Comm-com", "methodName":"SendText", "params": [ "I'M GETTING TIRED OF THIS" ]} \ No newline at end of file From 410ffd2f194addd487dcf64853b1b40e082760b4 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 26 Jun 2019 12:56:53 -0600 Subject: [PATCH 21/27] Assembly Version incremented to 1.4.11. Fixes issues with DisplayControllerBridge join mapping. Adds volume controls and ensures all input selection joins start at joinstart + 10. --- .../Bridges/DisplayControllerBridge.cs | 61 +++++++++++++++---- .../Properties/AssemblyInfo.cs | 2 +- essentials-framework | 2 +- 3 files changed, 50 insertions(+), 15 deletions(-) diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index b787b2d7..594e888d 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -84,10 +84,12 @@ namespace PepperDash.Essentials.Bridges InputKeys.Add(input.Key.ToString()); var tempKey = InputKeys.ElementAt(count - 1); trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", JoinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); count++; } + Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", JoinMap.InputSelect); trilist.SetUShortSigAction(JoinMap.InputSelect, (a) => { if (a == 0) @@ -105,11 +107,25 @@ namespace PepperDash.Essentials.Bridges displayDevice.PowerToggle(); } - if (displayDevice is PepperDash.Essentials.Core.TwoWayDisplayBase) + if (twoWayDisplay != null) InputNumberFeedback.FireUpdate(); }); - + + var volumeDisplay = displayDevice as IBasicVolumeControls; + if (volumeDisplay != null) + { + trilist.SetBoolSigAction(JoinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b)); + trilist.SetBoolSigAction(JoinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b)); + trilist.SetSigTrueAction(JoinMap.VolumeMute, () => volumeDisplay.MuteToggle()); + + var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; + if(volumeDisplayWithFeedback != null) + { + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[JoinMap.VolumeLevelFB]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.VolumeMute]); + } + } } static void CurrentInputFeedback_OutputChange(object sender, FeedbackEventArgs e) @@ -142,16 +158,25 @@ namespace PepperDash.Essentials.Bridges } public class DisplayControllerJoinMap : JoinMapBase { - public uint Name { get; set; } - public uint InputNamesOffset { get; set; } - public uint InputSelectOffset { get; set; } - public uint IsOnline { get; set; } - public uint PowerOff { get; set; } - public uint InputSelect { get; set; } - public uint PowerOn { get; set; } + // Digital + public uint PowerOff { get; set; } + public uint PowerOn { get; set; } public uint IsTwoWayDisplay { get; set; } - public uint SelectScene { get; set; } + public uint VolumeUp { get; set; } + public uint VolumeDown { get; set; } + public uint VolumeMute { get; set; } + public uint InputSelectOffset { get; set; } public uint ButtonVisibilityOffset { get; set; } + public uint IsOnline { get; set; } + + // Analog + public uint InputSelect { get; set; } + public uint VolumeLevelFB { get; set; } + + // Serial + public uint Name { get; set; } + public uint InputNamesOffset { get; set; } + public DisplayControllerJoinMap() { @@ -160,11 +185,16 @@ namespace PepperDash.Essentials.Bridges PowerOff = 1; PowerOn = 2; IsTwoWayDisplay = 3; + VolumeUp = 5; + VolumeDown = 6; + VolumeMute = 7; + ButtonVisibilityOffset = 40; - InputSelectOffset = 4; + InputSelectOffset = 10; // Analog - InputSelect = 4; + InputSelect = 11; + VolumeLevelFB = 5; // Serial Name = 1; @@ -179,12 +209,17 @@ namespace PepperDash.Essentials.Bridges PowerOff = PowerOff + joinOffset; PowerOn = PowerOn + joinOffset; IsTwoWayDisplay = IsTwoWayDisplay + joinOffset; - SelectScene = SelectScene + joinOffset; ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset; Name = Name + joinOffset; InputNamesOffset = InputNamesOffset + joinOffset; InputSelectOffset = InputSelectOffset + joinOffset; + InputSelect = InputSelect + joinOffset; + + VolumeUp = VolumeUp + joinOffset; + VolumeDown = VolumeDown + joinOffset; + VolumeMute = VolumeMute + joinOffset; + VolumeLevelFB = VolumeLevelFB + joinOffset; } } } \ No newline at end of file diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 55f4a128..34c10cd4 100644 --- a/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] -[assembly: AssemblyVersion("1.4.10.*")] +[assembly: AssemblyVersion("1.4.11.*")] diff --git a/essentials-framework b/essentials-framework index 1675b98b..d8825f38 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 1675b98b87a37a915081fff64e79cdc062147588 +Subproject commit d8825f385faacd6316b0c1af57707079e13a7d36 From 7958c64e67faa4b320e90ae047e61183a89208df Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 27 Jun 2019 14:21:09 -0600 Subject: [PATCH 22/27] Adds support for AirMediaControllerBridge --- .../Bridges/AirMediaControllerBridge.cs | 122 ++++++++++++++++++ .../Bridges/DisplayControllerBridge.cs | 53 ++++---- .../PepperDashEssentials.csproj | 1 + 3 files changed, 148 insertions(+), 28 deletions(-) create mode 100644 PepperDashEssentials/Bridges/AirMediaControllerBridge.cs diff --git a/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs b/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs new file mode 100644 index 00000000..9a447c7d --- /dev/null +++ b/PepperDashEssentials/Bridges/AirMediaControllerBridge.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Devices.Common; +using PepperDash.Essentials.DM.AirMedia; + +namespace PepperDash.Essentials.Bridges +{ + public static class AirMediaControllerApiExtensions + { + public static void LinkToApi(this AirMediaController airMedia, BasicTriList trilist, uint joinStart, string joinMapKey) + { + var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as AirMediaControllerJoinMap; + + if (joinMap == null) + { + joinMap = new AirMediaControllerJoinMap(); + } + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Bridge Type {0}", airMedia.GetType().Name.ToString()); + + trilist.StringInput[joinMap.Name].StringValue = airMedia.GetType().Name.ToString(); + + var commMonitor = airMedia as ICommunicationMonitor; + if (commMonitor != null) + { + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); + } + + airMedia.IsInSessionFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsInSession]); + airMedia.HdmiVideoSyncDetectedFeedback.LinkInputSig(trilist.BooleanInput[joinMap.HdmiVideoSync]); + + trilist.SetSigTrueAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.EnableAutomaticRouting)); + trilist.SetSigFalseAction(joinMap.AutomaticInputRoutingEnabled, new Action( airMedia.AirMedia.DisplayControl.DisableAutomaticRouting)); + airMedia.AutomaticInputRoutingEnabledFeedback.LinkInputSig(trilist.BooleanInput[joinMap.AutomaticInputRoutingEnabled]); + + trilist.SetUShortSigAction(joinMap.VideoOut, new Action((u) => airMedia.SelectVideoOut(u))); + + airMedia.VideoOutFeedback.LinkInputSig(trilist.UShortInput[joinMap.VideoOut]); + airMedia.ErrorFeedback.LinkInputSig(trilist.UShortInput[joinMap.ErrorFB]); + airMedia.NumberOfUsersConnectedFeedback.LinkInputSig(trilist.UShortInput[joinMap.NumberOfUsersConnectedFB]); + + trilist.SetUShortSigAction(joinMap.LoginCode, new Action((u) => airMedia.AirMedia.AirMedia.LoginCode.UShortValue = u)); + airMedia.LoginCodeFeedback.LinkInputSig(trilist.UShortInput[joinMap.LoginCode]); + + airMedia.ConnectionAddressFeedback.LinkInputSig(trilist.StringInput[joinMap.ConnectionAddressFB]); + airMedia.HostnameFeedback.LinkInputSig(trilist.StringInput[joinMap.HostnameFB]); + airMedia.SerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.SerialNumberFeedback]); + } + + } + public class AirMediaControllerJoinMap : JoinMapBase + { + // Digital + public uint IsOnline { get; set; } + public uint IsInSession { get; set; } + public uint HdmiVideoSync { get; set; } + public uint AutomaticInputRoutingEnabled { get; set; } + + // Analog + public uint VideoOut { get; set; } + public uint ErrorFB { get; set; } + public uint NumberOfUsersConnectedFB { get; set; } + public uint LoginCode { get; set; } + + // Serial + public uint Name { get; set; } + public uint ConnectionAddressFB { get; set; } + public uint HostnameFB { get; set; } + public uint SerialNumberFeedback { get; set; } + + + public AirMediaControllerJoinMap() + { + // Digital + IsOnline = 1; + IsInSession = 2; + HdmiVideoSync = 3; + AutomaticInputRoutingEnabled = 4; + + // Analog + VideoOut = 1; + ErrorFB = 2; + NumberOfUsersConnectedFB = 3; + LoginCode = 4; + + // Serial + Name = 1; + ConnectionAddressFB = 2; + HostnameFB = 3; + SerialNumberFeedback = 4; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + IsOnline = IsOnline + joinOffset; + IsInSession = IsInSession + joinOffset; + HdmiVideoSync = HdmiVideoSync + joinOffset; + AutomaticInputRoutingEnabled = AutomaticInputRoutingEnabled + joinOffset; + + VideoOut = VideoOut + joinOffset; + ErrorFB = ErrorFB + joinOffset; + NumberOfUsersConnectedFB = NumberOfUsersConnectedFB + joinOffset; + LoginCode = LoginCode + joinOffset; + + Name = Name + joinOffset; + ConnectionAddressFB = ConnectionAddressFB + joinOffset; + HostnameFB = HostnameFB + joinOffset; + SerialNumberFeedback = SerialNumberFeedback + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index 594e888d..b9f31ad6 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -13,33 +13,30 @@ namespace PepperDash.Essentials.Bridges public static class DisplayControllerApiExtensions { - public static BasicTriList _TriList; - public static DisplayControllerJoinMap JoinMap; public static int InputNumber; public static IntFeedback InputNumberFeedback; public static List InputKeys = new List(); public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) { - JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; - _TriList = trilist; + var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; - if (JoinMap == null) + if (joinMap == null) { - JoinMap = new DisplayControllerJoinMap(); + joinMap = new DisplayControllerJoinMap(); } - JoinMap.OffsetJoinNumbers(joinStart); + joinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", _TriList.ID.ToString("X")); + Debug.Console(1, "Linking to Trilist '{0}'",trilist.ID.ToString("X")); Debug.Console(0, "Linking to Bridge Type {0}", displayDevice.GetType().Name.ToString()); - _TriList.StringInput[JoinMap.Name].StringValue = displayDevice.GetType().Name.ToString(); + trilist.StringInput[joinMap.Name].StringValue = displayDevice.GetType().Name.ToString(); var commMonitor = displayDevice as ICommunicationMonitor; if (commMonitor != null) { - commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.IsOnline]); + commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]); } InputNumberFeedback = new IntFeedback(() => { return InputNumber; }); @@ -48,16 +45,16 @@ namespace PepperDash.Essentials.Bridges var twoWayDisplay = displayDevice as PepperDash.Essentials.Core.TwoWayDisplayBase; if (twoWayDisplay != null) { - trilist.SetBool(JoinMap.IsTwoWayDisplay, true); + trilist.SetBool(joinMap.IsTwoWayDisplay, true); twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); - - InputNumberFeedback.LinkInputSig(_TriList.UShortInput[JoinMap.InputSelect]); + + InputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); } // Power Off - trilist.SetSigTrueAction(JoinMap.PowerOff, () => + trilist.SetSigTrueAction(joinMap.PowerOff, () => { InputNumber = 102; InputNumberFeedback.FireUpdate(); @@ -65,10 +62,10 @@ namespace PepperDash.Essentials.Bridges }); displayDevice.PowerIsOnFeedback.OutputChange += new EventHandler(PowerIsOnFeedback_OutputChange); - displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[JoinMap.PowerOff]); + displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); // PowerOn - trilist.SetSigTrueAction(JoinMap.PowerOn, () => + trilist.SetSigTrueAction(joinMap.PowerOn, () => { InputNumber = 0; InputNumberFeedback.FireUpdate(); @@ -76,21 +73,21 @@ namespace PepperDash.Essentials.Bridges }); - displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.PowerOn]); + displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); int count = 1; foreach (var input in displayDevice.InputPorts) { InputKeys.Add(input.Key.ToString()); var tempKey = InputKeys.ElementAt(count - 1); - trilist.SetSigTrueAction((ushort)(JoinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); - Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", JoinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); - trilist.StringInput[(ushort)(JoinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); + trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => { displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector); }); + Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); + trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); count++; } - Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", JoinMap.InputSelect); - trilist.SetUShortSigAction(JoinMap.InputSelect, (a) => + Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); + trilist.SetUShortSigAction(joinMap.InputSelect, (a) => { if (a == 0) { @@ -115,15 +112,15 @@ namespace PepperDash.Essentials.Bridges var volumeDisplay = displayDevice as IBasicVolumeControls; if (volumeDisplay != null) { - trilist.SetBoolSigAction(JoinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b)); - trilist.SetBoolSigAction(JoinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b)); - trilist.SetSigTrueAction(JoinMap.VolumeMute, () => volumeDisplay.MuteToggle()); + trilist.SetBoolSigAction(joinMap.VolumeUp, (b) => volumeDisplay.VolumeUp(b)); + trilist.SetBoolSigAction(joinMap.VolumeDown, (b) => volumeDisplay.VolumeDown(b)); + trilist.SetSigTrueAction(joinMap.VolumeMute, () => volumeDisplay.MuteToggle()); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; if(volumeDisplayWithFeedback != null) { - volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[JoinMap.VolumeLevelFB]); - volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[JoinMap.VolumeMute]); + volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevelFB]); + volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); } } } @@ -156,7 +153,7 @@ namespace PepperDash.Essentials.Bridges } - public class DisplayControllerJoinMap : JoinMapBase + public class DisplayControllerJoinMap : JoinMapBase { // Digital public uint PowerOff { get; set; } diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index b454f4b4..f594fbf3 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -119,6 +119,7 @@ + From 5c923e66ec72ef16ce7a1fa0af23600f9bb6d00e Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 27 Jun 2019 14:21:48 -0600 Subject: [PATCH 23/27] Adds necessary framework commit --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index d8825f38..82872ebb 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit d8825f385faacd6316b0c1af57707079e13a7d36 +Subproject commit 82872ebb8e1093d1426466d301bc0613eac4354b From ea2d573ab3d28d36a06db4a84598ca078c0d5278 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Fri, 28 Jun 2019 08:20:06 -0600 Subject: [PATCH 24/27] Started on DgeController --- PepperDashEssentials/UI/EssentialsTouchpanelController.cs | 5 +++++ essentials-framework | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 841015db..c088e34c 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -65,6 +65,11 @@ namespace PepperDash.Essentials Panel = new Tsw1052(id, Global.ControlSystem); else if (type == "tsw1060") Panel = new Tsw1060(id, Global.ControlSystem); + else if (type.Contains("dge")) + { + // TODO: Figure out how to get the trilist from a DgeController device + //Panel = + } else { Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); diff --git a/essentials-framework b/essentials-framework index 82872ebb..69dd391d 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 82872ebb8e1093d1426466d301bc0613eac4354b +Subproject commit 69dd391d195819de8033b8ad1a5d2ea62f4de3f1 From 699900518ab0f290ade1bef8dd0dba2009658ad0 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Sun, 30 Jun 2019 10:58:11 -0600 Subject: [PATCH 25/27] Moved CrestronTouchpanelPropertiesConfig down to Essentials.Core so that the DgeController can use it from Essentials.DM. Modified EssentialsTouchpanelController to be able to use a dge100 as a panel. Added UiDeviceFactory condition to build dge100/dmdge200c --- .../Factory/UiDeviceFactory.cs | 339 ++++++++++-------- .../PepperDashEssentials.csproj | 1 - .../UI/CrestronTouchpanelPropertiesConfig.cs | 48 --- .../UI/EssentialsTouchpanelController.cs | 19 +- essentials-framework | 2 +- 5 files changed, 193 insertions(+), 216 deletions(-) delete mode 100644 PepperDashEssentials/UI/CrestronTouchpanelPropertiesConfig.cs diff --git a/PepperDashEssentials/Factory/UiDeviceFactory.cs b/PepperDashEssentials/Factory/UiDeviceFactory.cs index 5499aa0c..e1b00caa 100644 --- a/PepperDashEssentials/Factory/UiDeviceFactory.cs +++ b/PepperDashEssentials/Factory/UiDeviceFactory.cs @@ -1,162 +1,185 @@ -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.UI; - -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; -using PepperDash.Core; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.PageManagers; - - -namespace PepperDash.Essentials -{ - public class UiDeviceFactory - { - public static IKeyed GetUiDevice(DeviceConfig config) - { - var comm = CommFactory.GetControlPropertiesConfig(config); - - var props = JsonConvert.DeserializeObject(config.Properties.ToString()); - - EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt); - - panelController.AddPostActivationAction(() => - { - var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); - // Then the sub drivers - - // spin up different room drivers depending on room type - var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); - if (room is EssentialsHuddleSpaceRoom) - { - - // Header Driver - Debug.Console(0, panelController, "Adding header driver"); - mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); - - // AV Driver - Debug.Console(0, panelController, "Adding huddle space AV driver"); - var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); - avDriver.DefaultRoomKey = props.DefaultRoomKey; +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.UI; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.PageManagers; +using PepperDash.Essentials.DM.Endpoints.DGEs; + + +namespace PepperDash.Essentials +{ + public class UiDeviceFactory + { + public static IKeyed GetUiDevice(DeviceConfig config) + { + var comm = CommFactory.GetControlPropertiesConfig(config); + + var typeName = config.Type.ToLower(); + + EssentialsTouchpanelController panelController = null; + + var props = JsonConvert.DeserializeObject(config.Properties.ToString()); + + if (typeName.Contains("dge")) + { + Dge100 dgeDevice = null; + if (typeName == "dge100") + dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem); + else if (typeName == "dmdge200c") + dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); + + var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props); + + DeviceManager.AddDevice(dgeController); + + panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine, + props.ProjectName, props.SgdFile); + } + else + { + panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt); + } + + panelController.AddPostActivationAction(() => + { + var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); + // Then the sub drivers + + // spin up different room drivers depending on room type + var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); + if (room is EssentialsHuddleSpaceRoom) + { + + // Header Driver + Debug.Console(0, panelController, "Adding header driver"); + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + Debug.Console(0, panelController, "Adding huddle space AV driver"); + var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); + avDriver.DefaultRoomKey = props.DefaultRoomKey; mainDriver.AvDriver = avDriver; avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; - - // Environment Driver - if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) - { - Debug.Console(0, panelController, "Adding environment driver"); - mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); - - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); - } - - mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); - - panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. - - if (panelController.Panel is TswFt5ButtonSystem) - { - var tsw = panelController.Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - if(mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - } - } - //else if (room is EssentialsPresentationRoom) - //{ - // Debug.Console(0, panelController, "Adding presentation room driver"); - // var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); - // avDriver.CurrentRoom = room as EssentialsPresentationRoom; - // avDriver.DefaultRoomKey = props.DefaultRoomKey; - // mainDriver.AvDriver = avDriver ; - // mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); - // panelController.LoadAndShowDriver(mainDriver); - - // if (panelController.Panel is TswFt5ButtonSystem) - // { - // var tsw = panelController.Panel as TswFt5ButtonSystem; - // // Wire up hard keys - // tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - // //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - // tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - // tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - // } - //} - else if (room is EssentialsHuddleVtc1Room) - { - Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); - - // Header Driver - mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); - - // AV Driver - var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); - - var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, - (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); - avDriver.SetVideoCodecDriver(codecDriver); - avDriver.DefaultRoomKey = props.DefaultRoomKey; + + // Environment Driver + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) + { + Debug.Console(0, panelController, "Adding environment driver"); + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); + } + + mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (panelController.Panel is TswFt5ButtonSystem) + { + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if(mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } + } + //else if (room is EssentialsPresentationRoom) + //{ + // Debug.Console(0, panelController, "Adding presentation room driver"); + // var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); + // avDriver.CurrentRoom = room as EssentialsPresentationRoom; + // avDriver.DefaultRoomKey = props.DefaultRoomKey; + // mainDriver.AvDriver = avDriver ; + // mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + // panelController.LoadAndShowDriver(mainDriver); + + // if (panelController.Panel is TswFt5ButtonSystem) + // { + // var tsw = panelController.Panel as TswFt5ButtonSystem; + // // Wire up hard keys + // tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); + // //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + // tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + // tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + // } + //} + else if (room is EssentialsHuddleVtc1Room) + { + Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); + + // Header Driver + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); + + var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, + (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); + avDriver.SetVideoCodecDriver(codecDriver); + avDriver.DefaultRoomKey = props.DefaultRoomKey; mainDriver.AvDriver = avDriver; - avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; - - // Environment Driver - if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) - { - Debug.Console(0, panelController, "Adding environment driver"); - mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); - - mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); - } - - mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); - - panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. - - if (panelController.Panel is TswFt5ButtonSystem) - { - var tsw = panelController.Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - if (mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - } - } - else - { - Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); - } - }); - - return panelController; - } - - } + avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; + + // Environment Driver + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) + { + Debug.Console(0, panelController, "Adding environment driver"); + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); + } + + mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (panelController.Panel is TswFt5ButtonSystem) + { + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if (mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } + } + else + { + Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); + } + }); + + return panelController; + } + + } } \ No newline at end of file diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index f594fbf3..fc8ffe49 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -222,7 +222,6 @@ - diff --git a/PepperDashEssentials/UI/CrestronTouchpanelPropertiesConfig.cs b/PepperDashEssentials/UI/CrestronTouchpanelPropertiesConfig.cs deleted file mode 100644 index f018b9e8..00000000 --- a/PepperDashEssentials/UI/CrestronTouchpanelPropertiesConfig.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace PepperDash.Essentials -{ - public class CrestronTouchpanelPropertiesConfig - { - public string IpId { get; set; } - public string DefaultRoomKey { get; set; } - public string RoomListKey { get; set; } - public string SgdFile { get; set; } - public string ProjectName { get; set; } - public bool ShowVolumeGauge { get; set; } - public bool UsesSplashPage { get; set; } - public bool ShowDate { get; set; } - public bool ShowTime { get; set; } - public UiSetupPropertiesConfig Setup { get; set; } - public string HeaderStyle { get; set; } - public bool IncludeInFusionRoomHealth { get; set; } - - - /// - /// The count of sources that will trigger the "additional" arrows to show on the SRL. - /// Defaults to 5 - /// - public int SourcesOverflowCount { get; set; } - - public CrestronTouchpanelPropertiesConfig() - { - SourcesOverflowCount = 5; - HeaderStyle = CrestronTouchpanelPropertiesConfig.Habanero; - } - - /// - /// "habanero" - /// - public const string Habanero = "habanero"; - /// - /// "verbose" - /// - public const string Verbose = "verbose"; - } - - /// - /// - /// - public class UiSetupPropertiesConfig - { - public bool IsVisible { get; set; } - } -} \ No newline at end of file diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index c088e34c..e15f5b6c 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -27,9 +27,17 @@ namespace PepperDash.Essentials { Panel = tsw; tsw.LoadSmartObjects(sgdPath); - tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange); + tsw.SigChange += Panel_SigChange; } + public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath) + : base(key, name) + { + Panel = panel; + panel.LoadSmartObjects(sgdPath); + panel.SigChange += Panel_SigChange; + } + /// /// Config constructor /// @@ -65,11 +73,6 @@ namespace PepperDash.Essentials Panel = new Tsw1052(id, Global.ControlSystem); else if (type == "tsw1060") Panel = new Tsw1060(id, Global.ControlSystem); - else if (type.Contains("dge")) - { - // TODO: Figure out how to get the trilist from a DgeController device - //Panel = - } else { Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); @@ -107,7 +110,7 @@ namespace PepperDash.Essentials } Panel.LoadSmartObjects(sgdName); - Panel.SigChange += Tsw_SigChange; + Panel.SigChange += Panel_SigChange; } @@ -163,7 +166,7 @@ namespace PepperDash.Essentials } } - void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) + void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) { if (Debug.Level == 2) Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); diff --git a/essentials-framework b/essentials-framework index 69dd391d..8e275620 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 69dd391d195819de8033b8ad1a5d2ea62f4de3f1 +Subproject commit 8e275620b94348d21d0d85625ef2049996800cb2 From 634b07dc124257d600ed584afbb978b4c32ad74f Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Wed, 3 Jul 2019 15:28:34 -0600 Subject: [PATCH 26/27] Adds AppleTvBridge. Untested so far. --- PepperDashEssentials/Bridges/AppleTvBridge.cs | 75 +++++++++++++++++++ PepperDashEssentials/Bridges/BridgeBase.cs | 5 ++ .../PepperDashEssentials.csproj | 1 + 3 files changed, 81 insertions(+) create mode 100644 PepperDashEssentials/Bridges/AppleTvBridge.cs diff --git a/PepperDashEssentials/Bridges/AppleTvBridge.cs b/PepperDashEssentials/Bridges/AppleTvBridge.cs new file mode 100644 index 00000000..0c39b78b --- /dev/null +++ b/PepperDashEssentials/Bridges/AppleTvBridge.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Devices.Common; + +namespace PepperDash.Essentials.Bridges +{ + public static class AppleTvApiExtensions + { + public static void LinkToApi(this AppleTV appleTv, BasicTriList trilist, uint joinStart, string joinMapKey) + { + var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as AppleTvJoinMap; + + if (joinMap == null) + { + joinMap = new AppleTvJoinMap(); + } + + joinMap.OffsetJoinNumbers(joinStart); + + Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); + Debug.Console(0, "Linking to Bridge Type {0}", appleTv.GetType().Name.ToString()); + + trilist.SetBoolSigAction(joinMap.UpArrow, (b) => appleTv.Up(b)); + trilist.SetBoolSigAction(joinMap.DnArrow, (b) => appleTv.Down(b)); + trilist.SetBoolSigAction(joinMap.LeftArrow, (b) => appleTv.Left(b)); + trilist.SetBoolSigAction(joinMap.RightArrow, (b) => appleTv.Right(b)); + trilist.SetBoolSigAction(joinMap.Select, (b) => appleTv.Select(b)); + trilist.SetBoolSigAction(joinMap.Menu, (b) => appleTv.Menu(b)); + trilist.SetBoolSigAction(joinMap.PlayPause, (b) => appleTv.Play(b)); + } + } + + public class AppleTvJoinMap : JoinMapBase + { + // Digital + public uint UpArrow { get; set; } + public uint DnArrow { get; set; } + public uint LeftArrow { get; set; } + public uint RightArrow { get; set; } + public uint Menu { get; set; } + public uint Select { get; set; } + public uint PlayPause { get; set; } + + public AppleTvJoinMap() + { + UpArrow = 1; + DnArrow = 2; + LeftArrow = 3; + RightArrow = 4; + Menu = 5; + Select = 6; + PlayPause = 7; + } + + public override void OffsetJoinNumbers(uint joinStart) + { + var joinOffset = joinStart - 1; + + UpArrow = UpArrow + joinOffset; + DnArrow = DnArrow + joinOffset; + LeftArrow = LeftArrow + joinOffset; + RightArrow = RightArrow + joinOffset; + Menu = Menu + joinOffset; + Select = Select + joinOffset; + PlayPause = PlayPause + joinOffset; + } + } +} \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/BridgeBase.cs b/PepperDashEssentials/Bridges/BridgeBase.cs index ecd5c26c..6614d22d 100644 --- a/PepperDashEssentials/Bridges/BridgeBase.cs +++ b/PepperDashEssentials/Bridges/BridgeBase.cs @@ -123,6 +123,11 @@ namespace PepperDash.Essentials.Bridges (device as IDigitalInput).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); continue; } + else if (device is AppleTV) + { + (device as AppleTV).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; + } //else if (device is LightingBase) //{ // (device as LightingBase).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index b454f4b4..7818a651 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -116,6 +116,7 @@ + From 90c122d966d3a7c9228b6dafd63fedff5304aa94 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Tue, 9 Jul 2019 16:30:50 -0600 Subject: [PATCH 27/27] Committing framework submodule before removing submodule reference --- essentials-framework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/essentials-framework b/essentials-framework index d8825f38..2e132f83 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit d8825f385faacd6316b0c1af57707079e13a7d36 +Subproject commit 2e132f830f947c62ca148d7ce8569b6a3d604cab