diff --git a/IR Drivers/samsung_un_series.ir b/IR Drivers/samsung_un_series.ir new file mode 100644 index 00000000..cd6401d0 Binary files /dev/null and b/IR Drivers/samsung_un_series.ir differ 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 d6f20ab4..b05bc93b 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()); @@ -347,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); @@ -356,6 +371,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 +454,7 @@ namespace PepperDash.Essentials.AppServer.Messengers { calls = GetCurrentCallList(), cameraMode = GetCameraMode(), + cameraSelfView = EISC.GetBool(BCameraSelfView), currentCallString = EISC.GetString(SCurrentCallNumber), currentDialString = EISC.GetString(SCurrentDialString), directoryContactSelected = new @@ -448,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/Messengers/VideoCodecBaseMessenger.cs b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs index b8ca2dac..5c1c59b7 100644 --- a/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs +++ b/PepperDashEssentials/AppServer/Messengers/VideoCodecBaseMessenger.cs @@ -8,6 +8,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Devices.Common.Cameras; using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.AppServer.Messengers @@ -365,7 +366,7 @@ namespace PepperDash.Essentials.AppServer.Messengers hasDirectory = Codec is IHasDirectory, hasDirectorySearch = true, hasRecents = Codec is IHasCallHistory, - hasCameras = Codec is IHasCameraControl + hasCameras = Codec is IHasCodecCameras }); } } diff --git a/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs b/PepperDashEssentials/AppServer/RoomBridges/CotijaDdvc01RoomBridge.cs index fdd73989..1720778c 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))); - Parent.AddAction(@"/room/room1/activityVideo", new Action(() => - EISC.PulseBool(BoolJoin.ActivityVideoCallPress))); + EISC.PulseBool(BoolJoin.ActivityShare))); Parent.AddAction(@"/room/room1/activityPhone", new Action(() => - EISC.PulseBool(BoolJoin.ActivityPhoneCallPress))); + 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))); 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.ActivityShare, () => UpdateActivity(1)); + EISC.SetSigTrueAction(BoolJoin.ActivityPhoneCall, () => UpdateActivity(2)); + EISC.SetSigTrueAction(BoolJoin.ActivityVideoCall, () => UpdateActivity(3)); + } + + + /// + /// 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(); @@ -689,39 +745,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 +794,18 @@ namespace PepperDash.Essentials.Room.Cotija } } + /// + /// Returns the activity mode int + /// + /// + int GetActivityMode() + { + 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 3; + 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/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/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 e6ecf1c0..aa3ed15f 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) @@ -123,6 +122,16 @@ 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 IBridge) + { + (device as IBridge).LinkToApi(Eisc, d.JoinStart, d.JoinMapKey); + continue; } //else if (device is LightingBase) //{ @@ -141,6 +150,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 +220,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/BridgeFactory.cs b/PepperDashEssentials/Bridges/BridgeFactory.cs index 8b9ba75c..38cd117e 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) + (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); + } + } } - - -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) - (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); - } -} -} - \ No newline at end of file diff --git a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs index 1bf73c46..b9f31ad6 100644 --- a/PepperDashEssentials/Bridges/DisplayControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DisplayControllerBridge.cs @@ -13,36 +13,48 @@ 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.TwoWayDisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) + public static void LinkToApi(this PepperDash.Essentials.Core.DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey) { + var joinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; - JoinMap = JoinMapHelper.GetJoinMapForDevice(joinMapKey) as DisplayControllerJoinMap; - _TriList = trilist; - - if (JoinMap == null) + if (joinMap == null) { - JoinMap = new DisplayControllerJoinMap(); + joinMap = new DisplayControllerJoinMap(); } - JoinMap.OffsetJoinNumbers(joinStart); - Debug.Console(1, "Linking to Trilist '{0}'", _TriList.ID.ToString("X")); + 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 - trilist.SetSigTrueAction(JoinMap.PowerOff, () => + var commMonitor = displayDevice as ICommunicationMonitor; + if (commMonitor != null) + { + 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) + { + trilist.SetBool(joinMap.IsTwoWayDisplay, true); + + twoWayDisplay.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); + + + InputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect]); + } + + // Power Off + trilist.SetSigTrueAction(joinMap.PowerOff, () => { InputNumber = 102; InputNumberFeedback.FireUpdate(); @@ -50,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(); @@ -61,20 +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); }); - 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++; } - displayDevice.CurrentInputFeedback.OutputChange += new EventHandler(CurrentInputFeedback_OutputChange); - 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) { @@ -91,10 +104,25 @@ namespace PepperDash.Essentials.Bridges displayDevice.PowerToggle(); } - InputNumberFeedback.FireUpdate(); + 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) @@ -125,19 +153,27 @@ namespace PepperDash.Essentials.Bridges } - public class DisplayControllerJoinMap : JoinMapBase + 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; } - public uint SelectScene { get; set; } - public uint LightingSceneOffset { get; set; } + // Digital + public uint PowerOff { get; set; } + public uint PowerOn { get; set; } + public uint IsTwoWayDisplay { 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 IntegrationIdSet { 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() { @@ -145,15 +181,22 @@ namespace PepperDash.Essentials.Bridges IsOnline = 50; PowerOff = 1; PowerOn = 2; - InputSelect = 4; - IntegrationIdSet = 1; - LightingSceneOffset = 10; + IsTwoWayDisplay = 3; + VolumeUp = 5; + VolumeDown = 6; + VolumeMute = 7; + ButtonVisibilityOffset = 40; - Name = 1; - InputNamesOffset = 10; - InputSelectOffset = 4; + InputSelectOffset = 10; + // Analog - } + InputSelect = 11; + VolumeLevelFB = 5; + + // Serial + Name = 1; + InputNamesOffset = 10; + } public override void OffsetJoinNumbers(uint joinStart) { @@ -162,13 +205,18 @@ namespace PepperDash.Essentials.Bridges IsOnline = IsOnline + joinOffset; PowerOff = PowerOff + joinOffset; PowerOn = PowerOn + joinOffset; - SelectScene = SelectScene + joinOffset; - LightingSceneOffset = LightingSceneOffset + joinOffset; + IsTwoWayDisplay = IsTwoWayDisplay + 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/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/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/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 8124beb7..1325ea3e 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,120 +134,157 @@ 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); + var pluginDir = Global.FilePathPrefix + "plugins"; + if (!Directory.Exists(pluginDir)) + Directory.Create(pluginDir); + return configExists; } @@ -292,7 +329,7 @@ namespace PepperDash.Essentials DeviceManager.ActivateAll(); LinkSystemMonitorToAppServer(); - } + } void LinkSystemMonitorToAppServer() { @@ -309,28 +346,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,13 +378,13 @@ 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) @@ -356,8 +393,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" //{ @@ -376,59 +411,59 @@ namespace PepperDash.Essentials 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 +473,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 +487,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"); + } + } + } } 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/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 b454f4b4..57594192 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -116,9 +116,11 @@ + + @@ -127,6 +129,7 @@ + @@ -221,7 +224,6 @@ - diff --git a/PepperDashEssentials/Properties/AssemblyInfo.cs b/PepperDashEssentials/Properties/AssemblyInfo.cs index 83beada4..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.0.*")] +[assembly: AssemblyVersion("1.4.11.*")] 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 841015db..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 /// @@ -102,7 +110,7 @@ namespace PepperDash.Essentials } Panel.LoadSmartObjects(sgdName); - Panel.SigChange += Tsw_SigChange; + Panel.SigChange += Panel_SigChange; } @@ -158,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/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 704a42d3..f966c4cb 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -712,10 +712,10 @@ namespace PepperDash.Essentials.UIDrivers.VC void SetupLayoutControls() { TriList.SetSigFalseAction(UIBoolJoin.VCStagingSelfViewLayoutPress, this.ShowSelfViewLayout); - var svc = Codec as IHasCodecSelfview; + var svc = Codec as IHasCodecSelfView; if (svc != null) { - TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfviewModeToggle); + TriList.SetSigFalseAction(UIBoolJoin.VCSelfViewTogglePress, svc.SelfViewModeToggle); svc.SelfviewIsOnFeedback.LinkInputSig(TriList.BooleanInput[UIBoolJoin.VCSelfViewTogglePress]); } var lc = Codec as IHasCodecLayouts; 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 diff --git a/devjson commands.json b/devjson commands.json index 4f0aa69e..9d8ed35d 100644 --- a/devjson commands.json +++ b/devjson commands.json @@ -34,4 +34,8 @@ 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: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 diff --git a/essentials-framework b/essentials-framework index 75c2bf81..2e132f83 160000 --- a/essentials-framework +++ b/essentials-framework @@ -1 +1 @@ -Subproject commit 75c2bf819a3b7e6c37a3d6b0c7b11cc273043b12 +Subproject commit 2e132f830f947c62ca148d7ce8569b6a3d604cab