mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 05:05:00 +00:00
Updates to deactivate standby on codec
This commit is contained in:
@@ -592,6 +592,16 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
OnFeedback.FireUpdate();
|
OnFeedback.FireUpdate();
|
||||||
|
|
||||||
|
if (OnFeedback.BoolValue)
|
||||||
|
{
|
||||||
|
if (VideoCodec.UsageTracker.InUseTracker.InUseFeedback.BoolValue)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, "Video Codec in use, deactivating standby on codec");
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoCodec.StandbyDeactivate();
|
||||||
|
}
|
||||||
|
|
||||||
// report back when done
|
// report back when done
|
||||||
if (successCallback != null)
|
if (successCallback != null)
|
||||||
successCallback();
|
successCallback();
|
||||||
|
|||||||
@@ -1,58 +1,58 @@
|
|||||||
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;
|
||||||
using Crestron.SimplSharp.Scheduler;
|
using Crestron.SimplSharp.Scheduler;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Essentials.Core.Config;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Devices;
|
||||||
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
using PepperDash.Essentials.Core.DeviceTypeInterfaces;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Core
|
namespace PepperDash.Essentials.Core
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public BoolFeedback OnFeedback { get; private set; }
|
public BoolFeedback OnFeedback { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fires when the RoomOccupancy object is set
|
/// Fires when the RoomOccupancy object is set
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event EventHandler<EventArgs> RoomOccupancyIsSet;
|
public event EventHandler<EventArgs> RoomOccupancyIsSet;
|
||||||
|
|
||||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||||
public BoolFeedback IsCoolingDownFeedback { get; private set; }
|
public BoolFeedback IsCoolingDownFeedback { get; private set; }
|
||||||
|
|
||||||
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
|
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
|
||||||
|
|
||||||
public bool OccupancyStatusProviderIsRemote { get; private set; }
|
public bool OccupancyStatusProviderIsRemote { get; private set; }
|
||||||
|
|
||||||
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
|
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
|
||||||
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
|
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Indicates if this room is Mobile Control Enabled
|
/// Indicates if this room is Mobile Control Enabled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsMobileControlEnabled { get; private set; }
|
public bool IsMobileControlEnabled { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The bridge for this room if Mobile Control is enabled
|
/// The bridge for this room if Mobile Control is enabled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IMobileControlRoomBridge MobileControlRoomBridge { get; private set; }
|
public IMobileControlRoomBridge MobileControlRoomBridge { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The config name of the source list
|
/// The config name of the source list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
///
|
///
|
||||||
protected string _SourceListKey;
|
protected string _SourceListKey;
|
||||||
public virtual string SourceListKey {
|
public virtual string SourceListKey {
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -63,306 +63,306 @@ namespace PepperDash.Essentials.Core
|
|||||||
_SourceListKey = value;
|
_SourceListKey = value;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Timer used for informing the UIs of a shutdown
|
/// Timer used for informing the UIs of a shutdown
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
|
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int ShutdownPromptSeconds { get; set; }
|
public int ShutdownPromptSeconds { get; set; }
|
||||||
public int ShutdownVacancySeconds { get; set; }
|
public int ShutdownVacancySeconds { get; set; }
|
||||||
public eShutdownType ShutdownType { get; private set; }
|
public eShutdownType ShutdownType { get; private set; }
|
||||||
|
|
||||||
public EssentialsRoomEmergencyBase Emergency { get; set; }
|
public EssentialsRoomEmergencyBase Emergency { get; set; }
|
||||||
|
|
||||||
public Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
|
public Core.Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
|
||||||
|
|
||||||
public string LogoUrlLightBkgnd { get; set; }
|
public string LogoUrlLightBkgnd { get; set; }
|
||||||
|
|
||||||
public string LogoUrlDarkBkgnd { get; set; }
|
public string LogoUrlDarkBkgnd { get; set; }
|
||||||
|
|
||||||
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
||||||
|
|
||||||
public eVacancyMode VacancyMode { get; private set; }
|
public eVacancyMode VacancyMode { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Seconds after vacancy prompt is displayed until shutdown
|
/// Seconds after vacancy prompt is displayed until shutdown
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected int RoomVacancyShutdownSeconds;
|
protected int RoomVacancyShutdownSeconds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Seconds after vacancy detected until prompt is displayed
|
/// Seconds after vacancy detected until prompt is displayed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected int RoomVacancyShutdownPromptSeconds;
|
protected int RoomVacancyShutdownPromptSeconds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract Func<bool> OnFeedbackFunc { get; }
|
protected abstract Func<bool> OnFeedbackFunc { get; }
|
||||||
|
|
||||||
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
|
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When volume control devices change, should we zero the one that we are leaving?
|
/// When volume control devices change, should we zero the one that we are leaving?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
||||||
|
|
||||||
|
|
||||||
public EssentialsRoomBase(DeviceConfig config)
|
public EssentialsRoomBase(DeviceConfig config)
|
||||||
: base(config)
|
: base(config)
|
||||||
{
|
{
|
||||||
// Setup the ShutdownPromptTimer
|
// 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 = eShutdownType.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 = eShutdownType.None;
|
ShutdownType = eShutdownType.None;
|
||||||
|
|
||||||
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
||||||
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||||
//{
|
//{
|
||||||
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
||||||
// ShutdownType = ShutdownType.Vacancy;
|
// ShutdownType = ShutdownType.Vacancy;
|
||||||
//};
|
//};
|
||||||
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
|
RoomVacancyShutdownTimer.HasFinished += new EventHandler<EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered
|
||||||
|
|
||||||
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
||||||
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
||||||
VacancyMode = eVacancyMode.None;
|
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);
|
||||||
|
|
||||||
AddPostActivationAction(() =>
|
AddPostActivationAction(() =>
|
||||||
{
|
{
|
||||||
if (RoomOccupancy != null)
|
if (RoomOccupancy != null)
|
||||||
OnRoomOccupancyIsSet();
|
OnRoomOccupancyIsSet();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CustomActivate()
|
public override bool CustomActivate()
|
||||||
{
|
{
|
||||||
SetUpMobileControl();
|
SetUpMobileControl();
|
||||||
|
|
||||||
return base.CustomActivate();
|
return base.CustomActivate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// If mobile control is enabled, sets the appropriate properties
|
/// If mobile control is enabled, sets the appropriate properties
|
||||||
/// </summary>
|
/// </summary>
|
||||||
void SetUpMobileControl()
|
void SetUpMobileControl()
|
||||||
{
|
{
|
||||||
var mcBridgeKey = string.Format("mobileControlBridge-{0}", Key);
|
var mcBridgeKey = string.Format("mobileControlBridge-{0}", Key);
|
||||||
var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey);
|
var mcBridge = DeviceManager.GetDeviceForKey(mcBridgeKey);
|
||||||
if (mcBridge == null)
|
if (mcBridge == null)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, "*********************Mobile Control Bridge Not found for this room.");
|
Debug.Console(1, this, "*********************Mobile Control Bridge Not found for this room.");
|
||||||
IsMobileControlEnabled = false;
|
IsMobileControlEnabled = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MobileControlRoomBridge = mcBridge as IMobileControlRoomBridge;
|
MobileControlRoomBridge = mcBridge as IMobileControlRoomBridge;
|
||||||
Debug.Console(1, this, "*********************Mobile Control Bridge found and enabled for this room");
|
Debug.Console(1, this, "*********************Mobile Control Bridge found and enabled for this room");
|
||||||
IsMobileControlEnabled = true;
|
IsMobileControlEnabled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
switch (VacancyMode)
|
switch (VacancyMode)
|
||||||
{
|
{
|
||||||
case eVacancyMode.None:
|
case eVacancyMode.None:
|
||||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
break;
|
break;
|
||||||
case eVacancyMode.InInitialVacancy:
|
case eVacancyMode.InInitialVacancy:
|
||||||
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
||||||
break;
|
break;
|
||||||
case eVacancyMode.InShutdownWarning:
|
case eVacancyMode.InShutdownWarning:
|
||||||
{
|
{
|
||||||
StartShutdown(eShutdownType.Vacancy);
|
StartShutdown(eShutdownType.Vacancy);
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
/// <param name="type"></param>
|
||||||
public void StartShutdown(eShutdownType 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 == eShutdownType.Manual)
|
if (type == eShutdownType.Manual)
|
||||||
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
||||||
else if (type == eShutdownType.Vacancy)
|
else if (type == eShutdownType.Vacancy)
|
||||||
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
||||||
ShutdownType = type;
|
ShutdownType = type;
|
||||||
ShutdownPromptTimer.Start();
|
ShutdownPromptTimer.Start();
|
||||||
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartRoomVacancyTimer(eVacancyMode mode)
|
public void StartRoomVacancyTimer(eVacancyMode mode)
|
||||||
{
|
{
|
||||||
if (mode == eVacancyMode.None)
|
if (mode == eVacancyMode.None)
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
||||||
else if (mode == eVacancyMode.InInitialVacancy)
|
else if (mode == eVacancyMode.InInitialVacancy)
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
||||||
else if (mode == eVacancyMode.InShutdownWarning)
|
else if (mode == eVacancyMode.InShutdownWarning)
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
||||||
VacancyMode = mode;
|
VacancyMode = mode;
|
||||||
RoomVacancyShutdownTimer.Start();
|
RoomVacancyShutdownTimer.Start();
|
||||||
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Resets the vacancy mode and shutsdwon the room
|
/// Resets the vacancy mode and shutsdwon the room
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Shutdown()
|
public void Shutdown()
|
||||||
{
|
{
|
||||||
VacancyMode = eVacancyMode.None;
|
VacancyMode = eVacancyMode.None;
|
||||||
EndShutdown();
|
EndShutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This method is for the derived class to define it's specific shutdown
|
/// 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()
|
/// requirements but should not be called directly. It is called by Shutdown()
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract void EndShutdown();
|
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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void SetDefaultLevels();
|
public abstract void SetDefaultLevels();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
|
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="statusProvider"></param>
|
/// <param name="statusProvider"></param>
|
||||||
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
||||||
{
|
{
|
||||||
if (statusProvider == null)
|
if (statusProvider == null)
|
||||||
{
|
{
|
||||||
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", (statusProvider as Device).Key);
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
|
||||||
|
|
||||||
// If status provider is fusion, set flag to remote
|
// If status provider is fusion, set flag to remote
|
||||||
if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
|
if (statusProvider is Core.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
|
||||||
OccupancyStatusProviderIsRemote = true;
|
OccupancyStatusProviderIsRemote = true;
|
||||||
|
|
||||||
if(timeoutMinutes > 0)
|
if(timeoutMinutes > 0)
|
||||||
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
||||||
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
||||||
|
|
||||||
RoomOccupancy = statusProvider;
|
RoomOccupancy = statusProvider;
|
||||||
|
|
||||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
|
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
|
||||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
||||||
|
|
||||||
OnRoomOccupancyIsSet();
|
OnRoomOccupancyIsSet();
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnRoomOccupancyIsSet()
|
void OnRoomOccupancyIsSet()
|
||||||
{
|
{
|
||||||
var handler = RoomOccupancyIsSet;
|
var handler = RoomOccupancyIsSet;
|
||||||
if (handler != null)
|
if (handler != null)
|
||||||
handler(this, new EventArgs());
|
handler(this, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To allow base class to power room on to last source
|
/// To allow base class to power room on to last source
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void PowerOnToDefaultOrLastSource();
|
public abstract void PowerOnToDefaultOrLastSource();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// To allow base class to power room on to default source
|
/// To allow base class to power room on to default source
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public abstract bool RunDefaultPresentRoute();
|
public abstract bool RunDefaultPresentRoute();
|
||||||
|
|
||||||
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
|
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
|
||||||
// Trigger the timer when the room is vacant
|
// Trigger the timer when the room is vacant
|
||||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
|
||||||
// Reset the timer when the room is occupied
|
// Reset the timer when the room is occupied
|
||||||
RoomVacancyShutdownTimer.Cancel();
|
RoomVacancyShutdownTimer.Cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="o"></param>
|
/// <param name="o"></param>
|
||||||
public abstract void RoomVacatedForTimeoutPeriod(object o);
|
public abstract void RoomVacatedForTimeoutPeriod(object o);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <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 eShutdownType
|
public enum eShutdownType
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
External,
|
External,
|
||||||
Manual,
|
Manual,
|
||||||
Vacancy
|
Vacancy
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum eVacancyMode
|
public enum eVacancyMode
|
||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
InInitialVacancy,
|
InInitialVacancy,
|
||||||
InShutdownWarning
|
InShutdownWarning
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public enum eWarmingCoolingMode
|
public enum eWarmingCoolingMode
|
||||||
{
|
{
|
||||||
None,
|
None,
|
||||||
Warming,
|
Warming,
|
||||||
Cooling
|
Cooling
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class EssentialsRoomEmergencyBase : IKeyed
|
public abstract class EssentialsRoomEmergencyBase : IKeyed
|
||||||
{
|
{
|
||||||
public string Key { get; private set; }
|
public string Key { get; private set; }
|
||||||
|
|
||||||
public EssentialsRoomEmergencyBase(string key)
|
public EssentialsRoomEmergencyBase(string key)
|
||||||
{
|
{
|
||||||
Key = key;
|
Key = key;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user