fix: add some options to destination type enum

This commit is contained in:
Andrew Welker
2024-07-26 06:48:23 -05:00
parent 7a263a644a
commit e374f7b50f

View File

@@ -1,128 +1,121 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters; using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public enum eSourceListItemType public enum eSourceListItemType
{ {
Route, Off, Other, SomethingAwesomerThanThese Route, Off, Other, SomethingAwesomerThanThese
} }
/// <summary> /// <summary>
/// Represents an item in a source list - can be deserialized into. /// Represents an item in a source list - can be deserialized into.
/// </summary> /// </summary>
public class SourceListItem public class SourceListItem
{ {
[JsonProperty("sourceKey")] [JsonProperty("sourceKey")]
public string SourceKey { get; set; } public string SourceKey { get; set; }
/// <summary> /// <summary>
/// Returns the source Device for this, if it exists in DeviceManager /// Returns the source Device for this, if it exists in DeviceManager
/// </summary> /// </summary>
[JsonIgnore] [JsonIgnore]
public Device SourceDevice public Device SourceDevice
{ {
get get
{ {
if (_SourceDevice == null) if (_SourceDevice == null)
_SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device; _SourceDevice = DeviceManager.GetDeviceForKey(SourceKey) as Device;
return _SourceDevice; return _SourceDevice;
} }
} }
Device _SourceDevice;
/// <summary> private Device _SourceDevice;
/// Gets either the source's Name or this AlternateName property, if
/// defined. If source doesn't exist, returns "Missing source"
/// </summary>
[JsonProperty("preferredName")]
public string PreferredName
{
get
{
if (string.IsNullOrEmpty(Name))
{
if (SourceDevice == null)
return "---";
return SourceDevice.Name;
}
return Name;
}
}
/// <summary> /// <summary>
/// A name that will override the source's name on the UI /// Gets either the source's Name or this AlternateName property, if
/// </summary> /// defined. If source doesn't exist, returns "Missing source"
[JsonProperty("name")] /// </summary>
public string Name { get; set; } [JsonProperty("preferredName")]
public string PreferredName
{
get
{
if (string.IsNullOrEmpty(Name))
{
if (SourceDevice == null)
return "---";
return SourceDevice.Name;
}
return Name;
}
}
/// <summary>
/// A name that will override the source's name on the UI
/// </summary>
[JsonProperty("name")]
public string Name { get; set; }
/// <summary> /// <summary>
/// Specifies and icon for the source list item /// Specifies and icon for the source list item
/// </summary> /// </summary>
[JsonProperty("icon")] [JsonProperty("icon")]
public string Icon { get; set; } public string Icon { get; set; }
/// <summary> /// <summary>
/// Alternate icon /// Alternate icon
/// </summary> /// </summary>
[JsonProperty("altIcon")] [JsonProperty("altIcon")]
public string AltIcon { get; set; } public string AltIcon { get; set; }
/// <summary> /// <summary>
/// Indicates if the item should be included in the source list /// Indicates if the item should be included in the source list
/// </summary> /// </summary>
[JsonProperty("includeInSourceList")] [JsonProperty("includeInSourceList")]
public bool IncludeInSourceList { get; set; } public bool IncludeInSourceList { get; set; }
/// <summary> /// <summary>
/// Used to specify the order of the items in the source list when displayed /// Used to specify the order of the items in the source list when displayed
/// </summary> /// </summary>
[JsonProperty("order")] [JsonProperty("order")]
public int Order { get; set; } public int Order { get; set; }
/// <summary> /// <summary>
/// The key of the device for volume control /// The key of the device for volume control
/// </summary> /// </summary>
[JsonProperty("volumeControlKey")] [JsonProperty("volumeControlKey")]
public string VolumeControlKey { get; set; } public string VolumeControlKey { get; set; }
/// <summary> /// <summary>
/// The type of source list item /// The type of source list item
/// </summary> /// </summary>
[JsonProperty("type")] [JsonProperty("type")]
[JsonConverter(typeof(StringEnumConverter))] [JsonConverter(typeof(StringEnumConverter))]
public eSourceListItemType Type { get; set; } public eSourceListItemType Type { get; set; }
/// <summary> /// <summary>
/// The list of routes to execute for this source list item /// The list of routes to execute for this source list item
/// </summary> /// </summary>
[JsonProperty("routeList")] [JsonProperty("routeList")]
public List<SourceRouteListItem> RouteList { get; set; } public List<SourceRouteListItem> RouteList { get; set; }
/// <summary> /// <summary>
/// Indicates if this source should be disabled for sharing to the far end call participants via codec content /// Indicates if this source should be disabled for sharing to the far end call participants via codec content
/// </summary> /// </summary>
[JsonProperty("disableCodecSharing")] [JsonProperty("disableCodecSharing")]
public bool DisableCodecSharing { get; set; } public bool DisableCodecSharing { get; set; }
/// <summary> /// <summary>
/// Indicates if this source should be disabled for routing to a shared output /// Indicates if this source should be disabled for routing to a shared output
/// </summary> /// </summary>
[JsonProperty("disableRoutedSharing")] [JsonProperty("disableRoutedSharing")]
public bool DisableRoutedSharing { get; set; } public bool DisableRoutedSharing { get; set; }
[JsonProperty("destinations")] [JsonProperty("destinations")]
public List<eSourceListItemDestinationTypes> Destinations { get; set; } public List<eSourceListItemDestinationTypes> Destinations { get; set; }
@@ -156,10 +149,10 @@ namespace PepperDash.Essentials.Core
[JsonProperty("disableSimpleRouting")] [JsonProperty("disableSimpleRouting")]
public bool DisableSimpleRouting { get; set; } public bool DisableSimpleRouting { get; set; }
public SourceListItem() public SourceListItem()
{ {
Icon = "Blank"; Icon = "Blank";
} }
public override string ToString() public override string ToString()
{ {
@@ -167,23 +160,23 @@ namespace PepperDash.Essentials.Core
} }
} }
public class SourceRouteListItem public class SourceRouteListItem
{ {
[JsonProperty("sourceKey")] [JsonProperty("sourceKey")]
public string SourceKey { get; set; } public string SourceKey { get; set; }
[JsonProperty("sourcePortKey")] [JsonProperty("sourcePortKey")]
public string SourcePortKey { get; set; } public string SourcePortKey { get; set; }
[JsonProperty("destinationKey")] [JsonProperty("destinationKey")]
public string DestinationKey { get; set; } public string DestinationKey { get; set; }
[JsonProperty("destinationPortKey")] [JsonProperty("destinationPortKey")]
public string DestinationPortKey { get; set; } public string DestinationPortKey { get; set; }
[JsonProperty("type")] [JsonProperty("type")]
public eRoutingSignalType Type { get; set; } public eRoutingSignalType Type { get; set; }
} }
/// <summary> /// <summary>
/// Defines the valid destination types for SourceListItems in a room /// Defines the valid destination types for SourceListItems in a room
@@ -193,8 +186,12 @@ namespace PepperDash.Essentials.Core
defaultDisplay, defaultDisplay,
leftDisplay, leftDisplay,
rightDisplay, rightDisplay,
centerDisplay, centerDisplay,
programAudio, programAudio,
codecContent codecContent,
frontLeftDisplay,
frontRightDisplay,
rearLeftDisplay,
rearRightDisplay,
} }
} }