mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 20:24:57 +00:00
Tied in Room Occupancy Timer to Shutdown timer in EssentialsRoomBase
This commit is contained in:
@@ -46,14 +46,6 @@
|
|||||||
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
|
<GenerateSerializationAssemblies>off</GenerateSerializationAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="Cisco One Button To Push, Version=1.0.0.26373, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>References\Cisco One Button To Push.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Cisco SX80 Corporate Phone Book, Version=1.0.0.15355, Culture=neutral, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>References\Cisco SX80 Corporate Phone Book.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
<Reference Include="Crestron.SimplSharpPro.DeviceSupport, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
|
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.DeviceSupport.dll</HintPath>
|
||||||
|
|||||||
@@ -6,10 +6,7 @@ using Crestron.SimplSharp;
|
|||||||
using Crestron.SimplSharp.Net.Https;
|
using Crestron.SimplSharp.Net.Https;
|
||||||
using Crestron.SimplSharp.CrestronXml;
|
using Crestron.SimplSharp.CrestronXml;
|
||||||
using Crestron.SimplSharp.CrestronXml.Serialization;
|
using Crestron.SimplSharp.CrestronXml.Serialization;
|
||||||
//using Crestron.SimplSharpPro;
|
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Cisco_One_Button_To_Push;
|
|
||||||
using Cisco_SX80_Corporate_Phone_Book;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ namespace PepperDash.Essentials
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Shutdown()
|
protected override void EndShutdown()
|
||||||
{
|
{
|
||||||
RunRouteAction("roomOff");
|
RunRouteAction("roomOff");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -260,8 +260,8 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Shutdown()
|
protected override void EndShutdown()
|
||||||
{
|
{
|
||||||
RunRouteAction("roomOff");
|
RunRouteAction("roomOff");
|
||||||
VideoCodec.EndAllCalls();
|
VideoCodec.EndAllCalls();
|
||||||
|
|||||||
@@ -261,8 +261,8 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public override void Shutdown()
|
protected override void EndShutdown()
|
||||||
{
|
{
|
||||||
RunRouteAction("roomoff");
|
RunRouteAction("roomoff");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,15 +45,25 @@ namespace PepperDash.Essentials
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public int ShutdownPromptSeconds { get; set; }
|
public int ShutdownPromptSeconds { get; set; }
|
||||||
public int ShutdownVacancySeconds { get; set; }
|
public int ShutdownVacancySeconds { get; set; }
|
||||||
public ShutdownType ShutdownType { get; private set; }
|
public eShutdownType ShutdownType { get; private set; }
|
||||||
|
|
||||||
public PepperDash.Essentials.Room.EssentialsRoomEmergencyBase Emergency { get; set; }
|
public PepperDash.Essentials.Room.EssentialsRoomEmergencyBase Emergency { get; set; }
|
||||||
|
|
||||||
public string LogoUrl { get; set; }
|
public string LogoUrl { get; set; }
|
||||||
|
|
||||||
protected CTimer RoomVacancyShutdownTimer;
|
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
||||||
|
|
||||||
protected long RoomVacancyShutdownTimeout = 1800000; // 30 minutes by default
|
public eVacancyMode VacancyMode { get; private set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Seconds after vacancy prompt is displayed until shutdown
|
||||||
|
/// </summary>
|
||||||
|
protected int RoomVacancyShutdownSeconds;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Seconds after vacancy detected until prompt is displayed
|
||||||
|
/// </summary>
|
||||||
|
protected int RoomVacancyShutdownPromptSeconds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -67,44 +77,96 @@ namespace PepperDash.Essentials
|
|||||||
/// <param name="name"></param>
|
/// <param name="name"></param>
|
||||||
public EssentialsRoomBase(string key, string name) : base(key, name)
|
public EssentialsRoomBase(string key, string name) : base(key, name)
|
||||||
{
|
{
|
||||||
|
// Setup the ShutdownPromptTimer
|
||||||
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
||||||
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||||
{
|
{
|
||||||
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
||||||
ShutdownType = ShutdownType.None;
|
ShutdownType = eShutdownType.None;
|
||||||
};
|
};
|
||||||
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
|
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
|
||||||
|
|
||||||
ShutdownPromptSeconds = 60;
|
ShutdownPromptSeconds = 60;
|
||||||
ShutdownVacancySeconds = 120;
|
ShutdownVacancySeconds = 120;
|
||||||
ShutdownType = ShutdownType.None;
|
ShutdownType = eShutdownType.None;
|
||||||
|
|
||||||
|
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
||||||
|
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||||
|
//{
|
||||||
|
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
||||||
|
// ShutdownType = ShutdownType.Vacancy;
|
||||||
|
//};
|
||||||
|
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
|
||||||
|
|
||||||
|
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
||||||
|
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
||||||
|
VacancyMode = eVacancyMode.None;
|
||||||
|
|
||||||
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
||||||
|
|
||||||
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
|
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
|
||||||
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
|
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
switch (VacancyMode)
|
||||||
|
{
|
||||||
|
case eVacancyMode.None:
|
||||||
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
|
break;
|
||||||
|
case eVacancyMode.InInitialVacancy:
|
||||||
|
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
||||||
|
break;
|
||||||
|
case eVacancyMode.InShutdownWarning:
|
||||||
|
StartShutdown(eShutdownType.Vacancy);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
public void StartShutdown(ShutdownType type)
|
public void StartShutdown(eShutdownType type)
|
||||||
{
|
{
|
||||||
// Check for shutdowns running. Manual should override other shutdowns
|
// Check for shutdowns running. Manual should override other shutdowns
|
||||||
|
|
||||||
if (type == ShutdownType.Manual)
|
if (type == eShutdownType.Manual)
|
||||||
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
||||||
else if (type == ShutdownType.Vacancy)
|
else if (type == eShutdownType.Vacancy)
|
||||||
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
||||||
ShutdownType = type;
|
ShutdownType = type;
|
||||||
ShutdownPromptTimer.Start();
|
ShutdownPromptTimer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartRoomVacancyTimer(eVacancyMode mode)
|
||||||
|
{
|
||||||
|
if (mode == eVacancyMode.None)
|
||||||
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
||||||
|
else if (mode == eVacancyMode.InInitialVacancy)
|
||||||
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
||||||
|
VacancyMode = mode;
|
||||||
|
RoomVacancyShutdownTimer.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// Resets the vacancy mode and shutsdwon the room
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Shutdown();
|
public void Shutdown()
|
||||||
|
{
|
||||||
|
VacancyMode = eVacancyMode.None;
|
||||||
|
EndShutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// This method is for the derived class to define it's specific shutdown
|
||||||
|
/// requirements but should not be called directly. It is called by Shutdown()
|
||||||
|
/// </summary>
|
||||||
|
protected abstract void EndShutdown();
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Override this to implement a default volume level(s) method
|
/// Override this to implement a default volume level(s) method
|
||||||
@@ -127,13 +189,13 @@ namespace PepperDash.Essentials
|
|||||||
if ((sender as IOccupancyStatusProvider).RoomIsOccupiedFeedback.BoolValue == false)
|
if ((sender as IOccupancyStatusProvider).RoomIsOccupiedFeedback.BoolValue == false)
|
||||||
{
|
{
|
||||||
// Trigger the timer when the room is vacant
|
// Trigger the timer when the room is vacant
|
||||||
RoomVacancyShutdownTimer = new CTimer(RoomVacatedForTimeoutPeriod, RoomVacancyShutdownTimeout);
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Reset the timer when the room is occupied
|
// Reset the timer when the room is occupied
|
||||||
if(RoomVacancyShutdownTimer != null)
|
if(RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
||||||
RoomVacancyShutdownTimer.Reset(RoomVacancyShutdownTimeout);
|
RoomVacancyShutdownTimer.Cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,18 +209,25 @@ namespace PepperDash.Essentials
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// To describe the various ways a room may be shutting down
|
/// To describe the various ways a room may be shutting down
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ShutdownType
|
public enum eShutdownType
|
||||||
{
|
{
|
||||||
None,
|
None = 0,
|
||||||
External,
|
External,
|
||||||
Manual,
|
Manual,
|
||||||
Vacancy
|
Vacancy
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eVacancyMode
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
InInitialVacancy,
|
||||||
|
InShutdownWarning
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum WarmingCoolingMode
|
public enum eWarmingCoolingMode
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
Warming,
|
Warming,
|
||||||
|
|||||||
@@ -474,7 +474,7 @@ namespace PepperDash.Essentials
|
|||||||
|| CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
|| CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CurrentRoom.StartShutdown(ShutdownType.Manual);
|
CurrentRoom.StartShutdown(eShutdownType.Manual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -489,7 +489,7 @@ namespace PepperDash.Essentials
|
|||||||
EndMeetingButtonSig.BoolValue = true;
|
EndMeetingButtonSig.BoolValue = true;
|
||||||
ShareButtonSig.BoolValue = false;
|
ShareButtonSig.BoolValue = false;
|
||||||
|
|
||||||
if (CurrentRoom.ShutdownType == ShutdownType.Manual)
|
if (CurrentRoom.ShutdownType == eShutdownType.Manual)
|
||||||
{
|
{
|
||||||
PowerDownModal = new ModalDialog(TriList);
|
PowerDownModal = new ModalDialog(TriList);
|
||||||
var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds);
|
var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds);
|
||||||
|
|||||||
@@ -473,10 +473,10 @@ namespace PepperDash.Essentials
|
|||||||
void SetActivityFooterFeedbacks()
|
void SetActivityFooterFeedbacks()
|
||||||
{
|
{
|
||||||
CallButtonSig.BoolValue = CurrentMode == UiDisplayMode.Call
|
CallButtonSig.BoolValue = CurrentMode == UiDisplayMode.Call
|
||||||
&& CurrentRoom.ShutdownType == ShutdownType.None;
|
&& CurrentRoom.ShutdownType == eShutdownType.None;
|
||||||
ShareButtonSig.BoolValue = CurrentMode == UiDisplayMode.Presentation
|
ShareButtonSig.BoolValue = CurrentMode == UiDisplayMode.Presentation
|
||||||
&& CurrentRoom.ShutdownType == ShutdownType.None;
|
&& CurrentRoom.ShutdownType == eShutdownType.None;
|
||||||
EndMeetingButtonSig.BoolValue = CurrentRoom.ShutdownType != ShutdownType.None;
|
EndMeetingButtonSig.BoolValue = CurrentRoom.ShutdownType != eShutdownType.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -600,7 +600,7 @@ namespace PepperDash.Essentials
|
|||||||
|| CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
|| CurrentRoom.ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CurrentRoom.StartShutdown(ShutdownType.Manual);
|
CurrentRoom.StartShutdown(eShutdownType.Manual);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -614,7 +614,7 @@ namespace PepperDash.Essentials
|
|||||||
var timer = CurrentRoom.ShutdownPromptTimer;
|
var timer = CurrentRoom.ShutdownPromptTimer;
|
||||||
SetActivityFooterFeedbacks();
|
SetActivityFooterFeedbacks();
|
||||||
|
|
||||||
if (CurrentRoom.ShutdownType == ShutdownType.Manual)
|
if (CurrentRoom.ShutdownType == eShutdownType.Manual)
|
||||||
{
|
{
|
||||||
PowerDownModal = new ModalDialog(TriList);
|
PowerDownModal = new ModalDialog(TriList);
|
||||||
var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds);
|
var message = string.Format("Meeting will end in {0} seconds", CurrentRoom.ShutdownPromptSeconds);
|
||||||
|
|||||||
Reference in New Issue
Block a user