Merge pull request #225 from PepperDash/hotfix/dm-rmc4kz100-build

Fix issue building DM-RMC-4KZ-100-C & DM-TX-4KZ-202-C
This commit is contained in:
Neil Dorin
2020-06-03 11:28:54 -06:00
committed by GitHub
6 changed files with 803 additions and 437 deletions

View File

@@ -24,18 +24,31 @@ namespace PepperDash.Essentials.DM
EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue); EdidSerialNumberFeedback = new StringFeedback(() => _rmc.HdmiOutput.ConnectedDevice.SerialNumber.StringValue);
_rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange; _rmc.HdmiOutput.OutputStreamChange += HdmiOutput_OutputStreamChange;
_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
//removed to prevent NullReferenceException
//_rmc.HdmiOutput.ConnectedDevice.DeviceInformationChange += ConnectedDevice_DeviceInformationChange;
} }
void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args) void HdmiOutput_OutputStreamChange(EndpointOutputStream outputStream, EndpointOutputStreamEventArgs args)
{ {
if (args.EventId == EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId || args.EventId == EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId || switch (args.EventId)
args.EventId == EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId)
{ {
VideoOutputResolutionFeedback.FireUpdate(); case EndpointOutputStreamEventIds.FramesPerSecondFeedbackEventId:
case EndpointOutputStreamEventIds.VerticalResolutionFeedbackEventId:
case EndpointOutputStreamEventIds.HorizontalResolutionFeedbackEventId:
VideoOutputResolutionFeedback.FireUpdate();
break;
case EndpointOutputStreamEventIds.HotplugDetectedEventId:
if (_rmc.HdmiOutput.ConnectedDevice == null) return;
EdidManufacturerFeedback.FireUpdate();
EdidNameFeedback.FireUpdate();
EdidPreferredTimingFeedback.FireUpdate();
EdidSerialNumberFeedback.FireUpdate();
break;
} }
} }
/*
void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args) void ConnectedDevice_DeviceInformationChange(ConnectedDeviceInformation connectedDevice, ConnectedDeviceEventArgs args)
{ {
switch (args.EventId) switch (args.EventId)
@@ -53,7 +66,7 @@ namespace PepperDash.Essentials.DM
EdidSerialNumberFeedback.FireUpdate(); EdidSerialNumberFeedback.FireUpdate();
break; break;
} }
} }*/
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {

View File

@@ -18,13 +18,13 @@ using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM namespace PepperDash.Essentials.DM
{ {
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType;
[Description("Wrapper class for DM-TX-4K-202-C")] [Description("Wrapper class for DM-TX-4K-202-C")]
public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback, public class DmTx4k202CController : DmTxControllerBase, ITxRouting, IHasFeedback,
IIROutputPorts, IComPorts IIROutputPorts, IComPorts
{ {
public DmTx4kX02CBase Tx { get; private set; } public DmTx4k202C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; } public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
@@ -81,7 +81,7 @@ namespace PepperDash.Essentials.DM
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut }; return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
} }
} }
public DmTx4k202CController(string key, string name, DmTx4kX02CBase tx) public DmTx4k202CController(string key, string name, DmTx4k202C tx)
: base(key, name, tx) : base(key, name, tx)
{ {
Tx = tx; Tx = tx;
@@ -99,8 +99,9 @@ namespace PepperDash.Essentials.DM
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent; Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
Tx.BaseEvent += Tx_BaseEvent;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
@@ -190,24 +191,24 @@ namespace PepperDash.Essentials.DM
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null) if (Hdmi1VideoSyncFeedback != null)
{ {
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]); Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
} }
if (Hdmi2VideoSyncFeedback != null) if (Hdmi2VideoSyncFeedback != null)
{ {
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
} }
LinkDmTxToApi(this, trilist, joinMap, bridge); LinkDmTxToApi(this, trilist, joinMap, bridge);
} }
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{ {
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (type) switch (type)
{ {
case eRoutingSignalType.Video: case eRoutingSignalType.Video:
switch (input) switch (input)
{ {
case 0: case 0:
@@ -230,9 +231,9 @@ namespace PepperDash.Essentials.DM
ExecuteSwitch(eVst.AllDisabled, null, type); ExecuteSwitch(eVst.AllDisabled, null, type);
break; break;
} }
} }
break; break;
case eRoutingSignalType.Audio: case eRoutingSignalType.Audio:
switch (input) switch (input)
{ {
case 0: case 0:
@@ -255,11 +256,11 @@ namespace PepperDash.Essentials.DM
ExecuteSwitch(eAst.AllDisabled, null, type); ExecuteSwitch(eAst.AllDisabled, null, type);
break; break;
} }
} }
break; break;
} }
} }
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{ {
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video) if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
@@ -270,42 +271,42 @@ namespace PepperDash.Essentials.DM
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{ {
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId) switch (args.EventId)
{ {
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break; break;
} }
} }
void Tx_BaseEvent(GenericBase device, BaseEventArgs args) void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{ {
var id = args.EventId; var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId); Debug.Console(2, this, "EventId {0}", args.EventId);
switch (id) switch (id)
{ {
case EndpointTransmitterBase.VideoSourceFeedbackEventId: case EndpointTransmitterBase.VideoSourceFeedbackEventId:
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
ActiveVideoInputFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate(); VideoSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate(); ActiveVideoInputFeedback.FireUpdate();
break; break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId: case EndpointTransmitterBase.AudioSourceFeedbackEventId:
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback); Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate(); AudioSourceNumericFeedback.FireUpdate();
break; break;
} }
} }
@@ -313,12 +314,12 @@ namespace PepperDash.Essentials.DM
/// Relays the input stream change to the appropriate RoutingInputPort. /// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary> /// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{ {
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{ {
return; return;
} }
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
} }

View File

@@ -0,0 +1,359 @@
using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.DM
{
using eVst = eX02VideoSourceType;
using eAst = eX02AudioSourceType;
public class DmTx4kz202CController : DmTxControllerBase, ITxRouting,
IIROutputPorts, IComPorts
{
public DmTx4kz202C Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
//public override ushort HdcpSupportCapability { get; protected set; }
/// <summary>
/// Helps get the "real" inputs, including when in Auto
/// </summary>
public eX02VideoSourceType ActualActiveVideoInput
{
get
{
if (Tx.VideoSourceFeedback != eVst.Auto)
return Tx.VideoSourceFeedback;
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
return eVst.Hdmi1;
return Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue ? eVst.Hdmi2 : eVst.AllDisabled;
}
}
public RoutingPortCollection<RoutingInputPort> InputPorts
{
get
{
return new RoutingPortCollection<RoutingInputPort>
{
HdmiIn1,
HdmiIn2,
AnyVideoInput
};
}
}
public RoutingPortCollection<RoutingOutputPort> OutputPorts
{
get
{
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
}
}
public DmTx4kz202CController(string key, string name, DmTx4kz202C tx)
: base(key, name, tx)
{
Tx = tx;
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString());
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
//Return VideoSourceFeedback here as DM-TX-4KZ-202-C does not support audio breakaway
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString();
return "";
},
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == eVst.Hdmi1)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
if (ActualActiveVideoInput == eVst.Hdmi2)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return "";
},
VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
};
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.DmCat, null, this);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, null, this);
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback);
// Set Ports for CEC
HdmiIn1.Port = Tx.HdmiInputs[1];
HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput;
DmOut.Port = Tx.DmOutput;
}
public override bool CustomActivate()
{
// Link up all of these damned events to the various RoutingPorts via a helper handler
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
// Base does register and sets up comm monitoring.
return base.CustomActivate();
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
if (Hdmi1VideoSyncFeedback != null)
{
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
if (Hdmi2VideoSyncFeedback != null)
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
}
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
{
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
switch (type)
{
case eRoutingSignalType.Video:
switch (input)
{
case 0:
{
ExecuteSwitch(eVst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(HdmiIn1.Selector, null, type);
break;
}
case 2:
{
ExecuteSwitch(HdmiIn2.Selector, null, type);
break;
}
case 3:
{
ExecuteSwitch(eVst.AllDisabled, null, type);
break;
}
}
break;
case eRoutingSignalType.Audio:
switch (input)
{
case 0:
{
ExecuteSwitch(eAst.Auto, null, type);
break;
}
case 1:
{
ExecuteSwitch(eAst.Hdmi1, null, type);
break;
}
case 2:
{
ExecuteSwitch(eAst.Hdmi2, null, type);
break;
}
case 3:
{
ExecuteSwitch(eAst.AllDisabled, null, type);
break;
}
}
break;
}
}
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{
if ((signalType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector;
if(((signalType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio))
Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key);
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break;
}
}
void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
{
var id = args.EventId;
Debug.Console(2, this, "EventId {0}", args.EventId);
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
ActiveVideoInputFeedback.FireUpdate();
VideoSourceNumericFeedback.FireUpdate();
AudioSourceNumericFeedback.FireUpdate();
ActiveVideoInputFeedback.FireUpdate();
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
Debug.Console(2, this, " Audio Source : {0}", Tx.AudioSourceFeedback);
AudioSourceNumericFeedback.FireUpdate();
break;
}
}
/// <summary>
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
{
return;
}
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
}
/// <summary>
/// Relays the VideoAttributes change to a RoutingInputPort
/// </summary>
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
{
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
switch (eventId)
{
case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HdcpStateFeedbackEventId:
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
break;
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
}
}
#region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
}

View File

@@ -1,368 +1,360 @@
using System; using Crestron.SimplSharpPro;
using System.Collections.Generic; //using Crestron.SimplSharpPro.DeviceSupport;
using System.Linq; using Crestron.SimplSharpPro.DeviceSupport;
using System.Text; using Crestron.SimplSharpPro.DM;
using Crestron.SimplSharp; using Crestron.SimplSharpPro.DM.Endpoints;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
//using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.DeviceSupport; using PepperDash.Core;
using Crestron.SimplSharpPro.DM; using PepperDash.Essentials.Core;
using Crestron.SimplSharpPro.DM.Endpoints; using PepperDash.Essentials.Core.Bridges;
using Crestron.SimplSharpPro.DM.Endpoints.Transmitters;
namespace PepperDash.Essentials.DM
using PepperDash.Core; {
using PepperDash.Essentials.Core; using eVst = eX02VideoSourceType;
using PepperDash.Essentials.Core.Bridges; using eAst = eX02AudioSourceType;
using PepperDash.Essentials.DM.Config;
namespace PepperDash.Essentials.DM [Description("Wrapper class for DM-TX-4K-Z-302-C")]
{ public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback,
using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType; IIROutputPorts, IComPorts
using eAst = Crestron.SimplSharpPro.DeviceSupport.eX02AudioSourceType; {
public DmTx4kz302C Tx { get; private set; }
[Description("Wrapper class for DM-TX-4K-Z-302-C")]
public class DmTx4kz302CController : DmTxControllerBase, ITxRouting, IHasFeedback, public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
IIROutputPorts, IComPorts public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; }
{ public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; }
public DmTx4kz302C Tx { get; private set; } public RoutingOutputPort DmOut { get; private set; }
public RoutingOutputPort HdmiLoopOut { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn1 { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiIn2 { get; private set; } public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses DisplayPortIn { get; private set; } public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public RoutingOutputPort DmOut { get; private set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public RoutingOutputPort HdmiLoopOut { get; private set; } public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; } public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; } public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; } public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; }
public IntFeedback HdmiIn1HdcpCapabilityFeedback { get; protected set; }
public IntFeedback HdmiIn2HdcpCapabilityFeedback { get; protected set; } //public override IntFeedback HdcpSupportAllFeedback { get; protected set; }
public BoolFeedback Hdmi1VideoSyncFeedback { get; protected set; } //public override ushort HdcpSupportCapability { get; protected set; }
public BoolFeedback Hdmi2VideoSyncFeedback { get; protected set; }
public BoolFeedback DisplayPortVideoSyncFeedback { get; protected set; } /// <summary>
/// Helps get the "real" inputs, including when in Auto
//public override IntFeedback HdcpSupportAllFeedback { get; protected set; } /// </summary>
//public override ushort HdcpSupportCapability { get; protected set; } public eX02VideoSourceType ActualActiveVideoInput
{
/// <summary> get
/// Helps get the "real" inputs, including when in Auto {
/// </summary> if (Tx.VideoSourceFeedback != eVst.Auto)
public Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType ActualActiveVideoInput return Tx.VideoSourceFeedback;
{ if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
get return eVst.Hdmi1;
{ if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
if (Tx.VideoSourceFeedback != eVst.Auto) return eVst.Hdmi2;
return Tx.VideoSourceFeedback;
else // auto return Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue ? eVst.Vga : eVst.AllDisabled;
{ }
if (Tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue) }
return eVst.Hdmi1; public RoutingPortCollection<RoutingInputPort> InputPorts
else if (Tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) {
return eVst.Hdmi2; get
else if (Tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) {
return eVst.Vga; return new RoutingPortCollection<RoutingInputPort>
else {
return eVst.AllDisabled; HdmiIn1,
} HdmiIn2,
} DisplayPortIn,
} AnyVideoInput
public RoutingPortCollection<RoutingInputPort> InputPorts };
{ }
get }
{ public RoutingPortCollection<RoutingOutputPort> OutputPorts
return new RoutingPortCollection<RoutingInputPort> {
{ get
HdmiIn1, {
HdmiIn2, return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut };
DisplayPortIn, }
AnyVideoInput }
}; public DmTx4kz302CController(string key, string name, DmTx4kz302C tx)
} : base(key, name, tx)
} {
public RoutingPortCollection<RoutingOutputPort> OutputPorts Tx = tx;
{
get HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1,
{ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
return new RoutingPortCollection<RoutingOutputPort> { DmOut, HdmiLoopOut }; VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1]));
} HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2,
} eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this,
public DmTx4kz302CController(string key, string name, DmTx4kz302C tx) VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2]));
: base(key, name, tx) DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
{ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DisplayPort, eVst.DisplayPort, this,
Tx = tx; VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput));
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
HdmiIn1 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn1, () => ActualActiveVideoInput.ToString());
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi1, this,
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[1])); Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent;
HdmiIn2 = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn2, Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eVst.Hdmi2, this, Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChange;
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInputs[2])); Tx.BaseEvent += Tx_BaseEvent;
DisplayPortIn = new RoutingInputPortWithVideoStatuses(DmPortName.VgaIn,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DisplayPort, eVst.DisplayPort, this, VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
VideoStatusHelper.GetDisplayPortInputStatusFuncs(tx.DisplayPortInput)); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
() => ActualActiveVideoInput.ToString()); HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
Tx.HdmiInputs[1].InputStreamChange += InputStreamChangeEvent; HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
Tx.HdmiInputs[2].InputStreamChange += InputStreamChangeEvent;
Tx.DisplayPortInput.InputStreamChange += DisplayPortInputStreamChange; HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Tx.BaseEvent += Tx_BaseEvent;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue);
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); DisplayPortVideoSyncFeedback = new BoolFeedback(() => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
var combinedFuncs = new VideoStatusFuncsWrapper
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; {
HdcpActiveFeedbackFunc = () =>
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); (ActualActiveVideoInput == eVst.Hdmi1
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
Hdmi2VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue); || (ActualActiveVideoInput == eVst.Hdmi2
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue),
DisplayPortVideoSyncFeedback = new BoolFeedback(() => (bool)tx.DisplayPortInput.SyncDetectedFeedback.BoolValue);
HdcpStateFeedbackFunc = () =>
{
var combinedFuncs = new VideoStatusFuncsWrapper if (ActualActiveVideoInput == eVst.Hdmi1)
{ return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString();
HdcpActiveFeedbackFunc = () => return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : "";
(ActualActiveVideoInput == eVst.Hdmi1 },
&& tx.HdmiInputs[1].VideoAttributes.HdcpActiveFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2 VideoResolutionFeedbackFunc = () =>
&& tx.HdmiInputs[2].VideoAttributes.HdcpActiveFeedback.BoolValue), {
if (ActualActiveVideoInput == eVst.Hdmi1)
HdcpStateFeedbackFunc = () => return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString();
{ if (ActualActiveVideoInput == eVst.Hdmi2)
if (ActualActiveVideoInput == eVst.Hdmi1) return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return tx.HdmiInputs[1].VideoAttributes.HdcpStateFeedback.ToString(); return ActualActiveVideoInput == eVst.Vga ? tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString() : "";
return ActualActiveVideoInput == eVst.Hdmi2 ? tx.HdmiInputs[2].VideoAttributes.HdcpStateFeedback.ToString() : ""; },
}, VideoSyncFeedbackFunc = () =>
(ActualActiveVideoInput == eVst.Hdmi1
VideoResolutionFeedbackFunc = () => && tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
{ || (ActualActiveVideoInput == eVst.Hdmi2
if (ActualActiveVideoInput == eVst.Hdmi1) && tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue)
return tx.HdmiInputs[1].VideoAttributes.GetVideoResolutionString(); || (ActualActiveVideoInput == eVst.Vga
if (ActualActiveVideoInput == eVst.Hdmi2) && tx.DisplayPortInput.SyncDetectedFeedback.BoolValue)
return tx.HdmiInputs[2].VideoAttributes.GetVideoResolutionString();
return ActualActiveVideoInput == eVst.Vga ? tx.DisplayPortInput.VideoAttributes.GetVideoResolutionString() : ""; };
},
VideoSyncFeedbackFunc = () => AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
(ActualActiveVideoInput == eVst.Hdmi1 eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
&& tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue)
|| (ActualActiveVideoInput == eVst.Hdmi2 DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
&& tx.HdmiInputs[2].SyncDetectedFeedback.BoolValue) eRoutingPortConnectionType.DmCat, null, this);
|| (ActualActiveVideoInput == eVst.Vga HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
&& tx.DisplayPortInput.SyncDetectedFeedback.BoolValue) eRoutingPortConnectionType.Hdmi, null, this);
};
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback,
AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn, AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs); AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback,
DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback);
eRoutingPortConnectionType.DmCat, null, this);
HdmiLoopOut = new RoutingOutputPort(DmPortName.HdmiLoopOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, // Set Ports for CEC
eRoutingPortConnectionType.Hdmi, null, this); HdmiIn1.Port = Tx.HdmiInputs[1];
HdmiIn2.Port = Tx.HdmiInputs[2];
HdmiLoopOut.Port = Tx.HdmiOutput;
AddToFeedbackList(ActiveVideoInputFeedback, VideoSourceNumericFeedback, AudioSourceNumericFeedback, DmOut.Port = Tx.DmOutput;
AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback, }
AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiIn1HdcpCapabilityFeedback, HdmiIn2HdcpCapabilityFeedback, void DisplayPortInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
Hdmi1VideoSyncFeedback, Hdmi2VideoSyncFeedback, DisplayPortVideoSyncFeedback); {
Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
// Set Ports for CEC
HdmiIn1.Port = Tx.HdmiInputs[1]; switch (args.EventId)
HdmiIn2.Port = Tx.HdmiInputs[2]; {
HdmiLoopOut.Port = Tx.HdmiOutput; case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
DmOut.Port = Tx.DmOutput; DisplayPortVideoSyncFeedback.FireUpdate();
} break;
}
void DisplayPortInputStreamChange(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) }
{
Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId) public override bool CustomActivate()
{ {
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: // Link up all of these damned events to the various RoutingPorts via a helper handler
DisplayPortVideoSyncFeedback.FireUpdate(); Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId);
break; Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId);
}
} Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId);
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId);
Tx.DisplayPortInput.InputStreamChange += (o, a) => FowardInputStreamChange(DisplayPortIn, a.EventId);
public override bool CustomActivate() Tx.DisplayPortInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(DisplayPortIn, a.EventId);
{
// Link up all of these damned events to the various RoutingPorts via a helper handler // Base does register and sets up comm monitoring.
Tx.HdmiInputs[1].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn1, a.EventId); return base.CustomActivate();
Tx.HdmiInputs[1].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn1, a.EventId); }
Tx.HdmiInputs[2].InputStreamChange += (o, a) => FowardInputStreamChange(HdmiIn2, a.EventId); public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
Tx.HdmiInputs[2].VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(HdmiIn2, a.EventId); {
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
Tx.DisplayPortInput.InputStreamChange += (o, a) => FowardInputStreamChange(DisplayPortIn, a.EventId);
Tx.DisplayPortInput.VideoAttributes.AttributeChange += (o, a) => ForwardVideoAttributeChange(DisplayPortIn, a.EventId); if (Hdmi1VideoSyncFeedback != null)
{
// Base does register and sets up comm monitoring. Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
return base.CustomActivate(); }
} if (Hdmi2VideoSyncFeedback != null)
{
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]);
{ }
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); if (DisplayPortVideoSyncFeedback != null)
{
if (Hdmi1VideoSyncFeedback != null) DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]);
{ }
Hdmi1VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
} LinkDmTxToApi(this, trilist, joinMap, bridge);
if (Hdmi2VideoSyncFeedback != null) }
{
Hdmi2VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input2VideoSyncStatus.JoinNumber]); public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type)
} {
if (DisplayPortVideoSyncFeedback != null) Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input);
{
DisplayPortVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input3VideoSyncStatus.JoinNumber]); switch (input)
} {
case 0:
LinkDmTxToApi(this, trilist, joinMap, bridge); {
} ExecuteSwitch(eVst.Auto, null, eRoutingSignalType.Audio | eRoutingSignalType.Video);
break;
public void ExecuteNumericSwitch(ushort input, ushort output, eRoutingSignalType type) }
{ case 1:
Debug.Console(2, this, "Executing Numeric Switch to input {0}.", input); {
ExecuteSwitch(HdmiIn1.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video);
switch (input) break;
{ }
case 0: case 2:
{ {
ExecuteSwitch(eVst.Auto, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); ExecuteSwitch(HdmiIn2.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video);
break; break;
} }
case 1: case 3:
{ {
ExecuteSwitch(HdmiIn1.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); ExecuteSwitch(DisplayPortIn.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video);
break; break;
} }
case 2: case 4:
{ {
ExecuteSwitch(HdmiIn2.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); ExecuteSwitch(eVst.AllDisabled, null, eRoutingSignalType.Audio | eRoutingSignalType.Video);
break; break;
} }
case 3: }
{
ExecuteSwitch(DisplayPortIn.Selector, null, eRoutingSignalType.Audio | eRoutingSignalType.Video);
break; }
}
case 4: public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
{ {
ExecuteSwitch(eVst.AllDisabled, null, eRoutingSignalType.Audio | eRoutingSignalType.Video); if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
break; Tx.VideoSource = (eVst)inputSelector;
}
} // NOTE: It's possible that this particular TX model may not like the AudioSource property being set.
// The SIMPL definition only shows a single analog for AudioVideo Source
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
} //it doesn't
Debug.Console(2, this, "Unable to execute audio-only switch for tx {0}", Key);
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType) //Tx.AudioSource = (eAst)inputSelector;
{ }
if ((signalType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
Tx.VideoSource = (eVst)inputSelector; void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
// NOTE: It's possible that this particular TX model may not like the AudioSource property being set. Debug.Console(2, "{0} event {1} stream {2}", Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
// The SIMPL definition only shows a single analog for AudioVideo Source
if ((signalType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) switch (args.EventId)
Tx.AudioSource = (eAst)inputSelector; {
} case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args) if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
{ break;
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString()); case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
switch (args.EventId) if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
{ break;
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: }
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate(); }
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break; void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: {
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); var id = args.EventId;
if (inputStream == Tx.HdmiInputs[2]) Hdmi2VideoSyncFeedback.FireUpdate(); switch (id)
break; {
} case EndpointTransmitterBase.VideoSourceFeedbackEventId:
} Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
VideoSourceNumericFeedback.FireUpdate();
void Tx_BaseEvent(GenericBase device, BaseEventArgs args) ActiveVideoInputFeedback.FireUpdate();
{ break;
var id = args.EventId; case EndpointTransmitterBase.AudioSourceFeedbackEventId:
switch (id) Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
{ AudioSourceNumericFeedback.FireUpdate();
case EndpointTransmitterBase.VideoSourceFeedbackEventId: break;
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback); }
VideoSourceNumericFeedback.FireUpdate(); }
ActiveVideoInputFeedback.FireUpdate();
break; /// <summary>
case EndpointTransmitterBase.AudioSourceFeedbackEventId: /// Relays the input stream change to the appropriate RoutingInputPort.
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback); /// </summary>
AudioSourceNumericFeedback.FireUpdate(); void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
break; {
} if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return;
} inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
/// <summary> }
/// Relays the input stream change to the appropriate RoutingInputPort.
/// </summary> /// <summary>
void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) /// Relays the VideoAttributes change to a RoutingInputPort
{ /// </summary>
if (eventId != EndpointInputStreamEventIds.SyncDetectedFeedbackEventId) return; void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
inputPort.VideoStatus.VideoSyncFeedback.FireUpdate(); {
AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate(); //// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds
} //Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}",
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType());
/// <summary> switch (eventId)
/// Relays the VideoAttributes change to a RoutingInputPort {
/// </summary> case VideoAttributeEventIds.HdcpActiveFeedbackEventId:
void ForwardVideoAttributeChange(RoutingInputPortWithVideoStatuses inputPort, int eventId) inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate();
{ AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate();
//// LOCATION: Crestron.SimplSharpPro.DM.VideoAttributeEventIds break;
//Debug.Console(2, this, "VideoAttributes_AttributeChange event id={0} from {1}", case VideoAttributeEventIds.HdcpStateFeedbackEventId:
// args.EventId, (sender as VideoAttributesEnhanced).Owner.GetType()); inputPort.VideoStatus.HdcpStateFeedback.FireUpdate();
switch (eventId) AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate();
{ break;
case VideoAttributeEventIds.HdcpActiveFeedbackEventId: case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId:
inputPort.VideoStatus.HdcpActiveFeedback.FireUpdate(); case VideoAttributeEventIds.VerticalResolutionFeedbackEventId:
AnyVideoInput.VideoStatus.HdcpActiveFeedback.FireUpdate(); inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
break; AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
case VideoAttributeEventIds.HdcpStateFeedbackEventId: break;
inputPort.VideoStatus.HdcpStateFeedback.FireUpdate(); case VideoAttributeEventIds.FramesPerSecondFeedbackEventId:
AnyVideoInput.VideoStatus.HdcpStateFeedback.FireUpdate(); inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate();
break; AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
case VideoAttributeEventIds.HorizontalResolutionFeedbackEventId: break;
case VideoAttributeEventIds.VerticalResolutionFeedbackEventId: }
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); }
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate();
break;
case VideoAttributeEventIds.FramesPerSecondFeedbackEventId: #region IIROutputPorts Members
inputPort.VideoStatus.VideoResolutionFeedback.FireUpdate(); public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
AnyVideoInput.VideoStatus.VideoResolutionFeedback.FireUpdate(); public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
break; #endregion
}
} #region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#region IIROutputPorts Members #endregion
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
#endregion
#region IComPorts Members
public CrestronCollection<ComPort> ComPorts { get { return Tx.ComPorts; } }
public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
#endregion
}
} }

View File

@@ -52,7 +52,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem)); return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem)); return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem)); return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
@@ -115,7 +115,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num])); return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(chassis.Inputs[num])); return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num])); return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))
@@ -138,7 +138,7 @@ namespace PepperDash.Essentials.DM
if (typeName.StartsWith("dmtx4k202")) if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num])); return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202")) if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4k202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num])); return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302")) if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num])); return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302")) if (typeName.StartsWith("dmtx4kz302"))

View File

@@ -105,6 +105,7 @@
<Compile Include="Endpoints\DGEs\DmDge200CController.cs" /> <Compile Include="Endpoints\DGEs\DmDge200CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" /> <Compile Include="Endpoints\Receivers\DmRmc4kZ100CController.cs" />
<Compile Include="Endpoints\Receivers\DmRmc4kZScalerCController.cs" /> <Compile Include="Endpoints\Receivers\DmRmc4kZScalerCController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx4kz202CController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx201SController.cs" /> <Compile Include="Endpoints\Transmitters\DmTx201SController.cs" />
<Compile Include="Endpoints\Transmitters\DmTx4kz100Controller.cs" /> <Compile Include="Endpoints\Transmitters\DmTx4kz100Controller.cs" />
<Compile Include="Endpoints\Transmitters\TxInterfaces.cs" /> <Compile Include="Endpoints\Transmitters\TxInterfaces.cs" />