mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-09 09:45:06 +00:00
docs: XML comments for Devices.Common
This commit is contained in:
@@ -11,37 +11,53 @@ using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a BasicIrDisplay
|
||||
/// </summary>
|
||||
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
|
||||
/// <summary>
|
||||
/// Represents a BasicIrDisplay
|
||||
/// </summary>
|
||||
public class BasicIrDisplay : DisplayBase, IBasicVolumeControls, IBridgeAdvanced
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPort
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPort
|
||||
/// </summary>
|
||||
public IrOutputPortController IrPort { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPulseTime
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Gets or sets the IrPulseTime
|
||||
/// </summary>
|
||||
public ushort IrPulseTime { get; set; }
|
||||
|
||||
protected Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the power is on feedback function
|
||||
/// </summary>
|
||||
protected Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get { return () => _PowerIsOn; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is cooling down feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get { return () => _IsCoolingDown; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is warming up feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get { return () => _IsWarmingUp; }
|
||||
}
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicIrDisplay class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
/// <param name="port">The IR output port</param>
|
||||
/// <param name="irDriverFilepath">The path to the IR driver file</param>
|
||||
public BasicIrDisplay(string key, string name, IROutputPort port, string irDriverFilepath)
|
||||
: base(key, name)
|
||||
{
|
||||
@@ -53,74 +69,74 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
|
||||
InputPorts.AddRange(new RoutingPortCollection<RoutingInputPort>
|
||||
{
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi2), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi3), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Hdmi4), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Component1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.CompositeIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Video1), this, false),
|
||||
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
new RoutingInputPort(RoutingPortNames.AntennaIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
|
||||
eRoutingPortConnectionType.Hdmi, new Action(Antenna), this, false),
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi1 method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Hdmi1 method
|
||||
/// </summary>
|
||||
public void Hdmi1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi2 method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Hdmi2 method
|
||||
/// </summary>
|
||||
public void Hdmi2()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_2, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi3 method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Hdmi3 method
|
||||
/// </summary>
|
||||
public void Hdmi3()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_3, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Hdmi4 method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Hdmi4 method
|
||||
/// </summary>
|
||||
public void Hdmi4()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_HDMI_4, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Component1 method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Component1 method
|
||||
/// </summary>
|
||||
public void Component1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_COMPONENT_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Video1 method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Video1 method
|
||||
/// </summary>
|
||||
public void Video1()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_VIDEO_1, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Antenna method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Antenna method
|
||||
/// </summary>
|
||||
public void Antenna()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_ANTENNA, IrPulseTime);
|
||||
@@ -128,31 +144,31 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
|
||||
#region IPower Members
|
||||
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
|
||||
_PowerIsOn = true;
|
||||
_PowerIsOn = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
public override void PowerOff()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
_PowerIsOn = false;
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
public override void PowerToggle()
|
||||
{
|
||||
_PowerIsOn = false;
|
||||
_PowerIsOn = false;
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
|
||||
}
|
||||
|
||||
@@ -160,25 +176,25 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
|
||||
#region IBasicVolumeControls Members
|
||||
|
||||
/// <summary>
|
||||
/// VolumeUp method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// VolumeUp method
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_PLUS, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(IROutputStandardCommands.IROut_VOL_MINUS, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
IrPort.Pulse(IROutputStandardCommands.IROut_MUTE, 200);
|
||||
@@ -190,7 +206,8 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
new CTimer(o => {
|
||||
new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
IsWarmingUpFeedback.FireUpdate();
|
||||
}, 10000);
|
||||
@@ -213,13 +230,13 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
/// Typically called by the discovery routing algorithm.
|
||||
/// </summary>
|
||||
/// <param name="inputSelector">A delegate containing the input selector method to call</param>
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void ExecuteSwitch(object inputSelector)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Switching to input '{0}'", (inputSelector as Action).ToString());
|
||||
|
||||
Action finishSwitch = () =>
|
||||
{
|
||||
@@ -246,42 +263,45 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a BasicIrDisplayFactory
|
||||
/// </summary>
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
{
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
/// <summary>
|
||||
/// Represents a BasicIrDisplayFactory
|
||||
/// </summary>
|
||||
public class BasicIrDisplayFactory : EssentialsDeviceFactory<BasicIrDisplay>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the BasicIrDisplayFactory class
|
||||
/// </summary>
|
||||
public BasicIrDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "basicirdisplay" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new BasicIrDisplay Device");
|
||||
var ir = IRPortHelper.GetIrPort(dc.Properties);
|
||||
if (ir != null)
|
||||
{
|
||||
var display = new BasicIrDisplay(dc.Key, dc.Name, ir.Port, ir.FileName);
|
||||
display.IrPulseTime = 200; // Set default pulse time for IR commands.
|
||||
return display;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,38 +1,89 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Displays
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi1
|
||||
/// </summary>
|
||||
public interface IInputHdmi1 { void InputHdmi1(); }
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi1
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 1 input
|
||||
/// </summary>
|
||||
void InputHdmi1();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi2
|
||||
/// </summary>
|
||||
public interface IInputHdmi2 { void InputHdmi2(); }
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi2
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 2 input
|
||||
/// </summary>
|
||||
void InputHdmi2();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi3
|
||||
/// </summary>
|
||||
public interface IInputHdmi3 { void InputHdmi3(); }
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi3
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 3 input
|
||||
/// </summary>
|
||||
void InputHdmi3();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputHdmi4
|
||||
/// </summary>
|
||||
public interface IInputHdmi4 { void InputHdmi4(); }
|
||||
[Obsolete()]
|
||||
public interface IInputHdmi4
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to HDMI 4 input
|
||||
/// </summary>
|
||||
void InputHdmi4();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputDisplayPort1
|
||||
/// </summary>
|
||||
public interface IInputDisplayPort1 { void InputDisplayPort1(); }
|
||||
[Obsolete()]
|
||||
public interface IInputDisplayPort1
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to DisplayPort 1 input
|
||||
/// </summary>
|
||||
void InputDisplayPort1();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputDisplayPort2
|
||||
/// </summary>
|
||||
public interface IInputDisplayPort2 { void InputDisplayPort2(); }
|
||||
[Obsolete()]
|
||||
public interface IInputDisplayPort2
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to DisplayPort 2 input
|
||||
/// </summary>
|
||||
void InputDisplayPort2();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines the contract for IInputVga1
|
||||
/// </summary>
|
||||
public interface IInputVga1 { void InputVga1(); }
|
||||
[Obsolete()]
|
||||
public interface IInputVga1
|
||||
{
|
||||
/// <summary>
|
||||
/// Switches to VGA 1 input
|
||||
/// </summary>
|
||||
void InputVga1();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,16 +16,19 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
/// Represents a MockDisplay
|
||||
/// </summary>
|
||||
public class MockDisplay : TwoWayDisplayBase, IBasicVolumeWithFeedback, IBridgeAdvanced, IHasInputs<string>, IRoutingSinkWithSwitchingWithInputPort, IHasPowerControlWithFeedback
|
||||
{
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Inputs
|
||||
/// </summary>
|
||||
public ISelectableItems<string> Inputs { get; private set; }
|
||||
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
bool _PowerIsOn;
|
||||
bool _IsWarmingUp;
|
||||
bool _IsCoolingDown;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the power is on feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> PowerIsOnFeedbackFunc
|
||||
{
|
||||
get
|
||||
@@ -34,8 +37,12 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
{
|
||||
return _PowerIsOn;
|
||||
};
|
||||
} }
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the is cooling down feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsCoolingDownFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -45,7 +52,10 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
};
|
||||
}
|
||||
}
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
/// <summary>
|
||||
/// Gets the is warming up feedback function
|
||||
/// </summary>
|
||||
protected override Func<bool> IsWarmingUpFeedbackFunc
|
||||
{
|
||||
get
|
||||
{
|
||||
@@ -55,120 +65,128 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
};
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets the current input feedback function
|
||||
/// </summary>
|
||||
protected override Func<string> CurrentInputFeedbackFunc { get { return () => Inputs.CurrentItem; } }
|
||||
|
||||
int VolumeHeldRepeatInterval = 200;
|
||||
ushort VolumeInterval = 655;
|
||||
ushort _FakeVolumeLevel = 31768;
|
||||
bool _IsMuted;
|
||||
ushort _FakeVolumeLevel = 31768;
|
||||
bool _IsMuted;
|
||||
|
||||
public MockDisplay(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplay class
|
||||
/// </summary>
|
||||
/// <param name="key">The device key</param>
|
||||
/// <param name="name">The device name</param>
|
||||
public MockDisplay(string key, string name)
|
||||
: base(key, name)
|
||||
{
|
||||
Inputs = new MockDisplayInputs
|
||||
{
|
||||
Items = new Dictionary<string, ISelectableItem>
|
||||
{
|
||||
{ "HDMI1", new MockDisplayInput ( "HDMI1", "HDMI 1",this ) },
|
||||
{ "HDMI2", new MockDisplayInput ("HDMI2", "HDMI 2",this ) },
|
||||
{ "HDMI3", new MockDisplayInput ("HDMI3", "HDMI 3",this ) },
|
||||
{ "HDMI4", new MockDisplayInput ("HDMI4", "HDMI 4",this )},
|
||||
{ "DP", new MockDisplayInput ("DP", "DisplayPort", this ) }
|
||||
}
|
||||
{
|
||||
{ "HDMI1", new MockDisplayInput ( "HDMI1", "HDMI 1",this ) },
|
||||
{ "HDMI2", new MockDisplayInput ("HDMI2", "HDMI 2",this ) },
|
||||
{ "HDMI3", new MockDisplayInput ("HDMI3", "HDMI 3",this ) },
|
||||
{ "HDMI4", new MockDisplayInput ("HDMI4", "HDMI 4",this )},
|
||||
{ "DP", new MockDisplayInput ("DP", "DisplayPort", this ) }
|
||||
}
|
||||
};
|
||||
|
||||
Inputs.CurrentItemChanged += (o, a) => CurrentInputFeedback.FireUpdate();
|
||||
|
||||
var hdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI1", this);
|
||||
var hdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI2", this);
|
||||
var hdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI3", this);
|
||||
var hdmiIn4 = new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI4", this);
|
||||
var dpIn = new RoutingInputPort(RoutingPortNames.DisplayPortIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.DisplayPort, "DP", this);
|
||||
InputPorts.AddRange(new[] { hdmiIn1, hdmiIn2, hdmiIn3, hdmiIn4, dpIn });
|
||||
Inputs.CurrentItemChanged += (o, a) => CurrentInputFeedback.FireUpdate();
|
||||
|
||||
VolumeLevelFeedback = new IntFeedback(() => { return _FakeVolumeLevel; });
|
||||
MuteFeedback = new BoolFeedback("MuteOn", () => _IsMuted);
|
||||
var hdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI1", this);
|
||||
var hdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI2", this);
|
||||
var hdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI3", this);
|
||||
var hdmiIn4 = new RoutingInputPort(RoutingPortNames.HdmiIn4, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.Hdmi, "HDMI4", this);
|
||||
var dpIn = new RoutingInputPort(RoutingPortNames.DisplayPortIn, eRoutingSignalType.AudioVideo,
|
||||
eRoutingPortConnectionType.DisplayPort, "DP", this);
|
||||
InputPorts.AddRange(new[] { hdmiIn1, hdmiIn2, hdmiIn3, hdmiIn4, dpIn });
|
||||
|
||||
VolumeLevelFeedback = new IntFeedback("volume", () => { return _FakeVolumeLevel; });
|
||||
MuteFeedback = new BoolFeedback("muteOn", () => _IsMuted);
|
||||
|
||||
WarmupTime = 10000;
|
||||
CooldownTime = 10000;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
// Fake power-up cycle
|
||||
WarmupTimer = new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
_PowerIsOn = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, WarmupTime);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// PowerOn method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOn()
|
||||
{
|
||||
if (!PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsWarmingUp = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
// Fake power-up cycle
|
||||
WarmupTimer = new CTimer(o =>
|
||||
{
|
||||
_IsWarmingUp = false;
|
||||
_PowerIsOn = true;
|
||||
IsWarmingUpFeedback.InvokeFireUpdate();
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, WarmupTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOff()
|
||||
{
|
||||
// If a display has unreliable-power off feedback, just override this and
|
||||
// remove this check.
|
||||
if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
// Fake cool-down cycle
|
||||
CooldownTimer = new CTimer(o =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Cooldown timer ending", this);
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
/// <summary>
|
||||
/// PowerOff method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerOff()
|
||||
{
|
||||
// If a display has unreliable-power off feedback, just override this and
|
||||
// remove this check.
|
||||
if (PowerIsOnFeedback.BoolValue && !_IsWarmingUp && !_IsCoolingDown)
|
||||
{
|
||||
_IsCoolingDown = true;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
// Fake cool-down cycle
|
||||
CooldownTimer = new CTimer(o =>
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Cooldown timer ending", this);
|
||||
_IsCoolingDown = false;
|
||||
IsCoolingDownFeedback.InvokeFireUpdate();
|
||||
_PowerIsOn = false;
|
||||
PowerIsOnFeedback.InvokeFireUpdate();
|
||||
}, CooldownTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerToggle()
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue)
|
||||
PowerOff();
|
||||
else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue)
|
||||
PowerOn();
|
||||
}
|
||||
}, CooldownTime);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void ExecuteSwitch(object selector)
|
||||
{
|
||||
/// <summary>
|
||||
/// PowerToggle method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void PowerToggle()
|
||||
{
|
||||
if (PowerIsOnFeedback.BoolValue && !IsWarmingUpFeedback.BoolValue)
|
||||
PowerOff();
|
||||
else if (!PowerIsOnFeedback.BoolValue && !IsCoolingDownFeedback.BoolValue)
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// ExecuteSwitch method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override void ExecuteSwitch(object selector)
|
||||
{
|
||||
try
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "ExecuteSwitch: {0}", this, selector);
|
||||
|
||||
if (!_PowerIsOn)
|
||||
{
|
||||
PowerOn();
|
||||
}
|
||||
if (!_PowerIsOn)
|
||||
{
|
||||
PowerOn();
|
||||
}
|
||||
|
||||
if (!Inputs.Items.TryGetValue(selector.ToString(), out var input))
|
||||
return;
|
||||
@@ -184,13 +202,14 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
|
||||
if (inputPort == null)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Unable to find input port for selector {selector}", this, selector);
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Unable to find input port for selector {selector}", this, selector);
|
||||
return;
|
||||
}
|
||||
|
||||
Debug.LogMessage(LogEventLevel.Verbose, "Setting current input port to {inputPort}", this, inputPort);
|
||||
CurrentInputPort = inputPort;
|
||||
} catch (Exception ex)
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogMessage(ex, "Error making switch: {Exception}", this, ex);
|
||||
}
|
||||
@@ -201,14 +220,14 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
/// </summary>
|
||||
public void SetInput(string selector)
|
||||
{
|
||||
ISelectableItem currentInput = null;
|
||||
ISelectableItem currentInput = null;
|
||||
|
||||
try
|
||||
{
|
||||
currentInput = Inputs.Items.SingleOrDefault(Inputs => Inputs.Value.IsSelected).Value;
|
||||
}
|
||||
catch { }
|
||||
|
||||
try
|
||||
{
|
||||
currentInput = Inputs.Items.SingleOrDefault(Inputs => Inputs.Value.IsSelected).Value;
|
||||
}
|
||||
catch { }
|
||||
|
||||
|
||||
if (currentInput != null)
|
||||
{
|
||||
@@ -216,12 +235,12 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
currentInput.IsSelected = false;
|
||||
}
|
||||
|
||||
if (!Inputs.Items.TryGetValue(selector, out var input))
|
||||
if (!Inputs.Items.TryGetValue(selector, out var input))
|
||||
return;
|
||||
|
||||
input.IsSelected = true;
|
||||
input.IsSelected = true;
|
||||
|
||||
Inputs.CurrentItem = selector;
|
||||
Inputs.CurrentItem = selector;
|
||||
}
|
||||
|
||||
|
||||
@@ -232,37 +251,37 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
/// </summary>
|
||||
public IntFeedback VolumeLevelFeedback { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// SetVolume method
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
_FakeVolumeLevel = level;
|
||||
VolumeLevelFeedback.InvokeFireUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// SetVolume method
|
||||
/// </summary>
|
||||
public void SetVolume(ushort level)
|
||||
{
|
||||
_FakeVolumeLevel = level;
|
||||
VolumeLevelFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteOn method
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
_IsMuted = true;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// MuteOn method
|
||||
/// </summary>
|
||||
public void MuteOn()
|
||||
{
|
||||
_IsMuted = true;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteOff method
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
_IsMuted = false;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// MuteOff method
|
||||
/// </summary>
|
||||
public void MuteOff()
|
||||
{
|
||||
_IsMuted = false;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
/// <summary>
|
||||
/// Gets or sets the MuteFeedback
|
||||
/// </summary>
|
||||
public BoolFeedback MuteFeedback { get; private set; }
|
||||
|
||||
|
||||
#endregion
|
||||
@@ -273,74 +292,77 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
/// VolumeUp method
|
||||
/// </summary>
|
||||
public void VolumeUp(bool pressRelease)
|
||||
{
|
||||
{
|
||||
//while (pressRelease)
|
||||
//{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Down {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel + VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Down {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel + VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
/// <summary>
|
||||
/// VolumeDown method
|
||||
/// </summary>
|
||||
public void VolumeDown(bool pressRelease)
|
||||
{
|
||||
//while (pressRelease)
|
||||
//{
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Up {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel - VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
Debug.LogMessage(LogEventLevel.Verbose, this, "Volume Up {0}", pressRelease);
|
||||
if (pressRelease)
|
||||
{
|
||||
var newLevel = _FakeVolumeLevel - VolumeInterval;
|
||||
SetVolume((ushort)newLevel);
|
||||
CrestronEnvironment.Sleep(VolumeHeldRepeatInterval);
|
||||
}
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
_IsMuted = !_IsMuted;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
/// <summary>
|
||||
/// MuteToggle method
|
||||
/// </summary>
|
||||
public void MuteToggle()
|
||||
{
|
||||
_IsMuted = !_IsMuted;
|
||||
MuteFeedback.InvokeFireUpdate();
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
/// <summary>
|
||||
/// LinkToApi method
|
||||
/// </summary>
|
||||
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||
{
|
||||
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayFactory
|
||||
/// </summary>
|
||||
public class MockDisplayFactory : EssentialsDeviceFactory<MockDisplay>
|
||||
{
|
||||
public MockDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockdisplay" , "mockdisplay2" };
|
||||
}
|
||||
/// <summary>
|
||||
/// Represents a MockDisplayFactory
|
||||
/// </summary>
|
||||
public class MockDisplayFactory : EssentialsDeviceFactory<MockDisplay>
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplayFactory class
|
||||
/// </summary>
|
||||
public MockDisplayFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "mockdisplay", "mockdisplay2" };
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Mock Display Device");
|
||||
return new MockDisplay(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// BuildDevice method
|
||||
/// </summary>
|
||||
/// <inheritdoc />
|
||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||
{
|
||||
Debug.LogMessage(LogEventLevel.Debug, "Factory Attempting to create new Mock Display Device");
|
||||
return new MockDisplay(dc.Key, dc.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
{
|
||||
@@ -15,6 +11,9 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
{
|
||||
private Dictionary<string, ISelectableItem> _items;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the collection of selectable items
|
||||
/// </summary>
|
||||
public Dictionary<string, ISelectableItem> Items
|
||||
{
|
||||
get
|
||||
@@ -34,8 +33,11 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
|
||||
private string _currentItem;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the currently selected item
|
||||
/// </summary>
|
||||
public string CurrentItem
|
||||
{
|
||||
{
|
||||
get
|
||||
{
|
||||
return _currentItem;
|
||||
@@ -51,7 +53,13 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when the items collection is updated
|
||||
/// </summary>
|
||||
public event EventHandler ItemsUpdated;
|
||||
/// <summary>
|
||||
/// Occurs when the current item changes
|
||||
/// </summary>
|
||||
public event EventHandler CurrentItemChanged;
|
||||
}
|
||||
|
||||
@@ -63,7 +71,10 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
private MockDisplay _parent;
|
||||
|
||||
private bool _isSelected;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this input is selected
|
||||
/// </summary>
|
||||
public bool IsSelected
|
||||
{
|
||||
get
|
||||
@@ -91,8 +102,17 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
/// </summary>
|
||||
public string Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Occurs when this item is updated
|
||||
/// </summary>
|
||||
public event EventHandler ItemUpdated;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MockDisplayInput class
|
||||
/// </summary>
|
||||
/// <param name="key">The input key</param>
|
||||
/// <param name="name">The input name</param>
|
||||
/// <param name="parent">The parent mock display</param>
|
||||
public MockDisplayInput(string key, string name, MockDisplay parent)
|
||||
{
|
||||
Key = key;
|
||||
@@ -107,7 +127,7 @@ namespace PepperDash.Essentials.Devices.Common.Displays
|
||||
{
|
||||
if (!_parent.PowerIsOnFeedback.BoolValue) _parent.PowerOn();
|
||||
|
||||
foreach(var input in _parent.Inputs.Items)
|
||||
foreach (var input in _parent.Inputs.Items)
|
||||
{
|
||||
input.Value.IsSelected = input.Key == this.Key;
|
||||
}
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Crestron.SimplSharp;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using PepperDash.Core;
|
||||
using PepperDash.Essentials.Core;
|
||||
using PepperDash.Essentials.Core.Config;
|
||||
using PepperDash.Essentials.Core.CrestronIO;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
using PepperDash.Essentials.Devices.Common;
|
||||
using Serilog.Events;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
@@ -28,6 +25,9 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
ISwitchedOutput LowerRelay;
|
||||
ISwitchedOutput LatchedRelay;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the InUpPosition
|
||||
/// </summary>
|
||||
public bool InUpPosition
|
||||
{
|
||||
get { return _isInUpPosition; }
|
||||
@@ -41,10 +41,12 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
}
|
||||
|
||||
private bool _isInUpPosition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Type
|
||||
/// </summary>
|
||||
public eScreenLiftControlType Type { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Mode
|
||||
/// </summary>
|
||||
@@ -54,13 +56,20 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
/// Gets or sets the DisplayDeviceKey
|
||||
/// </summary>
|
||||
public string DisplayDeviceKey { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the IsInUpPosition
|
||||
/// </summary>
|
||||
public BoolFeedback IsInUpPosition { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Event that fires when the position changes
|
||||
/// </summary>
|
||||
public event EventHandler<EventArgs> PositionChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor for ScreenLiftController
|
||||
/// </summary>
|
||||
public ScreenLiftController(string key, string name, ScreenLiftControllerConfigProperties config)
|
||||
: base(key, name)
|
||||
{
|
||||
@@ -69,7 +78,7 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
Mode = Config.Mode;
|
||||
Type = Config.Type;
|
||||
|
||||
IsInUpPosition = new BoolFeedback(() => _isInUpPosition);
|
||||
IsInUpPosition = new BoolFeedback("isInUpPosition", () => _isInUpPosition);
|
||||
|
||||
switch (Mode)
|
||||
{
|
||||
@@ -206,14 +215,14 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
/// <summary>
|
||||
/// Attempts to get the port on teh specified device from config
|
||||
/// </summary>
|
||||
/// <param name="relayConfig"></param>
|
||||
/// <param name="relayKey"></param>
|
||||
/// <returns></returns>
|
||||
ISwitchedOutput GetSwitchedOutputFromDevice(string relayKey)
|
||||
{
|
||||
var portDevice = DeviceManager.GetDeviceForKey(relayKey);
|
||||
if (portDevice != null)
|
||||
{
|
||||
return (portDevice as ISwitchedOutput);
|
||||
return portDevice as ISwitchedOutput;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -238,58 +247,14 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ScreenLiftControllerConfigProperties
|
||||
/// </summary>
|
||||
public class ScreenLiftControllerConfigProperties
|
||||
{
|
||||
[JsonProperty("displayDeviceKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayDeviceKey
|
||||
/// </summary>
|
||||
public string DisplayDeviceKey { get; set; }
|
||||
|
||||
[JsonProperty("type")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
/// <summary>
|
||||
/// Gets or sets the Type
|
||||
/// </summary>
|
||||
public eScreenLiftControlType Type { get; set; }
|
||||
|
||||
[JsonProperty("mode")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
/// <summary>
|
||||
/// Gets or sets the Mode
|
||||
/// </summary>
|
||||
public eScreenLiftControlMode Mode { get; set; }
|
||||
|
||||
[JsonProperty("relays")]
|
||||
public Dictionary<string,ScreenLiftRelaysConfig> Relays { get; set; }
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Represents a ScreenLiftRelaysConfig
|
||||
/// </summary>
|
||||
public class ScreenLiftRelaysConfig
|
||||
{
|
||||
[JsonProperty("deviceKey")]
|
||||
/// <summary>
|
||||
/// Gets or sets the DeviceKey
|
||||
/// </summary>
|
||||
public string DeviceKey { get; set; }
|
||||
|
||||
[JsonProperty("pulseTimeInMs")]
|
||||
/// <summary>
|
||||
/// Gets or sets the PulseTimeInMs
|
||||
/// </summary>
|
||||
public int PulseTimeInMs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a ScreenLiftControllerFactory
|
||||
/// </summary>
|
||||
public class ScreenLiftControllerFactory : EssentialsDeviceFactory<RelayControlledShade>
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructor for ScreenLiftControllerFactory
|
||||
/// </summary>
|
||||
public ScreenLiftControllerFactory()
|
||||
{
|
||||
TypeNames = new List<string>() { "screenliftcontroller" };
|
||||
@@ -307,13 +272,4 @@ namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
return new ScreenLiftController(dc.Key, dc.Name, props);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration of eScreenLiftControlMode values
|
||||
/// </summary>
|
||||
public enum eScreenLiftControlMode
|
||||
{
|
||||
momentary,
|
||||
latched
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
using System.Collections.Generic;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a ScreenLiftControllerConfigProperties
|
||||
/// </summary>
|
||||
public class ScreenLiftControllerConfigProperties
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the DisplayDeviceKey
|
||||
/// </summary>
|
||||
[JsonProperty("displayDeviceKey")]
|
||||
public string DisplayDeviceKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Type
|
||||
/// </summary>
|
||||
[JsonProperty("type")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eScreenLiftControlType Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Mode
|
||||
/// </summary>
|
||||
[JsonProperty("mode")]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public eScreenLiftControlMode Mode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the Relays
|
||||
/// </summary>
|
||||
[JsonProperty("relays")]
|
||||
public Dictionary<string, ScreenLiftRelaysConfig> Relays { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a ScreenLiftRelaysConfig
|
||||
/// </summary>
|
||||
public class ScreenLiftRelaysConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the DeviceKey
|
||||
/// </summary>
|
||||
[JsonProperty("deviceKey")]
|
||||
public string DeviceKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the PulseTimeInMs
|
||||
/// </summary>
|
||||
[JsonProperty("pulseTimeInMs")]
|
||||
public int PulseTimeInMs { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
namespace PepperDash.Essentials.Devices.Common.Shades
|
||||
{
|
||||
/// <summary>
|
||||
/// Enumeration of eScreenLiftControlMode values
|
||||
/// </summary>
|
||||
public enum eScreenLiftControlMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Momentary control mode for screen lift
|
||||
/// </summary>
|
||||
momentary,
|
||||
/// <summary>
|
||||
/// Latched control mode for screen lift
|
||||
/// </summary>
|
||||
latched
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user