From 1b43fba37e2a38bd275fac585a80d478a442c442 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 21 Nov 2022 10:28:08 -0700 Subject: [PATCH 1/4] fix: add logic to prevent vacancy from triggering room off if room is in a call --- .../Room/Types/EssentialsHuddleVtc1Room.cs | 18 ++++++++++++++++++ .../Room/EssentialsRoomBase.cs | 16 ++++++++++++++-- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index e622983f..0b7b2b28 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -745,6 +745,24 @@ namespace PepperDash.Essentials { //Implement this } + + protected override bool AllowVacancyTimerToStart() + { + bool allowVideo = true; + bool allowAudio = true; + + if (VideoCodec != null) + { + allowVideo = !VideoCodec.IsInCall; + } + + if (AudioCodec != null) + { + allowAudio = !AudioCodec.IsInCall; + } + + return allowVideo && allowAudio; + } /// /// Does what it says diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs index 352cbfcd..6cb06841 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs @@ -343,7 +343,7 @@ namespace PepperDash.Essentials.Core void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e) { - if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false) + if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false && AllowVacancyTimerToStart()) { Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected"); // Trigger the timer when the room is vacant @@ -361,7 +361,19 @@ namespace PepperDash.Essentials.Core /// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed /// /// - public abstract void RoomVacatedForTimeoutPeriod(object o); + public abstract void RoomVacatedForTimeoutPeriod(object o) + { + + } + + /// + /// Allow the vacancy event from an occupancy sensor to turn the room off. + /// + /// If the timer should be allowed. Defaults to true + protected virtual bool AllowVacancyTimerToStart() + { + return true; + } } /// From a2b67798f3bb3de1e5a6a9279ea7bfa838c14f67 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 21 Nov 2022 10:37:26 -0700 Subject: [PATCH 2/4] refactor: add logging statements --- PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 0b7b2b28..038acd9d 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -753,14 +753,18 @@ namespace PepperDash.Essentials if (VideoCodec != null) { + Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} is in a video call. Not allowing auto power off", Key); allowVideo = !VideoCodec.IsInCall; } if (AudioCodec != null) { + Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} is in an audio call. Not allowing auto power off", Key); allowAudio = !AudioCodec.IsInCall; } + Debug.Console(2, this, "Room {0} allowing vacancy timer to start: {1}", Key, allowVideo && allowAudio); + return allowVideo && allowAudio; } From 5263b16bb7f7ab30b4abd233bfcbab7ba2561e2c Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 21 Nov 2022 10:42:33 -0700 Subject: [PATCH 3/4] refactor: fix issues with log statments --- PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs index 038acd9d..d04de3cc 100644 --- a/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs +++ b/PepperDashEssentials/Room/Types/EssentialsHuddleVtc1Room.cs @@ -753,13 +753,13 @@ namespace PepperDash.Essentials if (VideoCodec != null) { - Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} is in a video call. Not allowing auto power off", Key); + Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} {1} in a video call", Key, VideoCodec.IsInCall ? "is" : "is not"); allowVideo = !VideoCodec.IsInCall; } if (AudioCodec != null) { - Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} is in an audio call. Not allowing auto power off", Key); + Debug.Console(2,this, Debug.ErrorLogLevel.Notice, "Room {0} {1} in an audio call", Key, AudioCodec.IsInCall ? "is" : "is not"); allowAudio = !AudioCodec.IsInCall; } From 430612847443b0eb07a5b271be116a606da8d0b3 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Mon, 21 Nov 2022 10:45:25 -0700 Subject: [PATCH 4/4] refactor: fix abstract method --- .../PepperDashEssentialsBase/Room/EssentialsRoomBase.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs index 6cb06841..f5e3dee8 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Room/EssentialsRoomBase.cs @@ -361,10 +361,7 @@ namespace PepperDash.Essentials.Core /// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed /// /// - public abstract void RoomVacatedForTimeoutPeriod(object o) - { - - } + public abstract void RoomVacatedForTimeoutPeriod(object o); /// /// Allow the vacancy event from an occupancy sensor to turn the room off.