fix(essentials): Updates to deal with layouts and default layout for ZoomRoom

This commit is contained in:
Neil Dorin
2022-09-28 12:28:37 -06:00
parent 2daf3c0328
commit a524b1607d
4 changed files with 98 additions and 78 deletions

View File

@@ -1,61 +1,56 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
namespace PepperDash.Essentials.Core namespace PepperDash.Essentials.Core
{ {
/// <summary> /// <summary>
/// Describes the functionality required to prompt a user to enter a password /// Describes the functionality required to prompt a user to enter a password
/// </summary> /// </summary>
public interface IPasswordPrompt public interface IPasswordPrompt
{ {
/// <summary> /// <summary>
/// Notifies when a password is required or is entered incorrectly /// Notifies when a password is required or is entered incorrectly
/// </summary> /// </summary>
event EventHandler<PasswordPromptEventArgs> PasswordRequired; event EventHandler<PasswordPromptEventArgs> PasswordRequired;
/// <summary>
/// Submits the password
/// </summary>
/// <param name="password"></param>
void SubmitPassword(string password);
/// <summary> /// <summary>
/// Cancels the password submission /// Submits the password
/// </summary> /// </summary>
void CancelPasswordPrompt(); /// <param name="password"></param>
} void SubmitPassword(string password);
}
public class PasswordPromptEventArgs : EventArgs
{ public class PasswordPromptEventArgs : EventArgs
/// <summary> {
/// Indicates if the last submitted password was incorrect /// <summary>
/// </summary> /// Indicates if the last submitted password was incorrect
public bool LastAttemptWasIncorrect { get; private set; } /// </summary>
public bool LastAttemptWasIncorrect { get; private set; }
/// <summary>
/// Indicates that the login attempt has failed /// <summary>
/// </summary> /// Indicates that the login attempt has failed
public bool LoginAttemptFailed { get; private set; } /// </summary>
public bool LoginAttemptFailed { get; private set; }
/// <summary>
/// Indicates that the process was cancelled and the prompt should be dismissed /// <summary>
/// </summary> /// Indicates that the process was cancelled and the prompt should be dismissed
public bool LoginAttemptCancelled { get; private set; } /// </summary>
public bool LoginAttemptCancelled { get; private set; }
/// <summary>
/// A message to be displayed to the user /// <summary>
/// </summary> /// A message to be displayed to the user
public string Message { get; private set; } /// </summary>
public string Message { get; private set; }
public PasswordPromptEventArgs(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
{ public PasswordPromptEventArgs(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
LastAttemptWasIncorrect = lastAttemptIncorrect; {
LoginAttemptFailed = loginFailed; LastAttemptWasIncorrect = lastAttemptIncorrect;
LoginAttemptCancelled = loginCancelled; LoginAttemptFailed = loginFailed;
Message = message; LoginAttemptCancelled = loginCancelled;
} Message = message;
} }
}
} }

View File

@@ -627,6 +627,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
// backer variables // backer variables
private bool _can_Switch_Speaker_View; private bool _can_Switch_Speaker_View;
private bool _can_Switch_Wall_View; private bool _can_Switch_Wall_View;
private bool _can_Switch_Strip_View;
private bool _can_Switch_Share_On_All_Screens; private bool _can_Switch_Share_On_All_Screens;
private bool _can_Switch_Floating_Share_Content; private bool _can_Switch_Floating_Share_Content;
private bool _is_In_First_Page; private bool _is_In_First_Page;
@@ -714,6 +715,23 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
} }
[JsonProperty("can_Switch_Strip_View")]
public bool can_Switch_Strip_View
{
get
{
return _can_Switch_Strip_View;
}
set
{
if (value != _can_Switch_Strip_View)
{
_can_Switch_Strip_View = value;
NotifyPropertyChanged("can_Switch_Strip_View");
}
}
}
[JsonProperty("is_In_First_Page")] [JsonProperty("is_In_First_Page")]
public bool is_In_First_Page public bool is_In_First_Page
{ {

View File

@@ -810,8 +810,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
Debug.Console(1, this, "Status.Layout.PropertyChanged a.PropertyName: {0}", a.PropertyName); Debug.Console(1, this, "Status.Layout.PropertyChanged a.PropertyName: {0}", a.PropertyName);
switch (a.PropertyName.ToLower()) switch (a.PropertyName.ToLower())
{ {
case "can_switch_speaker_view": case "can_Switch_speaker_view":
case "can_switch_wall_view": case "can_switch_wall_view":
case "can_switch_strip_view":
case "video_type":
case "can_switch_share_on_all_screens": case "can_switch_share_on_all_screens":
{ {
ComputeAvailableLayouts(); ComputeAvailableLayouts();
@@ -827,7 +829,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
LayoutViewIsOnLastPageFeedback.FireUpdate(); LayoutViewIsOnLastPageFeedback.FireUpdate();
break; break;
} }
case "can_Switch_Floating_Share_Content": case "can_switch_floating_share_content":
{ {
CanSwapContentWithThumbnailFeedback.FireUpdate(); CanSwapContentWithThumbnailFeedback.FireUpdate();
break; break;
@@ -1559,7 +1561,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
{ {
JsonConvert.PopulateObject(responseObj.ToString(), Status.Call.Sharing); JsonConvert.PopulateObject(responseObj.ToString(), Status.Call.Sharing);
SetLayout(); SetDefaultLayout();
break; break;
} }
@@ -1935,7 +1937,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
} }
private void SetLayout() private void SetDefaultLayout()
{ {
if (!_props.AutoDefaultLayouts) return; if (!_props.AutoDefaultLayouts) return;
@@ -1948,8 +1950,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
} }
else else
{ {
SendText(String.Format("zconfiguration call layout style: {0}", if (_props.DefaultCallLayout == (_props.DefaultCallLayout & AvailableLayouts))
_props.DefaultCallLayout)); {
SendText(String.Format("zconfiguration call layout style: {0}",
_props.DefaultCallLayout));
}
else
Debug.Console(0, this, "Unable to set default Layout. {0} not currently an available layout based on meeting state", _props.DefaultCallLayout);
} }
} }
@@ -2149,8 +2156,10 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
MeetingIsLockedFeedback.BoolValue, MeetingIsLockedFeedback.BoolValue,
MeetingIsRecordingFeedback.BoolValue MeetingIsRecordingFeedback.BoolValue
); );
SetDefaultLayout();
} }
// TODO [ ] Issue #868
else if (item.Status == eCodecCallStatus.Disconnected) else if (item.Status == eCodecCallStatus.Disconnected)
{ {
MeetingInfo = new MeetingInfo( MeetingInfo = new MeetingInfo(
@@ -2171,11 +2180,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
Debug.Console(1, this, "[OnCallStatusChange] Current Call Status: {0}", Debug.Console(1, this, "[OnCallStatusChange] Current Call Status: {0}",
Status.Call != null ? Status.Call.Status.ToString() : "no call"); Status.Call != null ? Status.Call.Status.ToString() : "no call");
if (_props.AutoDefaultLayouts)
{
SetLayout();
}
} }
private string GetSharingStatus() private string GetSharingStatus()
@@ -3264,7 +3268,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
// There is no property that directly reports if strip mode is valid, but API stipulates // There is no property that directly reports if strip mode is valid, but API stipulates
// that strip mode is available if the number of screens is 1 // that strip mode is available if the number of screens is 1
if (Status.NumberOfScreens.NumOfScreens == 1) if (Status.NumberOfScreens.NumOfScreens == 1 || Status.Layout.can_Switch_Strip_View || Status.Layout.video_type.ToLower() == "strip")
{ {
availableLayouts |= zConfiguration.eLayoutStyle.Strip; availableLayouts |= zConfiguration.eLayoutStyle.Strip;
} }
@@ -3279,10 +3283,15 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
var handler = LayoutInfoChanged; var handler = LayoutInfoChanged;
if (handler != null) if (handler != null)
{ {
var currentLayout = zConfiguration.eLayoutStyle.None;
currentLayout = (zConfiguration.eLayoutStyle)Enum.Parse(typeof(zConfiguration.eLayoutStyle), string.IsNullOrEmpty(LocalLayoutFeedback.StringValue) ? "None" : LocalLayoutFeedback.StringValue, true);
handler(this, new LayoutInfoChangedEventArgs() handler(this, new LayoutInfoChangedEventArgs()
{ {
AvailableLayouts = AvailableLayouts, AvailableLayouts = AvailableLayouts,
CurrentSelectedLayout = (zConfiguration.eLayoutStyle)Enum.Parse(typeof(zConfiguration.eLayoutStyle),string.IsNullOrEmpty(LocalLayoutFeedback.StringValue) ? "None" : LocalLayoutFeedback.StringValue , true), CurrentSelectedLayout = currentLayout,
LayoutViewIsOnFirstPage = LayoutViewIsOnFirstPageFeedback.BoolValue, LayoutViewIsOnFirstPage = LayoutViewIsOnFirstPageFeedback.BoolValue,
LayoutViewIsOnLastPage = LayoutViewIsOnLastPageFeedback.BoolValue, LayoutViewIsOnLastPage = LayoutViewIsOnLastPageFeedback.BoolValue,
CanSwapContentWithThumbnail = CanSwapContentWithThumbnailFeedback.BoolValue, CanSwapContentWithThumbnail = CanSwapContentWithThumbnailFeedback.BoolValue,
@@ -3415,11 +3424,6 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
//OnPasswordRequired(false, false, true, ""); //OnPasswordRequired(false, false, true, "");
} }
public void CancelPasswordPrompt()
{
OnPasswordRequired(false, false, true, "Login Cancelled");
}
void OnPasswordRequired(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message) void OnPasswordRequired(bool lastAttemptIncorrect, bool loginFailed, bool loginCancelled, string message)
{ {
var handler = PasswordRequired; var handler = PasswordRequired;

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using Crestron.SimplSharp; using Crestron.SimplSharp;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
@@ -29,11 +30,13 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.ZoomRoom
/* This layout will be selected when Sharing starts (either from Far end or locally)*/ /* This layout will be selected when Sharing starts (either from Far end or locally)*/
[JsonProperty("defaultSharingLayout")] [JsonProperty("defaultSharingLayout")]
public string DefaultSharingLayout { get; set; } [JsonConverter(typeof(StringEnumConverter))]
public zConfiguration.eLayoutStyle DefaultSharingLayout { get; set; }
//This layout will be selected when a call is connected and no content is being shared //This layout will be selected when a call is connected and no content is being shared
[JsonProperty("defaultCallLayout")] [JsonProperty("defaultCallLayout")]
public string DefaultCallLayout { get; set; } [JsonConverter(typeof(StringEnumConverter))]
public zConfiguration.eLayoutStyle DefaultCallLayout { get; set; }
[JsonProperty("minutesBeforeMeetingStart")] [JsonProperty("minutesBeforeMeetingStart")]
public int MinutesBeforeMeetingStart { get; set; } public int MinutesBeforeMeetingStart { get; set; }