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; }
}
/// <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>
///

View File

@@ -8,16 +8,51 @@ using PepperDash.Core;
namespace PepperDash.Essentials.Core.Shades
{
/// <summary>
/// Class that contains the shades to be controlled in a room
/// </summary>
public class ShadeController : Device, IShades
{
ShadeControllerConfigProperties Config;
public List<ShadeBase> 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<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>
/// Collection of generic switched outputs
/// </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)
{
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();
}
public override bool CustomActivate()
{
return base.CustomActivate();
}
/// <summary>
/// Populates the generic collection with the loads from the Crestron collection
/// </summary>
@@ -70,4 +84,5 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Lighting
SwitchedOutput.FullOff();
}
}
}

View File

@@ -16,21 +16,32 @@ namespace PepperDash.Essentials.Devices.Common.Environment.Somfy
/// </summary>
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()

View File

@@ -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<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;

View File

@@ -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);

View File

@@ -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<CrestronTouchpanelPropertiesConfig>(
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;
}
}
}

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="Config\ConfigReader.cs" />
<Compile Include="Config\EssentialsConfig.cs" />
<Compile Include="Config\DeviceFactory.cs" />
<Compile Include="Factory\DeviceFactory.cs" />
<Compile Include="Devices\Amplifier.cs" />
<Compile Include="Devices\DiscPlayer\OppoExtendedBdp.cs" />
<Compile Include="Devices\NUMERIC AppleTV.cs" />
<Compile Include="ControlSystem.cs" />
<Compile Include="Factory\UiDeviceFactory.cs" />
<Compile Include="OTHER\Fusion\EssentialsHuddleVtc1FusionController.cs" />
<Compile Include="OTHER\Fusion\FusionEventHandlers.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\LargeTouchpanelControllerBase.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\EssentialsHuddleVTC\EssentialsHuddlePresentationUiDriver.cs" />
<Compile Include="UIDrivers\EssentialsHuddle\EssentialsHuddleTechPageDriver.cs" />

View File

@@ -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.*")]

View File

@@ -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<string> DeviceKeys { get; set; }
public EssentialsEnvironmentPropertiesConfig()
{
DeviceKeys = new List<string>();
}
}
public class EssentialsRoomMicrophonePrivacyConfig

View File

@@ -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;

View File

@@ -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<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
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)
: 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<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.
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<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)

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.
/// Want to keep the AvDriver alive, because it may hold states
/// </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; }
CrestronTouchpanelPropertiesConfig Config;
CrestronTouchpanelPropertiesConfig Config;
/// <summary>
/// The main interlock for popups
/// </summary>
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();
}

View File

@@ -14,7 +14,7 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase
public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver
{
CrestronTouchpanelPropertiesConfig Config;
@@ -110,7 +110,7 @@ namespace PepperDash.Essentials
/// <summary>
/// The parent driver for this
/// </summary>
PanelDriverBase Parent;
PanelDriverBase Parent;
/// <summary>
/// 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; }
/// <summary>
/// The driver for the tech page. Lazy getter for memory usage
@@ -311,7 +311,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Reveals the tech page and puts away anything that's in the way.
/// </summary>
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;
//}
/// <summary>

View File

@@ -18,7 +18,7 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVDriver
public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver
{
CrestronTouchpanelPropertiesConfig Config;
@@ -43,10 +43,6 @@ namespace PepperDash.Essentials
/// </summary>
public string DefaultRoomKey { get; set; }
/// <summary>
/// Indicates that the SetHeaderButtons method has completed successfully
/// </summary>
public bool HeaderButtonsAreSetUp { get; private set; }
/// <summary>
///
@@ -68,14 +64,8 @@ namespace PepperDash.Essentials
BoolInputSig ShareButtonSig;
BoolInputSig EndMeetingButtonSig;
//HeaderListButton HeaderCallButton;
//HeaderListButton HeaderGearButton;
StringInputSig HeaderCallButtonIconSig;
BoolFeedback CallSharingInfoVisibleFeedback;
/// <summary>
/// The parent driver for this
/// </summary>
@@ -326,7 +316,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Allows PopupInterlock to be toggled if the calls list is already visible, or if the codec is in a call
/// </summary>
void ShowActiveCallsList()
public void ShowActiveCallsList()
{
TriList.SetBool(UIBoolJoin.CallEndAllConfirmVisible, true);
if(PopupInterlock.CurrentJoin == UIBoolJoin.HeaderActiveCallsListVisible)
@@ -516,7 +506,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Calendar should only be visible when it's supposed to
/// </summary>
void CalendarPress()
public void CalendarPress()
{
//RefreshMeetingsList(); // List should be up-to-date
PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible);
@@ -558,7 +548,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Reveals the tech page and puts away anything that's in the way.
/// </summary>
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
}
/// <summary>
///
/// </summary>
void SetupHeaderButtons()
{
HeaderButtonsAreSetUp = false;
///// <summary>
/////
///// </summary>
//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);
//}
/// <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;
}
///// <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;
}
// 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");
//}
/// <summary>
///
@@ -1510,18 +1500,24 @@ namespace PepperDash.Essentials
}
/// <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>
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();
}
/// <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>
/// Exposes the ability to switch into call mode
/// </summary>
@@ -1530,5 +1526,7 @@ namespace PepperDash.Essentials
/// Allows the codec to trigger the main UI to clear up if call is coming in.
/// </summary>
void PrepareForCodecIncomingCall();
SubpageReferenceList MeetingOrContactMethodModalSrl { get; }
}
}

View File

@@ -23,7 +23,7 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary>
public class EssentialsVideoCodecUiDriver : PanelDriverBase
{
IAVDriver Parent;
IAVWithVCDriver Parent;
/// <summary>
///
@@ -87,12 +87,18 @@ namespace PepperDash.Essentials.UIDrivers.VC
CTimer BackspaceTimer;
/// <summary>
/// The panel header driver
/// </summary>
EssentialsHeaderDriver HeaderDriver;
/// <summary>
///
/// </summary>
/// <param name="triList"></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)
{
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);
}
/// <summary>
@@ -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
/// </summary>
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
/// </summary>
void AcceptIncomingCall(CodecActiveCallItem call)
{
Parent.PrepareForCodecIncomingCall();
Parent.ActivityCallButtonPressed();
(Parent as IAVWithVCDriver).PrepareForCodecIncomingCall();
(Parent as IAVWithVCDriver).ActivityCallButtonPressed();
Codec.AcceptCall(call);
}