mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 04:34:56 +00:00
fix: Changes LevelControlLists to AudioControlPointLists and modified IHasDspPresets
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
using Crestron.SimplSharpPro;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core.Config
|
||||||
|
{
|
||||||
|
public class AudioControlPointListItem
|
||||||
|
{
|
||||||
|
[JsonProperty("levelControls")]
|
||||||
|
public Dictionary<string, LevelControlListItem> LevelControls { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("presets")]
|
||||||
|
public Dictionary<string, PresetListItem> Presets { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,8 +25,8 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
[JsonProperty("destinationLists")]
|
[JsonProperty("destinationLists")]
|
||||||
public Dictionary<string, Dictionary<string, DestinationListItem>> DestinationLists { get; set; }
|
public Dictionary<string, Dictionary<string, DestinationListItem>> DestinationLists { get; set; }
|
||||||
|
|
||||||
[JsonProperty("levelControlLists")]
|
[JsonProperty("audioControlPointLists")]
|
||||||
public Dictionary<string, Dictionary<string, LevelControlListItem>> LevelControlLists { get; set; }
|
public Dictionary<string, Dictionary<string, AudioControlPointListItem>> AudioControlPointLists { get; set; }
|
||||||
|
|
||||||
[JsonProperty("tieLines")]
|
[JsonProperty("tieLines")]
|
||||||
public List<TieLineConfig> TieLines { get; set; }
|
public List<TieLineConfig> TieLines { get; set; }
|
||||||
@@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
Devices = new List<DeviceConfig>();
|
Devices = new List<DeviceConfig>();
|
||||||
SourceLists = new Dictionary<string, Dictionary<string, SourceListItem>>();
|
SourceLists = new Dictionary<string, Dictionary<string, SourceListItem>>();
|
||||||
DestinationLists = new Dictionary<string, Dictionary<string, DestinationListItem>>();
|
DestinationLists = new Dictionary<string, Dictionary<string, DestinationListItem>>();
|
||||||
LevelControlLists = new Dictionary<string, Dictionary<string, LevelControlListItem>>();
|
AudioControlPointLists = new Dictionary<string, Dictionary<string, AudioControlPointListItem>>();
|
||||||
TieLines = new List<TieLineConfig>();
|
TieLines = new List<TieLineConfig>();
|
||||||
JoinMaps = new Dictionary<string, JObject>();
|
JoinMaps = new Dictionary<string, JObject>();
|
||||||
}
|
}
|
||||||
@@ -72,16 +72,16 @@ namespace PepperDash.Essentials.Core.Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Retrieves a LevelControlList based on the key
|
/// Retrieves a AudioControlPointList based on the key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="key">key of the list to retrieve</param>
|
/// <param name="key">key of the list to retrieve</param>
|
||||||
/// <returns>LevelControlList if the key exists, null otherwise</returns>
|
/// <returns>AudioControlPointList if the key exists, null otherwise</returns>
|
||||||
public Dictionary<string, LevelControlListItem> GetLevelControlListForKey(string key)
|
public Dictionary<string, AudioControlPointListItem> GetAudioControlPointListForKey(string key)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(key) || !LevelControlLists.ContainsKey(key))
|
if (string.IsNullOrEmpty(key) || !AudioControlPointLists.ContainsKey(key))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return LevelControlLists[key];
|
return AudioControlPointLists[key];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public abstract class AudioControlListItemBase
|
||||||
|
{
|
||||||
|
[JsonProperty("parentDeviceKey")]
|
||||||
|
public string ParentDeviceKey { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("itemKey")]
|
||||||
|
public string ItemKey { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// A name that will override the items's name on the UI
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates if the item should be included in the user accessible list
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("includeInUserList")]
|
||||||
|
public bool IncludeInUserList { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Used to specify the order of the items in the source list when displayed
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("order")]
|
||||||
|
public int Order { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
|
||||||
public interface IHasDspPresets
|
|
||||||
{
|
|
||||||
List<IDspPreset> Presets { get; }
|
|
||||||
|
|
||||||
void RecallPreset(IDspPreset preset);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public interface IDspPreset
|
|
||||||
{
|
|
||||||
string Name { get; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
src/PepperDash.Essentials.Core/Devices/IDspPresets.cs
Normal file
12
src/PepperDash.Essentials.Core/Devices/IDspPresets.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using PepperDash.Core;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public interface IDspPresets
|
||||||
|
{
|
||||||
|
Dictionary<string, IKeyName> Presets { get; }
|
||||||
|
|
||||||
|
void RecallPreset(string key);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,13 +5,13 @@ using System.Text;
|
|||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
public class LevelControlListItem
|
public class LevelControlListItem : AudioControlListItemBase
|
||||||
{
|
{
|
||||||
[JsonProperty("deviceKey")]
|
|
||||||
public string DeviceKey { get; set; }
|
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public IBasicVolumeWithFeedback LevelControl
|
public IBasicVolumeWithFeedback LevelControl
|
||||||
@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_levelControl == null)
|
if (_levelControl == null)
|
||||||
_levelControl = DeviceManager.GetDeviceForKey(DeviceKey) as IBasicVolumeWithFeedback;
|
_levelControl = DeviceManager.GetDeviceForKey(ParentDeviceKey) as IBasicVolumeWithFeedback;
|
||||||
return _levelControl;
|
return _levelControl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -47,24 +47,6 @@ namespace PepperDash.Essentials.Core
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// A name that will override the items's name on the UI
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("name")]
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Indicates if the item should be included in the user accessible list
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("includeInUserList")]
|
|
||||||
public bool IncludeInUserList { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Used to specify the order of the items in the source list when displayed
|
|
||||||
/// </summary>
|
|
||||||
[JsonProperty("order")]
|
|
||||||
public int Order { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if the item is a level, mute , or both
|
/// Indicates if the item is a level, mute , or both
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
45
src/PepperDash.Essentials.Core/Devices/PresetListItem.cs
Normal file
45
src/PepperDash.Essentials.Core/Devices/PresetListItem.cs
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using PepperDash.Core;
|
||||||
|
|
||||||
|
|
||||||
|
namespace PepperDash.Essentials.Core
|
||||||
|
{
|
||||||
|
public class PresetListItem : AudioControlListItemBase
|
||||||
|
{
|
||||||
|
[JsonIgnore]
|
||||||
|
public IKeyName Preset
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_preset == null)
|
||||||
|
{
|
||||||
|
var parent = DeviceManager.GetDeviceForKey(ParentDeviceKey) as IDspPresets;
|
||||||
|
if (parent == null || !parent.Presets.ContainsKey(ItemKey))
|
||||||
|
return null;
|
||||||
|
_preset = parent.Presets[ItemKey];
|
||||||
|
}
|
||||||
|
return _preset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private IKeyName _preset;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name from the device if it implements IKeyName or else returns the Name property
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("preferredName")]
|
||||||
|
public string PreferredName
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(Name)) return Name;
|
||||||
|
|
||||||
|
else return Preset.Name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
|
||||||
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-416" />
|
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-419" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />
|
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />
|
||||||
|
|||||||
@@ -27,6 +27,6 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
|
||||||
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-416" />
|
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-419" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.20.42" />
|
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.20.42" />
|
||||||
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-416" />
|
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-419" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />
|
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />
|
||||||
|
|||||||
Reference in New Issue
Block a user