Moved CrestronTouchpanelPropertiesConfig down to Essentials.Core so that the DgeController can use it from Essentials.DM. Modified EssentialsTouchpanelController to be able to use a dge100 as a panel. Added UiDeviceFactory condition to build dge100/dmdge200c

This commit is contained in:
Neil Dorin
2019-06-30 10:58:11 -06:00
parent ea2d573ab3
commit 699900518a
5 changed files with 193 additions and 216 deletions

View File

@@ -1,162 +1,185 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI; using Crestron.SimplSharpPro.UI;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.PageManagers; using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.DM.Endpoints.DGEs;
namespace PepperDash.Essentials
{ namespace PepperDash.Essentials
public class UiDeviceFactory {
{ public class UiDeviceFactory
public static IKeyed GetUiDevice(DeviceConfig config) {
{ public static IKeyed GetUiDevice(DeviceConfig config)
var comm = CommFactory.GetControlPropertiesConfig(config); {
var comm = CommFactory.GetControlPropertiesConfig(config);
var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
var typeName = config.Type.ToLower();
EssentialsTouchpanelController panelController = new EssentialsTouchpanelController(config.Key, config.Name, config.Type, props, comm.IpIdInt);
EssentialsTouchpanelController panelController = null;
panelController.AddPostActivationAction(() =>
{ var props = JsonConvert.DeserializeObject<CrestronTouchpanelPropertiesConfig>(config.Properties.ToString());
var mainDriver = new EssentialsPanelMainInterfaceDriver(panelController.Panel, props);
// Then the sub drivers if (typeName.Contains("dge"))
{
// spin up different room drivers depending on room type Dge100 dgeDevice = null;
var room = DeviceManager.GetDeviceForKey(props.DefaultRoomKey); if (typeName == "dge100")
if (room is EssentialsHuddleSpaceRoom) dgeDevice = new Dge100(comm.IpIdInt, Global.ControlSystem);
{ else if (typeName == "dmdge200c")
dgeDevice = new DmDge200C(comm.IpIdInt, Global.ControlSystem);
// Header Driver
Debug.Console(0, panelController, "Adding header driver"); var dgeController = new DgeController(config.Key, config.Name, dgeDevice, config, props);
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
DeviceManager.AddDevice(dgeController);
// AV Driver
Debug.Console(0, panelController, "Adding huddle space AV driver"); panelController = new EssentialsTouchpanelController(config.Key, config.Name, dgeController.DigitalGraphicsEngine,
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); props.ProjectName, props.SgdFile);
avDriver.DefaultRoomKey = props.DefaultRoomKey; }
else
{
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)
{
// Header Driver
Debug.Console(0, panelController, "Adding header driver");
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
Debug.Console(0, panelController, "Adding huddle space AV driver");
var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver; mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom;
// Environment Driver // Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{ {
Debug.Console(0, panelController, "Adding environment driver"); Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
} }
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem) if (panelController.Panel is TswFt5ButtonSystem)
{ {
var tsw = panelController.Panel as TswFt5ButtonSystem; var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys // Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); }); tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if(mainDriver.EnvironmentDriver != null) if(mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b => tsw.Lights.UserObject = new Action<bool>(b =>
{ {
if (!b) if (!b)
{ {
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle(); mainDriver.EnvironmentDriver.Toggle();
} }
}); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress); tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress); tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
} }
} }
//else if (room is EssentialsPresentationRoom) //else if (room is EssentialsPresentationRoom)
//{ //{
// Debug.Console(0, panelController, "Adding presentation room driver"); // Debug.Console(0, panelController, "Adding presentation room driver");
// var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props); // var avDriver = new EssentialsPresentationPanelAvFunctionsDriver(mainDriver, props);
// avDriver.CurrentRoom = room as EssentialsPresentationRoom; // avDriver.CurrentRoom = room as EssentialsPresentationRoom;
// avDriver.DefaultRoomKey = props.DefaultRoomKey; // avDriver.DefaultRoomKey = props.DefaultRoomKey;
// mainDriver.AvDriver = avDriver ; // mainDriver.AvDriver = avDriver ;
// mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); // mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// panelController.LoadAndShowDriver(mainDriver); // panelController.LoadAndShowDriver(mainDriver);
// if (panelController.Panel is TswFt5ButtonSystem) // if (panelController.Panel is TswFt5ButtonSystem)
// { // {
// var tsw = panelController.Panel as TswFt5ButtonSystem; // var tsw = panelController.Panel as TswFt5ButtonSystem;
// // Wire up hard keys // // Wire up hard keys
// tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); }); // tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.PowerButtonPressed(); });
// //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); // //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
// tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress); // tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
// tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress); // tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
// } // }
//} //}
else if (room is EssentialsHuddleVtc1Room) else if (room is EssentialsHuddleVtc1Room)
{ {
Debug.Console(0, panelController, "Adding huddle space VTC AV driver"); Debug.Console(0, panelController, "Adding huddle space VTC AV driver");
// Header Driver // Header Driver
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props); mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver // AV Driver
var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props);
var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
(room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver);
avDriver.SetVideoCodecDriver(codecDriver); avDriver.SetVideoCodecDriver(codecDriver);
avDriver.DefaultRoomKey = props.DefaultRoomKey; avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver; mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room; avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
// Environment Driver // Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0) if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{ {
Debug.Console(0, panelController, "Adding environment driver"); Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props); mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment); mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
} }
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom); mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (panelController.Panel is TswFt5ButtonSystem) if (panelController.Panel is TswFt5ButtonSystem)
{ {
var tsw = panelController.Panel as TswFt5ButtonSystem; var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys // Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); }); tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); }); //tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if (mainDriver.EnvironmentDriver != null) if (mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b => tsw.Lights.UserObject = new Action<bool>(b =>
{ {
if (!b) if (!b)
{ {
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle(); mainDriver.EnvironmentDriver.Toggle();
} }
}); });
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress); tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress); tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
} }
} }
else else
{ {
Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey); Debug.Console(0, panelController, "ERROR: Cannot load AvFunctionsDriver for room '{0}'", props.DefaultRoomKey);
} }
}); });
return panelController; return panelController;
} }
} }
} }

View File

@@ -222,7 +222,6 @@
<Compile Include="AppServer\CotijaSystemController.cs" /> <Compile Include="AppServer\CotijaSystemController.cs" />
<Compile Include="UI\DualDisplaySourceSRLController.cs" /> <Compile Include="UI\DualDisplaySourceSRLController.cs" />
<Compile Include="UI\SubpageReferenceListActivityItem.cs" /> <Compile Include="UI\SubpageReferenceListActivityItem.cs" />
<Compile Include="UI\CrestronTouchpanelPropertiesConfig.cs" />
<Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" /> <Compile Include="FOR REFERENCE UI\Panels\REMOVE UiCue.cs" />
<Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" /> <Compile Include="FOR REFERENCE UI\SRL\SourceListSubpageReferenceList.cs" />
<Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" /> <Compile Include="Room\Types\EssentialsHuddleSpaceRoom.cs" />

View File

@@ -1,48 +0,0 @@
namespace PepperDash.Essentials
{
public class CrestronTouchpanelPropertiesConfig
{
public string IpId { get; set; }
public string DefaultRoomKey { get; set; }
public string RoomListKey { get; set; }
public string SgdFile { get; set; }
public string ProjectName { get; set; }
public bool ShowVolumeGauge { get; set; }
public bool UsesSplashPage { get; set; }
public bool ShowDate { get; set; }
public bool ShowTime { get; set; }
public UiSetupPropertiesConfig Setup { get; set; }
public string HeaderStyle { get; set; }
public bool IncludeInFusionRoomHealth { get; set; }
/// <summary>
/// The count of sources that will trigger the "additional" arrows to show on the SRL.
/// Defaults to 5
/// </summary>
public int SourcesOverflowCount { get; set; }
public CrestronTouchpanelPropertiesConfig()
{
SourcesOverflowCount = 5;
HeaderStyle = CrestronTouchpanelPropertiesConfig.Habanero;
}
/// <summary>
/// "habanero"
/// </summary>
public const string Habanero = "habanero";
/// <summary>
/// "verbose"
/// </summary>
public const string Verbose = "verbose";
}
/// <summary>
///
/// </summary>
public class UiSetupPropertiesConfig
{
public bool IsVisible { get; set; }
}
}

View File

@@ -27,9 +27,17 @@ namespace PepperDash.Essentials
{ {
Panel = tsw; Panel = tsw;
tsw.LoadSmartObjects(sgdPath); tsw.LoadSmartObjects(sgdPath);
tsw.SigChange += new Crestron.SimplSharpPro.DeviceSupport.SigEventHandler(Tsw_SigChange); tsw.SigChange += Panel_SigChange;
} }
public EssentialsTouchpanelController(string key, string name, Dge100 panel, string projectName, string sgdPath)
: base(key, name)
{
Panel = panel;
panel.LoadSmartObjects(sgdPath);
panel.SigChange += Panel_SigChange;
}
/// <summary> /// <summary>
/// Config constructor /// Config constructor
/// </summary> /// </summary>
@@ -65,11 +73,6 @@ namespace PepperDash.Essentials
Panel = new Tsw1052(id, Global.ControlSystem); Panel = new Tsw1052(id, Global.ControlSystem);
else if (type == "tsw1060") else if (type == "tsw1060")
Panel = new Tsw1060(id, Global.ControlSystem); Panel = new Tsw1060(id, Global.ControlSystem);
else if (type.Contains("dge"))
{
// TODO: Figure out how to get the trilist from a DgeController device
//Panel =
}
else else
{ {
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type);
@@ -107,7 +110,7 @@ namespace PepperDash.Essentials
} }
Panel.LoadSmartObjects(sgdName); Panel.LoadSmartObjects(sgdName);
Panel.SigChange += Tsw_SigChange; Panel.SigChange += Panel_SigChange;
} }
@@ -163,7 +166,7 @@ namespace PepperDash.Essentials
} }
} }
void Tsw_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args) void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
{ {
if (Debug.Level == 2) if (Debug.Level == 2)
Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue); Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);