fix: update lighting interfaces & messenger

Added the `ILightingScenesDynamic` interface to add an event for devices that support retrieving scene data from the lighting system at runtime. Also added the `sortOrder` property for the `LightingScene` type to allow for control over the sort order of scenes on the UI
This commit is contained in:
Andrew Welker
2025-04-14 10:45:43 -05:00
parent d8c7e3cfc7
commit e86ab8fa8b
3 changed files with 13 additions and 7 deletions

View File

@@ -1,10 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using PepperDash.Core;
namespace PepperDash.Essentials.Core.Lighting
{
@@ -23,6 +18,11 @@ namespace PepperDash.Essentials.Core.Lighting
}
public interface ILightingScenesDynamic
{
event EventHandler LightingScenesUpdated;
}
/// <summary>
/// Requirements for a device that implements master raise/lower
/// </summary>

View File

@@ -26,6 +26,9 @@ namespace PepperDash.Essentials.Core.Lighting
}
}
[JsonProperty("sortOrder", NullValueHandling = NullValueHandling.Ignore)]
public int SortOrder { get; set; }
[JsonIgnore]
public BoolFeedback IsActiveFeedback { get; set; }

View File

@@ -15,8 +15,6 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
Device = device ?? throw new ArgumentNullException("device");
Device.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
}
private void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventArgs e)
@@ -40,6 +38,11 @@ namespace PepperDash.Essentials.AppServer.Messengers
var s = content.ToObject<LightingScene>();
Device.SelectScene(s);
});
if(!(Device is ILightingScenesDynamic lightingScenesDynamic))
return;
lightingScenesDynamic.LightingScenesUpdated += (s, e) => SendFullStatus();
}