feat: adds more generic ISelectableItems and ISelectableItem interfaces and implements on new IHasInputs and IHasSurroundSoundModes

This commit is contained in:
Neil Dorin
2024-03-14 10:46:48 -06:00
parent 4eeb2145ae
commit ed5bd360b4
5 changed files with 67 additions and 15 deletions

View File

@@ -1,11 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a device that has selectable inputs
/// </summary>
public interface IHasInputs
{
event EventHandler InputsUpdated;
IDictionary<string, IInput> Inputs { get; }
ISelectableItems<string> Inputs { get; }
}
}
}

View File

@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a device that has selectable surround sound modes
/// </summary>
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>
public interface IHasSurroundSoundModes<TKey>
{
ISelectableItems<TKey> SurroundSoundModes { get; }
}
}

View File

@@ -1,12 +0,0 @@
using System;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface IInput : IKeyName
{
event EventHandler InputUpdated;
bool IsSelected { get; }
void Select();
}
}

View File

@@ -0,0 +1,19 @@
using System;
using Newtonsoft.Json;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes an item that can be selected
/// </summary>
public interface ISelectableItem : IKeyName
{
event EventHandler ItemUpdated;
[JsonProperty("isSelected")]
bool IsSelected { get; }
void Select();
}
}

View File

@@ -0,0 +1,22 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Describes a collection of items that can be selected
/// </summary>
/// <typeparam name="TKey">type for the keys in the collection. Probably a string or enum</typeparam>
public interface ISelectableItems<TKey>
{
event EventHandler ItemsUpdated;
event EventHandler CurrentItemChanged;
Dictionary<TKey, ISelectableItem> Items { get; }
[JsonProperty("currentItem")]
string CurrentItem { get; }
}
}