lots of changes. Getting things working

This commit is contained in:
Andrew Welker
2020-07-21 13:27:15 -06:00
parent 2b06672800
commit 8d0ea82402
13 changed files with 2071 additions and 2155 deletions

View File

@@ -1,231 +1,24 @@
//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Crestron.SimplSharp;
//using Crestron.SimplSharpPro;
//using Crestron.SimplSharpPro.DeviceSupport;
//using PepperDash.Core;
//using PepperDash.Essentials.Core;
//using PepperDash.Essentials.Core.SmartObjects;
//using PepperDash.Essentials.Core.PageManagers;
using System;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDashEssentials.UIDrivers.EssentialsDualDisplay;
//namespace PepperDash.Essentials
//{
// public class DualDisplaySimpleOrAdvancedRouting : PanelDriverBase
// {
// EssentialsPresentationPanelAvFunctionsDriver Parent;
namespace PepperDash.Essentials
{
public class DualDisplaySimpleOrAdvancedRouting : PanelDriverBase
{
private readonly EssentialsDualDisplayPanelAvFunctionsDriver _parent;
private EssentialsDualDisplayRoom _currentRoom;
// /// <summary>
// /// Smart Object 3200
// /// </summary>
// SubpageReferenceList SourcesSrl;
private SourceListItem PendingSource;
public DualDisplaySimpleOrAdvancedRouting(EssentialsDualDisplayPanelAvFunctionsDriver parent)
: base(parent.TriList)
{
_parent = parent;
_currentRoom = _parent.CurrentRoom as EssentialsDualDisplayRoom;
}
// /// <summary>
// /// For tracking feedback on last selected
// /// </summary>
// BoolInputSig LastSelectedSourceSig;
// /// <summary>
// /// The source that has been selected and is awaiting assignment to a display
// /// </summary>
// SourceListItem PendingSource;
// bool IsSharingModeAdvanced;
// public DualDisplaySimpleOrAdvancedRouting(EssentialsPresentationPanelAvFunctionsDriver parent) : base(parent.TriList)
// {
// Parent = parent;
// SourcesSrl = new SubpageReferenceList(TriList, 3200, 3, 3, 3);
// TriList.SetSigFalseAction(UIBoolJoin.ToggleSharingModePress, ToggleSharingModePressed);
// TriList.SetSigFalseAction(UIBoolJoin.Display1AudioButtonPressAndFb, Display1AudioPress);
// TriList.SetSigFalseAction(UIBoolJoin.Display1ControlButtonPress, Display1ControlPress);
// TriList.SetSigTrueAction(UIBoolJoin.Display1SelectPressAndFb, Display1Press);
// TriList.SetSigFalseAction(UIBoolJoin.Display2AudioButtonPressAndFb, Display2AudioPress);
// TriList.SetSigFalseAction(UIBoolJoin.Display2ControlButtonPress, Display2ControlPress);
// TriList.SetSigTrueAction(UIBoolJoin.Display2SelectPressAndFb, Display2Press);
// }
// /// <summary>
// ///
// /// </summary>
// public override void Show()
// {
// TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible].BoolValue = true;
// TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = true;
// if(IsSharingModeAdvanced)
// TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible].BoolValue = true;
// else
// TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = true;
// base.Show();
// }
// /// <summary>
// ///
// /// </summary>
// //public override void Hide()
// //{
// // TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible].BoolValue = false;
// // TriList.BooleanInput[UIBoolJoin.StagingPageVisible].BoolValue = false;
// // if(IsSharingModeAdvanced)
// // TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible].BoolValue = false;
// // else
// // TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false;
// // base.Hide();
// //}
// public void SetCurrentRoomFromParent()
// {
// if (IsSharingModeAdvanced)
// return; // add stuff here
// else
// SetupSourceListForSimpleRouting();
// }
// /// <summary>
// ///
// /// </summary>
// void SetupSourceListForSimpleRouting()
// {
// // get the source list config and set up the source list
// var config = ConfigReader.ConfigObject.SourceLists;
// if (config.ContainsKey(Parent.CurrentRoom.SourceListKey))
// {
// var srcList = config[Parent.CurrentRoom.SourceListKey]
// .Values.ToList().OrderBy(s => s.Order);
// // Setup sources list
// uint i = 1; // counter for UI list
// foreach (var srcConfig in srcList)
// {
// if (!srcConfig.IncludeInSourceList) // Skip sources marked this way
// continue;
// var sourceKey = srcConfig.SourceKey;
// var actualSource = DeviceManager.GetDeviceForKey(sourceKey) as Device;
// if (actualSource == null)
// {
// Debug.Console(0, "Cannot assign missing source '{0}' to source UI list",
// srcConfig.SourceKey);
// continue;
// }
// var localSrcItem = srcConfig; // lambda scope below
// var localIndex = i;
// SourcesSrl.GetBoolFeedbackSig(i, 1).UserObject = new Action<bool>(b =>
// {
// if (IsSharingModeAdvanced)
// {
// if (LastSelectedSourceSig != null)
// LastSelectedSourceSig.BoolValue = false;
// SourceListButtonPress(localSrcItem);
// LastSelectedSourceSig = SourcesSrl.BoolInputSig(localIndex, 1);
// LastSelectedSourceSig.BoolValue = true;
// }
// else
// Parent.CurrentRoom.DoSourceToAllDestinationsRoute(localSrcItem);
// });
// SourcesSrl.StringInputSig(i, 1).StringValue = srcConfig.PreferredName;
// i++;
// //var item = new SubpageReferenceListSourceItem(i++, SourcesSrl, srcConfig,
// // b => { if (!b) UiSelectSource(localSrcConfig); });
// //SourcesSrl.AddItem(item); // add to the SRL
// //item.RegisterForSourceChange(Parent.CurrentRoom);
// }
// SourcesSrl.Count = (ushort)(i - 1);
// Parent.CurrentRoom.CurrentSingleSourceChange += CurrentRoom_CurrentSourceInfoChange;
// Parent.CurrentRoom.CurrentDisplay1SourceChange += CurrentRoom_CurrentDisplay1SourceChange;
// Parent.CurrentRoom.CurrentDisplay2SourceChange += CurrentRoom_CurrentDisplay2SourceChange;
// }
// }
// void SetupSourceListForAdvancedRouting()
// {
// }
// void CurrentRoom_CurrentSourceInfoChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
// {
// }
// void CurrentRoom_CurrentDisplay1SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
// {
// TriList.StringInput[UIStringJoin.Display1SourceLabel].StringValue = PendingSource.PreferredName;
// }
// void CurrentRoom_CurrentDisplay2SourceChange(EssentialsRoomBase room, SourceListItem info, ChangeType type)
// {
// TriList.StringInput[UIStringJoin.Display2SourceLabel].StringValue = PendingSource.PreferredName;
// }
// /// <summary>
// ///
// /// </summary>
// void ToggleSharingModePressed()
// {
// Hide();
// IsSharingModeAdvanced = !IsSharingModeAdvanced;
// TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress].BoolValue = IsSharingModeAdvanced;
// Show();
// }
// public void SourceListButtonPress(SourceListItem item)
// {
// // start the timer
// // show FB on potential source
// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = false;
// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = false;
// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = false;
// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = false;
// PendingSource = item;
// }
// void EnableAppropriateDisplayButtons()
// {
// TriList.BooleanInput[UIBoolJoin.Display1AudioButtonEnable].BoolValue = true;
// TriList.BooleanInput[UIBoolJoin.Display1ControlButtonEnable].BoolValue = true;
// TriList.BooleanInput[UIBoolJoin.Display2AudioButtonEnable].BoolValue = true;
// TriList.BooleanInput[UIBoolJoin.Display2ControlButtonEnable].BoolValue = true;
// if (LastSelectedSourceSig != null)
// LastSelectedSourceSig.BoolValue = false;
// }
// public void Display1Press()
// {
// EnableAppropriateDisplayButtons();
// Parent.CurrentRoom.SourceToDisplay1(PendingSource);
// // Enable end meeting
// }
// public void Display1AudioPress()
// {
// }
// public void Display1ControlPress()
// {
// }
// public void Display2Press()
// {
// EnableAppropriateDisplayButtons();
// Parent.CurrentRoom.SourceToDisplay2(PendingSource);
// }
// public void Display2AudioPress()
// {
// }
// public void Display2ControlPress()
// {
// }
// }
//}
}
}

View File

@@ -13,20 +13,114 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay
private EssentialsDualDisplayRoom _currentRoom;
private readonly BoolInputSig _routeToggleVisibility;
private readonly BoolInputSig _dualDisplayControlVisibility;
private readonly BoolFeedback _sharingMode;
private readonly BoolOutputSig _sharingModeSig;
private readonly BoolFeedback _sharingModeFeedback;
private readonly BoolFeedback _dualDisplayVisiblityFeedback;
private readonly BoolFeedback _routeToggleVisiblityFeedback;
public EssentialsDualDisplayPanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config) : base(parent, config)
{
_routeToggleVisibility = parent.TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible];
_dualDisplayControlVisibility = parent.TriList.BooleanInput[UIBoolJoin.DualDisplayPageVisible];
_sharingModeSig = parent.TriList.BooleanOutput[UIBoolJoin.ToggleSharingModePress];
_sharingMode = new BoolFeedback(() => _currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced);
_sharingModeSig.SetBoolSigAction(ToggleVideoBehavior);
_sharingMode.LinkInputSig(parent.TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress]);
_sharingModeFeedback = new BoolFeedback(() => _currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced);
_sharingModeFeedback.LinkInputSig(parent.TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress]);
_dualDisplayVisiblityFeedback =
new BoolFeedback(
() =>
_currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced &&
CurrentMode == UiDisplayMode.Presentation);
_dualDisplayVisiblityFeedback.LinkInputSig(_dualDisplayControlVisibility);
_routeToggleVisiblityFeedback =
new BoolFeedback(
() => _currentRoom.RoomConfig.EnableVideoBehaviorToggle && CurrentMode == UiDisplayMode.Presentation);
_routeToggleVisiblityFeedback.LinkInputSig(_routeToggleVisibility);
}
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
protected override void ShowCurrentSource()
{
if (_currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced) return;
base.ShowCurrentSource();
}
#endregion
private void ToggleVideoBehavior(bool value)
{
if (!value) return;
_currentRoom.VideoRoutingBehavior = _currentRoom.VideoRoutingBehavior == EVideoBehavior.Basic
? EVideoBehavior.Advanced
: EVideoBehavior.Basic;
_sharingModeFeedback.FireUpdate();
_dualDisplayVisiblityFeedback.FireUpdate();
TriList.SetBool(UIBoolJoin.SelectASourceVisible, _currentRoom.VideoRoutingBehavior == EVideoBehavior.Basic);
if (_currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced)
{
CurrentSourcePageManager.Hide();
}
else
{
if (_currentRoom.CurrentSourceInfo != null)
{
UiSelectSource(_currentRoom.CurrentSourceInfoKey);
TriList.SetBool(UIBoolJoin.SelectASourceVisible, false);
}
CurrentSourcePageManager.Show();
}
}
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
protected override void SetCurrentRoom(EssentialsHuddleVtc1Room room)
{
_currentRoom = room as EssentialsDualDisplayRoom;
base.SetCurrentRoom(room);
}
#endregion
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
protected override void ActivityShareButtonPressed()
{
base.ActivityShareButtonPressed();
_dualDisplayVisiblityFeedback.FireUpdate();
_routeToggleVisiblityFeedback.FireUpdate();
}
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
public override void ActivityCallButtonPressed()
{
base.ActivityCallButtonPressed();
_dualDisplayVisiblityFeedback.FireUpdate();
_routeToggleVisiblityFeedback.FireUpdate();
}
#endregion
#endregion
protected override void SetupSourceList()
{
var inCall = _currentRoom.InCallFeedback.BoolValue;
@@ -40,24 +134,65 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay
SourceStagingSrl.Clear();
uint i = 1;
foreach (var src in sourceList.Where(
src =>
src.Value.IncludeInSourceList && (inCall && !src.Value.DisableCodecSharing) &&
(CurrentMode != UiDisplayMode.Call && !src.Value.DisableCodecSharing)))
foreach (var src in sourceList)
{
var source = src.Value;
var sourceKey = src.Key;
Debug.Console(1, "**** {0}, {1}, {2}, {3}, {4}", source.PreferredName, source.IncludeInSourceList,
source.DisableCodecSharing, inCall, CurrentMode);
var srlItem = new SubpageReferenceListSourceItem(i++, SourceStagingSrl, src.Value,
if (!source.IncludeInSourceList || (inCall && source.DisableCodecSharing)
|| CurrentMode == UiDisplayMode.Call && source.DisableCodecSharing)
{
Debug.Console(1, "Skipping {0}", source.PreferredName);
continue;
}
var srlItem = new SubpageReferenceListSourceItem(i++, SourceStagingSrl, source,
b => { if (!b) UiSelectSource(sourceKey); });
SourceStagingSrl.AddItem(srlItem);
srlItem.RegisterForSourceChange(_currentRoom);
}
SourceStagingSrl.Count = (ushort) (i - 1);
Debug.Console(2, "Dual Display Source Count: {0}", SourceStagingSrl.Count);
}
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
protected override void SetSourceFeedback()
{
if (!CurrentRoom.OnFeedback.BoolValue)
{
// If there's no default, show UI elements
if (!CurrentRoom.RunDefaultPresentRoute() && _currentRoom.VideoRoutingBehavior == EVideoBehavior.Basic)
{
TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
}
}
else // room is on show what's active or select a source if nothing is yet active
{
if (CurrentRoom.CurrentSourceInfo == null ||
CurrentRoom.CurrentSourceInfoKey == EssentialsHuddleVtc1Room.DefaultCodecRouteString)
{
TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
return;
}
if (CurrentSourcePageManager == null) return;
if (_currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced)
{
CurrentSourcePageManager.Hide();
return;
}
CurrentSourcePageManager.Show();
}
}
#endregion
private void RefreshRoom(EssentialsDualDisplayRoom room)
{
RefreshCurrentRoom(room);
@@ -65,7 +200,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay
_currentRoom = room;
_routeToggleVisibility.BoolValue = _currentRoom.RoomConfig.EnableVideoBehaviorToggle;
_sharingMode.FireUpdate();
_sharingModeFeedback.FireUpdate();
}
private void UiSelectSource(string sourceKey)

View File

@@ -91,7 +91,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Current page manager running for a source
/// </summary>
private PageManager _currentSourcePageManager;
protected PageManager CurrentSourcePageManager;
/// <summary>
/// Tracks the last meeting that was cancelled
@@ -270,7 +270,7 @@ namespace PepperDash.Essentials
/// <summary>
///
/// </summary>
public void ActivityCallButtonPressed()
public virtual void ActivityCallButtonPressed()
{
if (VcDriver.IsVisible)
{
@@ -281,9 +281,9 @@ namespace PepperDash.Essentials
TriList.SetBool(UIBoolJoin.StartPageVisible, false);
TriList.SetBool(UIBoolJoin.SourceStagingBarVisible, false);
TriList.SetBool(UIBoolJoin.SelectASourceVisible, false);
if (_currentSourcePageManager != null)
if (CurrentSourcePageManager != null)
{
_currentSourcePageManager.Hide();
CurrentSourcePageManager.Hide();
}
PowerOnFromCall();
CurrentMode = UiDisplayMode.Call;
@@ -691,6 +691,14 @@ namespace PepperDash.Essentials
TriList.SetBool(UIBoolJoin.CallStagingBarVisible, false);
TriList.SetBool(UIBoolJoin.SourceStagingBarVisible, true);
// Run default source when room is off and share is pressed
SetSourceFeedback();
CurrentMode = UiDisplayMode.Presentation;
SetupSourceList();
SetActivityFooterFeedbacks();
}
protected virtual void SetSourceFeedback()
{
if (!CurrentRoom.OnFeedback.BoolValue)
{
// If there's no default, show UI elements
@@ -706,14 +714,11 @@ namespace PepperDash.Essentials
{
TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
}
else if (_currentSourcePageManager != null)
else if (CurrentSourcePageManager != null)
{
_currentSourcePageManager.Show();
CurrentSourcePageManager.Show();
}
}
CurrentMode = UiDisplayMode.Presentation;
SetupSourceList();
SetActivityFooterFeedbacks();
}
/// <summary>
@@ -754,7 +759,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Loads the appropriate Sigs into CurrentDisplayModeSigsInUse and shows them
/// </summary>
private void ShowCurrentSource()
protected virtual void ShowCurrentSource()
{
if (CurrentRoom.CurrentSourceInfo == null)
{
@@ -795,7 +800,7 @@ namespace PepperDash.Essentials
pm = new DefaultPageManager(uiDev, TriList);
}
_pageManagers[uiDev] = pm;
_currentSourcePageManager = pm;
CurrentSourcePageManager = pm;
pm.Show();
}
@@ -1061,7 +1066,7 @@ namespace PepperDash.Essentials
}
}
private void SetCurrentRoom(EssentialsHuddleVtc1Room room)
protected virtual void SetCurrentRoom(EssentialsHuddleVtc1Room room)
{
if (_currentRoom == room || room == null)
{
@@ -1346,10 +1351,10 @@ namespace PepperDash.Essentials
// Hide whatever is showing
if (IsVisible)
{
if (_currentSourcePageManager != null)
if (CurrentSourcePageManager != null)
{
_currentSourcePageManager.Hide();
_currentSourcePageManager = null;
CurrentSourcePageManager.Hide();
CurrentSourcePageManager = null;
}
}
@@ -1394,7 +1399,7 @@ namespace PepperDash.Essentials
/// <summary>
/// Refreshes and shows the room's current source
/// </summary>
private void RefreshSourceInfo()
protected virtual void RefreshSourceInfo()
{
var routeInfo = CurrentRoom.CurrentSourceInfo;
// This will show off popup too