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/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/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs b/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs index 5769fc52..8a58c340 100644 --- a/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs +++ b/Essentials/PepperDashEssentials/UI/JoinConstants/UISmartObjectJoin.cs @@ -33,6 +33,10 @@ /// 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/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs index 67cb5d8f..23615504 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleTechPageDriver.cs @@ -16,10 +16,34 @@ 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; + + + /// /// /// @@ -45,21 +69,25 @@ namespace PepperDash.Essentials.UIDrivers MenuList.SetFeedback(1, true); }); - MenuList.SetItemMainText(2, "Panel Setup"); + MenuList.SetItemMainText(2, "Display Controls"); MenuList.SetItemButtonAction(2, b => { - if (b) PagesInterlock.ShowInterlocked(UIBoolJoin.TechPanelSetupVisible); - MenuList.SetFeedback(2, true); - }); - - MenuList.SetItemMainText(3, "System Status"); - MenuList.SetItemButtonAction(3, 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); @@ -67,11 +95,53 @@ namespace PepperDash.Essentials.UIDrivers 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/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 29eacc9b..534e8b8c 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -750,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/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index d9d9c054..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 c813158f..cb72b2a0 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ