diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj index 83916856..8c7bc10c 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj @@ -48,48 +48,39 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.ThreeSeriesCards.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll @@ -108,8 +99,7 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll False @@ -118,13 +108,11 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj index 7c8b163a..7d6b7bde 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj +++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj @@ -48,18 +48,15 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DM.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.UI.dll @@ -78,8 +75,7 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll False @@ -88,8 +84,7 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDirectory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDirectory.cs index 3a984ab2..3a59b62d 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDirectory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Codec/iHasDirectory.cs @@ -40,9 +40,15 @@ namespace PepperDash.Essentials.Devices.Common.Codec /// /// Tracks the directory browse history when browsing beyond the root directory /// + [Obsolete("Please use the Stack-based history instead")] List DirectoryBrowseHistory { get; } } + public interface IHasDirectoryHistoryStack : IHasDirectory + { + Stack DirectoryBrowseHistoryStack { get; } + } + /// /// /// @@ -147,6 +153,9 @@ namespace PepperDash.Essentials.Devices.Common.Codec [JsonProperty("name")] public string Name { get; set; } + + [JsonProperty("parentFolderId")] + public string ParentFolderId { get; set; } } /// @@ -157,8 +166,6 @@ namespace PepperDash.Essentials.Devices.Common.Codec [JsonProperty("contacts")] public List Contacts { get; set; } - [JsonProperty("parentFolderId")] - public string ParentFolderId { get; set; } public DirectoryFolder() { @@ -177,6 +184,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec [JsonProperty("title")] public string Title { get; set; } + + [JsonProperty("contactMethods")] public List ContactMethods { get; set; } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj index d18cb6ce..d3d468fc 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Essentials Devices Common.csproj @@ -48,23 +48,19 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.GeneralIO.dll False - ..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Lighting.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Lighting.dll @@ -83,8 +79,7 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpNewtonsoft.dll False @@ -93,8 +88,7 @@ False - ..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll - True + ..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll 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 55969a71..7c5c784b 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 @@ -308,9 +308,95 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec LinkVideoCodecCameraLayoutsToApi(codec as IHasCodecLayouts, trilist, joinMap); } + if (codec is IHasDirectory) + { + LinkVideoCodecDirectoryToApi(codec as IHasDirectory, trilist, joinMap); + } } + private void LinkVideoCodecDirectoryToApi(IHasDirectory codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) + { + codec.CurrentDirectoryResultIsNotDirectoryRoot.LinkComplementInputSig( + trilist.BooleanInput[joinMap.DirectoryIsRoot.JoinNumber]); + + trilist.SetSigFalseAction(joinMap.DirectoryRoot.JoinNumber, codec.SetCurrentDirectoryToRoot); + + trilist.SetStringSigAction(joinMap.DirectorySearchString.JoinNumber, codec.SearchDirectory); + + trilist.SetUShortSigAction(joinMap.DirectorySelectRow.JoinNumber, (i) => SelectDirectoryEntry(codec, i)); + + trilist.SetSigFalseAction(joinMap.DirectoryRoot.JoinNumber, codec.SetCurrentDirectoryToRoot); + + trilist.SetSigFalseAction(joinMap.DirectoryFolderBack.JoinNumber, codec.GetDirectoryParentFolderContents); + + codec.DirectoryResultReturned += (sender, args) => + { + trilist.SetUshort(joinMap.DirectoryRowCount.JoinNumber, (ushort) args.Directory.CurrentDirectoryResults.Count); + + var clearBytes = XSigHelpers.ClearOutputs(); + + trilist.SetString(joinMap.DirectoryEntries.JoinNumber, + Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length)); + var directoryXSig = UpdateDirectoryXSig(args.Directory, !codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue); + + trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig); + }; + } + + private void SelectDirectoryEntry(IHasDirectory codec, ushort i) + { + var entry = codec.CurrentDirectoryResult.CurrentDirectoryResults[i - 1]; + + if (entry is DirectoryFolder) + { + codec.GetDirectoryFolderContents(entry.FolderId); + return; + } + + var dialableEntry = entry as IInvitableContact; + + if (dialableEntry != null) + { + Dial(dialableEntry); + return; + } + + var entryToDial = entry as DirectoryContact; + + if (entryToDial == null) return; + + Dial(entryToDial.ContactMethods[0].Number); + } + + private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot) + { + var contactIndex = 1; + var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count]; + + foreach(var entry in directory.CurrentDirectoryResults) + { + var arrayIndex = contactIndex - 1; + + if (entry is DirectoryFolder && entry.ParentFolderId == "root") + { + tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, String.Format("[+] {0}", entry.Name)); + + contactIndex++; + + continue; + } + + if(isRoot && String.IsNullOrEmpty(entry.FolderId)) continue; + + tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, entry.Name); + + contactIndex++; + } + + return GetXSigString(tokenArray); + } + private void LinkVideoCodecCallControlsToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap) { trilist.SetSigFalseAction(joinMap.ManualDial.JoinNumber, @@ -319,8 +405,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec //End All calls for now trilist.SetSigFalseAction(joinMap.EndCall.JoinNumber, EndAllCalls); - - CallStatusChange += (sender, args) => { trilist.SetBool(joinMap.HookState.JoinNumber, IsInCall); @@ -341,25 +425,30 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec private string UpdateCallStatusXSig() { + const int maxCalls = 8; + const int maxStrings = 5; const int offset = 6; - var callIndex = 1; + var callIndex = 0; + var digitalIndex = maxStrings*maxCalls; var tokenArray = new XSigToken[ActiveCalls.Count*offset]; //set array size for number of calls * pieces of info foreach (var call in ActiveCalls) { + var arrayIndex = callIndex; //digitals - tokenArray[callIndex] = new XSigDigitalToken((callIndex/offset) + 1, call.IsActiveCall); + tokenArray[arrayIndex] = new XSigDigitalToken(digitalIndex + 1, call.IsActiveCall); //serials - tokenArray[callIndex + 1] = new XSigSerialToken(callIndex, call.Name); - tokenArray[callIndex + 2] = new XSigSerialToken(callIndex + 1, call.Number); - tokenArray[callIndex + 3] = new XSigSerialToken(callIndex + 2, call.Direction.ToString()); - tokenArray[callIndex + 4] = new XSigSerialToken(callIndex + 3, call.Type.ToString()); - tokenArray[callIndex + 5] = new XSigSerialToken(callIndex + 4, call.Status.ToString()); + tokenArray[arrayIndex + 1] = new XSigSerialToken(callIndex + 1, call.Name ?? String.Empty); + tokenArray[arrayIndex + 2] = new XSigSerialToken(callIndex + 2, call.Number ?? String.Empty); + tokenArray[arrayIndex + 3] = new XSigSerialToken(callIndex + 3, call.Direction.ToString()); + tokenArray[arrayIndex + 4] = new XSigSerialToken(callIndex + 4, call.Type.ToString()); + tokenArray[arrayIndex + 5] = new XSigSerialToken(callIndex + 5, call.Status.ToString()); callIndex += offset; + digitalIndex++; } return GetXSigString(tokenArray); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs index c603ca08..780b7d29 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/ZoomRoom/ResponseObjects.cs @@ -255,9 +255,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom /// public static CodecDirectory ConvertZoomContactsToGeneric(List zoomContacts) { - var directory = new Codec.CodecDirectory(); + var directory = new CodecDirectory(); - var folders = new List(); + var folders = new List(); var roomFolder = new DirectoryFolder(); @@ -272,9 +272,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom { // If so, setup a rooms and contacts folder and add them. roomFolder.Name = "Rooms"; + roomFolder.ParentFolderId = "root"; roomFolder.FolderId = "rooms"; contactFolder.Name = "Contacts"; + contactFolder.ParentFolderId = "root"; contactFolder.FolderId = "contacts"; folders.Add(roomFolder); @@ -285,21 +287,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom try { - if (zoomContacts.Count > 0) + if (zoomContacts.Count == 0) return directory; { foreach (Contact c in zoomContacts) { - var contact = new ZoomDirectoryContact(); - - contact.Name = c.ScreenName; - contact.ContactId = c.Jid; + var contact = new ZoomDirectoryContact {Name = c.ScreenName, ContactId = c.Jid}; if (folders.Count > 0) { - if (c.IsZoomRoom) - contact.FolderId = roomFolder.FolderId; - else - contact.FolderId = contactFolder.FolderId; + contact.ParentFolderId = c.IsZoomRoom ? "rooms" : "contacts"; } contacts.Add(contact); @@ -577,7 +573,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public string meetingID { get; set; } public string password { get; set; } public string meetingOption { get; set; } - public int MeetingNumber { get; set; } + public long MeetingNumber { get; set; } public string callerName { get; set; } public string avatarURL { get; set; } public int lifeTime { get; set; } @@ -831,13 +827,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom { get { - return this._volume; + return _volume; } set { if (value != _volume) { - this._volume = value; + _volume = value; NotifyPropertyChanged("Volume"); } } 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 ba5dc3e4..5fec376c 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 @@ -18,7 +18,7 @@ using PepperDash_Essentials_Core.Bridges.JoinMaps; namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom { - public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectory, ICommunicationMonitor, IRouting, + public class ZoomRoom : VideoCodecBase, IHasCodecSelfView, IHasDirectoryHistoryStack, ICommunicationMonitor, IRouting, IHasScheduleAwareness, IHasCodecCameras { private readonly CrestronQueue ReceiveQueue; @@ -277,19 +277,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public event EventHandler DirectoryResultReturned; public CodecDirectory DirectoryRoot { get; private set; } + private CodecDirectory _currentDirectoryResult; public CodecDirectory CurrentDirectoryResult { - get - { - if (DirectoryBrowseHistory.Count > 0) - { - return DirectoryBrowseHistory[DirectoryBrowseHistory.Count - 1]; - } - else - { - return DirectoryRoot; - } - } + get { return _currentDirectoryResult; } } public CodecPhonebookSyncState PhonebookSyncState { get; private set; } @@ -302,48 +293,42 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom DirectoryRoot.CurrentDirectoryResults.FindAll( c => c.Name.IndexOf(searchString, 0, StringComparison.OrdinalIgnoreCase) > -1)); - DirectoryBrowseHistory.Add(directoryResults); + DirectoryBrowseHistoryStack.Push(_currentDirectoryResult); + _currentDirectoryResult = directoryResults; OnDirectoryResultReturned(directoryResults); } public void GetDirectoryFolderContents(string folderId) { - var directoryResults = new CodecDirectory(); + var directoryResults = new CodecDirectory {ResultsFolderId = folderId}; - directoryResults.ResultsFolderId = folderId; directoryResults.AddContactsToDirectory( - DirectoryRoot.CurrentDirectoryResults.FindAll(c => c.FolderId.Equals(folderId))); + DirectoryRoot.CurrentDirectoryResults.FindAll(c => c.ParentFolderId.Equals(folderId))); - DirectoryBrowseHistory.Add(directoryResults); + DirectoryBrowseHistoryStack.Push(_currentDirectoryResult); + + _currentDirectoryResult = directoryResults; OnDirectoryResultReturned(directoryResults); } public void SetCurrentDirectoryToRoot() { - DirectoryBrowseHistory.Clear(); + DirectoryBrowseHistoryStack.Clear(); + + _currentDirectoryResult = DirectoryRoot; OnDirectoryResultReturned(DirectoryRoot); } public void GetDirectoryParentFolderContents() { - var currentDirectory = new CodecDirectory(); + if (DirectoryBrowseHistoryStack.Count == 0) return; - if (DirectoryBrowseHistory.Count > 0) - { - var lastItemIndex = DirectoryBrowseHistory.Count - 1; - var parentDirectoryContents = DirectoryBrowseHistory[lastItemIndex]; + var currentDirectory = DirectoryBrowseHistoryStack.Pop(); - DirectoryBrowseHistory.Remove(DirectoryBrowseHistory[lastItemIndex]); - - currentDirectory = parentDirectoryContents; - } - else - { - currentDirectory = DirectoryRoot; - } + _currentDirectoryResult = currentDirectory; OnDirectoryResultReturned(currentDirectory); } @@ -352,6 +337,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom public List DirectoryBrowseHistory { get; private set; } + public Stack DirectoryBrowseHistoryStack { get; private set; } + #endregion #region IHasScheduleAwareness Members @@ -452,8 +439,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom DirectoryRoot = new CodecDirectory(); DirectoryBrowseHistory = new List(); + DirectoryBrowseHistoryStack = new Stack(); - CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => DirectoryBrowseHistory.Count > 0); + CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => DirectoryBrowseHistoryStack.Count > 0); CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate(); } @@ -828,6 +816,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom PhonebookSyncState.PhonebookRootEntriesReceived(); PhonebookSyncState.SetPhonebookHasFolders(false); PhonebookSyncState.SetNumberOfContacts(Status.Phonebook.Contacts.Count); + } var directoryResults = new CodecDirectory(); @@ -837,6 +826,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom DirectoryRoot = directoryResults; + _currentDirectoryResult = DirectoryRoot; + OnDirectoryResultReturned(directoryResults); break;