mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
@@ -1,10 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using Crestron.SimplSharp;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core.Lighting
|
namespace PepperDash.Essentials.Core.Lighting
|
||||||
{
|
{
|
||||||
@@ -23,6 +18,11 @@ namespace PepperDash.Essentials.Core.Lighting
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public interface ILightingScenesDynamic
|
||||||
|
{
|
||||||
|
event EventHandler LightingScenesUpdated;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Requirements for a device that implements master raise/lower
|
/// Requirements for a device that implements master raise/lower
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -26,6 +26,9 @@ namespace PepperDash.Essentials.Core.Lighting
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[JsonProperty("sortOrder", NullValueHandling = NullValueHandling.Ignore)]
|
||||||
|
public int SortOrder { get; set; }
|
||||||
|
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public BoolFeedback IsActiveFeedback { get; set; }
|
public BoolFeedback IsActiveFeedback { get; set; }
|
||||||
|
|
||||||
|
|||||||
@@ -8,15 +8,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
public class ILightingScenesMessenger : MessengerBase
|
public class ILightingScenesMessenger : MessengerBase
|
||||||
{
|
{
|
||||||
protected ILightingScenes Device { get; private set; }
|
private ILightingScenes lightingScenesDevice;
|
||||||
|
|
||||||
public ILightingScenesMessenger(string key, ILightingScenes device, string messagePath)
|
public ILightingScenesMessenger(string key, ILightingScenes device, string messagePath)
|
||||||
: base(key, messagePath, device as IKeyName)
|
: base(key, messagePath, device as IKeyName)
|
||||||
{
|
{
|
||||||
Device = device ?? throw new ArgumentNullException("device");
|
lightingScenesDevice = device ?? throw new ArgumentNullException("device");
|
||||||
Device.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
|
|
||||||
|
|
||||||
|
|
||||||
|
lightingScenesDevice.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventArgs e)
|
private void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventArgs e)
|
||||||
@@ -38,8 +37,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
AddAction("/selectScene", (id, content) =>
|
AddAction("/selectScene", (id, content) =>
|
||||||
{
|
{
|
||||||
var s = content.ToObject<LightingScene>();
|
var s = content.ToObject<LightingScene>();
|
||||||
Device.SelectScene(s);
|
lightingScenesDevice.SelectScene(s);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if(!(lightingScenesDevice is ILightingScenesDynamic lightingScenesDynamic))
|
||||||
|
return;
|
||||||
|
|
||||||
|
lightingScenesDynamic.LightingScenesUpdated += (s, e) => SendFullStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -47,8 +51,8 @@ namespace PepperDash.Essentials.AppServer.Messengers
|
|||||||
{
|
{
|
||||||
var state = new LightingBaseStateMessage
|
var state = new LightingBaseStateMessage
|
||||||
{
|
{
|
||||||
Scenes = Device.LightingScenes,
|
Scenes = lightingScenesDevice.LightingScenes,
|
||||||
CurrentLightingScene = Device.CurrentLightingScene
|
CurrentLightingScene = lightingScenesDevice.CurrentLightingScene
|
||||||
};
|
};
|
||||||
|
|
||||||
PostStatusMessage(state);
|
PostStatusMessage(state);
|
||||||
|
|||||||
Reference in New Issue
Block a user