Compare commits

...

4 Commits

13 changed files with 138 additions and 61 deletions

View File

@@ -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; }
}
}

View File

@@ -25,8 +25,8 @@ namespace PepperDash.Essentials.Core.Config
[JsonProperty("destinationLists")]
public Dictionary<string, Dictionary<string, DestinationListItem>> DestinationLists { get; set; }
[JsonProperty("levelControlLists")]
public Dictionary<string, Dictionary<string, LevelControlListItem>> LevelControlLists { get; set; }
[JsonProperty("audioControlPointLists")]
public Dictionary<string, Dictionary<string, AudioControlPointListItem>> AudioControlPointLists { get; set; }
[JsonProperty("tieLines")]
public List<TieLineConfig> TieLines { get; set; }
@@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Core.Config
Devices = new List<DeviceConfig>();
SourceLists = new Dictionary<string, Dictionary<string, SourceListItem>>();
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>();
JoinMaps = new Dictionary<string, JObject>();
}
@@ -69,19 +69,19 @@ namespace PepperDash.Essentials.Core.Config
}
return DestinationLists[key];
}
}
/// <summary>
/// Retrieves a LevelControlList based on the key
/// Retrieves a AudioControlPointList based on the key
/// </summary>
/// <param name="key">key of the list to retrieve</param>
/// <returns>LevelControlList if the key exists, null otherwise</returns>
public Dictionary<string, LevelControlListItem> GetLevelControlListForKey(string key)
/// <returns>AudioControlPointList if the key exists, null otherwise</returns>
public Dictionary<string, AudioControlPointListItem> GetAudioControlPointListForKey(string key)
{
if (string.IsNullOrEmpty(key) || !LevelControlLists.ContainsKey(key))
if (string.IsNullOrEmpty(key) || !AudioControlPointLists.ContainsKey(key))
return null;
return LevelControlLists[key];
return AudioControlPointLists[key];
}
/// <summary>

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View 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);
}
}

View File

@@ -5,13 +5,13 @@ using System.Text;
using System.Threading.Tasks;
using Newtonsoft.Json;
using PepperDash.Core;
using PepperDash.Essentials.Core.Devices;
namespace PepperDash.Essentials.Core
{
public class LevelControlListItem
public class LevelControlListItem : AudioControlListItemBase
{
[JsonProperty("deviceKey")]
public string DeviceKey { get; set; }
[JsonIgnore]
public IBasicVolumeWithFeedback LevelControl
@@ -19,7 +19,7 @@ namespace PepperDash.Essentials.Core
get
{
if (_levelControl == null)
_levelControl = DeviceManager.GetDeviceForKey(DeviceKey) as IBasicVolumeWithFeedback;
_levelControl = DeviceManager.GetDeviceForKey(ParentDeviceKey) as IBasicVolumeWithFeedback;
return _levelControl;
}
}
@@ -34,8 +34,8 @@ namespace PepperDash.Essentials.Core
get
{
if (!string.IsNullOrEmpty(Name)) return Name;
else
{
else
{
if (LevelControl is IKeyName namedLevelControl)
{
if (namedLevelControl == null)
@@ -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>
/// Indicates if the item is a level, mute , or both
/// </summary>

View 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;
}
}
}
}

View File

@@ -23,7 +23,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-407" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-419" />
</ItemGroup>
<ItemGroup>
<None Include="Crestron\CrestronGenericBaseDevice.cs.orig" />

View File

@@ -198,8 +198,8 @@ namespace PepperDash.Essentials.Room.Config
public string SourceListKey { get; set; }
[JsonProperty("destinationListKey")]
public string DestinationListKey { get; set; }
[JsonProperty("levelControlListKey")]
public string LevelControlListKey { get; set; }
[JsonProperty("audioControlPointListKey")]
public string AudioControlPointListKey { get; set; }
[JsonProperty("defaultSourceItem")]
public string DefaultSourceItem { get; set; }

View File

@@ -110,12 +110,12 @@ namespace PepperDash.Essentials.Core
}
}
private string _levelControlListKey;
public string LevelControlListKey
private string _audioControlPointListKey;
public string AudioControlPointListKey
{
get
{
if (string.IsNullOrEmpty(_levelControlListKey))
if (string.IsNullOrEmpty(_audioControlPointListKey))
{
return _defaultListKey;
}
@@ -126,9 +126,9 @@ namespace PepperDash.Essentials.Core
}
protected set
{
if (value != _levelControlListKey)
if (value != _audioControlPointListKey)
{
_levelControlListKey = value;
_audioControlPointListKey = value;
}
}
}

View File

@@ -29,7 +29,7 @@ namespace PepperDash.Essentials.Core
string DestinationListKey { get; }
string LevelControlListKey { get; }
string AudioControlPointListKey { get; }
SecondsCountdownTimer ShutdownPromptTimer { get; }
int ShutdownPromptSeconds { get; }

View File

@@ -27,6 +27,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.ProgramLibrary" Version="2.20.42" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-407" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-419" />
</ItemGroup>
</Project>

View File

@@ -47,7 +47,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Crestron.SimplSharp.SDK.Program" Version="2.20.42" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-407" />
<PackageReference Include="PepperDashCore" Version="2.0.0-alpha-419" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PepperDash.Essentials.Core\PepperDash.Essentials.Core.csproj" />