diff --git a/PepperDashEssentials/Factory/UiDeviceFactory.cs b/PepperDashEssentials/Factory/UiDeviceFactory.cs index e1b00caa..6176b6d1 100644 --- a/PepperDashEssentials/Factory/UiDeviceFactory.cs +++ b/PepperDashEssentials/Factory/UiDeviceFactory.cs @@ -38,7 +38,13 @@ namespace PepperDash.Essentials else if (typeName == "dmdge200c") dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem); - var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props); + if (dgeDevice == null) + { + Debug.Console(1, "Unable to create DGE device"); + return null; + } + + var dgeController = new DgeController(config.Key + "-comPorts", config.Name, dgeDevice, config, props); DeviceManager.AddDevice(dgeController); diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index e1bdb6cf..51d9c364 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -226,63 +226,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(); - } - }; + if (DefaultAudioDevice is IBasicVolumeControls) + DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; + else if (DefaultAudioDevice is IHasVolumeDevice) + DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; + CurrentVolumeControls = DefaultVolumeControls; - 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 - 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) @@ -291,22 +253,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/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 678355e3..11f720a3 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -30,12 +30,17 @@ namespace PepperDash.Essentials tsw.SigChange += Panel_SigChange; } - public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath) + public EssentialsTouchpanelController(string key, string name, Dge100 dge, string projectName, string sgdPath) : base(key, name) { - Panel = panel; - panel.LoadSmartObjects(sgdPath); - panel.SigChange += Panel_SigChange; + Panel = dge; + + if (!string.IsNullOrEmpty(sgdPath)) + dge.LoadSmartObjects(sgdPath); + else + Debug.Console(1, this, "No SGD file path defined"); + + dge.SigChange += Panel_SigChange; } /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs index a5b0b715..e238c40e 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Microphone Privacy/MicrophonePrivacyController.cs @@ -87,7 +87,11 @@ namespace PepperDash.Essentials.Core.Privacy 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.Core.Privacy 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 Core/PepperDashEssentialsBase/Routing/RoutingPort.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs index fe7a0015..12edb104 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Routing/RoutingPort.cs @@ -32,8 +32,8 @@ namespace PepperDash.Essentials.Core public enum eRoutingSignalType { Audio = 1, - Video = 2, - AudioVideo = 4, + Video = 2, + AudioVideo = 4, UsbOutput = 8, UsbInput = 16 } 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/DmChassisController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs index 632e555a..136f3c86 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmChassisController.cs @@ -747,13 +747,19 @@ namespace PepperDash.Essentials.DM case DMInputEventIds.UsbRoutedToEventId: { Debug.Console(2, this, "DM Input {0} UsbRoutedToEventId", args.Number); - UsbInputRoutedToFeebacks[args.Number].FireUpdate(); + if(UsbInputRoutedToFeebacks[args.Number] != null) + UsbInputRoutedToFeebacks[args.Number].FireUpdate(); + else + Debug.Console(1, this, "No index of {0} found in UsbInputRoutedToFeedbacks"); break; } case DMInputEventIds.HdcpCapabilityFeedbackEventId: { Debug.Console(2, this, "DM Input {0} HdcpCapabilityFeedbackEventId", args.Number); - InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate(); + if (InputCardHdcpCapabilityFeedbacks[args.Number] != null) + InputCardHdcpCapabilityFeedbacks[args.Number].FireUpdate(); + else + Debug.Console(1, this, "No index of {0} found in InputCardHdcpCapabilityFeedbacks"); break; } default: @@ -818,6 +824,10 @@ namespace PepperDash.Essentials.DM { AudioOutputFeedbacks[output].FireUpdate(); } + if (OutputAudioRouteNameFeedbacks.ContainsKey(output)) + { + OutputAudioRouteNameFeedbacks[output].FireUpdate(); + } break; } case DMOutputEventIds.OutputNameEventId: diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs index f8cf0938..0fc00323 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/DGEs/DgeController.cs @@ -28,6 +28,8 @@ namespace PepperDash.Essentials.DM.Endpoints.DGEs public DgeController(string key, string name, Dge100 device, DeviceConfig dc, CrestronTouchpanelPropertiesConfig props) :base(key, name, device) { + DigitalGraphicsEngine = device; + DeviceConfig = dc; PropertiesConfig = props; diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index 5fe89500..98d2e45a 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -297,6 +297,10 @@ namespace PepperDash.Essentials.Devices.Common else Debug.Console(0, "Attempt to register relay {0} on device with key '{1}' failed.", props.PortNumber, props.PortDeviceKey); } + else + { + return new GenericRelayDevice(key, relay); + } // Future: Check if portDevice is 3-series card or other non control system that supports versiports }