Merge pull request #1063 from PepperDash/feature/dmps-dm-fixes

Various DMPS fixes
This commit is contained in:
Andrew Welker
2023-03-22 10:52:18 -06:00
committed by GitHub
9 changed files with 122 additions and 48 deletions

View File

@@ -55,7 +55,7 @@ namespace PepperDash.Essentials
return null; return null;
} }
// DSP format: deviceKey--levelName, biampTesira-1--master // DSP/DMPS format: deviceKey--levelName, biampTesira-1--master
match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)"); match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)");
if (match.Success) if (match.Success)
{ {
@@ -67,6 +67,27 @@ namespace PepperDash.Essentials
if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always... if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always...
return dsp.LevelControlPoints[levelTag]; return dsp.LevelControlPoints[levelTag];
} }
var dmps = DeviceManager.GetDeviceForKey(devKey) as DmpsAudioOutputController;
if (dmps != null)
{
var levelTag = match.Groups[2].Value;
switch (levelTag)
{
case "master":
return dmps.MasterVolumeLevel;
case "source":
return dmps.SourceVolumeLevel;
case "micsmaster":
return dmps.MicsMasterVolumeLevel;
case "codec1":
return dmps.Codec1VolumeLevel;
case "codec2":
return dmps.Codec2VolumeLevel;
default:
return dmps.MasterVolumeLevel;
}
}
// No volume for some reason. We have failed as developers // No volume for some reason. We have failed as developers
return null; return null;
} }

View File

@@ -47,28 +47,29 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public override void InitializeSystem() public override void InitializeSystem()
{ {
_startTimer = new CTimer(StartSystem,StartupTime);
// If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate // If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate
// to allow any HD-BaseT DM endpoints to register first. // to allow any HD-BaseT DM endpoints to register first.
if (Global.ControlSystemIsDmpsType) bool preventInitializationComplete = Global.ControlSystemIsDmpsType;
if (preventInitializationComplete)
{ {
Debug.Console(1, "******************* InitializeSystem() Entering **********************"); Debug.Console(1, "******************* InitializeSystem() Entering **********************");
_startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime);
_initializeEvent = new CEvent(); _initializeEvent = new CEvent(true, false);
DeviceManager.AllDevicesRegistered += (o, a) => DeviceManager.AllDevicesRegistered += (o, a) =>
{ {
_initializeEvent.Set(); _initializeEvent.Set();
Debug.Console(1, "******************* InitializeSystem() Exiting **********************");
}; };
_initializeEvent.Wait(30000); _initializeEvent.Wait(30000);
Debug.Console(1, "******************* InitializeSystem() Exiting **********************");
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
else
{
_startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime);
} }
} }
private void StartSystem(object obj) private void StartSystem(object preventInitialization)
{ {
DeterminePlatform(); DeterminePlatform();
@@ -125,7 +126,10 @@ namespace PepperDash.Essentials
return; return;
} }
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; if (!(bool)preventInitialization)
{
SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true;
}
} }
/// <summary> /// <summary>

View File

@@ -28,6 +28,8 @@ namespace PepperDash.Essentials.DM
InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn}; InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn};
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HDBaseTSink}; OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HDBaseTSink};
PreventRegistration = true;
rmc.Register();
} }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)

View File

@@ -33,6 +33,8 @@ namespace PepperDash.Essentials.DM
InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn}; InputPorts = new RoutingPortCollection<RoutingInputPort> {DmIn};
OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HdmiOut}; OutputPorts = new RoutingPortCollection<RoutingOutputPort> {HdmiOut};
PreventRegistration = true;
rmc.Register();
} }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)

View File

@@ -329,6 +329,9 @@ namespace PepperDash.Essentials.DM
DmRmcPropertiesConfig props, string pKey, uint ipid) DmRmcPropertiesConfig props, string pKey, uint ipid)
{ {
var parentDev = DeviceManager.GetDeviceForKey(pKey); var parentDev = DeviceManager.GetDeviceForKey(pKey);
CrestronGenericBaseDevice rx;
bool useChassisForOfflineFeedback = false;
if (parentDev is DmpsRoutingController) if (parentDev is DmpsRoutingController)
{ {
var dmps = parentDev as DmpsRoutingController; var dmps = parentDev as DmpsRoutingController;
@@ -342,22 +345,33 @@ namespace PepperDash.Essentials.DM
return null; return null;
} }
// Must use different constructor for DMPS4K types. No IPID // Must use different constructor for DMPS4K types. No IPID
if (Global.ControlSystemIsDmps4kType || typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g") if (Global.ControlSystemIsDmps4kType)
{ {
var rmc = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber); rx = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber);
Debug.Console(0, "DM endpoint output {0} is for Dmps4k, changing online feedback to chassis", num); useChassisForOfflineFeedback = true;
rmc.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue); }
else
{
rx = GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber);
if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
{
useChassisForOfflineFeedback = true;
}
}
if (useChassisForOfflineFeedback)
{
Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
rx.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue);
dmps.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => dmps.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
{ {
foreach (var feedback in rmc.Feedbacks) foreach (var feedback in rx.Feedbacks)
{ {
if (feedback != null) if (feedback != null)
feedback.FireUpdate(); feedback.FireUpdate();
} }
}; };
return rmc;
} }
return GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber); return rx;
} }
else if (parentDev is DmChassisController) else if (parentDev is DmChassisController)
{ {
@@ -380,23 +394,33 @@ namespace PepperDash.Essentials.DM
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64 chassis is DmMd128x128 || chassis is DmMd64x64)
|| typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
{ {
var rmc = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev); rx = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev);
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num); useChassisForOfflineFeedback = true;
rmc.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue);
controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
{
foreach (var feedback in rmc.Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
return rmc;
} }
return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev); else
{
rx = GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev);
if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g")
{
useChassisForOfflineFeedback = true;
}
}
if (useChassisForOfflineFeedback)
{
Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
rx.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue);
controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) =>
{
foreach (var feedback in rx.Feedbacks)
{
if (feedback != null)
feedback.FireUpdate();
}
};
}
return rx;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -500,8 +524,6 @@ namespace PepperDash.Essentials.DM
return null; return null;
} }
} }
} }
public class DmRmcControllerFactory : EssentialsDeviceFactory<DmRmcControllerBase> public class DmRmcControllerFactory : EssentialsDeviceFactory<DmRmcControllerBase>

View File

@@ -78,6 +78,8 @@ namespace PepperDash.Essentials.DM
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue); IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate(); controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
} }
PreventRegistration = true;
tx.Register();
} }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)

View File

@@ -72,6 +72,7 @@ namespace PepperDash.Essentials.DM
HdmiIn.Port = Tx; HdmiIn.Port = Tx;
PreventRegistration = true; PreventRegistration = true;
tx.Register();
} }
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)

View File

@@ -126,6 +126,7 @@ namespace PepperDash.Essentials.DM
var parentDev = DeviceManager.GetDeviceForKey(pKey); var parentDev = DeviceManager.GetDeviceForKey(pKey);
DMInput dmInput; DMInput dmInput;
BasicDmTxControllerBase tx; BasicDmTxControllerBase tx;
bool useChassisForOfflineFeedback = false;
if (parentDev is DmChassisController) if (parentDev is DmChassisController)
{ {
@@ -155,15 +156,23 @@ namespace PepperDash.Essentials.DM
chassis is DmMd128x128 || chassis is DmMd64x64) chassis is DmMd128x128 || chassis is DmMd64x64)
{ {
tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput); tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput);
Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num); useChassisForOfflineFeedback = true;
tx.IsOnline.SetValueFunc(() => switchDev.InputEndpointOnlineFeedbacks[num].BoolValue);
switchDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
return tx;
} }
else else
{ {
return GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput); tx = GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput);
if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g")
{
useChassisForOfflineFeedback = true;
}
} }
if (useChassisForOfflineFeedback)
{
Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
tx.IsOnline.SetValueFunc(() => switchDev.InputEndpointOnlineFeedbacks[num].BoolValue);
switchDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
}
return tx;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -203,15 +212,23 @@ namespace PepperDash.Essentials.DM
if(Global.ControlSystemIsDmps4kType) if(Global.ControlSystemIsDmps4kType)
{ {
tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput); tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput);
Debug.Console(0, "DM endpoint output {0} is for DMPS3-4K, changing online feedback to chassis", num); useChassisForOfflineFeedback = true;
tx.IsOnline.SetValueFunc(() => dmpsDev.InputEndpointOnlineFeedbacks[num].BoolValue);
dmpsDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
return tx;
} }
else else
{ {
return GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput); tx = GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput);
if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g")
{
useChassisForOfflineFeedback = true;
}
} }
if (useChassisForOfflineFeedback)
{
Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num);
tx.IsOnline.SetValueFunc(() => dmpsDev.InputEndpointOnlineFeedbacks[num].BoolValue);
dmpsDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate();
}
return tx;
} }
catch (Exception e) catch (Exception e)
{ {

View File

@@ -52,6 +52,9 @@ namespace PepperDash.Essentials.DM
IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue); IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue);
controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate(); controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate();
} }
PreventRegistration = true;
tx.Register();
} }
#region IRoutingInputs Members #region IRoutingInputs Members