From d8ac302f1c72bae6a14d1ba877eb5a1052c020c8 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Mon, 11 Jul 2022 17:30:51 -0500 Subject: [PATCH 1/6] [feature] - Create and Implement IConvertiblePreset within the VideoCodec and the VideoCodec.Cisco namespaces RESOLVES #966 --- .../Essentials Devices Common.csproj | 1 + .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 15 ++++--- .../VideoCodec/CiscoCodec/RoomPresets.cs | 39 ++++--------------- .../VideoCodec/CiscoCodec/xStatus.cs | 26 +++++++++++-- .../VideoCodec/IConvertiblePreset.cs | 9 +++++ 5 files changed, 49 insertions(+), 41 deletions(-) create mode 100644 essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs 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 fe4d5f61..547e8711 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 @@ -108,6 +108,7 @@ + diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index c9e584d3..581e34e5 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -1023,20 +1023,25 @@ ConnectorID: {2}" if (tempPresets.Count > 0) { // Create temporary list to store the existing items from the CiscoCodecStatus.RoomPreset collection - List existingRoomPresets = new List(); + var existingRoomPresets = new List(); // 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 JsonConvert.PopulateObject(response, CodecStatus); - JObject jResponse = JObject.Parse(response); + var jResponse = JObject.Parse(response); + + List convertedRoomPresets = + existingRoomPresets.Select(a => (CiscoCodecStatus.RoomPreset) a).ToList(); IList 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. - foreach (var preset in tempPresets) + foreach (var camPreset in tempPresets) { + var preset = camPreset as CiscoCodecStatus.RoomPreset; + if (preset == null) continue; // First fine the existing preset that matches the id - var existingPreset = existingRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id)); + var existingPreset = convertedRoomPresets.FirstOrDefault(p => p.id.Equals(preset.id)); if (existingPreset != null) { Debug.Console(1, this, "Existing Room Preset with ID: {0} found. Updating.", existingPreset.id); @@ -1068,7 +1073,7 @@ ConnectorID: {2}" CodecStatus.Status.RoomPreset = existingRoomPresets; // Generecise the list - NearEndPresets = RoomPresets.GetGenericPresets(CodecStatus.Status.RoomPreset); + NearEndPresets = RoomPresets.GetGenericPresets(existingRoomPresets).Select(a =>(CodecRoomPreset)a).ToList(); var handler = CodecRoomPresetsListHasChanged; if (handler != null) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs index b6327d52..1cf9acdf 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs @@ -1,14 +1,9 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using Crestron.SimplSharp; - -using Newtonsoft.Json; using PepperDash.Core; using PepperDash.Essentials.Core.Presets; -using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco; namespace PepperDash.Essentials.Devices.Common.VideoCodec { @@ -33,39 +28,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public static class RoomPresets { /// - /// Converts Cisco RoomPresets to generic CameraPresets + /// Converts non-generic RoomPresets to generic CameraPresets /// /// /// - public static List GetGenericPresets(List presets) + public static List GetGenericPresets(List presets) { - var cameraPresets = new List(); + Debug.Console(2, "Presets List:"); - if (Debug.Level > 0) - { - Debug.Console(1, "Presets List:"); - } - foreach (CiscoCodecStatus.RoomPreset preset in presets) - { - try - { - var cameraPreset = new CodecRoomPreset(UInt16.Parse(preset.id), preset.Description.Value, preset.Defined.BoolValue, true); - - cameraPresets.Add(cameraPreset); - - if (Debug.Level > 0) - { - Debug.Console(1, "Added Preset ID: {0}, Description: {1}, IsDefined: {2}, isDefinable: {3}", cameraPreset.ID, cameraPreset.Description, cameraPreset.Defined, cameraPreset.IsDefinable); - } - } - catch (Exception e) - { - Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", preset.id, e); - } - } - - return cameraPresets; + return + presets.Select(preset => preset.ReturnConvertedCodecPreset()) + .Where(newPreset => newPreset != null) + .ToList(); } } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs index 5bde30ff..2c84cba8 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs @@ -9,6 +9,7 @@ using Newtonsoft.Json.Linq; using PepperDash.Core; using PepperDash.Essentials.Devices.Common.VideoCodec.CiscoCodec; +using PepperDash.Essentials.Core.Presets; namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco { @@ -2185,7 +2186,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco } } - public class RoomPreset + public class RoomPreset : IConvertiblePreset { public string id { get; set; } public Defined Defined { get; set; } @@ -2198,7 +2199,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco Description = new Description2(); Type = new Type5(); } - } + + public PresetBase ReturnConvertedCodecPreset() + { + try + { + var preset = new CodecRoomPreset(UInt16.Parse(id), Description.Value, Defined.BoolValue, true); + + Debug.Console(2, "Preset ID {0} Converted from Cisco Codec Preset to Essentials Preset"); + + return preset; + } + catch (Exception e) + { + Debug.Console(2, "Unable to convert preset: {0}. Error: {1}", id, e); + return null; + } + } +} @@ -2222,7 +2240,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco public Proximity Proximity { get; set; } public RoomAnalytics RoomAnalytics { get; set; } - public List RoomPreset { get; set; } + public List RoomPreset { get; set; } public SIP SIP { get; set; } public Security Security { get; set; } @@ -2239,7 +2257,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco Standby = new Standby(); Cameras = new Cameras(); RoomAnalytics = new RoomAnalytics(); - RoomPreset = new List(); + RoomPreset = new List(); Conference = new Conference2(); SystemUnit = new SystemUnit(); Video = new Video(); diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs new file mode 100644 index 00000000..7c3695aa --- /dev/null +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs @@ -0,0 +1,9 @@ +using PepperDash.Essentials.Core.Presets; + +namespace PepperDash.Essentials.Devices.Common.VideoCodec +{ + public interface IConvertiblePreset + { + PresetBase ReturnConvertedCodecPreset(); + } +} \ No newline at end of file From b505ad467b8e76ca2033b1ee8c03d85464f3d9b4 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 Jul 2022 12:34:28 -0500 Subject: [PATCH 2/6] [feature] added IHasCodecLayoutsAvailable interface and associated bridge linking methods Modifies #966 --- .../JoinMaps/VideoCodecControllerJoinMap.cs | 59 +++++++++++++++++++ .../VideoCodec/Interfaces/IHasCodecLayouts.cs | 10 ++++ .../VideoCodec/VideoCodecBase.cs | 13 ++++ 3 files changed, 82 insertions(+) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs index b26471dd..9e982700 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Bridges/JoinMaps/VideoCodecControllerJoinMap.cs @@ -1576,6 +1576,36 @@ namespace PepperDash.Essentials.Core.Bridges.JoinMaps JoinType = eJoinType.Serial }); + [JoinName("AvailableLayoutsFb")] + public JoinDataComplete AvailableLayoutsFb = new JoinDataComplete( + new JoinData + { + JoinNumber = 142, + JoinSpan = 1 + }, + new JoinMetadata + { + Description = "xSig of all available layouts", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Serial + }); + + [JoinName("SelectLayout")] + public JoinDataComplete SelectLayout = new JoinDataComplete( + new JoinData + { + JoinNumber = 142, + JoinSpan = 1 + }, + new JoinMetadata + { + Description = "Select Layout by string", + JoinCapabilities = eJoinCapabilities.FromSIMPL, + JoinType = eJoinType.Serial + }); + + + [JoinName("CurrentParticipants")] public JoinDataComplete CurrentParticipants = new JoinDataComplete( new JoinData @@ -3014,6 +3044,35 @@ namespace PepperDash_Essentials_Core.Bridges.JoinMaps JoinType = eJoinType.Serial }); + [JoinName("AvailableLayoutsFb")] + public JoinDataComplete AvailableLayoutsFb = new JoinDataComplete( + new JoinData + { + JoinNumber = 142, + JoinSpan = 1 + }, + new JoinMetadata + { + Description = "xSig of all available layouts", + JoinCapabilities = eJoinCapabilities.ToSIMPL, + JoinType = eJoinType.Serial + }); + + [JoinName("SelectLayout")] + public JoinDataComplete SelectLayout = new JoinDataComplete( + new JoinData + { + JoinNumber = 142, + JoinSpan = 1 + }, + new JoinMetadata + { + Description = "Select Layout by string", + JoinCapabilities = eJoinCapabilities.FromSIMPL, + JoinType = eJoinType.Serial + }); + + [JoinName("CurrentParticipants")] public JoinDataComplete CurrentParticipants = new JoinDataComplete( new JoinData diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs index ef0bf2bd..454c3f3e 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs @@ -22,6 +22,16 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec void MinMaxLayoutToggle(); } + /// + /// Defines the required elements for layout control with direct layout selection + /// + public interface IHasCodecLayoutsAvailable : IHasCodecLayouts + { + StringFeedback AvailableLocalLayoutsFeedback { get; set; } + Dictionary AvailableLocalLayouts { get; set; } + void LocalLayoutSet(string layoutId); + } + /// /// Defines the requirements for Zoom Room layout control /// diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index 593472e9..19d48be7 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 @@ -370,6 +370,11 @@ 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) { LinkVideoCodecSelfviewPositionToApi(codec as IHasSelfviewPosition, trilist, joinMap); @@ -1471,6 +1476,14 @@ 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); From 9ecaec55840f9df393c29824f6e0399943a246fc Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 Jul 2022 15:02:22 -0500 Subject: [PATCH 3/6] [fix] slight change to move CodecCommandWithLabel into the VideoCodec namespace and modify the IHasCodecLayoutsAvailable interface to utilize this class Modifies #966 --- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 14 -------------- .../VideoCodec/Interfaces/IHasCodecLayouts.cs | 2 +- .../VideoCodec/Interfaces/IHasSelfviewPosition.cs | 2 +- .../VideoCodec/Interfaces/IHasSelfviewSize.cs | 2 +- .../VideoCodec/VideoCodecBase.cs | 15 +++++++++++++++ 5 files changed, 18 insertions(+), 17 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index 581e34e5..669a09ac 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -2470,20 +2470,6 @@ ConnectorID: {2}" } - /// - /// Represents a codec command that might need to have a friendly label applied for UI feedback purposes - /// - public class CodecCommandWithLabel - { - public string Command { get; set; } - public string Label { get; set; } - - public CodecCommandWithLabel(string command, string label) - { - Command = command; - Label = label; - } - } /// /// Tracks the initial sycnronization state of the codec when making a connection diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs index 454c3f3e..3368b1d2 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs @@ -28,7 +28,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec public interface IHasCodecLayoutsAvailable : IHasCodecLayouts { StringFeedback AvailableLocalLayoutsFeedback { get; set; } - Dictionary AvailableLocalLayouts { get; set; } + List AvailableLocalLayouts { get; set; } void LocalLayoutSet(string layoutId); } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewPosition.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewPosition.cs index 5360b80a..d0ba25fd 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewPosition.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewPosition.cs @@ -1,5 +1,5 @@ using PepperDash.Essentials.Core; -using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco; +using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.Core.DeviceTypeInterfaces { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewSize.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewSize.cs index 91ac3ec8..4103fa0e 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewSize.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasSelfviewSize.cs @@ -1,4 +1,4 @@ -using PepperDash.Essentials.Devices.Common.VideoCodec.Cisco; +using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials.Core.DeviceTypeInterfaces { 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 19d48be7..202a6a5b 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 @@ -1995,4 +1995,19 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec } } } + /// + /// Represents a codec command that might need to have a friendly label applied for UI feedback purposes + /// + public class CodecCommandWithLabel + { + public string Command { get; set; } + public string Label { get; set; } + + public CodecCommandWithLabel(string command, string label) + { + Command = command; + Label = label; + } + } + } \ No newline at end of file From 96ec2cbe49240a71515bd16eeff6e302ad96c6c7 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 Jul 2022 15:38:48 -0500 Subject: [PATCH 4/6] [Fix] - Updated IHasCodecLayoutsAvailable setters [Adjusts] #966 --- .../VideoCodec/Interfaces/IHasCodecLayouts.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs index 3368b1d2..a7b68501 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs @@ -27,8 +27,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec /// public interface IHasCodecLayoutsAvailable : IHasCodecLayouts { - StringFeedback AvailableLocalLayoutsFeedback { get; set; } - List AvailableLocalLayouts { get; set; } + StringFeedback AvailableLocalLayoutsFeedback { get; } + List AvailableLocalLayouts { get; } void LocalLayoutSet(string layoutId); } From 9c8bb66c5e21f204f66c8c3fd9899ab23895cc1c Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Tue, 12 Jul 2022 15:38:48 -0500 Subject: [PATCH 5/6] [Fix] - Updated IHasCodecLayoutsAvailable setters [Adjusts] #966 --- .../VideoCodec/Interfaces/IHasCodecLayouts.cs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs index 3368b1d2..f571e40c 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/Interfaces/IHasCodecLayouts.cs @@ -27,9 +27,18 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec /// public interface IHasCodecLayoutsAvailable : IHasCodecLayouts { - StringFeedback AvailableLocalLayoutsFeedback { get; set; } - List AvailableLocalLayouts { get; set; } - void LocalLayoutSet(string layoutId); + event EventHandler AvailableLayoutsChanged; + + StringFeedback AvailableLocalLayoutsFeedback { get; } + List AvailableLocalLayouts { get; } + void LocalLayoutSet(string layout); + void LocalLayoutSet(CodecCommandWithLabel layout); + + } + + public class AvailableLayoutChangedEventArgs : EventArgs + { + public List AvailableLayouts { get; set; } } /// From 04e8508c0c5c46436b25e6d32d30101ae51af060 Mon Sep 17 00:00:00 2001 From: Trevor Payne Date: Fri, 15 Jul 2022 11:38:19 -0500 Subject: [PATCH 6/6] fix: requested changes for PR #967 --- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 2 +- .../VideoCodec/CiscoCodec/RoomPresets.cs | 8 +++----- .../VideoCodec/CiscoCodec/xStatus.cs | 2 +- .../VideoCodec/IConvertiblePreset.cs | 2 +- .../VideoCodec/VideoCodecBase.cs | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index 669a09ac..0bca7181 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -1073,7 +1073,7 @@ ConnectorID: {2}" CodecStatus.Status.RoomPreset = existingRoomPresets; // Generecise the list - NearEndPresets = RoomPresets.GetGenericPresets(existingRoomPresets).Select(a =>(CodecRoomPreset)a).ToList(); + NearEndPresets = existingRoomPresets.GetGenericPresets(); var handler = CodecRoomPresetsListHasChanged; if (handler != null) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs index 1cf9acdf..4fec0d89 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/RoomPresets.cs @@ -32,14 +32,12 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec /// /// /// - public static List GetGenericPresets(List presets) + public static List GetGenericPresets(this List presets) { - Debug.Console(2, "Presets List:"); - - return - presets.Select(preset => preset.ReturnConvertedCodecPreset()) + presets.Select(preset => preset.ConvertCodecPreset()) .Where(newPreset => newPreset != null) + .Cast() .ToList(); } } diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs index 2c84cba8..23e8c6ab 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/xStatus.cs @@ -2200,7 +2200,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco Type = new Type5(); } - public PresetBase ReturnConvertedCodecPreset() + public PresetBase ConvertCodecPreset() { try { diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs index 7c3695aa..f6f3f74f 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/IConvertiblePreset.cs @@ -4,6 +4,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec { public interface IConvertiblePreset { - PresetBase ReturnConvertedCodecPreset(); + PresetBase ConvertCodecPreset(); } } \ No newline at end of file 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 202a6a5b..c7579f0b 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 @@ -2000,8 +2000,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec /// public class CodecCommandWithLabel { - public string Command { get; set; } - public string Label { get; set; } + public string Command { get; private set; } + public string Label { get; private set; } public CodecCommandWithLabel(string command, string label) {