getting things working

This commit is contained in:
Andrew Welker
2020-07-17 13:48:03 -06:00
parent aede5355b7
commit d6a6791e7b
5 changed files with 204 additions and 94 deletions

View File

@@ -1,25 +1,85 @@
using System; using System.Linq;
using System.Collections.Generic;
using System.Linq;
using Crestron.SimplSharp;
using Crestron.SimplSharpPro; using Crestron.SimplSharpPro;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials; using PepperDash.Essentials;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Core.Rooms.Config;
using PepperDash.Essentials.Core.Devices.VideoCodec;
using PepperDash.Essentials.Core.PageManagers;
using PepperDash.Essentials.Core.Touchpanels.Keyboards;
using PepperDash.Essentials.UIDrivers;
using PepperDash.Essentials.UIDrivers.VC;
namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay
{ {
public class EssentialsDualDisplayPanelAvFunctionsDriver : EssentialsHuddleVtc1PanelAvFunctionsDriver public class EssentialsDualDisplayPanelAvFunctionsDriver : EssentialsHuddleVtc1PanelAvFunctionsDriver
{ {
private EssentialsDualDisplayRoom _currentRoom;
private BoolInputSig _routeToggleVisibility;
private readonly BoolFeedback _sharingMode;
public EssentialsDualDisplayPanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config) : base(parent, config) public EssentialsDualDisplayPanelAvFunctionsDriver(PanelDriverBase parent, CrestronTouchpanelPropertiesConfig config) : base(parent, config)
{ {
_routeToggleVisibility = parent.TriList.BooleanInput[UIBoolJoin.ToggleSharingModeVisible];
_sharingMode = new BoolFeedback(() => _currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced);
_sharingMode.LinkInputSig(parent.TriList.BooleanInput[UIBoolJoin.ToggleSharingModePress]);
} }
#region Overrides of EssentialsHuddleVtc1PanelAvFunctionsDriver
protected override void SetupSourceList()
{
var inCall = _currentRoom.InCallFeedback.BoolValue;
var sourceLists = ConfigReader.ConfigObject.SourceLists;
if (!sourceLists.ContainsKey(_currentRoom.SourceListKey))
{
return;
}
var sourceList = sourceLists[_currentRoom.SourceListKey].OrderBy(kv => kv.Value.Order);
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)))
{
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,
b => { if (!b) UiSelectSource(sourceKey); });
SourceStagingSrl.AddItem(srlItem);
srlItem.RegisterForSourceChange(_currentRoom);
}
}
private void RefreshRoom(EssentialsDualDisplayRoom room)
{
RefreshCurrentRoom(room);
_currentRoom = room;
_routeToggleVisibility.BoolValue = _currentRoom.RoomConfig.EnableVideoBehaviorToggle;
_sharingMode.FireUpdate();
}
private void UiSelectSource(string sourceKey)
{
if (_currentRoom.VideoRoutingBehavior == EVideoBehavior.Advanced)
{
_currentRoom.SelectSource(sourceKey, _currentRoom.SourceListKey);
return;
}
_currentRoom.RunRouteAction(sourceKey);
}
#endregion
} }
} }

View File

@@ -67,7 +67,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Smart Object 3200 /// Smart Object 3200
/// </summary> /// </summary>
private readonly SubpageReferenceList _sourceStagingSrl; protected readonly SubpageReferenceList SourceStagingSrl;
private readonly CrestronTouchpanelPropertiesConfig _config; private readonly CrestronTouchpanelPropertiesConfig _config;
@@ -86,7 +86,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// The mode showing. Presentation or call. /// The mode showing. Presentation or call.
/// </summary> /// </summary>
private UiDisplayMode _currentMode = UiDisplayMode.Start; protected UiDisplayMode CurrentMode = UiDisplayMode.Start;
/// <summary> /// <summary>
/// Current page manager running for a source /// Current page manager running for a source
@@ -124,7 +124,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// The Video codec driver /// The Video codec driver
/// </summary> /// </summary>
private EssentialsVideoCodecUiDriver _vcDriver; protected EssentialsVideoCodecUiDriver VcDriver;
private EssentialsHuddleVtc1Room _currentRoom; private EssentialsHuddleVtc1Room _currentRoom;
@@ -144,7 +144,7 @@ namespace PepperDash.Essentials
_stagingBarInterlock = new JoinedSigInterlock(TriList); _stagingBarInterlock = new JoinedSigInterlock(TriList);
_callPagesInterlock = new JoinedSigInterlock(TriList); _callPagesInterlock = new JoinedSigInterlock(TriList);
_sourceStagingSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.SourceStagingSRL, 3, 3, 3); SourceStagingSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.SourceStagingSRL, 3, 3, 3);
_activityFooterSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.ActivityFooterSRL, 3, 3, 3); _activityFooterSrl = new SubpageReferenceList(TriList, UISmartObjectJoin.ActivityFooterSRL, 3, 3, 3);
_callButtonSig = _activityFooterSrl.BoolInputSig(2, 1); _callButtonSig = _activityFooterSrl.BoolInputSig(2, 1);
@@ -272,7 +272,7 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
public void ActivityCallButtonPressed() public void ActivityCallButtonPressed()
{ {
if (_vcDriver.IsVisible) if (VcDriver.IsVisible)
{ {
return; return;
} }
@@ -286,9 +286,9 @@ namespace PepperDash.Essentials
_currentSourcePageManager.Hide(); _currentSourcePageManager.Hide();
} }
PowerOnFromCall(); PowerOnFromCall();
_currentMode = UiDisplayMode.Call; CurrentMode = UiDisplayMode.Call;
SetActivityFooterFeedbacks(); SetActivityFooterFeedbacks();
_vcDriver.Show(); VcDriver.Show();
} }
/// <summary> /// <summary>
@@ -311,7 +311,7 @@ namespace PepperDash.Essentials
/// <param name="vcd"></param> /// <param name="vcd"></param>
public void SetVideoCodecDriver(EssentialsVideoCodecUiDriver vcd) public void SetVideoCodecDriver(EssentialsVideoCodecUiDriver vcd)
{ {
_vcDriver = vcd; VcDriver = vcd;
} }
/// <summary> /// <summary>
@@ -553,7 +553,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private void HideNextMeetingPopup() protected void HideNextMeetingPopup()
{ {
TriList.SetBool(UIBoolJoin.NextMeetingModalVisible, false); TriList.SetBool(UIBoolJoin.NextMeetingModalVisible, false);
} }
@@ -669,9 +669,9 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
private void SetActivityFooterFeedbacks() private void SetActivityFooterFeedbacks()
{ {
_callButtonSig.BoolValue = _currentMode == UiDisplayMode.Call _callButtonSig.BoolValue = CurrentMode == UiDisplayMode.Call
&& CurrentRoom.ShutdownType == eShutdownType.None; && CurrentRoom.ShutdownType == eShutdownType.None;
_shareButtonSig.BoolValue = _currentMode == UiDisplayMode.Presentation _shareButtonSig.BoolValue = CurrentMode == UiDisplayMode.Presentation
&& CurrentRoom.ShutdownType == eShutdownType.None; && CurrentRoom.ShutdownType == eShutdownType.None;
_endMeetingButtonSig.BoolValue = CurrentRoom.ShutdownType != eShutdownType.None; _endMeetingButtonSig.BoolValue = CurrentRoom.ShutdownType != eShutdownType.None;
} }
@@ -679,12 +679,12 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Attached to activity list share button /// Attached to activity list share button
/// </summary> /// </summary>
private void ActivityShareButtonPressed() protected virtual void ActivityShareButtonPressed()
{ {
SetupSourceList(); SetupSourceList();
if (_vcDriver.IsVisible) if (VcDriver.IsVisible)
{ {
_vcDriver.Hide(); VcDriver.Hide();
} }
HideNextMeetingPopup(); HideNextMeetingPopup();
TriList.SetBool(UIBoolJoin.StartPageVisible, false); TriList.SetBool(UIBoolJoin.StartPageVisible, false);
@@ -693,13 +693,10 @@ namespace PepperDash.Essentials
// Run default source when room is off and share is pressed // Run default source when room is off and share is pressed
if (!CurrentRoom.OnFeedback.BoolValue) if (!CurrentRoom.OnFeedback.BoolValue)
{ {
if (!CurrentRoom.OnFeedback.BoolValue) // If there's no default, show UI elements
if (!CurrentRoom.RunDefaultPresentRoute())
{ {
// If there's no default, show UI elements TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
if (!CurrentRoom.RunDefaultPresentRoute())
{
TriList.SetBool(UIBoolJoin.SelectASourceVisible, true);
}
} }
} }
else // room is on show what's active or select a source if nothing is yet active else // room is on show what's active or select a source if nothing is yet active
@@ -714,7 +711,7 @@ namespace PepperDash.Essentials
_currentSourcePageManager.Show(); _currentSourcePageManager.Show();
} }
} }
_currentMode = UiDisplayMode.Presentation; CurrentMode = UiDisplayMode.Presentation;
SetupSourceList(); SetupSourceList();
SetActivityFooterFeedbacks(); SetActivityFooterFeedbacks();
} }
@@ -810,7 +807,7 @@ namespace PepperDash.Essentials
private void UiSelectSource(string key) private void UiSelectSource(string key)
{ {
// Run the route and when it calls back, show the source // Run the route and when it calls back, show the source
CurrentRoom.RunRouteAction(key, () => { }); CurrentRoom.RunRouteAction(key);
} }
/// <summary> /// <summary>
@@ -979,7 +976,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Helper for property setter. Sets the panel to the given room, latching up all functionality /// Helper for property setter. Sets the panel to the given room, latching up all functionality
/// </summary> /// </summary>
private void RefreshCurrentRoom(EssentialsHuddleVtc1Room room) protected void RefreshCurrentRoom(EssentialsHuddleVtc1Room room)
{ {
if (_currentRoom != null) if (_currentRoom != null)
{ {
@@ -1112,46 +1109,48 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
private void SetupSourceList() protected virtual void SetupSourceList()
{ {
var inCall = _currentRoom.InCallFeedback.BoolValue; var inCall = _currentRoom.InCallFeedback.BoolValue;
var config = ConfigReader.ConfigObject.SourceLists; var config = ConfigReader.ConfigObject.SourceLists;
if (config.ContainsKey(_currentRoom.SourceListKey)) if (!config.ContainsKey(_currentRoom.SourceListKey))
{ {
var srcList = config[_currentRoom.SourceListKey].OrderBy(kv => kv.Value.Order); return;
// Setup sources list
_sourceStagingSrl.Clear();
uint i = 1; // counter for UI list
foreach (var kvp in srcList)
{
var srcConfig = kvp.Value;
Debug.Console(1, "**** {0}, {1}, {2}, {3}, {4}", srcConfig.PreferredName,
srcConfig.IncludeInSourceList,
srcConfig.DisableCodecSharing, inCall, _currentMode);
// Skip sources marked as not included, and filter list of non-sharable sources when in call
// or on share screen
if (!srcConfig.IncludeInSourceList || (inCall && srcConfig.DisableCodecSharing)
|| _currentMode == UiDisplayMode.Call && srcConfig.DisableCodecSharing)
{
Debug.Console(1, "Skipping {0}", srcConfig.PreferredName);
continue;
}
var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, _sourceStagingSrl, srcConfig,
b =>
{
if (!b)
{
UiSelectSource(routeKey);
}
});
_sourceStagingSrl.AddItem(item); // add to the SRL
item.RegisterForSourceChange(_currentRoom);
}
_sourceStagingSrl.Count = (ushort) (i - 1);
} }
var srcList = config[_currentRoom.SourceListKey].OrderBy(kv => kv.Value.Order);
// Setup sources list
SourceStagingSrl.Clear();
uint i = 1; // counter for UI list
foreach (var kvp in srcList)
{
var srcConfig = kvp.Value;
Debug.Console(1, "**** {0}, {1}, {2}, {3}, {4}", srcConfig.PreferredName,
srcConfig.IncludeInSourceList,
srcConfig.DisableCodecSharing, inCall, CurrentMode);
// Skip sources marked as not included, and filter list of non-sharable sources when in call
// or on share screen
if (!srcConfig.IncludeInSourceList || (inCall && srcConfig.DisableCodecSharing)
|| CurrentMode == UiDisplayMode.Call && srcConfig.DisableCodecSharing)
{
Debug.Console(1, "Skipping {0}", srcConfig.PreferredName);
continue;
}
var routeKey = kvp.Key;
var item = new SubpageReferenceListSourceItem(i++, SourceStagingSrl, srcConfig,
b =>
{
if (!b)
{
UiSelectSource(routeKey);
}
});
SourceStagingSrl.AddItem(item); // add to the SRL
item.RegisterForSourceChange(_currentRoom);
}
SourceStagingSrl.Count = (ushort) (i - 1);
} }
/// <summary> /// <summary>
@@ -1286,10 +1285,10 @@ namespace PepperDash.Essentials
} }
else else
{ {
_currentMode = UiDisplayMode.Start; CurrentMode = UiDisplayMode.Start;
if (_vcDriver.IsVisible) if (VcDriver.IsVisible)
{ {
_vcDriver.Hide(); VcDriver.Hide();
} }
SetupActivityFooterWhenRoomOff(); SetupActivityFooterWhenRoomOff();
ShowLogo(); ShowLogo();
@@ -1399,7 +1398,7 @@ namespace PepperDash.Essentials
{ {
var routeInfo = CurrentRoom.CurrentSourceInfo; var routeInfo = CurrentRoom.CurrentSourceInfo;
// This will show off popup too // This will show off popup too
if (IsVisible && !_vcDriver.IsVisible) if (IsVisible && !VcDriver.IsVisible)
{ {
ShowCurrentSource(); ShowCurrentSource();
} }

View File

@@ -1,4 +1,5 @@
using PepperDash.Core; using Newtonsoft.Json.Converters;
using PepperDash.Core;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace PepperDash.Essentials.Core.Rooms.Config namespace PepperDash.Essentials.Core.Rooms.Config
@@ -9,11 +10,15 @@ namespace PepperDash.Essentials.Core.Rooms.Config
public class EssentialsNDisplayRoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig public class EssentialsNDisplayRoomPropertiesConfig : EssentialsHuddleVtc1PropertiesConfig
{ {
[JsonProperty("defaultAudioBehavior")] [JsonProperty("defaultAudioBehavior")]
public string DefaultAudioBehavior { get; set; } [JsonConverter(typeof(StringEnumConverter))]
public EAudioBehavior DefaultAudioBehavior { get; set; }
[JsonProperty("defaultVideoBehavior")] [JsonProperty("defaultVideoBehavior")]
public string DefaultVideoBehavior { get; set; } [JsonConverter(typeof(StringEnumConverter))]
public EVideoBehavior DefaultVideoBehavior { get; set; }
[JsonProperty("destinationListKey")] [JsonProperty("destinationListKey")]
public string DestinationListKey { get; set; } public string DestinationListKey { get; set; }
[JsonProperty("enableVideoBehaviorToggle")]
public bool EnableVideoBehaviorToggle { get; set; }
} }
public class DisplayItem : IKeyName public class DisplayItem : IKeyName
@@ -21,4 +26,17 @@ namespace PepperDash.Essentials.Core.Rooms.Config
public string Key { get; set; } public string Key { get; set; }
public string Name { get; set; } public string Name { get; set; }
} }
public enum EVideoBehavior
{
Basic,
Advanced
}
public enum EAudioBehavior
{
AudioFollowVideo,
ChooseAudioFromDisplay,
AudioFollowVideoWithDeroute
}
} }

View File

@@ -474,41 +474,41 @@ namespace PepperDash.Essentials.Core
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="routeKey"></param> /// <param name="sourceKey"></param>
public virtual void RunRouteAction(string routeKey) public virtual void RunRouteAction(string sourceKey)
{ {
RunRouteAction(routeKey, String.Empty, () => { }); RunRouteAction(sourceKey, String.Empty, () => { });
} }
/// <summary> /// <summary>
/// Gets a source from config list SourceListKey and dynamically build and executes the /// Gets a source from config list SourceListKey and dynamically build and executes the
/// route or commands /// route or commands
/// </summary> /// </summary>
public virtual void RunRouteAction(string routeKey, Action successCallback) public virtual void RunRouteAction(string sourceKey, Action successCallback)
{ {
RunRouteAction(routeKey, String.Empty, successCallback); RunRouteAction(sourceKey, String.Empty, successCallback);
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="routeKey"></param> /// <param name="sourceKey"></param>
/// <param name="sourceListKey"></param> /// <param name="sourceListKey"></param>
public virtual void RunRouteAction(string routeKey, string sourceListKey) public virtual void RunRouteAction(string sourceKey, string sourceListKey)
{ {
RunRouteAction(routeKey, sourceListKey, () => { }); RunRouteAction(sourceKey, sourceListKey, () => { });
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="routeKey"></param> /// <param name="sourceKey"></param>
/// <param name="sourceListKey"></param> /// <param name="sourceListKey"></param>
/// <param name="successCallback"></param> /// <param name="successCallback"></param>
public virtual void RunRouteAction(string routeKey, string sourceListKey, Action successCallback) public virtual void RunRouteAction(string sourceKey, string sourceListKey, Action successCallback)
{ {
var routeObject = var routeObject =
new {RouteKey = routeKey, SourceListKey = sourceListKey, SuccessCallback = successCallback}; new {RouteKey = sourceKey, SourceListKey = sourceListKey, SuccessCallback = successCallback};
CrestronInvoke.BeginInvoke(RunRouteAction, routeObject); // end of BeginInvoke CrestronInvoke.BeginInvoke(RunRouteAction, routeObject); // end of BeginInvoke
} }
@@ -572,14 +572,13 @@ namespace PepperDash.Essentials.Core
SetVolumeControl(item); SetVolumeControl(item);
// store the name and UI info for routes // store the name and UI info for routes
CurrentSourceInfoKey = routeObj.RouteKey;
if (item.SourceKey == "$off") if (item.SourceKey == "$off")
{ {
CurrentSourceInfoKey = routeObj.RouteKey;
CurrentSourceInfo = null; CurrentSourceInfo = null;
} }
else if (item.SourceKey != null) else if (item.SourceKey != null)
{ {
CurrentSourceInfoKey = routeObj.RouteKey;
CurrentSourceInfo = item; CurrentSourceInfo = item;
} }
@@ -657,7 +656,7 @@ namespace PepperDash.Essentials.Core
return dest; return dest;
} }
private void SetVolumeControl(SourceListItem item) protected void SetVolumeControl(SourceListItem item)
{ {
IBasicVolumeControls volDev = null; IBasicVolumeControls volDev = null;
// Handle special cases for volume control // Handle special cases for volume control
@@ -730,7 +729,7 @@ namespace PepperDash.Essentials.Core
} }
} }
private Dictionary<string, SourceListItem> GetSourceListForKey(string routeKey, string sourceListKey) protected Dictionary<string, SourceListItem> GetSourceListForKey(string routeKey, string sourceListKey)
{ {
var slKey = String.IsNullOrEmpty(sourceListKey) ? SourceListKey : sourceListKey; var slKey = String.IsNullOrEmpty(sourceListKey) ? SourceListKey : sourceListKey;

View File

@@ -15,13 +15,16 @@ namespace PepperDash.Essentials
private const string LeftDestinationKey = "leftDisplay"; private const string LeftDestinationKey = "leftDisplay";
private const string RightDestinationKey = "rightDisplay"; private const string RightDestinationKey = "rightDisplay";
private readonly EssentialsDualDisplayRoomPropertiesConfig _config; public EssentialsDualDisplayRoomPropertiesConfig RoomConfig { get; private set; }
public EAudioBehavior AudioRoutingBehavior { get; set; }
public EVideoBehavior VideoRoutingBehavior { get; set; }
private string _destinationListKey; private string _destinationListKey;
public EssentialsDualDisplayRoom(DeviceConfig config) : base(config) public EssentialsDualDisplayRoom(DeviceConfig config) : base(config)
{ {
_config = config.Properties.ToObject<EssentialsDualDisplayRoomPropertiesConfig>(); RoomConfig = config.Properties.ToObject<EssentialsDualDisplayRoomPropertiesConfig>();
Initialize(); Initialize();
} }
@@ -40,9 +43,12 @@ namespace PepperDash.Essentials
{ {
try try
{ {
_destinationListKey = String.IsNullOrEmpty(_config.DestinationListKey) _destinationListKey = String.IsNullOrEmpty(RoomConfig.DestinationListKey)
? DefaultDestinationListKey ? DefaultDestinationListKey
: _config.DestinationListKey; : RoomConfig.DestinationListKey;
AudioRoutingBehavior = RoomConfig.DefaultAudioBehavior;
VideoRoutingBehavior = RoomConfig.DefaultVideoBehavior;
InitializeDestinations(); InitializeDestinations();
} }
@@ -192,5 +198,33 @@ namespace PepperDash.Essentials
DoRoute(routeItem); DoRoute(routeItem);
} }
public void SelectSource(string sourceKey, string sourceListKey)
{
var srcList = GetSourceListForKey(sourceKey, sourceListKey);
var src = srcList[sourceKey];
if (src.SourceKey != "roomoff")
{
LastSourceKey = sourceKey;
}
else
{
CurrentSourceInfoKey = null;
}
SetVolumeControl(src);
if (src.SourceKey == "$off")
{
CurrentSourceInfo = null;
} else if (src.SourceKey != null)
{
CurrentSourceInfo = src;
}
OnFeedback.FireUpdate();
}
} }
} }