diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/IVolumeAndAudioInterfaces.cs b/Essentials Core/PepperDashEssentialsBase/Devices/IVolumeAndAudioInterfaces.cs index c2b3ded9..f215d527 100644 --- a/Essentials Core/PepperDashEssentialsBase/Devices/IVolumeAndAudioInterfaces.cs +++ b/Essentials Core/PepperDashEssentialsBase/Devices/IVolumeAndAudioInterfaces.cs @@ -28,6 +28,15 @@ namespace PepperDash.Essentials.Core BoolFeedback MuteFeedback { get; } } + /// + /// A class that implements this contains a reference to a current IBasicVolumeControls device. + /// The class may have multiple IBasicVolumeControls. + /// + public interface IHasCurrentVolumeControls + { + IBasicVolumeControls CurrentVolumeControls { get; } + } + /// /// diff --git a/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs b/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs index c5596dc2..8d9c5e7f 100644 --- a/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs +++ b/Essentials Core/PepperDashEssentialsBase/Shades/ShadeController.cs @@ -8,16 +8,51 @@ using PepperDash.Core; namespace PepperDash.Essentials.Core.Shades { + /// + /// Class that contains the shades to be controlled in a room + /// public class ShadeController : Device, IShades { + ShadeControllerConfigProperties Config; + public List Shades { get; private set; } - public ShadeController(string key, string name) + public ShadeController(string key, string name, ShadeControllerConfigProperties config) : base(key, name) { + Config = config; + Shades = new List(); } + public override bool CustomActivate() + { + foreach (var shadeConfig in Config.Shades) + { + var shade = DeviceManager.GetDeviceForKey(shadeConfig.Key) as ShadeBase; + + if (shade != null) + { + AddShade(shade); + } + } + return base.CustomActivate(); + } + + void AddShade(ShadeBase shade) + { + Shades.Add(shade); + } } + public class ShadeControllerConfigProperties + { + public List Shades { get; set; } + + + public class ShadeConfig + { + public string Key { get; set; } + } + } } \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs b/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs index 0731dd12..70687b0c 100644 --- a/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs +++ b/Essentials Devices Common/Essentials Devices Common/Environment/Crestron Lighting/Din8sw8.cs @@ -22,16 +22,30 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting /// /// Collection of generic switched outputs /// - public Dictionary SwitchedOutputs; + public Dictionary SwitchedOutputs { get; private set; } - public Din8sw8Controller(string key, string cresnetId) + public Din8sw8Controller(string key, uint cresnetId) : base(key) { SwitchedOutputs = new Dictionary(); + SwitchModule = new Din8Sw8(cresnetId, Global.ControlSystem); + + if (SwitchModule.Register() != eDeviceRegistrationUnRegistrationResponse.Success) + { + Debug.Console(2, this, "Error registering Din8sw8. Reason: {0}", SwitchModule.RegistrationFailureReason); + } + PopulateDictionary(); } + public override bool CustomActivate() + { + + + return base.CustomActivate(); + } + /// /// Populates the generic collection with the loads from the Crestron collection /// @@ -70,4 +84,5 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting SwitchedOutput.FullOff(); } } + } \ No newline at end of file diff --git a/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs b/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs index a98732a7..42ca8b42 100644 --- a/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs +++ b/Essentials Devices Common/Essentials Devices Common/Environment/Somfy/RelayControlledShade.cs @@ -16,21 +16,32 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy /// public class RelayControlledShade : ShadeBase { + RelayControlledShadeConfigProperties Config; + ISwitchedOutput OpenRelay; ISwitchedOutput StopRelay; ISwitchedOutput CloseRelay; int RelayPulseTime; - public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties props) + public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties config) : base(key, name) { - RelayPulseTime = props.RelayPulseTime; - //Create ISwitchedOutput objects based on props + Config = config; - OpenRelay = GetSwitchedOutputFromDevice(props.Relays.Open); - StopRelay = GetSwitchedOutputFromDevice(props.Relays.Stop); - CloseRelay = GetSwitchedOutputFromDevice(props.Relays.Close); + RelayPulseTime = Config.RelayPulseTime; + + } + + public override bool CustomActivate() + { + //Create ISwitchedOutput objects based on props + OpenRelay = GetSwitchedOutputFromDevice(Config.Relays.Open); + StopRelay = GetSwitchedOutputFromDevice(Config.Relays.Stop); + CloseRelay = GetSwitchedOutputFromDevice(Config.Relays.Close); + + + return base.CustomActivate(); } public override void Open() diff --git a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs index f9c36b6f..2ae265cc 100644 --- a/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs +++ b/Essentials Devices Common/Essentials Devices Common/Factory/DeviceFactory.cs @@ -299,9 +299,31 @@ namespace PepperDash.Essentials.Devices.Common return new Environment.Lutron.LutronQuantumArea(key, name, comm, props); } + else if (typeName == "din8sw8") + { + var comm = CommFactory.GetControlPropertiesConfig(dc); + + return new Environment.Lighting.Din8sw8Controller(key, comm.CresnetIdInt); + } } + else if (groupName == "environment") + { + if (typeName == "shadecontroller") + { + var props = JsonConvert.DeserializeObject(properties.ToString()); + + return new Core.Shades.ShadeController(key, name, props); + } + else if (typeName == "relaycontrolledshade") + { + var props = JsonConvert.DeserializeObject(properties.ToString()); + + return new Environment.Somfy.RelayControlledShade(key, name, props); + } + + } return null; diff --git a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs index 00b46b9e..7d785b80 100644 --- a/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs +++ b/Essentials Devices Common/Essentials Devices Common/Occupancy/EssentialsGlsOccupancySensorBaseController.cs @@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy : base(key, name, sensor) { OccSensor = sensor; + RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(sensor_GlsOccupancySensorChange); diff --git a/Essentials/PepperDashEssentials/Config/DeviceFactory.cs b/Essentials/PepperDashEssentials/Factory/DeviceFactory.cs similarity index 86% rename from Essentials/PepperDashEssentials/Config/DeviceFactory.cs rename to Essentials/PepperDashEssentials/Factory/DeviceFactory.cs index 973866af..a97c3fcd 100644 --- a/Essentials/PepperDashEssentials/Config/DeviceFactory.cs +++ b/Essentials/PepperDashEssentials/Factory/DeviceFactory.cs @@ -30,11 +30,7 @@ namespace PepperDash.Essentials } else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw")) { - var comm = CommFactory.GetControlPropertiesConfig(dc); - - var props = JsonConvert.DeserializeObject( - properties.ToString()); - return new EssentialsTouchpanelController(key, name, typeName, props, comm.IpIdInt); + return UiDeviceFactory.GetUiDevice(dc); } else if (typeName == "mockdisplay") @@ -92,4 +88,5 @@ namespace PepperDash.Essentials return null; } } + } diff --git a/Essentials/PepperDashEssentials/Factory/UiDeviceFactory.cs b/Essentials/PepperDashEssentials/Factory/UiDeviceFactory.cs new file mode 100644 index 00000000..7dbd9a4e --- /dev/null +++ b/Essentials/PepperDashEssentials/Factory/UiDeviceFactory.cs @@ -0,0 +1,129 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DeviceSupport; +using Crestron.SimplSharpPro.UI; + +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.Config; +using PepperDash.Essentials.Core.PageManagers; + + +namespace PepperDash.Essentials +{ + public class UiDeviceFactory + { + public static IKeyed GetUiDevice(DeviceConfig config) + { + var comm = CommFactory.GetControlPropertiesConfig(config); + + var props = JsonConvert.DeserializeObject(config.Properties.ToString()); + + EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt); + + panelController.AddPostActivationAction(() => + { + var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props); + // Then the sub drivers + + // spin up different room drivers depending on room type + var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); + if (room is EssentialsHuddleSpaceRoom) + { + Debug.Console(0, panelController, "Adding huddle space driver"); + + // Header Driver + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); + avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; + avDriver.DefaultRoomKey = props.DefaultRoomKey; + mainDriver.AvDriver = avDriver; + + // Environment Driver + if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0) + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (panelController.Panel is TswFt5ButtonSystem) + { + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } + } + //else if (room is EssentialsPresentationRoom) + //{ + // Debug.Console(0, panelController, "Adding presentation room driver"); + // var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); + // avDriver.CurrentRoom = room as EssentialsPresentationRoom; + // avDriver.DefaultRoomKey = props.DefaultRoomKey; + // mainDriver.AvDriver = avDriver ; + // mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + // panelController.LoadAndShowDriver(mainDriver); + + // if (panelController.Panel is TswFt5ButtonSystem) + // { + // var tsw = panelController.Panel as TswFt5ButtonSystem; + // // Wire up hard keys + // tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); + // //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + // 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 driver"); + + // Header Driver + mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); + + // AV Driver + var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); + + var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, + (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); + avDriver.SetVideoCodecDriver(codecDriver); + avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; + avDriver.DefaultRoomKey = props.DefaultRoomKey; + mainDriver.AvDriver = avDriver; + + // Environment Driver + if (avDriver.CurrentRoom.Config.Environment != null && avDriver.CurrentRoom.Config.Environment.DeviceKeys.Count > 0) + mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); + + panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. + + if (panelController.Panel is TswFt5ButtonSystem) + { + 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(); }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + } + } + else + { + Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); + } + }); + + return panelController; + } + + } +} \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj index 21bff4a7..de8e6b15 100644 --- a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj +++ b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj @@ -125,11 +125,12 @@ - + + @@ -168,6 +169,8 @@ + + diff --git a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs index b8327f77..4fa1aa8d 100644 --- a/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs +++ b/Essentials/PepperDashEssentials/Properties/AssemblyInfo.cs @@ -4,5 +4,5 @@ [assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] -[assembly: AssemblyVersion("1.0.48.*")] +[assembly: AssemblyVersion("1.1.0.*")] diff --git a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs index af2084b8..47647e68 100644 --- a/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs +++ b/Essentials/PepperDashEssentials/Room/Config/EssentialsRoomConfig.cs @@ -194,8 +194,8 @@ namespace PepperDash.Essentials.Room.Config [JsonProperty("helpMessage")] public string HelpMessage { get; set; } - [JsonProperty("lighting")] - public EssentialsLightingPropertiesConfig Lighting { get; set; } + [JsonProperty("environment")] + public EssentialsEnvironmentPropertiesConfig Environment { get; set; } [JsonProperty("logo")] public EssentialsLogoPropertiesConfig Logo { get; set; } @@ -225,9 +225,18 @@ namespace PepperDash.Essentials.Room.Config public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } } - public class EssentialsLightingPropertiesConfig + public class EssentialsEnvironmentPropertiesConfig { public bool Enabled { get; set; } + + [JsonProperty("deviceKeys")] + public List DeviceKeys { get; set; } + + public EssentialsEnvironmentPropertiesConfig() + { + DeviceKeys = new List(); + } + } public class EssentialsRoomMicrophonePrivacyConfig diff --git a/Essentials/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs b/Essentials/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs index 88720f3e..0555fe76 100644 --- a/Essentials/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs +++ b/Essentials/PepperDashEssentials/Room/Cotija/RoomBridges/CotijaDdvc01RoomBridge.cs @@ -339,7 +339,7 @@ namespace PepperDash.Essentials.Room.Cotija rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue; rmProps.Help.Message = EISC.StringOutput[502].StringValue; - rmProps.Lighting = new EssentialsLightingPropertiesConfig(); // enabled defaults to false + rmProps.Environment = new EssentialsEnvironmentPropertiesConfig(); // enabled defaults to false rmProps.RoomPhoneNumber = EISC.StringOutput[504].StringValue; rmProps.RoomURI = EISC.StringOutput[505].StringValue; diff --git a/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 932b1e34..bce664c3 100644 --- a/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/Essentials/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -12,7 +12,7 @@ using PepperDash.Essentials.Devices.Common.VideoCodec; namespace PepperDash.Essentials { - public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, IPrivacy + public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, IPrivacy, IHasCurrentVolumeControls { public event EventHandler CurrentVolumeDeviceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange; diff --git a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index 826e12f4..e9cdd21c 100644 --- a/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/Essentials/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -36,153 +36,74 @@ namespace PepperDash.Essentials public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id) : base(key, name) { - AddPostActivationAction(() => - { -#warning Temporary Error logging for XiO Edge Debugging - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating touchpanel hardware..."); - type = type.ToLower(); - try - { - if (type == "crestronapp") - { - var app = new CrestronApp(id, Global.ControlSystem); - app.ParameterProjectName.Value = props.ProjectName; - Panel = app; - } - else if (type == "tsw550") - Panel = new Tsw550(id, Global.ControlSystem); - else if (type == "tsw552") - Panel = new Tsw552(id, Global.ControlSystem); - else if (type == "tsw560") - Panel = new Tsw560(id, Global.ControlSystem); - else if (type == "tsw750") - Panel = new Tsw750(id, Global.ControlSystem); - else if (type == "tsw752") - Panel = new Tsw752(id, Global.ControlSystem); - else if (type == "tsw760") - Panel = new Tsw760(id, Global.ControlSystem); - else if (type == "tsw1050") - Panel = new Tsw1050(id, Global.ControlSystem); - else if (type == "tsw1052") - Panel = new Tsw1052(id, Global.ControlSystem); - else if (type == "tsw1060") - Panel = new Tsw1060(id, Global.ControlSystem); - else - { -#warning Temporary Error logging for XiO Edge Debugging - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); - return; - } - } - catch (Exception e) - { -#warning Temporary Error logging for XiO Edge Debugging - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message); - return; - } - // Reserved sigs - if (Panel is TswFt5ButtonSystem) - { - var tsw = Panel as TswFt5ButtonSystem; - tsw.ExtenderSystemReservedSigs.Use(); - tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange - += ExtenderSystemReservedSigs_DeviceExtenderSigChange; - } + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating touchpanel hardware..."); + type = type.ToLower(); + try + { + if (type == "crestronapp") + { + var app = new CrestronApp(id, Global.ControlSystem); + app.ParameterProjectName.Value = props.ProjectName; + Panel = app; + } + else if (type == "tsw550") + Panel = new Tsw550(id, Global.ControlSystem); + else if (type == "tsw552") + Panel = new Tsw552(id, Global.ControlSystem); + else if (type == "tsw560") + Panel = new Tsw560(id, Global.ControlSystem); + else if (type == "tsw750") + Panel = new Tsw750(id, Global.ControlSystem); + else if (type == "tsw752") + Panel = new Tsw752(id, Global.ControlSystem); + else if (type == "tsw760") + Panel = new Tsw760(id, Global.ControlSystem); + else if (type == "tsw1050") + Panel = new Tsw1050(id, Global.ControlSystem); + else if (type == "tsw1052") + Panel = new Tsw1052(id, Global.ControlSystem); + else if (type == "tsw1060") + Panel = new Tsw1060(id, Global.ControlSystem); + else + { + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); + return; + } + } + catch (Exception e) + { + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message); + return; + } - //CrestronInvoke.BeginInvoke(o => - // { - var regSuccess = Panel.Register(); -#warning Temporary Error logging for XiO Edge Debugging - if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success) - Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess); + // Reserved sigs + if (Panel is TswFt5ButtonSystem) + { + var tsw = Panel as TswFt5ButtonSystem; + tsw.ExtenderSystemReservedSigs.Use(); + tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange + += ExtenderSystemReservedSigs_DeviceExtenderSigChange; - // Give up cleanly if SGD is not present. - var sgdName = Global.FilePathPrefix - + Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile; - if (!File.Exists(sgdName)) - { - Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName); - return; - } + tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange); - Panel.LoadSmartObjects(sgdName); - Panel.SigChange += Tsw_SigChange; + } - var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, props); - // Then the AV driver + if (Panel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) + Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason); - // spin up different room drivers depending on room type - var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); - if (room is EssentialsHuddleSpaceRoom) - { - Debug.Console(0, this, "Adding huddle space driver"); - var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); - avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; - avDriver.DefaultRoomKey = props.DefaultRoomKey; - mainDriver.AvDriver = avDriver; - LoadAndShowDriver(mainDriver); // This is a little convoluted. + // Give up cleanly if SGD is not present. + var sgdName = Global.FilePathPrefix + + Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile; + if (!File.Exists(sgdName)) + { + Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName); + return; + } - if (Panel is TswFt5ButtonSystem) - { - var tsw = Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange); - } - } - else if (room is EssentialsPresentationRoom) - { - Debug.Console(0, this, "Adding presentation room driver"); - var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); - avDriver.CurrentRoom = room as EssentialsPresentationRoom; - avDriver.DefaultRoomKey = props.DefaultRoomKey; - mainDriver.AvDriver = avDriver; - LoadAndShowDriver(mainDriver); - - if (Panel is TswFt5ButtonSystem) - { - var tsw = Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange); - } - } - else if (room is EssentialsHuddleVtc1Room) - { - Debug.Console(0, this, "Adding huddle space driver"); - var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); - var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(Panel, avDriver, - (room as EssentialsHuddleVtc1Room).VideoCodec); - avDriver.SetVideoCodecDriver(codecDriver); - avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; - avDriver.DefaultRoomKey = props.DefaultRoomKey; - mainDriver.AvDriver = avDriver; - LoadAndShowDriver(mainDriver); // This is a little convoluted. + Panel.LoadSmartObjects(sgdName); + Panel.SigChange += Tsw_SigChange; - if (Panel is TswFt5ButtonSystem) - { - var tsw = 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(); }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); - tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange); - } - } - else - { - Debug.Console(0, this, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); - } - //}, 0); - }); } public void LoadAndShowDriver(PanelDriverBase driver) diff --git a/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsEnvironmentDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsEnvironmentDriver.cs new file mode 100644 index 00000000..4c9026ea --- /dev/null +++ b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsEnvironmentDriver.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; + +namespace PepperDash.Essentials +{ + public class EssentialsEnvironmentDriver : PanelDriverBase + { + CrestronTouchpanelPropertiesConfig Config; + + /// + /// The parent driver for this + /// + EssentialsPanelMainInterfaceDriver Parent; + + public EssentialsEnvironmentDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config) + : base(parent.TriList) + { + Config = config; + Parent = parent; + } + + } +} \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs new file mode 100644 index 00000000..6764657a --- /dev/null +++ b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs @@ -0,0 +1,260 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Crestron.SimplSharp; +using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.UI; +using Crestron.SimplSharpPro.DeviceSupport; + + +using PepperDash.Core; +using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.SmartObjects; +using PepperDash.Essentials.Core.PageManagers; +using PepperDash.Essentials.Room.Config; +using PepperDash.Essentials.Devices.Common.Codec; +using PepperDash.Essentials.Devices.Common.VideoCodec; + + +namespace PepperDash.Essentials +{ + /// + /// + /// + public class EssentialsHeaderDriver : PanelDriverBase + { + CrestronTouchpanelPropertiesConfig Config; + + /// + /// The parent driver for this + /// + EssentialsPanelMainInterfaceDriver Parent; + + /// + /// Indicates that the SetHeaderButtons method has completed successfully + /// + public bool HeaderButtonsAreSetUp { get; private set; } + + StringInputSig HeaderCallButtonIconSig; + + public EssentialsHeaderDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config) + : base(parent.TriList) + { + Config = config; + Parent = parent; + } + + void SetUpGear(IAVDriver avDriver, EssentialsRoomBase currentRoom) + { + // Gear + TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); + TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, + Parent.AvDriver.ShowTech, + null, + () => + { + if (currentRoom.OnFeedback.BoolValue) + avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); + else + avDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); + }); + TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => + avDriver.PopupInterlock.HideAndClear()); + } + + void SetUpHelpButton(EssentialsRoomPropertiesConfig roomConf) + { + // Help roomConf and popup + if (roomConf.Help != null) + { + TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); + TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); + TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); + if (roomConf.Help.ShowCallButton) + TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN + else + TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); + } + else // older config + { + TriList.SetString(UIStringJoin.HelpMessage, roomConf.HelpMessage); + TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); + TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); + TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); + } + TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); + TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => + { + string message = null; + var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) + as EssentialsHuddleSpaceRoom; + if (room != null) + message = room.Config.HelpMessage; + else + message = "Sorry, no help message available. No room connected."; + //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; + Parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); + }); + } + + uint SetUpCalendarButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) + { + // Calendar button + if (avDriver.CurrentRoom.ScheduleSource != null) + { + TriList.SetString(nextJoin, "Calendar"); + TriList.SetSigFalseAction(nextJoin, avDriver.CalendarPress); + + return nextJoin--; + } + else + return nextJoin; + } + + uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) + { + // Call button + TriList.SetString(nextJoin, "DND"); + TriList.SetSigFalseAction(nextJoin, avDriver.ShowActiveCallsList); + HeaderCallButtonIconSig = TriList.StringInput[nextJoin]; + + return nextJoin--; + } + + /// + /// Evaluates the call status and sets the icon mode and text label + /// + public void ComputeHeaderCallStatus(VideoCodecBase codec) + { + if (codec == null) + { + Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null"); + return; + } + + if (HeaderCallButtonIconSig == null) + { + Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null"); + return; + } + + // Set mode of header button + if (!codec.IsInCall) + { + HeaderCallButtonIconSig.StringValue = "DND"; + //HeaderCallButton.SetIcon(HeaderListButton.OnHook); + } + else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video)) + HeaderCallButtonIconSig.StringValue = "Misc-06_Dark"; + //HeaderCallButton.SetIcon(HeaderListButton.Camera); + //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2); + else + HeaderCallButtonIconSig.StringValue = "Misc-09_Dark"; + //HeaderCallButton.SetIcon(HeaderListButton.Phone); + //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1); + + // Set the call status text + if (codec.ActiveCalls.Count > 0) + { + if (codec.ActiveCalls.Count == 1) + TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call"); + else if (codec.ActiveCalls.Count > 1) + TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count)); + } + else + TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls"); + } + + /// + /// Sets up Header Buttons for the EssentialsHuddleVtc1Room type + /// + public void SetupHeaderButtons(EssentialsHuddleVtc1Room currentRoom) + { + var avDriver = Parent.AvDriver as EssentialsHuddleVtc1PanelAvFunctionsDriver; + + HeaderButtonsAreSetUp = false; + + TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); + + var roomConf = currentRoom.Config; + + SetUpGear(avDriver, currentRoom); + + SetUpHelpButton(roomConf); + + uint nextJoin = 3953; + + nextJoin = SetUpCalendarButton(avDriver, nextJoin); + + nextJoin = SetUpCallButton(avDriver, nextJoin); + + // blank any that remain + for (var i = nextJoin; i > 3950; i--) + { + TriList.SetString(i, "Blank"); + TriList.SetSigFalseAction(i, () => { }); + } + + TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, avDriver.ShowActiveCallsList); + + // Set Call Status Subpage Position + + if (nextJoin == 3951) + { + // Set to right position + TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false); + TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true); + } + else if (nextJoin == 3950) + { + // Set to left position + TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true); + TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false); + } + + HeaderButtonsAreSetUp = true; + + ComputeHeaderCallStatus(currentRoom.VideoCodec); + } + + public void SetupHeaderButtons(EssentialsHuddleSpaceRoom currentRoom) + { + var avDriver = Parent.AvDriver as EssentialsHuddlePanelAvFunctionsDriver; + + HeaderButtonsAreSetUp = false; + + TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); + + var roomConf = currentRoom.Config; + + + //SetUpGear(avDriver, currentRoom); + + SetUpHelpButton(roomConf); + + uint nextJoin = 3953; + + //// Calendar button + //if (_CurrentRoom.ScheduleSource != null) + //{ + // TriList.SetString(nextJoin, "Calendar"); + // TriList.SetSigFalseAction(nextJoin, CalendarPress); + + // nextJoin--; + //} + + //nextJoin--; + + // blank any that remain + for (var i = nextJoin; i > 3950; i--) + { + TriList.SetString(i, "Blank"); + TriList.SetSigFalseAction(i, () => { }); + } + + HeaderButtonsAreSetUp = true; + } + + } +} \ No newline at end of file diff --git a/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs index 4eaaf6e9..a985913c 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/Essentials/EssentialsPanelMainInterfaceDriver.cs @@ -15,11 +15,20 @@ namespace PepperDash.Essentials /// Assign the appropriate A/V driver. /// Want to keep the AvDriver alive, because it may hold states /// - public PanelDriverBase AvDriver { get; set; } + public IAVDriver AvDriver { get; set; } + + public EssentialsHeaderDriver HeaderDriver { get; set; } + + public EssentialsEnvironmentDriver EnvironmentDriver { get; set; } public PanelDriverBase CurrentChildDriver { get; private set; } - CrestronTouchpanelPropertiesConfig Config; + CrestronTouchpanelPropertiesConfig Config; + + /// + /// The main interlock for popups + /// + public JoinedSigInterlock PopupInterlock { get; private set; } public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist, CrestronTouchpanelPropertiesConfig config) @@ -31,7 +40,7 @@ namespace PepperDash.Essentials public override void Show() { CurrentChildDriver = null; - ShowSubDriver(AvDriver); + ShowSubDriver(AvDriver as PanelDriverBase); base.Show(); } diff --git a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs index 6a70271f..b7e1c203 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -14,7 +14,7 @@ namespace PepperDash.Essentials /// /// /// - public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase + public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver { CrestronTouchpanelPropertiesConfig Config; @@ -110,7 +110,7 @@ namespace PepperDash.Essentials /// /// The parent driver for this /// - PanelDriverBase Parent; + PanelDriverBase Parent; /// /// All children attached to this driver. For hiding and showing as a group. @@ -153,7 +153,7 @@ namespace PepperDash.Essentials ModalDialog PowerDownModal; - JoinedSigInterlock PopupInterlock; + public JoinedSigInterlock PopupInterlock { get; private set; } /// /// The driver for the tech page. Lazy getter for memory usage @@ -311,7 +311,7 @@ namespace PepperDash.Essentials /// /// Reveals the tech page and puts away anything that's in the way. /// - void ShowTech() + public void ShowTech() { PopupInterlock.HideAndClear(); TechDriver.Show(); @@ -808,7 +808,7 @@ namespace PepperDash.Essentials _CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange; RefreshSourceInfo(); - SetupHeaderButtons(); + (Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(CurrentRoom); } else { @@ -817,82 +817,82 @@ namespace PepperDash.Essentials } } - void SetupHeaderButtons() - { - HeaderButtonsAreSetUp = false; + //void SetupHeaderButtons() + //{ + // HeaderButtonsAreSetUp = false; - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); + // TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - var roomConf = CurrentRoom.Config; + // var roomConf = CurrentRoom.Config; - // Gear - TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); - TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, - ShowTech, - null, - () => - { - if (CurrentRoom.OnFeedback.BoolValue) - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); - else - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); - }); - TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => - PopupInterlock.HideAndClear()); + // // Gear + // TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); + // TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, + // ShowTech, + // null, + // () => + // { + // if (CurrentRoom.OnFeedback.BoolValue) + // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); + // else + // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); + // }); + // TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => + // PopupInterlock.HideAndClear()); - // Help button and popup - if (CurrentRoom.Config.Help != null) - { - TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); - TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); - TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); - if (roomConf.Help.ShowCallButton) - TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN - else - TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - } - else // older config - { - TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); - TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); - TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); - TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - } - TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); - TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => - { - string message = null; - var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) - as EssentialsHuddleSpaceRoom; - if (room != null) - message = room.Config.HelpMessage; - else - message = "Sorry, no help message available. No room connected."; - //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); - }); - uint nextJoin = 3953; + // // Help button and popup + // if (CurrentRoom.Config.Help != null) + // { + // TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); + // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); + // TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); + // if (roomConf.Help.ShowCallButton) + // TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN + // else + // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); + // } + // else // older config + // { + // TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); + // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); + // TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); + // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); + // } + // TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); + // TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => + // { + // string message = null; + // var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) + // as EssentialsHuddleSpaceRoom; + // if (room != null) + // message = room.Config.HelpMessage; + // else + // message = "Sorry, no help message available. No room connected."; + // //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; + // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); + // }); + // uint nextJoin = 3953; - //// Calendar button - //if (_CurrentRoom.ScheduleSource != null) - //{ - // TriList.SetString(nextJoin, "Calendar"); - // TriList.SetSigFalseAction(nextJoin, CalendarPress); + // //// Calendar button + // //if (_CurrentRoom.ScheduleSource != null) + // //{ + // // TriList.SetString(nextJoin, "Calendar"); + // // TriList.SetSigFalseAction(nextJoin, CalendarPress); - // nextJoin--; - //} + // // nextJoin--; + // //} - //nextJoin--; + // //nextJoin--; - // blank any that remain - for (var i = nextJoin; i > 3950; i--) - { - TriList.SetString(i, "Blank"); - TriList.SetSigFalseAction(i, () => { }); - } + // // blank any that remain + // for (var i = nextJoin; i > 3950; i--) + // { + // TriList.SetString(i, "Blank"); + // TriList.SetSigFalseAction(i, () => { }); + // } - HeaderButtonsAreSetUp = true; - } + // HeaderButtonsAreSetUp = true; + //} /// diff --git a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index 1accd526..06845ede 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials /// /// /// - public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVDriver + public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver { CrestronTouchpanelPropertiesConfig Config; @@ -43,10 +43,6 @@ namespace PepperDash.Essentials /// public string DefaultRoomKey { get; set; } - /// - /// Indicates that the SetHeaderButtons method has completed successfully - /// - public bool HeaderButtonsAreSetUp { get; private set; } /// /// @@ -68,14 +64,8 @@ namespace PepperDash.Essentials BoolInputSig ShareButtonSig; BoolInputSig EndMeetingButtonSig; - //HeaderListButton HeaderCallButton; - //HeaderListButton HeaderGearButton; - - StringInputSig HeaderCallButtonIconSig; - BoolFeedback CallSharingInfoVisibleFeedback; - /// /// The parent driver for this /// @@ -326,7 +316,7 @@ namespace PepperDash.Essentials /// /// Allows PopupInterlock to be toggled if the calls list is already visible, or if the codec is in a call /// - void ShowActiveCallsList() + public void ShowActiveCallsList() { TriList.SetBool(UIBoolJoin.CallEndAllConfirmVisible, true); if(PopupInterlock.CurrentJoin == UIBoolJoin.HeaderActiveCallsListVisible) @@ -516,7 +506,7 @@ namespace PepperDash.Essentials /// /// Calendar should only be visible when it's supposed to /// - void CalendarPress() + public void CalendarPress() { //RefreshMeetingsList(); // List should be up-to-date PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible); @@ -558,7 +548,7 @@ namespace PepperDash.Essentials /// /// Reveals the tech page and puts away anything that's in the way. /// - void ShowTech() + public void ShowTech() { PopupInterlock.HideAndClear(); TechDriver.Show(); @@ -952,7 +942,7 @@ namespace PepperDash.Essentials TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, () => _CurrentRoom.RunRouteAction("codecOsd")); - SetupHeaderButtons(); + (Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(CurrentRoom); } else { @@ -1075,153 +1065,153 @@ namespace PepperDash.Essentials } - /// - /// - /// - void SetupHeaderButtons() - { - HeaderButtonsAreSetUp = false; + ///// + ///// + ///// + //void SetupHeaderButtons() + //{ + // HeaderButtonsAreSetUp = false; - TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); + // TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); - var roomConf = CurrentRoom.Config; + // var roomConf = CurrentRoom.Config; - // Gear - TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); - TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, - ShowTech, - null, - () => - { - if (CurrentRoom.OnFeedback.BoolValue) - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); - else - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); - }); - TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => - PopupInterlock.HideAndClear()); + // // Gear + // TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); + // TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, + // ShowTech, + // null, + // () => + // { + // if (CurrentRoom.OnFeedback.BoolValue) + // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); + // else + // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); + // }); + // TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => + // PopupInterlock.HideAndClear()); - // Help button and popup - if (CurrentRoom.Config.Help != null) - { - TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); - TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); - TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); - if (roomConf.Help.ShowCallButton) - TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN - else - TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - } - else // older config - { - TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); - TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); - TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); - TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); - } - TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); - TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => - { - string message = null; - var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) - as EssentialsHuddleSpaceRoom; - if (room != null) - message = room.Config.HelpMessage; - else - message = "Sorry, no help message available. No room connected."; - //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; - PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); - }); - uint nextJoin = 3953; + // // Help button and popup + // if (CurrentRoom.Config.Help != null) + // { + // TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); + // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); + // TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); + // if (roomConf.Help.ShowCallButton) + // TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN + // else + // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); + // } + // else // older config + // { + // TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); + // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); + // TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); + // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); + // } + // TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); + // TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => + // { + // string message = null; + // var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) + // as EssentialsHuddleSpaceRoom; + // if (room != null) + // message = room.Config.HelpMessage; + // else + // message = "Sorry, no help message available. No room connected."; + // //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; + // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); + // }); + // uint nextJoin = 3953; - // Calendar button - if (_CurrentRoom.ScheduleSource != null) - { - TriList.SetString(nextJoin, "Calendar"); - TriList.SetSigFalseAction(nextJoin, CalendarPress); + // // Calendar button + // if (_CurrentRoom.ScheduleSource != null) + // { + // TriList.SetString(nextJoin, "Calendar"); + // TriList.SetSigFalseAction(nextJoin, CalendarPress); - nextJoin--; - } + // nextJoin--; + // } - // Call button - TriList.SetString(nextJoin, "DND"); - TriList.SetSigFalseAction(nextJoin, ShowActiveCallsList); - HeaderCallButtonIconSig = TriList.StringInput[nextJoin]; + // // Call button + // TriList.SetString(nextJoin, "DND"); + // TriList.SetSigFalseAction(nextJoin, ShowActiveCallsList); + // HeaderCallButtonIconSig = TriList.StringInput[nextJoin]; - nextJoin--; + // nextJoin--; - // blank any that remain - for (var i = nextJoin; i > 3950; i--) - { - TriList.SetString(i, "Blank"); - TriList.SetSigFalseAction(i, () => { }); - } + // // blank any that remain + // for (var i = nextJoin; i > 3950; i--) + // { + // TriList.SetString(i, "Blank"); + // TriList.SetSigFalseAction(i, () => { }); + // } - TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, ShowActiveCallsList); + // TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, ShowActiveCallsList); - // Set Call Status Subpage Position + // // Set Call Status Subpage Position - if (nextJoin == 3951) - { - // Set to right position - TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false); - TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true); - } - else if (nextJoin == 3950) - { - // Set to left position - TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true); - TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false); - } + // if (nextJoin == 3951) + // { + // // Set to right position + // TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false); + // TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true); + // } + // else if (nextJoin == 3950) + // { + // // Set to left position + // TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true); + // TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false); + // } - HeaderButtonsAreSetUp = true; + // HeaderButtonsAreSetUp = true; - ComputeHeaderCallStatus(CurrentRoom.VideoCodec); - } + // ComputeHeaderCallStatus(CurrentRoom.VideoCodec); + //} - /// - /// Evaluates the call status and sets the icon mode and text label - /// - public void ComputeHeaderCallStatus(VideoCodecBase codec) - { - if (codec == null) - { - Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null"); - return; - } + ///// + ///// Evaluates the call status and sets the icon mode and text label + ///// + //public void ComputeHeaderCallStatus(VideoCodecBase codec) + //{ + // if (codec == null) + // { + // Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null"); + // return; + // } - if(HeaderCallButtonIconSig == null) - { - Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null"); - return; - } + // if (HeaderCallButtonIconSig == null) + // { + // Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null"); + // return; + // } - // Set mode of header button - if (!codec.IsInCall) - { - HeaderCallButtonIconSig.StringValue = "DND"; - //HeaderCallButton.SetIcon(HeaderListButton.OnHook); - } - else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video)) - HeaderCallButtonIconSig.StringValue = "Misc-06_Dark"; - //HeaderCallButton.SetIcon(HeaderListButton.Camera); - //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2); - else - HeaderCallButtonIconSig.StringValue = "Misc-09_Dark"; - //HeaderCallButton.SetIcon(HeaderListButton.Phone); - //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1); + // // Set mode of header button + // if (!codec.IsInCall) + // { + // HeaderCallButtonIconSig.StringValue = "DND"; + // //HeaderCallButton.SetIcon(HeaderListButton.OnHook); + // } + // else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video)) + // HeaderCallButtonIconSig.StringValue = "Misc-06_Dark"; + // //HeaderCallButton.SetIcon(HeaderListButton.Camera); + // //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2); + // else + // HeaderCallButtonIconSig.StringValue = "Misc-09_Dark"; + // //HeaderCallButton.SetIcon(HeaderListButton.Phone); + // //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1); - // Set the call status text - if (codec.ActiveCalls.Count > 0) - { - if (codec.ActiveCalls.Count == 1) - TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call"); - else if (codec.ActiveCalls.Count > 1) - TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count)); - } - else - TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls"); - } + // // Set the call status text + // if (codec.ActiveCalls.Count > 0) + // { + // if (codec.ActiveCalls.Count == 1) + // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call"); + // else if (codec.ActiveCalls.Count > 1) + // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count)); + // } + // else + // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls"); + //} /// /// @@ -1510,18 +1500,24 @@ namespace PepperDash.Essentials } /// - /// For hanging off various common things that child drivers might need from a parent AV driver + /// For hanging off various common AV things that child drivers might need from a parent AV driver /// public interface IAVDriver { - PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; } JoinedSigInterlock PopupInterlock { get; } - EssentialsHuddleVtc1Room CurrentRoom { get; } void ShowNotificationRibbon(string message, int timeout); void HideNotificationRibbon(); - void ComputeHeaderCallStatus(VideoCodecBase codec); - bool HeaderButtonsAreSetUp { get; } - SubpageReferenceList MeetingOrContactMethodModalSrl { get; } + void ShowTech(); + } + + /// + /// For hanging off various common VC things that child drivers might need from a parent AV driver + /// + public interface IAVWithVCDriver : IAVDriver + { + EssentialsHuddleVtc1Room CurrentRoom { get; } + + PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; } /// /// Exposes the ability to switch into call mode /// @@ -1530,5 +1526,7 @@ namespace PepperDash.Essentials /// Allows the codec to trigger the main UI to clear up if call is coming in. /// void PrepareForCodecIncomingCall(); + + SubpageReferenceList MeetingOrContactMethodModalSrl { get; } } } diff --git a/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs b/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs index 526585ab..1fd822df 100644 --- a/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs +++ b/Essentials/PepperDashEssentials/UIDrivers/VC/EssentialsVideoCodecUiDriver.cs @@ -23,7 +23,7 @@ namespace PepperDash.Essentials.UIDrivers.VC /// public class EssentialsVideoCodecUiDriver : PanelDriverBase { - IAVDriver Parent; + IAVWithVCDriver Parent; /// /// @@ -87,12 +87,18 @@ namespace PepperDash.Essentials.UIDrivers.VC CTimer BackspaceTimer; + + /// + /// The panel header driver + /// + EssentialsHeaderDriver HeaderDriver; + /// /// /// /// /// - public EssentialsVideoCodecUiDriver(BasicTriListWithSmartObject triList, IAVDriver parent, VideoCodecBase codec) + public EssentialsVideoCodecUiDriver(BasicTriListWithSmartObject triList, IAVWithVCDriver parent, VideoCodecBase codec, EssentialsHeaderDriver headerDriver) : base(triList) { try @@ -101,6 +107,7 @@ namespace PepperDash.Essentials.UIDrivers.VC throw new ArgumentNullException("Codec cannot be null"); Codec = codec; Parent = parent; + HeaderDriver = headerDriver; SetupCallStagingPopover(); SetupDialKeypad(); ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5); @@ -207,8 +214,8 @@ namespace PepperDash.Essentials.UIDrivers.VC TriList.SetString(UIStringJoin.RoomPhoneText, roomNumberSipUri); - if(Parent.HeaderButtonsAreSetUp) - Parent.ComputeHeaderCallStatus(Codec); + if(HeaderDriver.HeaderButtonsAreSetUp) + HeaderDriver.ComputeHeaderCallStatus(Codec); } /// @@ -231,7 +238,7 @@ namespace PepperDash.Essentials.UIDrivers.VC Parent.ShowNotificationRibbon("Connected", 2000); StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress); ShowKeypad(); - (Parent.CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).MuteOff(); + ((Parent.CurrentRoom as IHasCurrentVolumeControls).CurrentVolumeControls as IBasicVolumeWithFeedback).MuteOff(); //VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible); break; case eCodecCallStatus.Connecting: @@ -288,7 +295,7 @@ namespace PepperDash.Essentials.UIDrivers.VC else StagingBarsInterlock.SetButDontShow(stageJoin); - Parent.ComputeHeaderCallStatus(Codec); + HeaderDriver.ComputeHeaderCallStatus(Codec); // Update active call list UpdateHeaderActiveCallList(); @@ -326,7 +333,7 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void ShowIncomingModal(CodecActiveCallItem call) { - Parent.PrepareForCodecIncomingCall(); + (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall(); IncomingCallModal = new ModalDialog(TriList); string msg; string icon; @@ -356,8 +363,8 @@ namespace PepperDash.Essentials.UIDrivers.VC /// void AcceptIncomingCall(CodecActiveCallItem call) { - Parent.PrepareForCodecIncomingCall(); - Parent.ActivityCallButtonPressed(); + (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall(); + (Parent as IAVWithVCDriver).ActivityCallButtonPressed(); Codec.AcceptCall(call); } diff --git a/Release Package/PepperDashEssentials.cpz b/Release Package/PepperDashEssentials.cpz index 82213041..d6c4e23c 100644 Binary files a/Release Package/PepperDashEssentials.cpz and b/Release Package/PepperDashEssentials.cpz differ diff --git a/Release Package/PepperDashEssentials.dll b/Release Package/PepperDashEssentials.dll index e0f71a1a..49f94e22 100644 Binary files a/Release Package/PepperDashEssentials.dll and b/Release Package/PepperDashEssentials.dll differ