chore: move all files to file-scoped namespace

This commit is contained in:
Andrew Welker 2025-07-04 16:02:32 -05:00 committed by Neil Dorin
parent aaa5b0532b
commit 3ece4f0b7b
522 changed files with 39628 additions and 45678 deletions

View file

@ -13,253 +13,209 @@ using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
namespace PepperDash.Essentials.Core.CrestronIO;
/// <summary>
/// Represents a generic device controlled by relays
/// </summary>
[Description("Wrapper class for a Relay")]
public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput
{
/// <summary>
/// Represents a generic device controlled by relays
/// </summary>
[Description("Wrapper class for a Relay")]
public class GenericRelayDevice : EssentialsBridgeableDevice, ISwitchedOutput
public Relay RelayOutput { get; private set; }
public BoolFeedback OutputIsOnFeedback { get; private set; }
//Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor
public GenericRelayDevice(string key, Relay relay) :
base(key)
{
/// <summary>
/// The RelayOutput controlled by this device
/// </summary>
public Relay RelayOutput { get; private set; }
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
/// <summary>
/// Feedback to indicate whether the output is on
/// </summary>
public BoolFeedback OutputIsOnFeedback { get; private set; }
RelayOutput = relay;
RelayOutput.Register();
//Maintained for compatibility with PepperDash.Essentials.Core.Devices.CrestronProcessor
/// <summary>
/// Constructor for GenericRelayDevice
/// </summary>
/// <param name="key">key of the device</param>
/// <param name="relay">Relay output controlled by this device</param>
public GenericRelayDevice(string key, Relay relay) :
base(key)
RelayOutput.StateChange += RelayOutput_StateChange;
}
public GenericRelayDevice(string key, string name, Func<IOPortConfig, Relay> postActivationFunc,
IOPortConfig config)
: base(key, name)
{
OutputIsOnFeedback = new BoolFeedback(() => RelayOutput.State);
AddPostActivationAction(() =>
{
OutputIsOnFeedback = new BoolFeedback(new Func<bool>(() => RelayOutput.State));
RelayOutput = relay;
RelayOutput.Register();
RelayOutput.StateChange += RelayOutput_StateChange;
}
/// <summary>
/// Constructor for GenericRelayDevice
/// </summary>
/// <param name="key">key of the device</param>
/// <param name="name">name of the device</param>
/// <param name="postActivationFunc">function to get the relay output</param>
/// <param name="config">IO port configuration</param>
public GenericRelayDevice(string key, string name, Func<IOPortConfig, Relay> postActivationFunc,
IOPortConfig config)
: base(key, name)
{
OutputIsOnFeedback = new BoolFeedback(() => RelayOutput.State);
AddPostActivationAction(() =>
{
RelayOutput = postActivationFunc(config);
if (RelayOutput == null)
{
Debug.LogMessage(LogEventLevel.Information, this, "Unable to get parent relay device for device key {0} and port {1}", config.PortDeviceKey, config.PortNumber);
return;
}
RelayOutput.Register();
RelayOutput.StateChange += RelayOutput_StateChange;
});
}
#region PreActivate
private static Relay GetRelay(IOPortConfig dc)
{
IRelayPorts relayDevice;
if(dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsRelay)
{
Debug.LogMessage(LogEventLevel.Information, "Processor does not support relays");
return null;
}
relayDevice = Global.ControlSystem;
return relayDevice.RelayPorts[dc.PortNumber];
}
var essentialsDevice = DeviceManager.GetDeviceForKey(dc.PortDeviceKey);
if (essentialsDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "Device {0} was not found in Device Manager. Check configuration or for errors with device.", dc.PortDeviceKey);
return null;
}
relayDevice = essentialsDevice as IRelayPorts;
if (relayDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "Device {0} is not a valid relay parent. Please check configuration.", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber <= relayDevice.NumberOfRelayPorts)
{
return relayDevice.RelayPorts[dc.PortNumber];
}
Debug.LogMessage(LogEventLevel.Information, "Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
#endregion
#region Events
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
{
OutputIsOnFeedback.FireUpdate();
}
#endregion
#region Methods
/// <summary>
/// OpenRelay method
/// </summary>
public void OpenRelay()
{
RelayOutput.State = false;
}
/// <summary>
/// CloseRelay method
/// </summary>
public void CloseRelay()
{
RelayOutput.State = true;
}
/// <summary>
/// ToggleRelayState method
/// </summary>
public void ToggleRelayState()
{
if (RelayOutput.State == true)
OpenRelay();
else
CloseRelay();
}
#endregion
#region ISwitchedOutput Members
void ISwitchedOutput.On()
{
CloseRelay();
}
void ISwitchedOutput.Off()
{
OpenRelay();
}
#endregion
#region Bridge Linking
/// <summary>
/// LinkToApi method
/// </summary>
/// <inheritdoc />
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new GenericRelayControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
RelayOutput = postActivationFunc(config);
if (RelayOutput == null)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Relay is null", Key);
Debug.LogMessage(LogEventLevel.Information, this, "Unable to get parent relay device for device key {0} and port {1}", config.PortDeviceKey, config.PortNumber);
return;
}
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b =>
{
if (b)
CloseRelay();
else
OpenRelay();
});
// feedback for relay state
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
}
#endregion
#region Factory
/// <summary>
/// Represents a GenericRelayDeviceFactory
/// </summary>
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
{
/// <summary>
/// Constructor for GenericRelayDeviceFactory
/// </summary>
public GenericRelayDeviceFactory()
{
TypeNames = new List<string>() { "relayoutput" };
}
/// <summary>
/// BuildDevice method
/// </summary>
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Relay Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
if (props == null) return null;
var portDevice = new GenericRelayDevice(dc.Key, dc.Name, GetRelay, props);
return portDevice;
}
}
#endregion
RelayOutput.Register();
RelayOutput.StateChange += RelayOutput_StateChange;
});
}
#region PreActivate
private static Relay GetRelay(IOPortConfig dc)
{
IRelayPorts relayDevice;
if(dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsRelay)
{
Debug.LogMessage(LogEventLevel.Information, "Processor does not support relays");
return null;
}
relayDevice = Global.ControlSystem;
return relayDevice.RelayPorts[dc.PortNumber];
}
var essentialsDevice = DeviceManager.GetDeviceForKey(dc.PortDeviceKey);
if (essentialsDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "Device {0} was not found in Device Manager. Check configuration or for errors with device.", dc.PortDeviceKey);
return null;
}
relayDevice = essentialsDevice as IRelayPorts;
if (relayDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "Device {0} is not a valid relay parent. Please check configuration.", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber <= relayDevice.NumberOfRelayPorts)
{
return relayDevice.RelayPorts[dc.PortNumber];
}
Debug.LogMessage(LogEventLevel.Information, "Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
}
#endregion
#region Events
void RelayOutput_StateChange(Relay relay, RelayEventArgs args)
{
OutputIsOnFeedback.FireUpdate();
}
#endregion
#region Methods
public void OpenRelay()
{
RelayOutput.State = false;
}
public void CloseRelay()
{
RelayOutput.State = true;
}
public void ToggleRelayState()
{
if (RelayOutput.State == true)
OpenRelay();
else
CloseRelay();
}
#endregion
#region ISwitchedOutput Members
void ISwitchedOutput.On()
{
CloseRelay();
}
void ISwitchedOutput.Off()
{
OpenRelay();
}
#endregion
#region Bridge Linking
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new GenericRelayControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<GenericRelayControllerJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
if (RelayOutput == null)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Relay is null", Key);
return;
}
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
trilist.SetBoolSigAction(joinMap.Relay.JoinNumber, b =>
{
if (b)
CloseRelay();
else
OpenRelay();
});
// feedback for relay state
OutputIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Relay.JoinNumber]);
}
#endregion
#region Factory
public class GenericRelayDeviceFactory : EssentialsDeviceFactory<GenericRelayDevice>
{
public GenericRelayDeviceFactory()
{
TypeNames = new List<string>() { "relayoutput" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Relay Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
if (props == null) return null;
var portDevice = new GenericRelayDevice(dc.Key, dc.Name, GetRelay, props);
return portDevice;
}
}
#endregion
}

View file

@ -1,6 +1,4 @@

using System;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;

View file

@ -1,6 +1,4 @@

using System;
using System;
using System.Collections.Generic;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;

View file

@ -11,173 +11,176 @@ using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using Serilog.Events;
namespace PepperDash.Essentials.Core.CrestronIO
namespace PepperDash.Essentials.Core.CrestronIO;
/// <summary>
/// Represents a generic digital input deviced tied to a versiport
/// </summary>
public class GenericVersiportDigitalOutputDevice : EssentialsBridgeableDevice, IDigitalOutput
{
/// <summary>
/// Represents a generic digital input deviced tied to a versiport
/// </summary>
public class GenericVersiportDigitalOutputDevice : EssentialsBridgeableDevice, IDigitalOutput, IHasFeedback
public Versiport OutputPort { get; private set; }
public BoolFeedback OutputStateFeedback { get; private set; }
Func<bool> OutputStateFeedbackFunc
{
private Versiport outputPort;
/// <summary>
/// Gets or sets the OutputStateFeedback
/// </summary>
public BoolFeedback OutputStateFeedback { get; private set; }
/// <inheritdoc />
public FeedbackCollection<Feedback> Feedbacks { get; private set; } = new FeedbackCollection<Feedback>();
/// <summary>
/// Initializes a new instance of the <see cref="GenericVersiportDigitalOutputDevice"/> class.
/// </summary>
public GenericVersiportDigitalOutputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
base(key, name)
get
{
OutputStateFeedback = new BoolFeedback("outputState", () => outputPort.DigitalOut);
AddPostActivationAction(() =>
{
outputPort = postActivationFunc(config);
outputPort.Register();
if (!outputPort.SupportsDigitalOutput)
{
this.LogError("Device does not support configuration as a Digital Output");
return;
}
outputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalOutput);
outputPort.VersiportChange += OutputPort_VersiportChange;
});
return () => OutputPort.DigitalOut;
}
}
void OutputPort_VersiportChange(Versiport port, VersiportEventArgs args)
public GenericVersiportDigitalOutputDevice(string key, string name, Func<IOPortConfig, Versiport> postActivationFunc, IOPortConfig config) :
base(key, name)
{
OutputStateFeedback = new BoolFeedback(OutputStateFeedbackFunc);
AddPostActivationAction(() =>
{
this.LogDebug("Versiport change: {event}", args.Event);
OutputPort = postActivationFunc(config);
if (args.Event == eVersiportEvent.DigitalOutChange)
OutputStateFeedback.FireUpdate();
}
OutputPort.Register();
/// <summary>
/// Set value of the versiport digital output
/// </summary>
/// <param name="state">value to set the output to</param>
public void SetOutput(bool state)
{
if (!outputPort.SupportsDigitalOutput)
if (!OutputPort.SupportsDigitalOutput)
{
this.LogError("Versiport does not support Digital Output Mode");
Debug.LogMessage(LogEventLevel.Information, this, "Device does not support configuration as a Digital Output");
return;
}
outputPort.DigitalOut = state;
}
OutputPort.SetVersiportConfiguration(eVersiportConfiguration.DigitalOutput);
#region Bridge Linking
/// <summary>
/// LinkToApi method
/// </summary>
/// <inheritdoc />
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new IDigitalOutputJoinMap(joinStart);
OutputPort.VersiportChange += OutputPort_VersiportChange;
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
});
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IDigitalOutputJoinMap>(joinMapSerialized);
}
if (bridge != null)
void OutputPort_VersiportChange(Versiport port, VersiportEventArgs args)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Versiport change: {0}", args.Event);
if(args.Event == eVersiportEvent.DigitalOutChange)
OutputStateFeedback.FireUpdate();
}
/// <summary>
/// Set value of the versiport digital output
/// </summary>
/// <param name="state">value to set the output to</param>
public void SetOutput(bool state)
{
if (OutputPort.SupportsDigitalOutput)
{
bridge.AddJoinMap(Key, joinMap);
Debug.LogMessage(LogEventLevel.Information, this, "Passed the Check");
OutputPort.DigitalOut = state;
}
else
{
this.LogWarning("Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
Debug.LogMessage(LogEventLevel.Information, this, "Versiport does not support Digital Output Mode");
}
try
{
this.LogDebug("Linking to Trilist '{0}'", trilist.ID.ToString("X"));
}
// Link feedback for input state
OutputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OutputState.JoinNumber]);
trilist.SetBoolSigAction(joinMap.OutputState.JoinNumber, SetOutput);
}
catch (Exception e)
{
this.LogError("Unable to link device: {message}", e.Message);
this.LogDebug(e, "Stack Trace: ");
}
#region Bridge Linking
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new IDigitalOutputJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IDigitalOutputJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.LogMessage(LogEventLevel.Information, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
#endregion
/// <summary>
/// GetVersiportDigitalOutput method
/// </summary>
public static Versiport GetVersiportDigitalOutput(IOPortConfig dc)
try
{
Debug.LogMessage(LogEventLevel.Debug, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
// Link feedback for input state
OutputStateFeedback.LinkInputSig(trilist.BooleanInput[joinMap.OutputState.JoinNumber]);
trilist.SetBoolSigAction(joinMap.OutputState.JoinNumber, SetOutput);
}
catch (Exception e)
{
Debug.LogMessage(LogEventLevel.Debug, this, "Unable to link device '{0}'. Input is null", Key);
Debug.LogMessage(LogEventLevel.Debug, this, "Error: {0}", e);
}
}
#endregion
public static Versiport GetVersiportDigitalOutput(IOPortConfig dc)
{
IIOPorts ioPortDevice;
if (dc.PortDeviceKey.Equals("processor"))
{
if (!Global.ControlSystem.SupportsVersiport)
{
Debug.LogError("GetVersiportDigitalOutput: Processor does not support Versiports");
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Processor does not support Versiports");
return null;
}
return Global.ControlSystem.VersiPorts[dc.PortNumber];
ioPortDevice = Global.ControlSystem;
}
if (!(DeviceManager.GetDeviceForKey(dc.PortDeviceKey) is IIOPorts ioPortDevice))
else
{
Debug.LogError("GetVersiportDigitalOutput: Device {key} is not a valid device", dc.PortDeviceKey);
var ioPortDev = DeviceManager.GetDeviceForKey(dc.PortDeviceKey) as IIOPorts;
if (ioPortDev == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device {0} is not a valid device", dc.PortDeviceKey);
return null;
}
ioPortDevice = ioPortDev;
}
if (ioPortDevice == null)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device '0' is not a valid IOPorts Device", dc.PortDeviceKey);
return null;
}
if (dc.PortNumber > ioPortDevice.NumberOfVersiPorts)
{
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOutput: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
return null;
Debug.LogMessage(LogEventLevel.Information, "GetVersiportDigitalOuptut: Device {0} does not contain a port {1}", dc.PortDeviceKey, dc.PortNumber);
}
return ioPortDevice.VersiPorts[dc.PortNumber];
}
var port = ioPortDevice.VersiPorts[dc.PortNumber];
return port;
}
}
public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
{
public GenericVersiportDigitalOutputDeviceFactory()
{
TypeNames = new List<string>() { "versiportoutput" };
}
/// <summary>
/// Represents a GenericVersiportDigitalOutputDeviceFactory
/// </summary>
public class GenericVersiportDigitalOutputDeviceFactory : EssentialsDeviceFactory<GenericVersiportDigitalInputDevice>
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
/// <summary>
/// Initialize a new instance of the <see cref="GenericVersiportDigitalOutputDeviceFactory"/> class.
/// </summary>
public GenericVersiportDigitalOutputDeviceFactory()
{
TypeNames = new List<string>() { "versiportoutput" };
}
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Generic Versiport Device");
/// <inheritdoc />
public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
Debug.LogDebug("Factory Attempting to create new Generic Versiport Device");
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
var props = JsonConvert.DeserializeObject<IOPortConfig>(dc.Properties.ToString());
if (props == null) return null;
if (props == null) return null;
var portDevice = new GenericVersiportDigitalOutputDevice(dc.Key, dc.Name, GenericVersiportDigitalOutputDevice.GetVersiportDigitalOutput, props);
var portDevice = new GenericVersiportDigitalOutputDevice(dc.Key, dc.Name, GenericVersiportDigitalOutputDevice.GetVersiportDigitalOutput, props);
return portDevice;
}
return portDevice;
}
}

View file

@ -5,7 +5,9 @@ using System.Text;
using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.CrestronIO
namespace PepperDash.Essentials.Core.CrestronIO;
public interface IAnalogInput
{
/// <summary>
/// Defines the contract for IAnalogInput

View file

@ -1,19 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;

namespace PepperDash.Essentials.Core.CrestronIO;
namespace PepperDash.Essentials.Core.CrestronIO
/// <summary>
/// Represents a device that provides digital input
/// </summary>
public interface IDigitalInput
{
/// <summary>
/// Represents a device that provides digital input
/// Feedback to indicate the state of the input
/// </summary>
public interface IDigitalInput
{
/// <summary>
/// Feedback to indicate the state of the input
/// </summary>
BoolFeedback InputStateFeedback { get; }
}
}
BoolFeedback InputStateFeedback { get; }
}

View file

@ -4,7 +4,12 @@ using System.Linq;
using System.Text;
using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core.CrestronIO
namespace PepperDash.Essentials.Core.CrestronIO;
/// <summary>
/// Represents a device that provides digital input
/// </summary>
public interface IDigitalOutput
{
/// <summary>
/// Represents a device that provides digital input

View file

@ -6,7 +6,12 @@ using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
namespace PepperDash.Essentials.Core
namespace PepperDash.Essentials.Core;
/// <summary>
/// Defines the contract for a class that has Cresnet branches
/// </summary>
public interface IHasCresnetBranches
{
/// <summary>
/// Defines the contract for IHasCresnetBranches

View file

@ -1,5 +1,4 @@

using System;
using System.Collections.Generic;
using System.Linq;

View file

@ -6,37 +6,36 @@ using Crestron.SimplSharp;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.CrestronIO
namespace PepperDash.Essentials.Core.CrestronIO;
/// <summary>
/// Describes an output capable of switching on and off
/// </summary>
public interface ISwitchedOutput
{
/// <summary>
/// Describes an output capable of switching on and off
/// Feedback to indicate the state of the output
/// </summary>
public interface ISwitchedOutput
{
/// <summary>
/// Feedback to indicate whether the output is on
/// </summary>
BoolFeedback OutputIsOnFeedback {get;}
/// <summary>
/// Turns the output on
/// </summary>
void On();
/// <summary>
/// Turns the output off
/// </summary>
void Off();
}
BoolFeedback OutputIsOnFeedback {get;}
/// <summary>
/// Describes a collection of switched outputs
/// Turns the output on
/// </summary>
public interface ISwitchedOutputCollection
{
/// <summary>
/// Dictionary of switched outputs by their port number
/// </summary>
Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; }
}
void On();
/// <summary>
/// Turns the output off
/// </summary>
void Off();
}
/// <summary>
/// Defines the contract for a class that has a collection of switched outputs
/// </summary>
public interface ISwitchedOutputCollection
{
/// <summary>
/// Collection of switched outputs, indexed by their output number
/// </summary>
Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; }
}