diff --git a/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs b/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs index 3897afa5..23ab797e 100644 --- a/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs +++ b/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs @@ -272,6 +272,20 @@ namespace PepperDash.Essentials public const uint VCCameraPreset3 = 1283; + /// + /// 1291 + /// + public const uint VCCameraPreset1Visible = 1291; + /// + /// 1292 + /// + public const uint VCCameraPreset2Visible = 1292; + /// + /// 1293 + /// + public const uint VCCameraPreset3Visible = 1293; + + // Letter joins start at 2921; //****************************************************** diff --git a/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs b/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs index ab4ff3aa..9b92fc41 100644 --- a/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs +++ b/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs @@ -1,80 +1,81 @@ -using System; -using Crestron.SimplSharp; -using Crestron.SimplSharpPro.DeviceSupport; -using Crestron.SimplSharpPro.UI; -using PepperDash.Essentials.Core; -using PepperDash.Essentials.Core.SmartObjects; - -namespace PepperDash.Essentials -{ - /// - /// - /// - public class EssentialsPanelMainInterfaceDriver : PanelDriverBase - { - CTimer InactivityTimer; - - /// - /// Assign the appropriate A/V driver. - /// Want to keep the AvDriver alive, because it may hold states - /// - public IAVDriver AvDriver { get; set; } - - public EssentialsHeaderDriver HeaderDriver { get; set; } - - public EssentialsEnvironmentDriver EnvironmentDriver { get; set; } - - public PanelDriverBase CurrentChildDriver { get; private set; } - +using System; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.UI; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.SmartObjects; + +namespace PepperDash.Essentials +{ + /// + /// + /// + public class EssentialsPanelMainInterfaceDriver : PanelDriverBase, IHasScreenSaverController + { + CTimer InactivityTimer; + + /// + /// Assign the appropriate A/V driver. + /// Want to keep the AvDriver alive, because it may hold states + /// + public IAVDriver AvDriver { get; set;} + + public EssentialsHeaderDriver HeaderDriver { get; set; } + + public EssentialsEnvironmentDriver EnvironmentDriver { get; set; } + + public PanelDriverBase CurrentChildDriver { get; private set; } + public ScreenSaverController ScreenSaverController { get; set; } - private readonly long _timeoutMs; - - CrestronTouchpanelPropertiesConfig Config; - - /// - /// The main interlock for popups - /// - //public JoinedSigInterlock PopupInterlock { get; private set; } - - public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist, - CrestronTouchpanelPropertiesConfig config) - : base(trilist) - { - Config = config; - - _timeoutMs = Config.ScreenSaverTimeoutMin * 60 * 1000; - - var tsx52or60 = trilist as Tswx52ButtonVoiceControl; - + private readonly long _timeoutMs; + + CrestronTouchpanelPropertiesConfig Config; + + /// + /// The main interlock for popups + /// + //public JoinedSigInterlock PopupInterlock { get; private set; } + + public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist, + CrestronTouchpanelPropertiesConfig config) + : base(trilist) + { + Config = config; + + _timeoutMs = Config.ScreenSaverTimeoutMin * 60 * 1000; + + var tsx52or60 = trilist as Tswx52ButtonVoiceControl; + if (tsx52or60 != null) { tsx52or60.ExtenderTouchDetectionReservedSigs.Use(); tsx52or60.ExtenderTouchDetectionReservedSigs.DeviceExtenderSigChange += ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange; tsx52or60.ExtenderTouchDetectionReservedSigs.Time.UShortValue = 1; ManageInactivityTimer(); - - } - else - { - var tswx70 = trilist as TswX70Base; - if (tswx70 != null) + + } + else + { + var tswx70 = trilist as TswX70Base; + if (tswx70 != null) { tswx70.ExtenderTouchDetectionReservedSigs.Use(); tswx70.ExtenderTouchDetectionReservedSigs.DeviceExtenderSigChange += ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange; tswx70.ExtenderTouchDetectionReservedSigs.Time.UShortValue = 1; - ManageInactivityTimer(); - } - } - } - - void ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange(Crestron.SimplSharpPro.DeviceExtender currentDeviceExtender, Crestron.SimplSharpPro.SigEventArgs args) - { - + ManageInactivityTimer(); + } + } + } + + void ExtenderTouchDetectionReservedSigs_DeviceExtenderSigChange(Crestron.SimplSharpPro.DeviceExtender currentDeviceExtender, Crestron.SimplSharpPro.SigEventArgs args) + { + if (args.Sig.BoolValue) { ManageInactivityTimer(); - } + } } private void ManageInactivityTimer() @@ -87,46 +88,52 @@ namespace PepperDash.Essentials { InactivityTimer = new CTimer((o) => InactivityTimerExpired(), _timeoutMs); } - } - - void InactivityTimerExpired() - { - InactivityTimer.Stop(); - InactivityTimer.Dispose(); - InactivityTimer = null; - - ScreenSaverController.Show(); - } - - public override void Show() - { - CurrentChildDriver = null; - ShowSubDriver(AvDriver as PanelDriverBase); - base.Show(); - } - - public override void Hide() - { - TriList.BooleanInput[AvDriver.StartPageVisibleJoin].BoolValue = false; - base.Hide(); - } - - void ShowSubDriver(PanelDriverBase driver) - { - CurrentChildDriver = driver; - if (driver == null) - return; - this.Hide(); - driver.Show(); - } - - /// - /// - /// - public override void BackButtonPressed() - { - if(CurrentChildDriver != null) - CurrentChildDriver.BackButtonPressed(); - } - } + } + + void InactivityTimerExpired() + { + InactivityTimer.Stop(); + InactivityTimer.Dispose(); + InactivityTimer = null; + + ScreenSaverController.Show(); + } + + public override void Show() + { + CurrentChildDriver = null; + ShowSubDriver(AvDriver as PanelDriverBase); + + base.Show(); + } + + public override void Hide() + { + TriList.BooleanInput[AvDriver.StartPageVisibleJoin].BoolValue = false; + base.Hide(); + } + + void ShowSubDriver(PanelDriverBase driver) + { + CurrentChildDriver = driver; + if (driver == null) + return; + this.Hide(); + driver.Show(); + } + + /// + /// + /// + public override void BackButtonPressed() + { + if(CurrentChildDriver != null) + CurrentChildDriver.BackButtonPressed(); + } + } + + public interface IHasScreenSaverController + { + ScreenSaverController ScreenSaverController { get; } + } } \ No newline at end of file diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs index 42b2cf5c..a2a80af3 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -114,7 +114,7 @@ namespace PepperDash.Essentials /// /// The parent driver for this /// - PanelDriverBase Parent; + public PanelDriverBase Parent { get; private set; } /// /// All children attached to this driver. For hiding and showing as a group. diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 5a99f6e4..d8af370b 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -72,7 +72,7 @@ namespace PepperDash.Essentials /// /// The parent driver for this /// - PanelDriverBase Parent; + public PanelDriverBase Parent { get; private set; } /// /// All children attached to this driver. For hiding and showing as a group. @@ -1430,6 +1430,7 @@ namespace PepperDash.Essentials /// public interface IAVDriver { + PanelDriverBase Parent { get; } JoinedSigInterlock PopupInterlock { get; } void ShowNotificationRibbon(string message, int timeout); void HideNotificationRibbon(); diff --git a/PepperDashEssentials/UIDrivers/ScreenSaverController.cs b/PepperDashEssentials/UIDrivers/ScreenSaverController.cs index 9f973113..e6d60d5b 100644 --- a/PepperDashEssentials/UIDrivers/ScreenSaverController.cs +++ b/PepperDashEssentials/UIDrivers/ScreenSaverController.cs @@ -21,6 +21,8 @@ namespace PepperDash.Essentials private readonly EssentialsPanelMainInterfaceDriver _parent; + private JoinedSigInterlock PositionInterlock; + CTimer PositionTimer; uint PositionTimeoutMs; @@ -38,7 +40,9 @@ namespace PepperDash.Essentials PositionJoins = new List() { UIBoolJoin.MCScreenSaverPosition1Visible, UIBoolJoin.MCScreenSaverPosition2Visible, UIBoolJoin.MCScreenSaverPosition3Visible, UIBoolJoin.MCScreenSaverPosition4Visible }; - var cmdName = String.Format("shwscrsvr-{0}", config.IpId); + PositionInterlock = new JoinedSigInterlock(parent.TriList); + + var cmdName = String.Format("shwscrsvr-{0}", parent.TriList.ID); CrestronConsole.AddNewConsoleCommand((o) => Show(), cmdName, "Shows Panel Screensaver", ConsoleAccessLevelEnum.AccessOperator); @@ -47,10 +51,13 @@ namespace PepperDash.Essentials public override void Show() { - _parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MCScreenSaverVisible); + if (_parent.AvDriver != null) + { + _parent.AvDriver.PopupInterlock.ShowInterlocked(UIBoolJoin.MCScreenSaverVisible); + } CurrentPositionIndex = 0; - SetCurrentPosition(); + ShowCurrentPosition(); StartPositionTimer(); base.Show(); @@ -58,6 +65,8 @@ namespace PepperDash.Essentials public override void Hide() { + Debug.Console(1, "Hiding ScreenSaverController"); + if (PositionTimer != null) { PositionTimer.Stop(); @@ -67,7 +76,10 @@ namespace PepperDash.Essentials ClearAllPositions(); - _parent.AvDriver.PopupInterlock.HideAndClear(); + if (_parent.AvDriver != null) + { + _parent.AvDriver.PopupInterlock.HideAndClear(); + } base.Hide(); } @@ -89,7 +101,7 @@ namespace PepperDash.Essentials { IncrementPositionIndex(); - SetCurrentPosition(); + ShowCurrentPosition(); StartPositionTimer(); } @@ -109,20 +121,16 @@ namespace PepperDash.Essentials } // - void SetCurrentPosition() + void ShowCurrentPosition() { - ClearAllPositions(); - // Set based on current index - TriList.SetBool(PositionJoins[CurrentPositionIndex], true); + PositionInterlock.ShowInterlocked(PositionJoins[CurrentPositionIndex]); } void ClearAllPositions() { - foreach (var join in PositionJoins) - { - TriList.SetBool(join, false); - } + Debug.Console(1, "Hiding all screensaver positions"); + PositionInterlock.HideAndClear(); } } diff --git a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 0c219426..5642d757 100644 --- a/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -398,6 +398,8 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void ShowIncomingModal(CodecActiveCallItem call) { + Debug.Console(1, "Showing Incoming Call Modal"); + (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall(); IncomingCallModal = new ModalDialog(TriList); string msg; @@ -413,13 +415,19 @@ namespace PepperDash.Essentials.UIDrivers.VC msg = string.Format("Incoming video call from: {0}", call.Name); } - if (Parent.PopupInterlock.IsShown) + + // Hide screensaver + var screenSaverParent = Parent.Parent as IHasScreenSaverController; + + if (screenSaverParent != null) { - if (Parent.PopupInterlock.CurrentJoin == UIBoolJoin.MCScreenSaverVisible) - { - Parent.PopupInterlock.HideAndClear(); - } + screenSaverParent.ScreenSaverController.Hide(); } + else + { + Debug.Console(1, "Parent.Parent is null or does not implement IHasScreenSaverController"); + } + IncomingCallModal.PresentModalDialog(2, "Incoming Call", icon, msg, "Ignore", "Accept", false, false, b => @@ -709,17 +717,45 @@ namespace PepperDash.Essentials.UIDrivers.VC uint holdTime = 5000; presetsCodec.CodecRoomPresetsListHasChanged += new EventHandler(presetsCodec_CodecRoomPresetsListHasChanged); - TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction( - holdTime, () => presetsCodec.CodecRoomPresetStore(1, presetsCodec.NearEndPresets[0].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(1)); - TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction( - holdTime, () => presetsCodec.CodecRoomPresetStore(2, presetsCodec.NearEndPresets[1].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(2)); - TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction( - holdTime, () => presetsCodec.CodecRoomPresetStore(3, presetsCodec.NearEndPresets[2].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(3)); + var preset = 1; + if (presetsCodec.NearEndPresets[preset - 1] != null && presetsCodec.NearEndPresets[preset - 1].Defined) + { + TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, true); + TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction( + holdTime, ShowPresetStoreFeedback,() => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description), + () => presetsCodec.CodecRoomPresetSelect(preset)); + TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[preset - 1].Description; + } + else + { + TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, false); + } - TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[0].Description; - TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description; - TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description; + if (presetsCodec.NearEndPresets[1] != null && presetsCodec.NearEndPresets[1].Defined) + { + TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, true); + TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction( + holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description), + () => presetsCodec.CodecRoomPresetSelect(preset)); + TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description; + } + else + { + TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, false); + } + if (presetsCodec.NearEndPresets[2] != null && presetsCodec.NearEndPresets[2].Defined) + { + TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, true); + TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction( + holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description), + () => presetsCodec.CodecRoomPresetSelect(preset)); + TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description; + } + else + { + TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, false); + } } }