From 49e44ec85047faa90b75a26285ef32a114339a72 Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 10 Aug 2022 15:49:41 -0500 Subject: [PATCH 1/2] fix: updated VideoCodecBase UpdateDirectoryXSig to handle directory results that are greater than 1023, XSig maximimum index --- .../VideoCodec/VideoCodecBase.cs | 30 ++++++++++++------- .../VideoCodec/ZoomRoom/ZoomRoom.cs | 5 ++-- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index 593472e9..d07d5f81 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -1180,31 +1180,39 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot) { - var contactIndex = 1; - var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count]; + var xSigMaxIndex = 1023; + var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count > xSigMaxIndex + ? xSigMaxIndex + : directory.CurrentDirectoryResults.Count]; - Debug.Console(2, this, "Is root {0} Directory Count: {1}", isRoot, directory.CurrentDirectoryResults.Count); + Debug.Console(2, this, "IsRoot: {0}, Directory Count: {1}, TokenArray.Length: {2}", isRoot, directory.CurrentDirectoryResults.Count, tokenArray.Length); - foreach (var entry in directory.CurrentDirectoryResults) + var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex + ? directory.CurrentDirectoryResults.Take(xSigMaxIndex) + : directory.CurrentDirectoryResults; + + var counterIndex = 1; + foreach (var entry in contacts) { - var arrayIndex = contactIndex - 1; + var arrayIndex = counterIndex - 1; + var entryIndex = counterIndex; - Debug.Console(2, this, "Entry Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId); + Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId, entryIndex); if (entry is DirectoryFolder && entry.ParentFolderId == "root") { - tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, String.Format("[+] {0}", entry.Name)); + tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name)); - contactIndex++; + counterIndex++; continue; } - tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, entry.Name); + tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, entry.Name); - contactIndex++; + counterIndex++; } - + return GetXSigString(tokenArray); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index 73c1e8c5..6ba1082f 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -2730,6 +2730,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count); var directoryResult = result; + var directoryIsRoot = CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false; // If result is Root, create a copy and filter out contacts whose parent folder is not root //if (!CurrentDirectoryResultIsNotDirectoryRoot.BoolValue) @@ -2747,7 +2748,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom //} Debug.Console(2, this, "Updating directoryResult. IsOnRoot: {0} Contact Count: {1}", - !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue, directoryResult.Contacts.Count); + directoryIsRoot, directoryResult.Contacts.Count); // This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology var handler = DirectoryResultReturned; @@ -2756,7 +2757,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom handler(this, new DirectoryEventArgs { Directory = directoryResult, - DirectoryIsOnRoot = !CurrentDirectoryResultIsNotDirectoryRoot.BoolValue + DirectoryIsOnRoot = directoryIsRoot }); } From c446c3a976e9719190921ec2e8cb6e731a3100dd Mon Sep 17 00:00:00 2001 From: Jason DeVito Date: Wed, 10 Aug 2022 17:12:30 -0500 Subject: [PATCH 2/2] fix: updates to resolve directory display issues on touch panel when bridged --- .../VideoCodec/VideoCodecBase.cs | 19 ++++++++++++------- .../VideoCodec/ZoomRoom/ZoomRoom.cs | 4 +++- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index d07d5f81..6e577c59 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Crestron.SimplSharp.CrestronIO; +using Crestron.SimplSharp.Reflection; using Crestron.SimplSharp.Ssh; using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharp; @@ -1010,7 +1011,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec trilist.SetString(joinMap.DirectoryEntries.JoinNumber, Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length)); - var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue); + var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false); Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length); @@ -1025,7 +1026,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec trilist.SetString(joinMap.DirectoryEntries.JoinNumber, Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length)); - var directoryXSig = UpdateDirectoryXSig(args.Directory, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue); + var directoryXSig = UpdateDirectoryXSig(args.Directory, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false); Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length); @@ -1036,10 +1037,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec { if (!args.DeviceOnLine) return; - // TODO [ ] Issue #868 trilist.SetString(joinMap.DirectoryEntries.JoinNumber, "\xFC"); UpdateDirectoryXSig(codec.CurrentDirectoryResult, - !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue); + codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false); }; } @@ -1190,16 +1190,21 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex ? directory.CurrentDirectoryResults.Take(xSigMaxIndex) : directory.CurrentDirectoryResults; + + var contactsToDisplay = isRoot + ? contacts.Where(c => c.ParentFolderId == "root") + : contacts.Where(c => c.ParentFolderId != "root"); var counterIndex = 1; - foreach (var entry in contacts) + foreach (var entry in contactsToDisplay) { var arrayIndex = counterIndex - 1; var entryIndex = counterIndex; - Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId, entryIndex); + Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}, Type: {3}, ParentFolderId: {4}", + entry.Name, entry.FolderId, entryIndex, entry.GetType().GetCType().FullName, entry.ParentFolderId); - if (entry is DirectoryFolder && entry.ParentFolderId == "root") + if (entry is DirectoryFolder) { tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name)); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs index 6ba1082f..32415d1d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ZoomRoom.cs @@ -2729,6 +2729,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom { Debug.Console(2, this, "OnDirectoryResultReturned. Result has {0} contacts", result.Contacts.Count); + CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); + var directoryResult = result; var directoryIsRoot = CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false; @@ -2761,7 +2763,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom }); } - CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); + } catch (Exception e) {