Merge branch 'feature-2.0.0/interface-updates' of https://github.com/PepperDash/Essentials into feature-2.0.0/interface-updates

This commit is contained in:
Andrew Welker
2024-03-19 11:08:42 -05:00
9 changed files with 255 additions and 45 deletions

View File

@@ -1,11 +1,24 @@
using System;
using PepperDash.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
public interface IHasInputs
/// <summary>
/// Describes a device that has selectable inputs
/// </summary>
/// <typeparam name="TKey">the type to use as the key for each input item. Most likely an enum or string</typeparam>\
/// <example>
/// See MockDisplay for example implemntation
/// </example>
public interface IHasInputs<TKey, TSelector>: IKeyName
{
event EventHandler InputsUpdated;
IDictionary<string, IInput> Inputs { get; }
ISelectableItems<TKey> Inputs { get; }
void SetInput(TSelector selector);
}
}
}

View File

@@ -0,0 +1,20 @@
using PepperDash.Core;
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, TSelector>: IKeyName
{
ISelectableItems<TKey> SurroundSoundModes { get; }
void SetSurroundSoundMode(TSelector selector);
}
}

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; set; }
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;
[JsonProperty("items")]
Dictionary<TKey, ISelectableItem> Items { get; set; }
[JsonProperty("currentItem")]
string CurrentItem { get; set; }
}
}

View File

@@ -371,9 +371,9 @@ namespace PepperDash.Essentials
{
try
{
Debug.Console(0, $"Checking if type {type.Name} is IPluginDeviceFactory");
//Debug.Console(0, $"Checking if type {type.Name} is IPluginDeviceFactory");
Debug.Console(0, $"{type.Name} is plugin factory: {typeof(IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract}");
//Debug.Console(0, $"{type.Name} is plugin factory: {typeof(IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract}");
if (typeof (IPluginDeviceFactory).IsAssignableFrom(type) && !type.IsAbstract)
{