Compare commits

..

1 Commits

Author SHA1 Message Date
Neil Dorin
5b45a5caa6 feat: add audioDeviceKey property to SourceListItem and mark Destinations as obsolete 2026-04-01 13:23:14 -06:00
3 changed files with 15 additions and 142 deletions

View File

@@ -1,122 +0,0 @@
using System;
namespace PepperDash.Essentials.Core.DeviceTypeInterfaces
{
/// <summary>
/// Interface for network switches that support VLAN assignment on individual ports.
/// </summary>
public interface INetworkSwitchVlanManager
{
/// <summary>
/// Returns the current access VLAN ID configured on the port.
/// Return -1 when the value is unavailable (e.g. the switch has not been polled yet
/// or the implementation does not support VLAN queries).
/// </summary>
/// <param name="port">Switch port identifier</param>
/// <returns>VLAN ID or -1 when unavailable</returns>
int GetPortCurrentVlan(string port);
/// <summary>
/// Changes the access VLAN of a single switch port.
/// The implementation is responsible for entering/exiting privileged/config mode.
/// </summary>
/// <param name="port">Switch port identifier (e.g. "1/0/3" for Netgear, "gi1/0/3" for Cisco)</param>
/// <param name="vlanId">Target VLAN ID (1-4093)</param>
void SetPortVlan(string port, uint vlanId);
}
/// <summary>
/// Interface for network switches that support Power over Ethernet (PoE) control on individual ports.
/// </summary>
public interface INetworkSwitchPoeManager
{
/// <summary>
/// Enables or disables PoE power delivery on a single switch port.
/// The implementation is responsible for entering/exiting privileged/config mode.
/// </summary>
/// <param name="port">Switch port identifier</param>
/// <param name="enabled">True to enable PoE; false to disable PoE</param>
void SetPortPoeState(string port, bool enabled);
}
/// <summary>
/// Standardized interface for network switch devices that support per-port PoE control
/// and VLAN assignment.
/// </summary>
public interface INetworkSwitchPoeVlanManager : INetworkSwitchVlanManager, INetworkSwitchPoeManager
{
/// <summary>
/// Event that is raised when the state of a switch port changes, such as a VLAN change or PoE state change.
/// </summary>
event EventHandler<NetworkSwitchPortEventArgs> PortStateChanged;
}
/// <summary>
/// Event arguments for port state changes on a network switch, such as VLAN changes or PoE state changes.
/// </summary>
public class NetworkSwitchPortEventArgs : EventArgs
{
/// <summary>
/// The identifier of the port that changed state (e.g. "1/0/3" for Netgear, "gi1/0/3" for Cisco).
/// </summary>
public string Port { get; private set; }
/// <summary>
/// The type of event that occurred on the port (e.g. VLAN change, PoE enabled/disabled).
/// </summary>
public NetworkSwitchPortEventType EventType { get; private set; }
/// <summary>
/// Constructor for NetworkSwitchPortEventArgs
/// </summary>
/// <param name="port">The identifier of the port that changed state</param>
/// <param name="eventType">The type of event that occurred on the port</param>
public NetworkSwitchPortEventArgs(string port, NetworkSwitchPortEventType eventType)
{
Port = port;
EventType = eventType;
}
}
/// <summary>
/// Event arguments for port state changes on a network switch, such as VLAN changes or PoE state changes.
/// </summary>
public enum NetworkSwitchPortEventType
{
/// <summary>
/// Indicates that the type of event is unknown or cannot be determined.
/// </summary>
Unknown,
/// <summary>
/// Indicates that a VLAN change is in progress on the port, either through a call to SetPortVlan or an external change detected by polling.
/// </summary>
VlanChangeInProgress,
/// <summary>
/// Indicates that the access VLAN on a port has changed, either through a successful call to SetPortVlan
/// </summary>
VlanChanged,
/// <summary>
/// Indicates that PoE is being disabled on the port, either through a call to SetPortPoeState or an external change detected by polling.
/// </summary>
PoeDisableInProgress,
/// <summary>
/// Indicates that the PoE state on a port has changed, either through a successful call to SetPortPoeState
/// </summary>
PoEDisabled,
/// <summary>
/// Indicates that PoE is being enabled on the port, either through a call to SetPortPoeState or an external change detected by polling.
/// </summary>
PoeEnableInProgress,
/// <summary>
/// Indicates that the PoE state on a port has changed, either through a successful call to SetPortPoeState
/// </summary>
PoEEnabled
}
}

View File

@@ -138,7 +138,9 @@ namespace PepperDash.Essentials.Core
///
/// </summary>
[JsonProperty("destinations")]
[Obsolete("This property is obsolete and will be removed in future versions.")]
public List<eSourceListItemDestinationTypes> Destinations { get; set; }
/// <summary>
/// A means to reference a source list for this source item, in the event that this source has an input that can have sources routed to it
/// </summary>
@@ -175,6 +177,12 @@ namespace PepperDash.Essentials.Core
[JsonProperty("syncProviderDeviceKey")]
public string SyncProviderDeviceKey { get; set; }
/// <summary>
/// The key of the device that provides audio for this source item
/// </summary>
[JsonProperty("audioDeviceKey")]
public string AudioDeviceKey { get; set; }
/// <summary>
/// Indicates if the source supports USB connections
/// </summary>

View File

@@ -1,14 +1,13 @@
using System;
using System.Linq;
using System.Linq;
using Crestron.SimplSharp.WebScripting;
using Newtonsoft.Json;
using PepperDash.Core.Web.RequestHandlers;
namespace PepperDash.Essentials.Core.Web.RequestHandlers
{
/// <summary>
/// Represents a GetFeedbacksForDeviceRequestHandler
/// </summary>
/// <summary>
/// Represents a GetFeedbacksForDeviceRequestHandler
/// </summary>
public class GetFeedbacksForDeviceRequestHandler : WebApiBaseRequestHandler
{
/// <summary>
@@ -52,20 +51,8 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
var device = DeviceManager.GetDeviceForKey(deviceObj.ToString()) as IHasFeedback;
if (device == null)
{
context.Response.StatusCode = 200;
context.Response.StatusDescription = "OK";
context.Response.ContentType = "application/json";
context.Response.ContentEncoding = System.Text.Encoding.UTF8;
var resp = new
{
BoolValues = Array.Empty<object>(),
IntValues = Array.Empty<object>(),
SerialValues = Array.Empty<object>()
};
var respJs = JsonConvert.SerializeObject(resp, Formatting.Indented);
context.Response.Write(respJs, false);
context.Response.StatusCode = 404;
context.Response.StatusDescription = "Not Found";
context.Response.End();
return;
@@ -89,7 +76,7 @@ namespace PepperDash.Essentials.Core.Web.RequestHandlers
Value = feedback.IntValue
};
var stringFeedback =
var stringFeedback =
from feedback in device.Feedbacks.OfType<StringFeedback>()
where !string.IsNullOrEmpty(feedback.Key)
select new