feat: update bridging, device factory, and interfaces

In order to support the way some Smart Objects work, a clear
directory join was needed in order to allow for clearing a
selection in certain circumstances.

In order to support finer-grained dependencies while
developing plugins, the Development Device Factory was added.
This commit is contained in:
Trevor Payne
2022-09-06 17:16:27 -05:00
parent edd55d0349
commit ccf7acd53d
17 changed files with 381 additions and 208 deletions

View File

@@ -398,6 +398,7 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Digital JoinType = eJoinType.Digital
}); });
[JoinName("DirectoryEntryIsContact")] [JoinName("DirectoryEntryIsContact")]
public JoinDataComplete DirectoryEntryIsContact = new JoinDataComplete( public JoinDataComplete DirectoryEntryIsContact = new JoinDataComplete(
new JoinData new JoinData
@@ -524,6 +525,21 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Digital JoinType = eJoinType.Digital
}); });
[JoinName("DirectoryClearSelected")]
public JoinDataComplete DirectoryClearSelected = new JoinDataComplete(
new JoinData
{
JoinNumber = 110,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Clear Selected Entry and String from Search",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("CameraTiltUp")] [JoinName("CameraTiltUp")]
public JoinDataComplete CameraTiltUp = new JoinDataComplete( public JoinDataComplete CameraTiltUp = new JoinDataComplete(
new JoinData new JoinData
@@ -1256,11 +1272,12 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
}, },
new JoinMetadata new JoinMetadata
{ {
Description = "Directory Select Row", Description = "Directory Select Row and Feedback",
JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Analog JoinType = eJoinType.Analog
}); });
[JoinName("SelectedContactMethodCount")] [JoinName("SelectedContactMethodCount")]
public JoinDataComplete SelectedContactMethodCount = new JoinDataComplete( public JoinDataComplete SelectedContactMethodCount = new JoinDataComplete(
new JoinData new JoinData
@@ -1289,6 +1306,22 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Analog JoinType = eJoinType.Analog
}); });
[JoinName("DirectorySelectRowFeedback")]
public JoinDataComplete DirectorySelectRowFeedback = new JoinDataComplete(
new JoinData
{
JoinNumber = 104,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Directory Select Row and Feedback",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Analog
});
[JoinName("CameraPresetSelect")] [JoinName("CameraPresetSelect")]
public JoinDataComplete CameraPresetSelect = new JoinDataComplete( public JoinDataComplete CameraPresetSelect = new JoinDataComplete(
new JoinData new JoinData

View File

@@ -131,4 +131,15 @@ namespace PepperDash.Essentials.Core
/// </summary> /// </summary>
public string MinimumEssentialsFrameworkVersion { get; protected set; } public string MinimumEssentialsFrameworkVersion { get; protected set; }
} }
public abstract class EssentialsPluginDevelopmentDeviceFactory<T> : EssentialsDeviceFactory<T>, IPluginDevelopmentDeviceFactory where T : EssentialsDevice
{
/// <summary>
/// Specifies the minimum version of Essentials required for a plugin to run. Must use the format Major.Minor.Build (ex. "1.4.33")
/// </summary>
public string MinimumEssentialsFrameworkVersion { get; protected set; }
public List<string> DevelopmentEssentialsFrameworkVersions { get; protected set; }
}
} }

View File

@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core
{
public static class StringExtensions
{
public static string NullIfEmpty(this string s)
{
return string.IsNullOrEmpty(s) ? null : s;
}
public static string NullIfWhiteSpace(this string s)
{
return string.IsNullOrEmpty(s.Trim()) ? null : s;
}
}
}

View File

@@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Globalization; using System.Globalization;
using Crestron.SimplSharp; using Crestron.SimplSharp;
@@ -160,6 +161,38 @@ namespace PepperDash.Essentials.Core
public static void SetAssemblyVersion(string assemblyVersion) public static void SetAssemblyVersion(string assemblyVersion)
{ {
AssemblyVersion = assemblyVersion; AssemblyVersion = assemblyVersion;
}
public static bool IsRunningDevelopmentVersion(List<string> developmentVersions, string minimumVersion)
{
if (Regex.Match(AssemblyVersion, @"^(\d*).(\d*).(\d*).*").Groups[1].Value == "0")
{
Debug.Console(2, "Running Local Build. Bypassing Dependency Check.");
return true;
}
if (developmentVersions == null)
{
Debug.Console(0,
"Development Plugin does not specify a list of versions. Loading plugin may not work as expected. Checking Minumum version");
return IsRunningMinimumVersionOrHigher(minimumVersion);
}
Debug.Console(2, "Comparing running version '{0}' to minimum versions '{1}'", AssemblyVersion, developmentVersions);
var versionMatch = developmentVersions.FirstOrDefault(x => x == AssemblyVersion);
if (String.IsNullOrEmpty(versionMatch))
{
Debug.Console(0, "Essentials Build does not match any builds required for plugin load. Bypassing Plugin Load.");
return false;
}
Debug.Console(2, "Essentials Build {0} matches list of development builds", AssemblyVersion);
return IsRunningMinimumVersionOrHigher(minimumVersion);
} }
/// <summary> /// <summary>

View File

@@ -218,6 +218,7 @@
<Compile Include="DeviceTypeInterfaces\IHasPhoneDialing.cs" /> <Compile Include="DeviceTypeInterfaces\IHasPhoneDialing.cs" />
<Compile Include="DeviceTypeInterfaces\IMobileControl.cs" /> <Compile Include="DeviceTypeInterfaces\IMobileControl.cs" />
<Compile Include="Extensions\JsonExtensions.cs" /> <Compile Include="Extensions\JsonExtensions.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Factory\DeviceFactory.cs" /> <Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Factory\IDeviceFactory.cs" /> <Compile Include="Factory\IDeviceFactory.cs" />
<Compile Include="Factory\ReadyEventArgs.cs" /> <Compile Include="Factory\ReadyEventArgs.cs" />

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
using PepperDash.Core; using PepperDash.Core;
@@ -15,5 +16,10 @@ namespace PepperDash.Essentials.Core
} }
public interface IPluginDevelopmentDeviceFactory : IPluginDeviceFactory
{
List<string> DevelopmentEssentialsFrameworkVersions { get; }
} }
}

View File

@@ -425,7 +425,11 @@ namespace PepperDash.Essentials
/// <param name="loadedAssembly"></param> /// <param name="loadedAssembly"></param>
static void LoadCustomPlugin(IPluginDeviceFactory plugin, LoadedAssembly loadedAssembly) static void LoadCustomPlugin(IPluginDeviceFactory plugin, LoadedAssembly loadedAssembly)
{ {
var passed = Global.IsRunningMinimumVersionOrHigher(plugin.MinimumEssentialsFrameworkVersion); var developmentPlugin = plugin as IPluginDevelopmentDeviceFactory;
var passed = developmentPlugin != null ? Global.IsRunningDevelopmentVersion
(developmentPlugin.DevelopmentEssentialsFrameworkVersions, developmentPlugin.MinimumEssentialsFrameworkVersion)
: Global.IsRunningMinimumVersionOrHigher(plugin.MinimumEssentialsFrameworkVersion);
if (!passed) if (!passed)
{ {

View File

@@ -49,6 +49,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
Stack<CodecDirectory> DirectoryBrowseHistoryStack { get; } Stack<CodecDirectory> DirectoryBrowseHistoryStack { get; }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@@ -211,7 +211,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
get get
{ {
var joinable = StartTime.AddMinutes(-MinutesBeforeMeeting) <= DateTime.Now var joinable = StartTime.AddMinutes(-MinutesBeforeMeeting) <= DateTime.Now
&& DateTime.Now <= EndTime.AddMinutes(-5); && DateTime.Now <= EndTime.AddSeconds(-_joinableCooldownSeconds);
//Debug.Console(2, "Meeting Id: {0} joinable: {1}", Id, joinable); //Debug.Console(2, "Meeting Id: {0} joinable: {1}", Id, joinable);
return joinable; return joinable;
} }
@@ -231,11 +231,23 @@ namespace PepperDash.Essentials.Devices.Common.Codec
[JsonIgnore] [JsonIgnore]
public eMeetingEventChangeType NotifiedChangeTypes { get; set; } public eMeetingEventChangeType NotifiedChangeTypes { get; set; }
[JsonIgnore] private readonly int _joinableCooldownSeconds;
public Meeting() public Meeting()
{ {
Calls = new List<Call>(); Calls = new List<Call>();
_joinableCooldownSeconds = 300;
} }
public Meeting(int joinableCooldownSeconds)
{
Calls = new List<Call>();
_joinableCooldownSeconds = joinableCooldownSeconds;
}
#region Overrides of Object #region Overrides of Object
public override string ToString() public override string ToString()

View File

@@ -108,7 +108,7 @@
<Compile Include="Codec\eCodecCallStatus.cs" /> <Compile Include="Codec\eCodecCallStatus.cs" />
<Compile Include="Codec\eMeetingPrivacy.cs" /> <Compile Include="Codec\eMeetingPrivacy.cs" />
<Compile Include="Codec\iCodecAudio.cs" /> <Compile Include="Codec\iCodecAudio.cs" />
<Compile Include="VideoCodec\IConvertiblePreset.cs" /> <Compile Include="VideoCodec\ConvertiblePreset.cs" />
<Compile Include="Codec\IHasCallHold.cs" /> <Compile Include="Codec\IHasCallHold.cs" />
<Compile Include="Codec\IHasDoNotDisturb.cs" /> <Compile Include="Codec\IHasDoNotDisturb.cs" />
<Compile Include="Codec\IHasExternalSourceSwitching.cs" /> <Compile Include="Codec\IHasExternalSourceSwitching.cs" />

View File

@@ -377,5 +377,70 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
return meetings; return meetings;
} }
public static List<Meeting> GetGenericMeetingsFromBookingResult(List<Booking> bookings, int joinableCooldownSeconds)
{
var meetings = new List<Meeting>();
if (Debug.Level > 0)
{
Debug.Console(1, "Meetings List:\n");
}
foreach (Booking b in bookings)
{
var meeting = new Meeting(joinableCooldownSeconds);
if (b.Id != null)
meeting.Id = b.Id.Value;
if (b.Organizer != null)
meeting.Organizer = string.Format("{0}, {1}", b.Organizer.LastName.Value, b.Organizer.FirstName.Value);
if (b.Title != null)
meeting.Title = b.Title.Value;
if (b.Agenda != null)
meeting.Agenda = b.Agenda.Value;
if (b.Time != null)
{
meeting.StartTime = b.Time.StartTime.Value;
meeting.EndTime = b.Time.EndTime.Value;
}
if (b.Privacy != null)
meeting.Privacy = CodecCallPrivacy.ConvertToDirectionEnum(b.Privacy.Value);
//#warning Update this ConnectMode conversion after testing onsite. Expected value is "OBTP", but in PD NYC Test scenarios, "Manual" is being returned for OBTP meetings
if (b.DialInfo.ConnectMode != null)
if (b.DialInfo.ConnectMode.Value.ToLower() == "obtp" || b.DialInfo.ConnectMode.Value.ToLower() == "manual")
meeting.IsOneButtonToPushMeeting = true;
if (b.DialInfo.Calls.Call != null)
{
foreach (Call c in b.DialInfo.Calls.Call)
{
meeting.Calls.Add(new PepperDash.Essentials.Devices.Common.Codec.Call()
{
Number = c.Number.Value,
Protocol = c.Protocol.Value,
CallRate = c.CallRate.Value,
CallType = c.CallType.Value
});
}
}
meetings.Add(meeting);
if (Debug.Level > 0)
{
Debug.Console(1, "Title: {0}, ID: {1}, Organizer: {2}, Agenda: {3}", meeting.Title, meeting.Id, meeting.Organizer, meeting.Agenda);
Debug.Console(1, " Start Time: {0}, End Time: {1}, Duration: {2}", meeting.StartTime, meeting.EndTime, meeting.Duration);
Debug.Console(1, " Joinable: {0}\n", meeting.Joinable);
}
}
meetings.OrderBy(m => m.StartTime);
return meetings;
}
} }
} }

View File

@@ -1023,7 +1023,7 @@ ConnectorID: {2}"
if (tempPresets.Count > 0) if (tempPresets.Count > 0)
{ {
// Create temporary list to store the existing items from the CiscoCodecStatus.RoomPreset collection // Create temporary list to store the existing items from the CiscoCodecStatus.RoomPreset collection
var existingRoomPresets = new List<IConvertiblePreset>(); var existingRoomPresets = new List<CiscoCodecStatus.RoomPreset>();
// Add the existing items to the temporary list // Add the existing items to the temporary list
existingRoomPresets.AddRange(CodecStatus.Status.RoomPreset); existingRoomPresets.AddRange(CodecStatus.Status.RoomPreset);
// Populate the CodecStatus object (this will append new values to the RoomPreset collection // Populate the CodecStatus object (this will append new values to the RoomPreset collection
@@ -1031,8 +1031,6 @@ ConnectorID: {2}"
var jResponse = JObject.Parse(response); var jResponse = JObject.Parse(response);
List<CiscoCodecStatus.RoomPreset> convertedRoomPresets =
existingRoomPresets.Select(a => (CiscoCodecStatus.RoomPreset) a).ToList();
IList<JToken> roomPresets = jResponse["Status"]["RoomPreset"].Children().ToList(); IList<JToken> roomPresets = jResponse["Status"]["RoomPreset"].Children().ToList();
// Iterate the new items in this response agains the temporary list. Overwrite any existing items and add new ones. // Iterate the new items in this response agains the temporary list. Overwrite any existing items and add new ones.
@@ -1041,7 +1039,7 @@ ConnectorID: {2}"
var preset = camPreset as CiscoCodecStatus.RoomPreset; var preset = camPreset as CiscoCodecStatus.RoomPreset;
if (preset == null) continue; if (preset == null) continue;
// First fine the existing preset that matches the id // First fine the existing preset that matches the id
var existingPreset = convertedRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id)); var existingPreset = existingRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id));
if (existingPreset != null) if (existingPreset != null)
{ {
Debug.Console(1, this, "Existing Room Preset with ID: {0} found. Updating.", existingPreset.id); Debug.Console(1, this, "Existing Room Preset with ID: {0} found. Updating.", existingPreset.id);
@@ -1073,7 +1071,7 @@ ConnectorID: {2}"
CodecStatus.Status.RoomPreset = existingRoomPresets; CodecStatus.Status.RoomPreset = existingRoomPresets;
// Generecise the list // Generecise the list
NearEndPresets = existingRoomPresets.GetGenericPresets<CodecRoomPreset>(); NearEndPresets = existingRoomPresets.GetGenericPresets<CiscoCodecStatus.RoomPreset, CodecRoomPreset>();
var handler = CodecRoomPresetsListHasChanged; var handler = CodecRoomPresetsListHasChanged;
if (handler != null) if (handler != null)

View File

@@ -32,12 +32,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// </summary> /// </summary>
/// <param name="presets"></param> /// <param name="presets"></param>
/// <returns></returns> /// <returns></returns>
public static List<T> GetGenericPresets<T>(this List<IConvertiblePreset> presets) public static List<TDestination> GetGenericPresets<TSource, TDestination>(this List<TSource> presets) where TSource : ConvertiblePreset where TDestination : PresetBase
{ {
return return
presets.Select(preset => preset.ConvertCodecPreset()) presets.Select(preset => preset.ConvertCodecPreset())
.Where(newPreset => newPreset != null) .Where(newPreset => newPreset != null)
.Cast<T>() .Cast<TDestination>()
.ToList(); .ToList();
} }
} }

View File

@@ -2186,7 +2186,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
} }
} }
public class RoomPreset : IConvertiblePreset public class RoomPreset : ConvertiblePreset
{ {
public string id { get; set; } public string id { get; set; }
public Defined Defined { get; set; } public Defined Defined { get; set; }
@@ -2200,7 +2200,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
Type = new Type5(); Type = new Type5();
} }
public PresetBase ConvertCodecPreset() public override PresetBase ConvertCodecPreset()
{ {
try try
{ {
@@ -2240,7 +2240,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Proximity Proximity { get; set; } public Proximity Proximity { get; set; }
public RoomAnalytics RoomAnalytics { get; set; } public RoomAnalytics RoomAnalytics { get; set; }
public List<IConvertiblePreset> RoomPreset { get; set; } public List<RoomPreset> RoomPreset { get; set; }
public SIP SIP { get; set; } public SIP SIP { get; set; }
public Security Security { get; set; } public Security Security { get; set; }
@@ -2257,7 +2257,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
Standby = new Standby(); Standby = new Standby();
Cameras = new Cameras(); Cameras = new Cameras();
RoomAnalytics = new RoomAnalytics(); RoomAnalytics = new RoomAnalytics();
RoomPreset = new List<IConvertiblePreset>(); RoomPreset = new List<RoomPreset>();
Conference = new Conference2(); Conference = new Conference2();
SystemUnit = new SystemUnit(); SystemUnit = new SystemUnit();
Video = new Video(); Video = new Video();

View File

@@ -2,8 +2,8 @@
namespace PepperDash.Essentials.Devices.Common.VideoCodec namespace PepperDash.Essentials.Devices.Common.VideoCodec
{ {
public interface IConvertiblePreset public abstract class ConvertiblePreset
{ {
PresetBase ConvertCodecPreset(); public abstract PresetBase ConvertCodecPreset();
} }
} }

View File

@@ -22,25 +22,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
void MinMaxLayoutToggle(); void MinMaxLayoutToggle();
} }
/// <summary>
/// Defines the required elements for layout control with direct layout selection
/// </summary>
public interface IHasCodecLayoutsAvailable : IHasCodecLayouts
{
event EventHandler<AvailableLayoutChangedEventArgs> AvailableLayoutsChanged;
StringFeedback AvailableLocalLayoutsFeedback { get; }
List<CodecCommandWithLabel> AvailableLocalLayouts { get; }
void LocalLayoutSet(string layout);
void LocalLayoutSet(CodecCommandWithLabel layout);
}
public class AvailableLayoutChangedEventArgs : EventArgs
{
public List<CodecCommandWithLabel> AvailableLayouts { get; set; }
}
/// <summary> /// <summary>
/// Defines the requirements for Zoom Room layout control /// Defines the requirements for Zoom Room layout control

View File

@@ -11,6 +11,7 @@ using PepperDash.Core;
using PepperDash.Core.Intersystem; using PepperDash.Core.Intersystem;
using PepperDash.Core.Intersystem.Tokens; using PepperDash.Core.Intersystem.Tokens;
using PepperDash.Core.WebApi.Presets; using PepperDash.Core.WebApi.Presets;
using Crestron.SimplSharp.Reflection;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
@@ -31,6 +32,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
private const int XSigEncoding = 28591; private const int XSigEncoding = 28591;
protected const int MaxParticipants = 50; protected const int MaxParticipants = 50;
private readonly byte[] _clearBytes = XSigHelpers.ClearOutputs(); private readonly byte[] _clearBytes = XSigHelpers.ClearOutputs();
private IHasDirectory _directoryCodec;
private BasicTriList _directoryTrilist;
private VideoCodecControllerJoinMap _directoryJoinmap;
protected string _timeFormatSpecifier;
protected string _dateFormatSpecifier;
protected VideoCodecBase(DeviceConfig config) protected VideoCodecBase(DeviceConfig config)
: base(config) : base(config)
{ {
@@ -371,10 +381,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
LinkVideoCodecCameraLayoutsToApi(codec as IHasCodecLayouts, trilist, joinMap); LinkVideoCodecCameraLayoutsToApi(codec as IHasCodecLayouts, trilist, joinMap);
} }
if (codec is IHasCodecLayoutsAvailable)
{
LinkVideoCodecAvailableLayoutsToApi(codec as IHasCodecLayoutsAvailable, trilist, joinMap);
}
if (codec is IHasSelfviewPosition) if (codec is IHasSelfviewPosition)
{ {
@@ -789,7 +795,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetSigFalseAction(joinMap.SourceShareStart.JoinNumber, StartSharing); trilist.SetSigFalseAction(joinMap.SourceShareStart.JoinNumber, StartSharing);
trilist.SetSigFalseAction(joinMap.SourceShareEnd.JoinNumber, StopSharing); trilist.SetSigFalseAction(joinMap.SourceShareEnd.JoinNumber, StopSharing);
trilist.SetBoolSigAction(joinMap.SourceShareAutoStart.JoinNumber, (b) => AutoShareContentWhileInCall = b); trilist.SetBoolSigAction(joinMap.SourceShareAutoStart.JoinNumber, b => AutoShareContentWhileInCall = b);
} }
private List<Meeting> _currentMeetings = new List<Meeting>(); private List<Meeting> _currentMeetings = new List<Meeting>();
@@ -951,13 +957,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
//serials //serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, meeting.Organizer); tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, meeting.Organizer);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, meeting.Title); tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, meeting.Title);
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, meeting.StartTime.ToString("t", Global.Culture)); tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, meeting.StartTime.ToString(_dateFormatSpecifier.NullIfEmpty() ?? "d", Global.Culture));
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, meeting.StartTime.ToString("t", Global.Culture)); tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, meeting.StartTime.ToString(_timeFormatSpecifier.NullIfEmpty() ?? "t", Global.Culture));
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, meeting.EndTime.ToString("t", Global.Culture)); tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, meeting.EndTime.ToString(_dateFormatSpecifier.NullIfEmpty() ?? "d", Global.Culture));
tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, meeting.EndTime.ToString("t", Global.Culture)); tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, meeting.EndTime.ToString(_timeFormatSpecifier.NullIfEmpty() ?? "t", Global.Culture));
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, meeting.Id); tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, meeting.Id);
digitalIndex += maxDigitals; digitalIndex += maxDigitals;
meetingIndex += offset; meetingIndex += offset;
stringIndex += maxStrings; stringIndex += maxStrings;
@@ -989,6 +994,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
return GetXSigString(tokenArray); return GetXSigString(tokenArray);
} }
private void LinkVideoCodecDirectoryToApi(IHasDirectory codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) private void LinkVideoCodecDirectoryToApi(IHasDirectory codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{ {
codec.CurrentDirectoryResultIsNotDirectoryRoot.LinkComplementInputSig( codec.CurrentDirectoryResultIsNotDirectoryRoot.LinkComplementInputSig(
@@ -998,6 +1004,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetUShortSigAction(joinMap.DirectorySelectRow.JoinNumber, (i) => SelectDirectoryEntry(codec, i, trilist, joinMap)); trilist.SetUShortSigAction(joinMap.DirectorySelectRow.JoinNumber, (i) => SelectDirectoryEntry(codec, i, trilist, joinMap));
//Special Change for protected directory clear
trilist.SetBoolSigAction(joinMap.DirectoryClearSelected.JoinNumber, (b) => SelectDirectoryEntry(_directoryCodec, 0, _directoryTrilist, _directoryJoinmap));
// Report feedback for number of contact methods for selected contact // Report feedback for number of contact methods for selected contact
trilist.SetSigFalseAction(joinMap.DirectoryRoot.JoinNumber, codec.SetCurrentDirectoryToRoot); trilist.SetSigFalseAction(joinMap.DirectoryRoot.JoinNumber, codec.SetCurrentDirectoryToRoot);
@@ -1012,7 +1022,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length)); Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false); var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot,
codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length); Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
@@ -1027,8 +1038,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length)); Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
var directoryXSig = UpdateDirectoryXSig(args.Directory, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false); var directoryXSig = UpdateDirectoryXSig(args.Directory,
codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length); Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig); trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
@@ -1046,13 +1057,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
}; };
} }
private void SelectDirectoryEntry(IHasDirectory codec, ushort i, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) private void SelectDirectoryEntry(IHasDirectory codec, ushort i, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{ {
if (i < 1 || i > codec.CurrentDirectoryResult.CurrentDirectoryResults.Count) return; if (i > codec.CurrentDirectoryResult.CurrentDirectoryResults.Count) return;
_selectedDirectoryItem = i == 0 ? null : codec.CurrentDirectoryResult.CurrentDirectoryResults[i - 1];
trilist.SetUshort(joinMap.DirectorySelectRowFeedback.JoinNumber, i);
_selectedDirectoryItem = codec.CurrentDirectoryResult.CurrentDirectoryResults[i - 1]; if (_selectedDirectoryItem == null) trilist.SetBool(joinMap.DirectoryEntryIsContact.JoinNumber, false);
if (_selectedDirectoryItem is DirectoryFolder) if (_selectedDirectoryItem is DirectoryFolder)
@@ -1064,6 +1075,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.ClearUShortSigAction(joinMap.SelectContactMethod.JoinNumber); trilist.ClearUShortSigAction(joinMap.SelectContactMethod.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedLine.JoinNumber); trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedLine.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedContactMethod.JoinNumber); trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedContactMethod.JoinNumber);
trilist.SetBool(joinMap.DirectoryEntryIsContact.JoinNumber, false);
return; return;
} }
@@ -1071,12 +1083,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetString(joinMap.DirectorySelectedFolderName.JoinNumber, string.Empty); trilist.SetString(joinMap.DirectorySelectedFolderName.JoinNumber, string.Empty);
var selectedContact = _selectedDirectoryItem as DirectoryContact; var selectedContact = _selectedDirectoryItem as DirectoryContact;
if (selectedContact != null)
{
trilist.SetString(joinMap.DirectoryEntrySelectedName.JoinNumber, selectedContact.Name);
if (selectedContact != null && selectedContact.ContactMethods.Count >= 1)
{
trilist.SetBool(joinMap.DirectoryEntryIsContact.JoinNumber, true);
} }
trilist.SetString(joinMap.DirectoryEntrySelectedName.JoinNumber,
selectedContact != null ? selectedContact.Name : string.Empty);
// Allow auto dial of selected line. Always dials first contact method // Allow auto dial of selected line. Always dials first contact method
if (!trilist.GetBool(joinMap.DirectoryDisableAutoDialSelectedLine.JoinNumber)) if (!trilist.GetBool(joinMap.DirectoryDisableAutoDialSelectedLine.JoinNumber))
{ {
@@ -1090,12 +1105,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
var entryToDial = _selectedDirectoryItem as DirectoryContact; var entryToDial = _selectedDirectoryItem as DirectoryContact;
trilist.SetString(joinMap.DirectoryEntrySelectedNumber.JoinNumber, selectedContact.ContactMethods[0].Number); trilist.SetString(joinMap.DirectoryEntrySelectedNumber.JoinNumber,
selectedContact != null ? selectedContact.ContactMethods[0].Number : string.Empty);
if (entryToDial == null) return; if (entryToDial == null) return;
Dial(entryToDial.ContactMethods[0].Number); Dial(entryToDial.ContactMethods[0].Number);
return;
} }
else else
{ {
@@ -1188,29 +1203,26 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
? xSigMaxIndex ? xSigMaxIndex
: directory.CurrentDirectoryResults.Count]; : directory.CurrentDirectoryResults.Count];
Debug.Console(2, this, "IsRoot: {0}, Directory Count: {1}, TokenArray.Length: {2}", isRoot, directory.CurrentDirectoryResults.Count, tokenArray.Length); Debug.Console(2, this, "IsRoot: {0}, Directory Count: {1}, TokenArray.Length: {2}", isRoot,
directory.CurrentDirectoryResults.Count, tokenArray.Length);
var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex
? directory.CurrentDirectoryResults.Take(xSigMaxIndex) ? directory.CurrentDirectoryResults.Take(xSigMaxIndex)
: directory.CurrentDirectoryResults; : directory.CurrentDirectoryResults;
var contactsToDisplay = isRoot
? contacts.Where(c => c.ParentFolderId == "root")
: contacts.Where(c => c.ParentFolderId != "root");
var counterIndex = 1; var counterIndex = 1;
foreach (var entry in contactsToDisplay) foreach (var entry in contacts)
{ {
var arrayIndex = counterIndex - 1; var arrayIndex = counterIndex - 1;
var entryIndex = counterIndex; var entryIndex = counterIndex;
Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}, Type: {3}, ParentFolderId: {4}", Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId, entryIndex);
entry.Name, entry.FolderId, entryIndex, entry.GetType().GetCType().FullName, entry.ParentFolderId);
if (entry is DirectoryFolder) if (entry is DirectoryFolder && entry.ParentFolderId == "root")
{ {
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name)); tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name));
counterIndex++;
counterIndex++; counterIndex++;
continue; continue;
@@ -1222,6 +1234,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
} }
return GetXSigString(tokenArray); return GetXSigString(tokenArray);
} }
private void LinkVideoCodecCallControlsToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap) private void LinkVideoCodecCallControlsToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
@@ -1489,14 +1503,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
codec.LocalLayoutFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentLayoutStringFb.JoinNumber]); codec.LocalLayoutFeedback.LinkInputSig(trilist.StringInput[joinMap.CurrentLayoutStringFb.JoinNumber]);
} }
private void LinkVideoCodecAvailableLayoutsToApi(IHasCodecLayoutsAvailable codec, BasicTriList trilist,
VideoCodecControllerJoinMap joinMap)
{
codec.AvailableLocalLayoutsFeedback.LinkInputSig(trilist.StringInput[joinMap.AvailableLayoutsFb.JoinNumber]);
trilist.SetStringSigAction(joinMap.SelectLayout.JoinNumber, codec.LocalLayoutSet);
}
private void LinkVideoCodecCameraModeToApi(IHasCameraAutoMode codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) private void LinkVideoCodecCameraModeToApi(IHasCameraAutoMode codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{ {
trilist.SetSigFalseAction(joinMap.CameraModeAuto.JoinNumber, codec.CameraAutoModeOn); trilist.SetSigFalseAction(joinMap.CameraModeAuto.JoinNumber, codec.CameraAutoModeOn);
@@ -2023,4 +2029,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
} }
} }
} }