diff --git a/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces and things.cs b/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces and things.cs index b25be535..26675eb3 100644 --- a/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces and things.cs +++ b/Essentials Core/PepperDashEssentialsBase/Monitoring/Interfaces and things.cs @@ -26,11 +26,14 @@ namespace PepperDash.Essentials.Core } /// - /// + /// StatusUnknown = 0, IsOk = 1, InWarning = 2, InError = 3 /// public enum MonitorStatus { - IsOk, InWarning, InError, StatusUnknown + StatusUnknown = 0, + IsOk = 1, + InWarning = 2, + InError = 3 } public class MonitorStatusChangeEventArgs : EventArgs diff --git a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 6fe716eb..ab03ff44 100644 --- a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -217,7 +217,6 @@ - diff --git a/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectDynamicList.cs b/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectDynamicList.cs index 5c4f767a..bf73ba1b 100644 --- a/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectDynamicList.cs +++ b/Essentials Core/PepperDashEssentialsBase/SmartObjects/SmartObjectDynamicList.cs @@ -33,6 +33,12 @@ namespace PepperDash.Essentials.Core.SmartObjects /// public int MaxCount { get; private set; } + /// + /// Wrapper for smart object + /// + /// + /// True if the standard user object action handler will be used + /// The starting join of the string sigs for the button labels public SmartObjectDynamicList(SmartObject so, bool useUserObjectHandler, uint nameSigOffset) : base(so, useUserObjectHandler) { try diff --git a/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/DeviceStatusListController.cs b/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/DeviceStatusListController.cs deleted file mode 100644 index 6fec4209..00000000 --- a/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/DeviceStatusListController.cs +++ /dev/null @@ -1,111 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.Linq; -//using System.Text; -//using Crestron.SimplSharp; -//using Crestron.SimplSharpPro; -//using Crestron.SimplSharpPro.UI; - -//namespace PepperDash.Essentials.Core -//{ -// /// -// /// Controls the device/tech status list - links in to the first 10, 1, 5 statuses in an item's StatusProperties -// /// -// public class DeviceStatusListController : SubpageReferenceListController -// { -// Dictionary Items = new Dictionary(); - -// public DeviceStatusListController(SmartObject list) -// { -// TheList = new SubpageReferenceList(list, 10, 1, 5); -// } - -// /// -// /// Attaches an item's StatusProperties to the list item. -// /// THIS METHOD MAY BE BETTER ABSORBED INTO SOME OTHER CONTROLLER CLASS AS A -// /// PSIG -> LIST ITEM ADAPTER -// /// -// /// List position -// /// -// public void AddItem(uint listIndex, Device device) -// { -// if (device == null) throw new ArgumentNullException("device"); -// Items[listIndex] = device; - -// // Feedback - read the status properties and if there is room for them on the list sigs -// // link them up. -// //foreach (PValue statusPsig in device.StatusProperties) -// //{ -// // uint num = statusPsig.Number; -// // Sig listSig = null; -// // switch (statusPsig.Type) // Switch on the PSig type and whether the PSig number is within the increment range -// // { -// // case eSigType.Bool: -// // if (num > TheList.BoolIncrement) return; -// // listSig = TheList.BoolInputSig(listIndex, num); // Pull the appropriate list sig. -// // break; -// // case eSigType.String: -// // if (num > TheList.StringIncrement) return; -// // listSig = TheList.StringInputSig(listIndex, num); -// // break; -// // case eSigType.UShort: -// // if (num > TheList.UShortIncrement) return; -// // listSig = TheList.UShortInputSig(listIndex, num); -// // break; -// // default: -// // return; -// // } -// // if (listSig != null) // If we got a sig, plug it into the PSig for updates. -// // statusPsig.AddLinkedSig(listSig, true); -// //} - -// // Press/other handlers - read the Commands and if there is room, add them as Sig handlers. -// //foreach (var id in device.Commands.Keys) -// //{ -// // var pValueNumber = id.Number; -// // Sig listSig = null; -// // // Switch on type of a command and if it's in range, get it's list Sig. -// // switch (id.Type) -// // { -// // case eSigType.Bool: -// // if (pValueNumber > TheList.BoolIncrement) return; -// // listSig = TheList.BoolFeedbackSig(listIndex, pValueNumber); -// // break; -// // case eSigType.String: -// // if (pValueNumber > TheList.StringIncrement) return; -// // listSig = TheList.StringOutputSig(listIndex, pValueNumber); -// // break; -// // case eSigType.UShort: -// // if (pValueNumber > TheList.UShortIncrement) return; -// // listSig = TheList.UShortOutputSig(listIndex, pValueNumber); -// // break; -// // default: -// // return; -// // } -// // if (listSig != null) // If we got a sig, add the command to its ChangeAction -// // SigToAction.GetSigToActionUserObjectForSig(listSig).SigChangeAction += device.Commands[id]; -// // // This will need to be undone when detached MAKE A HELPER!!!! -// //} - -// // "Custom things" below -// // Set the name on sig 1 - just an assignment. Don't -// var nameSig = TheList.StringInputSig(listIndex, 1); -// if (nameSig != null) -// nameSig.StringValue = device.Key; - -// // Map IsOnline bool to a 0 / 1 state analog icon -// // Add an action to the online PValue that maps to a ushort sig on the list POTENTIAL LEAK HERE IF -// // this isn't cleaned up on disconnect -// var onlineSig = TheList.UShortInputSig(listIndex, 1); -// //var onlinePValue = device.StatusProperties[Device.JoinIsOnline]; -// //if (onlineSig != null && onlinePValue != null) -// // onlinePValue.AddChangeAction(pv => onlineSig.UShortValue = (ushort)(onlinePValue.BoolValue ? 1 : 0)); -// // //OR onlinePValue.AddLinkedSig(onlineSig, true); - -// // Set the list length based on largest key -// TheList.Count = (ushort)Items.Keys.DefaultIfEmpty().Max(); // The count will be the largest key or 0 -// } -// } - - -//} \ No newline at end of file diff --git a/Essentials Core/PepperDashEssentialsBase/Touchpanels/TriListExtensions.cs b/Essentials Core/PepperDashEssentialsBase/Touchpanels/TriListExtensions.cs index 15287a64..bc9ff012 100644 --- a/Essentials Core/PepperDashEssentialsBase/Touchpanels/TriListExtensions.cs +++ b/Essentials Core/PepperDashEssentialsBase/Touchpanels/TriListExtensions.cs @@ -81,21 +81,25 @@ namespace PepperDash.Essentials.Core public static BoolOutputSig SetSigHeldAction(this BasicTriList tl, uint sigNum, uint heldMs, Action heldAction, Action releaseAction) { CTimer heldTimer = null; + bool wasHeld = false; return tl.SetBoolSigAction(sigNum, press => { if (press) { - + wasHeld = false; // Could insert a pressed action here heldTimer = new CTimer(o => { // if still held and there's an action if (tl.BooleanOutput[sigNum].BoolValue && heldAction != null) + { + wasHeld = true; // Hold action here heldAction(); + } }, heldMs); } - else if (heldTimer != null) // released + else if(!wasHeld) // released { heldTimer.Stop(); if (releaseAction != null) diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs index a79c570c..ded56878 100644 --- a/Essentials/PepperDashEssentials/ControlSystem.cs +++ b/Essentials/PepperDashEssentials/ControlSystem.cs @@ -15,6 +15,7 @@ namespace PepperDash.Essentials public class ControlSystem : CrestronControlSystem { PepperDashPortalSyncClient PortalSync; + HttpLogoServer LogoServer; public ControlSystem() : base() @@ -63,6 +64,8 @@ namespace PepperDash.Essentials LoadTieLines(); LoadRooms(); + LogoServer = new HttpLogoServer(8080, @"\html\logo"); + DeviceManager.ActivateAll(); Debug.Console(0, "Essentials load complete\r" + "-------------------------------------------------------------"); @@ -206,6 +209,5 @@ namespace PepperDash.Essentials Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); } } - } } diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj index e19cb51f..cb43f6ca 100644 --- a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj +++ b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj @@ -164,11 +164,14 @@ + + + - + diff --git a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs index 6ccb0f33..934bd1f5 100644 --- a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs +++ b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs @@ -141,7 +141,7 @@ namespace PepperDash.Essentials.Room.Config if (Type == "url") return Url; if (Type == "system") - return string.Format("http://{0}:5646/logo", + return string.Format("http://{0}:8080/logo.png", CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)); return null; } diff --git a/Essentials/PepperDashEssentials/UI/HttpLogoServer.cs b/Essentials/PepperDashEssentials/UI/HttpLogoServer.cs new file mode 100644 index 00000000..f04f6872 --- /dev/null +++ b/Essentials/PepperDashEssentials/UI/HttpLogoServer.cs @@ -0,0 +1,108 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharp.CrestronIO; +using Crestron.SimplSharp.Net.Http; + +using PepperDash.Core; + +namespace PepperDash.Essentials +{ + public class HttpLogoServer + { + /// + /// + /// + HttpServer Server; + + /// + /// + /// + string FileDirectory; + + /// + /// + /// + public static Dictionary ExtensionContentTypes; + + /// + /// + /// + /// + /// + public HttpLogoServer(int port, string directory) + { + ExtensionContentTypes = new Dictionary + { + //{ ".css", "text/css" }, + //{ ".htm", "text/html" }, + //{ ".html", "text/html" }, + { ".jpg", "image/jpeg" }, + { ".jpeg", "image/jpeg" }, + //{ ".js", "application/javascript" }, + //{ ".json", "application/json" }, + //{ ".map", "application/x-navimap" }, + { ".pdf", "application.pdf" }, + { ".png", "image/png" }, + //{ ".txt", "text/plain" }, + }; + + Server = new HttpServer(); + Server.Port = port; + FileDirectory = directory; + Server.OnHttpRequest += new OnHttpRequestHandler(Server_OnHttpRequest); + Server.Open(); + + CrestronEnvironment.ProgramStatusEventHandler += new ProgramStatusEventHandler(CrestronEnvironment_ProgramStatusEventHandler); + } + + /// + /// + /// + void Server_OnHttpRequest(object sender, OnHttpRequestArgs args) + { + var path = args.Request.Path; + if (File.Exists(FileDirectory + @"\" + path)) + { + string filePath = path.Replace('/', '\\'); + string localPath = string.Format(@"{0}{1}", FileDirectory, filePath); + if (File.Exists(localPath)) + { + args.Response.Header.ContentType = GetContentType(new FileInfo(localPath).Extension); + args.Response.ContentStream = new FileStream(localPath, FileMode.Open, FileAccess.Read); + } + else + { + args.Response.ContentString = string.Format("Not found: '{0}'", filePath); + args.Response.Code = 404; + } + } + } + + /// + /// + /// + void CrestronEnvironment_ProgramStatusEventHandler(eProgramStatusEventType programEventType) + { + if (programEventType == eProgramStatusEventType.Stopping) + Server.Close(); + } + + /// + /// + /// + /// + /// + public static string GetContentType(string extension) + { + string type; + if (ExtensionContentTypes.ContainsKey(extension)) + type = ExtensionContentTypes[extension]; + else + type = "text/plain"; + return type; + } + } +} \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs b/Essentials/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs index 26cc59ea..7d2f41a2 100644 --- a/Essentials/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs +++ b/Essentials/PepperDashEssentials/UI/JoinConstants/UIBoolJoin.cs @@ -206,6 +206,43 @@ namespace PepperDash.Essentials // Letter joins start at 2921; + + + /// + /// 3101 + /// + public const uint TechExitButton = 3101; + /// + /// 3106 + /// + public const uint TechCommonItemsVisbible = 3106; + /// + /// 3107 + /// + public const uint TechSystemStatusVisible = 3107; + /// + /// 3108 + /// + public const uint TechDisplayControlsVisible = 3108; + /// + /// 3109 + /// + public const uint TechPanelSetupVisible = 3109; + /// + /// 3110 + /// + public const uint TechAdvancedVolumeVisible = 3110; + /// + /// 3111 + /// + public const uint TechAboutVisible = 3111; + /// + /// 3112 + /// + public const uint TechSchedulerVisible = 3112; + + + //****************************************************** /// /// 3811 @@ -300,14 +337,8 @@ namespace PepperDash.Essentials /// 3891 /// public const uint VolumeDefaultPress = 3891; - /// - /// 3901 - /// - public const uint TechPagesExitButton = 3901; - /// - /// 3902 - /// - public const uint TechPanelSetupVisible = 3902; + + /// /// 3999 /// diff --git a/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs b/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs index ceea3a89..8a58c340 100644 --- a/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs +++ b/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs @@ -29,6 +29,14 @@ /// 15022 The main activity footer /// public const uint ActivityFooterSRL = 15022; + /// + /// 3901 The Tech page menu list + /// + public const uint TechMenuList = 3901; + /// + /// 3902 Tech page statuses + /// + public const uint TechStatusList = 3902; } } \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/UI/JoinConstants/UIStringlJoin.cs b/Essentials/PepperDashEssentials/UI/JoinConstants/UIStringlJoin.cs index c49fae06..b38188c9 100644 --- a/Essentials/PepperDashEssentials/UI/JoinConstants/UIStringlJoin.cs +++ b/Essentials/PepperDashEssentials/UI/JoinConstants/UIStringlJoin.cs @@ -28,6 +28,14 @@ namespace PepperDash.Essentials /// //public const uint KeypadText = 2901; + /// + /// 3101 - This is the start of the range 3101 - 3120 + /// + public const uint TechMenuButtonTextStart = 3101; + + //----- through 3120 + + /// /// 3812 /// diff --git a/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHuddlePanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHuddlePanelAvFunctionsDriver.cs index fbf22900..ecd4fb04 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -220,7 +220,7 @@ namespace PepperDash.Essentials // Setup button TriList.SetSigHeldAction(UIBoolJoin.GearHeaderButtonPress, 2000, () => PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.TechPanelSetupVisible));// ShowInterlockedModal(UIBoolJoin.TechPanelSetupVisible)); - TriList.SetSigFalseAction(UIBoolJoin.TechPagesExitButton, () => + TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => PopupInterlock.HideAndClear()); // HideCurrentInterlockedModal()); #warning This gets overridden by config after NYU demo if(TriList is CrestronApp) diff --git a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs new file mode 100644 index 00000000..23615504 --- /dev/null +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs @@ -0,0 +1,147 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; +using PepperDash.Essentials; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.SmartObjects; +using PepperDash.Essentials.Core.Touchpanels.Keyboards; + +namespace PepperDash.Essentials.UIDrivers +{ + public class EssentialsHuddleTechPageDriver : PanelDriverBase + { + /// + /// + /// + SmartObjectDynamicList MenuList; + /// + /// + /// + SubpageReferenceList StatusList; + /// + /// References lines in the list against device instances + /// + Dictionary StatusListDeviceIndexes; + /// + /// + /// + IAVDriver Parent; + /// + /// + /// + JoinedSigInterlock PagesInterlock; + + /// + /// 1 + /// + public const uint JoinText = 1; + + + + /// + /// + /// + /// + /// + public EssentialsHuddleTechPageDriver(BasicTriListWithSmartObject trilist, IAVDriver parent) + : base(trilist) + { + Parent = parent; + PagesInterlock = new JoinedSigInterlock(trilist); + PagesInterlock.SetButDontShow(UIBoolJoin.TechSystemStatusVisible); + + trilist.SetSigFalseAction(UIBoolJoin.TechExitButton, Hide); + + MenuList = new SmartObjectDynamicList(trilist.SmartObjects[UISmartObjectJoin.TechMenuList], + true, 3100); + + MenuList.SetFeedback(1, true); // initial fb + + MenuList.SetItemMainText(1, "System Status"); + MenuList.SetItemButtonAction(1, b => { + if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechSystemStatusVisible); + MenuList.SetFeedback(1, true); + }); + + MenuList.SetItemMainText(2, "Display Controls"); + MenuList.SetItemButtonAction(2, b => { + if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechDisplayControlsVisible); + MenuList.SetFeedback(2, true); + }); + + MenuList.SetItemMainText(3, "Panel Setup"); + MenuList.SetItemButtonAction(3, b => { + if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechPanelSetupVisible); + MenuList.SetFeedback(3, true); + }); + MenuList.Count = 3; + + BuildStatusList(); + } + + /// + /// + /// + public override void Show() + { + TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, true); + PagesInterlock.Show(); + base.Show(); + } + + /// + /// + /// + public override void Hide() + { + TriList.SetBool(UIBoolJoin.TechCommonItemsVisbible, false); + PagesInterlock.Hide(); + base.Hide(); + } + + /// + /// + /// + void BuildStatusList() + { + StatusList = new SubpageReferenceList(TriList, UISmartObjectJoin.TechStatusList, 3, 3, 3); + StatusListDeviceIndexes = new Dictionary(); + uint i = 0; + foreach (var d in DeviceManager.AllDevices) + { + // make sure it is both ICommunicationMonitor and a Device + var sd = d as ICommunicationMonitor; + if (sd == null) + continue; + var dd = sd as Device; + if(dd == null) + continue; + i++; + StatusList.StringInputSig(i, 1).StringValue = dd.Name; + StatusList.UShortInputSig(i, 1).UShortValue = (ushort)sd.CommunicationMonitor.Status; + StatusListDeviceIndexes.Add(sd, i); + sd.CommunicationMonitor.StatusChange += CommunicationMonitor_StatusChange ; + } + StatusList.Count = (ushort)i; + } + + /// + /// + /// + void CommunicationMonitor_StatusChange(object sender, MonitorStatusChangeEventArgs e) + { + var c = sender as ICommunicationMonitor; + if (StatusListDeviceIndexes.ContainsKey(c)) + { + var i = StatusListDeviceIndexes[c]; + StatusList.UShortInputSig(i, 1).UShortValue = (ushort)e.Status; + } + } + } +} \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/HuddleVTCPanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs similarity index 95% rename from Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/HuddleVTCPanelAvFunctionsDriver.cs rename to Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 8de877cb..534e8b8c 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/HuddleVTCPanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -121,16 +121,47 @@ namespace PepperDash.Essentials /// JoinedSigInterlock StagingBarInterlock; + /// + /// Interlocks the various call-related subpages + /// JoinedSigInterlock CallPagesInterlock; + /// + /// The Video codec driver + /// PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver VCDriver; + /// + /// The driver for the tech page. Lazy getter for memory usage + /// + PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver TechDriver + { + get + { + if (_TechDriver == null) + _TechDriver = new PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver(TriList, this); + return _TechDriver; + } + } + PepperDash.Essentials.UIDrivers.EssentialsHuddleTechPageDriver _TechDriver; + + /// + /// Controls timeout of notification ribbon timer + /// CTimer RibbonTimer; + /// + /// The keyboard + /// public PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; private set; } + /// + /// The mode showing. Presentation or call. + /// UiDisplayMode CurrentMode = UiDisplayMode.Start; + + /// /// Constructor /// @@ -277,14 +308,14 @@ namespace PepperDash.Essentials // Setup button - shows volumes with default button OR hold for tech page TriList.SetSigHeldAction(UIBoolJoin.GearHeaderButtonPress, 2000, - () => PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.TechPanelSetupVisible), + ShowTech, () => PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible)); - TriList.SetSigFalseAction(UIBoolJoin.TechPagesExitButton, () => + TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => PopupInterlock.HideAndClear()); - // Default Volume button + // Volume related things TriList.SetSigFalseAction(UIBoolJoin.VolumeDefaultPress, () => CurrentRoom.SetDefaultLevels()); - + TriList.SetString(UIStringJoin.AdvancedVolumeSlider1Text, "Room"); if (TriList is CrestronApp) TriList.BooleanInput[UIBoolJoin.GearButtonVisible].BoolValue = false; @@ -379,6 +410,15 @@ namespace PepperDash.Essentials } } + /// + /// Reveals the tech page and puts away anything that's in the way. + /// + void ShowTech() + { + PopupInterlock.HideAndClear(); + TechDriver.Show(); + } + /// /// When the room is off, set the footer SRL /// @@ -710,13 +750,13 @@ namespace PepperDash.Essentials if (!srcConfig.IncludeInSourceList) // Skip sources marked this way continue; - var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device; - if (actualSource == null) - { - Debug.Console(1, "Cannot assign missing source '{0}' to source UI list", - srcConfig.SourceKey); - continue; - } + //var actualSource = DeviceManager.GetDeviceForKey(srcConfig.SourceKey) as Device; + //if (actualSource == null) + //{ + // Debug.Console(1, "Cannot assign missing source '{0}' to source UI list", + // srcConfig.SourceKey); + // continue; + //} var routeKey = kvp.Key; var item = new SubpageReferenceListSourceItem(i++, SourceStagingSrl, srcConfig, b => { if (!b) UiSelectSource(routeKey); }); diff --git a/Essentials/PepperDashEssentials/UIDrivers/SigInterlock.cs b/Essentials/PepperDashEssentials/UIDrivers/SigInterlock.cs new file mode 100644 index 00000000..e62fc7f3 --- /dev/null +++ b/Essentials/PepperDashEssentials/UIDrivers/SigInterlock.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; + +using PepperDash.Core; +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials +{ + /// + /// Used for interlocking sigs, using a set-clears-last-set model. + /// + public class SigInterlock + { + /// + /// + /// + public BoolInputSig CurrentSig { get; private set; } + + /// + /// + /// + public SigInterlock() + { + } + + /// + /// Hides CurrentJoin and shows join. Does nothing when resending CurrentJoin + /// + public void ShowInterlocked(BoolInputSig sig) + { + if (CurrentSig == sig) + return; + SetButDontShow(sig); + sig.BoolValue = true; + } + + /// + /// + /// + /// + public void ShowInterlockedWithToggle(BoolInputSig sig) + { + if(CurrentSig == sig) + HideAndClear(); + else + { + if(CurrentSig != null) + CurrentSig.BoolValue = false; + CurrentSig = sig; + CurrentSig.BoolValue = true; + } + + } + + /// + /// Hides current Sig and clears CurrentSig + /// + public void HideAndClear() + { + Hide(); + CurrentSig = null; + } + + /// + /// Hides the current Sig but does not clear the selected Sig in case + /// it needs to be reshown + /// + public void Hide() + { + if(CurrentSig != null) + CurrentSig.BoolValue = false; + } + + /// + /// If CurrentSig is set, it restores that Sig + /// + public void Show() + { + if(CurrentSig != null) + CurrentSig.BoolValue = true; + } + + /// + /// Useful for pre-setting the interlock but not enabling it. Sets CurrentSig + /// + /// + public void SetButDontShow(BoolInputSig sig) + { + if (CurrentSig != null) + CurrentSig.BoolValue = false; + CurrentSig = sig; + } + } +} \ No newline at end of file diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 480bd616..cc391a45 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index 8f39feb1..cb72b2a0 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ