Significant refactoring of DeviceFactory for touchpanel device building. Moved SetupHeaderButtons() out of AV driver classes and into new EssentialsHeaderDriver class.

This commit is contained in:
Neil Dorin
2018-05-17 12:33:20 -06:00
parent b44613b91f
commit c88b259c71
22 changed files with 846 additions and 394 deletions

View File

@@ -28,6 +28,15 @@ namespace PepperDash.Essentials.Core
BoolFeedback MuteFeedback { get; } BoolFeedback MuteFeedback { get; }
} }
/// <summary>
/// A class that implements this contains a reference to a current IBasicVolumeControls device.
/// The class may have multiple IBasicVolumeControls.
/// </summary>
public interface IHasCurrentVolumeControls
{
IBasicVolumeControls CurrentVolumeControls { get; }
}
/// <summary> /// <summary>
/// ///

View File

@@ -8,16 +8,51 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core.Shades namespace PepperDash.Essentials.Core.Shades
{ {
/// <summary>
/// Class that contains the shades to be controlled in a room
/// </summary>
public class ShadeController : Device, IShades public class ShadeController : Device, IShades
{ {
ShadeControllerConfigProperties Config;
public List<ShadeBase> Shades { get; private set; } public List<ShadeBase> Shades { get; private set; }
public ShadeController(string key, string name) public ShadeController(string key, string name, ShadeControllerConfigProperties config)
: base(key, name) : base(key, name)
{ {
Config = config;
Shades = new List<ShadeBase>(); Shades = new List<ShadeBase>();
} }
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<ShadeConfig> Shades { get; set; }
public class ShadeConfig
{
public string Key { get; set; }
}
}
} }

View File

@@ -22,16 +22,30 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
/// <summary> /// <summary>
/// Collection of generic switched outputs /// Collection of generic switched outputs
/// </summary> /// </summary>
public Dictionary<uint, ISwitchedOutput> SwitchedOutputs; public Dictionary<uint, ISwitchedOutput> SwitchedOutputs { get; private set; }
public Din8sw8Controller(string key, string cresnetId) public Din8sw8Controller(string key, uint cresnetId)
: base(key) : base(key)
{ {
SwitchedOutputs = new Dictionary<uint, ISwitchedOutput>(); SwitchedOutputs = new Dictionary<uint, ISwitchedOutput>();
SwitchModule = new Din8Sw8(cresnetId, Global.ControlSystem);
if (SwitchModule.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
{
Debug.Console(2, this, "Error registering Din8sw8. Reason: {0}", SwitchModule.RegistrationFailureReason);
}
PopulateDictionary(); PopulateDictionary();
} }
public override bool CustomActivate()
{
return base.CustomActivate();
}
/// <summary> /// <summary>
/// Populates the generic collection with the loads from the Crestron collection /// Populates the generic collection with the loads from the Crestron collection
/// </summary> /// </summary>
@@ -70,4 +84,5 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
SwitchedOutput.FullOff(); SwitchedOutput.FullOff();
} }
} }
} }

View File

@@ -16,21 +16,32 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy
/// </summary> /// </summary>
public class RelayControlledShade : ShadeBase public class RelayControlledShade : ShadeBase
{ {
RelayControlledShadeConfigProperties Config;
ISwitchedOutput OpenRelay; ISwitchedOutput OpenRelay;
ISwitchedOutput StopRelay; ISwitchedOutput StopRelay;
ISwitchedOutput CloseRelay; ISwitchedOutput CloseRelay;
int RelayPulseTime; int RelayPulseTime;
public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties props) public RelayControlledShade(string key, string name, RelayControlledShadeConfigProperties config)
: base(key, name) : base(key, name)
{ {
RelayPulseTime = props.RelayPulseTime; Config = config;
//Create ISwitchedOutput objects based on props
OpenRelay = GetSwitchedOutputFromDevice(props.Relays.Open); RelayPulseTime = Config.RelayPulseTime;
StopRelay = GetSwitchedOutputFromDevice(props.Relays.Stop);
CloseRelay = GetSwitchedOutputFromDevice(props.Relays.Close); }
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() public override void Open()

View File

@@ -299,9 +299,31 @@ namespace PepperDash.Essentials.Devices.Common
return new Environment.Lutron.LutronQuantumArea(key, name, comm, props); 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<Core.Shades.ShadeControllerConfigProperties>(properties.ToString());
return new Core.Shades.ShadeController(key, name, props);
}
else if (typeName == "relaycontrolledshade")
{
var props = JsonConvert.DeserializeObject<Environment.Somfy.RelayControlledShadeConfigProperties>(properties.ToString());
return new Environment.Somfy.RelayControlledShade(key, name, props);
}
}
return null; return null;

View File

@@ -33,6 +33,7 @@ namespace PepperDash.Essentials.Devices.Common.Occupancy
: base(key, name, sensor) : base(key, name, sensor)
{ {
OccSensor = sensor; OccSensor = sensor;
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc); RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(sensor_GlsOccupancySensorChange); OccSensor.GlsOccupancySensorChange += new GlsOccupancySensorChangeEventHandler(sensor_GlsOccupancySensorChange);

View File

@@ -30,11 +30,7 @@ namespace PepperDash.Essentials
} }
else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw")) else if (dc.Group.ToLower() == "touchpanel") // typeName.StartsWith("tsw"))
{ {
var comm = CommFactory.GetControlPropertiesConfig(dc); return UiDeviceFactory.GetUiDevice(dc);
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(
properties.ToString());
return new EssentialsTouchpanelController(key, name, typeName, props, comm.IpIdInt);
} }
else if (typeName == "mockdisplay") else if (typeName == "mockdisplay")
@@ -92,4 +88,5 @@ namespace PepperDash.Essentials
return null; return null;
} }
} }
} }

View File

@@ -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<CrestronTouchpanelPropertiesConfig>(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<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(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<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
// tsw.Down.UserObject = new Action<bool>(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<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
}
else
{
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
}
});
return panelController;
}
}
}

View File

@@ -125,11 +125,12 @@
<Compile Include="Configuration ORIGINAL\Factories\FactoryHelper.cs" /> <Compile Include="Configuration ORIGINAL\Factories\FactoryHelper.cs" />
<Compile Include="Config\ConfigReader.cs" /> <Compile Include="Config\ConfigReader.cs" />
<Compile Include="Config\EssentialsConfig.cs" /> <Compile Include="Config\EssentialsConfig.cs" />
<Compile Include="Config\DeviceFactory.cs" /> <Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Devices\Amplifier.cs" /> <Compile Include="Devices\Amplifier.cs" />
<Compile Include="Devices\DiscPlayer\OppoExtendedBdp.cs" /> <Compile Include="Devices\DiscPlayer\OppoExtendedBdp.cs" />
<Compile Include="Devices\NUMERIC AppleTV.cs" /> <Compile Include="Devices\NUMERIC AppleTV.cs" />
<Compile Include="ControlSystem.cs" /> <Compile Include="ControlSystem.cs" />
<Compile Include="Factory\UiDeviceFactory.cs" />
<Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" /> <Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="OTHER\Fusion\FusionEventHandlers.cs" /> <Compile Include="OTHER\Fusion\FusionEventHandlers.cs" />
<Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" /> <Compile Include="OTHER\Fusion\FusionProcessorQueries.cs" />
@@ -168,6 +169,8 @@
<Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeSetTopBoxGeneric.cs" /> <Compile Include="FOR REFERENCE UI\PageControllers\PageControllerLargeSetTopBoxGeneric.cs" />
<Compile Include="FOR REFERENCE UI\PageControllers\LargeTouchpanelControllerBase.cs" /> <Compile Include="FOR REFERENCE UI\PageControllers\LargeTouchpanelControllerBase.cs" />
<Compile Include="FOR REFERENCE UI\Panels\SmartGraphicsTouchpanelControllerBase.cs" /> <Compile Include="FOR REFERENCE UI\Panels\SmartGraphicsTouchpanelControllerBase.cs" />
<Compile Include="UIDrivers\Essentials\EssentialsEnvironmentDriver.cs" />
<Compile Include="UIDrivers\Essentials\EssentialsHeaderDriver.cs" />
<Compile Include="UIDrivers\SigInterlock.cs" /> <Compile Include="UIDrivers\SigInterlock.cs" />
<Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddlePresentationUiDriver.cs" /> <Compile Include="UIDrivers\EssentialsHuddleVTC\EssentialsHuddlePresentationUiDriver.cs" />
<Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddleTechPageDriver.cs" /> <Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddleTechPageDriver.cs" />

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2017")]
[assembly: AssemblyVersion("1.0.48.*")] [assembly: AssemblyVersion("1.1.0.*")]

View File

@@ -194,8 +194,8 @@ namespace PepperDash.Essentials.Room.Config
[JsonProperty("helpMessage")] [JsonProperty("helpMessage")]
public string HelpMessage { get; set; } public string HelpMessage { get; set; }
[JsonProperty("lighting")] [JsonProperty("environment")]
public EssentialsLightingPropertiesConfig Lighting { get; set; } public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
[JsonProperty("logo")] [JsonProperty("logo")]
public EssentialsLogoPropertiesConfig Logo { get; set; } public EssentialsLogoPropertiesConfig Logo { get; set; }
@@ -225,9 +225,18 @@ namespace PepperDash.Essentials.Room.Config
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
} }
public class EssentialsLightingPropertiesConfig public class EssentialsEnvironmentPropertiesConfig
{ {
public bool Enabled { get; set; } public bool Enabled { get; set; }
[JsonProperty("deviceKeys")]
public List<string> DeviceKeys { get; set; }
public EssentialsEnvironmentPropertiesConfig()
{
DeviceKeys = new List<string>();
}
} }
public class EssentialsRoomMicrophonePrivacyConfig public class EssentialsRoomMicrophonePrivacyConfig

View File

@@ -339,7 +339,7 @@ namespace PepperDash.Essentials.Room.Cotija
rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue; rmProps.Help.CallButtonText = EISC.StringOutput[503].StringValue;
rmProps.Help.Message = EISC.StringOutput[502].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.RoomPhoneNumber = EISC.StringOutput[504].StringValue;
rmProps.RoomURI = EISC.StringOutput[505].StringValue; rmProps.RoomURI = EISC.StringOutput[505].StringValue;

View File

@@ -12,7 +12,7 @@ using PepperDash.Essentials.Devices.Common.VideoCodec;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, IPrivacy public class EssentialsHuddleVtc1Room : EssentialsRoomBase, IHasCurrentSourceInfoChange, IPrivacy, IHasCurrentVolumeControls
{ {
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange; public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
public event SourceInfoChangeHandler CurrentSingleSourceChange; public event SourceInfoChangeHandler CurrentSingleSourceChange;

View File

@@ -36,153 +36,74 @@ namespace PepperDash.Essentials
public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id) public EssentialsTouchpanelController(string key, string name, string type, CrestronTouchpanelPropertiesConfig props, uint id)
: base(key, name) : 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 Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating touchpanel hardware...");
if (Panel is TswFt5ButtonSystem) type = type.ToLower();
{ try
var tsw = Panel as TswFt5ButtonSystem; {
tsw.ExtenderSystemReservedSigs.Use(); if (type == "crestronapp")
tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange {
+= ExtenderSystemReservedSigs_DeviceExtenderSigChange; 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 => // Reserved sigs
// { if (Panel is TswFt5ButtonSystem)
var regSuccess = Panel.Register(); {
#warning Temporary Error logging for XiO Edge Debugging var tsw = Panel as TswFt5ButtonSystem;
if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success) tsw.ExtenderSystemReservedSigs.Use();
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess); tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange
+= ExtenderSystemReservedSigs_DeviceExtenderSigChange;
// Give up cleanly if SGD is not present. tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
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;
}
Panel.LoadSmartObjects(sgdName); }
Panel.SigChange += Tsw_SigChange;
var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, props); if (Panel.Register() != eDeviceRegistrationUnRegistrationResponse.Success)
// Then the AV driver 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 // Give up cleanly if SGD is not present.
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); var sgdName = Global.FilePathPrefix
if (room is EssentialsHuddleSpaceRoom) + Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile;
{ if (!File.Exists(sgdName))
Debug.Console(0, this, "Adding huddle space driver"); {
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName);
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; return;
avDriver.DefaultRoomKey = props.DefaultRoomKey; }
mainDriver.AvDriver = avDriver;
LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (Panel is TswFt5ButtonSystem) Panel.LoadSmartObjects(sgdName);
{ Panel.SigChange += Tsw_SigChange;
var tsw = Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(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<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(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.
if (Panel is TswFt5ButtonSystem)
{
var tsw = Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(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) public void LoadAndShowDriver(PanelDriverBase driver)

View File

@@ -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;
/// <summary>
/// The parent driver for this
/// </summary>
EssentialsPanelMainInterfaceDriver Parent;
public EssentialsEnvironmentDriver(EssentialsPanelMainInterfaceDriver parent, CrestronTouchpanelPropertiesConfig config)
: base(parent.TriList)
{
Config = config;
Parent = parent;
}
}
}

View File

@@ -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
{
/// <summary>
///
/// </summary>
public class EssentialsHeaderDriver : PanelDriverBase
{
CrestronTouchpanelPropertiesConfig Config;
/// <summary>
/// The parent driver for this
/// </summary>
EssentialsPanelMainInterfaceDriver Parent;
/// <summary>
/// Indicates that the SetHeaderButtons method has completed successfully
/// </summary>
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--;
}
/// <summary>
/// Evaluates the call status and sets the icon mode and text label
/// </summary>
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");
}
/// <summary>
/// Sets up Header Buttons for the EssentialsHuddleVtc1Room type
/// </summary>
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;
}
}
}

View File

@@ -15,11 +15,20 @@ namespace PepperDash.Essentials
/// Assign the appropriate A/V driver. /// Assign the appropriate A/V driver.
/// Want to keep the AvDriver alive, because it may hold states /// Want to keep the AvDriver alive, because it may hold states
/// </summary> /// </summary>
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; } public PanelDriverBase CurrentChildDriver { get; private set; }
CrestronTouchpanelPropertiesConfig Config; CrestronTouchpanelPropertiesConfig Config;
/// <summary>
/// The main interlock for popups
/// </summary>
public JoinedSigInterlock PopupInterlock { get; private set; }
public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist, public EssentialsPanelMainInterfaceDriver(BasicTriListWithSmartObject trilist,
CrestronTouchpanelPropertiesConfig config) CrestronTouchpanelPropertiesConfig config)
@@ -31,7 +40,7 @@ namespace PepperDash.Essentials
public override void Show() public override void Show()
{ {
CurrentChildDriver = null; CurrentChildDriver = null;
ShowSubDriver(AvDriver); ShowSubDriver(AvDriver as PanelDriverBase);
base.Show(); base.Show();
} }

View File

@@ -14,7 +14,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver
{ {
CrestronTouchpanelPropertiesConfig Config; CrestronTouchpanelPropertiesConfig Config;
@@ -110,7 +110,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// The parent driver for this /// The parent driver for this
/// </summary> /// </summary>
PanelDriverBase Parent; PanelDriverBase Parent;
/// <summary> /// <summary>
/// All children attached to this driver. For hiding and showing as a group. /// All children attached to this driver. For hiding and showing as a group.
@@ -153,7 +153,7 @@ namespace PepperDash.Essentials
ModalDialog PowerDownModal; ModalDialog PowerDownModal;
JoinedSigInterlock PopupInterlock; public JoinedSigInterlock PopupInterlock { get; private set; }
/// <summary> /// <summary>
/// The driver for the tech page. Lazy getter for memory usage /// The driver for the tech page. Lazy getter for memory usage
@@ -311,7 +311,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Reveals the tech page and puts away anything that's in the way. /// Reveals the tech page and puts away anything that's in the way.
/// </summary> /// </summary>
void ShowTech() public void ShowTech()
{ {
PopupInterlock.HideAndClear(); PopupInterlock.HideAndClear();
TechDriver.Show(); TechDriver.Show();
@@ -808,7 +808,7 @@ namespace PepperDash.Essentials
_CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange; _CurrentRoom.CurrentSingleSourceChange += CurrentRoom_SourceInfoChange;
RefreshSourceInfo(); RefreshSourceInfo();
SetupHeaderButtons(); (Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(CurrentRoom);
} }
else else
{ {
@@ -817,82 +817,82 @@ namespace PepperDash.Essentials
} }
} }
void SetupHeaderButtons() //void SetupHeaderButtons()
{ //{
HeaderButtonsAreSetUp = false; // HeaderButtonsAreSetUp = false;
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); // TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
var roomConf = CurrentRoom.Config; // var roomConf = CurrentRoom.Config;
// Gear // // Gear
TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); // TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, // TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000,
ShowTech, // ShowTech,
null, // null,
() => // () =>
{ // {
if (CurrentRoom.OnFeedback.BoolValue) // if (CurrentRoom.OnFeedback.BoolValue)
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
else // else
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
}); // });
TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => // TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
PopupInterlock.HideAndClear()); // PopupInterlock.HideAndClear());
// Help button and popup // // Help button and popup
if (CurrentRoom.Config.Help != null) // if (CurrentRoom.Config.Help != null)
{ // {
TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); // TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message);
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton);
TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); // TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText);
if (roomConf.Help.ShowCallButton) // if (roomConf.Help.ShowCallButton)
TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN // TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN
else // else
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
} // }
else // older config // else // older config
{ // {
TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); // TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage);
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false);
TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); // TriList.SetString(UIStringJoin.HelpPageCallButtonText, null);
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
} // }
TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); // TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help");
TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => // TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () =>
{ // {
string message = null; // string message = null;
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) // var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
as EssentialsHuddleSpaceRoom; // as EssentialsHuddleSpaceRoom;
if (room != null) // if (room != null)
message = room.Config.HelpMessage; // message = room.Config.HelpMessage;
else // else
message = "Sorry, no help message available. No room connected."; // message = "Sorry, no help message available. No room connected.";
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; // //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
}); // });
uint nextJoin = 3953; // uint nextJoin = 3953;
//// Calendar button // //// Calendar button
//if (_CurrentRoom.ScheduleSource != null) // //if (_CurrentRoom.ScheduleSource != null)
//{ // //{
// TriList.SetString(nextJoin, "Calendar"); // // TriList.SetString(nextJoin, "Calendar");
// TriList.SetSigFalseAction(nextJoin, CalendarPress); // // TriList.SetSigFalseAction(nextJoin, CalendarPress);
// nextJoin--; // // nextJoin--;
//} // //}
//nextJoin--; // //nextJoin--;
// blank any that remain // // blank any that remain
for (var i = nextJoin; i > 3950; i--) // for (var i = nextJoin; i > 3950; i--)
{ // {
TriList.SetString(i, "Blank"); // TriList.SetString(i, "Blank");
TriList.SetSigFalseAction(i, () => { }); // TriList.SetSigFalseAction(i, () => { });
} // }
HeaderButtonsAreSetUp = true; // HeaderButtonsAreSetUp = true;
} //}
/// <summary> /// <summary>

View File

@@ -18,7 +18,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVDriver public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver
{ {
CrestronTouchpanelPropertiesConfig Config; CrestronTouchpanelPropertiesConfig Config;
@@ -43,10 +43,6 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public string DefaultRoomKey { get; set; } public string DefaultRoomKey { get; set; }
/// <summary>
/// Indicates that the SetHeaderButtons method has completed successfully
/// </summary>
public bool HeaderButtonsAreSetUp { get; private set; }
/// <summary> /// <summary>
/// ///
@@ -68,14 +64,8 @@ namespace PepperDash.Essentials
BoolInputSig ShareButtonSig; BoolInputSig ShareButtonSig;
BoolInputSig EndMeetingButtonSig; BoolInputSig EndMeetingButtonSig;
//HeaderListButton HeaderCallButton;
//HeaderListButton HeaderGearButton;
StringInputSig HeaderCallButtonIconSig;
BoolFeedback CallSharingInfoVisibleFeedback; BoolFeedback CallSharingInfoVisibleFeedback;
/// <summary> /// <summary>
/// The parent driver for this /// The parent driver for this
/// </summary> /// </summary>
@@ -326,7 +316,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Allows PopupInterlock to be toggled if the calls list is already visible, or if the codec is in a call /// Allows PopupInterlock to be toggled if the calls list is already visible, or if the codec is in a call
/// </summary> /// </summary>
void ShowActiveCallsList() public void ShowActiveCallsList()
{ {
TriList.SetBool(UIBoolJoin.CallEndAllConfirmVisible, true); TriList.SetBool(UIBoolJoin.CallEndAllConfirmVisible, true);
if(PopupInterlock.CurrentJoin == UIBoolJoin.HeaderActiveCallsListVisible) if(PopupInterlock.CurrentJoin == UIBoolJoin.HeaderActiveCallsListVisible)
@@ -516,7 +506,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Calendar should only be visible when it's supposed to /// Calendar should only be visible when it's supposed to
/// </summary> /// </summary>
void CalendarPress() public void CalendarPress()
{ {
//RefreshMeetingsList(); // List should be up-to-date //RefreshMeetingsList(); // List should be up-to-date
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible); PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible);
@@ -558,7 +548,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Reveals the tech page and puts away anything that's in the way. /// Reveals the tech page and puts away anything that's in the way.
/// </summary> /// </summary>
void ShowTech() public void ShowTech()
{ {
PopupInterlock.HideAndClear(); PopupInterlock.HideAndClear();
TechDriver.Show(); TechDriver.Show();
@@ -952,7 +942,7 @@ namespace PepperDash.Essentials
TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, () => _CurrentRoom.RunRouteAction("codecOsd")); TriList.SetSigFalseAction(UIBoolJoin.CallStopSharingPress, () => _CurrentRoom.RunRouteAction("codecOsd"));
SetupHeaderButtons(); (Parent as EssentialsPanelMainInterfaceDriver).HeaderDriver.SetupHeaderButtons(CurrentRoom);
} }
else else
{ {
@@ -1075,153 +1065,153 @@ namespace PepperDash.Essentials
} }
/// <summary> ///// <summary>
/// /////
/// </summary> ///// </summary>
void SetupHeaderButtons() //void SetupHeaderButtons()
{ //{
HeaderButtonsAreSetUp = false; // HeaderButtonsAreSetUp = false;
TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); // TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true);
var roomConf = CurrentRoom.Config; // var roomConf = CurrentRoom.Config;
// Gear // // Gear
TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear"); // TriList.SetString(UIStringJoin.HeaderButtonIcon5, "Gear");
TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000, // TriList.SetSigHeldAction(UIBoolJoin.HeaderIcon5Press, 2000,
ShowTech, // ShowTech,
null, // null,
() => // () =>
{ // {
if (CurrentRoom.OnFeedback.BoolValue) // if (CurrentRoom.OnFeedback.BoolValue)
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible); // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPageVisible);
else // else
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible); // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.VolumesPagePowerOffVisible);
}); // });
TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () => // TriList.SetSigFalseAction(UIBoolJoin.TechExitButton, () =>
PopupInterlock.HideAndClear()); // PopupInterlock.HideAndClear());
// Help button and popup // // Help button and popup
if (CurrentRoom.Config.Help != null) // if (CurrentRoom.Config.Help != null)
{ // {
TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message); // TriList.SetString(UIStringJoin.HelpMessage, roomConf.Help.Message);
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton); // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, roomConf.Help.ShowCallButton);
TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText); // TriList.SetString(UIStringJoin.HelpPageCallButtonText, roomConf.Help.CallButtonText);
if (roomConf.Help.ShowCallButton) // if (roomConf.Help.ShowCallButton)
TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN // TriList.SetSigFalseAction(UIBoolJoin.HelpPageShowCallButtonPress, () => { }); // ************ FILL IN
else // else
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
} // }
else // older config // else // older config
{ // {
TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage); // TriList.SetString(UIStringJoin.HelpMessage, CurrentRoom.Config.HelpMessage);
TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false); // TriList.SetBool(UIBoolJoin.HelpPageShowCallButtonVisible, false);
TriList.SetString(UIStringJoin.HelpPageCallButtonText, null); // TriList.SetString(UIStringJoin.HelpPageCallButtonText, null);
TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress); // TriList.ClearBoolSigAction(UIBoolJoin.HelpPageShowCallButtonPress);
} // }
TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help"); // TriList.SetString(UIStringJoin.HeaderButtonIcon4, "Help");
TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () => // TriList.SetSigFalseAction(UIBoolJoin.HeaderIcon4Press, () =>
{ // {
string message = null; // string message = null;
var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey) // var room = DeviceManager.GetDeviceForKey(Config.DefaultRoomKey)
as EssentialsHuddleSpaceRoom; // as EssentialsHuddleSpaceRoom;
if (room != null) // if (room != null)
message = room.Config.HelpMessage; // message = room.Config.HelpMessage;
else // else
message = "Sorry, no help message available. No room connected."; // message = "Sorry, no help message available. No room connected.";
//TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message; // //TriList.StringInput[UIStringJoin.HelpMessage].StringValue = message;
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible); // PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HelpPageVisible);
}); // });
uint nextJoin = 3953; // uint nextJoin = 3953;
// Calendar button // // Calendar button
if (_CurrentRoom.ScheduleSource != null) // if (_CurrentRoom.ScheduleSource != null)
{ // {
TriList.SetString(nextJoin, "Calendar"); // TriList.SetString(nextJoin, "Calendar");
TriList.SetSigFalseAction(nextJoin, CalendarPress); // TriList.SetSigFalseAction(nextJoin, CalendarPress);
nextJoin--; // nextJoin--;
} // }
// Call button // // Call button
TriList.SetString(nextJoin, "DND"); // TriList.SetString(nextJoin, "DND");
TriList.SetSigFalseAction(nextJoin, ShowActiveCallsList); // TriList.SetSigFalseAction(nextJoin, ShowActiveCallsList);
HeaderCallButtonIconSig = TriList.StringInput[nextJoin]; // HeaderCallButtonIconSig = TriList.StringInput[nextJoin];
nextJoin--; // nextJoin--;
// blank any that remain // // blank any that remain
for (var i = nextJoin; i > 3950; i--) // for (var i = nextJoin; i > 3950; i--)
{ // {
TriList.SetString(i, "Blank"); // TriList.SetString(i, "Blank");
TriList.SetSigFalseAction(i, () => { }); // 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) // if (nextJoin == 3951)
{ // {
// Set to right position // // Set to right position
TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false); // TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false);
TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true); // TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true);
} // }
else if (nextJoin == 3950) // else if (nextJoin == 3950)
{ // {
// Set to left position // // Set to left position
TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true); // TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true);
TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false); // TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false);
} // }
HeaderButtonsAreSetUp = true; // HeaderButtonsAreSetUp = true;
ComputeHeaderCallStatus(CurrentRoom.VideoCodec); // ComputeHeaderCallStatus(CurrentRoom.VideoCodec);
} //}
/// <summary> ///// <summary>
/// Evaluates the call status and sets the icon mode and text label ///// Evaluates the call status and sets the icon mode and text label
/// </summary> ///// </summary>
public void ComputeHeaderCallStatus(VideoCodecBase codec) //public void ComputeHeaderCallStatus(VideoCodecBase codec)
{ //{
if (codec == null) // if (codec == null)
{ // {
Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null"); // Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. codec is null");
return; // return;
} // }
if(HeaderCallButtonIconSig == null) // if (HeaderCallButtonIconSig == null)
{ // {
Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null"); // Debug.Console(1, "ComputeHeaderCallStatus() cannot execute. HeaderCallButtonIconSig is null");
return; // return;
} // }
// Set mode of header button // // Set mode of header button
if (!codec.IsInCall) // if (!codec.IsInCall)
{ // {
HeaderCallButtonIconSig.StringValue = "DND"; // HeaderCallButtonIconSig.StringValue = "DND";
//HeaderCallButton.SetIcon(HeaderListButton.OnHook); // //HeaderCallButton.SetIcon(HeaderListButton.OnHook);
} // }
else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video)) // else if (codec.ActiveCalls.Any(c => c.Type == eCodecCallType.Video))
HeaderCallButtonIconSig.StringValue = "Misc-06_Dark"; // HeaderCallButtonIconSig.StringValue = "Misc-06_Dark";
//HeaderCallButton.SetIcon(HeaderListButton.Camera); // //HeaderCallButton.SetIcon(HeaderListButton.Camera);
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2); // //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 2);
else // else
HeaderCallButtonIconSig.StringValue = "Misc-09_Dark"; // HeaderCallButtonIconSig.StringValue = "Misc-09_Dark";
//HeaderCallButton.SetIcon(HeaderListButton.Phone); // //HeaderCallButton.SetIcon(HeaderListButton.Phone);
//TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1); // //TriList.SetUshort(UIUshortJoin.CallHeaderButtonMode, 1);
// Set the call status text // // Set the call status text
if (codec.ActiveCalls.Count > 0) // if (codec.ActiveCalls.Count > 0)
{ // {
if (codec.ActiveCalls.Count == 1) // if (codec.ActiveCalls.Count == 1)
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call"); // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "1 Active Call");
else if (codec.ActiveCalls.Count > 1) // else if (codec.ActiveCalls.Count > 1)
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count)); // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, string.Format("{0} Active Calls", codec.ActiveCalls.Count));
} // }
else // else
TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls"); // TriList.SetString(UIStringJoin.HeaderCallStatusLabel, "No Active Calls");
} //}
/// <summary> /// <summary>
/// ///
@@ -1510,18 +1500,24 @@ namespace PepperDash.Essentials
} }
/// <summary> /// <summary>
/// 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
/// </summary> /// </summary>
public interface IAVDriver public interface IAVDriver
{ {
PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; }
JoinedSigInterlock PopupInterlock { get; } JoinedSigInterlock PopupInterlock { get; }
EssentialsHuddleVtc1Room CurrentRoom { get; }
void ShowNotificationRibbon(string message, int timeout); void ShowNotificationRibbon(string message, int timeout);
void HideNotificationRibbon(); void HideNotificationRibbon();
void ComputeHeaderCallStatus(VideoCodecBase codec); void ShowTech();
bool HeaderButtonsAreSetUp { get; } }
SubpageReferenceList MeetingOrContactMethodModalSrl { get; }
/// <summary>
/// For hanging off various common VC things that child drivers might need from a parent AV driver
/// </summary>
public interface IAVWithVCDriver : IAVDriver
{
EssentialsHuddleVtc1Room CurrentRoom { get; }
PepperDash.Essentials.Core.Touchpanels.Keyboards.HabaneroKeyboardController Keyboard { get; }
/// <summary> /// <summary>
/// Exposes the ability to switch into call mode /// Exposes the ability to switch into call mode
/// </summary> /// </summary>
@@ -1530,5 +1526,7 @@ namespace PepperDash.Essentials
/// Allows the codec to trigger the main UI to clear up if call is coming in. /// Allows the codec to trigger the main UI to clear up if call is coming in.
/// </summary> /// </summary>
void PrepareForCodecIncomingCall(); void PrepareForCodecIncomingCall();
SubpageReferenceList MeetingOrContactMethodModalSrl { get; }
} }
} }

View File

@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary> /// </summary>
public class EssentialsVideoCodecUiDriver : PanelDriverBase public class EssentialsVideoCodecUiDriver : PanelDriverBase
{ {
IAVDriver Parent; IAVWithVCDriver Parent;
/// <summary> /// <summary>
/// ///
@@ -87,12 +87,18 @@ namespace PepperDash.Essentials.UIDrivers.VC
CTimer BackspaceTimer; CTimer BackspaceTimer;
/// <summary>
/// The panel header driver
/// </summary>
EssentialsHeaderDriver HeaderDriver;
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="triList"></param> /// <param name="triList"></param>
/// <param name="codec"></param> /// <param name="codec"></param>
public EssentialsVideoCodecUiDriver(BasicTriListWithSmartObject triList, IAVDriver parent, VideoCodecBase codec) public EssentialsVideoCodecUiDriver(BasicTriListWithSmartObject triList, IAVWithVCDriver parent, VideoCodecBase codec, EssentialsHeaderDriver headerDriver)
: base(triList) : base(triList)
{ {
try try
@@ -101,6 +107,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
throw new ArgumentNullException("Codec cannot be null"); throw new ArgumentNullException("Codec cannot be null");
Codec = codec; Codec = codec;
Parent = parent; Parent = parent;
HeaderDriver = headerDriver;
SetupCallStagingPopover(); SetupCallStagingPopover();
SetupDialKeypad(); SetupDialKeypad();
ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5); ActiveCallsSRL = new SubpageReferenceList(triList, UISmartObjectJoin.CodecActiveCallsHeaderList, 5,5,5);
@@ -207,8 +214,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
TriList.SetString(UIStringJoin.RoomPhoneText, roomNumberSipUri); TriList.SetString(UIStringJoin.RoomPhoneText, roomNumberSipUri);
if(Parent.HeaderButtonsAreSetUp) if(HeaderDriver.HeaderButtonsAreSetUp)
Parent.ComputeHeaderCallStatus(Codec); HeaderDriver.ComputeHeaderCallStatus(Codec);
} }
/// <summary> /// <summary>
@@ -231,7 +238,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
Parent.ShowNotificationRibbon("Connected", 2000); Parent.ShowNotificationRibbon("Connected", 2000);
StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress); StagingButtonsFeedbackInterlock.ShowInterlocked(UIBoolJoin.VCStagingKeypadPress);
ShowKeypad(); ShowKeypad();
(Parent.CurrentRoom.CurrentVolumeControls as IBasicVolumeWithFeedback).MuteOff(); ((Parent.CurrentRoom as IHasCurrentVolumeControls).CurrentVolumeControls as IBasicVolumeWithFeedback).MuteOff();
//VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible); //VCControlsInterlock.ShowInterlocked(UIBoolJoin.VCKeypadVisible);
break; break;
case eCodecCallStatus.Connecting: case eCodecCallStatus.Connecting:
@@ -288,7 +295,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
else else
StagingBarsInterlock.SetButDontShow(stageJoin); StagingBarsInterlock.SetButDontShow(stageJoin);
Parent.ComputeHeaderCallStatus(Codec); HeaderDriver.ComputeHeaderCallStatus(Codec);
// Update active call list // Update active call list
UpdateHeaderActiveCallList(); UpdateHeaderActiveCallList();
@@ -326,7 +333,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary> /// </summary>
void ShowIncomingModal(CodecActiveCallItem call) void ShowIncomingModal(CodecActiveCallItem call)
{ {
Parent.PrepareForCodecIncomingCall(); (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall();
IncomingCallModal = new ModalDialog(TriList); IncomingCallModal = new ModalDialog(TriList);
string msg; string msg;
string icon; string icon;
@@ -356,8 +363,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary> /// </summary>
void AcceptIncomingCall(CodecActiveCallItem call) void AcceptIncomingCall(CodecActiveCallItem call)
{ {
Parent.PrepareForCodecIncomingCall(); (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall();
Parent.ActivityCallButtonPressed(); (Parent as IAVWithVCDriver).ActivityCallButtonPressed();
Codec.AcceptCall(call); Codec.AcceptCall(call);
} }