Revert "Revert "Merge branch 'development' into release/v1.5.0""

This reverts commit 4cd01aa428.
This commit is contained in:
Andrew Welker
2020-05-06 12:33:32 -06:00
parent 4cd01aa428
commit bfa1fee522
12 changed files with 890 additions and 671 deletions

View File

@@ -40,6 +40,10 @@ namespace PepperDash.Essentials.Bridges
public uint EdidSerialNumber { get; set; } public uint EdidSerialNumber { get; set; }
#endregion #endregion
#region Analogs
public uint AudioVideoSource { get; set; }
#endregion
public DmRmcControllerJoinMap() public DmRmcControllerJoinMap()
{ {
// Digital // Digital
@@ -51,6 +55,9 @@ namespace PepperDash.Essentials.Bridges
EdidName = 3; EdidName = 3;
EdidPrefferedTiming = 4; EdidPrefferedTiming = 4;
EdidSerialNumber = 5; EdidSerialNumber = 5;
//Analog
AudioVideoSource = 1;
} }
public override void OffsetJoinNumbers(uint joinStart) public override void OffsetJoinNumbers(uint joinStart)
@@ -63,6 +70,7 @@ namespace PepperDash.Essentials.Bridges
EdidName = EdidName + joinOffset; EdidName = EdidName + joinOffset;
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
EdidSerialNumber = EdidSerialNumber + joinOffset; EdidSerialNumber = EdidSerialNumber + joinOffset;
AudioVideoSource = AudioVideoSource + joinOffset;
} }
} }
} }

View File

@@ -7,111 +7,71 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges namespace PepperDash.Essentials.Core.Bridges
{ {
public class DisplayControllerJoinMap : JoinMapBase public class DisplayControllerJoinMap : JoinMapBaseAdvanced
{ {
#region Digitals [JoinName("Name")]
/// <summary> public JoinDataComplete Name = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
/// Turns the display off and reports power off feedback new JoinMetadata() { Label = "Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
/// </summary>
public uint PowerOff { get; set; }
/// <summary>
/// Turns the display on and repots power on feedback
/// </summary>
public uint PowerOn { get; set; }
/// <summary>
/// Indicates that the display device supports two way communication when high
/// </summary>
public uint IsTwoWayDisplay { get; set; }
/// <summary>
/// Increments the volume while high
/// </summary>
public uint VolumeUp { get; set; }
/// <summary>
/// Decrements teh volume while high
/// </summary>
public uint VolumeDown { get; set; }
/// <summary>
/// Toggles the mute state. Feedback is high when volume is muted
/// </summary>
public uint VolumeMute { get; set; }
/// <summary>
/// Range of digital joins to select inputs and report current input as feedback
/// </summary>
public uint InputSelectOffset { get; set; }
/// <summary>
/// Range of digital joins to report visibility for input buttons
/// </summary>
public uint ButtonVisibilityOffset { get; set; }
/// <summary>
/// High if the device is online
/// </summary>
public uint IsOnline { get; set; }
#endregion
#region Analogs [JoinName("PowerOff")]
/// <summary> public JoinDataComplete PowerOff = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
/// Analog join to set the input and report current input as feedback new JoinMetadata() { Label = "Power Off", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
/// </summary>
public uint InputSelect { get; set; }
/// <summary>
/// Sets the volume level and reports the current level as feedback
/// </summary>
public uint VolumeLevel { get; set; }
#endregion
#region Serials [JoinName("PowerOn")]
/// <summary> public JoinDataComplete PowerOn = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 },
/// Reports the name of the display as defined in config as feedback new JoinMetadata() { Label = "Power On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
/// </summary>
public uint Name { get; set; }
/// <summary>
/// Range of serial joins that reports the names of the inputs as feedback
/// </summary>
public uint InputNamesOffset { get; set; }
#endregion
public DisplayControllerJoinMap() [JoinName("IsTwoWayDisplay")]
public JoinDataComplete IsTwoWayDisplay = new JoinDataComplete(new JoinData() { JoinNumber = 3, JoinSpan = 1 },
new JoinMetadata() { Label = "Is Two Way Display", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeUp")]
public JoinDataComplete VolumeUp = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 },
new JoinMetadata() { Label = "Volume Up", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeLevel")]
public JoinDataComplete VolumeLevel = new JoinDataComplete(new JoinData() { JoinNumber = 5, JoinSpan = 1 },
new JoinMetadata() { Label = "Volume Level", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("VolumeDown")]
public JoinDataComplete VolumeDown = new JoinDataComplete(new JoinData() { JoinNumber = 6, JoinSpan = 1 },
new JoinMetadata() { Label = "Volume Down", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeMute")]
public JoinDataComplete VolumeMute = new JoinDataComplete(new JoinData() { JoinNumber = 7, JoinSpan = 1 },
new JoinMetadata() { Label = "Volume Mute", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeMuteOn")]
public JoinDataComplete VolumeMuteOn = new JoinDataComplete(new JoinData() { JoinNumber = 8, JoinSpan = 1 },
new JoinMetadata() { Label = "Volume Mute On", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("VolumeMuteOff")]
public JoinDataComplete VolumeMuteOff = new JoinDataComplete(new JoinData() { JoinNumber = 9, JoinSpan = 1 },
new JoinMetadata() { Label = "Volume Mute Off", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("InputSelectOffset")]
public JoinDataComplete InputSelectOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 },
new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("InputNamesOffset")]
public JoinDataComplete InputNamesOffset = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 10 },
new JoinMetadata() { Label = "Input Names Offset", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
[JoinName("InputSelect")]
public JoinDataComplete InputSelect = new JoinDataComplete(new JoinData() { JoinNumber = 11, JoinSpan = 1 },
new JoinMetadata() { Label = "Input Select", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Analog });
[JoinName("ButtonVisibilityOffset")]
public JoinDataComplete ButtonVisibilityOffset = new JoinDataComplete(new JoinData() { JoinNumber = 41, JoinSpan = 10 },
new JoinMetadata() { Label = "Button Visibility Offset", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.DigitalSerial });
[JoinName("IsOnline")]
public JoinDataComplete IsOnline = new JoinDataComplete(new JoinData() { JoinNumber = 50, JoinSpan = 1 },
new JoinMetadata() { Label = "Is Online", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
public DisplayControllerJoinMap(uint joinStart)
: base(joinStart, typeof(CameraControllerJoinMap))
{ {
// Digital
IsOnline = 50;
PowerOff = 1;
PowerOn = 2;
IsTwoWayDisplay = 3;
VolumeUp = 5;
VolumeDown = 6;
VolumeMute = 7;
ButtonVisibilityOffset = 40;
InputSelectOffset = 10;
// Analog
InputSelect = 11;
VolumeLevel = 5;
// Serial
Name = 1;
InputNamesOffset = 10;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
IsOnline = IsOnline + joinOffset;
PowerOff = PowerOff + joinOffset;
PowerOn = PowerOn + joinOffset;
IsTwoWayDisplay = IsTwoWayDisplay + joinOffset;
ButtonVisibilityOffset = ButtonVisibilityOffset + joinOffset;
Name = Name + joinOffset;
InputNamesOffset = InputNamesOffset + joinOffset;
InputSelectOffset = InputSelectOffset + joinOffset;
InputSelect = InputSelect + joinOffset;
VolumeUp = VolumeUp + joinOffset;
VolumeDown = VolumeDown + joinOffset;
VolumeMute = VolumeMute + joinOffset;
VolumeLevel = VolumeLevel + joinOffset;
} }
} }
} }

View File

@@ -39,6 +39,10 @@ namespace PepperDash.Essentials.Core.Bridges
public uint EdidSerialNumber { get; set; } public uint EdidSerialNumber { get; set; }
#endregion #endregion
#region Analogs
public uint AudioVideoSource { get; set; }
#endregion
public DmRmcControllerJoinMap() public DmRmcControllerJoinMap()
{ {
// Digital // Digital
@@ -50,6 +54,9 @@ namespace PepperDash.Essentials.Core.Bridges
EdidName = 3; EdidName = 3;
EdidPrefferedTiming = 4; EdidPrefferedTiming = 4;
EdidSerialNumber = 5; EdidSerialNumber = 5;
//Analog
AudioVideoSource = 1;
} }
public override void OffsetJoinNumbers(uint joinStart) public override void OffsetJoinNumbers(uint joinStart)
@@ -62,6 +69,7 @@ namespace PepperDash.Essentials.Core.Bridges
EdidName = EdidName + joinOffset; EdidName = EdidName + joinOffset;
EdidPrefferedTiming = EdidPrefferedTiming + joinOffset; EdidPrefferedTiming = EdidPrefferedTiming + joinOffset;
EdidSerialNumber = EdidSerialNumber + joinOffset; EdidSerialNumber = EdidSerialNumber + joinOffset;
AudioVideoSource = AudioVideoSource + joinOffset;
} }
} }
} }

View File

@@ -7,61 +7,36 @@ using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.Core.Bridges namespace PepperDash.Essentials.Core.Bridges
{ {
public class IBasicCommunicationJoinMap : JoinMapBase public class IBasicCommunicationJoinMap : JoinMapBaseAdvanced
{ {
#region Digitals [JoinName("TextReceived")]
/// <summary> public JoinDataComplete TextReceived = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
/// Set High to connect, Low to disconnect new JoinMetadata() { Label = "Text Received From Remote Device", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });
/// </summary>
public uint Connect { get; set; }
/// <summary>
/// Reports Connected State (High = Connected)
/// </summary>
public uint Connected { get; set; }
#endregion
#region Analogs [JoinName("SendText")]
/// <summary> public JoinDataComplete SendText = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
/// Reports the connections status value new JoinMetadata() { Label = "Text Sent To Remote Device", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial });
/// </summary>
public uint Status { get; set; }
#endregion
#region Serials [JoinName("SetPortConfig")]
/// <summary> public JoinDataComplete SetPortConfig = new JoinDataComplete(new JoinData() { JoinNumber = 2, JoinSpan = 1 },
/// Data back from port new JoinMetadata() { Label = "Set Port Config", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Serial });
/// </summary>
public uint TextReceived { get; set; }
/// <summary>
/// Sends data to the port
/// </summary>
public uint SendText { get; set; }
/// <summary>
/// Takes a JSON serialized string that sets a COM port's parameters
/// </summary>
public uint SetPortConfig { get; set; }
#endregion
public IBasicCommunicationJoinMap() [JoinName("Connect")]
public JoinDataComplete Connect = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Connect", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Digital });
[JoinName("Connected")]
public JoinDataComplete Connected = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Connected", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
[JoinName("Status")]
public JoinDataComplete Status = new JoinDataComplete(new JoinData() { JoinNumber = 1, JoinSpan = 1 },
new JoinMetadata() { Label = "Status", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Analog });
public IBasicCommunicationJoinMap(uint joinStart)
: base(joinStart, typeof(IBasicCommunicationJoinMap))
{ {
TextReceived = 1;
SendText = 1;
SetPortConfig = 2;
Connect = 1;
Connected = 1;
Status = 1;
}
public override void OffsetJoinNumbers(uint joinStart)
{
var joinOffset = joinStart - 1;
TextReceived = TextReceived + joinOffset;
SendText = SendText + joinOffset;
SetPortConfig = SetPortConfig + joinOffset;
Connect = Connect + joinOffset;
Connected = Connected + joinOffset;
Status = Status + joinOffset;
} }
} }
} }

View File

@@ -60,13 +60,12 @@ namespace PepperDash.Essentials.Core
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = new IBasicCommunicationJoinMap(); var joinMap = new IBasicCommunicationJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized)) if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized); joinMap = JsonConvert.DeserializeObject<IBasicCommunicationJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
if (CommPort == null) if (CommPort == null)
{ {
@@ -80,22 +79,22 @@ namespace PepperDash.Essentials.Core
CommPort.TextReceived += (s, a) => CommPort.TextReceived += (s, a) =>
{ {
Debug.Console(2, this, "RX: {0}", a.Text); Debug.Console(2, this, "RX: {0}", a.Text);
trilist.SetString(joinMap.TextReceived, a.Text); trilist.SetString(joinMap.TextReceived.JoinNumber, a.Text);
}; };
trilist.SetStringSigAction(joinMap.SendText, s => CommPort.SendText(s)); trilist.SetStringSigAction(joinMap.SendText.JoinNumber, s => CommPort.SendText(s));
trilist.SetStringSigAction(joinMap.SetPortConfig, SetPortConfig); trilist.SetStringSigAction(joinMap.SetPortConfig.JoinNumber, SetPortConfig);
var sComm = this as ISocketStatus; var sComm = this as ISocketStatus;
if (sComm == null) return; if (sComm == null) return;
sComm.ConnectionChange += (s, a) => sComm.ConnectionChange += (s, a) =>
{ {
trilist.SetUshort(joinMap.Status, (ushort)(a.Client.ClientStatus)); trilist.SetUshort(joinMap.Status.JoinNumber, (ushort)(a.Client.ClientStatus));
trilist.SetBool(joinMap.Connected, a.Client.ClientStatus == trilist.SetBool(joinMap.Connected.JoinNumber, a.Client.ClientStatus ==
SocketStatus.SOCKET_STATUS_CONNECTED); SocketStatus.SOCKET_STATUS_CONNECTED);
}; };
trilist.SetBoolSigAction(joinMap.Connect, b => trilist.SetBoolSigAction(joinMap.Connect.JoinNumber, b =>
{ {
if (b) if (b)
{ {

View File

@@ -18,7 +18,7 @@ namespace PepperDash.Essentials.Core
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public abstract class DisplayBase : EssentialsDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking public abstract class DisplayBase : EssentialsBridgeableDevice, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
{ {
public event SourceInfoChangeHandler CurrentSourceChange; public event SourceInfoChangeHandler CurrentSourceChange;
@@ -121,24 +121,22 @@ namespace PepperDash.Essentials.Core
var inputNumber = 0; var inputNumber = 0;
var inputKeys = new List<string>(); var inputKeys = new List<string>();
var joinMap = new DisplayControllerJoinMap(); var joinMap = new DisplayControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized)) if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized); joinMap = JsonConvert.DeserializeObject<DisplayControllerJoinMap>(joinMapSerialized);
joinMap.OffsetJoinNumbers(joinStart);
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].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]); commMonitor.CommunicationMonitor.IsOnlineFeedback.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
} }
var inputNumberFeedback = new IntFeedback(() => inputNumber); var inputNumberFeedback = new IntFeedback(() => inputNumber);
@@ -148,16 +146,16 @@ namespace PepperDash.Essentials.Core
if (twoWayDisplay != null) if (twoWayDisplay != null)
{ {
trilist.SetBool(joinMap.IsTwoWayDisplay, 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]); inputNumberFeedback.LinkInputSig(trilist.UShortInput[joinMap.InputSelect.JoinNumber]);
} }
// Power Off // Power Off
trilist.SetSigTrueAction(joinMap.PowerOff, () => trilist.SetSigTrueAction(joinMap.PowerOff.JoinNumber, () =>
{ {
inputNumber = 102; inputNumber = 102;
inputNumberFeedback.FireUpdate(); inputNumberFeedback.FireUpdate();
@@ -179,10 +177,10 @@ namespace PepperDash.Essentials.Core
} }
}; };
displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff]); displayDevice.PowerIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.PowerOff.JoinNumber]);
// PowerOn // PowerOn
trilist.SetSigTrueAction(joinMap.PowerOn, () => trilist.SetSigTrueAction(joinMap.PowerOn.JoinNumber, () =>
{ {
inputNumber = 0; inputNumber = 0;
inputNumberFeedback.FireUpdate(); inputNumberFeedback.FireUpdate();
@@ -190,21 +188,27 @@ namespace PepperDash.Essentials.Core
}); });
displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn]); displayDevice.PowerIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.PowerOn.JoinNumber]);
var count = 1; for (int i = 0; i < displayDevice.InputPorts.Count; i++)
foreach (var input in displayDevice.InputPorts)
{ {
inputKeys.Add(input.Key); if (i < joinMap.InputNamesOffset.JoinSpan)
var tempKey = inputKeys.ElementAt(count - 1); {
trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset + count), () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector)); inputKeys.Add(displayDevice.InputPorts[i].Key);
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}", joinMap.InputSelectOffset + count, displayDevice.InputPorts[tempKey].Key.ToString()); var tempKey = inputKeys.ElementAt(i);
trilist.StringInput[(ushort)(joinMap.InputNamesOffset + count)].StringValue = input.Key.ToString(); trilist.SetSigTrueAction((ushort)(joinMap.InputSelectOffset.JoinNumber + i),
count++; () => displayDevice.ExecuteSwitch(displayDevice.InputPorts[tempKey].Selector));
Debug.Console(2, displayDevice, "Setting Input Select Action on Digital Join {0} to Input: {1}",
joinMap.InputSelectOffset.JoinNumber + i, displayDevice.InputPorts[tempKey].Key.ToString());
trilist.StringInput[(ushort)(joinMap.InputNamesOffset.JoinNumber + i)].StringValue = displayDevice.InputPorts[i].Key.ToString();
}
else
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.",
displayDevice.InputPorts.Count, joinMap.InputNamesOffset.JoinSpan, i + 1, displayDevice.InputPorts.Count);
} }
Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect); Debug.Console(2, displayDevice, "Setting Input Select Action on Analog Join {0}", joinMap.InputSelect);
trilist.SetUShortSigAction(joinMap.InputSelect, (a) => trilist.SetUShortSigAction(joinMap.InputSelect.JoinNumber, (a) =>
{ {
if (a == 0) if (a == 0)
{ {
@@ -229,17 +233,22 @@ namespace PepperDash.Essentials.Core
var volumeDisplay = displayDevice as IBasicVolumeControls; var volumeDisplay = displayDevice as IBasicVolumeControls;
if (volumeDisplay == null) return; if (volumeDisplay == null) return;
trilist.SetBoolSigAction(joinMap.VolumeUp, volumeDisplay.VolumeUp); trilist.SetBoolSigAction(joinMap.VolumeUp.JoinNumber, volumeDisplay.VolumeUp);
trilist.SetBoolSigAction(joinMap.VolumeDown, volumeDisplay.VolumeDown); trilist.SetBoolSigAction(joinMap.VolumeDown.JoinNumber, volumeDisplay.VolumeDown);
trilist.SetSigTrueAction(joinMap.VolumeMute, volumeDisplay.MuteToggle); trilist.SetSigTrueAction(joinMap.VolumeMute.JoinNumber, volumeDisplay.MuteToggle);
var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback; var volumeDisplayWithFeedback = volumeDisplay as IBasicVolumeWithFeedback;
if (volumeDisplayWithFeedback == null) return; if (volumeDisplayWithFeedback == null) return;
trilist.SetSigTrueAction(joinMap.VolumeMuteOn.JoinNumber, volumeDisplayWithFeedback.MuteOn);
trilist.SetSigTrueAction(joinMap.VolumeMuteOff.JoinNumber, volumeDisplayWithFeedback.MuteOff);
trilist.SetUShortSigAction(joinMap.VolumeLevel, volumeDisplayWithFeedback.SetVolume);
volumeDisplayWithFeedback.VolumeLevelFeedback.LinkInputSig(trilist.UShortInput[joinMap.VolumeLevel]); trilist.SetUShortSigAction(joinMap.VolumeLevel.JoinNumber, volumeDisplayWithFeedback.SetVolume);
volumeDisplayWithFeedback.MuteFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VolumeMute]); 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]);
} }
} }

View File

@@ -91,6 +91,15 @@ namespace PepperDash.Essentials.Core
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type); void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
} }
/// <summary>
/// Defines a receiver that has internal routing (DM-RMC-4K-Z-SCALER-C)
/// </summary>
public interface IRmcRouting : IRouting
{
IntFeedback AudioVideoSourceNumericFeedback { get; }
void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type);
}
/// <summary> /// <summary>
/// Defines an IRoutingOutputs devices as being a source - the start of the chain /// Defines an IRoutingOutputs devices as being a source - the start of the chain
/// </summary> /// </summary>

View File

@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
public class DmRmc4kZ100CController : DmRmcX100CController
{
private readonly DmRmc4kz100C _rmc;
public DmRmc4kZ100CController(string key, string name, DmRmc4kz100C rmc)
: base(key, name, rmc)
{
_rmc = rmc;
/* removed this logic because it's done in the base constructor and doesn't need to be duplicated here
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, 0, this);
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc};
*/
// Set Ports for CEC
//TODO: We need to look at this class inheritance design...not so sure these properties need to be virtual and/or abstract.
EdidManufacturerFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
EdidNameFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
EdidPreferredTimingFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
}
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
{
VideoOutputResolutionFeedback.FireUpdate();
}
}
void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
{
if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId)
{
EdidManufacturerFeedback.FireUpdate();
}
else if (args.EventId == ConnectedDeviceEventIds.NameEventId)
{
EdidNameFeedback.FireUpdate();
}
else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId)
{
EdidPreferredTimingFeedback.FireUpdate();
}
else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId)
{
EdidSerialNumberFeedback.FireUpdate();
}
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
}
}
}

View File

@@ -0,0 +1,151 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Core;
namespace PepperDash.Essentials.DM
{
public class DmRmc4kZScalerCController : DmRmcControllerBase, IRmcRouting,
IIROutputPorts, IComPorts, ICec
{
public DmRmc4kzScalerC Rmc { get; private set; }
public RoutingInputPort DmIn { get; private set; }
public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
/// <summary>
/// The value of the current video source for the HDMI output on the receiver
/// </summary>
public IntFeedback AudioVideoSourceNumericFeedback { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get { return new RoutingPortCollection<RoutingInputPort> { DmIn, HdmiIn }; }
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get { return new RoutingPortCollection<RoutingOutputPort> { HdmiOut }; }
}
public DmRmc4kZScalerCController(string key, string name, DmRmc4kzScalerC rmc)
: base(key, name, rmc)
{
Rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, 0, this);
HdmiIn = new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 0, this);
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
EdidManufacturerFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Manufacturer.StringValue);
EdidNameFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.Name.StringValue);
EdidPreferredTimingFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.PreferredTiming.StringValue);
EdidSerialNumberFeedback = new StringFeedback(() => Rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
VideoOutputResolutionFeedback = new StringFeedback(() => Rmc.HdmiOutput.GetVideoResolutionString());
Rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
Rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
// Set Ports for CEC
HdmiOut.Port = Rmc.HdmiOutput;
AudioVideoSourceNumericFeedback = new IntFeedback(() => (ushort)(Rmc.SelectedSourceFeedback));
}
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId ||
args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
{
VideoOutputResolutionFeedback.FireUpdate();
}
if (args.EventId == EndpointOutputStreamEventIds.SelectedSourceFeedbackEventId)
{
AudioVideoSourceNumericFeedback.FireUpdate();
}
}
void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
{
if (args.EventId == ConnectedDeviceEventIds.ManufacturerEventId)
{
EdidManufacturerFeedback.FireUpdate();
}
else if (args.EventId == ConnectedDeviceEventIds.NameEventId)
{
EdidNameFeedback.FireUpdate();
}
else if (args.EventId == ConnectedDeviceEventIds.PreferredTimingEventId)
{
EdidPreferredTimingFeedback.FireUpdate();
}
else if (args.EventId == ConnectedDeviceEventIds.SerialNumberEventId)
{
EdidSerialNumberFeedback.FireUpdate();
}
}
public override bool CustomActivate()
{
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
LinkDmRmcToApi(this, trilist, joinStart, joinMapKey, bridge);
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Rmc.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Rmc.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Rmc.ComPorts; } }
public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } }
#endregion
#region ICec Members
/// <summary>
/// Gets the CEC stream directly from the HDMI port.
/// </summary>
public Cec StreamCec { get { return Rmc.HdmiOutput.StreamCec; } }
#endregion
#region IRmcRouting Members
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector);
var number = Convert.ToUInt16(inputSelector);
Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)number;
}
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType)
{
Debug.Console(2, this, "Attempting a route from input {0} to HDMI Output", inputSelector);
Rmc.AudioVideoSource = (DmRmc4kzScalerC.eAudioVideoSource)inputSelector;
}
#endregion
}
}

View File

@@ -26,7 +26,7 @@ namespace PepperDash.Essentials.DM
public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; } public virtual StringFeedback EdidPreferredTimingFeedback { get; protected set; }
public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; } public virtual StringFeedback EdidSerialNumberFeedback { get; protected set; }
public DmRmcControllerBase(string key, string name, EndpointReceiverBase device) protected DmRmcControllerBase(string key, string name, EndpointReceiverBase device)
: base(key, name, device) : base(key, name, device)
{ {
// if wired to a chassis, skip registration step in base class // if wired to a chassis, skip registration step in base class
@@ -61,6 +61,17 @@ namespace PepperDash.Essentials.DM
rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]); rmc.EdidPreferredTimingFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidPrefferedTiming]);
if (rmc.EdidSerialNumberFeedback != null) if (rmc.EdidSerialNumberFeedback != null)
rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]); rmc.EdidSerialNumberFeedback.LinkInputSig(trilist.StringInput[joinMap.EdidSerialNumber]);
//If the device is an DM-RMC-4K-Z-SCALER-C
var routing = rmc as IRmcRouting;
if (routing != null)
{
if (routing.AudioVideoSourceNumericFeedback != null)
routing.AudioVideoSourceNumericFeedback.LinkInputSig(trilist.UShortInput[joinMap.AudioVideoSource]);
trilist.SetUShortSigAction(joinMap.AudioVideoSource, (a) => routing.ExecuteNumericSwitch(a, 1, eRoutingSignalType.AudioVideo));
}
} }
} }
@@ -146,7 +157,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmrmc4k100c")) if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem)); return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kz100c")) if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem)); return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc150s")) if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem)); return new DmRmc150SController(key, name, new DmRmc150S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc200c")) if (typeName.StartsWith("dmrmc200c"))
@@ -165,6 +176,8 @@ namespace PepperDash.Essentials.DM
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem)); return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kscalercdsp")) if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem)); return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmrmc4kzscalerc"))
return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(ipid, Global.ControlSystem));
} }
catch (Exception e) catch (Exception e)
{ {
@@ -219,7 +232,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmrmc4k100c")) if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num])); return new DmRmcX100CController(key, name, new DmRmc4k100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kz100c")) if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num])); return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc150s")) if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num])); return new DmRmc150SController(key, name, new DmRmc150S(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200c")) if (typeName.StartsWith("dmrmc200c"))
@@ -238,6 +251,8 @@ namespace PepperDash.Essentials.DM
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num])); return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalercdsp")) if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num])); return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kzscalerc"))
return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num]));
} }
else else
{ {
@@ -252,7 +267,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmrmc4k100c")) if (typeName.StartsWith("dmrmc4k100c"))
return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num])); return new DmRmcX100CController(key, name, new DmRmc4k100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kz100c")) if (typeName.StartsWith("dmrmc4kz100c"))
return new DmRmcX100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num])); return new DmRmc4kZ100CController(key, name, new DmRmc4kz100C(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc150s")) if (typeName.StartsWith("dmrmc150s"))
return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num])); return new DmRmc150SController(key, name, new DmRmc150S(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc200c")) if (typeName.StartsWith("dmrmc200c"))
@@ -271,6 +286,9 @@ namespace PepperDash.Essentials.DM
return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num])); return new DmRmc4kScalerCController(key, name, new DmRmc4kScalerC(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kscalercdsp")) if (typeName.StartsWith("dmrmc4kscalercdsp"))
return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num])); return new DmRmc4kScalerCDspController(key, name, new DmRmc4kScalerCDsp(ipid, chassis.Outputs[num]));
if (typeName.StartsWith("dmrmc4kzscalerc"))
return new DmRmc4kZScalerCController(key, name, new DmRmc4kzScalerC(chassis.Outputs[num]));
} }
} }
catch (Exception e) catch (Exception e)
@@ -288,7 +306,8 @@ namespace PepperDash.Essentials.DM
public DmRmcControllerFactory() public DmRmcControllerFactory()
{ {
TypeNames = new List<string>() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s", TypeNames = new List<string>() { "hdbasetrx", "dmrmc4k100c1g", "dmrmc100c", "dmrmc100s", "dmrmc4k100c", "dmrmc150s",
"dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp" }; "dmrmc200c", "dmrmc200s", "dmrmc200s2", "dmrmcscalerc", "dmrmcscalers", "dmrmcscalers2", "dmrmc4kscalerc", "dmrmc4kscalercdsp",
"dmrmc4kz100c", "dmrmckzscalerc" };
} }
public override EssentialsDevice BuildDevice(DeviceConfig dc) public override EssentialsDevice BuildDevice(DeviceConfig dc)

View File

@@ -21,10 +21,10 @@ namespace PepperDash.Essentials.DM
public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs, public class DmRmcX100CController : DmRmcControllerBase, IRoutingInputsOutputs,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
public DmRmc100C Rmc { get; private set; } public DmRmc100C Rmc { get; protected set; }
public RoutingInputPort DmIn { get; private set; } public RoutingInputPort DmIn { get; protected set; }
public RoutingOutputPort HdmiOut { get; private set; } public RoutingOutputPort HdmiOut { get; protected set; }
public RoutingPortCollection<RoutingInputPort> InputPorts public RoutingPortCollection<RoutingInputPort> InputPorts
{ {

View File

@@ -100,6 +100,8 @@
<Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" /> <Compile Include="Chassis\DmpsInternalVirtualDmTxController.cs" />
<Compile Include="Chassis\DmpsRoutingController.cs" /> <Compile Include="Chassis\DmpsRoutingController.cs" />
<Compile Include="Chassis\HdMdNxM4kEController.cs" /> <Compile Include="Chassis\HdMdNxM4kEController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZScalerCController.cs" />
<Compile Include="Endpoints\Transmitters\TxInterfaces.cs" /> <Compile Include="Endpoints\Transmitters\TxInterfaces.cs" />
<Compile Include="IDmSwitch.cs" /> <Compile Include="IDmSwitch.cs" />
<Compile Include="Config\DmpsRoutingConfig.cs" /> <Compile Include="Config\DmpsRoutingConfig.cs" />