Merge branch 'development' into feature/room-combining

This commit is contained in:
Neil Dorin
2021-09-29 17:17:29 -06:00
12 changed files with 435 additions and 200 deletions

View File

@@ -28,6 +28,7 @@ namespace PepperDash.Essentials
HttpLogoServer LogoServer;
private CTimer _startTimer;
private CEvent _initializeEvent;
private const long StartupTime = 500;
public ControlSystem()
@@ -46,6 +47,24 @@ namespace PepperDash.Essentials
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
// to allow any HD-BaseT DM endpoints to register first.
if (Global.ControlSystemIsDmpsType)
{
Debug.Console(2, "******************* InitializeSystem() Entering **********************");
_initializeEvent = new CEvent();
DeviceManager.AllDevicesActivated += (o, a) =>
{
_initializeEvent.Set();
Debug.Console(2, "******************* InitializeSystem() Exiting **********************");
};
_initializeEvent.Wait(30000);
}
}
private void StartSystem(object obj)
@@ -343,7 +362,7 @@ namespace PepperDash.Essentials
{
var prompt = Global.ControlSystem.ControllerPrompt;
var typeMatch = String.Equals(devConf.Type, prompt, StringComparison.OrdinalIgnoreCase) &&
var typeMatch = String.Equals(devConf.Type, prompt, StringComparison.OrdinalIgnoreCase) ||
String.Equals(devConf.Type, prompt.Replace("-", ""), StringComparison.OrdinalIgnoreCase);
if (!typeMatch)
@@ -361,9 +380,7 @@ namespace PepperDash.Essentials
if(propertiesConfig == null)
propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig);
DeviceManager.AddDevice(dmpsRoutingController);
DeviceManager.AddDevice(DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig));
}
else if (this.ControllerPrompt.IndexOf("mpc3", StringComparison.OrdinalIgnoreCase) > -1)
{

View File

@@ -10,7 +10,7 @@ namespace PepperDash.Essentials.Core.Bridges
new JoinMetadata
{
Description = "DM Chassis enable audio breakaway routing",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});
@@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core.Bridges
new JoinMetadata
{
Description = "DM Chassis enable USB breakaway routing",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinCapabilities = eJoinCapabilities.FromSIMPL,
JoinType = eJoinType.Digital
});

View File

@@ -1,9 +1,17 @@
using System;
namespace PepperDash.Essentials.Core.Bridges
{
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
{
namespace PepperDash.Essentials.Core.Bridges
{
public class DmpsRoutingControllerJoinMap : JoinMapBaseAdvanced
{
[JoinName("SystemPowerOn")]
public JoinDataComplete SystemPowerOn = new JoinDataComplete(new JoinData { JoinNumber = 12, JoinSpan = 1 },
new JoinMetadata { Description = "DMPS System Power On Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("SystemPowerOff")]
public JoinDataComplete SystemPowerOff = new JoinDataComplete(new JoinData { JoinNumber = 13, JoinSpan = 1 },
new JoinMetadata { Description = "DMPS System Power Off Get/Set", JoinCapabilities = eJoinCapabilities.ToFromSIMPL, JoinType = eJoinType.Digital });
[JoinName("VideoSyncStatus")]
public JoinDataComplete VideoSyncStatus = new JoinDataComplete(new JoinData { JoinNumber = 101, JoinSpan = 32 },
new JoinMetadata { Description = "DM Input Video Sync", JoinCapabilities = eJoinCapabilities.ToSIMPL, JoinType = eJoinType.Digital });
@@ -61,5 +69,5 @@ namespace PepperDash.Essentials.Core.Bridges
protected DmpsRoutingControllerJoinMap(uint joinStart, Type type) : base(joinStart, type)
{
}
}
}
}

View File

@@ -69,19 +69,28 @@ namespace PepperDash.Essentials.Core
public override bool CustomActivate()
{
Debug.Console(0, this, "Activating");
if (!PreventRegistration)
{
if (!PreventRegistration)
{
//Debug.Console(1, this, " Does not require registration. Skipping");
var response = Hardware.RegisterWithLogging(Key);
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
var response = Hardware.RegisterWithLogging(Key);
if (response != eDeviceRegistrationUnRegistrationResponse.Success)
{
//Debug.Console(0, this, "ERROR: Cannot register Crestron device: {0}", response);
return false;
}
IsRegistered.FireUpdate();
}
}
else
{
AddPostActivationAction(() =>
{
var response = Hardware.RegisterWithLogging(Key);
IsRegistered.FireUpdate();
});
}
foreach (var f in Feedbacks)
{

View File

@@ -32,6 +32,27 @@ namespace PepperDash.Essentials.Core
// TODO: consider making this configurable later
public static IFormatProvider Culture = CultureInfo.CreateSpecificCulture("en-US");
/// <summary>
/// True when the processor type is a DMPS variant
/// </summary>
public static bool ControlSystemIsDmpsType
{
get
{
return ControlSystem.ControllerPrompt.ToLower().IndexOf("dmps") > -1;
}
}
/// <summary>
/// True when the processor type is a DMPS 4K variant
/// </summary>
public static bool ControlSystemIsDmps4kType
{
get
{
return ControlSystemIsDmpsType && ControlSystem.ControllerPrompt.ToLower().IndexOf("4k") > -1;
}
}
/// <summary>
/// The file path prefix to the folder containing configuration files

View File

@@ -25,9 +25,16 @@ namespace PepperDash.Essentials.DM
public CrestronControlSystem Dmps { get; set; }
public ISystemControl SystemControl { get; private set; }
//Check if DMPS is a DMPS3-4K type for endpoint creation
public bool Dmps4kType { get; private set; }
//IroutingNumericEvent
public event EventHandler<RoutingNumericEventArgs> NumericSwitchChange;
//Feedback for DMPS System Power
public BoolFeedback SystemPowerOnFeedback { get; private set; }
public BoolFeedback SystemPowerOffFeedback { get; private set; }
// Feedbacks for EssentialDM
public Dictionary<uint, IntFeedback> VideoOutputFeedbacks { get; private set; }
@@ -112,10 +119,29 @@ namespace PepperDash.Essentials.DM
/// <param name="chassis"></param>
public DmpsRoutingController(string key, string name, ISystemControl systemControl)
: base(key, name)
{
{
Dmps = Global.ControlSystem;
SystemControl = systemControl;
switch (name.Replace("-", "").Replace("c", "").Replace("C", ""))
{
case "dmps34k50":
case "dmps34k100":
case "dmps34k150":
SystemControl = systemControl as Dmps34K150CSystemControl;
Dmps4kType = true;
break;
case "dmps34k200":
case "dmps34k250":
case "dmps34k300":
case "dmps34k350":
SystemControl = systemControl as Dmps34K300CSystemControl;
Dmps4kType = true;
break;
default:
SystemControl = systemControl as Dmps3SystemControl;
Dmps4kType = false;
break;
}
InputPorts = new RoutingPortCollection<RoutingInputPort>();
OutputPorts = new RoutingPortCollection<RoutingOutputPort>();
@@ -123,6 +149,29 @@ namespace PepperDash.Essentials.DM
TxDictionary = new Dictionary<uint, string>();
RxDictionary = new Dictionary<uint, string>();
SystemPowerOnFeedback = new BoolFeedback(() =>
{
if (SystemControl is Dmps3SystemControl)
{
return ((Dmps3SystemControl)SystemControl).SystemPowerOnFeedBack.BoolValue;
}
else
{
return false;
}
});
SystemPowerOffFeedback = new BoolFeedback(() =>
{
if (SystemControl is Dmps3SystemControl)
{
return ((Dmps3SystemControl)SystemControl).SystemPowerOffFeedBack.BoolValue;
}
else
{
return false;
}
});
VideoOutputFeedbacks = new Dictionary<uint, IntFeedback>();
AudioOutputFeedbacks = new Dictionary<uint, IntFeedback>();
VideoInputSyncFeedbacks = new Dictionary<uint, BoolFeedback>();
@@ -154,6 +203,7 @@ namespace PepperDash.Essentials.DM
// Subscribe to events
Dmps.DMInputChange += Dmps_DMInputChange;
Dmps.DMOutputChange += Dmps_DMOutputChange;
Dmps.DMSystemChange += Dmps_DMSystemChange;
return base.CustomActivate();
}
@@ -191,6 +241,22 @@ namespace PepperDash.Essentials.DM
}
}
public void SetPowerOn(bool a)
{
if (SystemControl is Dmps3SystemControl)
{
((Dmps3SystemControl)SystemControl).SystemPowerOn();
}
}
public void SetPowerOff(bool a)
{
if (SystemControl is Dmps3SystemControl)
{
((Dmps3SystemControl)SystemControl).SystemPowerOff();
}
}
public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge)
{
var joinMap = new DmpsRoutingControllerJoinMap(joinStart);
@@ -211,9 +277,22 @@ namespace PepperDash.Essentials.DM
Debug.Console(1, this, "Linking to Trilist '{0}'", trilist.ID.ToString("X"));
//Link up system
trilist.SetBoolSigAction(joinMap.SystemPowerOn.JoinNumber, SetPowerOn);
trilist.SetBoolSigAction(joinMap.SystemPowerOff.JoinNumber, SetPowerOff);
if (SystemPowerOnFeedback != null)
{
SystemPowerOnFeedback.LinkInputSig(
trilist.BooleanInput[joinMap.SystemPowerOn.JoinNumber]);
}
if (SystemPowerOffFeedback != null)
{
SystemPowerOffFeedback.LinkInputSig(
trilist.BooleanInput[joinMap.SystemPowerOff.JoinNumber]);
}
// Link up outputs
LinkInputsToApi(trilist, joinMap);
LinkOutputsToApi(trilist, joinMap);
}
@@ -719,28 +798,36 @@ namespace PepperDash.Essentials.DM
void Dmps_DMInputChange(Switch device, DMInputEventArgs args)
{
//Debug.Console(2, this, "DMSwitch:{0} Input:{1} Event:{2}'", this.Name, args.Number, args.EventId.ToString());
switch (args.EventId)
try
{
case (DMInputEventIds.OnlineFeedbackEventId):
{
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;
}
switch (args.EventId)
{
case (DMInputEventIds.OnlineFeedbackEventId):
{
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);
if(InputNameFeedbacks.ContainsKey(args.Number))
{
InputNameFeedbacks[args.Number].FireUpdate();
}
break;
}
}
}
catch (Exception e)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "DMSwitch Input Change:{0} Input:{1} Event:{2}\rException: {3}", this.Name, args.Number, args.EventId.ToString(), e.ToString());
}
}
void Dmps_DMOutputChange(Switch device, DMOutputEventArgs args)
@@ -812,6 +899,23 @@ namespace PepperDash.Essentials.DM
}
void Dmps_DMSystemChange(Switch device, DMSystemEventArgs args)
{
switch (args.EventId)
{
case DMSystemEventIds.SystemPowerOnEventId:
{
SystemPowerOnFeedback.FireUpdate();
break;
}
case DMSystemEventIds.SystemPowerOffEventId:
{
SystemPowerOffFeedback.FireUpdate();
break;
}
}
}
/// <summary>
///
/// </summary>
@@ -879,7 +983,6 @@ namespace PepperDash.Essentials.DM
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video)
{
output.VideoOut = input;
}
@@ -903,7 +1006,6 @@ namespace PepperDash.Essentials.DM
if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{
output.USBRoutedTo = input;
}

View File

@@ -329,7 +329,14 @@ namespace PepperDash.Essentials.DM
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (parentDev is DmpsRoutingController)
{
return GetDmRmcControllerForDmps(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber);
if ((parentDev as DmpsRoutingController).Dmps4kType)
{
return GetDmRmcControllerForDmps4k(key, name, typeName, parentDev as DmpsRoutingController, props.ParentOutputNumber);
}
else
{
return GetDmRmcControllerForDmps(key, name, typeName, ipid, parentDev as DmpsRoutingController, props.ParentOutputNumber);
}
}
if (!(parentDev is IDmSwitch))
{
@@ -395,25 +402,47 @@ namespace PepperDash.Essentials.DM
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName,
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps(string key, string name, string typeName,
uint ipid, DmpsRoutingController controller, uint num)
{
Func<string, string, uint, DMOutput, CrestronGenericBaseDevice> dmpsHandler;
if (ChassisDict.TryGetValue(typeName.ToLower(), out dmpsHandler))
{
var output = controller.Dmps.SwitcherOutputs[num] as DMOutput;
if (output != null)
{
return dmpsHandler(key, name, ipid, output);
}
Debug.Console(0, Debug.ErrorLogLevel.Error,
"Cannot attach DM-RMC of type '{0}' to output {1} on DMPS chassis. Output is not a DM Output.",
typeName, num);
return null;
}
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS chassis", typeName, num);
return null;
}
private static CrestronGenericBaseDevice GetDmRmcControllerForDmps4k(string key, string name, string typeName,
DmpsRoutingController controller, uint num)
{
Func<string, string, DMOutput, CrestronGenericBaseDevice> dmpsHandler;
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmpsHandler))
Func<string, string, DMOutput, CrestronGenericBaseDevice> dmps4kHandler;
if (ChassisCpu3Dict.TryGetValue(typeName.ToLower(), out dmps4kHandler))
{
var output = controller.Dmps.SwitcherOutputs[num] as DMOutput;
if (output != null)
{
return dmpsHandler(key, name, output);
return dmps4kHandler(key, name, output);
}
Debug.Console(0, Debug.ErrorLogLevel.Error,
"Cannot attach DM-RMC of type '{0}' to output {1} on DMPS chassis. Output is not a DM Output.",
"Cannot attach DM-RMC of type '{0}' to output {1} on DMPS-4K chassis. Output is not a DM Output.",
typeName, num);
return null;
}
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS chassis", typeName, num);
Debug.Console(0, Debug.ErrorLogLevel.Error, "Cannot create DM-RMC of type '{0}' to output {1} on DMPS-4K chassis", typeName, num);
return null;
}

View File

@@ -36,7 +36,7 @@ namespace PepperDash.Essentials.DM
var ipid = props.Control.IpIdInt;
var pKey = props.ParentDeviceKey.ToLower();
if (pKey == "processor")
if (pKey == "processor")
{
// Catch constructor failures, mainly dues to IPID
try
@@ -65,99 +65,135 @@ namespace PepperDash.Essentials.DM
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
return null;
}
else
{
var parentDev = DeviceManager.GetDeviceForKey(pKey);
if (!(parentDev is IDmSwitch))
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a DM Chassis.",
key, pKey);
return null;
}
var parentDev = DeviceManager.GetDeviceForKey(pKey);
DMInput dmInput;
bool isCpu3 = false;
if (parentDev is IDmSwitch)
{
// Get the Crestron chassis and link stuff up
var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis;
var switchDev = (parentDev as IDmSwitch);
var chassis = switchDev.Chassis;
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
else
//Check that the input is within range of this chassis' possible inputs
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.NumberOfInputs)
{
Debug.Console(0, "Cannot create DM device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
switchDev.TxDictionary.Add(num, key);
dmInput = chassis.Inputs[num];
//Determine if IpId is needed for this chassis type
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps ||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
var controller = (parentDev as IDmSwitch);
controller.TxDictionary.Add(num, key);
isCpu3 = true;
}
// Catch constructor failures, mainly dues to IPID
try
{
// Must use different constructor for CPU3 chassis types. No IPID
if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 ||
chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps ||
chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps||
chassis is DmMd128x128 || chassis is DmMd64x64)
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(chassis.Inputs[num]));
if (typeName.StartsWith("hdbasettx"))
return new HDBaseTTxController(key, name, new HDTx3CB(chassis.Inputs[num]));
}
else
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, chassis.Inputs[num]));
if (typeName.StartsWith("hdbasettx"))
return new HDBaseTTxController(key, name, new HDTx3CB(ipid, chassis.Inputs[num]));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
}
else if(parentDev is DmpsRoutingController)
{
// Get the DMPS chassis and link stuff up
var dmpsDev = (parentDev as DmpsRoutingController);
var chassis = dmpsDev.Dmps;
//Check that the input is within range of this chassis' possible inputs
var num = props.ParentInputNumber;
if (num <= 0 || num > chassis.SwitcherInputs.Count)
{
Debug.Console(0, "Cannot create DMPS device '{0}'. Input number '{1}' is out of range",
key, num);
return null;
}
dmpsDev.TxDictionary.Add(num, key);
try
{
dmInput = chassis.SwitcherInputs[num] as DMInput;
}
catch
{
Debug.Console(0, "Cannot create DMPS device '{0}'. Input number '{1}' is not a DM input", key, num);
return null;
}
}
else
{
Debug.Console(0, "Cannot create DM device '{0}'. '{1}' is not a processor, DM Chassis or DMPS.", key, pKey);
return null;
}
return null;
try
{
// Must use different constructor for CPU3 or DMPS3-4K types. No IPID
if (isCpu3 || Global.ControlSystemIsDmps4kType)
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(dmInput));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(dmInput));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(dmInput));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(dmInput));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(dmInput));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(dmInput));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(dmInput));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(dmInput));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(dmInput));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(dmInput));
if (typeName.StartsWith("hdbasettx"))
return new HDBaseTTxController(key, name, new HDTx3CB(dmInput));
}
else
{
if (typeName.StartsWith("dmtx200"))
return new DmTx200Controller(key, name, new DmTx200C2G(ipid, dmInput));
if (typeName.StartsWith("dmtx201c"))
return new DmTx201CController(key, name, new DmTx201C(ipid, dmInput));
if (typeName.StartsWith("dmtx201s"))
return new DmTx201SController(key, name, new DmTx201S(ipid, dmInput));
if (typeName.StartsWith("dmtx4k100"))
return new DmTx4k100Controller(key, name, new DmTx4K100C1G(ipid, dmInput));
if (typeName.StartsWith("dmtx4kz100"))
return new DmTx4kz100Controller(key, name, new DmTx4kz100C1G(ipid, dmInput));
if (typeName.StartsWith("dmtx4k202"))
return new DmTx4k202CController(key, name, new DmTx4k202C(ipid, dmInput));
if (typeName.StartsWith("dmtx4kz202"))
return new DmTx4kz202CController(key, name, new DmTx4kz202C(ipid, dmInput));
if (typeName.StartsWith("dmtx4k302"))
return new DmTx4k302CController(key, name, new DmTx4k302C(ipid, dmInput));
if (typeName.StartsWith("dmtx4kz302"))
return new DmTx4kz302CController(key, name, new DmTx4kz302C(ipid, dmInput));
if (typeName.StartsWith("dmtx401"))
return new DmTx401CController(key, name, new DmTx401C(ipid, dmInput));
if (typeName.StartsWith("hdbasettx"))
return new HDBaseTTxController(key, name, new HDTx3CB(ipid, dmInput));
}
}
catch (Exception e)
{
Debug.Console(0, "[{0}] WARNING: Cannot create DM-TX device: {1}", key, e);
}
return null;
}
}
@@ -185,11 +221,12 @@ namespace PepperDash.Essentials.DM
protected DmTxControllerBase(string key, string name, EndpointTransmitterBase hardware)
: base(key, name, hardware)
{
// if wired to a chassis, skip registration step in base class
if (hardware.DMInput != null)
{
this.PreventRegistration = true;
}
// if wired to a chassis or DMPS, skip registration step in base class
if (hardware.DMInput != null || (Global.ControlSystemIsDmpsType && hardware.DMInput != null))
{
this.PreventRegistration = true;
}
AddToFeedbackList(ActiveVideoInputFeedback);
}

View File

@@ -93,6 +93,20 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
JoinType = eJoinType.Digital
});
[JoinName("EnteringStandbyMode")]
public JoinDataComplete EnteringStandbyMode = new JoinDataComplete(
new JoinData
{
JoinNumber = 229,
JoinSpan = 1
},
new JoinMetadata
{
Description = "High to indicate that the codec is entering standby mode",
JoinCapabilities = eJoinCapabilities.ToSIMPL,
JoinType = eJoinType.Digital
});
#endregion

View File

@@ -24,9 +24,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
enum eCommandType { SessionStart, SessionEnd, Command, GetStatus, GetConfiguration };
public enum eExternalSourceType {camera, desktop, document_camera, mediaplayer, PC, whiteboard, other}
public enum eExternalSourceMode {Ready, NotReady, Hidden, Error}
public enum eExternalSourceMode {Ready, NotReady, Hidden, Error}
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectoryHistoryStack,
public class CiscoSparkCodec : VideoCodecBase, IHasCallHistory, IHasCallFavorites, IHasDirectory,
IHasScheduleAwareness, IOccupancyStatusProvider, IHasCodecLayouts, IHasCodecSelfView,
ICommunicationMonitor, IRouting, IHasCodecCameras, IHasCameraAutoMode, IHasCodecRoomPresets,
IHasExternalSourceSwitching, IHasBranding, IHasCameraOff, IHasCameraMute, IHasDoNotDisturbMode,
@@ -108,9 +108,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// </summary>
public CodecDirectory DirectoryRoot { get; private set; }
private CodecDirectory _currentDirectoryResult;
/// <summary>
/// Represents the current state of the directory and is computed on get
/// </summary>
@@ -118,15 +115,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
return _currentDirectoryResult;
}
private set
{
_currentDirectoryResult = value;
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
OnDirectoryResultReturned(_currentDirectoryResult);
if (DirectoryBrowseHistory.Count > 0)
return DirectoryBrowseHistory[DirectoryBrowseHistory.Count - 1];
else
return DirectoryRoot;
}
}
@@ -137,8 +129,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// </summary>
public List<CodecDirectory> DirectoryBrowseHistory { get; private set; }
public Stack<CodecDirectory> DirectoryBrowseHistoryStack { get; private set; }
public CodecScheduleAwareness CodecSchedule { get; private set; }
/// <summary>
@@ -329,7 +319,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SupportsCameraOff = true;
DoNotDisturbModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Conference.DoNotDisturb.BoolValue);
HalfWakeModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value == "Halfwake");
HalfWakeModeIsOnFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value.ToLower() == "halfwake");
EnteringStandbyModeFeedback = new BoolFeedback(() => CodecStatus.Status.Standby.State.Value.ToLower() == "enteringstandby");
PresentationViewMaximizedFeedback = new BoolFeedback(() => CurrentPresentationView == "Maximized");
@@ -367,7 +358,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
CallHistory = new CodecCallHistory();
if (props.Favorites != null)
if (props.Favorites != null)
{
CallFavorites = new CodecCallFavorites();
CallFavorites.Favorites = props.Favorites;
@@ -377,12 +369,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
DirectoryBrowseHistory = new List<CodecDirectory>();
DirectoryBrowseHistoryStack = new Stack<CodecDirectory>();
CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => DirectoryBrowseHistory.Count > 0);
CurrentDirectoryResultIsNotDirectoryRoot = new BoolFeedback(() => CurrentDirectoryResult != DirectoryRoot);
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
CodecSchedule = new CodecScheduleAwareness();
//Set Feedback Actions
SetFeedbackActions();
CodecOsdIn = new RoutingInputPort(RoutingPortNames.CodecOsd, eRoutingSignalType.Audio | eRoutingSignalType.Video,
eRoutingPortConnectionType.Hdmi, new Action(StopSharing), this);
HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video,
@@ -417,9 +412,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
BrandingEnabled = props.UiBranding.Enable;
_brandingUrl = props.UiBranding.BrandingUrl;
//Set Feedback Actions
SetFeedbackActions();
}
private void SetFeedbackActions()
@@ -431,6 +423,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
StandbyIsOnFeedback.FireUpdate();
HalfWakeModeIsOnFeedback.FireUpdate();
EnteringStandbyModeFeedback.FireUpdate();
});
CodecStatus.Status.RoomAnalytics.PeoplePresence.ValueChangedAction = RoomIsOccupiedFeedback.FireUpdate;
CodecStatus.Status.RoomAnalytics.PeopleCount.Current.ValueChangedAction = PeopleCountFeedback.FireUpdate;
@@ -449,11 +442,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
}
catch (Exception ex)
{
Debug.Console(0, this, "Error setting MainVideoMute Action: {0}", ex);
Debug.Console(0, this, "Error setting MainVideuMute Action: {0}", ex);
if (ex.InnerException != null)
{
Debug.Console(0, this, "Error setting MainVideoMute Action: {0}", ex);
Debug.Console(0, this, "Error setting MainVideuMute Action: {0}", ex);
}
}
}
@@ -1051,8 +1044,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
PhonebookSyncState.PhonebookRootEntriesReceived();
CurrentDirectoryResult = DirectoryRoot;
PrintDirectory(DirectoryRoot);
}
else if (PhonebookSyncState.InitialSyncComplete)
@@ -1064,7 +1055,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
PrintDirectory(directoryResults);
CurrentDirectoryResult = directoryResults;
DirectoryBrowseHistory.Add(directoryResults);
OnDirectoryResultReturned(directoryResults);
}
}
@@ -1095,6 +1088,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <param name="result"></param>
void OnDirectoryResultReturned(CodecDirectory result)
{
CurrentDirectoryResultIsNotDirectoryRoot.FireUpdate();
// This will return the latest results to all UIs. Multiple indendent UI Directory browsing will require a different methodology
var handler = DirectoryResultReturned;
if (handler != null)
@@ -1246,8 +1241,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <param name="searchString"></param>
public void SearchDirectory(string searchString)
{
DirectoryBrowseHistoryStack.Push(CurrentDirectoryResult);
SendText(string.Format("xCommand Phonebook Search SearchString: \"{0}\" PhonebookType: {1} ContactType: Contact Limit: {2}", searchString, PhonebookMode, PhonebookResultsLimit));
}
@@ -1257,8 +1250,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <param name="folderId"></param>
public void GetDirectoryFolderContents(string folderId)
{
DirectoryBrowseHistoryStack.Push(CurrentDirectoryResult);
SendText(string.Format("xCommand Phonebook Search FolderId: {0} PhonebookType: {1} ContactType: Any Limit: {2}", folderId, PhonebookMode, PhonebookResultsLimit));
}
@@ -1268,12 +1259,24 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// <returns></returns>
public void GetDirectoryParentFolderContents()
{
if (DirectoryBrowseHistoryStack.Count == 0)
var currentDirectory = new CodecDirectory();
if (DirectoryBrowseHistory.Count > 0)
{
return;
var lastItemIndex = DirectoryBrowseHistory.Count - 1;
var parentDirectoryContents = DirectoryBrowseHistory[lastItemIndex];
DirectoryBrowseHistory.Remove(DirectoryBrowseHistory[lastItemIndex]);
currentDirectory = parentDirectoryContents;
}
else
{
currentDirectory = DirectoryRoot;
}
CurrentDirectoryResult = DirectoryBrowseHistoryStack.Pop();
OnDirectoryResultReturned(currentDirectory);
}
/// <summary>
@@ -1281,9 +1284,9 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
/// </summary>
public void SetCurrentDirectoryToRoot()
{
DirectoryBrowseHistoryStack.Clear();
DirectoryBrowseHistory.Clear();
CurrentDirectoryResult = DirectoryRoot;
OnDirectoryResultReturned(DirectoryRoot);
}
/// <summary>
@@ -1545,6 +1548,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
halfwakeCodec.StandbyIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateStandby.JoinNumber]);
halfwakeCodec.StandbyIsOnFeedback.LinkComplementInputSig(trilist.BooleanInput[joinMap.DeactivateStandby.JoinNumber]);
halfwakeCodec.HalfWakeModeIsOnFeedback.LinkInputSig(trilist.BooleanInput[joinMap.ActivateHalfWakeMode.JoinNumber]);
halfwakeCodec.EnteringStandbyModeFeedback.LinkInputSig(trilist.BooleanInput[joinMap.EnteringStandbyMode.JoinNumber]);
trilist.SetSigFalseAction(joinMap.ActivateStandby.JoinNumber, () => halfwakeCodec.StandbyActivate());
trilist.SetSigFalseAction(joinMap.DeactivateStandby.JoinNumber, () => halfwakeCodec.StandbyDeactivate());
@@ -1937,27 +1941,17 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
{
get
{
try
if (CodecStatus.Status.SIP != null && CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value != null)
{
if (CodecStatus.Status.SIP != null && !string.IsNullOrEmpty(CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value))
{
return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value;
}
else if (CodecStatus.Status.UserInterface != null &&
CodecStatus.Status.UserInterface.ContactInfo != null && CodecStatus.Status.UserInterface.ContactInfo.ContactMethod != null)
{
return CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value;
}
else
{
return string.Empty;
}
return CodecStatus.Status.SIP.AlternateURI.Primary.URI.Value;
}
catch (Exception e)
else if (CodecStatus.Status.UserInterface != null &&
CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value != null)
{
Debug.Console(2, "Error getting SipUri: {0}", e);
return CodecStatus.Status.UserInterface.ContactInfo.ContactMethod[0].Number.Value;
}
else
return string.Empty;
}
}
}
@@ -2166,6 +2160,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
public BoolFeedback HalfWakeModeIsOnFeedback { get; private set; }
public BoolFeedback EnteringStandbyModeFeedback { get; private set; }
public void HalfwakeActivate()
{
SendText("xCommand Standby Halfwake");

View File

@@ -27,6 +27,8 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
{
BoolFeedback HalfWakeModeIsOnFeedback { get; }
BoolFeedback EnteringStandbyModeFeedback { get; }
void HalfwakeActivate();
}
}

View File

@@ -1,3 +1,3 @@
<packages>
<package id="PepperDashCore" version="1.1.0" targetFramework="net35" allowedVersions="[1.0,1.1)"/>
<package id="PepperDashCore" version="1.1.0" targetFramework="net35" allowedVersions="[1.0,2.0)"/>
</packages>