From c31a2a09deaea57428d03fd20953157f157d35d7 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 13 Jul 2020 13:41:44 -0600 Subject: [PATCH] revisiting inheritance --- PepperDashEssentials/ControlSystem.cs | 2 +- .../PepperDashEssentials.csproj | 1 + .../UI/EssentialsTouchpanelController.cs | 74 ++-- .../Essentials/EssentialsHeaderDriver.cs | 98 ++++- ...ntialsDualDisplayPanelAvFunctionsDriver.cs | 363 ++++++++++++++++-- .../EssentialsHuddlePanelAvFunctionsDriver.cs | 3 - ...entialsHuddleVtc1PanelAvFunctionsDriver.cs | 8 +- .../UIDrivers/IHasCalendarButton.cs | 16 + .../EssentialsNDisplayRoomPropertiesConfig.cs | 6 +- .../Rooms/EssentialsRoomBase.cs | 1 - .../Rooms/Types/EssentialsDualDisplayRoom.cs | 123 +----- .../Rooms/Types/EssentialsHuddleVtc1Room.cs | 35 +- 12 files changed, 492 insertions(+), 238 deletions(-) create mode 100644 PepperDashEssentials/UIDrivers/IHasCalendarButton.cs diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index 930d1fc8..e6c4f74a 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -449,7 +449,7 @@ namespace PepperDash.Essentials var room = EssentialsRoomConfigHelper.GetRoomObject(roomConfig) as EssentialsRoomBase; if (room == null) { - Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);' + Debug.Console(0, Debug.ErrorLogLevel.Notice, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key); return; } diff --git a/PepperDashEssentials/PepperDashEssentials.csproj b/PepperDashEssentials/PepperDashEssentials.csproj index 66e494fb..011db25b 100644 --- a/PepperDashEssentials/PepperDashEssentials.csproj +++ b/PepperDashEssentials/PepperDashEssentials.csproj @@ -155,6 +155,7 @@ + diff --git a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs index eade64bd..fb03e9d0 100644 --- a/PepperDashEssentials/UI/EssentialsTouchpanelController.cs +++ b/PepperDashEssentials/UI/EssentialsTouchpanelController.cs @@ -231,8 +231,10 @@ namespace PepperDash.Essentials // AV Driver Debug.Console(0, panelController, "Adding huddle space AV driver"); - var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props); - avDriver.DefaultRoomKey = props.DefaultRoomKey; + var avDriver = new EssentialsHuddlePanelAvFunctionsDriver(mainDriver, props) + { + DefaultRoomKey = props.DefaultRoomKey + }; mainDriver.AvDriver = avDriver; avDriver.CurrentRoom = room as EssentialsHuddleSpaceRoom; @@ -249,24 +251,25 @@ namespace PepperDash.Essentials panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. - if (panelController.Panel is TswFt5ButtonSystem) + if (!(panelController.Panel is TswFt5ButtonSystem)) { - var tsw = panelController.Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - if (mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + return; } + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.PowerButtonPressed(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if (mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); } else if (room is EssentialsHuddleVtc1Room) { @@ -278,7 +281,7 @@ namespace PepperDash.Essentials // AV Driver var avDriver = new EssentialsHuddleVtc1PanelAvFunctionsDriver(mainDriver, props); - var codecDriver = new PepperDash.Essentials.UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, + var codecDriver = new UIDrivers.VC.EssentialsVideoCodecUiDriver(panelController.Panel, avDriver, (room as EssentialsHuddleVtc1Room).VideoCodec, mainDriver.HeaderDriver); avDriver.SetVideoCodecDriver(codecDriver); avDriver.DefaultRoomKey = props.DefaultRoomKey; @@ -298,24 +301,25 @@ namespace PepperDash.Essentials panelController.LoadAndShowDriver(mainDriver); // This is a little convoluted. - if (panelController.Panel is TswFt5ButtonSystem) + if (!(panelController.Panel is TswFt5ButtonSystem)) { - var tsw = panelController.Panel as TswFt5ButtonSystem; - // Wire up hard keys - tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); - //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); - if (mainDriver.EnvironmentDriver != null) - tsw.Lights.UserObject = new Action(b => - { - if (!b) - { - //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); - mainDriver.EnvironmentDriver.Toggle(); - } - }); - tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); - tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); + return; } + var tsw = panelController.Panel as TswFt5ButtonSystem; + // Wire up hard keys + tsw.Power.UserObject = new Action(b => { if (!b) avDriver.EndMeetingPress(); }); + //tsw.Home.UserObject = new Action(b => { if (!b) HomePressed(); }); + if (mainDriver.EnvironmentDriver != null) + tsw.Lights.UserObject = new Action(b => + { + if (!b) + { + //mainDriver.AvDriver.PopupInterlock.ShowInterlockedWithToggle(mainDriver.EnvironmentDriver.BackgroundSubpageJoin); + mainDriver.EnvironmentDriver.Toggle(); + } + }); + tsw.Up.UserObject = new Action(avDriver.VolumeUpPress); + tsw.Down.UserObject = new Action(avDriver.VolumeDownPress); } else { diff --git a/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs b/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs index e62b7351..b2a3ee61 100644 --- a/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs +++ b/PepperDashEssentials/UIDrivers/Essentials/EssentialsHeaderDriver.cs @@ -16,6 +16,7 @@ using PepperDash.Essentials.Core.PageManagers; using PepperDash.Essentials.Core.Rooms.Config; using PepperDash.Essentials.Core.Devices.Codec; using PepperDash.Essentials.Devices.Common.VideoCodec; +using PepperDashEssentials.UIDrivers.EssentialsDualDisplay; namespace PepperDash.Essentials @@ -136,37 +137,39 @@ namespace PepperDash.Essentials return nextJoin; } - uint SetUpCalendarButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) + uint SetUpCalendarButton(IHasCalendarButton avDriver, uint nextJoin) { // Calendar button - if (avDriver.CurrentRoom.ScheduleSource != null) + var room = avDriver.CurrentRoom as EssentialsHuddleVtc1Room; + if (room != null && room.ScheduleSource == null) { - var tempJoin = nextJoin; - TriList.SetString(tempJoin, "Calendar"); - CalendarCaretVisible = tempJoin + 10; - TriList.SetSigFalseAction(tempJoin, () => - { - avDriver.CalendarPress(); - CaretInterlock.ShowInterlocked(CalendarCaretVisible); - }); - - nextJoin--; return nextJoin; } - else - return nextJoin; + + var tempJoin = nextJoin; + TriList.SetString(tempJoin, "Calendar"); + CalendarCaretVisible = tempJoin + 10; + TriList.SetSigFalseAction(tempJoin, () => + { + avDriver.CalendarPress(); + CaretInterlock.ShowInterlocked(CalendarCaretVisible); + }); + + nextJoin--; + return nextJoin; } - uint SetUpCallButton(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, uint nextJoin) + uint SetUpCallButton(IHasCallButton avDriver, uint nextJoin) { // Call button + var room = avDriver.CurrentRoom as EssentialsHuddleVtc1Room; var tempJoin = nextJoin; TriList.SetString(tempJoin, "DND"); CallCaretVisible = tempJoin + 10; TriList.SetSigFalseAction(tempJoin, () => { avDriver.ShowActiveCallsList(); - if(avDriver.CurrentRoom.InCallFeedback.BoolValue) + if(room != null && room.InCallFeedback.BoolValue) CaretInterlock.ShowInterlocked(CallCaretVisible); }); HeaderCallButtonIconSig = TriList.StringInput[tempJoin]; @@ -225,6 +228,7 @@ namespace PepperDash.Essentials public void SetupHeaderButtons(EssentialsHuddleVtc1PanelAvFunctionsDriver avDriver, EssentialsHuddleVtc1Room currentRoom) { HeaderButtonsAreSetUp = false; + var room = avDriver.CurrentRoom as EssentialsHuddleVtc1Room; TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); @@ -257,7 +261,67 @@ namespace PepperDash.Essentials () => { avDriver.ShowActiveCallsList(); - if (avDriver.CurrentRoom.InCallFeedback.BoolValue) + if (room != null && room.InCallFeedback.BoolValue) + CaretInterlock.ShowInterlocked(CallCaretVisible); + }); + + // Set Call Status Subpage Position + + if (nextJoin == 3951) + { + // Set to right position + TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, false); + TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, true); + } + else if (nextJoin == 3950) + { + // Set to left position + TriList.SetBool(UIBoolJoin.HeaderCallStatusLeftPositionVisible, true); + TriList.SetBool(UIBoolJoin.HeaderCallStatusRightPositionVisible, false); + } + + HeaderButtonsAreSetUp = true; + + ComputeHeaderCallStatus(currentRoom.VideoCodec); + } + + public void SetupHeaderButtons(EssentialsDualDisplayPanelAvFunctionsDriver avDriver, EssentialsHuddleVtc1Room currentRoom) + { + HeaderButtonsAreSetUp = false; + var room = avDriver.CurrentRoom as EssentialsHuddleVtc1Room; + + TriList.SetBool(UIBoolJoin.TopBarHabaneroDynamicVisible, true); + + var roomConf = currentRoom.PropertiesConfig; + + // Register for the PopupInterlock IsShowsFeedback event to tie the header carets subpage visiblity to it + Parent.AvDriver.PopupInterlock.StatusChanged -= PopupInterlock_StatusChanged; + Parent.AvDriver.PopupInterlock.StatusChanged += PopupInterlock_StatusChanged; + + SetUpGear(avDriver, currentRoom); + + SetUpHelpButton(roomConf); + + uint nextJoin = 3953; + + nextJoin = SetUpEnvironmentButton(Parent.EnvironmentDriver, nextJoin); + + nextJoin = SetUpCalendarButton(avDriver, nextJoin); + + nextJoin = SetUpCallButton(avDriver, nextJoin); + + // blank any that remain + for (var i = nextJoin; i > 3950; i--) + { + TriList.SetString(i, "Blank"); + TriList.SetSigFalseAction(i, () => { }); + } + + TriList.SetSigFalseAction(UIBoolJoin.HeaderCallStatusLabelPress, + () => + { + avDriver.ShowActiveCallsList(); + if (room != null && room.InCallFeedback.BoolValue) CaretInterlock.ShowInterlocked(CallCaretVisible); }); diff --git a/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs index c310678a..59801977 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsDualDisplay/EssentialsDualDisplayPanelAvFunctionsDriver.cs @@ -8,6 +8,7 @@ using PepperDash.Essentials; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Devices.Codec; +using PepperDash.Essentials.Core.Devices.VideoCodec; using PepperDash.Essentials.Core.PageManagers; using PepperDash.Essentials.Core.Touchpanels.Keyboards; using PepperDash.Essentials.UIDrivers; @@ -15,7 +16,7 @@ using PepperDash.Essentials.UIDrivers.VC; namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay { - public class EssentialsDualDisplayPanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver + public class EssentialsDualDisplayPanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver, IHasCalendarButton, IHasCallButton { #region UiDisplayMode enum @@ -86,6 +87,28 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay set { SetCurrentRoom(value as EssentialsDualDisplayRoom); } } + public void ShowActiveCallsList() + { + TriList.SetBool(UIBoolJoin.CallEndAllConfirmVisible, true); + if (PopupInterlock.CurrentJoin == UIBoolJoin.HeaderActiveCallsListVisible) + { + PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HeaderActiveCallsListVisible); + } + else + { + var videoCodecBase = _currentRoom.ScheduleSource as VideoCodecBase; + if (videoCodecBase != null && videoCodecBase.IsInCall) + { + PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.HeaderActiveCallsListVisible); + } + } + } + + public void CalendarPress() + { + PopupInterlock.ShowInterlockedWithToggle(UIBoolJoin.MeetingsOrContacMethodsListVisible); + } + public SubpageReferenceList MeetingOrContactMethodModalSrl { get; set; } public JoinedSigInterlock PopupInterlock { get; private set; } @@ -109,30 +132,6 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay }, timeout); } - private void SetupActivityFooterWhenRoomOff() - { - _activityFooterSrl.Clear(); - _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, _activityFooterSrl, 0, - b => - { - if (!b) - { - ActivityShareButtonPressed(); - } - })); - _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, _activityFooterSrl, 3, - b => - { - if (!b) - { - ActivityCallButtonPressed(); - } - })); - _activityFooterSrl.Count = 2; - TriList.SetUshort(UIUshortJoin.PresentationStagingCaretMode, 1); // right one slot - TriList.SetUshort(UIUshortJoin.CallStagingCaretMode, 5); // left one slot - } - public void HideNotificationRibbon() { TriList.SetBool(UIBoolJoin.NotificationRibbonVisible, false); @@ -184,6 +183,30 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay #endregion + private void SetupActivityFooterWhenRoomOff() + { + _activityFooterSrl.Clear(); + _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(1, _activityFooterSrl, 0, + b => + { + if (!b) + { + ActivityShareButtonPressed(); + } + })); + _activityFooterSrl.AddItem(new SubpageReferenceListActivityItem(2, _activityFooterSrl, 3, + b => + { + if (!b) + { + ActivityCallButtonPressed(); + } + })); + _activityFooterSrl.Count = 2; + TriList.SetUshort(UIUshortJoin.PresentationStagingCaretMode, 1); // right one slot + TriList.SetUshort(UIUshortJoin.CallStagingCaretMode, 5); // left one slot + } + private void HideLogo() { TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); @@ -211,7 +234,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay && CurrentRoom.ShutdownType == eShutdownType.None; _endMeetingButtonSig.BoolValue = CurrentRoom.ShutdownType != eShutdownType.None; } - + private void UiSelectSource(string key) { // Run the route and when it calls back, show the source @@ -361,6 +384,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay { RefreshCurrentRoom(_currentRoom); } + private void CurrentRoom_CurrentAudioDeviceChange(object sender, VolumeDeviceChangeEventArgs args) { if (args.Type == ChangeType.WillChange) @@ -372,6 +396,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay RefreshAudioDeviceConnections(); } } + public void VolumeUpPress(bool state) { if (CurrentRoom.CurrentVolumeControls != null) @@ -524,7 +549,7 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay { pm = _pageManagers[uiDev]; } - // Otherwise make an apporiate one + // Otherwise make an apporiate one else if (uiDev is ISetTopBoxControls) { pm = new SetTopBoxThreePanelPageManager(uiDev as ISetTopBoxControls, TriList); @@ -629,10 +654,125 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay { return; } - var value = (ushort)(intFeedback.UShortValue * 65535 / 100); + var value = (ushort) (intFeedback.UShortValue*65535/100); TriList.UShortInput[ModalDialog.TimerGaugeJoin].UShortValue = value; } + private void ShutdownPromptTimer_HasStarted(object sender, EventArgs e) + { + // Do we need to check where the UI is? No? + var timer = CurrentRoom.ShutdownPromptTimer; + SetActivityFooterFeedbacks(); + + if (CurrentRoom.ShutdownType == eShutdownType.Manual || CurrentRoom.ShutdownType == eShutdownType.Vacancy) + { + _powerDownModal = new ModalDialog(TriList); + var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds); + + // Attach timer things to modal + CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += + ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; + CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange += + ShutdownPromptTimer_PercentFeedback_OutputChange; + + // respond to offs by cancelling dialog + var onFb = CurrentRoom.OnFeedback; + EventHandler offHandler = null; + offHandler = (o, a) => + { + if (!onFb.BoolValue) + { + _powerDownModal.HideDialog(); + SetActivityFooterFeedbacks(); + onFb.OutputChange -= offHandler; + } + }; + onFb.OutputChange += offHandler; + + _powerDownModal.PresentModalDialog(2, "End Meeting", "Power", message, "Cancel", "End Meeting Now", true, + true, + but => + { + if (but != 2) // any button except for End cancels + { + timer.Cancel(); + } + else + { + timer.Finish(); + } + }); + } + } + + private void ShutdownPromptTimer_HasFinished(object sender, EventArgs e) + { + SetActivityFooterFeedbacks(); + CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange -= + ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; + CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= + ShutdownPromptTimer_PercentFeedback_OutputChange; + } + + private void ShutdownPromptTimer_WasCancelled(object sender, EventArgs e) + { + if (_powerDownModal != null) + { + _powerDownModal.HideDialog(); + } + SetActivityFooterFeedbacks(); + + CurrentRoom.ShutdownPromptTimer.TimeRemainingFeedback.OutputChange += + ShutdownPromptTimer_TimeRemainingFeedback_OutputChange; + CurrentRoom.ShutdownPromptTimer.PercentFeedback.OutputChange -= + ShutdownPromptTimer_PercentFeedback_OutputChange; + } + + private void CurrentRoom_IsWarmingFeedback_OutputChange(object sender, EventArgs e) + { + if (CurrentRoom.IsWarmingUpFeedback.BoolValue) + { + ShowNotificationRibbon("Room is powering on. Please wait...", 0); + } + else + { + ShowNotificationRibbon("Room is powered on. Welcome.", 2000); + } + } + + /// + /// + /// + /// + /// + private void CurrentRoom_IsCoolingDownFeedback_OutputChange(object sender, EventArgs e) + { + if (CurrentRoom.IsCoolingDownFeedback.BoolValue) + { + ShowNotificationRibbon("Room is powering off. Please wait.", 0); + } + else + { + HideNotificationRibbon(); + } + } + + private void CurrentRoom_InCallFeedback_OutputChange(object sender, EventArgs e) + { + var inCall = _currentRoom.InCallFeedback.BoolValue; + if (inCall) + { + // Check if transitioning to in call - and non-sharable source is in use + if (CurrentRoom.CurrentSourceInfo != null && CurrentRoom.CurrentSourceInfo.DisableCodecSharing) + { + Debug.Console(1, CurrentRoom, "Transitioning to in-call, cancelling non-sharable source"); + CurrentRoom.RunRouteAction("codecOsd", CurrentRoom.SourceListKey); + } + } + + SetupSourceList(); + } + private void RefreshCurrentRoom(EssentialsDualDisplayRoom room) { if (_currentRoom != null) @@ -718,5 +858,172 @@ namespace PepperDashEssentials.UIDrivers.EssentialsDualDisplay TriList.StringInput[UIStringJoin.CurrentRoomName].StringValue = "Select a room"; } } + + private void SharingContentIsOnFeedback_OutputChange(object sender, EventArgs e) + { + SetActiveCallListSharingContentStatus(); + } + + private void SetActiveCallListSharingContentStatus() + { + _callSharingInfoVisibleFeedback.FireUpdate(); + + string callListSharedSourceLabel; + + if (_currentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _currentRoom.CurrentSourceInfo != null) + { + Debug.Console(0, "*#* CurrentRoom.CurrentSourceInfo = {0}", + _currentRoom.CurrentSourceInfo != null ? _currentRoom.CurrentSourceInfo.SourceKey : "Nada!"); + callListSharedSourceLabel = _currentRoom.CurrentSourceInfo.PreferredName; + } + else + { + callListSharedSourceLabel = "None"; + } + + TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = callListSharedSourceLabel; + } + + private void CurrentRoom_CurrentSingleSourceChange(SourceListItem info, ChangeType type) + { + if (_currentRoom.VideoCodec.SharingContentIsOnFeedback.BoolValue && _currentRoom.CurrentSourceInfo != null) + { + TriList.StringInput[UIStringJoin.CallSharedSourceNameText].StringValue = + _currentRoom.CurrentSourceInfo.PreferredName; + } + } + + private void CodecSchedule_MeetingsListHasChanged(object sender, EventArgs e) + { + RefreshMeetingsList(); + } + + private void ShowLogo() + { + if (CurrentRoom.LogoUrl == null) + { + TriList.SetBool(UIBoolJoin.LogoDefaultVisible, true); + TriList.SetBool(UIBoolJoin.LogoUrlVisible, false); + } + else + { + TriList.SetBool(UIBoolJoin.LogoDefaultVisible, false); + TriList.SetBool(UIBoolJoin.LogoUrlVisible, true); + TriList.SetString(UIStringJoin.LogoUrl, _currentRoom.LogoUrl); + } + } + + private void RefreshMeetingsList() + { + // See if this is helpful or if the callback response in the codec class maybe doesn't come it time? + // Let's build list from event + // CurrentRoom.ScheduleSource.GetSchedule(); + + TriList.SetString(UIStringJoin.MeetingsOrContactMethodListIcon, "Calendar"); + TriList.SetString(UIStringJoin.MeetingsOrContactMethodListTitleText, "Today's Meetings"); + + ushort i = 0; + foreach (var m in _currentRoom.ScheduleSource.CodecSchedule.Meetings) + { + i++; + MeetingOrContactMethodModalSrl.StringInputSig(i, 1).StringValue = m.StartTime.ToShortTimeString(); + MeetingOrContactMethodModalSrl.StringInputSig(i, 2).StringValue = m.EndTime.ToShortTimeString(); + MeetingOrContactMethodModalSrl.StringInputSig(i, 3).StringValue = m.Title; + MeetingOrContactMethodModalSrl.StringInputSig(i, 4).StringValue = string.Format("
{0}", m.Organizer); + MeetingOrContactMethodModalSrl.StringInputSig(i, 5).StringValue = "Join"; + MeetingOrContactMethodModalSrl.BoolInputSig(i, 2).BoolValue = m.Joinable; + var mm = m; // lambda scope + MeetingOrContactMethodModalSrl.GetBoolFeedbackSig(i, 1).SetSigFalseAction(() => + { + PopupInterlock.Hide(); + ActivityCallButtonPressed(); + var d = _currentRoom.ScheduleSource as VideoCodecBase; + if (d != null) + { + RoomOnAndDialMeeting(mm); + } + }); + } + MeetingOrContactMethodModalSrl.Count = i; + + if (i == 0) // Show item indicating no meetings are booked for rest of day + { + MeetingOrContactMethodModalSrl.Count = 1; + + MeetingOrContactMethodModalSrl.StringInputSig(1, 1).StringValue = string.Empty; + MeetingOrContactMethodModalSrl.StringInputSig(1, 2).StringValue = string.Empty; + MeetingOrContactMethodModalSrl.StringInputSig(1, 3).StringValue = + "No Meetings are booked for the remainder of the day."; + MeetingOrContactMethodModalSrl.StringInputSig(1, 4).StringValue = string.Empty; + MeetingOrContactMethodModalSrl.StringInputSig(1, 5).StringValue = string.Empty; + } + } + + private void CurrentRoom_OnFeedback_OutputChange(object sender, EventArgs e) + { + CurrentRoom_SyncOnFeedback(); + } + + private void RoomOnAndDialMeeting(Meeting meeting) + { + Action dialAction = () => + { + var d = _currentRoom.ScheduleSource as VideoCodecBase; + if (d != null) + { + d.Dial(meeting); + _lastMeetingDismissedId = meeting.Id; // To prevent prompts for already-joined call + } + }; + if (CurrentRoom.OnFeedback.BoolValue) + { + dialAction(); + } + else + { + // Rig a one-time handler to catch when the room is warmed and then dial call + EventHandler oneTimeHandler = null; + oneTimeHandler = (o, a) => + { + if (!CurrentRoom.IsWarmingUpFeedback.BoolValue) + { + CurrentRoom.IsWarmingUpFeedback.OutputChange -= oneTimeHandler; + dialAction(); + } + }; + CurrentRoom.IsWarmingUpFeedback.OutputChange += oneTimeHandler; + ActivityCallButtonPressed(); + } + } + + private void CurrentRoom_SyncOnFeedback() + { + var value = _currentRoom.OnFeedback.BoolValue; + TriList.BooleanInput[UIBoolJoin.RoomIsOn].BoolValue = value; + + TriList.BooleanInput[UIBoolJoin.StartPageVisible].BoolValue = !value; + + if (value) //ON + { + SetupActivityFooterWhenRoomOn(); + TriList.BooleanInput[UIBoolJoin.SelectASourceVisible].BoolValue = false; + TriList.BooleanInput[UIBoolJoin.VolumeDualMute1Visible].BoolValue = true; + } + else + { + _currentMode = UiDisplayMode.Start; + if (_vcDriver.IsVisible) + { + _vcDriver.Hide(); + } + SetupActivityFooterWhenRoomOff(); + ShowLogo(); + SetActivityFooterFeedbacks(); + TriList.BooleanInput[UIBoolJoin.VolumeDualMute1Visible].BoolValue = false; + TriList.BooleanInput[UIBoolJoin.SourceStagingBarVisible].BoolValue = false; + // Clear this so that the pesky meeting warning can resurface every minute when off + _lastMeetingDismissedId = null; + } + } } } \ No newline at end of file diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs index d737c0ce..3c42b247 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddle/EssentialsHuddlePanelAvFunctionsDriver.cs @@ -10,9 +10,6 @@ using PepperDash.Essentials.UIDrivers; namespace PepperDash.Essentials { - /// - /// - /// public class EssentialsHuddlePanelAvFunctionsDriver : PanelDriverBase, IAVDriver { private readonly CrestronTouchpanelPropertiesConfig _config; diff --git a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs index c3c97eae..1f03001d 100644 --- a/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs +++ b/PepperDashEssentials/UIDrivers/EssentialsHuddleVTC/EssentialsHuddleVtc1PanelAvFunctionsDriver.cs @@ -18,7 +18,7 @@ namespace PepperDash.Essentials /// /// /// - public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver + public class EssentialsHuddleVtc1PanelAvFunctionsDriver : PanelDriverBase, IAVWithVCDriver,IHasCallButton, IHasCalendarButton { #region UiDisplayMode enum @@ -196,10 +196,10 @@ namespace PepperDash.Essentials /// /// /// - public EssentialsRoomBase CurrentRoom + public EssentialsHuddleVtc1Room CurrentRoom { get { return _currentRoom; } - set { SetCurrentRoom(value as EssentialsHuddleVtc1Room); } + set { SetCurrentRoom(value); } } /// @@ -1558,7 +1558,7 @@ namespace PepperDash.Essentials /// public interface IAVWithVCDriver : IAVDriver { - EssentialsRoomBase CurrentRoom { get; } + EssentialsHuddleVtc1Room CurrentRoom { get; } HabaneroKeyboardController Keyboard { get; } SubpageReferenceList MeetingOrContactMethodModalSrl { get; } diff --git a/PepperDashEssentials/UIDrivers/IHasCalendarButton.cs b/PepperDashEssentials/UIDrivers/IHasCalendarButton.cs new file mode 100644 index 00000000..b42bb326 --- /dev/null +++ b/PepperDashEssentials/UIDrivers/IHasCalendarButton.cs @@ -0,0 +1,16 @@ +using PepperDash.Essentials.Core; + +namespace PepperDash.Essentials +{ + public interface IHasCalendarButton + { + EssentialsRoomBase CurrentRoom { get; } + void CalendarPress(); + } + + public interface IHasCallButton + { + EssentialsRoomBase CurrentRoom { get; } + void ShowActiveCallsList(); + } +} \ No newline at end of file diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs index b6a9bb32..db599403 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Config/EssentialsNDisplayRoomPropertiesConfig.cs @@ -1,9 +1,5 @@ -using System.Collections.Generic; -using PepperDash.Core; -using PepperDash.Essentials.Core; - +using PepperDash.Core; using Newtonsoft.Json; -using PepperDash.Essentials.Core.Config; namespace PepperDash.Essentials.Core.Rooms.Config { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/EssentialsRoomBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/EssentialsRoomBase.cs index d5d77fe4..b630d5dc 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/EssentialsRoomBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/EssentialsRoomBase.cs @@ -210,7 +210,6 @@ namespace PepperDash.Essentials.Core /// public event EventHandler RoomOccupancyIsSet; - private void SetupRoomVacancyShutdown() { RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer"); diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs index b10370a7..e512cc32 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsDualDisplayRoom.cs @@ -4,27 +4,17 @@ using System.Linq; using PepperDash.Core; using PepperDash.Essentials.Core; using PepperDash.Essentials.Core.Config; -using PepperDash.Essentials.Core.Devices.AudioCodec; -using PepperDash.Essentials.Core.Devices.VideoCodec; -using PepperDash.Essentials.Core.Rooms; using PepperDash.Essentials.Core.Rooms.Config; using PepperDash_Essentials_Core.Devices; namespace PepperDash.Essentials { - public class EssentialsDualDisplayRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, - IPrivacy, IHasCurrentVolumeControls, IRunRouteAction, IRunDefaultCallRoute, IHasVideoCodec, IHasAudioCodec, - IHasDefaultDisplay, IHasInCallFeedback + public class EssentialsDualDisplayRoom : EssentialsHuddleVtc1Room { public const string DefaultDestinationListKey = "default"; private const string LeftDestinationKey = "leftDisplay"; private const string RightDestinationKey = "rightDisplay"; - /// - /// "codecOsd" - /// - public const string DefaultCodecRouteString = "codecOsd"; - private readonly EssentialsDualDisplayRoomPropertiesConfig _config; private string _destinationListKey; @@ -33,23 +23,6 @@ namespace PepperDash.Essentials { _config = config.Properties.ToObject(); - DefaultDisplay = DeviceManager.GetDeviceForKey(_config.DefaultDisplayKey) as IRoutingSinkWithSwitching; - DefaultAudioDevice = DeviceManager.GetDeviceForKey(_config.DefaultAudioKey) as IRoutingSinkWithSwitching; - - VideoCodec = DeviceManager.GetDeviceForKey(_config.VideoCodecKey) as VideoCodecBase; - - if (VideoCodec == null) - { - throw new ArgumentNullException("codec cannot be null"); - } - - AudioCodec = DeviceManager.GetDeviceForKey(_config.AudioCodecKey) as AudioCodecBase; - - if (AudioCodec == null) - { - Debug.Console(0, this, "No audio codec found"); - } - Initialize(); } @@ -63,109 +36,15 @@ namespace PepperDash.Essentials public IRoutingSinkWithSwitching LeftDisplay { get; private set; } public IRoutingSinkWithSwitching RightDisplay { get; private set; } - #region IHasAudioCodec Members - - public AudioCodecBase AudioCodec { get; private set; } - - #endregion - - #region IHasVideoCodec Members - - public BoolFeedback InCallFeedback { get; private set; } - - public IntFeedback CallTypeFeedback { get; private set; } - - public BoolFeedback IsSharingFeedback { get; private set; } - - public VideoCodecBase VideoCodec { get; private set; } - - #endregion - - #region IPrivacy Members - - public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } - - public void PrivacyModeOff() - { - VideoCodec.PrivacyModeOff(); - } - - public void PrivacyModeOn() - { - VideoCodec.PrivacyModeOn(); - } - - public void PrivacyModeToggle() - { - VideoCodec.PrivacyModeToggle(); - } - - #endregion - - #region IRunDefaultCallRoute Members - - /// - /// Sets up the room when started into call mode without presenting a source - /// - /// - public bool RunDefaultCallRoute() - { - RunRouteAction(DefaultCodecRouteString); - return true; - } - - #endregion - private void Initialize() { try { - if (DefaultAudioDevice is IBasicVolumeControls) - { - DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls; - } - else if (DefaultAudioDevice is IHasVolumeDevice) - { - DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice; - } - - CurrentVolumeControls = DefaultVolumeControls; - _destinationListKey = String.IsNullOrEmpty(_config.DestinationListKey) ? DefaultDestinationListKey : _config.DestinationListKey; - SourceListKey = String.IsNullOrEmpty(_config.SourceListKey) - ? DefaultSourceListKey - : _config.SourceListKey; - InitializeDestinations(); - - InCallFeedback = new BoolFeedback(() => - { - var inAudioCall = AudioCodec != null && AudioCodec.IsInCall; - var inVideoCall = VideoCodec != null && VideoCodec.IsInCall; - - return inAudioCall || inVideoCall; - }); - - MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(_config, this); - Emergency = EssentialsRoomConfigHelper.GetEmergency(_config, this); - - VideoCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate(); - - if (AudioCodec != null) - { - AudioCodec.CallStatusChange += (o, a) => InCallFeedback.FireUpdate(); - } - - IsSharingFeedback = new BoolFeedback(() => VideoCodec.SharingContentIsOnFeedback.BoolValue); - VideoCodec.SharingContentIsOnFeedback.OutputChange += (o, a) => IsSharingFeedback.FireUpdate(); - - PrivacyModeIsOnFeedback = new BoolFeedback(() => VideoCodec.PrivacyModeIsOnFeedback.BoolValue); - VideoCodec.PrivacyModeIsOnFeedback.OutputChange += (o, a) => PrivacyModeIsOnFeedback.FireUpdate(); - - CallTypeFeedback = new IntFeedback(() => 0); } catch (Exception e) { diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsHuddleVtc1Room.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsHuddleVtc1Room.cs index 29ea4a56..a68bcf8a 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsHuddleVtc1Room.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Rooms/Types/EssentialsHuddleVtc1Room.cs @@ -21,15 +21,14 @@ namespace PepperDash.Essentials /// public const string DefaultCodecRouteString = "codecOsd"; - public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; } + public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; protected set; } public EssentialsHuddleVtc1Room(DeviceConfig config) : base(config) { try { - PropertiesConfig = JsonConvert.DeserializeObject - (config.Properties.ToString()); + PropertiesConfig = config.Properties.ToObject(); DefaultDisplay = DeviceManager.GetDeviceForKey(PropertiesConfig.DefaultDisplayKey) as IRoutingSinkWithSwitching; @@ -68,28 +67,28 @@ namespace PepperDash.Essentials #region IHasAudioCodec Members - public AudioCodecBase AudioCodec { get; private set; } + public AudioCodecBase AudioCodec { get; protected set; } #endregion #region IHasVideoCodec Members - public BoolFeedback InCallFeedback { get; private set; } + public BoolFeedback InCallFeedback { get; protected set; } /// /// States: 0 for on hook, 1 for video, 2 for audio, 3 for telekenesis /// - public IntFeedback CallTypeFeedback { get; private set; } + public IntFeedback CallTypeFeedback { get; protected set; } /// /// When something in the room is sharing with the far end or through other means /// - public BoolFeedback IsSharingFeedback { get; private set; } + public BoolFeedback IsSharingFeedback { get; protected set; } //************************ - public VideoCodecBase VideoCodec { get; private set; } + public VideoCodecBase VideoCodec { get; protected set; } #endregion @@ -98,7 +97,7 @@ namespace PepperDash.Essentials /// /// /// - public BoolFeedback PrivacyModeIsOnFeedback { get; private set; } + public BoolFeedback PrivacyModeIsOnFeedback { get; protected set; } public void PrivacyModeOff() { @@ -149,18 +148,8 @@ namespace PepperDash.Essentials // Combines call feedback from both codecs if available InCallFeedback = new BoolFeedback(() => { - var inAudioCall = false; - var inVideoCall = false; - - if (AudioCodec != null) - { - inAudioCall = AudioCodec.IsInCall; - } - - if (VideoCodec != null) - { - inVideoCall = VideoCodec.IsInCall; - } + var inAudioCall = AudioCodec != null && AudioCodec.IsInCall; + var inVideoCall = VideoCodec != null && VideoCodec.IsInCall; return inAudioCall || inVideoCall; }); @@ -192,7 +181,9 @@ namespace PepperDash.Essentials CallTypeFeedback = new IntFeedback(() => 0); - SourceListKey = "default"; + SourceListKey = String.IsNullOrEmpty(PropertiesConfig.SourceListKey) + ? DefaultSourceListKey + : PropertiesConfig.SourceListKey; EnablePowerOnToLastSource = true; var disp = DefaultDisplay as DisplayBase;