Compare commits

...

13 Commits

Author SHA1 Message Date
AECohn
e8276c4165 Merge pull request #1259 from PepperDash/routing-updates
fix: check for `SecondaryAudio | Video`
2025-04-24 11:13:05 -04:00
Andrew Welker
817b5eccb5 fix: explicit flag checks for clarity
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-04-24 10:08:29 -05:00
Andrew Welker
702443f953 fix: check for SecondaryAudio | Video
In some scenarios when working with NVX, a route is intended to use the
secondary audio (NAX) path instead of the primary audio path. A route
that's both `Video` and `SecondaryAudio` should be considered a
dual-path route instead of a single path.
2025-04-24 09:55:22 -05:00
Andrew Welker
1306247c32 Merge pull request #1256 from PepperDash/lighting-interface-fix
fix: ILightingScenesDynamic inherits from ILightingScenes
2025-04-18 12:44:12 -05:00
Andrew Welker
d3d7b400ae Merge branch 'selectable-items-interfaces' into lighting-interface-fix 2025-04-18 12:29:36 -05:00
Andrew Welker
9db980ead1 fix: ILightingScenesDynamic inherits from ILightingScenes 2025-04-18 11:36:05 -05:00
Andrew Welker
c9c3a74f2f fix: add ISelectableItems<TKey,TValue> interface 2025-04-17 09:19:34 -05:00
Neil Dorin
d99095e8ce Merge pull request #1254 from PepperDash/lighting-scene-updates 2025-04-14 09:53:18 -06:00
Andrew Welker
60e705ea8b refactor: change accessiblity & naming for ILightingScenesMessenger 2025-04-14 10:49:27 -05:00
Andrew Welker
e86ab8fa8b 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
2025-04-14 10:45:43 -05:00
Neil Dorin
d8c7e3cfc7 Merge pull request #1250 from PepperDash/generic-comm-monitor-issues 2025-04-11 12:49:39 -06:00
Andrew Welker
eeb106c489 fix: use semaphore for thread safety in Start method 2025-04-11 13:45:04 -05:00
Andrew Welker
c1d62ea5d4 chore: update local build version to 2.4.0-local 2025-04-11 13:44:26 -05:00
7 changed files with 47 additions and 25 deletions

View File

@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Version>2.0.0-local</Version>
<Version>2.4.0-local</Version>
<InformationalVersion>$(Version)</InformationalVersion>
<Authors>PepperDash Technology</Authors>
<Company>PepperDash Technology</Company>

View File

@@ -4,19 +4,24 @@ 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>
public interface ISelectableItems<TKey, TValue> where TValue : ISelectableItem
{
event EventHandler ItemsUpdated;
event EventHandler CurrentItemChanged;
[JsonProperty("items")]
Dictionary<TKey, ISelectableItem> Items { get; set; }
Dictionary<TKey, TValue> Items { get; set; }
[JsonProperty("currentItem")]
TKey CurrentItem { get; set; }
}
/// <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> : ISelectableItems<TKey, ISelectableItem>
{
}
}

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 : ILightingScenes
{
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

@@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Core
private Timer PollTimer;
private SemaphoreSlim semaphore = new SemaphoreSlim(1, 1);
/// <summary>
/// GenericCommunicationMonitor constructor
///
@@ -201,14 +203,21 @@ namespace PepperDash.Essentials.Core
private void BeginPolling()
{
lock (_pollTimerLock)
try
{
if (PollTimer != null)
semaphore.Wait();
{
return;
}
if (PollTimer != null)
{
return;
}
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
PollTimer = new Timer(o => Poll(), null, 0, PollTime);
}
}
finally
{
semaphore.Release();
}
}

View File

@@ -69,7 +69,8 @@ namespace PepperDash.Essentials.Core
public static (RouteDescriptor, RouteDescriptor) GetRouteToSource(this IRoutingInputs destination, IRoutingOutputs source, eRoutingSignalType signalType, RoutingInputPort destinationPort, RoutingOutputPort sourcePort)
{
// if it's a single signal type, find the route
if (!signalType.HasFlag(eRoutingSignalType.AudioVideo))
if (!signalType.HasFlag(eRoutingSignalType.AudioVideo) &&
!(signalType.HasFlag(eRoutingSignalType.Video) && signalType.HasFlag(eRoutingSignalType.SecondaryAudio)))
{
var singleTypeRouteDescriptor = new RouteDescriptor(source, destination, destinationPort, signalType);
Debug.LogMessage(LogEventLevel.Debug, "Attempting to build source route from {sourceKey} of type {type}", destination, source.Key, signalType);

View File

@@ -8,15 +8,14 @@ namespace PepperDash.Essentials.AppServer.Messengers
{
public class ILightingScenesMessenger : MessengerBase
{
protected ILightingScenes Device { get; private set; }
private ILightingScenes lightingScenesDevice;
public ILightingScenesMessenger(string key, ILightingScenes device, string messagePath)
: base(key, messagePath, device as IKeyName)
{
Device = device ?? throw new ArgumentNullException("device");
Device.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
lightingScenesDevice = device ?? throw new ArgumentNullException("device");
lightingScenesDevice.LightingSceneChange += new EventHandler<LightingSceneChangeEventArgs>(LightingDevice_LightingSceneChange);
}
private void LightingDevice_LightingSceneChange(object sender, LightingSceneChangeEventArgs e)
@@ -38,8 +37,13 @@ namespace PepperDash.Essentials.AppServer.Messengers
AddAction("/selectScene", (id, content) =>
{
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
{
Scenes = Device.LightingScenes,
CurrentLightingScene = Device.CurrentLightingScene
Scenes = lightingScenesDevice.LightingScenes,
CurrentLightingScene = lightingScenesDevice.CurrentLightingScene
};
PostStatusMessage(state);