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 { /// /// Interface for camera presets /// public interface IHasCodecRoomPresets { event EventHandler CodecRoomPresetsListHasChanged; List NearEndPresets { get; } List FarEndRoomPresets { get; } void CodecRoomPresetSelect(int preset); void CodecRoomPresetStore(int preset, string description); } public static class RoomPresets { /// /// Converts Cisco RoomPresets to generic CameraPresets /// /// /// public static List GetGenericPresets(List presets) { var cameraPresets = new 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; } } /// /// Represents a room preset on a video codec. Typically stores camera position(s) and video routing. Can be recalled by Far End if enabled. /// public class CodecRoomPreset : PresetBase { public CodecRoomPreset(int id, string description, bool def, bool isDef) : base(id, description, def, isDef) { } } }