Merge pull request #520 from PepperDash/feature/add-dm-streaming-start-stop-support

Add dm streaming start stop support
This commit is contained in:
Andrew Welker
2020-12-02 12:09:50 -07:00
committed by GitHub
3 changed files with 196 additions and 9 deletions

View File

@@ -70,6 +70,14 @@ namespace PepperDash.Essentials.Bridges
/// Range reports the highest supported HDCP state level for the corresponding input card /// Range reports the highest supported HDCP state level for the corresponding input card
/// </summary> /// </summary>
public uint HdcpSupportCapability { get; set; } public uint HdcpSupportCapability { get; set; }
/// <summary>
/// DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback
/// </summary>
public uint InputStreamCardStatus { get; set; }
/// <summary>
/// DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback
/// </summary>
public uint OutputStreamCardStatus { get; set; }
#endregion #endregion
#region Serials #region Serials
@@ -115,6 +123,8 @@ namespace PepperDash.Essentials.Bridges
InputUsb = 700; //701-899 InputUsb = 700; //701-899
HdcpSupportState = 1000; //1001-1199 HdcpSupportState = 1000; //1001-1199
HdcpSupportCapability = 1200; //1201-1399 HdcpSupportCapability = 1200; //1201-1399
InputStreamCardStatus = 1500; //1501-1532
OutputStreamCardStatus = 1600; //1601-1632
//Serial //Serial
@@ -145,6 +155,8 @@ namespace PepperDash.Essentials.Bridges
OutputEndpointOnline = OutputEndpointOnline + joinOffset; OutputEndpointOnline = OutputEndpointOnline + joinOffset;
HdcpSupportState = HdcpSupportState + joinOffset; HdcpSupportState = HdcpSupportState + joinOffset;
HdcpSupportCapability = HdcpSupportCapability + joinOffset; HdcpSupportCapability = HdcpSupportCapability + joinOffset;
InputStreamCardStatus = InputStreamCardStatus + joinOffset;
OutputStreamCardStatus = OutputStreamCardStatus + joinOffset;
OutputDisabledByHdcp = OutputDisabledByHdcp + joinOffset; OutputDisabledByHdcp = OutputDisabledByHdcp + joinOffset;
TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset; TxAdvancedIsPresent = TxAdvancedIsPresent + joinOffset;
} }

View File

@@ -76,6 +76,14 @@ namespace PepperDash.Essentials.Core.Bridges
public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 }, public JoinDataComplete HdcpSupportCapability = new JoinDataComplete(new JoinData { JoinNumber = 1201, JoinSpan = 32 },
new JoinMetadata { Description = "DM Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog }); new JoinMetadata { Description = "DM Chassis Input HDCP Support Capability", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
[JoinName("InputStreamCardState")]
public JoinDataComplete InputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1501, JoinSpan = 32 },
new JoinMetadata { Description = "DM Chassis Stream Input Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
[JoinName("OutputStreamCardState")]
public JoinDataComplete OutputStreamCardState = new JoinDataComplete(new JoinData { JoinNumber = 1601, JoinSpan = 32 },
new JoinMetadata { Description = "DM Chassis Stream Output Start (1), Stop (2), Pause (3) with Feedback", JoinCapabilities = eJoinCapabilities.FromSIMPL, JoinType = eJoinType.Analog });
[JoinName("InputNames")] [JoinName("InputNames")]
public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 }, public JoinDataComplete InputNames = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial }); new JoinMetadata { Description = "DM Chassis Input Name", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Serial });

View File

@@ -50,6 +50,8 @@ namespace PepperDash.Essentials.DM
public BoolFeedback EnableUsbBreakawayFeedback { get; private set; } public BoolFeedback EnableUsbBreakawayFeedback { get; private set; }
public Dictionary<uint, IntFeedback> InputCardHdcpStateFeedbacks { get; private set; } public Dictionary<uint, IntFeedback> InputCardHdcpStateFeedbacks { get; private set; }
public Dictionary<uint, IntFeedback> InputStreamCardStateFeedbacks { get; private set; }
public Dictionary<uint, IntFeedback> OutputStreamCardStateFeedbacks { get; private set; }
public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; } public Dictionary<uint, eHdcpCapabilityType> InputCardHdcpCapabilityTypes { get; private set; }
@@ -224,6 +226,8 @@ namespace PepperDash.Essentials.DM
new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue); new BoolFeedback(() => (Chassis as DmMDMnxn).EnableUSBBreakawayFeedback.BoolValue);
InputCardHdcpStateFeedbacks = new Dictionary<uint, IntFeedback>(); InputCardHdcpStateFeedbacks = new Dictionary<uint, IntFeedback>();
InputStreamCardStateFeedbacks = new Dictionary<uint, IntFeedback>();
OutputStreamCardStateFeedbacks = 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++)
@@ -308,6 +312,33 @@ namespace PepperDash.Essentials.DM
return false; return false;
}); });
OutputStreamCardStateFeedbacks[tempX] = new IntFeedback(() =>
{
try
{
var outputCard = Chassis.Outputs[tempX];
if (outputCard.Card is DmcStroAV)
{
Debug.Console(2, "Found output stream card in slot: {0}.", tempX);
var streamCard = outputCard.Card as DmcStroAV;
if (streamCard.Control.StartFeedback.BoolValue == true)
return 1;
else if (streamCard.Control.StopFeedback.BoolValue == true)
return 2;
else if (streamCard.Control.PauseFeedback.BoolValue == true)
return 3;
else
return 0;
}
return 0;
}
catch (InvalidOperationException iopex)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Error adding output stream card in slot: {0}. Error: {1}", tempX, iopex);
return 0;
}
});
} }
if (Chassis.Inputs[tempX] != null) if (Chassis.Inputs[tempX] != null)
@@ -407,6 +438,33 @@ namespace PepperDash.Essentials.DM
return 0; return 0;
} }
}); });
InputStreamCardStateFeedbacks[tempX] = new IntFeedback(() =>
{
try
{
var inputCard = Chassis.Inputs[tempX];
if (inputCard.Card is DmcStr)
{
Debug.Console(2, "Found input stream card in slot: {0}.", tempX);
var streamCard = inputCard.Card as DmcStr;
if (streamCard.Control.StartFeedback.BoolValue == true)
return 1;
else if (streamCard.Control.StopFeedback.BoolValue == true)
return 2;
else if (streamCard.Control.PauseFeedback.BoolValue == true)
return 3;
else
return 0;
}
return 0;
}
catch (InvalidOperationException iopex)
{
Debug.Console(0, this, Debug.ErrorLogLevel.Warning, "Error adding input stream card in slot: {0}. Error: {1}", tempX, iopex);
return 0;
}
});
} }
} }
} }
@@ -916,6 +974,19 @@ namespace PepperDash.Essentials.DM
Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks"); Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks");
break; break;
} }
case DMInputEventIds.StartEventId:
case DMInputEventIds.StopEventId:
case DMInputEventIds.PauseEventId:
{
Debug.Console(2, this, "DM Input {0} Stream Status EventId", args.Number);
if (InputStreamCardStateFeedbacks[args.Number] != null)
{
InputStreamCardStateFeedbacks[args.Number].FireUpdate();
}
else
Debug.Console(2, this, "No index of {0} found in InputStreamCardStateFeedbacks");
break;
}
default: default:
{ {
Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId); Debug.Console(2, this, "DMInputChange fired for Input {0} with Unhandled EventId: {1}", args.Number, args.EventId);
@@ -1044,6 +1115,19 @@ namespace PepperDash.Essentials.DM
OutputDisabledByHdcpFeedbacks[args.Number].FireUpdate(); OutputDisabledByHdcpFeedbacks[args.Number].FireUpdate();
break; break;
} }
case DMOutputEventIds.StartEventId:
case DMOutputEventIds.StopEventId:
case DMOutputEventIds.PauseEventId:
{
Debug.Console(2, this, "DM Output {0} Stream Status EventId", args.Number);
if (OutputStreamCardStateFeedbacks[args.Number] != null)
{
OutputStreamCardStateFeedbacks[args.Number].FireUpdate();
}
else
Debug.Console(2, this, "No index of {0} found in OutputStreamCardStateFeedbacks");
break;
}
default: default:
{ {
Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId); Debug.Console(2, this, "DMOutputChange fired for Output {0} with Unhandled EventId: {1}", args.Number, args.EventId);
@@ -1243,12 +1327,15 @@ namespace PepperDash.Essentials.DM
else else
{ {
LinkHdmiInputToApi(trilist, ioSlot, joinMap, ioSlotJoin); LinkHdmiInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
LinkStreamInputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
} }
if (RxDictionary.ContainsKey(ioSlot)) if (RxDictionary.ContainsKey(ioSlot))
{ {
LinkRxToApi(trilist, ioSlot, joinMap, ioSlotJoin); LinkRxToApi(trilist, ioSlot, joinMap, ioSlotJoin);
} }
else
LinkStreamOutputToApi(trilist, ioSlot, joinMap, ioSlotJoin);
} }
} }
@@ -1297,6 +1384,86 @@ namespace PepperDash.Essentials.DM
} }
} }
private void LinkStreamInputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
{
var inputPort = InputPorts[string.Format("inputCard{0}--streamIn", ioSlot)];
if (inputPort == null)
{
return;
}
var streamCard = Chassis.Inputs[ioSlot].Card as DmcStr;
var join = joinMap.InputStreamCardState.JoinNumber + ioSlotJoin;
Debug.Console(1, "Port value for input card {0} is set as a stream card", ioSlot);
trilist.SetUShortSigAction(join, s =>
{
if (s == 1)
{
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to start", join, s);
streamCard.Control.Start();
}
else if (s == 2)
{
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to stop", join, s);
streamCard.Control.Stop();
}
else if (s == 3)
{
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to pause", join, s);
streamCard.Control.Pause();
}
else
{
Debug.Console(2, this, "Join {0} value {1}: Ignore stream state", join, s);
}
});
InputStreamCardStateFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[join]);
trilist.UShortInput[join].UShortValue = InputStreamCardStateFeedbacks[ioSlot].UShortValue;
}
private void LinkStreamOutputToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
{
var outputPort = OutputPorts[string.Format("outputCard{0}--streamOut", ioSlot)];
if (outputPort == null)
{
return;
}
var streamCard = Chassis.Outputs[ioSlot].Card as DmcStroAV;
var join = joinMap.OutputStreamCardState.JoinNumber + ioSlotJoin;
Debug.Console(1, "Port value for output card {0} is set as a stream card", ioSlot);
trilist.SetUShortSigAction(join, s =>
{
if (s == 1)
{
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to start", join, s);
streamCard.Control.Start();
}
else if (s == 2)
{
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to stop", join, s);
streamCard.Control.Stop();
}
else if (s == 3)
{
Debug.Console(2, this, "Join {0} value {1}: Setting stream state to pause", join, s);
streamCard.Control.Pause();
}
else
{
Debug.Console(2, this, "Join {0} value {1}: Ignore stream state", join, s);
}
});
OutputStreamCardStateFeedbacks[ioSlot].LinkInputSig(trilist.UShortInput[join]);
trilist.UShortInput[join].UShortValue = OutputStreamCardStateFeedbacks[ioSlot].UShortValue;
}
private void LinkRxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin) private void LinkRxToApi(BasicTriList trilist, uint ioSlot, DmChassisControllerJoinMap joinMap, uint ioSlotJoin)
{ {
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot); Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);