Merge branch 'development' into feature/multi-display-room-changes

This commit is contained in:
Andrew Welker
2020-07-10 10:41:14 -06:00
13 changed files with 735 additions and 751 deletions

View File

@@ -64,7 +64,7 @@
</Reference> </Reference>
<Reference Include="Crestron.SimplSharpPro.Gateways, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL"> <Reference Include="Crestron.SimplSharpPro.Gateways, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath> <HintPath>..\..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Gateways.dll</HintPath>
</Reference> </Reference>
<Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL"> <Reference Include="Crestron.SimplSharpPro.GeneralIO, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>

View File

@@ -1,310 +1,317 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.Gateways; using Crestron.SimplSharpPro.Gateways;
using Crestron.SimplSharpPro.Remotes; using Crestron.SimplSharpPro.Remotes;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharp.Reflection; using Crestron.SimplSharp.Reflection;
using Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Bridges;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
[Description("Wrapper class for all HR-Series remotes")] [Description("Wrapper class for all HR-Series remotes")]
public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback public class Hrxx0WirelessRemoteController : EssentialsBridgeableDevice, IHasFeedback
{ {
private CenRfgwController _gateway; private CenRfgwController _gateway;
private Hr1x0WirelessRemoteBase _remote; private GatewayBase _gatewayBase;
public FeedbackCollection<Feedback> Feedbacks { get; set; }
private Hr1x0WirelessRemoteBase _remote;
public CrestronCollection<Button> Buttons { get { return _remote.Button; } }
public FeedbackCollection<Feedback> Feedbacks { get; set; }
private DeviceConfig _config;
public CrestronCollection<Button> Buttons { get { return _remote.Button; } }
public Hrxx0WirelessRemoteController(string key, Func<DeviceConfig, Hr1x0WirelessRemoteBase> preActivationFunc,
DeviceConfig config) private DeviceConfig _config;
: base(key, config.Name)
{ public Hrxx0WirelessRemoteController(string key, Func<DeviceConfig, Hr1x0WirelessRemoteBase> preActivationFunc,
Feedbacks = new FeedbackCollection<Feedback>(); DeviceConfig config)
: base(key, config.Name)
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString()); {
Feedbacks = new FeedbackCollection<Feedback>();
var type = config.Type;
var rfId = (uint)props.Control.InfinetIdInt; var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
_config = config;
var type = config.Type;
GatewayBase gateway; var rfId = (uint)props.Control.InfinetIdInt;
_config = config;
if (props.GatewayDeviceKey == "processor")
{ if (props.GatewayDeviceKey == "processor")
gateway = Global.ControlSystem.ControllerRFGatewayDevice; {
} {
AddPreActivationAction(() =>
else {
{ _remote = preActivationFunc(config);
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController; RegisterEvents();
if (gatewayDev == null) });
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey); return;
} }
if (gatewayDev != null) }
{
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
gateway = gatewayDev.GateWay; var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
_gateway = gatewayDev; if (gatewayDev == null)
} {
} Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
}
if (_gateway == null) return; if (gatewayDev != null)
{
_gateway.IsReadyEvent += _gateway_IsReadyEvent; Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
if (_gateway.IsReady) _gateway = gatewayDev;
{ }
AddPreActivationAction(() =>
{
_remote = preActivationFunc(config); if (_gateway == null) return;
RegisterEvents(); _gateway.IsReadyEvent += _gateway_IsReadyEvent;
}); if (_gateway.IsReady)
} {
} AddPreActivationAction(() =>
{
void _gateway_IsReadyEvent(object sender, PepperDash_Essentials_Core.IsReadyEventArgs e) _remote = preActivationFunc(config);
{
if (e.IsReady != true) return; RegisterEvents();
_remote = GetHr1x0WirelessRemote(_config); });
}
RegisterEvents(); }
}
void _gateway_IsReadyEvent(object sender, PepperDash_Essentials_Core.IsReadyEventArgs e)
void _remote_BaseEvent(GenericBase device, BaseEventArgs args) {
{ if (e.IsReady != true) return;
if(args.EventId == Hr1x0EventIds.BatteryCriticalFeedbackEventId) _remote = GetHr1x0WirelessRemote(_config);
Feedbacks["BatteryCritical"].FireUpdate();
if(args.EventId == Hr1x0EventIds.BatteryLowFeedbackEventId) RegisterEvents();
Feedbacks["BatteryLow"].FireUpdate(); }
if(args.EventId == Hr1x0EventIds.BatteryVoltageFeedbackEventId)
Feedbacks["BatteryVoltage"].FireUpdate(); void _remote_BaseEvent(GenericBase device, BaseEventArgs args)
} {
if(args.EventId == Hr1x0EventIds.BatteryCriticalFeedbackEventId)
private void RegisterEvents() Feedbacks["BatteryCritical"].FireUpdate();
{ if(args.EventId == Hr1x0EventIds.BatteryLowFeedbackEventId)
_remote.ButtonStateChange += _remote_ButtonStateChange; Feedbacks["BatteryLow"].FireUpdate();
if(args.EventId == Hr1x0EventIds.BatteryVoltageFeedbackEventId)
Feedbacks.Add(new BoolFeedback("BatteryCritical", () => _remote.BatteryCriticalFeedback.BoolValue)); Feedbacks["BatteryVoltage"].FireUpdate();
Feedbacks.Add(new BoolFeedback("BatteryLow", () => _remote.BatteryLowFeedback.BoolValue)); }
Feedbacks.Add(new IntFeedback("BatteryVoltage", () => _remote.BatteryVoltageFeedback.UShortValue));
private void RegisterEvents()
_remote.BaseEvent += _remote_BaseEvent; {
} _remote.ButtonStateChange += _remote_ButtonStateChange;
void _remote_ButtonStateChange(GenericBase device, ButtonEventArgs args) Feedbacks.Add(new BoolFeedback("BatteryCritical", () => _remote.BatteryCriticalFeedback.BoolValue));
{ Feedbacks.Add(new BoolFeedback("BatteryLow", () => _remote.BatteryLowFeedback.BoolValue));
try Feedbacks.Add(new IntFeedback("BatteryVoltage", () => _remote.BatteryVoltageFeedback.UShortValue));
{
var handler = args.Button.UserObject; _remote.BaseEvent += _remote_BaseEvent;
}
if (handler == null) return;
void _remote_ButtonStateChange(GenericBase device, ButtonEventArgs args)
Debug.Console(1, this, "Executing Action: {0}", handler.ToString()); {
try
if (handler is Action<bool>) {
{ var handler = args.Button.UserObject;
(handler as Action<bool>)(args.Button.State == eButtonState.Pressed ? true : false);
} if (handler == null) return;
}
catch (Exception e) Debug.Console(1, this, "Executing Action: {0}", handler.ToString());
{
Debug.Console(2, this, "Error in ButtonStateChange handler: {0}", e); if (handler is Action<bool>)
} {
} (handler as Action<bool>)(args.Button.State == eButtonState.Pressed ? true : false);
}
}
#region Preactivation catch (Exception e)
{
private static Hr1x0WirelessRemoteBase GetHr1x0WirelessRemote(DeviceConfig config) Debug.Console(2, this, "Error in ButtonStateChange handler: {0}", e);
{ }
var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString()); }
var type = config.Type;
var rfId = (uint)props.Control.InfinetIdInt; #region Preactivation
GatewayBase gateway; private static Hr1x0WirelessRemoteBase GetHr1x0WirelessRemote(DeviceConfig config)
{
if (props.GatewayDeviceKey == "processor") var props = JsonConvert.DeserializeObject<CrestronRemotePropertiesConfig>(config.Properties.ToString());
{
gateway = Global.ControlSystem.ControllerRFGatewayDevice; var type = config.Type;
} var rfId = (uint)props.Control.InfinetIdInt;
else
{ GatewayBase gateway;
var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
if (gatewayDev == null) if (props.GatewayDeviceKey == "processor")
{ {
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey); gateway = Global.ControlSystem.ControllerRFGatewayDevice;
return null; }
} else
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey); {
gateway = gatewayDev.GateWay; var gatewayDev = DeviceManager.GetDeviceForKey(props.GatewayDeviceKey) as CenRfgwController;
} if (gatewayDev == null)
{
if (gateway == null) Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid device", props.GatewayDeviceKey);
{ return null;
Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid gateway", props.GatewayDeviceKey); }
return null; Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is a valid device", props.GatewayDeviceKey);
} gateway = gatewayDev.GateWay;
}
Hr1x0WirelessRemoteBase remoteBase;
switch (type) if (gateway == null)
{ {
case ("hr100"): Debug.Console(0, "GetHr1x0WirelessRemote: Device '{0}' is not a valid gateway", props.GatewayDeviceKey);
remoteBase = new Hr100(rfId, gateway); return null;
break; }
case ("hr150"):
remoteBase = new Hr150(rfId, gateway); Hr1x0WirelessRemoteBase remoteBase;
break; switch (type)
case ("hr310"): {
remoteBase = new Hr310(rfId, gateway); case ("hr100"):
break; remoteBase = new Hr100(rfId, gateway);
default: break;
return null; case ("hr150"):
} remoteBase = new Hr150(rfId, gateway);
break;
// register the device when using an internal RF gateway case ("hr310"):
if (props.GatewayDeviceKey == "processor") remoteBase = new Hr310(rfId, gateway);
{ break;
remoteBase.RegisterWithLogging(config.Key); default:
} return null;
}
return remoteBase;
} // register the device when using an internal RF gateway
if (props.GatewayDeviceKey == "processor")
#endregion {
remoteBase.RegisterWithLogging(config.Key);
#region Factory }
public class Hrxx0WirelessRemoteControllerFactory : EssentialsDeviceFactory<Hrxx0WirelessRemoteController>
{ return remoteBase;
public Hrxx0WirelessRemoteControllerFactory() }
{
TypeNames = new List<string>() { "hr100", "hr150", "hr310" }; #endregion
}
#region Factory
public override EssentialsDevice BuildDevice(DeviceConfig dc) public class Hrxx0WirelessRemoteControllerFactory : EssentialsDeviceFactory<Hrxx0WirelessRemoteController>
{ {
Debug.Console(1, "Factory Attempting to create new HR-x00 Remote Device"); public Hrxx0WirelessRemoteControllerFactory()
{
return new Hrxx0WirelessRemoteController(dc.Key, GetHr1x0WirelessRemote, dc); TypeNames = new List<string>() { "hr100", "hr150", "hr310" };
} }
}
#endregion public override EssentialsDevice BuildDevice(DeviceConfig dc)
{
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) Debug.Console(1, "Factory Attempting to create new HR-x00 Remote Device");
{
var joinMap = new Hrxxx0WirelessRemoteControllerJoinMap(joinStart); return new Hrxx0WirelessRemoteController(dc.Key, GetHr1x0WirelessRemote, dc);
}
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey); }
#endregion
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<Hrxxx0WirelessRemoteControllerJoinMap>(joinMapSerialized); public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
if (bridge != null) var joinMap = new Hrxxx0WirelessRemoteControllerJoinMap(joinStart);
{
bridge.AddJoinMap(Key, joinMap); var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
}
else if (!string.IsNullOrEmpty(joinMapSerialized))
{ joinMap = JsonConvert.DeserializeObject<Hrxxx0WirelessRemoteControllerJoinMap>(joinMapSerialized);
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
} if (bridge != null)
{
//List<string> ExcludedKeys = new List<string>(); bridge.AddJoinMap(Key, joinMap);
foreach (var feedback in Feedbacks) }
{ else
var myFeedback = feedback; {
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
var joinData = }
joinMap.Joins.FirstOrDefault(
x => //List<string> ExcludedKeys = new List<string>();
x.Key.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase)); foreach (var feedback in Feedbacks)
{
if (string.IsNullOrEmpty((joinData.Key))) continue; var myFeedback = feedback;
var name = joinData.Key; var joinData =
var join = joinData.Value; joinMap.Joins.FirstOrDefault(
x =>
if (join.Metadata.JoinType == eJoinType.Digital) x.Key.Equals(myFeedback.Key, StringComparison.InvariantCultureIgnoreCase));
{
Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", name, join.JoinNumber); if (string.IsNullOrEmpty((joinData.Key))) continue;
var someFeedback = myFeedback as BoolFeedback;
if(someFeedback == null) continue; var name = joinData.Key;
someFeedback.LinkInputSig(trilist.BooleanInput[join.JoinNumber]); var join = joinData.Value;
}
if (join.Metadata.JoinType == eJoinType.Analog) if (join.Metadata.JoinType == eJoinType.Digital)
{ {
Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", name, join.JoinNumber); Debug.Console(0, this, "Linking Bool Feedback '{0}' to join {1}", name, join.JoinNumber);
var someFeedback = myFeedback as IntFeedback; var someFeedback = myFeedback as BoolFeedback;
if (someFeedback == null) continue; if(someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.UShortInput[join.JoinNumber]); someFeedback.LinkInputSig(trilist.BooleanInput[join.JoinNumber]);
} }
if (join.Metadata.JoinType == eJoinType.Serial) if (join.Metadata.JoinType == eJoinType.Analog)
{ {
Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", name, join.JoinNumber); Debug.Console(0, this, "Linking Analog Feedback '{0}' to join {1}", name, join.JoinNumber);
var someFeedback = myFeedback as StringFeedback; var someFeedback = myFeedback as IntFeedback;
if (someFeedback == null) continue; if (someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.StringInput[join.JoinNumber]); someFeedback.LinkInputSig(trilist.UShortInput[join.JoinNumber]);
} }
} if (join.Metadata.JoinType == eJoinType.Serial)
{
//var newJoinKeys = joinMap.Joins.Keys.Except(ExcludedKeys).ToList(); Debug.Console(0, this, "Linking Serial Feedback '{0}' to join {1}", name, join.JoinNumber);
var someFeedback = myFeedback as StringFeedback;
//var newJoinMap = newJoinKeys.Where(k => joinMap.Joins.ContainsKey(k)).Select(k => joinMap.Joins[k]); if (someFeedback == null) continue;
someFeedback.LinkInputSig(trilist.StringInput[join.JoinNumber]);
}
Debug.Console(2, this, "There are {0} remote buttons", _remote.Button.Count); }
for (uint i = 1; i <= _remote.Button.Count; i++)
{ //var newJoinKeys = joinMap.Joins.Keys.Except(ExcludedKeys).ToList();
Debug.Console(2, this, "Attempting to link join index {0}", i);
var index = i; //var newJoinMap = newJoinKeys.Where(k => joinMap.Joins.ContainsKey(k)).Select(k => joinMap.Joins[k]);
var joinData =
joinMap.Joins.FirstOrDefault(
o => Debug.Console(2, this, "There are {0} remote buttons", _remote.Button.Count);
o.Key.Equals(_remote.Button[index].Name.ToString(), for (uint i = 1; i <= _remote.Button.Count; i++)
StringComparison.InvariantCultureIgnoreCase)); {
Debug.Console(2, this, "Attempting to link join index {0}", i);
if (string.IsNullOrEmpty((joinData.Key))) continue; var index = i;
var joinData =
var join = joinData.Value; joinMap.Joins.FirstOrDefault(
var name = joinData.Key; o =>
o.Key.Equals(_remote.Button[index].Name.ToString(),
Debug.Console(2, this, "Setting User Object for '{0}'", name); StringComparison.InvariantCultureIgnoreCase));
if (join.Metadata.JoinType == eJoinType.Digital)
{ if (string.IsNullOrEmpty((joinData.Key))) continue;
_remote.Button[i].SetButtonAction((b) => trilist.BooleanInput[join.JoinNumber].BoolValue = b);
} var join = joinData.Value;
} var name = joinData.Key;
trilist.OnlineStatusChange += (d, args) => Debug.Console(2, this, "Setting User Object for '{0}'", name);
{ if (join.Metadata.JoinType == eJoinType.Digital)
if (!args.DeviceOnLine) return; {
_remote.Button[i].SetButtonAction((b) => trilist.BooleanInput[join.JoinNumber].BoolValue = b);
foreach (var feedback in Feedbacks) }
{ }
feedback.FireUpdate();
} trilist.OnlineStatusChange += (d, args) =>
{
}; if (!args.DeviceOnLine) return;
}
public void SetTrilistBool(BasicTriList trilist, uint join, bool b) foreach (var feedback in Feedbacks)
{ {
trilist.BooleanInput[join].BoolValue = b; feedback.FireUpdate();
} }
}
} };
}
public void SetTrilistBool(BasicTriList trilist, uint join, bool b)
{
trilist.BooleanInput[join].BoolValue = b;
}
}
}

View File

@@ -1,6 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
@@ -46,7 +46,7 @@ namespace PepperDash.Essentials.DM
public BoolFeedback EnableAudioBreakawayFeedback { get; private set; } public BoolFeedback EnableAudioBreakawayFeedback { get; private set; }
public BoolFeedback EnableUsbBreakawayFeedback { get; private set; } public BoolFeedback EnableUsbBreakawayFeedback { get; private set; }
public Dictionary<uint, IntFeedback> InputCardHdcpCapabilityFeedbacks { get; private set; } public Dictionary<uint, IntFeedback> InputCardHdcpStateFeedbacks { get; private set; }
public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; } public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; }
@@ -218,7 +218,7 @@ namespace PepperDash.Essentials.DM
EnableUsbBreakawayFeedback = EnableUsbBreakawayFeedback =
new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue); new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue);
InputCardHdcpCapabilityFeedbacks = new Dictionary<uint, IntFeedback>(); InputCardHdcpStateFeedbacks = new Dictionary<uint, IntFeedback>();
InputCardHdcpCapabilityTypes = new Dictionary<uint, eHdcpCapabilityType>(); InputCardHdcpCapabilityTypes = new Dictionary<uint, eHdcpCapabilityType>();
for (uint x = 1; x <= Chassis.NumberOfOutputs; x++) for (uint x = 1; x <= Chassis.NumberOfOutputs; x++)
@@ -328,7 +328,7 @@ namespace PepperDash.Essentials.DM
InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; }); InputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { return Chassis.Inputs[tempX].EndpointOnlineFeedback; });
InputCardHdcpCapabilityFeedbacks[tempX] = new IntFeedback(() => { InputCardHdcpStateFeedbacks[tempX] = new IntFeedback(() => {
var inputCard = Chassis.Inputs[tempX]; var inputCard = Chassis.Inputs[tempX];
if (inputCard.Card is DmcHd) if (inputCard.Card is DmcHd)
@@ -614,13 +614,6 @@ namespace PepperDash.Essentials.DM
var cecPort2 = outputCard.Card2.HdmiOutput; var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2); AddDmcHdoPorts(number, cecPort1, cecPort2);
} }
else if (type == "dmc4kzhdo")
{
var outputCard = new Dmc4kzHdoSingle(number, Chassis);
var cecPort1 = outputCard.Card1.HdmiOutput;
var cecPort2 = outputCard.Card2.HdmiOutput;
AddDmcHdoPorts(number, cecPort1, cecPort2);
}
else if (type == "dmchdo") else if (type == "dmchdo")
{ {
var outputCard = new DmcHdoSingle(number, Chassis); var outputCard = new DmcHdoSingle(number, Chassis);
@@ -845,10 +838,10 @@ namespace PepperDash.Essentials.DM
case DMInputEventIds.HdcpCapabilityFeedbackEventId: case DMInputEventIds.HdcpCapabilityFeedbackEventId:
{ {
Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number); Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number);
if (InputCardHdcpCapabilityFeedbacks[args.Number] != null) if (InputCardHdcpStateFeedbacks[args.Number] != null)
InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate(); InputCardHdcpStateFeedbacks[args.Number].FireUpdate();
else else
Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks"); Debug.Console(1, this, "No index of {0} found in InputCardHdcpStateFeedbacks");
break; break;
} }
default: default:
@@ -1112,24 +1105,281 @@ namespace PepperDash.Essentials.DM
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 DmChassisControllerJoinMap(joinStart); var joinMap = GetJoinMap(joinStart, joinMapKey, bridge);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
joinMap = JsonConvert.DeserializeObject<DmChassisControllerJoinMap>(joinMapSerialized);
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X")); Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
LinkChassisToApi(trilist, joinMap);
// Link up inputs & outputs
for (uint i = 1; i <= Chassis.NumberOfOutputs; i++)
{
var ioSlot = i;
var ioSlotJoin = ioSlot - 1;
LinkRoutingJoinsToApi(trilist, joinMap, ioSlotJoin, ioSlot);
if (TxDictionary.ContainsKey(ioSlot))
{
LinkTxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
}
else
{
LinkHdmiInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
}
if (RxDictionary.ContainsKey(ioSlot))
{
LinkRxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
}
}
}
private void LinkHdmiInputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
{
VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort == null)
{
return;
}
Debug.Console(1, "Port value for input card {0} is set", ioSlot);
var port = inputPort.Port;
if (port == null)
{
return;
}
if (!(port is HdmiInputWithCEC))
{
Debug.Console(0, this, "HDMI Input port on card {0} does not support HDCP settings.", ioSlot);
return;
}
Debug.Console(1, "Port is HdmiInputWithCec");
var hdmiInPortWCec = port as HdmiInputWithCEC;
SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
InputCardHdcpStateFeedbacks[ioSlot].LinkInputSig(
trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
{
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue =
(ushort)InputCardHdcpCapabilityTypes[ioSlot];
}
else
{
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
}
}
private void LinkRxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
{
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
var rxKey = RxDictionary[ioSlot];
var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
|| Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps
|| Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps || hdBaseTDevice != null)
{
OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
}
else if (rxDevice != null)
{
rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
}
}
private void LinkTxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
{
Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot);
VideoInputSyncFeedbacks[ioSlot].LinkInputSig(
trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot];
var txDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
if (txDevice == null)
{
return;
}
LinkTxOnlineFeedbackToApi(trilist, ioSlot, joinMap, ioSlotJoin, txDevice);
LinkBasicTxToApi(trilist, joinMap, ioSlot, ioSlotJoin, txDevice);
LinkAdvancedTxToApi(trilist, joinMap, ioSlot, ioSlotJoin, txDevice);
}
private void LinkBasicTxToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap, uint ioSlot,
uint ioSlotJoin, BasicDmTxControllerBase basicTransmitter)
{
var advTx = basicTransmitter as DmTxControllerBase;
if (advTx != null)
{
return;
}
var inputPort = InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)];
if (inputPort == null)
{
return;
}
var port = inputPort.Port;
if (!(port is DMInputPortWithCec))
{
Debug.Console(0, this, "DM Input port on card {0} does not support HDCP settings.", ioSlot);
return;
}
Debug.Console(1, "Port is DMInputPortWithCec");
var dmInPortWCec = port as DMInputPortWithCec;
bool supportsHdcp2;
//added in case the InputSlotSupportsHdcp2 section isn't included in the config, or this slot is left out.
//if the key isn't in the dictionary, supportsHdcp2 will be false
if(!PropertiesConfig.InputSlotSupportsHdcp2.TryGetValue(ioSlot, out supportsHdcp2))
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
"Input Slot Supports HDCP2 setting not found for slot {0}. Setting to false. Program may not function as intended.",
ioSlot);
}
SetHdcpStateAction(supportsHdcp2, dmInPortWCec,
joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
InputCardHdcpStateFeedbacks[ioSlot].LinkInputSig(
trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
{
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue =
(ushort) InputCardHdcpCapabilityTypes[ioSlot];
}
else
{
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
}
}
private void LinkAdvancedTxToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap,
uint ioSlot, uint ioSlotJoin, BasicDmTxControllerBase basicTransmitter)
{
var transmitter = basicTransmitter as DmTxControllerBase;
if (transmitter == null) return;
trilist.BooleanInput[joinMap.TxAdvancedIsPresent.JoinNumber + ioSlotJoin].BoolValue = true;
transmitter.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(
trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
var txRoutingInputs = transmitter as IRoutingInputs;
if (txRoutingInputs == null) return;
var inputPorts = txRoutingInputs.InputPorts.Where((p) => p.Port is EndpointHdmiInput || p.Port is EndpointDisplayPortInput).ToList();
if (inputPorts.Count == 0)
{
Debug.Console(1, this, "No HDCP-capable input ports found on transmitter for slot {0}", ioSlot);
return;
}
bool supportsHdcp2;
if (!PropertiesConfig.InputSlotSupportsHdcp2.TryGetValue(ioSlot, out supportsHdcp2))
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning,
"Input Slot Supports HDCP2 setting not found for slot {0}. Setting to false. Program may not function as intended.",
ioSlot);
}
SetHdcpStateAction(supportsHdcp2, inputPorts, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
if (transmitter.HdcpStateFeedback != null)
{
transmitter.HdcpStateFeedback.LinkInputSig(
trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
}
else
{
Debug.Console(2, this, "Transmitter Hdcp Feedback null. Linking to card's feedback");
InputCardHdcpStateFeedbacks[ioSlot].LinkInputSig(
trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
}
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue =
(ushort) transmitter.HdcpSupportCapability;
}
private void LinkTxOnlineFeedbackToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap,
uint ioSlotJoin, BasicDmTxControllerBase txDevice)
{
var advancedTxDevice = txDevice as DmTxControllerBase;
if ((Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
|| Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps
|| Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps) ||
advancedTxDevice == null)
{
Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot);
InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(
trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
return;
}
Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot);
advancedTxDevice.IsOnline.LinkInputSig(
trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
}
private void LinkRoutingJoinsToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap, uint ioSlotJoin,
uint ioSlot)
{
// Routing Control
trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin,
o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video));
trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin,
o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio));
trilist.SetUShortSigAction(joinMap.OutputUsb.JoinNumber + ioSlotJoin,
o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput));
trilist.SetUShortSigAction(joinMap.InputUsb.JoinNumber + ioSlotJoin,
o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput));
//Routing Feedbacks
VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]);
AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]);
UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb.JoinNumber + ioSlotJoin]);
UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb.JoinNumber + ioSlotJoin]);
OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]);
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(
trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]);
OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(
trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]);
OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(
trilist.BooleanInput[joinMap.OutputDisabledByHdcp.JoinNumber + ioSlotJoin]);
}
private void LinkChassisToApi(BasicTriList trilist, DmChassisControllerJoinMap joinMap)
{
var chassis = Chassis as DmMDMnxn; var chassis = Chassis as DmMDMnxn;
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]); IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
@@ -1137,12 +1387,17 @@ namespace PepperDash.Essentials.DM
trilist.SetUShortSigAction(joinMap.SystemId.JoinNumber, o => trilist.SetUShortSigAction(joinMap.SystemId.JoinNumber, o =>
{ {
if (chassis != null) if (chassis != null)
{
chassis.SystemId.UShortValue = o; chassis.SystemId.UShortValue = o;
}
}); });
trilist.SetSigTrueAction(joinMap.SystemId.JoinNumber, () => trilist.SetSigTrueAction(joinMap.SystemId.JoinNumber, () =>
{ {
if (chassis != null) chassis.ApplySystemId(); if (chassis != null)
{
chassis.ApplySystemId();
}
}); });
SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]); SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId.JoinNumber]);
@@ -1153,177 +1408,44 @@ namespace PepperDash.Essentials.DM
trilist.OnlineStatusChange += (o, a) => trilist.OnlineStatusChange += (o, a) =>
{ {
if (!a.DeviceOnLine) return; if (!a.DeviceOnLine)
{
return;
}
EnableAudioBreakawayFeedback.FireUpdate(); EnableAudioBreakawayFeedback.FireUpdate();
EnableUsbBreakawayFeedback.FireUpdate(); EnableUsbBreakawayFeedback.FireUpdate();
SystemIdBusyFeedback.FireUpdate(); SystemIdBusyFeedback.FireUpdate();
SystemIdFeebdack.FireUpdate(); SystemIdFeebdack.FireUpdate();
}; };
// Link up outputs
for (uint i = 1; i <= Chassis.NumberOfOutputs; i++)
{
var ioSlot = i;
var ioSlotJoin = ioSlot - 1;
// Control
trilist.SetUShortSigAction(joinMap.OutputVideo.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Video));
trilist.SetUShortSigAction(joinMap.OutputAudio.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.Audio));
trilist.SetUShortSigAction(joinMap.OutputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbOutput));
trilist.SetUShortSigAction(joinMap.InputUsb.JoinNumber + ioSlotJoin, o => ExecuteSwitch(o, ioSlot, eRoutingSignalType.UsbInput));
if (TxDictionary.ContainsKey(ioSlot))
{
Debug.Console(2, "Creating Tx Feedbacks {0}", ioSlot);
var txKey = TxDictionary[ioSlot];
var basicTxDevice = DeviceManager.GetDeviceForKey(txKey) as BasicDmTxControllerBase;
var advancedTxDevice = basicTxDevice as DmTxControllerBase;
if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
|| Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps
|| Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps)
{
InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
}
else
{
if (advancedTxDevice != null)
{
advancedTxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
Debug.Console(2, "Linking Tx Online Feedback from Advanced Transmitter at input {0}", ioSlot);
}
else if (InputEndpointOnlineFeedbacks[ioSlot] != null)
{
Debug.Console(2, "Linking Tx Online Feedback from Input Card {0}", ioSlot);
InputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.InputEndpointOnline.JoinNumber + ioSlotJoin]);
}
}
if (basicTxDevice != null && advancedTxDevice == null)
trilist.BooleanInput[joinMap.TxAdvancedIsPresent.JoinNumber + ioSlotJoin].BoolValue = true;
if (advancedTxDevice != null)
{
advancedTxDevice.AnyVideoInput.VideoStatus.VideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
}
else if (advancedTxDevice == null || basicTxDevice != null)
{
Debug.Console(1, "Setting up actions and feedbacks on input card {0}", ioSlot);
VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort != null)
{
Debug.Console(1, "Port value for input card {0} is set", ioSlot);
var port = inputPort.Port;
if (port != null)
{
if (port is HdmiInputWithCEC)
{
Debug.Console(1, "Port is HdmiInputWithCec");
var hdmiInPortWCec = port as HdmiInputWithCEC;
if (hdmiInPortWCec.HdcpSupportedLevel != eHdcpSupportedLevel.Unknown)
{
SetHdcpStateAction(true, hdmiInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
}
InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot];
else
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
}
}
}
else
{
inputPort = InputPorts[string.Format("inputCard{0}--dmIn", ioSlot)];
if (inputPort != null)
{
var port = inputPort.Port;
if (port is DMInputPortWithCec)
{
Debug.Console(1, "Port is DMInputPortWithCec");
var dmInPortWCec = port as DMInputPortWithCec;
if (dmInPortWCec != null)
{
SetHdcpStateAction(PropertiesConfig.InputSlotSupportsHdcp2[ioSlot], dmInPortWCec, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
}
InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
if (InputCardHdcpCapabilityTypes.ContainsKey(ioSlot))
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = (ushort)InputCardHdcpCapabilityTypes[ioSlot];
else
trilist.UShortInput[joinMap.HdcpSupportCapability.JoinNumber + ioSlotJoin].UShortValue = 1;
}
}
}
}
}
else
{
VideoInputSyncFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.VideoSyncStatus.JoinNumber + ioSlotJoin]);
var inputPort = InputPorts[string.Format("inputCard{0}--hdmiIn", ioSlot)];
if (inputPort != null)
{
var hdmiPort = inputPort.Port as EndpointHdmiInput;
if (hdmiPort != null)
{
SetHdcpStateAction(true, hdmiPort, joinMap.HdcpSupportState.JoinNumber + ioSlotJoin, trilist);
InputCardHdcpCapabilityFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.HdcpSupportState.JoinNumber + ioSlotJoin]);
}
}
}
if (RxDictionary.ContainsKey(ioSlot))
{
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
var rxKey = RxDictionary[ioSlot];
var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
if (Chassis is DmMd8x8Cpu3 || Chassis is DmMd8x8Cpu3rps
|| Chassis is DmMd16x16Cpu3 || Chassis is DmMd16x16Cpu3rps
|| Chassis is DmMd32x32Cpu3 || Chassis is DmMd32x32Cpu3rps || hdBaseTDevice != null)
{
OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
}
else if (rxDevice != null)
{
rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline.JoinNumber + ioSlotJoin]);
}
}
// Feedback
VideoOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputVideo.JoinNumber + ioSlotJoin]);
AudioOutputFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputAudio.JoinNumber + ioSlotJoin]);
UsbOutputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.OutputUsb.JoinNumber + ioSlotJoin]);
UsbInputRoutedToFeebacks[ioSlot].LinkInputSig(trilist.UShortInput[joinMap.InputUsb.JoinNumber + ioSlotJoin]);
OutputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputNames.JoinNumber + ioSlotJoin]);
InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]);
OutputVideoRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentVideoInputNames.JoinNumber + ioSlotJoin]);
OutputAudioRouteNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.OutputCurrentAudioInputNames.JoinNumber + ioSlotJoin]);
OutputDisabledByHdcpFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputDisabledByHdcp.JoinNumber + ioSlotJoin]);
}
} }
private void SetHdcpStateAction(bool hdcpTypeSimple, HdmiInputWithCEC port, uint join, BasicTriList trilist) private DmChassisControllerJoinMap GetJoinMap(uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
if (hdcpTypeSimple) var joinMap = new DmChassisControllerJoinMap(joinStart);
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
if (!string.IsNullOrEmpty(joinMapSerialized))
{
joinMap = JsonConvert.DeserializeObject<DmChassisControllerJoinMap>(joinMapSerialized);
}
if (bridge != null)
{
bridge.AddJoinMap(Key, joinMap);
}
else
{
Debug.Console(0, this,
"Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
}
return joinMap;
}
private void SetHdcpStateAction(bool supportsHdcp2, HdmiInputWithCEC port, uint join, BasicTriList trilist)
{
if (!supportsHdcp2)
{ {
trilist.SetUShortSigAction(join, trilist.SetUShortSigAction(join,
s => s =>
@@ -1348,9 +1470,9 @@ namespace PepperDash.Essentials.DM
} }
} }
private void SetHdcpStateAction(bool hdcpTypeSimple, EndpointHdmiInput port, uint join, BasicTriList trilist) private void SetHdcpStateAction(bool supportsHdcp2, EndpointHdmiInput port, uint join, BasicTriList trilist)
{ {
if (hdcpTypeSimple) if (!supportsHdcp2)
{ {
trilist.SetUShortSigAction(join, trilist.SetUShortSigAction(join,
s => s =>
@@ -1375,6 +1497,38 @@ namespace PepperDash.Essentials.DM
} }
} }
private void SetHdcpStateAction(bool supportsHdcp2, List<RoutingInputPort> ports, uint join,
BasicTriList triList)
{
if (!supportsHdcp2)
{
triList.SetUShortSigAction(join, a =>
{
foreach (var tempPort in ports.Select(port => port.Port).OfType<EndpointHdmiInput>())
{
if (a == 0)
{
tempPort.HdcpSupportOff();
}
else if (a > 0)
{
tempPort.HdcpSupportOn();
}
}
});
}
else
{
triList.SetUShortSigAction(join, a =>
{
foreach (var tempPort in ports.Select(port => port.Port).OfType<EndpointHdmiInput>())
{
tempPort.HdcpCapability = (eHdcpCapabilityType) a;
}
});
}
}
private void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist) private void SetHdcpStateAction(bool supportsHdcp2, DMInputPortWithCec port, uint join, BasicTriList trilist)
{ {
if (!supportsHdcp2) if (!supportsHdcp2)
@@ -1452,5 +1606,4 @@ namespace PepperDash.Essentials.DM
} }
} }
} }

View File

@@ -28,7 +28,7 @@ namespace PepperDash.Essentials.DM
public override StringFeedback ActiveVideoInputFeedback { get; protected set; } public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback VideoSourceNumericFeedback { get; protected set; } public IntFeedback VideoSourceNumericFeedback { get; protected set; }
public IntFeedback AudioSourceNumericFeedback { get; protected set; } public IntFeedback AudioSourceNumericFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; } //actually state
public BoolFeedback HdmiVideoSyncFeedback { get; protected set; } public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
public BoolFeedback VgaVideoSyncFeedback { get; protected set; } public BoolFeedback VgaVideoSyncFeedback { get; protected set; }
@@ -105,7 +105,10 @@ namespace PepperDash.Essentials.DM
VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback); VideoSourceNumericFeedback = new IntFeedback(() => (int)Tx.VideoSourceFeedback);
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0); HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
//setting this on the base class so that we can get it easily on the chassis.
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;

View File

@@ -111,7 +111,9 @@ namespace PepperDash.Essentials.DM
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
(tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0)); (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue); HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);

View File

@@ -113,6 +113,8 @@ namespace PepperDash.Essentials.DM
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
(tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0)); (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0));
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue); HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue); VgaVideoSyncFeedback = new BoolFeedback(() => (bool)tx.VgaInput.SyncDetectedFeedback.BoolValue);

View File

@@ -129,7 +129,9 @@ namespace PepperDash.Essentials.DM
AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback); AudioSourceNumericFeedback = new IntFeedback(() => (int)Tx.AudioSourceFeedback);
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0); HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () => tx.HdmiInput.HdcpSupportOnFeedback.BoolValue ? 1 : 0);
HdcpStateFeedback = HdmiInHdcpCapabilityFeedback;
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport; HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;

View File

@@ -110,6 +110,13 @@ namespace PepperDash.Essentials.DM
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int) tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int) tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
@@ -276,12 +283,11 @@ namespace PepperDash.Essentials.DM
switch (args.EventId) switch (args.EventId)
{ {
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
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();
HdcpStateFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();

View File

@@ -115,7 +115,14 @@ namespace PepperDash.Essentials.DM
HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback); HdmiIn1HdcpCapabilityFeedback = new IntFeedback("HdmiIn1HdcpCapability", () => (int)tx.HdmiInputs[1].HdcpCapabilityFeedback);
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int)tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
@@ -368,12 +375,11 @@ namespace PepperDash.Essentials.DM
switch (args.EventId) switch (args.EventId)
{ {
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
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();
HdcpStateFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();

View File

@@ -22,267 +22,63 @@ namespace PepperDash.Essentials.DM
/// Controller class for all DM-TX-201C/S/F transmitters /// Controller class for all DM-TX-201C/S/F transmitters
/// </summary> /// </summary>
[Description("Wrapper class for DM-TX-4K-Z-100-C")] [Description("Wrapper class for DM-TX-4K-Z-100-C")]
public class DmTx4kz100Controller : DmTxControllerBase, IRoutingInputsOutputs, IHasFeedback, public class DmTx4kz100Controller : BasicDmTxControllerBase, IRoutingInputsOutputs, IHasFeedback,
IIROutputPorts, IComPorts, ICec IIROutputPorts, IComPorts, ICec
{ {
public DmTx4kz100C1G Tx { get; private set; } public DmTx4kz100C1G Tx { get; private set; }
public RoutingInputPortWithVideoStatuses HdmiInput { get; private set; } public RoutingInputPort HdmiIn { get; private set; }
public RoutingOutputPort DmOutput { get; private set; } public RoutingOutputPort DmOut { get; private set; }
public override StringFeedback ActiveVideoInputFeedback { get; protected set; }
public IntFeedback HdmiInHdcpCapabilityFeedback { get; protected set; }
public BoolFeedback HdmiVideoSyncFeedback { get; protected set; }
/// <summary> /// <summary>
/// Helps get the "real" inputs, including when in Auto /// Helps get the "real" inputs, including when in Auto
/// </summary> /// </summary>
public DmTx200Base.eSourceSelection ActualActiveVideoInput public eX02VideoSourceType ActualActiveVideoInput
{ {
get 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 eX02VideoSourceType.Hdmi1;
return DmTx200Base.eSourceSelection.Digital;
else if (Tx.VgaInput.SyncDetectedFeedback.BoolValue)
return DmTx200Base.eSourceSelection.Analog;
else
return DmTx200Base.eSourceSelection.Disable;
} }
}
} }
public RoutingPortCollection<RoutingInputPort> InputPorts public RoutingPortCollection<RoutingInputPort> InputPorts
{ {
get get
{ {
return new RoutingPortCollection<RoutingInputPort> return new RoutingPortCollection<RoutingInputPort>
{ {
HdmiInput HdmiIn
}; };
} }
} }
public RoutingPortCollection<RoutingOutputPort> OutputPorts public RoutingPortCollection<RoutingOutputPort> OutputPorts
{ {
get get
{ {
return new RoutingPortCollection<RoutingOutputPort> { DmOutput }; return new RoutingPortCollection<RoutingOutputPort> { DmOut };
} }
} }
/// <summary>
///
/// </summary>
/// <param name="key"></param>
/// <param name="name"></param>
/// <param name="tx"></param>
public DmTx4kz100Controller(string key, string name, DmTx4kz100C1G tx) public DmTx4kz100Controller(string key, string name, DmTx4kz100C1G tx)
: base(key, name, tx) : base(key, name, tx)
{ {
Tx = tx; Tx = tx;
HdmiInput = new RoutingInputPortWithVideoStatuses(DmPortName.HdmiIn, HdmiIn = new RoutingInputPort(DmPortName.HdmiIn1,
eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, DmTx200Base.eSourceSelection.Digital, this, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, eX02VideoSourceType.Hdmi1, this);
VideoStatusHelper.GetHdmiInputStatusFuncs(tx.HdmiInput));
ActiveVideoInputFeedback = new StringFeedback("ActiveVideoInput", DmOut = new RoutingOutputPort(DmPortName.DmOut, eRoutingSignalType.Audio | eRoutingSignalType.Video,
() => ActualActiveVideoInput.ToString()); eRoutingPortConnectionType.DmCat, null, this);
Tx.HdmiInput.InputStreamChange += InputStreamChangeEvent;
Tx.BaseEvent += Tx_BaseEvent;
Tx.OnlineStatusChange += Tx_OnlineStatusChange;
HdmiInHdcpCapabilityFeedback = new IntFeedback("HdmiInHdcpCapability", () =>
{
if (tx.HdmiInput.HdcpSupportOnFeedback.BoolValue)
return 1;
else
return 0;
});
HdcpSupportCapability = eHdcpCapabilityType.HdcpAutoSupport;
HdmiVideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInput.SyncDetectedFeedback.BoolValue);
var combinedFuncs = new VideoStatusFuncsWrapper
{
HdcpActiveFeedbackFunc = () =>
(ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital
&& tx.HdmiInput.VideoAttributes.HdcpActiveFeedback.BoolValue),
HdcpStateFeedbackFunc = () => ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital ? tx.HdmiInput.VideoAttributes.HdcpStateFeedback.ToString() : "",
VideoResolutionFeedbackFunc = () =>
{
if (ActualActiveVideoInput == DmTx200Base.eSourceSelection.Digital)
return tx.HdmiInput.VideoAttributes.GetVideoResolutionString();
return ActualActiveVideoInput == DmTx200Base.eSourceSelection.Analog ? tx.VgaInput.VideoAttributes.GetVideoResolutionString() : "";
},
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 // Set Ports for CEC
HdmiInput.Port = Tx.HdmiInput; HdmiIn.Port = Tx;
DmOutput.Port = Tx.DmOutput;
}
PreventRegistration = true;
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) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{ {
var joinMap = GetDmTxJoinMap(joinStart, joinMapKey); Debug.Console(1, this, "No properties to link. Skipping device {0}", Name);
if (HdmiVideoSyncFeedback != null)
{
HdmiVideoSyncFeedback.LinkInputSig(trilist.BooleanInput[joinMap.Input1VideoSyncStatus.JoinNumber]);
}
LinkDmTxToApi(this, trilist, joinMap, bridge);
} }
/// <summary>
/// Enables or disables free run
/// </summary>
/// <param name="enable"></param>
public void SetFreeRunEnabled(bool enable)
{
Tx.VgaInput.FreeRun = enable ? eDmFreeRunSetting.Enabled : eDmFreeRunSetting.Disabled;
}
/// <summary>
/// Sets the VGA brightness level
/// </summary>
/// <param name="level"></param>
public void SetVgaBrightness(ushort level)
{
Tx.VgaInput.VideoControls.Brightness.UShortValue = level;
}
/// <summary>
/// Sets the VGA contrast level
/// </summary>
/// <param name="level"></param>
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);
switch (id)
{
case EndpointTransmitterBase.VideoSourceFeedbackEventId:
Debug.Console(2, this, " Video Source: {0}", Tx.VideoSourceFeedback);
ActiveVideoInputFeedback.FireUpdate();
break;
case EndpointTransmitterBase.AudioSourceFeedbackEventId:
Debug.Console(2, this, " Audio Source: {0}", Tx.AudioSourceFeedback);
break;
}
}
void InputStreamChangeEvent(EndpointInputStream inputStream, EndpointInputStreamEventArgs args)
{
Debug.Console(2, "{0} event {1} stream {2}", this.Tx.ToString(), inputStream.ToString(), args.EventId.ToString());
switch (args.EventId)
{
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
HdmiInHdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
HdmiInHdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
HdmiVideoSyncFeedback.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 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 #region IIROutputPorts Members
public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } } public CrestronCollection<IROutputPort> IROutputPorts { get { return Tx.IROutputPorts; } }
public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } } public int NumberOfIROutputPorts { get { return Tx.NumberOfIROutputPorts; } }
@@ -294,12 +90,7 @@ namespace PepperDash.Essentials.DM
#endregion #endregion
#region ICec Members #region ICec Members
/// <summary>
/// Gets the CEC stream directly from the HDMI port.
/// </summary>
public Cec StreamCec { get { return Tx.HdmiInput.StreamCec; } } public Cec StreamCec { get { return Tx.HdmiInput.StreamCec; } }
#endregion #endregion
} }
} }

View File

@@ -99,6 +99,13 @@ namespace PepperDash.Essentials.DM
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int)tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
@@ -265,10 +272,8 @@ namespace PepperDash.Essentials.DM
switch (args.EventId) switch (args.EventId)
{ {
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
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;

View File

@@ -105,6 +105,13 @@ namespace PepperDash.Essentials.DM
HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback); HdmiIn2HdcpCapabilityFeedback = new IntFeedback("HdmiIn2HdcpCapability", () => (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpStateFeedback =
new IntFeedback(
() =>
tx.HdmiInputs[1].HdcpCapabilityFeedback > tx.HdmiInputs[2].HdcpCapabilityFeedback
? (int)tx.HdmiInputs[1].HdcpCapabilityFeedback
: (int)tx.HdmiInputs[2].HdcpCapabilityFeedback);
HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support; HdcpSupportCapability = eHdcpCapabilityType.Hdcp2_2Support;
Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue); Hdmi1VideoSyncFeedback = new BoolFeedback(() => (bool)tx.HdmiInputs[1].SyncDetectedFeedback.BoolValue);
@@ -275,12 +282,11 @@ namespace PepperDash.Essentials.DM
switch (args.EventId) switch (args.EventId)
{ {
case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOffFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) HdmiIn1HdcpCapabilityFeedback.FireUpdate();
if (inputStream == Tx.HdmiInputs[2]) HdmiIn2HdcpCapabilityFeedback.FireUpdate();
break;
case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId: case EndpointInputStreamEventIds.HdcpSupportOnFeedbackEventId:
case EndpointInputStreamEventIds.HdcpCapabilityFeedbackEventId:
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();
HdcpStateFeedback.FireUpdate();
break; break;
case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId: case EndpointInputStreamEventIds.SyncDetectedFeedbackEventId:
if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate(); if (inputStream == Tx.HdmiInputs[1]) Hdmi1VideoSyncFeedback.FireUpdate();

View File

@@ -176,6 +176,7 @@ namespace PepperDash.Essentials.DM
public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; } public virtual eHdcpCapabilityType HdcpSupportCapability { get; protected set; }
public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; } public abstract StringFeedback ActiveVideoInputFeedback { get; protected set; }
public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; } public RoutingInputPortWithVideoStatuses AnyVideoInput { get; protected set; }
public IntFeedback HdcpStateFeedback { get; protected set; }
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware) protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware) : base(key, name, hardware)