Adding DualDisplay to build methods

This commit is contained in:
Andrew Welker
2020-07-17 15:42:19 -06:00
parent d6a6791e7b
commit ffaff91ed2
5 changed files with 105 additions and 54 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharp.CrestronIO;
using Crestron.SimplSharpPro;
@@ -12,10 +11,9 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Bridges;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Fusion;
using PepperDash.Essentials.Core.Rooms.Config;
using PepperDash.Essentials.DM;
using PepperDash.Essentials.Fusion;
using PepperDash.Essentials.Room.Config;
//using PepperDash.Essentials.Room.MobileControl;
using Newtonsoft.Json;
@@ -440,68 +438,71 @@ namespace PepperDash.Essentials
{
if (ConfigReader.ConfigObject.Rooms == null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "NOTICE: No Essentials Rooms found in current configuration.");
Debug.Console(0, Debug.ErrorLogLevel.Warning, "WARNING: Configuration contains no rooms");
return;
}
foreach (var roomConfig in ConfigReader.ConfigObject.Rooms)
{
var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase;
if (room == null)
if (room != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
return;
}
var huddleRoom = room as EssentialsHuddleSpaceRoom;
if (huddleRoom != null)
{
DeviceManager.AddDevice(huddleRoom);
var huddleRoom = room as EssentialsHuddleSpaceRoom;
var vtcRoom = room as EssentialsHuddleVtc1Room;
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(
new EssentialsHuddleSpaceFusionSystemControllerBase(huddleRoom, 0xf1));
if (huddleRoom != null)
{
DeviceManager.AddDevice(huddleRoom);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
//var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room as EssentialsHuddleSpaceRoom);
//AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
//DeviceManager.AddDevice(bridge);
CreateMobileControlBridge(room);
CreateMobileControlBridge(huddleRoom);
continue;
}
else if (room is EssentialsHuddleVtc1Room)
{
DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(huddleRoom);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
var ddRoom = room as EssentialsDualDisplayRoom;
//checking for dual display room first, as it inherits from EssentialsHuddleVtc1Room
if (ddRoom != null)
{
DeviceManager.AddDevice(ddRoom);
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Room is EssentialsDualDisplayRoom, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController(ddRoom, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
//var bridge = new MobileConrolEssentialsHuddleSpaceRoomBridge(room);
//AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
//DeviceManager.AddDevice(bridge);
CreateMobileControlBridge(room);
CreateMobileControlBridge(ddRoom);
continue;
}
else
var vtc1Room = room as EssentialsHuddleVtc1Room;
if (vtc1Room != null)
{
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
DeviceManager.AddDevice(room);
DeviceManager.AddDevice(vtc1Room);
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Room is EssentialsHuddleVtc1Room, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleVtc1FusionController(vtc1Room, 0xf1));
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
CreateMobileControlBridge(vtc1Room);
continue;
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Attempting to build Mobile Control Bridge...");
// Mobile Control bridge
var bridge = new MobileControlEssentialsHuddleSpaceRoomBridge(room);
AddBridgePostActivationHelper(bridge); // Lets things happen later when all devices are present
DeviceManager.AddDevice(bridge);
continue;
}
Debug.Console(0, Debug.ErrorLogLevel.Notice,
"Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
DeviceManager.AddDevice(room);
Debug.Console(0, Debug.ErrorLogLevel.Notice, "Room is NOT EssentialsRoom, attempting to add to DeviceManager w/o Fusion");
DeviceManager.AddDevice(room);
}
else
Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'",
roomConfig.Key);
}
Debug.Console(0, Debug.ErrorLogLevel.Notice, "All Rooms Loaded.");

View File

@@ -11,6 +11,7 @@ using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.PageManagers;
using PepperDashEssentials.UIDrivers.EssentialsDualDisplay;
namespace PepperDash.Essentials
{
@@ -178,7 +179,7 @@ namespace PepperDash.Essentials
}
}
void Panel_SigChange(object currentDevice, Crestron.SimplSharpPro.SigEventArgs args)
void Panel_SigChange(object currentDevice, SigEventArgs args)
{
if (Debug.Level == 2)
Debug.Console(2, this, "Sig change: {0} {1}={2}", args.Sig.Type, args.Sig.Number, args.Sig.StringValue);
@@ -271,6 +272,56 @@ namespace PepperDash.Essentials
tsw.Up.UserObject = new Action<bool>(avDriver.VolumeUpPress);
tsw.Down.UserObject = new Action<bool>(avDriver.VolumeDownPress);
}
else if (room is EssentialsDualDisplayRoom)
{
Debug.Console(0, panelController, "Adding Dual Display VTC AV driver");
// Header Driver
mainDriver.HeaderDriver = new EssentialsHeaderDriver(mainDriver, props);
// AV Driver
var avDriver = new EssentialsDualDisplayPanelAvFunctionsDriver(mainDriver, props);
var codecDriver = new UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver,
(room as EssentialsDualDisplayRoom).VideoCodec, mainDriver.HeaderDriver);
avDriver.SetVideoCodecDriver(codecDriver);
avDriver.DefaultRoomKey = props.DefaultRoomKey;
mainDriver.AvDriver = avDriver;
avDriver.CurrentRoom = room as EssentialsHuddleVtc1Room;
// Environment Driver
if (avDriver.CurrentRoom.PropertiesConfig.Environment != null && avDriver.CurrentRoom.PropertiesConfig.Environment.DeviceKeys.Count > 0)
{
Debug.Console(0, panelController, "Adding environment driver");
mainDriver.EnvironmentDriver = new EssentialsEnvironmentDriver(mainDriver, props);
mainDriver.EnvironmentDriver.GetDevicesFromConfig(avDriver.CurrentRoom.PropertiesConfig.Environment);
}
mainDriver.HeaderDriver.SetupHeaderButtons(avDriver, avDriver.CurrentRoom);
panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted.
if (!(panelController.Panel is TswFt5ButtonSystem))
{
return;
}
var tsw = panelController.Panel as TswFt5ButtonSystem;
// Wire up hard keys
tsw.Power.UserObject = new Action<bool>(b => { if (!b) avDriver.EndMeetingPress(); });
//tsw.Home.UserObject = new Action<bool>(b => { if (!b) HomePressed(); });
if (mainDriver.EnvironmentDriver != null)
tsw.Lights.UserObject = new Action<bool>(b =>
{
if (!b)
{
//mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin);
mainDriver.EnvironmentDriver.Toggle();
}
});
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 VTC AV driver");

View File

@@ -12,7 +12,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay
{
private EssentialsDualDisplayRoom _currentRoom;
private BoolInputSig _routeToggleVisibility;
private readonly BoolInputSig _routeToggleVisibility;
private readonly BoolFeedback _sharingMode;

View File

@@ -46,14 +46,14 @@ namespace PepperDash.Essentials.Core.Config
public Dictionary<string, DestinationListItem> GetDestinationListForKey(string key)
{
if (string.IsNullOrEmpty(key) || !SourceLists.ContainsKey(key))
if (string.IsNullOrEmpty(key) || !DestinationLists.ContainsKey(key))
return null;
return DestinationLists[key];
}
/// <summary>
/// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, retunes null
/// Checks Devices for an item with a Key that matches and returns it if found. Otherwise, returns null
/// </summary>
/// <param name="key">Key of desired device</param>
/// <returns></returns>

View File

@@ -18,8 +18,7 @@ namespace PepperDash.Essentials.Core.Rooms.Config
{
var typeName = roomConfig.Type.ToLower();
EssentialsRoomBase rm;
if (typeName == "huddle")
if (typeName == "huddle")
{
var huddle = new EssentialsHuddleSpaceRoom(roomConfig);
@@ -27,22 +26,22 @@ namespace PepperDash.Essentials.Core.Rooms.Config
}
if (typeName == "huddlevtc1")
{
rm = new EssentialsHuddleVtc1Room(roomConfig);
EssentialsRoomBase rm = new EssentialsHuddleVtc1Room(roomConfig);
return rm;
}
if (typeName == "ddvc01Bridge")
{
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
}
if (typeName != "dualdisplay")
{
return null;
}
//rm = new EssentialsDualDisplayRoom();
return null;
var dualDisplay = new EssentialsDualDisplayRoom(roomConfig);
return dualDisplay;
}
/// <summary>