diff --git a/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs b/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs index 9910d2ed..6daddbb0 100644 --- a/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs +++ b/PepperDashEssentials/Bridges/DmBladeChassisControllerBridge.cs @@ -137,15 +137,15 @@ namespace PepperDash.Essentials.Bridges { } if (dmChassis.RxDictionary.ContainsKey(ioSlot)) { Debug.Console(2, "Creating Rx Feedbacks {0}", ioSlot); - var rxKey = dmChassis.RxDictionary[ioSlot]; - var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase; - var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase; - if (dmChassis.Chassis is DmMd128x128 || dmChassis.Chassis is DmMd64x64) { + //var rxKey = dmChassis.RxDictionary[ioSlot]; + //var rxDevice = DeviceManager.GetDeviceForKey(rxKey) as DmRmcControllerBase; + //var hdBaseTDevice = DeviceManager.GetDeviceForKey(rxKey) as DmHdBaseTControllerBase; + //if (hdBaseTDevice != null) { dmChassis.OutputEndpointOnlineFeedbacks[ioSlot].LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); - } - else if (rxDevice != null) { - rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); - } + //} + //else if (rxDevice != null) { + // rxDevice.IsOnline.LinkInputSig(trilist.BooleanInput[joinMap.OutputEndpointOnline + ioSlot]); + //} } // Feedback diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index c89f4948..65848f71 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -17,6 +17,8 @@ using PepperDash.Essentials.Fusion; using PepperDash.Essentials.Room.Config; using PepperDash.Essentials.Room.Cotija; +using Newtonsoft.Json; + namespace PepperDash.Essentials { public class ControlSystem : CrestronControlSystem @@ -359,21 +361,7 @@ namespace PepperDash.Essentials 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 DeviceManager.AddDevice(new PepperDash.Essentials.Core.Monitoring.SystemMonitorController("systemMonitor")); @@ -390,7 +378,26 @@ namespace PepperDash.Essentials if (devConf.Type.ToLower() != Global.ControlSystem.ControllerPrompt.ToLower()) Debug.Console(0, "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(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; } diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index d83c8e9a..991a3470 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -231,64 +231,25 @@ namespace PepperDash.Essentials void Initialize() { - if (DefaultAudioDevice is IBasicVolumeControls) - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - else if (DefaultAudioDevice is IHasVolumeDevice) - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - CurrentVolumeControls = DefaultVolumeControls; - - - var disp = DefaultDisplay as DisplayBase; - if (disp != null) + try { - // 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(); - } - }; - - 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."); - } + if (DefaultAudioDevice is IBasicVolumeControls) + DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; + else if (DefaultAudioDevice is IHasVolumeDevice) + DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; + CurrentVolumeControls = DefaultVolumeControls; - // Combines call feedback from both codecs if available - InCallFeedback = new BoolFeedback(() => + // Combines call feedback from both codecs if available + InCallFeedback = new BoolFeedback(() => { bool inAudioCall = false; bool inVideoCall = false; - if(AudioCodec != null) + if (AudioCodec != null) inAudioCall = AudioCodec.IsInCall; - if(VideoCodec != null) + if (VideoCodec != null) inVideoCall = VideoCodec.IsInCall; if (inAudioCall || inVideoCall) @@ -297,22 +258,71 @@ namespace PepperDash.Essentials 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) - AudioCodec.CallStatusChange += (o, a) => this.InCallFeedback.FireUpdate(); + disp.IsWarmingUpFeedback.OutputChange += (o, a) => + { + 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); - - SourceListKey = "default"; - EnablePowerOnToLastSource = true; + + // Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback + 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."); + + + 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) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs index a6a16e08..12edb104 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs @@ -33,9 +33,9 @@ namespace PepperDash.Essentials.Core { Audio = 1, Video = 2, - //AudioVideo = 4, - UsbOutput = 4, - UsbInput = 8 + AudioVideo = 4, + UsbOutput = 8, + UsbInput = 16 } public enum eRoutingPortConnectionType diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/SubpageReferenceList.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/SubpageReferenceList.cs index 2f8794f0..fe69e4ca 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/SubpageReferenceList.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/SmartObjects/SubpageReferencList/SubpageReferenceList.cs @@ -33,7 +33,7 @@ namespace PepperDash.Essentials.Core public ushort Count { get { return SetNumberOfItemsSig.UShortValue; } - set { SetNumberOfItemsSig.UShortValue = value; } + set { SetNumberOfItemsSig.UShortValue = value; } } public ushort MaxDefinedItems { get; private set; } @@ -100,8 +100,9 @@ namespace PepperDash.Essentials.Core // Empty the list Items.Clear(); // Clean up the SRL - Count = 0; - ScrollToItemSig.UShortValue = 1; + Count = 1; + + ScrollToItemSig.UShortValue = 1; } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs index d00ba884..7d57127a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmBladeChassisController.cs @@ -177,8 +177,10 @@ namespace PepperDash.Essentials.DM { }); OutputEndpointOnlineFeedbacks[tempX] = new BoolFeedback(() => { - CrestronConsole.PrintLine("GotHere 5"); - return Chassis.Outputs[tempX].EndpointOnlineFeedback; + //if (Chassis.Outputs[tempX].Endpoint != null) + // return Chassis.Outputs[tempX].Endpoint.IsOnline; + //else + return Chassis.Outputs[tempX].EndpointOnlineFeedback; }); } @@ -456,9 +458,8 @@ namespace PepperDash.Essentials.DM { } /// /// - void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) { - - //This should be a switch case JTA 2018-07-02 + void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) + { var output = args.Number; switch (args.EventId) { @@ -469,7 +470,10 @@ namespace PepperDash.Essentials.DM { break; } 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(); break; } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index c1bddd19..632e555a 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -767,8 +767,6 @@ namespace PepperDash.Essentials.DM /// void Chassis_DMOutputChange(Switch device, DMOutputEventArgs args) { - - //This should be a switch case JTA 2018-07-02 var output = args.Number; switch (args.EventId) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 3c6b7ea3..0c4ff887 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -116,15 +116,25 @@ namespace PepperDash.Essentials.DM public override bool CustomActivate() { - - // Set input and output names from config if (InputNames != null) + { 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) + { 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 Dmps.DMInputChange += new DMInputEventHandler(Dmps_DMInputChange); @@ -629,41 +639,41 @@ namespace PepperDash.Essentials.DM } 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 if ((sigType | eRoutingSignalType.Video) == eRoutingSignalType.Video) { //SystemControl.VideoEnter.BoolValue = true; - if (outCard != null && outCard.VideoOut != null) + if (outCard != null) outCard.VideoOut = inCard; } if ((sigType | eRoutingSignalType.Audio) == eRoutingSignalType.Audio) { - if (outCard != null && outCard.AudioOut != null) + if (outCard != null) outCard.AudioOut = inCard; } if ((sigType | eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) { - if (outCard != null && outCard.USBRoutedTo != null) + if (outCard != null) outCard.USBRoutedTo = inCard; } if ((sigType | eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) { - if (inCard != null && inCard.USBRoutedTo != null) + if (inCard != null) inCard.USBRoutedTo = outCard; } - } - else - { - Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector); - } + //} + //else + //{ + // Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector); + //} } else diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/MIcrophone/MicrophonePrivacyController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/MIcrophone/MicrophonePrivacyController.cs index 177fffd1..d8a7f543 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/MIcrophone/MicrophonePrivacyController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/MIcrophone/MicrophonePrivacyController.cs @@ -87,7 +87,11 @@ namespace PepperDash.Essentials.Devices.Common.Microphones else 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; @@ -97,8 +101,6 @@ namespace PepperDash.Essentials.Devices.Common.Microphones public void SetPrivacyDevice(IPrivacy privacyDevice) { PrivacyDevice = privacyDevice; - - PrivacyDevice.PrivacyModeIsOnFeedback.OutputChange += PrivacyModeIsOnFeedback_OutputChange; } void PrivacyModeIsOnFeedback_OutputChange(object sender, EventArgs e) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs index 5f468e4b..372aa232 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Occupancy/GlsOdtOccupancySensorController.cs @@ -30,6 +30,8 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy public GlsOdtOccupancySensorController(string key, string name, GlsOdtCCn sensor) : base(key, name, sensor) { + OccSensor = sensor; + AndWhenVacatedFeedback = new BoolFeedback(() => OccSensor.AndWhenVacatedFeedback.BoolValue); OrWhenVacatedFeedback = new BoolFeedback(() => OccSensor.OrWhenVacatedFeedback.BoolValue);