diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index e6c4f74a..31d897e2 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Linq; using Crestron.SimplSharp; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharpPro; @@ -12,10 +11,9 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Bridges; using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.Fusion; using PepperDash.Essentials.Core.Rooms.Config; using PepperDash.Essentials.DM; -using PepperDash.Essentials.Fusion; -using PepperDash.Essentials.Room.Config; //using PepperDash.Essentials.Room.MobileControl; using Newtonsoft.Json; @@ -440,68 +438,71 @@ namespace PepperDash.Essentials { if (ConfigReader.ConfigObject.Rooms == null) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: No Essentials Rooms found in current configuration."); + Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms"); return; } foreach (var roomConfig in ConfigReader.ConfigObject.Rooms) { var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase; - if (room == null) + if (room != null) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); - return; - } + var huddleRoom = room as EssentialsHuddleSpaceRoom; + if (huddleRoom != null) + { + DeviceManager.AddDevice(huddleRoom); - var huddleRoom = room as EssentialsHuddleSpaceRoom; - var vtcRoom = room as EssentialsHuddleVtc1Room; + Debug.Console(0, Debug.ErrorLogLevel.Notice, + "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion"); + DeviceManager.AddDevice( + new EssentialsHuddleSpaceFusionSystemControllerBase(huddleRoom, 0xf1)); - if (huddleRoom != null) - { - DeviceManager.AddDevice(huddleRoom); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); - // Mobile Control bridge - //var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom); - //AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present - //DeviceManager.AddDevice(bridge); - CreateMobileControlBridge(room); + CreateMobileControlBridge(huddleRoom); + continue; } - else if (room is EssentialsHuddleVtc1Room) - { - DeviceManager.AddDevice(room); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); - // Mobile Control bridge - var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(huddleRoom); - AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present - DeviceManager.AddDevice(bridge); + var ddRoom = room as EssentialsDualDisplayRoom; + //checking for dual display room first, as it inherits from EssentialsHuddleVtc1Room + if (ddRoom != null) + { + DeviceManager.AddDevice(ddRoom); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, + "Room is EssentialsDualDisplayRoom, attempting to add to DeviceManager with Fusion"); + DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController(ddRoom, 0xf1)); Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); - // Mobile Control bridge - //var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room); - //AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present - //DeviceManager.AddDevice(bridge); - CreateMobileControlBridge(room); + CreateMobileControlBridge(ddRoom); + continue; } - else + + var vtc1Room = room as EssentialsHuddleVtc1Room; + if (vtc1Room != null) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion"); - DeviceManager.AddDevice(room); + DeviceManager.AddDevice(vtc1Room); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, + "Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion"); + DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController(vtc1Room, 0xf1)); + + Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); + + CreateMobileControlBridge(vtc1Room); + continue; } - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge..."); - // Mobile Control bridge - var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(room); - AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present - DeviceManager.AddDevice(bridge); - continue; - } + Debug.Console(0, Debug.ErrorLogLevel.Notice, + "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion"); + DeviceManager.AddDevice(room); - Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion"); - DeviceManager.AddDevice(room); + } + else + Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", + roomConfig.Key); } Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded."); diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index fb03e9d0..146198e7 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -11,6 +11,7 @@ using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.PageManagers; +using PepperDashEssentials.UIDrivers.EssentialsDualDisplay; namespace PepperDash.Essentials { @@ -178,7 +179,7 @@ namespace PepperDash.Essentials } } - void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) + void Panel_SigChange(object currentDevice, SigEventArgs args) { if (Debug.Level == 2) Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); @@ -271,6 +272,56 @@ namespace PepperDash.Essentials tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); } + else if (room is EssentialsDualDisplayRoom) + { + Debug.Console(0, panelController, "Adding Dual Display VTC AV driver"); + + // Header Driver + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + var avDriver = new EssentialsDualDisplayPanelAvFunctionsDriver(mainDriver, props); + + var codecDriver = new UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, + (room as EssentialsDualDisplayRoom).VideoCodec, mainDriver.HeaderDriver); + avDriver.SetVideoCodecDriver(codecDriver); + avDriver.DefaultRoomKey = props.DefaultRoomKey; + mainDriver.AvDriver = avDriver; + avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; + + // Environment Driver + if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) + { + Debug.Console(0, panelController, "Adding environment driver"); + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); + } + + mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (!(panelController.Panel is TswFt5ButtonSystem)) + { + return; + } + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if (mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } else if (room is EssentialsHuddleVtc1Room) { Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); diff --git a/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs index 0369ef2a..50d7c5e2 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs @@ -12,7 +12,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay { private EssentialsDualDisplayRoom _currentRoom; - private BoolInputSig _routeToggleVisibility; + private readonly BoolInputSig _routeToggleVisibility; private readonly BoolFeedback _sharingMode; diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs index 818c1e17..01e34e87 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Config/BasicConfig.cs @@ -46,14 +46,14 @@ namespace PepperDash.Essentials.Core.Config public Dictionary GetDestinationListForKey(string key) { - if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key)) + if (string.IsNullOrEmpty(key) || !DestinationLists.ContainsKey(key)) return null; return DestinationLists[key]; } /// - /// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, retunes null + /// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, returns null /// /// Key of desired device /// diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsRoomConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsRoomConfig.cs index 97c93033..7a9eab29 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsRoomConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsRoomConfig.cs @@ -18,8 +18,7 @@ namespace PepperDash.Essentials.Core.Rooms.Config { var typeName = roomConfig.Type.ToLower(); - EssentialsRoomBase rm; - if (typeName == "huddle") + if (typeName == "huddle") { var huddle = new EssentialsHuddleSpaceRoom(roomConfig); @@ -27,22 +26,22 @@ namespace PepperDash.Essentials.Core.Rooms.Config } if (typeName == "huddlevtc1") { - rm = new EssentialsHuddleVtc1Room(roomConfig); - + EssentialsRoomBase rm = new EssentialsHuddleVtc1Room(roomConfig); + return rm; } if (typeName == "ddvc01Bridge") { return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing. } + if (typeName != "dualdisplay") { return null; } - //rm = new EssentialsDualDisplayRoom(); - - return null; + var dualDisplay = new EssentialsDualDisplayRoom(roomConfig); + return dualDisplay; } ///