Compare commits

...

13 Commits

Author SHA1 Message Date
Trevor Payne
080375345b fix:merge fixes 2022-09-06 11:53:08 -05:00
Trevor Payne
4d911d492f Fixed Commit Messages 2022-09-06 11:46:37 -05:00
Trevor Payne
e4226eb74b Post Lab Cisco-RoomOS Codec Pugin Testing
Multiple Changes
2022-09-06 09:56:46 -05:00
Trevor Payne
75c8dea4d3 Merged with Development 2022-09-06 00:10:40 -05:00
Trevor Payne
960c882436 Post BAML CodecTesting
Multiple Changes
2022-09-05 23:51:12 -05:00
Trevor Payne
d302a1b06b fix: merge in changes from issue #983
fix: DeviceInfo Null Check

Change IConvertiblePreset to abstract class ConvertiblePreset
2022-08-18 16:34:48 -05:00
Trevor Payne
780ec0aa4b fix: Check for local version 2022-08-17 13:22:48 -05:00
Trevor Payne
c2deaf9534 merge: feature/VideoCodec-Phonebook-Clear 2022-08-17 13:18:25 -05:00
Trevor Payne
cf3563d6b6 Merge branch 'feature/VideoCodec-Phonebook-Clear' into feature/explicit-essentials-version-check 2022-08-17 13:17:15 -05:00
Trevor Payne
e45643e9ab feat: add PluginDevelopmentDeviceFactory and associated Interfaces
feat: add method to Global to check against list of development versions
2022-08-17 13:01:21 -05:00
Trevor Payne
03a640d3d4 fix: Joinmap Index overwriting - adjusted 2022-08-12 16:18:58 -05:00
Trevor Payne
96cc263dbe feat: Resolves #982 2022-08-12 16:08:00 -05:00
Trevor Payne
9860e5f498 feat: Add method to clear selected phonebook entry 2022-08-12 15:58:19 -05:00
17 changed files with 403 additions and 209 deletions

View File

@@ -398,6 +398,22 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
JoinType = eJoinType.Digital
});
[JoinName("DirectoryClearSelection")]
public JoinDataComplete DirectoryClearSelection = new JoinDataComplete(
new JoinData
{
JoinNumber = 100,
JoinSpan = 1
},
new JoinMetadata
{
Description = "Directory Clear Entry Selection",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
[JoinName("DirectoryEntryIsContact")]
public JoinDataComplete DirectoryEntryIsContact = new JoinDataComplete(
new JoinData
@@ -1256,11 +1272,12 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
},
new JoinMetadata
{
Description = "Directory Select Row",
Description = "Directory Select Row and Feedback",
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Analog
});
[JoinName("SelectedContactMethodCount")]
public JoinDataComplete SelectedContactMethodCount = new JoinDataComplete(
new JoinData
@@ -1289,6 +1306,22 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps
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")]
public JoinDataComplete CameraPresetSelect = new JoinDataComplete(
new JoinData

View File

@@ -131,4 +131,15 @@ namespace PepperDash.Essentials.Core
/// </summary>
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.Linq;
using System.Text.RegularExpressions;
using System.Globalization;
using Crestron.SimplSharp;
@@ -162,6 +163,38 @@ namespace PepperDash.Essentials.Core
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>
/// Checks to see if the running version meets or exceed the minimum specified version. For beta versions (0.xx.yy), will always return true.
/// </summary>

View File

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

View File

@@ -1,3 +1,4 @@
using System.Collections.Generic;
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>
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)
{

View File

@@ -49,6 +49,11 @@ namespace PepperDash.Essentials.Devices.Common.Codec
Stack<CodecDirectory> DirectoryBrowseHistoryStack { get; }
}
public interface IHasDirectoryClearSelection : IHasDirectory
{
void DirectoryClearSelection();
}
/// <summary>
///
/// </summary>

View File

@@ -211,7 +211,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
get
{
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);
return joinable;
}
@@ -231,11 +231,23 @@ namespace PepperDash.Essentials.Devices.Common.Codec
[JsonIgnore]
public eMeetingEventChangeType NotifiedChangeTypes { get; set; }
[JsonIgnore] private readonly int _joinableCooldownSeconds;
public Meeting()
{
Calls = new List<Call>();
_joinableCooldownSeconds = 300;
}
public Meeting(int joinableCooldownSeconds)
{
Calls = new List<Call>();
_joinableCooldownSeconds = joinableCooldownSeconds;
}
#region Overrides of Object
public override string ToString()

View File

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

View File

@@ -377,5 +377,70 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
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

@@ -24,9 +24,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
public enum eExternalSourceType {camera, desktop, document_camera, mediaplayer, PC, whiteboard, other}
public enum eExternalSourceMode {Ready, NotReady, Hidden, Error}
public enum eExternalSourceMode {Ready, NotReady, Hidden, Error}
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory,
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectoryClearSelection,
IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView,
ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets,
IHasExternalSourceSwitching, IHasBranding, IHasCameraOff, IHasCameraMute, IHasDoNotDisturbMode,
@@ -493,6 +493,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
TieLineCollection.Default.Add(tl);
}
public void DirectoryClearSelection()
{
DirectoryClearSelectionBase();
}
public void InitializeBranding(string roomKey)
{
Debug.Console(1, this, "Initializing Branding for room {0}", roomKey);
@@ -1023,7 +1028,7 @@ ConnectorID: {2}"
if (tempPresets.Count > 0)
{
// 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
existingRoomPresets.AddRange(CodecStatus.Status.RoomPreset);
// Populate the CodecStatus object (this will append new values to the RoomPreset collection
@@ -1031,8 +1036,6 @@ ConnectorID: {2}"
var jResponse = JObject.Parse(response);
List<CiscoCodecStatus.RoomPreset> convertedRoomPresets =
existingRoomPresets.Select(a => (CiscoCodecStatus.RoomPreset) a).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.
@@ -1041,7 +1044,7 @@ ConnectorID: {2}"
var preset = camPreset as CiscoCodecStatus.RoomPreset;
if (preset == null) continue;
// 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)
{
Debug.Console(1, this, "Existing Room Preset with ID: {0} found. Updating.", existingPreset.id);
@@ -1073,7 +1076,7 @@ ConnectorID: {2}"
CodecStatus.Status.RoomPreset = existingRoomPresets;
// Generecise the list
NearEndPresets = existingRoomPresets.GetGenericPresets<CodecRoomPreset>();
NearEndPresets = existingRoomPresets.GetGenericPresets<CiscoCodecStatus.RoomPreset, CodecRoomPreset>();
var handler = CodecRoomPresetsListHasChanged;
if (handler != null)

View File

@@ -32,12 +32,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
/// </summary>
/// <param name="presets"></param>
/// <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
presets.Select(preset => preset.ConvertCodecPreset())
.Where(newPreset => newPreset != null)
.Cast<T>()
.Cast<TDestination>()
.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 Defined Defined { get; set; }
@@ -2200,7 +2200,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
Type = new Type5();
}
public PresetBase ConvertCodecPreset()
public override PresetBase ConvertCodecPreset()
{
try
{
@@ -2240,7 +2240,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public Proximity Proximity { 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 Security Security { get; set; }
@@ -2257,7 +2257,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
Standby = new Standby();
Cameras = new Cameras();
RoomAnalytics = new RoomAnalytics();
RoomPreset = new List<IConvertiblePreset>();
RoomPreset = new List<RoomPreset>();
Conference = new Conference2();
SystemUnit = new SystemUnit();
Video = new Video();

View File

@@ -2,8 +2,8 @@
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();
}
/// <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>
/// 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.Tokens;
using PepperDash.Core.WebApi.Presets;
using Crestron.SimplSharp.Reflection;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
@@ -31,6 +32,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
private const int XSigEncoding = 28591;
protected const int MaxParticipants = 50;
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)
: base(config)
{
@@ -371,10 +381,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
LinkVideoCodecCameraLayoutsToApi(codec as IHasCodecLayouts, trilist, joinMap);
}
if (codec is IHasCodecLayoutsAvailable)
{
LinkVideoCodecAvailableLayoutsToApi(codec as IHasCodecLayoutsAvailable, trilist, joinMap);
}
if (codec is IHasSelfviewPosition)
{
@@ -692,37 +698,37 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
if (meetingIndex >= maxParticipants * offset) break;
// Debug.Console(2, this,
//@"Updating Participant on xsig:
//Name: {0} (s{9})
//AudioMute: {1} (d{10})
//VideoMute: {2} (d{11})
//CanMuteVideo: {3} (d{12})
//CanUMuteVideo: {4} (d{13})
//IsHost: {5} (d{14})
//HandIsRaised: {6} (d{15})
//IsPinned: {7} (d{16})
//ScreenIndexIsPinnedTo: {8} (a{17})
//",
// participant.Name,
// participant.AudioMuteFb,
// participant.VideoMuteFb,
// participant.CanMuteVideo,
// participant.CanUnmuteVideo,
// participant.IsHost,
// participant.HandIsRaisedFb,
// participant.IsPinnedFb,
// participant.ScreenIndexIsPinnedToFb,
// stringIndex + 1,
// digitalIndex + 1,
// digitalIndex + 2,
// digitalIndex + 3,
// digitalIndex + 4,
// digitalIndex + 5,
// digitalIndex + 6,
// digitalIndex + 7,
// analogIndex + 1
// );
// Debug.Console(2, this,
//@"Updating Participant on xsig:
//Name: {0} (s{9})
//AudioMute: {1} (d{10})
//VideoMute: {2} (d{11})
//CanMuteVideo: {3} (d{12})
//CanUMuteVideo: {4} (d{13})
//IsHost: {5} (d{14})
//HandIsRaised: {6} (d{15})
//IsPinned: {7} (d{16})
//ScreenIndexIsPinnedTo: {8} (a{17})
//",
// participant.Name,
// participant.AudioMuteFb,
// participant.VideoMuteFb,
// participant.CanMuteVideo,
// participant.CanUnmuteVideo,
// participant.IsHost,
// participant.HandIsRaisedFb,
// participant.IsPinnedFb,
// participant.ScreenIndexIsPinnedToFb,
// stringIndex + 1,
// digitalIndex + 1,
// digitalIndex + 2,
// digitalIndex + 3,
// digitalIndex + 4,
// digitalIndex + 5,
// digitalIndex + 6,
// digitalIndex + 7,
// analogIndex + 1
// );
//digitals
@@ -789,10 +795,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetSigFalseAction(joinMap.SourceShareStart.JoinNumber, StartSharing);
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>();
private void LinkVideoCodecScheduleToApi(IHasScheduleAwareness codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
@@ -800,7 +806,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetUShortSigAction(joinMap.MinutesBeforeMeetingStart.JoinNumber, (i) =>
{
codec.CodecSchedule.MeetingWarningMinutes = i;
codec.CodecSchedule.MeetingWarningMinutes = i;
});
trilist.SetSigFalseAction(joinMap.DialMeeting1.JoinNumber, () =>
@@ -904,90 +910,94 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
// TODO [ ] hotfix/videocodecbase-max-meeting-xsig-set
public IntFeedback MeetingsToDisplayFeedback { get; set; }
private string UpdateMeetingsListXSig(List<Meeting> meetings)
{
private string UpdateMeetingsListXSig(List<Meeting> meetings)
{
// TODO [ ] hotfix/videocodecbase-max-meeting-xsig-set
//const int _meetingsToDisplay = 3;
const int maxDigitals = 2;
const int maxStrings = 7;
const int offset = maxDigitals + maxStrings;
var digitalIndex = maxStrings * _meetingsToDisplay; //15
var stringIndex = 0;
var meetingIndex = 0;
const int maxDigitals = 2;
const int maxStrings = 7;
const int offset = maxDigitals + maxStrings;
var digitalIndex = maxStrings * _meetingsToDisplay; //15
var stringIndex = 0;
var meetingIndex = 0;
var tokenArray = new XSigToken[_meetingsToDisplay * offset];
/*
* Digitals
* IsJoinable - 1
* IsDialable - 2
*
* Serials
* Organizer - 1
* Title - 2
* Start Date - 3
* Start Time - 4
* End Date - 5
* End Time - 6
* Id - 7
*/
var tokenArray = new XSigToken[_meetingsToDisplay * offset];
/*
* Digitals
* IsJoinable - 1
* IsDialable - 2
*
* Serials
* Organizer - 1
* Title - 2
* Start Date - 3
* Start Time - 4
* End Date - 5
* End Time - 6
* Id - 7
*/
foreach (var meeting in meetings)
{
var currentTime = DateTime.Now;
foreach (var meeting in meetings)
{
var currentTime = DateTime.Now;
if (meeting.StartTime < currentTime && meeting.EndTime < currentTime) continue;
if (meeting.StartTime < currentTime && meeting.EndTime < currentTime) continue;
if (meetingIndex >= _meetingsToDisplay * offset)
{
Debug.Console(2, this, "Max Meetings reached");
break;
}
if (meetingIndex >= _meetingsToDisplay * offset)
{
Debug.Console(2, this, "Max Meetings reached");
break;
}
//digitals
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, meeting.Joinable);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, meeting.Id != "0");
//digitals
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, meeting.Joinable);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, meeting.Id != "0");
//serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, meeting.Organizer);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, meeting.Title);
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(_timeFormatSpecifier.NullIfEmpty() ?? "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(_timeFormatSpecifier.NullIfEmpty() ?? "t", Global.Culture));
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, meeting.Id);
//serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, meeting.Organizer);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, meeting.Title);
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, meeting.StartTime.ToString("t", Global.Culture));
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, meeting.StartTime.ToString("t", Global.Culture));
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, meeting.EndTime.ToString("t", Global.Culture));
tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, meeting.EndTime.ToString("t", Global.Culture));
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, meeting.Id);
digitalIndex += maxDigitals;
meetingIndex += offset;
stringIndex += maxStrings;
}
while (meetingIndex < _meetingsToDisplay * offset)
{
Debug.Console(2, this, "Clearing unused data. Meeting Index: {0} MaxMeetings * Offset: {1}",
meetingIndex, _meetingsToDisplay * offset);
digitalIndex += maxDigitals;
meetingIndex += offset;
stringIndex += maxStrings;
}
//digitals
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, false);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, false);
while (meetingIndex < _meetingsToDisplay * offset)
{
Debug.Console(2, this, "Clearing unused data. Meeting Index: {0} MaxMeetings * Offset: {1}",
meetingIndex, _meetingsToDisplay * offset);
//serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, String.Empty);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, String.Empty);
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, String.Empty);
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, String.Empty);
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, String.Empty);
tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, String.Empty);
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, String.Empty);
//digitals
tokenArray[digitalIndex] = new XSigDigitalToken(digitalIndex + 1, false);
tokenArray[digitalIndex + 1] = new XSigDigitalToken(digitalIndex + 2, false);
digitalIndex += maxDigitals;
meetingIndex += offset;
stringIndex += maxStrings;
}
//serials
tokenArray[stringIndex] = new XSigSerialToken(stringIndex + 1, String.Empty);
tokenArray[stringIndex + 1] = new XSigSerialToken(stringIndex + 2, String.Empty);
tokenArray[stringIndex + 2] = new XSigSerialToken(stringIndex + 3, String.Empty);
tokenArray[stringIndex + 3] = new XSigSerialToken(stringIndex + 4, String.Empty);
tokenArray[stringIndex + 4] = new XSigSerialToken(stringIndex + 5, String.Empty);
tokenArray[stringIndex + 5] = new XSigSerialToken(stringIndex + 6, String.Empty);
tokenArray[stringIndex + 6] = new XSigSerialToken(stringIndex + 7, String.Empty);
return GetXSigString(tokenArray);
}
digitalIndex += maxDigitals;
meetingIndex += offset;
stringIndex += maxStrings;
}
return GetXSigString(tokenArray);
}
protected void DirectoryClearSelectionBase()
{
SelectDirectoryEntry(_directoryCodec, 0, _directoryTrilist, _directoryJoinmap);
}
private void LinkVideoCodecDirectoryToApi(IHasDirectory codec, BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
@@ -998,7 +1008,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetUShortSigAction(joinMap.DirectorySelectRow.JoinNumber, (i) => SelectDirectoryEntry(codec, i, trilist, joinMap));
// Report feedback for number of contact methods for selected contact
//Special Change for protected directory clear
_directoryCodec = codec as IHasDirectoryClearSelection;
if (_directoryCodec != null)
{
_directoryTrilist = trilist;
_directoryJoinmap = joinMap;
trilist.SetBoolSigAction(joinMap.DirectoryClearSelection.JoinNumber, (b) => DirectoryClearSelectionBase());
}
// Report feedback for number of contact methods for selected contact
trilist.SetSigFalseAction(joinMap.DirectoryRoot.JoinNumber, codec.SetCurrentDirectoryToRoot);
@@ -1012,7 +1034,8 @@ 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 == false);
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot,
codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
@@ -1027,32 +1050,32 @@ 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 == false);
var directoryXSig = UpdateDirectoryXSig(args.Directory,
codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
Debug.Console(2, this, "Directory XSig Length: {0}", directoryXSig.Length);
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
};
trilist.OnlineStatusChange += (device, args) =>
{
if (!args.DeviceOnLine) return;
var clearBytes = XSigHelpers.ClearOutputs();
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
var clearBytes = XSigHelpers.ClearOutputs();
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
};
}
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)
@@ -1064,6 +1087,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.ClearUShortSigAction(joinMap.SelectContactMethod.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedLine.JoinNumber);
trilist.ClearBoolSigAction(joinMap.DirectoryDialSelectedContactMethod.JoinNumber);
trilist.SetBool(joinMap.DirectoryEntryIsContact.JoinNumber, false);
return;
}
@@ -1071,13 +1095,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
trilist.SetString(joinMap.DirectorySelectedFolderName.JoinNumber, string.Empty);
var selectedContact = _selectedDirectoryItem as DirectoryContact;
if (selectedContact != null)
{
trilist.SetString(joinMap.DirectoryEntrySelectedName.JoinNumber, selectedContact.Name);
}
// Allow auto dial of selected line. Always dials first contact method
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
if (!trilist.GetBool(joinMap.DirectoryDisableAutoDialSelectedLine.JoinNumber))
{
var invitableEntry = _selectedDirectoryItem as IInvitableContact;
@@ -1090,12 +1117,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
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;
Dial(entryToDial.ContactMethods[0].Number);
return;
}
else
{
@@ -1181,50 +1208,49 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
return GetXSigString(tokenArray);
}
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
{
var xSigMaxIndex = 1023;
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count > xSigMaxIndex
? xSigMaxIndex
: directory.CurrentDirectoryResults.Count];
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
{
var xSigMaxIndex = 1023;
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count > xSigMaxIndex
? xSigMaxIndex
: 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
? directory.CurrentDirectoryResults.Take(xSigMaxIndex)
: directory.CurrentDirectoryResults;
var contactsToDisplay = isRoot
? contacts.Where(c => c.ParentFolderId == "root")
: contacts.Where(c => c.ParentFolderId != "root");
var contacts = directory.CurrentDirectoryResults.Count > xSigMaxIndex
? directory.CurrentDirectoryResults.Take(xSigMaxIndex)
: directory.CurrentDirectoryResults;
var counterIndex = 1;
foreach (var entry in contactsToDisplay)
{
var arrayIndex = counterIndex - 1;
var entryIndex = counterIndex;
var counterIndex = 1;
foreach (var entry in contacts)
{
var arrayIndex = counterIndex - 1;
var entryIndex = counterIndex;
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);
Debug.Console(2, this, "Entry{2:0000} Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId, entryIndex);
if (entry is DirectoryFolder)
{
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name));
if (entry is DirectoryFolder && entry.ParentFolderId == "root")
{
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name));
counterIndex++;
counterIndex++;
counterIndex++;
continue;
}
continue;
}
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, entry.Name);
counterIndex++;
}
return GetXSigString(tokenArray);
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, entry.Name);
counterIndex++;
}
return GetXSigString(tokenArray);
}
private void LinkVideoCodecCallControlsToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
private void LinkVideoCodecCallControlsToApi(BasicTriList trilist, VideoCodecControllerJoinMap joinMap)
{
trilist.SetSigFalseAction(joinMap.ManualDial.JoinNumber,
() => Dial(trilist.StringOutput[joinMap.CurrentDialString.JoinNumber].StringValue));
@@ -1489,14 +1515,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
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)
{
trilist.SetSigFalseAction(joinMap.CameraModeAuto.JoinNumber, codec.CameraAutoModeOn);
@@ -2023,4 +2041,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
}
}
}