mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
fix: merge in changes from issue #983
fix: DeviceInfo Null Check Change IConvertiblePreset to abstract class ConvertiblePreset
This commit is contained in:
@@ -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" />
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -10,6 +10,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;
|
||||||
@@ -462,10 +463,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
|||||||
}
|
}
|
||||||
|
|
||||||
SharingContentIsOnFeedback.FireUpdate();
|
SharingContentIsOnFeedback.FireUpdate();
|
||||||
|
|
||||||
trilist.SetBool(joinMap.HookState.JoinNumber, IsInCall);
|
|
||||||
|
|
||||||
trilist.SetString(joinMap.CurrentCallData.JoinNumber, UpdateCallStatusXSig());
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1018,7 +1015,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);
|
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);
|
||||||
|
|
||||||
@@ -1033,8 +1031,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);
|
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);
|
||||||
@@ -1044,10 +1042,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
|||||||
{
|
{
|
||||||
if (!args.DeviceOnLine) return;
|
if (!args.DeviceOnLine) return;
|
||||||
|
|
||||||
// TODO [ ] Issue #868
|
var clearBytes = XSigHelpers.ClearOutputs();
|
||||||
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, "\xFC");
|
trilist.SetString(joinMap.DirectoryEntries.JoinNumber,
|
||||||
UpdateDirectoryXSig(codec.CurrentDirectoryResult,
|
Encoding.GetEncoding(XSigEncoding).GetString(clearBytes, 0, clearBytes.Length));
|
||||||
!codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue);
|
var directoryXSig = UpdateDirectoryXSig(codec.DirectoryRoot, codec.CurrentDirectoryResultIsNotDirectoryRoot.BoolValue == false);
|
||||||
|
trilist.SetString(joinMap.DirectoryEntries.JoinNumber, directoryXSig);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1185,32 +1184,45 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
|
|||||||
|
|
||||||
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
|
private string UpdateDirectoryXSig(CodecDirectory directory, bool isRoot)
|
||||||
{
|
{
|
||||||
var contactIndex = 1;
|
const int xSigMaxIndex = 1023;
|
||||||
var tokenArray = new XSigToken[directory.CurrentDirectoryResults.Count];
|
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)
|
||||||
var arrayIndex = contactIndex - 1;
|
: directory.CurrentDirectoryResults;
|
||||||
|
|
||||||
Debug.Console(2, this, "Entry Name: {0}, Folder ID: {1}", entry.Name, entry.FolderId);
|
var contactsToDisplay = isRoot
|
||||||
|
? contacts.Where(c => c.ParentFolderId == "root")
|
||||||
|
: contacts.Where(c => c.ParentFolderId != "root");
|
||||||
|
|
||||||
if (entry is DirectoryFolder && entry.ParentFolderId == "root")
|
var counterIndex = 1;
|
||||||
{
|
foreach (var entry in contactsToDisplay)
|
||||||
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, String.Format("[+] {0}", entry.Name));
|
{
|
||||||
|
var arrayIndex = counterIndex - 1;
|
||||||
|
var entryIndex = counterIndex;
|
||||||
|
|
||||||
contactIndex++;
|
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);
|
||||||
|
|
||||||
continue;
|
if (entry is DirectoryFolder)
|
||||||
}
|
{
|
||||||
|
tokenArray[arrayIndex] = new XSigSerialToken(entryIndex, String.Format("[+] {0}", entry.Name));
|
||||||
|
|
||||||
tokenArray[arrayIndex] = new XSigSerialToken(contactIndex, entry.Name);
|
counterIndex++;
|
||||||
|
|
||||||
contactIndex++;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user