Adds device support for HdMdxxxCE family of Tx/Rx pairs.

This commit is contained in:
Neil Dorin
2019-09-03 16:43:07 -06:00
parent d588757eb6
commit f1611da74c
5 changed files with 224 additions and 51 deletions

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.AirMedia;
using Crestron.SimplSharpPro.UI;
@@ -68,7 +69,24 @@ namespace PepperDash.Essentials.DM
return PepperDash.Essentials.DM.Chassis.HdMdNxM4kEController.GetController(key, name, type, props);
}
else if (typeName.Equals("hdmd400ce") || typeName.Equals("hdmd300ce") || typeName.Equals("hdmd200ce"))
{
var props = JsonConvert.DeserializeObject
<PepperDash.Essentials.DM.HdMdxxxCEPropertiesConfig>(properties.ToString());
if (typeName.Equals("hdmd400ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd400CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd300ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd300CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd200ce"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd200CE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
else if (typeName.Equals("hdmd200c1ge"))
return new PepperDash.Essentials.DM.HdMdxxxCEController(key, name,
new HdMd200C1GE(props.Control.IpIdInt, props.Control.TcpSshProperties.Address, Global.ControlSystem));
}
return null;
}

View File

@@ -0,0 +1,201 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Core;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.DM
{
/// <summary>
/// Represent both a transmitter and receiver pair of the HD-MD-400-C-E / HD-MD-300-C-E / HD-MD-200-C-E kits
/// </summary>
public class HdMdxxxCEController : CrestronGenericBaseDevice, IRouting //, IComPorts
{
/// <summary>
/// DmLite Ports
/// </summary>
public RoutingOutputPort ToRx { get; private set; }
public RoutingInputPort FromTx { get; private set; }
public RoutingOutputPort HdmiOut { get; private set; }
public HdMdxxxCE TxRxPair { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
public IntFeedback VideoSourceFeedback { get; private set; }
public BoolFeedback AutoRouteOnFeedback { get; private set; }
public BoolFeedback PriorityRoutingOnFeedback { get; private set; }
public BoolFeedback InputOnScreenDisplayEnabledFeedback { get; private set; }
public Dictionary<uint, BoolFeedback> SyncDetectedFeedbacks { get; private set; }
public BoolFeedback RemoteEndDetectedFeedback { get; private set; }
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get { return new RoutingPortCollection<RoutingOutputPort> { HdmiOut }; }
}
public HdMdxxxCEController(string key, string name, HdMdxxxCE txRxPair)
:base(key, name, txRxPair)
{
TxRxPair = txRxPair;
RemoteEndDetectedFeedback = new BoolFeedback(() => TxRxPair.RemoteEndDetectedOnFeedback.BoolValue);
AutoRouteOnFeedback = new BoolFeedback(() => TxRxPair.ReceiverAutoModeOnFeedback.BoolValue);
PriorityRoutingOnFeedback = new BoolFeedback(() => TxRxPair.PriorityRoutingOnFeedback.BoolValue);
InputOnScreenDisplayEnabledFeedback = new BoolFeedback(() => TxRxPair.OnScreenDisplayEnabledFeedback.BoolValue);
InputPorts = new RoutingPortCollection<RoutingInputPort>();
// Add the HDMI input port on the receiver
InputPorts.Add(new RoutingInputPort(DmPortName.Hdmi, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 1, this));
SyncDetectedFeedbacks.Add(1, new BoolFeedback( () => TxRxPair.HdmiInputs[1].VideoDetectedFeedback.BoolValue));
if(txRxPair is HdMd400CE)
{
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2, this));
SyncDetectedFeedbacks.Add(2, new BoolFeedback(() => TxRxPair.HdmiInputs[2].VideoDetectedFeedback.BoolValue));
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 3, this));
SyncDetectedFeedbacks.Add(3, new BoolFeedback(() => TxRxPair.HdmiInputs[3].VideoDetectedFeedback.BoolValue));
InputPorts.Add(new RoutingInputPort(DmPortName.VgaIn, eRoutingSignalType.Video | eRoutingSignalType.Audio,
eRoutingPortConnectionType.Vga, 4, this));
SyncDetectedFeedbacks.Add(4, new BoolFeedback(() => TxRxPair.VgaInputs[1].VideoDetectedFeedback.BoolValue));
// Set Ports for CEC
InputPorts[DmPortName.HdmiIn1].Port = TxRxPair.HdmiInputs[1];
InputPorts[DmPortName.HdmiIn2].Port = TxRxPair.HdmiInputs[2];
}
else if (txRxPair is HdMd300CE)
{
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2, this));
SyncDetectedFeedbacks.Add(2, new BoolFeedback(() => TxRxPair.HdmiInputs[2].VideoDetectedFeedback.BoolValue));
InputPorts.Add(new RoutingInputPort(DmPortName.VgaIn, eRoutingSignalType.Video | eRoutingSignalType.Audio,
eRoutingPortConnectionType.Vga, 3, this));
SyncDetectedFeedbacks.Add(3, new BoolFeedback(() => TxRxPair.VgaInputs[1].VideoDetectedFeedback.BoolValue));
// Set Ports for CEC
InputPorts[DmPortName.HdmiIn].Port = TxRxPair.HdmiInputs[1];
}
else if (txRxPair is HdMd200CE || txRxPair is HdMd200C1GE)
{
InputPorts.Add(new RoutingInputPort(DmPortName.HdmiIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, 2, this));
SyncDetectedFeedbacks.Add(2, new BoolFeedback(() => TxRxPair.HdmiInputs[2].VideoDetectedFeedback.BoolValue));
// Set Ports for CEC
InputPorts[DmPortName.HdmiIn].Port = TxRxPair.HdmiInputs[1];
}
ToRx = new RoutingOutputPort(DmPortName.ToTx, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
FromTx = new RoutingInputPort(DmPortName.FromTx, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
HdmiOut = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
TxRxPair.DMInputChange += new DMInputEventHandler(TxRxPair_DMInputChange);
TxRxPair.DMOutputChange += new DMOutputEventHandler(TxRxPair_DMOutputChange);
TxRxPair.DMSystemChange += new DMSystemEventHandler(TxRxPair_DMSystemChange);
VideoSourceFeedback = new IntFeedback(() => (int)TxRxPair.HdmiOutputs[1].VideoOutFeedback.Number);
}
void TxRxPair_DMSystemChange(Switch device, DMSystemEventArgs args)
{
if (args.EventId == DMSystemEventIds.RemoteEndDetectedEventId)
RemoteEndDetectedFeedback.FireUpdate();
else if (args.EventId == DMSystemEventIds.ReceiverAutoModeOnEventId)
AutoRouteOnFeedback.FireUpdate();
else if (args.EventId == DMSystemEventIds.PriorityRoutingOnEventId)
PriorityRoutingOnFeedback.FireUpdate();
else if (args.EventId == DMSystemEventIds.OnScreenDisplayEnabledEventId)
InputOnScreenDisplayEnabledFeedback.FireUpdate();
}
void TxRxPair_DMOutputChange(Switch device, DMOutputEventArgs args)
{
if (args.EventId == DMOutputEventIds.VideoOutEventId)
VideoSourceFeedback.FireUpdate();
}
void TxRxPair_DMInputChange(Switch device, DMInputEventArgs args)
{
if (args.EventId == DMInputEventIds.VideoDetectedEventId)
SyncDetectedFeedbacks[args.Number].FireUpdate();
}
public void AutoRouteOn()
{
TxRxPair.TransmitterAutoModeOn();
}
public void AutoRouteOff()
{
TxRxPair.TransmitterAutoModeOff();
}
public void PriorityRouteOn()
{
TxRxPair.PriorityRoutingOn();
}
public void PriorityRouteOff()
{
TxRxPair.PriorityRoutingOff();
}
public void OnScreenDisplayEnable()
{
TxRxPair.OnScreenDisplayEnabled();
}
public void OnScreenDisplayDisable()
{
TxRxPair.OnScreenDisplayDisabled();
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
TxRxPair.HdmiOutputs[1].VideoOut = TxRxPair.Inputs[(uint)inputSelector];
}
// This device has a different class for com ports which will make it hard to implement IComPorts....
//#region IComPorts Members
//public CrestronCollection<ComPort> ComPorts { get { return TxRxPair.ComPorts as CrestronCollection<ComPort>; } }
//public int NumberOfComPorts { get { return 1; } }
//#endregion
}
public class HdMdxxxCEPropertiesConfig
{
public ControlPropertiesConfig Control { get; set; }
}
}

View File

@@ -26,6 +26,8 @@ namespace PepperDash.Essentials.DM
public const string DmOut = "DmOut";
public const string DmOut1 = "DmOut1";
public const string DmOut2 = "DmOut2";
public const string FromTx = "FromTx";
public const string Hdmi = "Hdmi";
public const string HdmiIn = "HdmiIn";
public const string HdmiIn1 = "HdmiIn1";
public const string HdmiIn2 = "HdmiIn2";
@@ -35,6 +37,7 @@ namespace PepperDash.Essentials.DM
public const string HdmiOut = "HdmiOut";
public const string Osd = "Osd";
public const string SpdifIn = "SpdifIn";
public const string ToTx = "ToTx";
public const string VgaIn = "VgaIn";
}
}

View File

@@ -1,49 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Receivers;
using PepperDash.Essentials.Core;
namespace PepperDash.Essentials.DM
{
public class HdRx4kX10Controller : DmHdBaseTControllerBase, IRoutingInputsOutputs,
IComPorts
{
public RoutingInputPort DmIn { get; private set; }
public RoutingOutputPort HDBaseTSink { get; private set; }
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get { return new RoutingPortCollection<RoutingInputPort> { DmIn }; }
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get { return new RoutingPortCollection<RoutingOutputPort> { HDBaseTSink }; }
}
public HdRx4kX10Controller(string key, string name, HdRx4kX10 rmc)
: base(key, name, rmc)
{
Rmc = rmc;
DmIn = new RoutingInputPort(DmPortName.DmIn, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, 0, this);
HDBaseTSink = new RoutingOutputPort(DmPortName.HdmiOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
// Set Ports for CEC
HDBaseTSink.Port = Rmc; // Unique case, this class has no HdmiOutput port and ICec is implemented on the receiver class itself
}
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Rmc.ComPorts; } }
public int NumberOfComPorts { get { return Rmc.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -113,7 +113,7 @@
<Compile Include="Endpoints\NVX\DmNvxControllerBase.cs" />
<Compile Include="Endpoints\DGEs\DgeController.cs" />
<Compile Include="Endpoints\DGEs\DgePropertiesConfig.cs" />
<Compile Include="Endpoints\Receivers\DmHdRxX01Controller.cs" />
<Compile Include="DmLite\DmMdxxxCEController.cs" />
<Compile Include="Endpoints\Receivers\DmHdBaseTEndpointController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc100SController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc150SController.cs" />