Merge pull request #477 from PepperDash/feature/update-ipower-interface

Feature/update ipower interface
This commit is contained in:
Andrew Welker
2020-11-09 21:11:32 -06:00
committed by GitHub
21 changed files with 3010 additions and 2886 deletions

View File

@@ -273,15 +273,18 @@ namespace PepperDash.Essentials.Fusion
// Display to fusion room sigs // Display to fusion room sigs
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction; FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction; FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
var defaultDisplayTwoWay = defaultDisplay as IHasPowerControlWithFeedback;
if (defaultDisplayTwoWay != null)
{
defaultDisplayTwoWay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
}
if (defaultDisplay is IDisplayUsage) if (defaultDisplay is IDisplayUsage)
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig); (defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
MapDisplayToRoomJoins(1, 158, defaultDisplay); MapDisplayToRoomJoins(1, 158, defaultDisplay);
var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key)); var deviceConfig = ConfigReader.ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(defaultDisplay.Key));
//Check for existing asset in GUIDs collection //Check for existing asset in GUIDs collection
@@ -302,8 +305,18 @@ namespace PepperDash.Essentials.Fusion
var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId); var dispAsset = FusionRoom.CreateStaticAsset(tempAsset.SlotNumber, tempAsset.Name, "Display", tempAsset.InstanceId);
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction; dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction; dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
var defaultTwoWayDisplay = defaultDisplay as IHasPowerControlWithFeedback;
if (defaultTwoWayDisplay != null)
{
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
if (defaultDisplay is IDisplayUsage)
(defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
defaultTwoWayDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
}
// Use extension methods // Use extension methods
dispAsset.TrySetMakeModel(defaultDisplay); dispAsset.TrySetMakeModel(defaultDisplay);
dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay); dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
@@ -325,12 +338,17 @@ namespace PepperDash.Essentials.Fusion
// Power on // Power on
var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig); var defaultDisplayPowerOn = FusionRoom.CreateOffsetBoolSig((uint)joinOffset, displayName + "Power On", eSigIoMask.InputOutputSig);
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); }); defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOn(); });
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
// Power Off // Power Off
var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig); var defaultDisplayPowerOff = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 1, displayName + "Power Off", eSigIoMask.InputOutputSig);
defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ; defaultDisplayPowerOn.OutputSig.UserObject = new Action<bool>(b => { if (!b) display.PowerOff(); }); ;
display.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
var displayTwoWay = display as IHasPowerControlWithFeedback;
if (displayTwoWay != null)
{
displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
displayTwoWay.PowerIsOnFeedback.LinkInputSig(defaultDisplayPowerOn.InputSig);
}
// Current Source // Current Source
var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig); var defaultDisplaySourceNone = FusionRoom.CreateOffsetBoolSig((uint)joinOffset + 8, displayName + "Source None", eSigIoMask.InputOutputSig);

View File

@@ -283,19 +283,23 @@ namespace PepperDash.Essentials
if (disp != null) if (disp != null)
{ {
// Link power, warming, cooling to display // Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) => var dispTwoWay = disp as IHasPowerControlWithFeedback;
{ if (dispTwoWay != null)
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) {
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
{ {
if (!disp.PowerIsOnFeedback.BoolValue) if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
disp.CurrentSourceInfo = null; {
OnFeedback.FireUpdate(); if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
} disp.CurrentSourceInfo = null;
if (disp.PowerIsOnFeedback.BoolValue) OnFeedback.FireUpdate();
{ }
SetDefaultLevels(); if (dispTwoWay.PowerIsOnFeedback.BoolValue)
} {
}; SetDefaultLevels();
}
};
}
disp.IsWarmingUpFeedback.OutputChange += (o, a) => disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{ {
@@ -579,8 +583,8 @@ namespace PepperDash.Essentials
if (dest is IPower) if (dest is IHasPowerControl)
(dest as IPower).PowerOff(); (dest as IHasPowerControl).PowerOff();
} }
else else
{ {

View File

@@ -176,15 +176,19 @@ namespace PepperDash.Essentials
if (disp != null) if (disp != null)
{ {
// Link power, warming, cooling to display // Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) => var dispTwoWay = disp as IHasPowerControlWithFeedback;
{ if (dispTwoWay != null)
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) {
{ dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
if (!disp.PowerIsOnFeedback.BoolValue) {
CurrentSourceInfo = null; if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
OnFeedback.FireUpdate(); {
} if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
}; CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
};
}
disp.IsWarmingUpFeedback.OutputChange += (o, a) => disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{ {
@@ -495,8 +499,8 @@ namespace PepperDash.Essentials
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{ {
dest.ReleaseRoute(); dest.ReleaseRoute();
if (dest is IPower) if (dest is IHasPowerControl)
(dest as IPower).PowerOff(); (dest as IHasPowerControl).PowerOff();
} }
else else
{ {

View File

@@ -190,6 +190,12 @@ namespace PepperDash.Essentials
(_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control"); (_CurrentSourceInfo.SourceDevice as IInUseTracking).InUseTracker.AddUser(this, "control");
if (handler != null) if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange); handler(_CurrentSourceInfo, ChangeType.DidChange);
var vc = VideoCodec as IHasExternalSourceSwitching;
if (vc != null)
{
vc.SetSelectedSource(_CurrentSourceInfo.SourceKey);
}
} }
} }
SourceListItem _CurrentSourceInfo; SourceListItem _CurrentSourceInfo;
@@ -273,19 +279,23 @@ namespace PepperDash.Essentials
if (disp != null) if (disp != null)
{ {
// Link power, warming, cooling to display // Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) => var dispTwoWay = disp as IHasPowerControlWithFeedback;
{ if (dispTwoWay != null)
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) {
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
{ {
if (!disp.PowerIsOnFeedback.BoolValue) if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
CurrentSourceInfo = null; {
OnFeedback.FireUpdate(); if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
} CurrentSourceInfo = null;
if (disp.PowerIsOnFeedback.BoolValue) OnFeedback.FireUpdate();
{ }
SetDefaultLevels(); if (dispTwoWay.PowerIsOnFeedback.BoolValue)
} {
}; SetDefaultLevels();
}
};
}
disp.IsWarmingUpFeedback.OutputChange += (o, a) => disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{ {
@@ -640,8 +650,8 @@ namespace PepperDash.Essentials
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{ {
dest.ReleaseRoute(); dest.ReleaseRoute();
if (dest is IPower) if (dest is IHasPowerControl)
(dest as IPower).PowerOff(); (dest as IHasPowerControl).PowerOff();
} }
else else
{ {

View File

@@ -305,9 +305,9 @@ namespace PepperDash.Essentials
TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, EndMeetingPress); TriList.SetSigFalseAction(UIBoolJoin.ShowPowerOffPress, EndMeetingPress);
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () => TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
{ {
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower) if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IHasPowerControl)
(CurrentRoom.DefaultDisplay as IPower).PowerToggle(); (CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle();
}); });
base.Show(); base.Show();
@@ -984,8 +984,8 @@ namespace PepperDash.Essentials
(previousDev as IDvr).UnlinkButtons(TriList); (previousDev as IDvr).UnlinkButtons(TriList);
if (previousDev is INumericKeypad) if (previousDev is INumericKeypad)
(previousDev as INumericKeypad).UnlinkButtons(TriList); (previousDev as INumericKeypad).UnlinkButtons(TriList);
if (previousDev is IPower) if (previousDev is IHasPowerControl)
(previousDev as IPower).UnlinkButtons(TriList); (previousDev as IHasPowerControl).UnlinkButtons(TriList);
if (previousDev is ITransport) if (previousDev is ITransport)
(previousDev as ITransport).UnlinkButtons(TriList); (previousDev as ITransport).UnlinkButtons(TriList);
//if (previousDev is IRadio) //if (previousDev is IRadio)
@@ -1044,8 +1044,8 @@ namespace PepperDash.Essentials
(dev as IDvr).LinkButtons(TriList); (dev as IDvr).LinkButtons(TriList);
if (dev is INumericKeypad) if (dev is INumericKeypad)
(dev as INumericKeypad).LinkButtons(TriList); (dev as INumericKeypad).LinkButtons(TriList);
if (dev is IPower) if (dev is IHasPowerControl)
(dev as IPower).LinkButtons(TriList); (dev as IHasPowerControl).LinkButtons(TriList);
if (dev is ITransport) if (dev is ITransport)
(dev as ITransport).LinkButtons(TriList); (dev as ITransport).LinkButtons(TriList);
//if (dev is IRadio) //if (dev is IRadio)

View File

@@ -319,8 +319,8 @@ namespace PepperDash.Essentials
TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () => TriList.SetSigFalseAction(UIBoolJoin.DisplayPowerTogglePress, () =>
{ {
if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IPower) if (CurrentRoom != null && CurrentRoom.DefaultDisplay is IHasPowerControl)
(CurrentRoom.DefaultDisplay as IPower).PowerToggle(); (CurrentRoom.DefaultDisplay as IHasPowerControl).PowerToggle();
}); });
SetupNextMeetingTimer(); SetupNextMeetingTimer();
@@ -1293,8 +1293,8 @@ namespace PepperDash.Essentials
(previousDev as IDvr).UnlinkButtons(TriList); (previousDev as IDvr).UnlinkButtons(TriList);
if (previousDev is INumericKeypad) if (previousDev is INumericKeypad)
(previousDev as INumericKeypad).UnlinkButtons(TriList); (previousDev as INumericKeypad).UnlinkButtons(TriList);
if (previousDev is IPower) if (previousDev is IHasPowerControl)
(previousDev as IPower).UnlinkButtons(TriList); (previousDev as IHasPowerControl).UnlinkButtons(TriList);
if (previousDev is ITransport) if (previousDev is ITransport)
(previousDev as ITransport).UnlinkButtons(TriList); (previousDev as ITransport).UnlinkButtons(TriList);
} }
@@ -1351,8 +1351,8 @@ namespace PepperDash.Essentials
(dev as IDvr).LinkButtons(TriList); (dev as IDvr).LinkButtons(TriList);
if (dev is INumericKeypad) if (dev is INumericKeypad)
(dev as INumericKeypad).LinkButtons(TriList); (dev as INumericKeypad).LinkButtons(TriList);
if (dev is IPower) if (dev is IHasPowerControl)
(dev as IPower).LinkButtons(TriList); (dev as IHasPowerControl).LinkButtons(TriList);
if (dev is ITransport) if (dev is ITransport)
(dev as ITransport).LinkButtons(TriList); (dev as ITransport).LinkButtons(TriList);
} }

View File

@@ -6,7 +6,7 @@ using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IPower, ITransport, IUiDisplayInfo public interface IDiscPlayerControls : IColor, IDPad, INumericKeypad, IHasPowerControl, ITransport, IUiDisplayInfo
{ {
} }

View File

@@ -14,35 +14,64 @@ using PepperDash.Essentials.Core.SmartObjects;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// /// Defines the ability to power a device on and off
/// </summary> /// </summary>
[Obsolete("Will be replaced by IHasPowerControlWithFeedback")]
public interface IPower public interface IPower
{ {
void PowerOn(); void PowerOn();
void PowerOff(); void PowerOff();
void PowerToggle(); void PowerToggle();
BoolFeedback PowerIsOnFeedback { get; } BoolFeedback PowerIsOnFeedback { get; }
} }
/// <summary>
/// Adds feedback for current power state
/// </summary>
public interface IHasPowerControlWithFeedback : IHasPowerControl
{
BoolFeedback PowerIsOnFeedback { get; }
}
/// <summary>
/// Defines the ability to power a device on and off
/// </summary>
public interface IHasPowerControl
{
void PowerOn();
void PowerOff();
void PowerToggle();
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public static class IPowerExtensions public static class IHasPowerControlExtensions
{ {
public static void LinkButtons(this IPower dev, BasicTriList triList) public static void LinkButtons(this IHasPowerControl dev, BasicTriList triList)
{ {
triList.SetSigFalseAction(101, dev.PowerOn); triList.SetSigFalseAction(101, dev.PowerOn);
triList.SetSigFalseAction(102, dev.PowerOff); triList.SetSigFalseAction(102, dev.PowerOff);
triList.SetSigFalseAction(103, dev.PowerToggle); triList.SetSigFalseAction(103, dev.PowerToggle);
dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
var fbdev = dev as IHasPowerControlWithFeedback;
if (fbdev != null)
{
fbdev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
}
} }
public static void UnlinkButtons(this IPower dev, BasicTriList triList) public static void UnlinkButtons(this IHasPowerControl dev, BasicTriList triList)
{ {
triList.ClearBoolSigAction(101); triList.ClearBoolSigAction(101);
triList.ClearBoolSigAction(102); triList.ClearBoolSigAction(102);
triList.ClearBoolSigAction(103); triList.ClearBoolSigAction(103);
dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
var fbdev = dev as IHasPowerControlWithFeedback;
if (fbdev != null)
{
fbdev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
}
} }
} }
} }

View File

@@ -20,10 +20,12 @@ namespace PepperDash.Essentials.Core
public IrOutputPortController IrPort { get; private set; } public IrOutputPortController IrPort { get; private set; }
public ushort IrPulseTime { get; set; } public ushort IrPulseTime { get; set; }
protected override Func<bool> PowerIsOnFeedbackFunc public BoolFeedback PowerIsOnFeedback { get; private set; }
{
get { return () => _PowerIsOn; } protected Func<bool> PowerIsOnFeedbackFunc
} {
get { return () => _PowerIsOn; }
}
protected override Func<bool> IsCoolingDownFeedbackFunc protected override Func<bool> IsCoolingDownFeedbackFunc
{ {
get { return () => _IsCoolingDown; } get { return () => _IsCoolingDown; }
@@ -33,7 +35,7 @@ namespace PepperDash.Essentials.Core
get { return () => _IsWarmingUp; } get { return () => _IsWarmingUp; }
} }
bool _PowerIsOn; bool _PowerIsOn;
bool _IsWarmingUp; bool _IsWarmingUp;
bool _IsCoolingDown; bool _IsCoolingDown;
@@ -43,11 +45,14 @@ namespace PepperDash.Essentials.Core
IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath); IrPort = new IrOutputPortController(key + "-ir", port, irDriverFilepath);
DeviceManager.AddDevice(IrPort); DeviceManager.AddDevice(IrPort);
PowerIsOnFeedback.OutputChange += (o, a) => { PowerIsOnFeedback = new BoolFeedback(PowerIsOnFeedbackFunc);
Debug.Console(2, this, "Power on={0}", _PowerIsOn);
if (_PowerIsOn) StartWarmingTimer(); PowerIsOnFeedback.OutputChange += (o, a) =>
else StartCoolingTimer(); {
}; Debug.Console(2, this, "Power on={0}", _PowerIsOn);
if (_PowerIsOn) StartWarmingTimer();
else StartCoolingTimer();
};
IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp); IsWarmingUpFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Warming up={0}", _IsWarmingUp);
IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown); IsCoolingDownFeedback.OutputChange += (o, a) => Debug.Console(2, this, "Cooling down={0}", _IsCoolingDown);
@@ -110,21 +115,21 @@ namespace PepperDash.Essentials.Core
public override void PowerOn() public override void PowerOn()
{ {
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime); IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
_PowerIsOn = true; _PowerIsOn = true;
PowerIsOnFeedback.FireUpdate(); PowerIsOnFeedback.FireUpdate();
} }
public override void PowerOff() public override void PowerOff()
{ {
_PowerIsOn = false; _PowerIsOn = false;
PowerIsOnFeedback.FireUpdate(); PowerIsOnFeedback.FireUpdate();
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime); IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
} }
public override void PowerToggle() public override void PowerToggle()
{ {
_PowerIsOn = false; _PowerIsOn = false;
PowerIsOnFeedback.FireUpdate(); PowerIsOnFeedback.FireUpdate();
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime); IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
} }

View File

@@ -1,131 +1,117 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM; using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints; using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IHasPowerControl, IWarmingCooling, IUsageTracking
{ {
public event SourceInfoChangeHandler CurrentSourceChange; public event SourceInfoChangeHandler CurrentSourceChange;
public string CurrentSourceInfoKey { get; set; } public string CurrentSourceInfoKey { get; set; }
public SourceListItem CurrentSourceInfo public SourceListItem CurrentSourceInfo
{ {
get get
{ {
return _CurrentSourceInfo; return _CurrentSourceInfo;
} }
set set
{ {
if (value == _CurrentSourceInfo) return; if (value == _CurrentSourceInfo) return;
var handler = CurrentSourceChange; var handler = CurrentSourceChange;
if (handler != null) if (handler != null)
handler(_CurrentSourceInfo, ChangeType.WillChange); handler(_CurrentSourceInfo, ChangeType.WillChange);
_CurrentSourceInfo = value; _CurrentSourceInfo = value;
if (handler != null) if (handler != null)
handler(_CurrentSourceInfo, ChangeType.DidChange); handler(_CurrentSourceInfo, ChangeType.DidChange);
} }
} }
SourceListItem _CurrentSourceInfo; SourceListItem _CurrentSourceInfo;
public BoolFeedback PowerIsOnFeedback { get; protected set; } public BoolFeedback IsCoolingDownFeedback { get; protected set; }
public BoolFeedback IsCoolingDownFeedback { get; protected set; } public BoolFeedback IsWarmingUpFeedback { get; private set; }
public BoolFeedback IsWarmingUpFeedback { get; private set; }
public UsageTracking UsageTracker { get; set; }
public UsageTracking UsageTracker { get; set; }
public uint WarmupTime { get; set; }
public uint WarmupTime { get; set; } public uint CooldownTime { get; set; }
public uint CooldownTime { get; set; }
/// <summary>
/// <summary> /// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented
/// Bool Func that will provide a value for the PowerIsOn Output. Must be implemented /// by concrete sub-classes
/// by concrete sub-classes /// </summary>
/// </summary> abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
abstract protected Func<bool> PowerIsOnFeedbackFunc { get; } abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
abstract protected Func<bool> IsCoolingDownFeedbackFunc { get; }
abstract protected Func<bool> IsWarmingUpFeedbackFunc { get; }
protected CTimer WarmupTimer;
protected CTimer CooldownTimer;
protected CTimer WarmupTimer;
protected CTimer CooldownTimer; #region IRoutingInputs Members
#region IRoutingInputs Members public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; } #endregion
#endregion protected DisplayBase(string key, string name)
: base(key, name)
protected DisplayBase(string key, string name) {
: base(key, name) IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc);
{ IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc); InputPorts = new RoutingPortCollection<RoutingInputPort>();
IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc);
}
InputPorts = new RoutingPortCollection<RoutingInputPort>();
PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
} public abstract void PowerOn();
public abstract void PowerOff();
void PowerIsOnFeedback_OutputChange(object sender, EventArgs e) public abstract void PowerToggle();
{
if (UsageTracker != null) public virtual FeedbackCollection<Feedback> Feedbacks
{ {
if (PowerIsOnFeedback.BoolValue) get
UsageTracker.StartDeviceUsage(); {
else return new FeedbackCollection<Feedback>
UsageTracker.EndDeviceUsage(); {
} IsCoolingDownFeedback,
} IsWarmingUpFeedback
};
public abstract void PowerOn(); }
public abstract void PowerOff(); }
public abstract void PowerToggle();
public abstract void ExecuteSwitch(object selector);
public virtual FeedbackCollection<Feedback> Feedbacks
{ protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
get EiscApiAdvanced bridge)
{ {
return new FeedbackCollection<Feedback> var inputNumber = 0;
{ var inputKeys = new List<string>();
PowerIsOnFeedback,
IsCoolingDownFeedback, var joinMap = new DisplayControllerJoinMap(joinStart);
IsWarmingUpFeedback
}; var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
}
} if (!string.IsNullOrEmpty(joinMapSerialized))
public abstract void ExecuteSwitch(object selector);
protected void LinkDisplayToApi(DisplayBase displayDevice, BasicTriList trilist, uint joinStart, string joinMapKey,
EiscApiAdvanced bridge)
{
var inputNumber = 0;
var inputKeys = new List<string>();
var joinMap = new DisplayControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized); joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
if (bridge != null) if (bridge != null)
@@ -137,164 +123,186 @@ namespace PepperDash.Essentials.Core
Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device."); Debug.Console(0,this,"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
} }
Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(1, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
Debug.Console(0, "Linking to Display: {0}", displayDevice.Name); Debug.Console(0, "Linking to Display: {0}", displayDevice.Name);
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name; trilist.StringInput[joinMap.Name.JoinNumber].StringValue = displayDevice.Name;
var commMonitor = displayDevice as ICommunicationMonitor; var commMonitor = displayDevice as ICommunicationMonitor;
if (commMonitor != null) if (commMonitor != null)
{ {
commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
} }
var inputNumberFeedback = new IntFeedback(() => inputNumber); var inputNumberFeedback = new IntFeedback(() => inputNumber);
// Two way feedbacks // Two way feedbacks
var twoWayDisplay = displayDevice as TwoWayDisplayBase; var twoWayDisplay = displayDevice as TwoWayDisplayBase;
if (twoWayDisplay != null) if (twoWayDisplay != null)
{ {
trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true); trilist.SetBool(joinMap.IsTwoWayDisplay.JoinNumber, true);
twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue); twoWayDisplay.CurrentInputFeedback.OutputChange += (o, a) => Debug.Console(0, "CurrentInputFeedback_OutputChange {0}", a.StringValue);
inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]); inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
} }
// Power Off // Power Off
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
{ {
inputNumber = 102; inputNumber = 102;
inputNumberFeedback.FireUpdate(); inputNumberFeedback.FireUpdate();
displayDevice.PowerOff(); displayDevice.PowerOff();
}); });
displayDevice.PowerIsOnFeedback.OutputChange += (o, a) => var twoWayDisplayDevice = displayDevice as TwoWayDisplayBase;
{ if (twoWayDisplayDevice != null)
if (!a.BoolValue) {
{ twoWayDisplayDevice.PowerIsOnFeedback.OutputChange += (o, a) =>
inputNumber = 102; {
inputNumberFeedback.FireUpdate(); if (!a.BoolValue)
{
} inputNumber = 102;
else inputNumberFeedback.FireUpdate();
{
inputNumber = 0; }
inputNumberFeedback.FireUpdate(); else
} {
}; inputNumber = 0;
inputNumberFeedback.FireUpdate();
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); }
};
// PowerOn
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => twoWayDisplayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
{ twoWayDisplayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
inputNumber = 0; }
inputNumberFeedback.FireUpdate();
displayDevice.PowerOn(); // PowerOn
}); trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
{
inputNumber = 0;
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); inputNumberFeedback.FireUpdate();
displayDevice.PowerOn();
for (int i = 0; i < displayDevice.InputPorts.Count; i++) });
{
if (i < joinMap.InputNamesOffset.JoinSpan)
{
inputKeys.Add(displayDevice.InputPorts[i].Key); for (int i = 0; i < displayDevice.InputPorts.Count; i++)
var tempKey = inputKeys.ElementAt(i); {
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i), if (i < joinMap.InputNamesOffset.JoinSpan)
() => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); {
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", inputKeys.Add(displayDevice.InputPorts[i].Key);
joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString()); var tempKey = inputKeys.ElementAt(i);
trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString(); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i),
} () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
else Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}",
Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.", joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString());
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count); trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString();
} }
else
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); Debug.Console(0, displayDevice, Debug.ErrorLogLevel.Warning, "Device has {0} inputs. The Join Map allows up to {1} inputs. Discarding inputs {2} - {3} from bridge.",
trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) => displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count);
{ }
if (a == 0)
{ Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
displayDevice.PowerOff(); trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) =>
inputNumber = 0; {
} if (a == 0)
else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber) {
{ displayDevice.PowerOff();
displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector); inputNumber = 0;
inputNumber = a; }
} else if (a > 0 && a < displayDevice.InputPorts.Count && a != inputNumber)
else if (a == 102) {
{ displayDevice.ExecuteSwitch(displayDevice.InputPorts.ElementAt(a - 1).Selector);
displayDevice.PowerToggle(); inputNumber = a;
}
} else if (a == 102)
if (twoWayDisplay != null) {
inputNumberFeedback.FireUpdate(); displayDevice.PowerToggle();
});
}
if (twoWayDisplay != null)
var volumeDisplay = displayDevice as IBasicVolumeControls; inputNumberFeedback.FireUpdate();
if (volumeDisplay == null) return; });
trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown); var volumeDisplay = displayDevice as IBasicVolumeControls;
trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle); if (volumeDisplay == null) return;
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown);
if (volumeDisplayWithFeedback == null) return; trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle);
trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff); var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
if (volumeDisplayWithFeedback == null) return;
trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume); trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]); trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]); trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume);
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMuteOn.JoinNumber]);
volumeDisplayWithFeedback.MuteFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.VolumeMuteOff.JoinNumber]);
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback public abstract class TwoWayDisplayBase : DisplayBase, IRoutingFeedback, IHasPowerControlWithFeedback
{ {
public StringFeedback CurrentInputFeedback { get; private set; } public StringFeedback CurrentInputFeedback { get; private set; }
abstract protected Func<string> CurrentInputFeedbackFunc { get; } abstract protected Func<string> CurrentInputFeedbackFunc { get; }
public BoolFeedback PowerIsOnFeedback { get; protected set; }
public static MockDisplay DefaultDisplay abstract protected Func<bool> PowerIsOnFeedbackFunc { get; }
{
get
{ public static MockDisplay DefaultDisplay
if (_DefaultDisplay == null) {
_DefaultDisplay = new MockDisplay("default", "Default Display"); get
return _DefaultDisplay; {
} if (_DefaultDisplay == null)
} _DefaultDisplay = new MockDisplay("default", "Default Display");
static MockDisplay _DefaultDisplay; return _DefaultDisplay;
}
public TwoWayDisplayBase(string key, string name)
: base(key, name)
{
CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
WarmupTime = 7000;
CooldownTime = 15000;
Feedbacks.Add(CurrentInputFeedback);
} }
static MockDisplay _DefaultDisplay;
public TwoWayDisplayBase(string key, string name)
: base(key, name)
{
CurrentInputFeedback = new StringFeedback(CurrentInputFeedbackFunc);
WarmupTime = 7000;
CooldownTime = 15000;
PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc);
Feedbacks.Add(CurrentInputFeedback);
Feedbacks.Add(PowerIsOnFeedback);
PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange;
}
void PowerIsOnFeedback_OutputChange(object sender, EventArgs e)
{
if (UsageTracker != null)
{
if (PowerIsOnFeedback.BoolValue)
UsageTracker.StartDeviceUsage();
else
UsageTracker.EndDeviceUsage();
}
}
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange; public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
@@ -309,5 +317,5 @@ namespace PepperDash.Essentials.Core
} }
} }
} }

View File

@@ -181,14 +181,18 @@ namespace PepperDash.Essentials.Devices.Common.Cameras
}); });
} }
if (cameraDevice is IPower) var powerCamera = cameraDevice as IHasPowerControl;
if (powerCamera != null)
{ {
var powerCamera = cameraDevice as IPower;
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn()); trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () => powerCamera.PowerOn());
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff()); trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () => powerCamera.PowerOff());
powerCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]); var powerFbCamera = powerCamera as IHasPowerControlWithFeedback;
powerCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]); if (powerFbCamera != null)
{
powerFbCamera.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
powerFbCamera.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
}
} }
if (cameraDevice is ICommunicationMonitor) if (cameraDevice is ICommunicationMonitor)

View File

@@ -14,7 +14,7 @@ using Crestron.SimplSharp.Reflection;
namespace PepperDash.Essentials.Devices.Common.Cameras namespace PepperDash.Essentials.Devices.Common.Cameras
{ {
public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IPower, IBridgeAdvanced public class CameraVisca : CameraBase, IHasCameraPtzControl, ICommunicationMonitor, IHasCameraPresets, IHasPowerControlWithFeedback, IBridgeAdvanced
{ {
public IBasicCommunication Communication { get; private set; } public IBasicCommunication Communication { get; private set; }
public CommunicationGather PortGather { get; private set; } public CommunicationGather PortGather { get; private set; }

View File

@@ -14,6 +14,7 @@ namespace PepperDash.Essentials.Devices.Common.Codec
void AddExternalSource(string connectorId, string key, string name, eExternalSourceType type); void AddExternalSource(string connectorId, string key, string name, eExternalSourceType type);
void SetExternalSourceState(string key, eExternalSourceMode mode); void SetExternalSourceState(string key, eExternalSourceMode mode);
void ClearExternalSources(); void ClearExternalSources();
void SetSelectedSource(string key);
Action<string, string> RunRouteAction { set;} Action<string, string> RunRouteAction { set;}
} }

View File

@@ -10,26 +10,28 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Devices.Displays namespace PepperDash.Essentials.Devices.Displays
{ {
public abstract class ComTcpDisplayBase : DisplayBase, IPower [Obsolete("Please use TwoWayDisplayBase instead")]
public abstract class ComTcpDisplayBase : TwoWayDisplayBase
{ {
/// <summary>
/// Sets the communication method for this - swaps out event handlers and output handlers ///// <summary>
/// </summary> ///// Sets the communication method for this - swaps out event handlers and output handlers
public IBasicCommunication CommunicationMethod ///// </summary>
{ //public IBasicCommunication CommunicationMethod
get { return _CommunicationMethod; } //{
set // get { return _CommunicationMethod; }
{ // set
if (_CommunicationMethod != null) // {
_CommunicationMethod.BytesReceived -= this.CommunicationMethod_BytesReceived; // if (_CommunicationMethod != null)
// Outputs??? // _CommunicationMethod.BytesReceived -= this.CommunicationMethod_BytesReceived;
_CommunicationMethod = value; // // Outputs???
if (_CommunicationMethod != null) // _CommunicationMethod = value;
_CommunicationMethod.BytesReceived += this.CommunicationMethod_BytesReceived; // if (_CommunicationMethod != null)
// Outputs? // _CommunicationMethod.BytesReceived += this.CommunicationMethod_BytesReceived;
} // // Outputs?
} // }
IBasicCommunication _CommunicationMethod; //}
//IBasicCommunication _CommunicationMethod;
public ComTcpDisplayBase(string key, string name) public ComTcpDisplayBase(string key, string name)
: base(key, name) : base(key, name)
@@ -38,6 +40,6 @@ namespace PepperDash.Essentials.Devices.Displays
} }
protected abstract void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args); //protected abstract void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args);
} }
} }

View File

@@ -11,217 +11,222 @@ using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Devices.Displays namespace PepperDash.Essentials.Devices.Displays
{ {
public class NecPaSeriesProjector : ComTcpDisplayBase, IBridgeAdvanced //public class NecPaSeriesProjector : TwoWayDisplayBase, IBridgeAdvanced
{ //{
public readonly IntFeedback Lamp1RemainingPercent; // public readonly IntFeedback Lamp1RemainingPercent;
int _Lamp1RemainingPercent; // int _Lamp1RemainingPercent;
public readonly IntFeedback Lamp2RemainingPercent; // public readonly IntFeedback Lamp2RemainingPercent;
int _Lamp2RemainingPercent; // int _Lamp2RemainingPercent;
protected override Func<bool> PowerIsOnFeedbackFunc
{
get { return () => _PowerIsOn; }
}
bool _PowerIsOn;
protected override Func<bool> IsCoolingDownFeedbackFunc // RoutingInputPort _CurrentInputPort;
{
get { return () => false; }
}
protected override Func<bool> IsWarmingUpFeedbackFunc // protected override Func<string> CurrentInputFeedbackFunc { get { return () => _CurrentInputPort.Key; } }
{
get { return () => false; } // protected override Func<bool> PowerIsOnFeedbackFunc
} // {
// get { return () => _PowerIsOn; }
// }
// bool _PowerIsOn;
public override void PowerToggle() // protected override Func<bool> IsCoolingDownFeedbackFunc
{ // {
throw new NotImplementedException(); // get { return () => false; }
} // }
public override void ExecuteSwitch(object selector) // protected override Func<bool> IsWarmingUpFeedbackFunc
{ // {
throw new NotImplementedException(); // get { return () => false; }
} // }
Dictionary<string, string> InputMap; // public override void PowerToggle()
// {
// throw new NotImplementedException();
// }
/// <summary> // public override void ExecuteSwitch(object selector)
/// Constructor // {
/// </summary> // throw new NotImplementedException();
public NecPaSeriesProjector(string key, string name) // }
: base(key, name)
{
Lamp1RemainingPercent = new IntFeedback("Lamp1RemainingPercent", () => _Lamp1RemainingPercent);
Lamp2RemainingPercent = new IntFeedback("Lamp2RemainingPercent", () => _Lamp2RemainingPercent);
InputMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) // Dictionary<string, string> InputMap;
{
{ "computer1", "\x02\x03\x00\x00\x02\x01\x01\x09" },
{ "computer2", "\x02\x03\x00\x00\x02\x01\x02\x0a" },
{ "computer3", "\x02\x03\x00\x00\x02\x01\x03\x0b" },
{ "hdmi", "\x02\x03\x00\x00\x02\x01\x1a\x22" },
{ "dp", "\x02\x03\x00\x00\x02\x01\x1b\x23" },
{ "video", "\x02\x03\x00\x00\x02\x01\x06\x0e" },
{ "viewer", "\x02\x03\x00\x00\x02\x01\x1f\x27" },
{ "network", "\x02\x03\x00\x00\x02\x01\x20\x28" },
};
}
void IsConnected_OutputChange(object sender, EventArgs e) // /// <summary>
{ // /// Constructor
// /// </summary>
// public NecPaSeriesProjector(string key, string name)
// : base(key, name)
// {
// Lamp1RemainingPercent = new IntFeedback("Lamp1RemainingPercent", () => _Lamp1RemainingPercent);
// Lamp2RemainingPercent = new IntFeedback("Lamp2RemainingPercent", () => _Lamp2RemainingPercent);
} // InputMap = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
// {
// { "computer1", "\x02\x03\x00\x00\x02\x01\x01\x09" },
// { "computer2", "\x02\x03\x00\x00\x02\x01\x02\x0a" },
// { "computer3", "\x02\x03\x00\x00\x02\x01\x03\x0b" },
// { "hdmi", "\x02\x03\x00\x00\x02\x01\x1a\x22" },
// { "dp", "\x02\x03\x00\x00\x02\x01\x1b\x23" },
// { "video", "\x02\x03\x00\x00\x02\x01\x06\x0e" },
// { "viewer", "\x02\x03\x00\x00\x02\x01\x1f\x27" },
// { "network", "\x02\x03\x00\x00\x02\x01\x20\x28" },
// };
// }
public void SetEnable(bool state) // void IsConnected_OutputChange(object sender, EventArgs e)
{ // {
var tcp = CommunicationMethod as GenericTcpIpClient;
if (tcp != null)
{
tcp.Connect();
}
}
public override void PowerOn() // }
{
SendText("\x02\x00\x00\x00\x00\x02");
}
public override void PowerOff() // public void SetEnable(bool state)
{ // {
SendText("\x02\x01\x00\x00\x00\x03"); // var tcp = CommunicationMethod as GenericTcpIpClient;
} // if (tcp != null)
// {
// tcp.Connect();
// }
// }
public void PictureMuteOn() // public override void PowerOn()
{ // {
SendText("\x02\x10\x00\x00\x00\x12"); // SendText("\x02\x00\x00\x00\x00\x02");
} // }
public void PictureMuteOff() // public override void PowerOff()
{ // {
SendText("\x02\x11\x00\x00\x00\x13"); // SendText("\x02\x01\x00\x00\x00\x03");
} // }
public void GetRunningStatus() // public void PictureMuteOn()
{ // {
SendText("\x00\x85\x00\x00\x01\x01\x87"); // SendText("\x02\x10\x00\x00\x00\x12");
} // }
public void GetLampRemaining(int lampNum) // public void PictureMuteOff()
{ // {
if (!_PowerIsOn) return; // SendText("\x02\x11\x00\x00\x00\x13");
// }
var bytes = new byte[]{0x03,0x96,0x00,0x00,0x02,0x00,0x04}; // public void GetRunningStatus()
if (lampNum == 2) // {
bytes[5] = 0x01; // SendText("\x00\x85\x00\x00\x01\x01\x87");
SendBytes(AppendChecksum(bytes)); // }
}
public void SelectInput(string inputKey) // public void GetLampRemaining(int lampNum)
{ // {
if (InputMap.ContainsKey(inputKey)) // if (!_PowerIsOn) return;
SendText(InputMap[inputKey]);
}
void SendText(string text) // var bytes = new byte[]{0x03,0x96,0x00,0x00,0x02,0x00,0x04};
{ // if (lampNum == 2)
if (CommunicationMethod != null) // bytes[5] = 0x01;
CommunicationMethod.SendText(text); // SendBytes(AppendChecksum(bytes));
} // }
void SendBytes(byte[] bytes) // public void SelectInput(string inputKey)
{ // {
if (CommunicationMethod != null) // if (InputMap.ContainsKey(inputKey))
CommunicationMethod.SendBytes(bytes); // SendText(InputMap[inputKey]);
} // }
byte[] AppendChecksum(byte[] bytes) // void SendText(string text)
{ // {
byte sum = unchecked((byte)bytes.Sum(x => (int)x)); // if (CommunicationMethod != null)
var retVal = new byte[bytes.Length + 1]; // CommunicationMethod.SendText(text);
bytes.CopyTo(retVal, 0); // }
retVal[retVal.Length - 1] = sum;
return retVal;
}
protected override void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args) // void SendBytes(byte[] bytes)
{ // {
var bytes = args.Bytes; // if (CommunicationMethod != null)
ParseBytes(args.Bytes); // CommunicationMethod.SendBytes(bytes);
} // }
void ParseBytes(byte[] bytes) // byte[] AppendChecksum(byte[] bytes)
{ // {
if (bytes[0] == 0x22) // byte sum = unchecked((byte)bytes.Sum(x => (int)x));
{ // var retVal = new byte[bytes.Length + 1];
// Power on // bytes.CopyTo(retVal, 0);
if (bytes[1] == 0x00) // retVal[retVal.Length - 1] = sum;
{ // return retVal;
_PowerIsOn = true; // }
PowerIsOnFeedback.FireUpdate();
}
// Power off
else if (bytes[1] == 0x01)
{
_PowerIsOn = false;
PowerIsOnFeedback.FireUpdate();
}
}
// Running Status
else if (bytes[0] == 0x20 && bytes[1] == 0x85 && bytes[4] == 0x10)
{
var operationStates = new Dictionary<int, string>
{
{ 0x00, "Standby" },
{ 0x04, "Power On" },
{ 0x05, "Cooling" },
{ 0x06, "Standby (error)" },
{ 0x0f, "Standby (power saving" },
{ 0x10, "Network Standby" },
{ 0xff, "Not supported" }
};
var newPowerIsOn = bytes[7] == 0x01; // protected override void CommunicationMethod_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs args)
if (newPowerIsOn != _PowerIsOn) // {
{ // var bytes = args.Bytes;
_PowerIsOn = newPowerIsOn; // ParseBytes(args.Bytes);
PowerIsOnFeedback.FireUpdate(); // }
}
Debug.Console(2, this, "PowerIsOn={0}\rCooling={1}\rPowering on/off={2}\rStatus={3}", // void ParseBytes(byte[] bytes)
_PowerIsOn, // {
bytes[8] == 0x01, // if (bytes[0] == 0x22)
bytes[9] == 0x01, // {
operationStates[bytes[10]]); // // Power on
// if (bytes[1] == 0x00)
// {
// _PowerIsOn = true;
// PowerIsOnFeedback.FireUpdate();
// }
// // Power off
// else if (bytes[1] == 0x01)
// {
// _PowerIsOn = false;
// PowerIsOnFeedback.FireUpdate();
// }
// }
// // Running Status
// else if (bytes[0] == 0x20 && bytes[1] == 0x85 && bytes[4] == 0x10)
// {
// var operationStates = new Dictionary<int, string>
// {
// { 0x00, "Standby" },
// { 0x04, "Power On" },
// { 0x05, "Cooling" },
// { 0x06, "Standby (error)" },
// { 0x0f, "Standby (power saving" },
// { 0x10, "Network Standby" },
// { 0xff, "Not supported" }
// };
// var newPowerIsOn = bytes[7] == 0x01;
// if (newPowerIsOn != _PowerIsOn)
// {
// _PowerIsOn = newPowerIsOn;
// PowerIsOnFeedback.FireUpdate();
// }
// Debug.Console(2, this, "PowerIsOn={0}\rCooling={1}\rPowering on/off={2}\rStatus={3}",
// _PowerIsOn,
// bytes[8] == 0x01,
// bytes[9] == 0x01,
// operationStates[bytes[10]]);
} // }
// Lamp remaining // // Lamp remaining
else if (bytes[0] == 0x23 && bytes[1] == 0x96 && bytes[4] == 0x06 && bytes[6] == 0x04) // else if (bytes[0] == 0x23 && bytes[1] == 0x96 && bytes[4] == 0x06 && bytes[6] == 0x04)
{ // {
var newValue = bytes[7]; // var newValue = bytes[7];
if (bytes[5] == 0x00) // if (bytes[5] == 0x00)
{ // {
if (newValue != _Lamp1RemainingPercent) // if (newValue != _Lamp1RemainingPercent)
{ // {
_Lamp1RemainingPercent = newValue; // _Lamp1RemainingPercent = newValue;
Lamp1RemainingPercent.FireUpdate(); // Lamp1RemainingPercent.FireUpdate();
} // }
} // }
else // else
{ // {
if (newValue != _Lamp2RemainingPercent) // if (newValue != _Lamp2RemainingPercent)
{ // {
_Lamp2RemainingPercent = newValue; // _Lamp2RemainingPercent = newValue;
Lamp2RemainingPercent.FireUpdate(); // Lamp2RemainingPercent.FireUpdate();
} // }
} // }
Debug.Console(0, this, "Lamp {0}, {1}% remaining", (bytes[5] + 1), bytes[7]); // Debug.Console(0, this, "Lamp {0}, {1}% remaining", (bytes[5] + 1), bytes[7]);
} // }
} // }
public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) // public void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ // {
LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge); // LinkDisplayToApi(this, trilist, joinStart, joinMapKey, bridge);
} // }
} //}
} }

View File

@@ -16,12 +16,12 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Devices.Common namespace PepperDash.Essentials.Devices.Common
{ {
[Description("Wrapper class for an IR Set Top Box")] [Description("Wrapper class for an IR Set Top Box")]
public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IPower public class IRSetTopBoxBase : EssentialsBridgeableDevice, ISetTopBoxControls, IRoutingOutputs, IUsageTracking, IHasPowerControl
{ {
public IrOutputPortController IrPort { get; private set; } public IrOutputPortController IrPort { get; private set; }
public uint DisplayUiType { get { return DisplayUiConstants.TypeDirecTv; } } public uint DisplayUiType { get { return DisplayUiConstants.TypeDirecTv; } }
public ushort IrPulseTime { get; set; }
public bool HasPresets { get; set; } public bool HasPresets { get; set; }
public bool HasDvr { get; set; } public bool HasDvr { get; set; }
@@ -35,6 +35,13 @@ namespace PepperDash.Essentials.Devices.Common
: base(key, name) : base(key, name)
{ {
IrPort = portCont; IrPort = portCont;
IrPulseTime = 200;
if (props.IrPulseTime > 0)
{
IrPulseTime = (ushort)props.IrPulseTime;
}
DeviceManager.AddDevice(portCont); DeviceManager.AddDevice(portCont);
HasPresets = props.HasPresets; HasPresets = props.HasPresets;
@@ -55,7 +62,6 @@ namespace PepperDash.Essentials.Devices.Common
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio, AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
eRoutingPortConnectionType.DigitalAudio, null, this); eRoutingPortConnectionType.DigitalAudio, null, this);
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyVideoOut, AnyAudioOut }; OutputPorts = new RoutingPortCollection<RoutingOutputPort> { AnyVideoOut, AnyAudioOut };
} }
public void LoadPresets(string filePath) public void LoadPresets(string filePath)
@@ -348,26 +354,17 @@ namespace PepperDash.Essentials.Devices.Common
public void PowerOn() public void PowerOn()
{ {
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_ON, true); IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, IrPulseTime);
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_ON, false);
} }
public void PowerOff() public void PowerOff()
{ {
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_OFF, true); IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, IrPulseTime);
IrPort.PressRelease(IROutputStandardCommands.IROut_POWER_OFF, false);
} }
public void PowerToggle() public void PowerToggle()
{ {
throw new NotImplementedException(); IrPort.Pulse(IROutputStandardCommands.IROut_POWER, IrPulseTime);
}
public BoolFeedback PowerIsOnFeedback
{
get { throw new NotImplementedException(); }
} }
#endregion #endregion
@@ -395,79 +392,96 @@ namespace PepperDash.Essentials.Devices.Common
trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name; trilist.StringInput[joinMap.Name.JoinNumber].StringValue = Name;
var stbBase = this as ISetTopBoxControls; var stbBase = this as ISetTopBoxControls;
if (stbBase != null)
{
trilist.BooleanInput[joinMap.HasDpad.JoinNumber].BoolValue = stbBase.HasDpad;
trilist.BooleanInput[joinMap.HasNumeric.JoinNumber].BoolValue = stbBase.HasNumeric;
trilist.BooleanInput[joinMap.HasDvr.JoinNumber].BoolValue = stbBase.HasDvr;
trilist.BooleanInput[joinMap.HasPresets.JoinNumber].BoolValue = stbBase.HasPresets;
trilist.BooleanInput[joinMap.HasDpad.JoinNumber].BoolValue = stbBase.HasDpad; trilist.SetBoolSigAction(joinMap.DvrList.JoinNumber, stbBase.DvrList);
trilist.BooleanInput[joinMap.HasNumeric.JoinNumber].BoolValue = stbBase.HasNumeric; trilist.SetBoolSigAction(joinMap.Replay.JoinNumber, stbBase.Replay);
trilist.BooleanInput[joinMap.HasDvr.JoinNumber].BoolValue = stbBase.HasDvr;
trilist.BooleanInput[joinMap.HasPresets.JoinNumber].BoolValue = stbBase.HasPresets;
trilist.SetBoolSigAction(joinMap.DvrList.JoinNumber, stbBase.DvrList); trilist.SetStringSigAction(joinMap.LoadPresets.JoinNumber, stbBase.LoadPresets);
trilist.SetBoolSigAction(joinMap.Replay.JoinNumber, stbBase.Replay); }
trilist.SetStringSigAction(joinMap.LoadPresets.JoinNumber, stbBase.LoadPresets); var stbPower = this as IHasPowerControl;
if (stbPower != null)
var stbPower = this as IPower; {
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, stbPower.PowerOn);
trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, stbPower.PowerOn); trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, stbPower.PowerOff);
trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, stbPower.PowerOff); trilist.SetSigTrueAction(joinMap.PowerToggle.JoinNumber, stbPower.PowerToggle);
trilist.SetSigTrueAction(joinMap.PowerToggle.JoinNumber, stbPower.PowerToggle); }
var stbDPad = this as IDPad; var stbDPad = this as IDPad;
if (stbDPad != null)
trilist.SetBoolSigAction(joinMap.Up.JoinNumber, stbDPad.Up); {
trilist.SetBoolSigAction(joinMap.Down.JoinNumber, stbDPad.Down); trilist.SetBoolSigAction(joinMap.Up.JoinNumber, stbDPad.Up);
trilist.SetBoolSigAction(joinMap.Left.JoinNumber, stbDPad.Left); trilist.SetBoolSigAction(joinMap.Down.JoinNumber, stbDPad.Down);
trilist.SetBoolSigAction(joinMap.Right.JoinNumber, stbDPad.Right); trilist.SetBoolSigAction(joinMap.Left.JoinNumber, stbDPad.Left);
trilist.SetBoolSigAction(joinMap.Select.JoinNumber, stbDPad.Select); trilist.SetBoolSigAction(joinMap.Right.JoinNumber, stbDPad.Right);
trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, stbDPad.Menu); trilist.SetBoolSigAction(joinMap.Select.JoinNumber, stbDPad.Select);
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbDPad.Exit); trilist.SetBoolSigAction(joinMap.Menu.JoinNumber, stbDPad.Menu);
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbDPad.Exit);
}
var stbChannel = this as IChannel; var stbChannel = this as IChannel;
trilist.SetBoolSigAction(joinMap.ChannelUp.JoinNumber, stbChannel.ChannelUp); if (stbChannel != null)
trilist.SetBoolSigAction(joinMap.ChannelDown.JoinNumber, stbChannel.ChannelDown); {
trilist.SetBoolSigAction(joinMap.LastChannel.JoinNumber, stbChannel.LastChannel); trilist.SetBoolSigAction(joinMap.ChannelUp.JoinNumber, stbChannel.ChannelUp);
trilist.SetBoolSigAction(joinMap.Guide.JoinNumber, stbChannel.Guide); trilist.SetBoolSigAction(joinMap.ChannelDown.JoinNumber, stbChannel.ChannelDown);
trilist.SetBoolSigAction(joinMap.Info.JoinNumber, stbChannel.Info); trilist.SetBoolSigAction(joinMap.LastChannel.JoinNumber, stbChannel.LastChannel);
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbChannel.Exit); trilist.SetBoolSigAction(joinMap.Guide.JoinNumber, stbChannel.Guide);
trilist.SetBoolSigAction(joinMap.Info.JoinNumber, stbChannel.Info);
trilist.SetBoolSigAction(joinMap.Exit.JoinNumber, stbChannel.Exit);
}
var stbColor = this as IColor; var stbColor = this as IColor;
trilist.SetBoolSigAction(joinMap.Red.JoinNumber, stbColor.Red); if (stbColor != null)
trilist.SetBoolSigAction(joinMap.Green.JoinNumber, stbColor.Green); {
trilist.SetBoolSigAction(joinMap.Yellow.JoinNumber, stbColor.Yellow); trilist.SetBoolSigAction(joinMap.Red.JoinNumber, stbColor.Red);
trilist.SetBoolSigAction(joinMap.Blue.JoinNumber, stbColor.Blue); trilist.SetBoolSigAction(joinMap.Green.JoinNumber, stbColor.Green);
trilist.SetBoolSigAction(joinMap.Yellow.JoinNumber, stbColor.Yellow);
trilist.SetBoolSigAction(joinMap.Blue.JoinNumber, stbColor.Blue);
}
var stbKeypad = this as ISetTopBoxNumericKeypad; var stbKeypad = this as ISetTopBoxNumericKeypad;
if (stbKeypad != null)
{
trilist.StringInput[joinMap.KeypadAccessoryButton1Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton1Label;
trilist.StringInput[joinMap.KeypadAccessoryButton2Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton2Label;
trilist.StringInput[joinMap.KeypadAccessoryButton1Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton1Label; trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton1;
trilist.StringInput[joinMap.KeypadAccessoryButton2Label.JoinNumber].StringValue = stbKeypad.KeypadAccessoryButton2Label; trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton2;
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton1.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton1; trilist.SetBoolSigAction(joinMap.Digit0.JoinNumber, stbKeypad.Digit0);
trilist.BooleanInput[joinMap.HasKeypadAccessoryButton2.JoinNumber].BoolValue = stbKeypad.HasKeypadAccessoryButton2; trilist.SetBoolSigAction(joinMap.Digit1.JoinNumber, stbKeypad.Digit1);
trilist.SetBoolSigAction(joinMap.Digit2.JoinNumber, stbKeypad.Digit2);
trilist.SetBoolSigAction(joinMap.Digit0.JoinNumber, stbKeypad.Digit0); trilist.SetBoolSigAction(joinMap.Digit3.JoinNumber, stbKeypad.Digit3);
trilist.SetBoolSigAction(joinMap.Digit1.JoinNumber, stbKeypad.Digit1); trilist.SetBoolSigAction(joinMap.Digit4.JoinNumber, stbKeypad.Digit4);
trilist.SetBoolSigAction(joinMap.Digit2.JoinNumber, stbKeypad.Digit2); trilist.SetBoolSigAction(joinMap.Digit5.JoinNumber, stbKeypad.Digit5);
trilist.SetBoolSigAction(joinMap.Digit3.JoinNumber, stbKeypad.Digit3); trilist.SetBoolSigAction(joinMap.Digit6.JoinNumber, stbKeypad.Digit6);
trilist.SetBoolSigAction(joinMap.Digit4.JoinNumber, stbKeypad.Digit4); trilist.SetBoolSigAction(joinMap.Digit7.JoinNumber, stbKeypad.Digit7);
trilist.SetBoolSigAction(joinMap.Digit5.JoinNumber, stbKeypad.Digit5); trilist.SetBoolSigAction(joinMap.Digit8.JoinNumber, stbKeypad.Digit8);
trilist.SetBoolSigAction(joinMap.Digit6.JoinNumber, stbKeypad.Digit6); trilist.SetBoolSigAction(joinMap.Digit9.JoinNumber, stbKeypad.Digit9);
trilist.SetBoolSigAction(joinMap.Digit7.JoinNumber, stbKeypad.Digit7); trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press.JoinNumber, stbKeypad.KeypadAccessoryButton1);
trilist.SetBoolSigAction(joinMap.Digit8.JoinNumber, stbKeypad.Digit8); trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press.JoinNumber, stbKeypad.KeypadAccessoryButton1);
trilist.SetBoolSigAction(joinMap.Digit9.JoinNumber, stbKeypad.Digit9); trilist.SetBoolSigAction(joinMap.Dash.JoinNumber, stbKeypad.Dash);
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton1Press.JoinNumber, stbKeypad.KeypadAccessoryButton1); trilist.SetBoolSigAction(joinMap.KeypadEnter.JoinNumber, stbKeypad.KeypadEnter);
trilist.SetBoolSigAction(joinMap.KeypadAccessoryButton2Press.JoinNumber, stbKeypad.KeypadAccessoryButton1); }
trilist.SetBoolSigAction(joinMap.Dash.JoinNumber, stbKeypad.Dash);
trilist.SetBoolSigAction(joinMap.KeypadEnter.JoinNumber, stbKeypad.KeypadEnter);
var stbTransport = this as ITransport; var stbTransport = this as ITransport;
trilist.SetBoolSigAction(joinMap.Play.JoinNumber, stbTransport.Play); if (stbTransport != null)
trilist.SetBoolSigAction(joinMap.Pause.JoinNumber, stbTransport.Pause); {
trilist.SetBoolSigAction(joinMap.Rewind.JoinNumber, stbTransport.Rewind); trilist.SetBoolSigAction(joinMap.Play.JoinNumber, stbTransport.Play);
trilist.SetBoolSigAction(joinMap.FFwd.JoinNumber, stbTransport.FFwd); trilist.SetBoolSigAction(joinMap.Pause.JoinNumber, stbTransport.Pause);
trilist.SetBoolSigAction(joinMap.ChapMinus.JoinNumber, stbTransport.ChapMinus); trilist.SetBoolSigAction(joinMap.Rewind.JoinNumber, stbTransport.Rewind);
trilist.SetBoolSigAction(joinMap.ChapPlus.JoinNumber, stbTransport.ChapPlus); trilist.SetBoolSigAction(joinMap.FFwd.JoinNumber, stbTransport.FFwd);
trilist.SetBoolSigAction(joinMap.Stop.JoinNumber, stbTransport.Stop); trilist.SetBoolSigAction(joinMap.ChapMinus.JoinNumber, stbTransport.ChapMinus);
trilist.SetBoolSigAction(joinMap.Record.JoinNumber, stbTransport.Record); trilist.SetBoolSigAction(joinMap.ChapPlus.JoinNumber, stbTransport.ChapPlus);
trilist.SetBoolSigAction(joinMap.Stop.JoinNumber, stbTransport.Stop);
trilist.SetBoolSigAction(joinMap.Record.JoinNumber, stbTransport.Record);
}
} }
} }

View File

@@ -14,6 +14,7 @@ namespace PepperDash.Essentials.Devices.Common
public bool HasDvr { get; set; } public bool HasDvr { get; set; }
public bool HasDpad { get; set; } public bool HasDpad { get; set; }
public bool HasNumeric { get; set; } public bool HasNumeric { get; set; }
public int IrPulseTime { get; set; }
public ControlPropertiesConfig Control { get; set; } public ControlPropertiesConfig Control { get; set; }
} }

View File

@@ -106,8 +106,8 @@ namespace PepperDash.Essentials.Devices.Common.SoftCodec
if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase)) if (route.SourceKey.Equals("$off", StringComparison.OrdinalIgnoreCase))
{ {
dest.ReleaseRoute(); dest.ReleaseRoute();
if (dest is IPower) if (dest is IHasPowerControl)
(dest as IPower).PowerOff(); (dest as IHasPowerControl).PowerOff();
} }
else else
{ {

View File

@@ -1970,6 +1970,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
} }
/// <summary>
/// Sets the selected source of the available external sources on teh Touch10 UI
/// </summary>
public void SetSelectedSource(string key)
{
SendText(string.Format("xCommand UserInterface Presentation ExternalSource Select SourceIdentifier: {0}", key));
}
/// <summary> /// <summary>
/// Action that will run when the External Source is selected. /// Action that will run when the External Source is selected.
/// </summary> /// </summary>