From ed5bd360b476695d85b5c203decedb1735f15eb2 Mon Sep 17 00:00:00 2001 From: Neil Dorin Date: Thu, 14 Mar 2024 10:46:48 -0600 Subject: [PATCH] feat: adds more generic ISelectableItems and ISelectableItem interfaces and implements on new IHasInputs and IHasSurroundSoundModes --- .../DeviceTypeInterfaces/IHasInputs.cs | 12 +++++++--- .../IHasSurroundSoundModes.cs | 17 ++++++++++++++ .../DeviceTypeInterfaces/IInput.cs | 12 ---------- .../DeviceTypeInterfaces/ISelectableItem.cs | 19 ++++++++++++++++ .../DeviceTypeInterfaces/ISelectableItems.cs | 22 +++++++++++++++++++ 5 files changed, 67 insertions(+), 15 deletions(-) create mode 100644 src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasSurroundSoundModes.cs delete mode 100644 src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IInput.cs create mode 100644 src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItem.cs create mode 100644 src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItems.cs diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasInputs.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasInputs.cs index b0d14e9c..a9f59c35 100644 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasInputs.cs +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasInputs.cs @@ -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 { + + /// + /// Describes a device that has selectable inputs + /// public interface IHasInputs { - event EventHandler InputsUpdated; - IDictionary Inputs { get; } + ISelectableItems Inputs { get; } } -} \ No newline at end of file +} diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasSurroundSoundModes.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasSurroundSoundModes.cs new file mode 100644 index 00000000..83e48105 --- /dev/null +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IHasSurroundSoundModes.cs @@ -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 +{ + /// + /// Describes a device that has selectable surround sound modes + /// + /// the type to use as the key for each input item. Most likely an enum or string + public interface IHasSurroundSoundModes + { + ISelectableItems SurroundSoundModes { get; } + } +} diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IInput.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IInput.cs deleted file mode 100644 index fc49e390..00000000 --- a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/IInput.cs +++ /dev/null @@ -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(); - } -} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItem.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItem.cs new file mode 100644 index 00000000..525581d3 --- /dev/null +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItem.cs @@ -0,0 +1,19 @@ +using System; +using Newtonsoft.Json; +using PepperDash.Core; + +namespace PepperDash.Essentials.Core.DeviceTypeInterfaces +{ + + /// + /// Describes an item that can be selected + /// + public interface ISelectableItem : IKeyName + { + event EventHandler ItemUpdated; + + [JsonProperty("isSelected")] + bool IsSelected { get; } + void Select(); + } +} \ No newline at end of file diff --git a/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItems.cs b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItems.cs new file mode 100644 index 00000000..ba936963 --- /dev/null +++ b/src/PepperDash.Essentials.Core/DeviceTypeInterfaces/ISelectableItems.cs @@ -0,0 +1,22 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; + +namespace PepperDash.Essentials.Core.DeviceTypeInterfaces +{ + /// + /// Describes a collection of items that can be selected + /// + /// type for the keys in the collection. Probably a string or enum + public interface ISelectableItems + { + event EventHandler ItemsUpdated; + event EventHandler CurrentItemChanged; + + + Dictionary Items { get; } + + [JsonProperty("currentItem")] + string CurrentItem { get; } + } +} \ No newline at end of file