diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/INumeric.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/INumeric.cs index 0294a0b5..62ea8b3f 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/INumeric.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/INumeric.cs @@ -1,5 +1,5 @@ using Crestron.SimplSharpPro.DeviceSupport; - +using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.SmartObjects; @@ -8,7 +8,7 @@ namespace PepperDash.Essentials.Core /// /// /// - public interface INumericKeypad + public interface INumericKeypad:IKeyed { void Digit0(bool pressRelease); void Digit1(bool pressRelease); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Presets/DevicePresets.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Presets/DevicePresets.cs index 84b3cbd3..55522cf0 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Presets/DevicePresets.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Presets/DevicePresets.cs @@ -7,6 +7,7 @@ using Newtonsoft.Json; using PepperDash.Core; //using SSMono.IO; +using PepperDash.Core.WebApi.Presets; namespace PepperDash.Essentials.Core.Presets { @@ -15,9 +16,13 @@ namespace PepperDash.Essentials.Core.Presets /// public class DevicePresetsModel : Device { - private CCriticalSection _fileOps = new CCriticalSection(); + public delegate void PresetChangedCallback(ISetTopBoxNumericKeypad device, string channel); + + private readonly CCriticalSection _fileOps = new CCriticalSection(); private readonly bool _initSuccess; + private ISetTopBoxNumericKeypad _setTopBox; + /// /// The methods on the STB device to call when dialing /// @@ -32,6 +37,8 @@ namespace PepperDash.Essentials.Core.Presets { try { + _setTopBox = setTopBox; + // Grab the digit functions from the device // If any fail, the whole thing fails peacefully _dialFunctions = new Dictionary>(10) @@ -76,6 +83,8 @@ namespace PepperDash.Essentials.Core.Presets _initSuccess = true; } + public event PresetChangedCallback PresetChanged; + public int PulseTime { get; set; } public int DigitSpacingMs { get; set; } public bool PresetsAreLoaded { get; private set; } @@ -172,6 +181,10 @@ namespace PepperDash.Essentials.Core.Presets } _dialIsRunning = false; }); + + if (_setTopBox == null) return; + + OnPresetChanged(_setTopBox, chanNum); } public void Dial(int presetNum, ISetTopBoxNumericKeypad setTopBox) @@ -201,9 +214,23 @@ namespace PepperDash.Essentials.Core.Presets _enterFunction = setTopBox.KeypadEnter; + OnPresetChanged(setTopBox, chanNum); + Dial(chanNum); } + private void OnPresetChanged(ISetTopBoxNumericKeypad setTopBox, string channel) + { + var handler = PresetChanged; + + if (handler == null) + { + return; + } + + handler(setTopBox, channel); + } + public void UpdatePreset(int index, PresetChannel preset) { if (index >= PresetsList.Count)