Merged in bugfix/ecs-1192 (pull request #38)

Bugfix/ecs 1192

Approved-by: Neil Dorin <ndorin@pepperdash.com>
This commit is contained in:
Neil Dorin
2019-11-27 17:41:37 +00:00
10 changed files with 151 additions and 117 deletions

View File

@@ -137,15 +137,15 @@ namespace PepperDash.Essentials.Bridges {
} }
if (dmChassis.RxDictionary.ContainsKey(ioSlot)) { if (dmChassis.RxDictionary.ContainsKey(ioSlot)) {
Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot); Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot);
var rxKey = dmChassis.RxDictionary[ioSlot]; //var rxKey = dmChassis.RxDictionary[ioSlot];
var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase; //var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase;
var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase; //var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase;
if (dmChassis.Chassis is DmMd128x128 || dmChassis.Chassis is DmMd64x64) { //if (hdBaseTDevice != null) {
dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
} //}
else if (rxDevice != null) { //else if (rxDevice != null) {
rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); // rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]);
} //}
} }
// Feedback // Feedback

View File

@@ -17,6 +17,8 @@ using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Config; using PepperDash.Essentials.Room.Config;
using PepperDash.Essentials.Room.Cotija; using PepperDash.Essentials.Room.Cotija;
using Newtonsoft.Json;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class ControlSystem : CrestronControlSystem public class ControlSystem : CrestronControlSystem
@@ -359,21 +361,7 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor")); DeviceManager.AddDevice(new PepperDash.Essentials.Core.Devices.CrestronProcessor("processor"));
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, new DM.Config.DmpsRoutingPropertiesConfig());
DeviceManager.AddDevice(dmpsRoutingController);
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
// Add global System Monitor device // Add global System Monitor device
DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor"));
@@ -390,7 +378,26 @@ namespace PepperDash.Essentials
if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower()) if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower())
Debug.Console(0, Debug.Console(0,
"WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available", "WARNING: Config file defines processor type as '{0}' but actual processor is '{1}'! Some ports may not be available",
devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper()); devConf.Type.ToUpper(), Global.ControlSystem.ControllerPrompt.ToUpper());
// Check if the processor is a DMPS model
if (this.ControllerPrompt.IndexOf("dmps", StringComparison.OrdinalIgnoreCase) > -1)
{
Debug.Console(2, "Adding DmpsRoutingController for {0} to Device Manager.", this.ControllerPrompt);
var propertiesConfig = JsonConvert.DeserializeObject<DM.Config.DmpsRoutingPropertiesConfig>(devConf.Properties.ToString());
if(propertiesConfig == null)
propertiesConfig = new DM.Config.DmpsRoutingPropertiesConfig();
var dmpsRoutingController = DmpsRoutingController.GetDmpsRoutingController("processor-avRouting", this.ControllerPrompt, propertiesConfig);
DeviceManager.AddDevice(dmpsRoutingController);
}
else
{
Debug.Console(2, "************Processor is not DMPS type***************");
}
continue; continue;
} }

View File

@@ -231,64 +231,25 @@ namespace PepperDash.Essentials
void Initialize() void Initialize()
{ {
if (DefaultAudioDevice is IBasicVolumeControls) try
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
else if (DefaultAudioDevice is IHasVolumeDevice)
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
CurrentVolumeControls = DefaultVolumeControls;
var disp = DefaultDisplay as DisplayBase;
if (disp != null)
{ {
// Link power, warming, cooling to display if (DefaultAudioDevice is IBasicVolumeControls)
disp.PowerIsOnFeedback.OutputChange += (o, a) => DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
{ else if (DefaultAudioDevice is IHasVolumeDevice)
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue) DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
{ CurrentVolumeControls = DefaultVolumeControls;
if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
{
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
// Get Microphone Privacy object, if any
this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
}
// Combines call feedback from both codecs if available // Combines call feedback from both codecs if available
InCallFeedback = new BoolFeedback(() => InCallFeedback = new BoolFeedback(() =>
{ {
bool inAudioCall = false; bool inAudioCall = false;
bool inVideoCall = false; bool inVideoCall = false;
if(AudioCodec != null) if (AudioCodec != null)
inAudioCall = AudioCodec.IsInCall; inAudioCall = AudioCodec.IsInCall;
if(VideoCodec != null) if (VideoCodec != null)
inVideoCall = VideoCodec.IsInCall; inVideoCall = VideoCodec.IsInCall;
if (inAudioCall || inVideoCall) if (inAudioCall || inVideoCall)
@@ -297,22 +258,71 @@ namespace PepperDash.Essentials
return false; return false;
}); });
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); var disp = DefaultDisplay as DisplayBase;
if (disp != null)
{
// Link power, warming, cooling to display
disp.PowerIsOnFeedback.OutputChange += (o, a) =>
{
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
{
if (!disp.PowerIsOnFeedback.BoolValue)
CurrentSourceInfo = null;
OnFeedback.FireUpdate();
}
if (disp.PowerIsOnFeedback.BoolValue)
{
SetDefaultLevels();
}
};
if (AudioCodec != null) disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); {
IsWarmingUpFeedback.FireUpdate();
if (!IsWarmingUpFeedback.BoolValue)
(CurrentVolumeControls as IBasicVolumeWithFeedback).SetVolume(DefaultVolume);
};
disp.IsCoolingDownFeedback.OutputChange += (o, a) =>
{
IsCoolingDownFeedback.FireUpdate();
};
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); }
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
SourceListKey = "default"; this.MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
EnablePowerOnToLastSource = true;
Debug.Console(2, this, "Microphone Privacy Config evaluated.");
// Get emergency object, if any
this.Emergency = EssentialsRoomConfigHelper.GetEmergency(PropertiesConfig, this);
Debug.Console(2, this, "Emergency Config evaluated.");
VideoCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
if (AudioCodec != null)
AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate();
IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue);
VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => this.IsSharingFeedback.FireUpdate();
// link privacy to VC (for now?)
PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue);
VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => this.PrivacyModeIsOnFeedback.FireUpdate();
CallTypeFeedback = new IntFeedback(() => 0);
SourceListKey = "default";
EnablePowerOnToLastSource = true;
}
catch (Exception e)
{
Debug.Console(0, this, "Error Initializing Room: {0}", e);
}
} }
protected override void CustomSetConfig(DeviceConfig config) protected override void CustomSetConfig(DeviceConfig config)

View File

@@ -33,9 +33,9 @@ namespace PepperDash.Essentials.Core
{ {
Audio = 1, Audio = 1,
Video = 2, Video = 2,
//AudioVideo = 4, AudioVideo = 4,
UsbOutput = 4, UsbOutput = 8,
UsbInput = 8 UsbInput = 16
} }
public enum eRoutingPortConnectionType public enum eRoutingPortConnectionType

View File

@@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core
public ushort Count public ushort Count
{ {
get { return SetNumberOfItemsSig.UShortValue; } get { return SetNumberOfItemsSig.UShortValue; }
set { SetNumberOfItemsSig.UShortValue = value; } set { SetNumberOfItemsSig.UShortValue = value; }
} }
public ushort MaxDefinedItems { get; private set; } public ushort MaxDefinedItems { get; private set; }
@@ -100,8 +100,9 @@ namespace PepperDash.Essentials.Core
// Empty the list // Empty the list
Items.Clear(); Items.Clear();
// Clean up the SRL // Clean up the SRL
Count = 0; Count = 1;
ScrollToItemSig.UShortValue = 1;
ScrollToItemSig.UShortValue = 1;
} }
/// <summary> /// <summary>

View File

@@ -177,8 +177,10 @@ namespace PepperDash.Essentials.DM {
}); });
OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => {
CrestronConsole.PrintLine("GotHere 5"); //if (Chassis.Outputs[tempX].Endpoint != null)
return Chassis.Outputs[tempX].EndpointOnlineFeedback; // return Chassis.Outputs[tempX].Endpoint.IsOnline;
//else
return Chassis.Outputs[tempX].EndpointOnlineFeedback;
}); });
} }
@@ -456,9 +458,8 @@ namespace PepperDash.Essentials.DM {
} }
/// ///
/// </summary> /// </summary>
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) { void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{
//This should be a switch case JTA 2018-07-02
var output = args.Number; var output = args.Number;
switch (args.EventId) { switch (args.EventId) {
@@ -469,7 +470,10 @@ namespace PepperDash.Essentials.DM {
break; break;
} }
case DMOutputEventIds.EndpointOnlineEventId: { case DMOutputEventIds.EndpointOnlineEventId: {
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback); Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. EndpointOnlineFeedback State: {1}", args.Number, Chassis.Outputs[output].EndpointOnlineFeedback);
if(Chassis.Outputs[output].Endpoint != null)
Debug.Console(2, this, "Output {0} DMOutputEventIds.EndpointOnlineEventId fired. Endpoint.IsOnline State: {1}", args.Number, Chassis.Outputs[output].Endpoint.IsOnline);
OutputEndpointOnlineFeedbacks[output].FireUpdate(); OutputEndpointOnlineFeedbacks[output].FireUpdate();
break; break;
} }

View File

@@ -767,8 +767,6 @@ namespace PepperDash.Essentials.DM
/// </summary> /// </summary>
void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args)
{ {
//This should be a switch case JTA 2018-07-02
var output = args.Number; var output = args.Number;
switch (args.EventId) switch (args.EventId)

View File

@@ -116,15 +116,25 @@ namespace PepperDash.Essentials.DM
public override bool CustomActivate() public override bool CustomActivate()
{ {
// Set input and output names from config // Set input and output names from config
if (InputNames != null) if (InputNames != null)
{
foreach (var kvp in InputNames) foreach (var kvp in InputNames)
(Dmps.SwitcherInputs[kvp.Key] as DMInput).Name.StringValue = kvp.Value; {
var input = (Dmps.SwitcherInputs[kvp.Key] as DMInput);
if (input != null)
input.Name.StringValue = kvp.Value;
}
}
if (OutputNames != null) if (OutputNames != null)
{
foreach (var kvp in OutputNames) foreach (var kvp in OutputNames)
(Dmps.SwitcherOutputs[kvp.Key] as Card.Dmps3OutputBase).Name.StringValue = kvp.Value; {
var output = (Dmps.SwitcherOutputs[kvp.Key] as DMOutput);
if (output != null)
output.Name.StringValue = kvp.Value;
}
}
// Subscribe to events // Subscribe to events
Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange); Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange);
@@ -629,41 +639,41 @@ namespace PepperDash.Essentials.DM
} }
DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; DMInput inCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput;
Card.Dmps3OutputBase outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as Card.Dmps3OutputBase; DMOutput outCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput;
if (inCard != null) //if (inCard != null)
{ //{
// NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES
if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video)
{ {
//SystemControl.VideoEnter.BoolValue = true; //SystemControl.VideoEnter.BoolValue = true;
if (outCard != null && outCard.VideoOut != null) if (outCard != null)
outCard.VideoOut = inCard; outCard.VideoOut = inCard;
} }
if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio)
{ {
if (outCard != null && outCard.AudioOut != null) if (outCard != null)
outCard.AudioOut = inCard; outCard.AudioOut = inCard;
} }
if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput)
{ {
if (outCard != null && outCard.USBRoutedTo != null) if (outCard != null)
outCard.USBRoutedTo = inCard; outCard.USBRoutedTo = inCard;
} }
if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput)
{ {
if (inCard != null && inCard.USBRoutedTo != null) if (inCard != null)
inCard.USBRoutedTo = outCard; inCard.USBRoutedTo = outCard;
} }
} //}
else //else
{ //{
Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector); // Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector);
} //}
} }
else else

View File

@@ -87,7 +87,11 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
else else
Debug.Console(0, this, "Unable to add Red LED device"); Debug.Console(0, this, "Unable to add Red LED device");
CheckPrivacyMode(); AddPostActivationAction(() => {
CheckPrivacyMode();
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange -= PrivacyModeIsOnFeedback_OutputChange;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
});
initialized = true; initialized = true;
@@ -97,8 +101,6 @@ namespace PepperDash.Essentials.Devices.Common.Microphones
public void SetPrivacyDevice(IPrivacy privacyDevice) public void SetPrivacyDevice(IPrivacy privacyDevice)
{ {
PrivacyDevice = privacyDevice; PrivacyDevice = privacyDevice;
PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange;
} }
void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e) void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e)

View File

@@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor) public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor)
: base(key, name, sensor) : base(key, name, sensor)
{ {
OccSensor = sensor;
AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue);
OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue); OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);