Merge branch 'development' into feature/add-queues

This commit is contained in:
Nick Genovese
2020-09-03 11:05:40 -04:00
committed by GitHub
10 changed files with 429 additions and 310 deletions

View File

@@ -424,10 +424,14 @@ namespace PepperDash.Essentials
{ {
if (string.IsNullOrEmpty(sourceListKey)) if (string.IsNullOrEmpty(sourceListKey))
{ {
Debug.Console(1, this, "No sourceListKey present. RunRouteAction assumes default source list.");
RunRouteAction(routeKey, new Action(() => { })); RunRouteAction(routeKey, new Action(() => { }));
} }
else else
{
Debug.Console(1, this, "sourceListKey present but not yet implemented");
throw new NotImplementedException(); throw new NotImplementedException();
}
} }
/// <summary> /// <summary>

View File

@@ -272,6 +272,20 @@ namespace PepperDash.Essentials
public const uint VCCameraPreset3 = 1283; public const uint VCCameraPreset3 = 1283;
/// <summary>
/// 1291
/// </summary>
public const uint VCCameraPreset1Visible = 1291;
/// <summary>
/// 1292
/// </summary>
public const uint VCCameraPreset2Visible = 1292;
/// <summary>
/// 1293
/// </summary>
public const uint VCCameraPreset3Visible = 1293;
// Letter joins start at 2921; // Letter joins start at 2921;
//****************************************************** //******************************************************

View File

@@ -2,6 +2,7 @@
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Crestron.SimplSharpPro.UI; using Crestron.SimplSharpPro.UI;
using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.SmartObjects; using PepperDash.Essentials.Core.SmartObjects;
@@ -10,7 +11,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class EssentialsPanelMainInterfaceDriver : PanelDriverBase public class EssentialsPanelMainInterfaceDriver : PanelDriverBase, IHasScreenSaverController
{ {
CTimer InactivityTimer; CTimer InactivityTimer;
@@ -18,7 +19,7 @@ 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 IAVDriver AvDriver { get; set; } public IAVDriver AvDriver { get; set;}
public EssentialsHeaderDriver HeaderDriver { get; set; } public EssentialsHeaderDriver HeaderDriver { get; set; }
@@ -102,6 +103,7 @@ namespace PepperDash.Essentials
{ {
CurrentChildDriver = null; CurrentChildDriver = null;
ShowSubDriver(AvDriver as PanelDriverBase); ShowSubDriver(AvDriver as PanelDriverBase);
base.Show(); base.Show();
} }
@@ -129,4 +131,9 @@ namespace PepperDash.Essentials
CurrentChildDriver.BackButtonPressed(); CurrentChildDriver.BackButtonPressed();
} }
} }
public interface IHasScreenSaverController
{
ScreenSaverController ScreenSaverController { get; }
}
} }

View File

@@ -114,7 +114,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// The parent driver for this /// The parent driver for this
/// </summary> /// </summary>
PanelDriverBase Parent; public PanelDriverBase Parent { get; private set; }
/// <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.

View File

@@ -72,7 +72,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// The parent driver for this /// The parent driver for this
/// </summary> /// </summary>
PanelDriverBase Parent; public PanelDriverBase Parent { get; private set; }
/// <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.
@@ -1430,6 +1430,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public interface IAVDriver public interface IAVDriver
{ {
PanelDriverBase Parent { get; }
JoinedSigInterlock PopupInterlock { get; } JoinedSigInterlock PopupInterlock { get; }
void ShowNotificationRibbon(string message, int timeout); void ShowNotificationRibbon(string message, int timeout);
void HideNotificationRibbon(); void HideNotificationRibbon();

View File

@@ -21,6 +21,8 @@ namespace PepperDash.Essentials
private readonly EssentialsPanelMainInterfaceDriver _parent; private readonly EssentialsPanelMainInterfaceDriver _parent;
private JoinedSigInterlock PositionInterlock;
CTimer PositionTimer; CTimer PositionTimer;
uint PositionTimeoutMs; uint PositionTimeoutMs;
@@ -38,7 +40,9 @@ namespace PepperDash.Essentials
PositionJoins = new List<uint>() { UIBoolJoin.MCScreenSaverPosition1Visible, UIBoolJoin.MCScreenSaverPosition2Visible, UIBoolJoin.MCScreenSaverPosition3Visible, UIBoolJoin.MCScreenSaverPosition4Visible }; PositionJoins = new List<uint>() { UIBoolJoin.MCScreenSaverPosition1Visible, UIBoolJoin.MCScreenSaverPosition2Visible, UIBoolJoin.MCScreenSaverPosition3Visible, UIBoolJoin.MCScreenSaverPosition4Visible };
var cmdName = String.Format("shwscrsvr-{0}", config.IpId); PositionInterlock = new JoinedSigInterlock(parent.TriList);
var cmdName = String.Format("shwscrsvr-{0}", parent.TriList.ID);
CrestronConsole.AddNewConsoleCommand((o) => Show(), cmdName, "Shows Panel Screensaver", ConsoleAccessLevelEnum.AccessOperator); CrestronConsole.AddNewConsoleCommand((o) => Show(), cmdName, "Shows Panel Screensaver", ConsoleAccessLevelEnum.AccessOperator);
@@ -47,10 +51,13 @@ namespace PepperDash.Essentials
public override void Show() public override void Show()
{ {
_parent.AvDriver.PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MCScreenSaverVisible); if (_parent.AvDriver != null)
{
_parent.AvDriver.PopupInterlock.ShowInterlocked(UIBoolJoin.MCScreenSaverVisible);
}
CurrentPositionIndex = 0; CurrentPositionIndex = 0;
SetCurrentPosition(); ShowCurrentPosition();
StartPositionTimer(); StartPositionTimer();
base.Show(); base.Show();
@@ -58,6 +65,8 @@ namespace PepperDash.Essentials
public override void Hide() public override void Hide()
{ {
Debug.Console(1, "Hiding ScreenSaverController");
if (PositionTimer != null) if (PositionTimer != null)
{ {
PositionTimer.Stop(); PositionTimer.Stop();
@@ -67,7 +76,10 @@ namespace PepperDash.Essentials
ClearAllPositions(); ClearAllPositions();
_parent.AvDriver.PopupInterlock.HideAndClear(); if (_parent.AvDriver != null)
{
_parent.AvDriver.PopupInterlock.HideAndClear();
}
base.Hide(); base.Hide();
} }
@@ -89,7 +101,7 @@ namespace PepperDash.Essentials
{ {
IncrementPositionIndex(); IncrementPositionIndex();
SetCurrentPosition(); ShowCurrentPosition();
StartPositionTimer(); StartPositionTimer();
} }
@@ -109,20 +121,16 @@ namespace PepperDash.Essentials
} }
// //
void SetCurrentPosition() void ShowCurrentPosition()
{ {
ClearAllPositions();
// Set based on current index // Set based on current index
TriList.SetBool(PositionJoins[CurrentPositionIndex], true); PositionInterlock.ShowInterlocked(PositionJoins[CurrentPositionIndex]);
} }
void ClearAllPositions() void ClearAllPositions()
{ {
foreach (var join in PositionJoins) Debug.Console(1, "Hiding all screensaver positions");
{ PositionInterlock.HideAndClear();
TriList.SetBool(join, false);
}
} }
} }

View File

@@ -398,6 +398,8 @@ namespace PepperDash.Essentials.UIDrivers.VC
/// </summary> /// </summary>
void ShowIncomingModal(CodecActiveCallItem call) void ShowIncomingModal(CodecActiveCallItem call)
{ {
Debug.Console(1, "Showing Incoming Call Modal");
(Parent as IAVWithVCDriver).PrepareForCodecIncomingCall(); (Parent as IAVWithVCDriver).PrepareForCodecIncomingCall();
IncomingCallModal = new ModalDialog(TriList); IncomingCallModal = new ModalDialog(TriList);
string msg; string msg;
@@ -413,13 +415,19 @@ namespace PepperDash.Essentials.UIDrivers.VC
msg = string.Format("Incoming video call from: {0}", call.Name); msg = string.Format("Incoming video call from: {0}", call.Name);
} }
if (Parent.PopupInterlock.IsShown)
// Hide screensaver
var screenSaverParent = Parent.Parent as IHasScreenSaverController;
if (screenSaverParent != null)
{ {
if (Parent.PopupInterlock.CurrentJoin == UIBoolJoin.MCScreenSaverVisible) screenSaverParent.ScreenSaverController.Hide();
{
Parent.PopupInterlock.HideAndClear();
}
} }
else
{
Debug.Console(1, "Parent.Parent is null or does not implement IHasScreenSaverController");
}
IncomingCallModal.PresentModalDialog(2, "Incoming Call", icon, msg, IncomingCallModal.PresentModalDialog(2, "Incoming Call", icon, msg,
"Ignore", "Accept", false, false, b => "Ignore", "Accept", false, false, b =>
@@ -709,17 +717,45 @@ namespace PepperDash.Essentials.UIDrivers.VC
uint holdTime = 5000; uint holdTime = 5000;
presetsCodec.CodecRoomPresetsListHasChanged += new EventHandler<EventArgs>(presetsCodec_CodecRoomPresetsListHasChanged); presetsCodec.CodecRoomPresetsListHasChanged += new EventHandler<EventArgs>(presetsCodec_CodecRoomPresetsListHasChanged);
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction( var preset = 1;
holdTime, () => presetsCodec.CodecRoomPresetStore(1, presetsCodec.NearEndPresets[0].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(1)); if (presetsCodec.NearEndPresets[preset - 1] != null && presetsCodec.NearEndPresets[preset - 1].Defined)
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction( {
holdTime, () => presetsCodec.CodecRoomPresetStore(2, presetsCodec.NearEndPresets[1].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(2)); TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, true);
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction( TriList.BooleanOutput[UIBoolJoin.VCCameraPreset1].SetSigHeldAction(
holdTime, () => presetsCodec.CodecRoomPresetStore(3, presetsCodec.NearEndPresets[2].Description), ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetSelect(3)); holdTime, ShowPresetStoreFeedback,() => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description),
() => presetsCodec.CodecRoomPresetSelect(preset));
TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[preset - 1].Description;
}
else
{
TriList.SetBool(UIBoolJoin.VCCameraPreset1Visible, false);
}
TriList.StringInput[UIStringJoin.VCCameraPresetLabel1].StringValue = presetsCodec.NearEndPresets[0].Description; if (presetsCodec.NearEndPresets[1] != null && presetsCodec.NearEndPresets[1].Defined)
TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description; {
TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description; TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, true);
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset2].SetSigHeldAction(
holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description),
() => presetsCodec.CodecRoomPresetSelect(preset));
TriList.StringInput[UIStringJoin.VCCameraPresetLabel2].StringValue = presetsCodec.NearEndPresets[1].Description;
}
else
{
TriList.SetBool(UIBoolJoin.VCCameraPreset2Visible, false);
}
if (presetsCodec.NearEndPresets[2] != null && presetsCodec.NearEndPresets[2].Defined)
{
TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, true);
TriList.BooleanOutput[UIBoolJoin.VCCameraPreset3].SetSigHeldAction(
holdTime, ShowPresetStoreFeedback, () => presetsCodec.CodecRoomPresetStore(preset, presetsCodec.NearEndPresets[preset - 1].Description),
() => presetsCodec.CodecRoomPresetSelect(preset));
TriList.StringInput[UIStringJoin.VCCameraPresetLabel3].StringValue = presetsCodec.NearEndPresets[2].Description;
}
else
{
TriList.SetBool(UIBoolJoin.VCCameraPreset3Visible, false);
}
} }
} }

View File

@@ -124,7 +124,7 @@ namespace PepperDash.Essentials.Core
Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey); Debug.Console(0, "WARNING: device with IR ports '{0}' not found", portDevKey);
return null; return null;
} }
if (portNum >= irDev.NumberOfIROutputPorts) if (portNum > irDev.NumberOfIROutputPorts)
{ {
Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range", Debug.Console(0, "WARNING: device '{0}' IR port {1} out of range",
portDevKey, portNum); portDevKey, portNum);
@@ -134,10 +134,9 @@ namespace PepperDash.Essentials.Core
var port = irDev.IROutputPorts[portNum]; var port = irDev.IROutputPorts[portNum];
port.LoadIRDriver(Global.FilePathPrefix + "IR" + Global.DirectorySeparator + control["irFile"].Value<string>());
return port; return port;
} }
public static IrOutputPortController GetIrOutputPortController(DeviceConfig config) public static IrOutputPortController GetIrOutputPortController(DeviceConfig config)
@@ -149,7 +148,8 @@ namespace PepperDash.Essentials.Core
return null; return null;
} }
var irDevice = new IrOutputPortController(config.Key, GetIrOutputPort, config); var postActivationFunc = new Func<DeviceConfig,IROutputPort> (GetIrOutputPort);
var irDevice = new IrOutputPortController(config.Key + "-ir", postActivationFunc, config);
return irDevice; return irDevice;
} }

View File

@@ -25,6 +25,8 @@ namespace PepperDash.Essentials.Core
public string DriverFilepath { get; private set; } public string DriverFilepath { get; private set; }
public bool DriverIsLoaded { get; private set; } public bool DriverIsLoaded { get; private set; }
public string[] IrFileCommands { get { return IrPort.AvailableStandardIRCmds(IrPortUid); } }
/// <summary> /// <summary>
/// Constructor for IrDevice base class. If a null port is provided, this class will /// Constructor for IrDevice base class. If a null port is provided, this class will
/// still function without trying to talk to a port. /// still function without trying to talk to a port.
@@ -49,9 +51,30 @@ namespace PepperDash.Essentials.Core
AddPostActivationAction(() => AddPostActivationAction(() =>
{ {
IrPort = postActivationFunc(config); IrPort = postActivationFunc(config);
if (IrPort == null)
{
Debug.Console(0, this, "WARNING No valid IR Port assigned to controller. IR will not function");
return;
}
var filePath = Global.FilePathPrefix + "ir" + Global.DirectorySeparator + config.Properties["control"]["irFile"].Value<string>();
Debug.Console(1, "*************Attemting to load IR file: {0}***************", filePath);
LoadDriver(filePath);
PrintAvailableCommands();
}); });
} }
public void PrintAvailableCommands()
{
Debug.Console(2, this, "Available IR Commands in IR File {0}", IrPortUid);
foreach (var cmd in IrPort.AvailableIRCmds())
{
Debug.Console(2, this, "{0}", cmd);
}
}
/// <summary> /// <summary>
@@ -60,14 +83,15 @@ namespace PepperDash.Essentials.Core
/// <param name="path"></param> /// <param name="path"></param>
public void LoadDriver(string path) public void LoadDriver(string path)
{ {
Debug.Console(2, this, "***Loading IR File***");
if (string.IsNullOrEmpty(path)) path = DriverFilepath; if (string.IsNullOrEmpty(path)) path = DriverFilepath;
try try
{ {
IrPortUid = IrPort.LoadIRDriver(path); IrPortUid = IrPort.LoadIRDriver(path);
DriverFilepath = path; DriverFilepath = path;
StandardIrPulseTime = 200; StandardIrPulseTime = 200;
DriverIsLoaded = true; DriverIsLoaded = true;
} }
catch catch
{ {
DriverIsLoaded = false; DriverIsLoaded = false;

View File

@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Crestron.SimplSharp.Reflection;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using Crestron.SimplSharpPro.DeviceSupport; using Crestron.SimplSharpPro.DeviceSupport;
using Newtonsoft.Json; using Newtonsoft.Json;
@@ -32,39 +33,50 @@ namespace PepperDash.Essentials.Devices.Common
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio, AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
eRoutingPortConnectionType.DigitalAudio, null, this); eRoutingPortConnectionType.DigitalAudio, null, this);
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut }; OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
PrintExpectedIrCommands();
} }
public void PrintExpectedIrCommands()
{
var cmds = typeof (AppleTvIrCommands).GetCType().GetFields(BindingFlags.Public | BindingFlags.Static);
#region IDPad Members foreach (var value in cmds.Select(cmd => cmd.GetValue(null)).OfType<string>())
{
Debug.Console(2, this, "Expected IR Function Name: {0}", value);
}
}
#region IDPad Members
public void Up(bool pressRelease) public void Up(bool pressRelease)
{ {
IrPort.PressRelease("+", pressRelease); IrPort.PressRelease(AppleTvIrCommands.Up, pressRelease);
} }
public void Down(bool pressRelease) public void Down(bool pressRelease)
{ {
IrPort.PressRelease("-", pressRelease); IrPort.PressRelease(AppleTvIrCommands.Down, pressRelease);
} }
public void Left(bool pressRelease) public void Left(bool pressRelease)
{ {
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease); IrPort.PressRelease(AppleTvIrCommands.Left, pressRelease);
} }
public void Right(bool pressRelease) public void Right(bool pressRelease)
{ {
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease); IrPort.PressRelease(AppleTvIrCommands.Right, pressRelease);
} }
public void Select(bool pressRelease) public void Select(bool pressRelease)
{ {
IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease); IrPort.PressRelease(AppleTvIrCommands.Enter, pressRelease);
} }
public void Menu(bool pressRelease) public void Menu(bool pressRelease)
{ {
IrPort.PressRelease("Menu", pressRelease); IrPort.PressRelease(AppleTvIrCommands.Menu, pressRelease);
} }
public void Exit(bool pressRelease) public void Exit(bool pressRelease)
@@ -78,12 +90,12 @@ namespace PepperDash.Essentials.Devices.Common
public void Play(bool pressRelease) public void Play(bool pressRelease)
{ {
IrPort.PressRelease("PLAY/PAUSE", pressRelease); IrPort.PressRelease(AppleTvIrCommands.PlayPause, pressRelease);
} }
public void Pause(bool pressRelease) public void Pause(bool pressRelease)
{ {
IrPort.PressRelease("PLAY/PAUSE", pressRelease); IrPort.PressRelease(AppleTvIrCommands.PlayPause, pressRelease);
} }
/// <summary> /// <summary>
@@ -190,4 +202,17 @@ namespace PepperDash.Essentials.Devices.Common
} }
} }
public static class AppleTvIrCommands
{
public static string Up = "+";
public static string Down = "-";
public static string Left = IROutputStandardCommands.IROut_TRACK_MINUS;
public static string Right = IROutputStandardCommands.IROut_TRACK_PLUS;
public static string Enter = IROutputStandardCommands.IROut_ENTER;
public static string PlayPause = "PLAY/PAUSE";
public static string Rewind = "REWIND";
public static string Menu = "Menu";
public static string FastForward = "FASTFORWARD";
}
} }