Merge branch 'development' of http://code.pepperdash.net/scm/pec/essentials into development

This commit is contained in:
Heath Volmer
2018-06-15 14:11:17 -06:00
6 changed files with 351 additions and 202 deletions

View File

@@ -59,7 +59,7 @@ namespace PepperDash.Essentials
"Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl); "Template URL: {1}", ConfigReader.ConfigObject.SystemUrl, ConfigReader.ConfigObject.TemplateUrl);
}, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator); }, "portalinfo", "Shows portal URLS from configuration", ConsoleAccessLevelEnum.AccessOperator);
GoWithLoad(); //GoWithLoad();
} }
/// <summary> /// <summary>

View File

@@ -1005,6 +1005,10 @@ namespace PepperDash.Essentials.Fusion
/// </summary> /// </summary>
void SetUpCommunitcationMonitors() void SetUpCommunitcationMonitors()
{ {
uint displayNum = 0;
uint touchpanelNum = 0;
uint xpanelNum = 0;
// Attach to all room's devices with monitors. // Attach to all room's devices with monitors.
//foreach (var dev in DeviceManager.Devices) //foreach (var dev in DeviceManager.Devices)
foreach (var dev in DeviceManager.GetDevices()) foreach (var dev in DeviceManager.GetDevices())
@@ -1012,41 +1016,56 @@ namespace PepperDash.Essentials.Fusion
if (!(dev is ICommunicationMonitor)) if (!(dev is ICommunicationMonitor))
continue; continue;
var keyNum = ExtractNumberFromKey(dev.Key);
if (keyNum == -1)
{
Debug.Console(1, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes",
dev.Key);
continue;
}
string attrName = null; string attrName = null;
uint attrNum = Convert.ToUInt32(keyNum); uint attrNum = 1;
if (dev is EssentialsTouchpanelController) //var keyNum = ExtractNumberFromKey(dev.Key);
//if (keyNum == -1)
//{
// Debug.Console(1, this, "WARNING: Cannot link device '{0}' to numbered Fusion monitoring attributes",
// dev.Key);
// continue;
//}
//uint attrNum = Convert.ToUInt32(keyNum);
// Check for UI devices
var uiDev = dev as EssentialsTouchpanelController;
if (uiDev != null)
{ {
if ((dev as EssentialsTouchpanelController).Panel is Crestron.SimplSharpPro.DeviceSupport.TswFt5Button) if (uiDev.Panel is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
{
if (attrNum > 10)
continue;
attrName = "Online - Touch Panel " + attrNum;
attrNum += 150;
}
else if ((dev as EssentialsTouchpanelController).Panel is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
{ {
attrNum = attrNum + touchpanelNum;
if (attrNum > 10) if (attrNum > 10)
continue; continue;
attrName = "Online - XPanel " + attrNum; attrName = "Online - XPanel " + attrNum;
attrNum += 160; attrNum += 160;
touchpanelNum++;
}
else
{
attrNum = attrNum + xpanelNum;
if (attrNum > 10)
continue;
attrName = "Online - Touch Panel " + attrNum;
attrNum += 150;
xpanelNum++;
} }
} }
//else //else
if (dev is DisplayBase) if (dev is DisplayBase)
{ {
attrNum = attrNum + displayNum;
if (attrNum > 10) if (attrNum > 10)
continue; continue;
attrName = "Online - Display " + attrNum; attrName = "Online - Display " + attrNum;
attrNum += 170; attrNum += 170;
displayNum++;
} }
//else if (dev is DvdDeviceBase) //else if (dev is DvdDeviceBase)
//{ //{
@@ -1265,7 +1284,7 @@ namespace PepperDash.Essentials.Fusion
/// <returns>-1 if no number matched</returns> /// <returns>-1 if no number matched</returns>
int ExtractNumberFromKey(string key) int ExtractNumberFromKey(string key)
{ {
var capture = System.Text.RegularExpressions.Regex.Match(key, @"\D+(\d+)"); var capture = System.Text.RegularExpressions.Regex.Match(key, @"\b(\d+)");
if (!capture.Success) if (!capture.Success)
return -1; return -1;
else return Convert.ToInt32(capture.Groups[1].Value); else return Convert.ToInt32(capture.Groups[1].Value);

View File

@@ -13,6 +13,8 @@
public bool ShowTime { get; set; } public bool ShowTime { get; set; }
public UiSetupPropertiesConfig Setup { get; set; } public UiSetupPropertiesConfig Setup { get; set; }
public string HeaderStyle { get; set; } public string HeaderStyle { get; set; }
public bool IncludeInFusionRoomHealth { get; set; }
/// <summary> /// <summary>
/// The count of sources that will trigger the "additional" arrows to show on the SRL. /// The count of sources that will trigger the "additional" arrows to show on the SRL.

View File

@@ -1,4 +1,4 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@@ -13,10 +13,14 @@ using PepperDash.Essentials.Core.PageManagers;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
public class EssentialsTouchpanelController : Device public class EssentialsTouchpanelController : Device, ICommunicationMonitor
{ {
public BasicTriListWithSmartObject Panel { get; private set; } public BasicTriListWithSmartObject Panel { get; private set; }
public StatusMonitorBase CommunicationMonitor { get; private set; }
public bool IncludeInFusionRoomHealth { get; private set; }
public PanelDriverBase PanelDriver { get; private set; } public PanelDriverBase PanelDriver { get; private set; }
CTimer BacklightTransitionedOnTimer; CTimer BacklightTransitionedOnTimer;
@@ -36,8 +40,9 @@ 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)
{ {
IncludeInFusionRoomHealth = props.IncludeInFusionRoomHealth;
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Creating touchpanel hardware..."); Debug.Console(0, this, "Creating hardware...");
type = type.ToLower(); type = type.ToLower();
try try
{ {
@@ -65,18 +70,67 @@ 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 == "xpanel")
Panel = new XpanelForSmartGraphics(id, Global.ControlSystem);
else else
{ {
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW controller with type '{0}'", type); Debug.Console(0, this, "WARNING: Cannot create TSW controller with type '{0}'", type);
return; return;
} }
} }
catch (Exception e) catch (Exception e)
{ {
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message); Debug.Console(0, this, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message);
return; return;
} }
CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, Panel, 30000, 120000);
AddPostActivationAction(() =>
{
//Debug.Console(0, this, "Creating 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 if (type == "xpanel")
// Panel = new XpanelForSmartGraphics(id, Global.ControlSystem);
// else
// {
// Debug.Console(0, this, "WARNING: Cannot create TSW controller with type '{0}'", type);
// return;
// }
//}
//catch (Exception e)
//{
// Debug.Console(0, this, "WARNING: Cannot create TSW base class. Panel will not function: {0}", e.Message);
// return;
//}
// Reserved sigs // Reserved sigs
if (Panel is TswFt5ButtonSystem) if (Panel is TswFt5ButtonSystem)
{ {
@@ -84,17 +138,17 @@ namespace PepperDash.Essentials
tsw.ExtenderSystemReservedSigs.Use(); tsw.ExtenderSystemReservedSigs.Use();
tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange tsw.ExtenderSystemReservedSigs.DeviceExtenderSigChange
+= ExtenderSystemReservedSigs_DeviceExtenderSigChange; += ExtenderSystemReservedSigs_DeviceExtenderSigChange;
tsw.ButtonStateChange += new ButtonEventHandler(Tsw_ButtonStateChange);
} }
if (Panel.Register() != eDeviceRegistrationUnRegistrationResponse.Success) //CrestronInvoke.BeginInvoke(o =>
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "WARNING: Registration failed. Continuing, but panel may not function: {0}", Panel.RegistrationFailureReason); // {
var regSuccess = Panel.Register();
if (regSuccess != eDeviceRegistrationUnRegistrationResponse.Success)
Debug.Console(0, this, "WARNING: Registration failed. Continuing, but panel may not function: {0}", regSuccess);
// Give up cleanly if SGD is not present. // Give up cleanly if SGD is not present.
var sgdName = Global.FilePathPrefix var sgdName = @"\NVRAM\Program" + InitialParametersClass.ApplicationNumber
+ Global.DirectorySeparator + "sgd" + Global.DirectorySeparator + props.SgdFile; + @"\sgd\" + props.SgdFile;
if (!File.Exists(sgdName)) if (!File.Exists(sgdName))
{ {
Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName); Debug.Console(0, this, "ERROR: Smart object file '{0}' not present. Exiting TSW load", sgdName);
@@ -104,6 +158,80 @@ namespace PepperDash.Essentials
Panel.LoadSmartObjects(sgdName); Panel.LoadSmartObjects(sgdName);
Panel.SigChange += Tsw_SigChange; Panel.SigChange += Tsw_SigChange;
var mainDriver = new EssentialsPanelMainInterfaceDriver(Panel, props);
// Then the AV driver
// 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.
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.
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)