mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-12 11:15:08 +00:00
Compare commits
1 Commits
feature/Ge
...
1.9.3-hotf
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7af8f0d087 |
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro.DeviceSupport;
|
using Crestron.SimplSharpPro.DeviceSupport;
|
||||||
@@ -15,421 +16,446 @@ using PepperDash.Essentials.Core.Config;
|
|||||||
|
|
||||||
namespace PepperDash.Essentials.DM.Chassis
|
namespace PepperDash.Essentials.DM.Chassis
|
||||||
{
|
{
|
||||||
[Description("Wrapper class for all HdMdNxM4E switchers")]
|
[Description("Wrapper class for all HdMdNxM4E switchers")]
|
||||||
public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IHasFeedback
|
public class HdMdNxM4kEBridgeableController : CrestronGenericBridgeableBaseDevice, IRoutingNumericWithFeedback, IHasFeedback
|
||||||
{
|
{
|
||||||
private HdMdNxM _Chassis;
|
private HdMdNxM _Chassis;
|
||||||
private HdMd4x14kE _Chassis4x1;
|
private HdMd4x14kE _Chassis4x1;
|
||||||
|
|
||||||
//IroutingNumericEvent
|
//IroutingNumericEvent
|
||||||
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
|
||||||
|
|
||||||
public Dictionary<uint, string> InputNames { get; set; }
|
public Dictionary<uint, string> InputNames { get; set; }
|
||||||
public Dictionary<uint, string> OutputNames { get; set; }
|
public Dictionary<uint, string> OutputNames { get; set; }
|
||||||
|
|
||||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||||
|
|
||||||
public FeedbackCollection<BoolFeedback> VideoInputSyncFeedbacks { get; private set; }
|
public FeedbackCollection<BoolFeedback> VideoInputSyncFeedbacks { get; private set; }
|
||||||
public FeedbackCollection<IntFeedback> VideoOutputRouteFeedbacks { get; private set; }
|
public FeedbackCollection<IntFeedback> VideoOutputRouteFeedbacks { get; private set; }
|
||||||
public FeedbackCollection<StringFeedback> InputNameFeedbacks { get; private set; }
|
public FeedbackCollection<StringFeedback> InputNameFeedbacks { get; private set; }
|
||||||
public FeedbackCollection<StringFeedback> OutputNameFeedbacks { get; private set; }
|
public FeedbackCollection<StringFeedback> OutputNameFeedbacks { get; private set; }
|
||||||
public FeedbackCollection<StringFeedback> OutputRouteNameFeedbacks { get; private set; }
|
public FeedbackCollection<StringFeedback> OutputRouteNameFeedbacks { get; private set; }
|
||||||
public FeedbackCollection<BoolFeedback> InputHdcpEnableFeedback { get; private set; }
|
public FeedbackCollection<BoolFeedback> InputHdcpEnableFeedback { get; private set; }
|
||||||
public FeedbackCollection<StringFeedback> DeviceNameFeedback { get; private set; }
|
public FeedbackCollection<StringFeedback> DeviceNameFeedback { get; private set; }
|
||||||
public FeedbackCollection<BoolFeedback> AutoRouteFeedback { get; private set; }
|
public FeedbackCollection<BoolFeedback> AutoRouteFeedback { get; private set; }
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
|
|
||||||
public HdMdNxM4kEBridgeableController(string key, string name, HdMdNxM chassis,
|
public HdMdNxM4kEBridgeableController(string key, string name, HdMdNxM chassis,
|
||||||
HdMdNxM4kEBridgeablePropertiesConfig props)
|
HdMdNxM4kEBridgeablePropertiesConfig props)
|
||||||
: base(key, name, chassis)
|
: base(key, name, chassis)
|
||||||
{
|
{
|
||||||
_Chassis = chassis;
|
_Chassis = chassis;
|
||||||
var _props = props;
|
|
||||||
|
if (props == null)
|
||||||
InputNames = props.Inputs;
|
{
|
||||||
OutputNames = props.Outputs;
|
Debug.Console(1, this, "HdMdNx4keBridgeableController properties are null, failed to build the device");
|
||||||
|
return;
|
||||||
VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>();
|
}
|
||||||
VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>();
|
|
||||||
InputNameFeedbacks = new FeedbackCollection<StringFeedback>();
|
|
||||||
OutputNameFeedbacks = new FeedbackCollection<StringFeedback>();
|
if (props.Inputs != null)
|
||||||
OutputRouteNameFeedbacks = new FeedbackCollection<StringFeedback>();
|
{
|
||||||
InputHdcpEnableFeedback = new FeedbackCollection<BoolFeedback>();
|
foreach (var kvp in props.Inputs)
|
||||||
DeviceNameFeedback = new FeedbackCollection<StringFeedback>();
|
{
|
||||||
AutoRouteFeedback = new FeedbackCollection<BoolFeedback>();
|
Debug.Console(0, this, "props.Inputs: {0}-{1}", kvp.Key, kvp.Value);
|
||||||
|
}
|
||||||
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
InputNames = props.Inputs;
|
||||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
}
|
||||||
|
if (props.Outputs != null)
|
||||||
DeviceNameFeedback.Add(new StringFeedback(this.Name, () => this.Name));
|
{
|
||||||
|
foreach (var kvp in props.Outputs)
|
||||||
if (_Chassis.NumberOfInputs == 1)
|
{
|
||||||
{
|
Debug.Console(0, this, "props.Outputs: {0}-{1}", kvp.Key, kvp.Value);
|
||||||
_Chassis4x1 = _Chassis as HdMd4x14kE;
|
}
|
||||||
AutoRouteFeedback.Add(new BoolFeedback(this.Name + "-" + InputNames[1], () => _Chassis4x1.AutoModeOnFeedback.BoolValue));
|
OutputNames = props.Outputs;
|
||||||
}
|
}
|
||||||
|
//else
|
||||||
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
//{
|
||||||
{
|
// OutputNames.Add(1, "Output");
|
||||||
var index = i;
|
//}
|
||||||
var inputName = InputNames[index];
|
|
||||||
_Chassis.Inputs[index].Name.StringValue = inputName;
|
VideoInputSyncFeedbacks = new FeedbackCollection<BoolFeedback>();
|
||||||
|
VideoOutputRouteFeedbacks = new FeedbackCollection<IntFeedback>();
|
||||||
InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
|
InputNameFeedbacks = new FeedbackCollection<StringFeedback>();
|
||||||
eRoutingPortConnectionType.Hdmi, index, this)
|
OutputNameFeedbacks = new FeedbackCollection<StringFeedback>();
|
||||||
{
|
OutputRouteNameFeedbacks = new FeedbackCollection<StringFeedback>();
|
||||||
FeedbackMatchObject = _Chassis.HdmiInputs[index]
|
InputHdcpEnableFeedback = new FeedbackCollection<BoolFeedback>();
|
||||||
});
|
DeviceNameFeedback = new FeedbackCollection<StringFeedback>();
|
||||||
VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[index].VideoDetectedFeedback.BoolValue));
|
AutoRouteFeedback = new FeedbackCollection<BoolFeedback>();
|
||||||
InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[index].Name.StringValue));
|
|
||||||
InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[index].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
|
InputPorts = new RoutingPortCollection<RoutingInputPort>();
|
||||||
}
|
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
|
||||||
|
|
||||||
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
var deviceName = string.IsNullOrEmpty(this.Name) ? name : this.Name;
|
||||||
{
|
DeviceNameFeedback.Add(new StringFeedback(deviceName, () => deviceName));
|
||||||
var index = i;
|
|
||||||
var outputName = OutputNames[index];
|
if (_Chassis.NumberOfInputs == 1)
|
||||||
_Chassis.Outputs[i].Name.StringValue = outputName;
|
{
|
||||||
|
_Chassis4x1 = _Chassis as HdMd4x14kE;
|
||||||
OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
|
AutoRouteFeedback.Add(new BoolFeedback(deviceName + "-" + InputNames[1], () => _Chassis4x1.AutoModeOnFeedback.BoolValue));
|
||||||
eRoutingPortConnectionType.Hdmi, index, this)
|
}
|
||||||
{
|
|
||||||
FeedbackMatchObject = _Chassis.HdmiOutputs[index]
|
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
||||||
});
|
{
|
||||||
VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
|
var index = i;
|
||||||
OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].Name.StringValue));
|
var inputName = InputNames[index];
|
||||||
OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
|
_Chassis.Inputs[index].Name.StringValue = inputName;
|
||||||
}
|
|
||||||
|
InputPorts.Add(new RoutingInputPort(inputName, eRoutingSignalType.AudioVideo,
|
||||||
_Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
|
eRoutingPortConnectionType.Hdmi, index, this)
|
||||||
_Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
|
{
|
||||||
|
FeedbackMatchObject = _Chassis.HdmiInputs[index]
|
||||||
AddPostActivationAction(AddFeedbackCollections);
|
});
|
||||||
}
|
VideoInputSyncFeedbacks.Add(new BoolFeedback(inputName, () => _Chassis.Inputs[index].VideoDetectedFeedback.BoolValue));
|
||||||
|
InputNameFeedbacks.Add(new StringFeedback(inputName, () => _Chassis.Inputs[index].Name.StringValue));
|
||||||
#endregion
|
InputHdcpEnableFeedback.Add(new BoolFeedback(inputName, () => _Chassis.HdmiInputs[index].HdmiInputPort.HdcpSupportOnFeedback.BoolValue));
|
||||||
|
}
|
||||||
#region Methods
|
|
||||||
|
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
||||||
/// <summary>
|
{
|
||||||
/// Raise an event when the status of a switch object changes.
|
var index = i;
|
||||||
/// </summary>
|
var outputName = OutputNames[index];
|
||||||
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
_Chassis.Outputs[i].Name.StringValue = outputName;
|
||||||
private void OnSwitchChange(RoutingNumericEventArgs e)
|
|
||||||
{
|
OutputPorts.Add(new RoutingOutputPort(outputName, eRoutingSignalType.AudioVideo,
|
||||||
var newEvent = NumericSwitchChange;
|
eRoutingPortConnectionType.Hdmi, index, this)
|
||||||
if (newEvent != null) newEvent(this, e);
|
{
|
||||||
}
|
FeedbackMatchObject = _Chassis.HdmiOutputs[index]
|
||||||
|
});
|
||||||
public void EnableHdcp(uint port)
|
VideoOutputRouteFeedbacks.Add(new IntFeedback(outputName, () => (int)_Chassis.Outputs[index].VideoOutFeedback.Number));
|
||||||
{
|
OutputNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].Name.StringValue));
|
||||||
if (port > _Chassis.NumberOfInputs) return;
|
OutputRouteNameFeedbacks.Add(new StringFeedback(outputName, () => _Chassis.Outputs[index].VideoOutFeedback.NameFeedback.StringValue));
|
||||||
if (port <= 0) return;
|
}
|
||||||
|
|
||||||
_Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn();
|
_Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
|
||||||
InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
|
_Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
|
||||||
}
|
|
||||||
|
AddPostActivationAction(AddFeedbackCollections);
|
||||||
public void DisableHdcp(uint port)
|
}
|
||||||
{
|
|
||||||
if (port > _Chassis.NumberOfInputs) return;
|
#endregion
|
||||||
if (port <= 0) return;
|
|
||||||
|
#region Methods
|
||||||
_Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff();
|
|
||||||
InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
|
/// <summary>
|
||||||
}
|
/// Raise an event when the status of a switch object changes.
|
||||||
|
/// </summary>
|
||||||
public void EnableAutoRoute()
|
/// <param name="e">Arguments defined as IKeyName sender, output, input, and eRoutingSignalType</param>
|
||||||
{
|
private void OnSwitchChange(RoutingNumericEventArgs e)
|
||||||
if (_Chassis.NumberOfInputs != 1) return;
|
{
|
||||||
|
var newEvent = NumericSwitchChange;
|
||||||
if (_Chassis4x1 == null) return;
|
if (newEvent != null) newEvent(this, e);
|
||||||
|
}
|
||||||
_Chassis4x1.AutoModeOn();
|
|
||||||
}
|
public void EnableHdcp(uint port)
|
||||||
|
{
|
||||||
public void DisableAutoRoute()
|
if (port > _Chassis.NumberOfInputs) return;
|
||||||
{
|
if (port <= 0) return;
|
||||||
if (_Chassis.NumberOfInputs != 1) return;
|
|
||||||
|
_Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOn();
|
||||||
if (_Chassis4x1 == null) return;
|
InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
|
||||||
|
}
|
||||||
_Chassis4x1.AutoModeOff();
|
|
||||||
}
|
public void DisableHdcp(uint port)
|
||||||
|
{
|
||||||
#region PostActivate
|
if (port > _Chassis.NumberOfInputs) return;
|
||||||
|
if (port <= 0) return;
|
||||||
public void AddFeedbackCollections()
|
|
||||||
{
|
_Chassis.HdmiInputs[port].HdmiInputPort.HdcpSupportOff();
|
||||||
AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback);
|
InputHdcpEnableFeedback[InputNames[port]].FireUpdate();
|
||||||
AddCollectionsToList(VideoOutputRouteFeedbacks);
|
}
|
||||||
AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks, DeviceNameFeedback);
|
|
||||||
}
|
public void EnableAutoRoute()
|
||||||
|
{
|
||||||
#endregion
|
if (_Chassis.NumberOfInputs != 1) return;
|
||||||
|
|
||||||
#region FeedbackCollection Methods
|
if (_Chassis4x1 == null) return;
|
||||||
|
|
||||||
//Add arrays of collections
|
_Chassis4x1.AutoModeOn();
|
||||||
public void AddCollectionsToList(params FeedbackCollection<BoolFeedback>[] newFbs)
|
}
|
||||||
{
|
|
||||||
foreach (FeedbackCollection<BoolFeedback> fbCollection in newFbs)
|
public void DisableAutoRoute()
|
||||||
{
|
{
|
||||||
foreach (var item in newFbs)
|
if (_Chassis.NumberOfInputs != 1) return;
|
||||||
{
|
|
||||||
AddCollectionToList(item);
|
if (_Chassis4x1 == null) return;
|
||||||
}
|
|
||||||
}
|
_Chassis4x1.AutoModeOff();
|
||||||
}
|
}
|
||||||
public void AddCollectionsToList(params FeedbackCollection<IntFeedback>[] newFbs)
|
|
||||||
{
|
#region PostActivate
|
||||||
foreach (FeedbackCollection<IntFeedback> fbCollection in newFbs)
|
|
||||||
{
|
public void AddFeedbackCollections()
|
||||||
foreach (var item in newFbs)
|
{
|
||||||
{
|
AddCollectionsToList(VideoInputSyncFeedbacks, InputHdcpEnableFeedback);
|
||||||
AddCollectionToList(item);
|
AddCollectionsToList(VideoOutputRouteFeedbacks);
|
||||||
}
|
AddCollectionsToList(InputNameFeedbacks, OutputNameFeedbacks, OutputRouteNameFeedbacks, DeviceNameFeedback);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
#endregion
|
||||||
public void AddCollectionsToList(params FeedbackCollection<StringFeedback>[] newFbs)
|
|
||||||
{
|
#region FeedbackCollection Methods
|
||||||
foreach (FeedbackCollection<StringFeedback> fbCollection in newFbs)
|
|
||||||
{
|
//Add arrays of collections
|
||||||
foreach (var item in newFbs)
|
public void AddCollectionsToList(params FeedbackCollection<BoolFeedback>[] newFbs)
|
||||||
{
|
{
|
||||||
AddCollectionToList(item);
|
foreach (FeedbackCollection<BoolFeedback> fbCollection in newFbs)
|
||||||
}
|
{
|
||||||
}
|
foreach (var item in newFbs)
|
||||||
}
|
{
|
||||||
|
AddCollectionToList(item);
|
||||||
//Add Collections
|
}
|
||||||
public void AddCollectionToList(FeedbackCollection<BoolFeedback> newFbs)
|
}
|
||||||
{
|
}
|
||||||
foreach (var f in newFbs)
|
public void AddCollectionsToList(params FeedbackCollection<IntFeedback>[] newFbs)
|
||||||
{
|
{
|
||||||
if (f == null) continue;
|
foreach (FeedbackCollection<IntFeedback> fbCollection in newFbs)
|
||||||
|
{
|
||||||
AddFeedbackToList(f);
|
foreach (var item in newFbs)
|
||||||
}
|
{
|
||||||
}
|
AddCollectionToList(item);
|
||||||
|
}
|
||||||
public void AddCollectionToList(FeedbackCollection<IntFeedback> newFbs)
|
}
|
||||||
{
|
}
|
||||||
foreach (var f in newFbs)
|
|
||||||
{
|
public void AddCollectionsToList(params FeedbackCollection<StringFeedback>[] newFbs)
|
||||||
if (f == null) continue;
|
{
|
||||||
|
foreach (FeedbackCollection<StringFeedback> fbCollection in newFbs)
|
||||||
AddFeedbackToList(f);
|
{
|
||||||
}
|
foreach (var item in newFbs)
|
||||||
}
|
{
|
||||||
|
AddCollectionToList(item);
|
||||||
public void AddCollectionToList(FeedbackCollection<StringFeedback> newFbs)
|
}
|
||||||
{
|
}
|
||||||
foreach (var f in newFbs)
|
}
|
||||||
{
|
|
||||||
if (f == null) continue;
|
//Add Collections
|
||||||
|
public void AddCollectionToList(FeedbackCollection<BoolFeedback> newFbs)
|
||||||
AddFeedbackToList(f);
|
{
|
||||||
}
|
foreach (var f in newFbs)
|
||||||
}
|
{
|
||||||
|
if (f == null) continue;
|
||||||
//Add Individual Feedbacks
|
|
||||||
public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb)
|
AddFeedbackToList(f);
|
||||||
{
|
}
|
||||||
if (newFb == null) return;
|
}
|
||||||
|
|
||||||
if (!Feedbacks.Contains(newFb))
|
public void AddCollectionToList(FeedbackCollection<IntFeedback> newFbs)
|
||||||
{
|
{
|
||||||
Feedbacks.Add(newFb);
|
foreach (var f in newFbs)
|
||||||
}
|
{
|
||||||
}
|
if (f == null) continue;
|
||||||
|
|
||||||
#endregion
|
AddFeedbackToList(f);
|
||||||
|
}
|
||||||
#region IRouting Members
|
}
|
||||||
|
|
||||||
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
|
public void AddCollectionToList(FeedbackCollection<StringFeedback> newFbs)
|
||||||
{
|
{
|
||||||
// Try to make switch only when necessary. The unit appears to toggle when already selected.
|
foreach (var f in newFbs)
|
||||||
var current = _Chassis.HdmiOutputs[(uint)outputSelector].VideoOut;
|
{
|
||||||
if (current != _Chassis.HdmiInputs[(uint)inputSelector])
|
if (f == null) continue;
|
||||||
_Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = _Chassis.HdmiInputs[(uint)inputSelector];
|
|
||||||
}
|
AddFeedbackToList(f);
|
||||||
|
}
|
||||||
#endregion
|
}
|
||||||
|
|
||||||
#region IRoutingNumeric Members
|
//Add Individual Feedbacks
|
||||||
|
public void AddFeedbackToList(PepperDash.Essentials.Core.Feedback newFb)
|
||||||
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType)
|
{
|
||||||
{
|
if (newFb == null) return;
|
||||||
ExecuteSwitch(inputSelector, outputSelector, signalType);
|
|
||||||
}
|
if (!Feedbacks.Contains(newFb))
|
||||||
|
{
|
||||||
#endregion
|
Feedbacks.Add(newFb);
|
||||||
|
}
|
||||||
#endregion
|
}
|
||||||
|
|
||||||
#region Bridge Linking
|
#endregion
|
||||||
|
|
||||||
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
#region IRouting Members
|
||||||
{
|
|
||||||
var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart);
|
public void ExecuteSwitch(object inputSelector, object outputSelector, eRoutingSignalType signalType)
|
||||||
|
{
|
||||||
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
// Try to make switch only when necessary. The unit appears to toggle when already selected.
|
||||||
|
var current = _Chassis.HdmiOutputs[(uint)outputSelector].VideoOut;
|
||||||
if (!string.IsNullOrEmpty(joinMapSerialized))
|
if (current != _Chassis.HdmiInputs[(uint)inputSelector])
|
||||||
joinMap = JsonConvert.DeserializeObject<HdMdNxM4kEControllerJoinMap>(joinMapSerialized);
|
_Chassis.HdmiOutputs[(uint)outputSelector].VideoOut = _Chassis.HdmiInputs[(uint)inputSelector];
|
||||||
|
}
|
||||||
if (bridge != null)
|
|
||||||
{
|
#endregion
|
||||||
bridge.AddJoinMap(Key, joinMap);
|
|
||||||
}
|
#region IRoutingNumeric Members
|
||||||
else
|
|
||||||
{
|
public void ExecuteNumericSwitch(ushort inputSelector, ushort outputSelector, eRoutingSignalType signalType)
|
||||||
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
{
|
||||||
}
|
ExecuteSwitch(inputSelector, outputSelector, signalType);
|
||||||
|
}
|
||||||
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
|
||||||
DeviceNameFeedback[this.Name].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]);
|
#endregion
|
||||||
|
|
||||||
if (_Chassis4x1 != null)
|
#endregion
|
||||||
{
|
|
||||||
trilist.SetSigTrueAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOn());
|
#region Bridge Linking
|
||||||
trilist.SetSigFalseAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOff());
|
|
||||||
AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkInputSig(trilist.BooleanInput[joinMap.EnableAutoRoute.JoinNumber]);
|
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
|
||||||
}
|
{
|
||||||
|
var joinMap = new HdMdNxM4kEControllerJoinMap(joinStart);
|
||||||
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
|
||||||
{
|
var joinMapSerialized = JoinMapHelper.GetSerializedJoinMapForDevice(joinMapKey);
|
||||||
var joinIndex = i - 1;
|
|
||||||
//Digital
|
if (!string.IsNullOrEmpty(joinMapSerialized))
|
||||||
VideoInputSyncFeedbacks[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]);
|
joinMap = JsonConvert.DeserializeObject<HdMdNxM4kEControllerJoinMap>(joinMapSerialized);
|
||||||
InputHdcpEnableFeedback[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]);
|
|
||||||
InputHdcpEnableFeedback[InputNames[i]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]);
|
if (bridge != null)
|
||||||
trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(i));
|
{
|
||||||
trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(i));
|
bridge.AddJoinMap(Key, joinMap);
|
||||||
|
}
|
||||||
//Serial
|
else
|
||||||
InputNameFeedbacks[InputNames[i]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]);
|
{
|
||||||
}
|
Debug.Console(0, this, "Please update config to use 'eiscapiadvanced' to get all join map features for this device.");
|
||||||
|
}
|
||||||
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
|
||||||
{
|
IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline.JoinNumber]);
|
||||||
var joinIndex = i - 1;
|
DeviceNameFeedback[this.Name].LinkInputSig(trilist.StringInput[joinMap.Name.JoinNumber]);
|
||||||
//Analog
|
|
||||||
VideoOutputRouteFeedbacks[OutputNames[i]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]);
|
if (_Chassis4x1 != null)
|
||||||
trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteSwitch(a, i, eRoutingSignalType.AudioVideo));
|
{
|
||||||
|
trilist.SetSigTrueAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOn());
|
||||||
//Serial
|
trilist.SetSigFalseAction(joinMap.EnableAutoRoute.JoinNumber, () => _Chassis4x1.AutoModeOff());
|
||||||
OutputNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]);
|
AutoRouteFeedback[this.Name + "-" + InputNames[1]].LinkInputSig(trilist.BooleanInput[joinMap.EnableAutoRoute.JoinNumber]);
|
||||||
OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]);
|
}
|
||||||
}
|
|
||||||
|
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
||||||
_Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange);
|
{
|
||||||
|
var joinIndex = i - 1;
|
||||||
trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) =>
|
//Digital
|
||||||
{
|
VideoInputSyncFeedbacks[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.InputSync.JoinNumber + joinIndex]);
|
||||||
if (args.DeviceOnLine)
|
InputHdcpEnableFeedback[InputNames[i]].LinkInputSig(trilist.BooleanInput[joinMap.EnableInputHdcp.JoinNumber + joinIndex]);
|
||||||
{
|
InputHdcpEnableFeedback[InputNames[i]].LinkComplementInputSig(trilist.BooleanInput[joinMap.DisableInputHdcp.JoinNumber + joinIndex]);
|
||||||
foreach (var feedback in Feedbacks)
|
trilist.SetSigTrueAction(joinMap.EnableInputHdcp.JoinNumber + joinIndex, () => EnableHdcp(i));
|
||||||
{
|
trilist.SetSigTrueAction(joinMap.DisableInputHdcp.JoinNumber + joinIndex, () => DisableHdcp(i));
|
||||||
feedback.FireUpdate();
|
|
||||||
}
|
//Serial
|
||||||
}
|
InputNameFeedbacks[InputNames[i]].LinkInputSig(trilist.StringInput[joinMap.InputName.JoinNumber + joinIndex]);
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
||||||
|
{
|
||||||
#endregion
|
var joinIndex = i - 1;
|
||||||
|
//Analog
|
||||||
#region Events
|
VideoOutputRouteFeedbacks[OutputNames[i]].LinkInputSig(trilist.UShortInput[joinMap.OutputRoute.JoinNumber + joinIndex]);
|
||||||
|
trilist.SetUShortSigAction(joinMap.OutputRoute.JoinNumber + joinIndex, (a) => ExecuteSwitch(a, i, eRoutingSignalType.AudioVideo));
|
||||||
void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
|
|
||||||
{
|
//Serial
|
||||||
if (!args.DeviceOnLine) return;
|
OutputNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputName.JoinNumber + joinIndex]);
|
||||||
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
OutputRouteNameFeedbacks[OutputNames[i]].LinkInputSig(trilist.StringInput[joinMap.OutputRoutedName.JoinNumber + joinIndex]);
|
||||||
{
|
}
|
||||||
_Chassis.Inputs[i].Name.StringValue = InputNames[i];
|
|
||||||
}
|
_Chassis.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler(Chassis_OnlineStatusChange);
|
||||||
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
|
||||||
{
|
trilist.OnlineStatusChange += new Crestron.SimplSharpPro.OnlineStatusChangeEventHandler((d, args) =>
|
||||||
_Chassis.Outputs[i].Name.StringValue = OutputNames[i];
|
{
|
||||||
}
|
if (args.DeviceOnLine)
|
||||||
|
{
|
||||||
foreach (var feedback in Feedbacks)
|
foreach (var feedback in Feedbacks)
|
||||||
{
|
{
|
||||||
feedback.FireUpdate();
|
feedback.FireUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
|
}
|
||||||
{
|
|
||||||
if (args.EventId != DMOutputEventIds.VideoOutEventId) return;
|
|
||||||
|
#endregion
|
||||||
for (var i = 0; i < VideoOutputRouteFeedbacks.Count; i++)
|
|
||||||
{
|
#region Events
|
||||||
var index = i;
|
|
||||||
var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1].VideoOutFeedback);
|
void Chassis_OnlineStatusChange(Crestron.SimplSharpPro.GenericBase currentDevice, Crestron.SimplSharpPro.OnlineOfflineEventArgs args)
|
||||||
var localOutputPort =
|
{
|
||||||
OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1]);
|
if (!args.DeviceOnLine) return;
|
||||||
|
for (uint i = 1; i <= _Chassis.NumberOfInputs; i++)
|
||||||
|
{
|
||||||
VideoOutputRouteFeedbacks[i].FireUpdate();
|
_Chassis.Inputs[i].Name.StringValue = InputNames[i];
|
||||||
OnSwitchChange(new RoutingNumericEventArgs((ushort)i, VideoOutputRouteFeedbacks[i].UShortValue, localOutputPort, localInputPort, eRoutingSignalType.AudioVideo));
|
}
|
||||||
}
|
for (uint i = 1; i <= _Chassis.NumberOfOutputs; i++)
|
||||||
}
|
{
|
||||||
|
_Chassis.Outputs[i].Name.StringValue = OutputNames[i];
|
||||||
void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
|
}
|
||||||
{
|
|
||||||
if (args.EventId != DMInputEventIds.VideoDetectedEventId) return;
|
foreach (var feedback in Feedbacks)
|
||||||
foreach (var item in VideoInputSyncFeedbacks)
|
{
|
||||||
{
|
feedback.FireUpdate();
|
||||||
item.FireUpdate();
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||||
#endregion
|
{
|
||||||
|
if (args.EventId != DMOutputEventIds.VideoOutEventId) return;
|
||||||
#region Factory
|
|
||||||
|
for (var i = 0; i < VideoOutputRouteFeedbacks.Count; i++)
|
||||||
public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory<HdMdNxM4kEBridgeableController>
|
{
|
||||||
{
|
var index = i;
|
||||||
public HdMdNxM4kEControllerFactory()
|
var localInputPort = InputPorts.FirstOrDefault(p => (DMInput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1].VideoOutFeedback);
|
||||||
{
|
var localOutputPort =
|
||||||
TypeNames = new List<string>() { "hdmd4x14ke-bridgeable", "hdmd4x24ke", "hdmd6x24ke" };
|
OutputPorts.FirstOrDefault(p => (DMOutput)p.FeedbackMatchObject == _Chassis.HdmiOutputs[(uint)index + 1]);
|
||||||
}
|
|
||||||
|
|
||||||
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
VideoOutputRouteFeedbacks[i].FireUpdate();
|
||||||
{
|
OnSwitchChange(new RoutingNumericEventArgs((ushort)i, VideoOutputRouteFeedbacks[i].UShortValue, localOutputPort, localInputPort, eRoutingSignalType.AudioVideo));
|
||||||
Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device");
|
}
|
||||||
|
}
|
||||||
var props = JsonConvert.DeserializeObject<HdMdNxM4kEBridgeablePropertiesConfig>(dc.Properties.ToString());
|
|
||||||
|
void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
|
||||||
var type = dc.Type.ToLower();
|
{
|
||||||
var control = props.Control;
|
if (args.EventId != DMInputEventIds.VideoDetectedEventId) return;
|
||||||
var ipid = control.IpIdInt;
|
foreach (var item in VideoInputSyncFeedbacks)
|
||||||
var address = control.TcpSshProperties.Address;
|
{
|
||||||
|
item.FireUpdate();
|
||||||
switch (type)
|
}
|
||||||
{
|
}
|
||||||
case ("hdmd4x14ke-bridgeable"):
|
|
||||||
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props);
|
#endregion
|
||||||
case ("hdmd4x24ke"):
|
|
||||||
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props);
|
#region Factory
|
||||||
case ("hdmd6x24ke"):
|
|
||||||
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props);
|
public class HdMdNxM4kEControllerFactory : EssentialsDeviceFactory<HdMdNxM4kEBridgeableController>
|
||||||
default:
|
{
|
||||||
return null;
|
public HdMdNxM4kEControllerFactory()
|
||||||
}
|
{
|
||||||
}
|
TypeNames = new List<string>() { "hdmd4x14ke-bridgeable", "hdmd4x24ke", "hdmd6x24ke" };
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
public override EssentialsDevice BuildDevice(DeviceConfig dc)
|
||||||
|
{
|
||||||
|
Debug.Console(1, "Factory Attempting to create new HD-MD-NxM-4K-E Device");
|
||||||
|
|
||||||
}
|
var props = JsonConvert.DeserializeObject<HdMdNxM4kEBridgeablePropertiesConfig>(dc.Properties.ToString());
|
||||||
|
|
||||||
|
var type = dc.Type.ToLower();
|
||||||
|
var control = props.Control;
|
||||||
|
var ipid = control.IpIdInt;
|
||||||
|
var address = control.TcpSshProperties.Address;
|
||||||
|
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case ("hdmd4x14ke-bridgeable"):
|
||||||
|
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x14kE(ipid, address, Global.ControlSystem), props);
|
||||||
|
case ("hdmd4x24ke"):
|
||||||
|
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd4x24kE(ipid, address, Global.ControlSystem), props);
|
||||||
|
case ("hdmd6x24ke"):
|
||||||
|
return new HdMdNxM4kEBridgeableController(dc.Key, dc.Name, new HdMd6x24kE(ipid, address, Global.ControlSystem), props);
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro.DM;
|
using Crestron.SimplSharpPro.DM;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
@@ -47,10 +48,15 @@ namespace PepperDash.Essentials.DM.Chassis
|
|||||||
// physical settings
|
// physical settings
|
||||||
if (props != null && props.Inputs != null)
|
if (props != null && props.Inputs != null)
|
||||||
{
|
{
|
||||||
|
var inputRegex = new Regex(@"(?<InputNum>\d)", RegexOptions.IgnoreCase);
|
||||||
foreach (var kvp in props.Inputs)
|
foreach (var kvp in props.Inputs)
|
||||||
{
|
{
|
||||||
// strip "hdmiIn"
|
// get numnbers from key and convert to int
|
||||||
var inputNum = Convert.ToUInt32(kvp.Key.Substring(6));
|
//var inputNum = Convert.ToUInt32(kvp.Key.Substring(6));
|
||||||
|
var inputMatch = inputRegex.Match(kvp.Key);
|
||||||
|
if (inputMatch == null) continue;
|
||||||
|
|
||||||
|
var inputNum = Convert.ToUInt32(inputMatch.Groups["InputNum"].Value);
|
||||||
|
|
||||||
var port = chassis.HdmiInputs[inputNum].HdmiInputPort;
|
var port = chassis.HdmiInputs[inputNum].HdmiInputPort;
|
||||||
// set hdcp disables
|
// set hdcp disables
|
||||||
|
|||||||
Reference in New Issue
Block a user