diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs
new file mode 100644
index 00000000..036602d3
--- /dev/null
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs
@@ -0,0 +1,320 @@
+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.Transmitters;
+
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Bridges;
+using PepperDash.Essentials.DM.Config;
+
+namespace PepperDash.Essentials.DM
+{
+ // using eVst = Crestron.SimplSharpPro.DeviceSupport.eX02VideoSourceType;
+
+ ///
+ /// Controller class for all DM-TX-201C/S/F transmitters
+ ///
+ public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback,
+ IIROutputPorts, IComPorts, ICec
+ {
+ public DmTx4kz100C1G Tx { get; private set; }
+
+ public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; }
+ public RoutingOutputPort DmOutput { get; private set; }
+
+ public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
+ public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
+ public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
+
+ ///
+ /// Helps get the "real" inputs, including when in Auto
+ ///
+ public DmTx200Base.eSourceSelection ActualActiveVideoInput
+ {
+ get
+ {
+ if (Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Digital ||
+ Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Analog ||
+ Tx.VideoSourceFeedback == DmTx200Base.eSourceSelection.Disable)
+ return Tx.VideoSourceFeedback;
+ else // auto
+ {
+ if (Tx.HdmiInput.SyncDetectedFeedback.BoolValue)
+ return DmTx200Base.eSourceSelection.Digital;
+ else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
+ return DmTx200Base.eSourceSelection.Analog;
+ else
+ return DmTx200Base.eSourceSelection.Disable;
+ }
+ }
+ }
+
+ public RoutingPortCollection InputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection
+ {
+ HdmiInput
+ };
+ }
+ }
+
+ public RoutingPortCollection OutputPorts
+ {
+ get
+ {
+ return new RoutingPortCollection { DmOutput };
+ }
+ }
+
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
+ public DmTx4kz100Controller(string key, string name, DmTx4kz100C1G tx)
+ : base(key, name, tx)
+ {
+ Tx = tx;
+
+ HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this,
+ VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
+
+ ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput",
+ () => ActualActiveVideoInput.ToString());
+
+ Tx.HdmiInput.InputStreamChange += new EndpointInputStreamChangeEventHandler(InputStreamChangeEvent);
+ Tx.BaseEvent += Tx_BaseEvent;
+ Tx.OnlineStatusChange += new OnlineStatusChangeEventHandler(Tx_OnlineStatusChange);
+
+
+ HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
+ {
+ if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue)
+ return 1;
+ else
+ return 0;
+ });
+
+ HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
+
+ HdmiVideoSyncFeedback = new BoolFeedback(() =>
+ {
+ return (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue;
+ });
+
+
+ var combinedFuncs = new VideoStatusFuncsWrapper
+ {
+ HdcpActiveFeedbackFunc = () =>
+ (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
+ && tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
+
+ HdcpStateFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
+ return tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString();
+ return "";
+ },
+
+ VideoResolutionFeedbackFunc = () =>
+ {
+ if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
+ return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
+ if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog)
+ return tx.VgaInput.VideoAttributes.GetVideoResolutionString();
+ return "";
+ },
+ VideoSyncFeedbackFunc = () =>
+ (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
+ && tx.HdmiInput.SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog
+ && tx.VgaInput.SyncDetectedFeedback.BoolValue)
+ || (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Auto
+ && (tx.VgaInput.SyncDetectedFeedback.BoolValue || tx.HdmiInput.SyncDetectedFeedback.BoolValue))
+
+ };
+
+ AnyVideoInput = new RoutingInputPortWithVideoStatuses(DmPortName.AnyVideoIn,
+ eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.None, 0, this, combinedFuncs);
+
+ DmOutput = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, null, this);
+
+ AddToFeedbackList(ActiveVideoInputFeedback,
+ AnyVideoInput.VideoStatus.HasVideoStatusFeedback, AnyVideoInput.VideoStatus.HdcpActiveFeedback,
+ AnyVideoInput.VideoStatus.HdcpStateFeedback, AnyVideoInput.VideoStatus.VideoResolutionFeedback,
+ AnyVideoInput.VideoStatus.VideoSyncFeedback, HdmiInHdcpCapabilityFeedback, HdmiVideoSyncFeedback
+ );
+
+ // Set Ports for CEC
+ HdmiInput.Port = Tx.HdmiInput;
+ DmOutput.Port = Tx.DmOutput;
+ }
+
+
+ void Tx_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
+ {
+ ActiveVideoInputFeedback.FireUpdate();
+ HdmiVideoSyncFeedback.FireUpdate();
+ }
+
+ public override bool CustomActivate()
+ {
+
+ Tx.HdmiInput.InputStreamChange += (o, a) => FowardInputStreamChange(HdmiInput, a.EventId);
+ Tx.HdmiInput.VideoAttributes.AttributeChange += (o, a) => FireVideoAttributeChange(HdmiInput, 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)
+ {
+ DmTxControllerJoinMap joinMap = GetDmTxJoinMap(joinStart, joinMapKey);
+
+ if (HdmiVideoSyncFeedback != null)
+ {
+ HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
+ }
+
+ LinkDmTxToApi(this, trilist, joinMap, bridge);
+ }
+
+ ///
+ /// Enables or disables free run
+ ///
+ ///
+ public void SetFreeRunEnabled(bool enable)
+ {
+ if (enable)
+ {
+ Tx.VgaInput.FreeRun = eDmFreeRunSetting.Enabled;
+ }
+ else
+ {
+ Tx.VgaInput.FreeRun = eDmFreeRunSetting.Disabled;
+ }
+ }
+
+ ///
+ /// Sets the VGA brightness level
+ ///
+ ///
+ public void SetVgaBrightness(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
+ }
+
+ ///
+ /// Sets the VGA contrast level
+ ///
+ ///
+ public void SetVgaContrast(ushort level)
+ {
+ Tx.VgaInput.VideoControls.Contrast.UShortValue = level;
+ }
+
+
+ void Tx_BaseEvent(GenericBase device, BaseEventArgs args)
+ {
+ var id = args.EventId;
+ Debug.Console(2, this, "EventId {0}", args.EventId);
+
+ if (id == EndpointTransmitterBase.VideoSourceFeedbackEventId)
+ {
+ Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
+ ActiveVideoInputFeedback.FireUpdate();
+ }
+
+ // ------------------------------ incomplete -----------------------------------------
+ else if (id == EndpointTransmitterBase.AudioSourceFeedbackEventId)
+ {
+ Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
+ }
+ }
+
+ void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
+ {
+ Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
+
+ if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId)
+ {
+ HdmiInHdcpCapabilityFeedback.FireUpdate();
+ }
+ else if (args.EventId == EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId)
+ {
+ HdmiInHdcpCapabilityFeedback.FireUpdate();
+ }
+ }
+
+ ///
+ /// Relays the input stream change to the appropriate RoutingInputPort.
+ ///
+ void FowardInputStreamChange(RoutingInputPortWithVideoStatuses inputPort, int eventId)
+ {
+ if (eventId == EndpointInputStreamEventIds.SyncDetectedFeedbackEventId)
+ {
+ inputPort.VideoStatus.VideoSyncFeedback.FireUpdate();
+ AnyVideoInput.VideoStatus.VideoSyncFeedback.FireUpdate();
+ }
+ }
+
+ ///
+ /// Relays the VideoAttributes change to a RoutingInputPort
+ ///
+ void FireVideoAttributeChange(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 IROutputPorts { get { return Tx.IROutputPorts; } }
+ public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
+ #endregion
+
+ #region IComPorts Members
+ public CrestronCollection ComPorts { get { return Tx.ComPorts; } }
+ public int NumberOfComPorts { get { return Tx.NumberOfComPorts; } }
+ #endregion
+
+ #region ICec Members
+ ///
+ /// Gets the CEC stream directly from the HDMI port.
+ ///
+ public Cec StreamCec { get { return Tx.HdmiInput.StreamCec; } }
+ #endregion
+
+
+ }
+}
\ No newline at end of file
diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
index d5fd9dd2..4fcc4742 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
+++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs
@@ -43,6 +43,8 @@ namespace PepperDash.Essentials.DM
{
if(typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, Global.ControlSystem));
+ if (typeName.StartsWith("dmtx4kz100"))
+ return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx201"))
return new DmTx201XController(key, name, new DmTx201S(ipid, Global.ControlSystem));
if (typeName.StartsWith("dmtx4k202"))
@@ -104,6 +106,8 @@ namespace PepperDash.Essentials.DM
return new DmTx201XController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
+ if (typeName.StartsWith("dmtx4kz100"))
+ return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
@@ -123,6 +127,8 @@ namespace PepperDash.Essentials.DM
return new DmTx201XController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
+ if (typeName.StartsWith("dmtx4kz100"))
+ return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
@@ -329,7 +335,8 @@ namespace PepperDash.Essentials.DM
{
public DmTxControllerFactory()
{
- TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c", "dmtx401c", "dmtx401s" };
+ TypeNames = new List() { "dmtx200c", "dmtx201c", "dmtx201s", "dmtx4k100c", "dmtx4k202c", "dmtx4kz202c", "dmtx4k302c", "dmtx4kz302c",
+ "dmtx401c", "dmtx401s", "dmtx4k100c1g", "dmtx4kz100c1g" };
}
public override EssentialsDevice BuildDevice(DeviceConfig dc)
diff --git a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj
index 8467f92a..2c245384 100644
--- a/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj
+++ b/essentials-framework/Essentials DM/Essentials_DM/PepperDash_Essentials_DM.csproj
@@ -102,6 +102,7 @@
+