mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-29 20:34:51 +00:00
Tested working with USB routing and SystemId setting on DmChassisController and DmChassisControllerBridge
This commit is contained in:
@@ -27,6 +27,12 @@ namespace PepperDash.Essentials.Bridges
|
||||
|
||||
dmChassis.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.IsOnline]);
|
||||
|
||||
trilist.SetUShortSigAction(joinMap.SystemId, new Action<ushort>(o => dmChassis.Chassis.SystemId.UShortValue = o));
|
||||
trilist.SetSigTrueAction(joinMap.SystemId, new Action(() => dmChassis.Chassis.ApplySystemId()));
|
||||
|
||||
dmChassis.SystemIdFeebdack.LinkInputSig(trilist.UShortInput[joinMap.SystemId]);
|
||||
dmChassis.SystemIdBusyFeedback.LinkInputSig(trilist.BooleanInput[joinMap.SystemId]);
|
||||
|
||||
// Link up outputs
|
||||
for (uint i = 1; i <= dmChassis.Chassis.NumberOfOutputs; i++)
|
||||
{
|
||||
@@ -97,6 +103,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
public class DmChassisControllerJoinMap : JoinMapBase
|
||||
{
|
||||
public uint IsOnline { get; set; }
|
||||
public uint SystemId { get; set; }
|
||||
public uint OutputVideo { get; set; }
|
||||
public uint OutputAudio { get; set; }
|
||||
public uint OutputUsb { get; set; }
|
||||
@@ -115,6 +122,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
|
||||
public DmChassisControllerJoinMap()
|
||||
{
|
||||
SystemId = 10;
|
||||
IsOnline = 11;
|
||||
OutputVideo = 100; //101-299
|
||||
OutputAudio = 300; //301-499
|
||||
@@ -137,6 +145,7 @@ namespace PepperDash.Essentials.Bridges
|
||||
{
|
||||
var joinOffset = joinStart - 1;
|
||||
|
||||
SystemId = SystemId + joinOffset;
|
||||
IsOnline = IsOnline + joinOffset;
|
||||
OutputVideo = OutputVideo + joinOffset;
|
||||
OutputAudio = OutputAudio + joinOffset;
|
||||
|
||||
@@ -38,6 +38,9 @@ namespace PepperDash.Essentials.DM
|
||||
public Dictionary<uint, IntFeedback> UsbOutputRoutedToFeebacks { get; private set; }
|
||||
public Dictionary<uint, IntFeedback> UsbInputRoutedToFeebacks { get; private set; }
|
||||
|
||||
public IntFeedback SystemIdFeebdack { get; private set; }
|
||||
public BoolFeedback SystemIdBusyFeedback { get; private set; }
|
||||
|
||||
|
||||
// Need a couple Lists of generic Backplane ports
|
||||
public RoutingPortCollection<RoutingInputPort> InputPorts { get; private set; }
|
||||
@@ -145,7 +148,7 @@ namespace PepperDash.Essentials.DM
|
||||
RxDictionary = new Dictionary<uint, string>();
|
||||
IsOnline.OutputChange += new EventHandler<FeedbackEventArgs>(IsOnline_OutputChange);
|
||||
Chassis.DMInputChange += new DMInputEventHandler(Chassis_DMInputChange);
|
||||
//Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange);
|
||||
Chassis.DMSystemChange += new DMSystemEventHandler(Chassis_DMSystemChange);
|
||||
Chassis.DMOutputChange += new DMOutputEventHandler(Chassis_DMOutputChange);
|
||||
VideoOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||
AudioOutputFeedbacks = new Dictionary<uint, IntFeedback>();
|
||||
@@ -159,6 +162,8 @@ namespace PepperDash.Essentials.DM
|
||||
InputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
|
||||
OutputEndpointOnlineFeedbacks = new Dictionary<uint, BoolFeedback>();
|
||||
|
||||
SystemIdFeebdack = new IntFeedback(() => { return Chassis.SystemIdFeedback.UShortValue; });
|
||||
SystemIdBusyFeedback = new BoolFeedback(() => { return Chassis.SystemIdBusy.BoolValue; });
|
||||
|
||||
for (uint x = 1; x <= Chassis.NumberOfOutputs; x++)
|
||||
{
|
||||
@@ -346,7 +351,7 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
new DmcSdi(number, Chassis);
|
||||
AddInputPortWithDebug(number, "sdiIn", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi);
|
||||
AddOutputPortWithDebug(number, "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi, null);
|
||||
AddOutputPortWithDebug(string.Format("inputCard{0}", number), "sdiOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Sdi, null);
|
||||
AddInCardHdmiAndAudioLoopPorts(number);
|
||||
}
|
||||
else if (type == "dmcDvi")
|
||||
@@ -415,13 +420,13 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
void AddInCardHdmiAndAudioLoopPorts(uint number)
|
||||
{
|
||||
AddOutputPortWithDebug(number, "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null);
|
||||
AddOutputPortWithDebug(number, "audioLoopOut", eRoutingSignalType.Audio, eRoutingPortConnectionType.Hdmi, null);
|
||||
AddOutputPortWithDebug(string.Format("inputCard{0}", number), "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null);
|
||||
AddOutputPortWithDebug(string.Format("inputCard{0}", number), "audioLoopOut", eRoutingSignalType.Audio, eRoutingPortConnectionType.Hdmi, null);
|
||||
}
|
||||
|
||||
void AddInCardHdmiLoopPort(uint number)
|
||||
{
|
||||
AddOutputPortWithDebug(number, "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null);
|
||||
AddOutputPortWithDebug(string.Format("inputCard{0}", number), "hdmiLoopOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -474,23 +479,23 @@ namespace PepperDash.Essentials.DM
|
||||
{
|
||||
var outputCard = new DmcSoHdSingle(number, Chassis);
|
||||
var cecPort1 = outputCard.Card1.HdmiOutput;
|
||||
AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmMmFiber, 2 * (number - 1) + 2);
|
||||
|
||||
}
|
||||
else if (type == "dmcS2oHd")
|
||||
{
|
||||
var outputCard = new DmcS2oHdSingle(number, Chassis);
|
||||
var cecPort1 = outputCard.Card1.HdmiOutput;
|
||||
AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmSmFiber, 2 * (number - 1) + 2);
|
||||
}
|
||||
else if (type == "dmcStro")
|
||||
{
|
||||
var outputCard = new DmcStroSingle(number, Chassis);
|
||||
AddOutputPortWithDebug(number, "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "streamOut", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming, 2 * (number - 1) + 1);
|
||||
}
|
||||
|
||||
else
|
||||
@@ -499,17 +504,17 @@ namespace PepperDash.Essentials.DM
|
||||
|
||||
void AddDmcHdoPorts(uint number, ICec cecPort1, ICec cecPort2)
|
||||
{
|
||||
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(number, "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(number, "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2, cecPort2);
|
||||
AddOutputPortWithDebug(number, "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 2);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut1", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 2, cecPort2);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "audioOut2", eRoutingSignalType.Audio, eRoutingPortConnectionType.LineAudio, 2 * (number - 1) + 2);
|
||||
}
|
||||
|
||||
void AddDmcCoPorts(uint number, ICec cecPort1)
|
||||
{
|
||||
AddOutputPortWithDebug(number, "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(number, "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(number, "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "hdmiOut1", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, 2 * (number - 1) + 1, cecPort1);
|
||||
AddOutputPortWithDebug(string.Format("outputCard{0}", number), "dmOut2", eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, 2 * (number - 1) + 2);
|
||||
}
|
||||
|
||||
|
||||
@@ -543,9 +548,9 @@ namespace PepperDash.Essentials.DM
|
||||
/// <summary>
|
||||
/// Adds OutputPort
|
||||
/// </summary>
|
||||
void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
|
||||
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector)
|
||||
{
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||
var portKey = string.Format("{0}--{1}", cardName, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
OutputPorts.Add(new RoutingOutputPort(portKey, sigType, portType, selector, this));
|
||||
}
|
||||
@@ -553,9 +558,9 @@ namespace PepperDash.Essentials.DM
|
||||
/// <summary>
|
||||
/// Adds OutputPort and sets Port as ICec object
|
||||
/// </summary>
|
||||
void AddOutputPortWithDebug(uint cardNum, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort)
|
||||
void AddOutputPortWithDebug(string cardName, string portName, eRoutingSignalType sigType, eRoutingPortConnectionType portType, object selector, ICec cecPort)
|
||||
{
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardNum, portName);
|
||||
var portKey = string.Format("outputCard{0}--{1}", cardName, portName);
|
||||
Debug.Console(2, this, "Adding output port '{0}'", portKey);
|
||||
var outputPort = new RoutingOutputPort(portKey, sigType, portType, selector, this);
|
||||
|
||||
@@ -579,41 +584,63 @@ namespace PepperDash.Essentials.DM
|
||||
//}
|
||||
|
||||
|
||||
void Chassis_DMSystemChange(Switch device, DMSystemEventArgs args) {
|
||||
void Chassis_DMSystemChange(Switch device, DMSystemEventArgs args)
|
||||
{
|
||||
switch (args.EventId)
|
||||
{
|
||||
case DMSystemEventIds.SystemIdEventId:
|
||||
{
|
||||
Debug.Console(2, this, "SystemIdEvent Value: {0}", Chassis.SystemIdFeedback.UShortValue);
|
||||
SystemIdFeebdack.FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMSystemEventIds.SystemIdBusyEventId:
|
||||
{
|
||||
Debug.Console(2, this, "SystemIdBusyEvent State: {0}", Chassis.SystemIdBusy.BoolValue);
|
||||
SystemIdBusyFeedback.FireUpdate();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
void Chassis_DMInputChange(Switch device, DMInputEventArgs args) {
|
||||
//Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString());
|
||||
void Chassis_DMInputChange(Switch device, DMInputEventArgs args)
|
||||
{
|
||||
|
||||
switch (args.EventId) {
|
||||
case DMInputEventIds.EndpointOnlineEventId: {
|
||||
Debug.Console(2, this, "DMINput EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
|
||||
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
switch (args.EventId) {
|
||||
case DMInputEventIds.EndpointOnlineEventId: {
|
||||
Debug.Console(2, this, "DM Input EndpointOnlineEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
|
||||
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.OnlineFeedbackEventId:
|
||||
{
|
||||
Debug.Console(2, this, "DMINput OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
|
||||
Debug.Console(2, this, "DM Input OnlineFeedbackEventId for input: {0}. State: {1}", args.Number, device.Inputs[args.Number].EndpointOnlineFeedback);
|
||||
InputEndpointOnlineFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.VideoDetectedEventId: {
|
||||
Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
|
||||
VideoInputSyncFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.InputNameEventId: {
|
||||
Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
|
||||
InputNameFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.VideoDetectedEventId: {
|
||||
Debug.Console(2, this, "DM Input {0} VideoDetectedEventId", args.Number);
|
||||
VideoInputSyncFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.InputNameEventId: {
|
||||
Debug.Console(2, this, "DM Input {0} NameFeedbackEventId", args.Number);
|
||||
InputNameFeedbacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMInputEventIds.UsbRoutedToEventId:
|
||||
{
|
||||
Debug.Console(2, this, "DM Input {0} UsbRoutedToEventId", args.Number);
|
||||
UsbInputRoutedToFeebacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
///
|
||||
/// </summary>
|
||||
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
|
||||
@@ -679,6 +706,12 @@ namespace PepperDash.Essentials.DM
|
||||
OutputNameFeedbacks[output].FireUpdate();
|
||||
break;
|
||||
}
|
||||
case DMOutputEventIds.UsbRoutedToEventId:
|
||||
{
|
||||
Debug.Console(2, this, "DM Output {0} UsbRoutedToEventId", args.Number);
|
||||
UsbOutputRoutedToFeebacks[args.Number].FireUpdate();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
|
||||
@@ -763,13 +796,15 @@ namespace PepperDash.Essentials.DM
|
||||
if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
|
||||
{
|
||||
Chassis.USBEnter.BoolValue = true;
|
||||
Chassis.Outputs[output].USBRoutedTo = inCard;
|
||||
if (Chassis.Outputs[output] != null)
|
||||
Chassis.Outputs[output].USBRoutedTo = inCard;
|
||||
}
|
||||
|
||||
if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
|
||||
{
|
||||
Chassis.USBEnter.BoolValue = true;
|
||||
Chassis.Inputs[input].USBRoutedTo = outCard;
|
||||
if(Chassis.Inputs[input] != null)
|
||||
Chassis.Inputs[input].USBRoutedTo = outCard;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user