using System.Collections.Generic; using Newtonsoft.Json; using Newtonsoft.Json.Converters; using PepperDash.Core; namespace PepperDash.Essentials.Core { /// /// Defines the type of source list item, which can be a route, off, or other. /// This is used to categorize the source list items in a room. /// The type is serialized to JSON and can be used to determine how the item should be displayed or handled in the UI. /// public enum eSourceListItemType { /// /// Represents a typical route. /// Route, /// /// Represents an off route. /// Off, /// /// Represents some other type of route /// Other, } /// /// Represents an item in a source list - can be deserialized into. /// public class SourceListItem { /// /// The key of the source item, which is used to identify it in the DeviceManager /// [JsonProperty("sourceKey")] public string SourceKey { get; set; } /// /// Returns the source Device for this, if it exists in DeviceManager /// [JsonIgnore] public Device SourceDevice { get { if (_SourceDevice == null) _SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device; return _SourceDevice; } } private Device _SourceDevice; /// /// Gets either the source's Name or this AlternateName property, if /// defined. If source doesn't exist, returns "Missing source" /// [JsonProperty("preferredName")] public string PreferredName { get { if (string.IsNullOrEmpty(Name)) { if (SourceDevice == null) return "---"; return SourceDevice.Name; } return Name; } } /// /// A name that will override the source's name on the UI /// [JsonProperty("name")] public string Name { get; set; } /// /// Specifies and icon for the source list item /// [JsonProperty("icon")] public string Icon { get; set; } /// /// Alternate icon /// [JsonProperty("altIcon")] public string AltIcon { get; set; } /// /// Indicates if the item should be included in the source list /// [JsonProperty("includeInSourceList")] public bool IncludeInSourceList { get; set; } /// /// Used to specify the order of the items in the source list when displayed /// [JsonProperty("order")] public int Order { get; set; } /// /// The key of the device for volume control /// [JsonProperty("volumeControlKey")] public string VolumeControlKey { get; set; } /// /// The type of source list item /// [JsonProperty("type")] [JsonConverter(typeof(StringEnumConverter))] public eSourceListItemType Type { get; set; } /// /// The list of routes to execute for this source list item /// [JsonProperty("routeList")] public List RouteList { get; set; } /// /// Indicates if this source should be disabled for sharing to the far end call participants via codec content /// [JsonProperty("disableCodecSharing")] public bool DisableCodecSharing { get; set; } /// /// Indicates if this source should be disabled for routing to a shared output /// [JsonProperty("disableRoutedSharing")] public bool DisableRoutedSharing { get; set; } /// /// /// [JsonProperty("destinations")] public List Destinations { get; set; } /// /// A means to reference a source list for this source item, in the event that this source has an input that can have sources routed to it /// [JsonProperty("sourceListKey")] public string SourceListKey { get; set; } /// /// Indicates if the device associated with this source is controllable /// [JsonProperty("isControllable")] public bool IsControllable { get; set; } /// /// Indicates that the device associated with this source has audio available /// [JsonProperty("isAudioSource")] public bool IsAudioSource { get; set; } /// /// Hide source on UI when Avanced Sharing is enabled /// [JsonProperty("disableAdvancedRouting")] public bool DisableAdvancedRouting { get; set; } /// /// Hide source on UI when Simpl Sharing is enabled /// [JsonProperty("disableSimpleRouting")] public bool DisableSimpleRouting { get; set; } /// /// The key of the device that provides video sync for this source item /// [JsonProperty("syncProviderDeviceKey")] public string SyncProviderDeviceKey { get; set; } /// /// Indicates if the source supports USB connections /// [JsonProperty("supportsUsb")] public bool SupportsUsb { get; set; } /// /// Default constructor for SourceListItem, initializes the Icon to "Blank" /// public SourceListItem() { Icon = "Blank"; } /// /// Returns a string representation of the SourceListItem, including the SourceKey and Name /// /// A string representation of the SourceListItem public override string ToString() { return $"{SourceKey}:{Name}"; } } /// /// Represents a route in a source list item, which defines the source and destination keys and the type of signal being routed /// public class SourceRouteListItem { /// /// The key of the source device to route from /// [JsonProperty("sourceKey")] public string SourceKey { get; set; } /// /// The key of the source port to route from /// [JsonProperty("sourcePortKey")] public string SourcePortKey { get; set; } /// /// The key of the destination device to route to /// [JsonProperty("destinationKey")] public string DestinationKey { get; set; } /// /// The key of the destination port to route to /// [JsonProperty("destinationPortKey")] public string DestinationPortKey { get; set; } /// /// The type of signal being routed, such as audio or video /// [JsonProperty("type")] public eRoutingSignalType Type { get; set; } } /// /// Defines the valid destination types for SourceListItems in a room /// public enum eSourceListItemDestinationTypes { /// /// Default display, used for the main video output in a room /// defaultDisplay, /// /// Left display /// leftDisplay, /// /// Right display /// rightDisplay, /// /// Center display /// centerDisplay, /// /// Program audio, used for the main audio output in a room /// programAudio, /// /// Codec content, used for sharing content to the far end in a video call /// codecContent, /// /// Front left display, used for rooms with multiple displays /// frontLeftDisplay, /// /// Front right display, used for rooms with multiple displays /// frontRightDisplay, /// /// Rear left display, used for rooms with multiple displays /// rearLeftDisplay, /// /// Rear right display, used for rooms with multiple displays /// rearRightDisplay, /// /// Auxiliary display 1, used for additional displays in a room /// auxDisplay1, /// /// Auxiliary display 2, used for additional displays in a room /// auxDisplay2, /// /// Auxiliary display 3, used for additional displays in a room /// auxDisplay3, /// /// Auxiliary display 4, used for additional displays in a room /// auxDisplay4, /// /// Auxiliary display 5, used for additional displays in a room /// auxDisplay5, /// /// Auxiliary display 6, used for additional displays in a room /// auxDisplay6, /// /// Auxiliary display 7, used for additional displays in a room /// auxDisplay7, /// /// Auxiliary display 8, used for additional displays in a room /// auxDisplay8, /// /// Auxiliary display 9, used for additional displays in a room /// auxDisplay9, /// /// Auxiliary display 10, used for additional displays in a room /// auxDisplay10, } }