mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-15 20:54:55 +00:00
Refactoring things to base class
This commit is contained in:
@@ -13,49 +13,9 @@ namespace PepperDash.Essentials
|
|||||||
{
|
{
|
||||||
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay
|
public class EssentialsHuddleSpaceRoom : EssentialsRoomBase, IHasCurrentSourceInfoChange, IRunRouteAction, IRunDefaultPresentRoute, IHasCurrentVolumeControls, IHasDefaultDisplay
|
||||||
{
|
{
|
||||||
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
//
|
||||||
public event SourceInfoChangeHandler CurrentSourceChange;
|
public event SourceInfoChangeHandler CurrentSourceChange;
|
||||||
|
|
||||||
protected override Func<bool> OnFeedbackFunc
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
var val = CurrentSourceInfo != null
|
|
||||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
|
||||||
&& disp != null;
|
|
||||||
//&& disp.PowerIsOnFeedback.BoolValue;
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Func<bool> IsWarmingFeedbackFunc
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
return disp != null && disp.IsWarmingUpFeedback.BoolValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Func<bool> IsCoolingFeedbackFunc
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
return disp != null && disp.IsCoolingDownFeedback.BoolValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
public EssentialsHuddleRoomPropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||||
@@ -74,33 +34,6 @@ namespace PepperDash.Essentials
|
|||||||
public bool EnablePowerOnToLastSource { get; set; }
|
public bool EnablePowerOnToLastSource { get; set; }
|
||||||
string _lastSourceKey;
|
string _lastSourceKey;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
public IBasicVolumeControls CurrentVolumeControls
|
|
||||||
{
|
|
||||||
get { return _currentAudioDevice; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == _currentAudioDevice) return;
|
|
||||||
|
|
||||||
var oldDev = _currentAudioDevice;
|
|
||||||
// derigister this room from the device, if it can
|
|
||||||
if (oldDev is IInUseTracking)
|
|
||||||
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
|
|
||||||
var handler = CurrentVolumeDeviceChange;
|
|
||||||
if (handler != null)
|
|
||||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
|
|
||||||
_currentAudioDevice = value;
|
|
||||||
if (handler != null)
|
|
||||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
|
|
||||||
// register this room with new device, if it can
|
|
||||||
if (_currentAudioDevice is IInUseTracking)
|
|
||||||
(_currentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IBasicVolumeControls _currentAudioDevice;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The SourceListItem last run - containing names and icons
|
/// The SourceListItem last run - containing names and icons
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -152,7 +85,7 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Initialize()
|
private void Initialize()
|
||||||
{
|
{
|
||||||
if (DefaultAudioDevice is IBasicVolumeControls)
|
if (DefaultAudioDevice is IBasicVolumeControls)
|
||||||
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
DefaultVolumeControls = DefaultAudioDevice as IBasicVolumeControls;
|
||||||
@@ -160,8 +93,35 @@ namespace PepperDash.Essentials
|
|||||||
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
DefaultVolumeControls = (DefaultAudioDevice as IHasVolumeDevice).VolumeDevice;
|
||||||
CurrentVolumeControls = DefaultVolumeControls;
|
CurrentVolumeControls = DefaultVolumeControls;
|
||||||
|
|
||||||
|
SourceListKey = "default";
|
||||||
|
EnablePowerOnToLastSource = true;
|
||||||
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
var disp = DefaultDisplay as DisplayBase;
|
||||||
if (disp != null)
|
if (disp == null) return;
|
||||||
|
|
||||||
|
IsWarmingFeedbackFunc = () => disp.IsWarmingUpFeedback.BoolValue;
|
||||||
|
|
||||||
|
IsCoolingFeedbackFunc = () => disp.IsCoolingDownFeedback.BoolValue;
|
||||||
|
|
||||||
|
OnFeedbackFunc = () => CurrentSourceInfo != null
|
||||||
|
&& CurrentSourceInfo.Type == eSourceListItemType.Route;
|
||||||
|
|
||||||
|
InitializeDisplay(disp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected override void IsCoolingDownFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||||
|
{
|
||||||
|
IsCoolingDownFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||||
|
{
|
||||||
|
var display = sender as DisplayBase;
|
||||||
|
|
||||||
|
if (display == null) return;
|
||||||
|
|
||||||
|
if (display.PowerIsOnFeedback.BoolValue == OnFeedback.BoolValue)
|
||||||
{
|
{
|
||||||
// Link power, warming, cooling to display
|
// Link power, warming, cooling to display
|
||||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
||||||
@@ -177,33 +137,35 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
|
||||||
{
|
|
||||||
IsWarmingUpFeedback.FireUpdate();
|
|
||||||
|
|
||||||
if (IsWarmingUpFeedback.BoolValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var display = DefaultDisplay as IBasicVolumeWithFeedback;
|
|
||||||
|
|
||||||
if (display == null)
|
|
||||||
{
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
|
|
||||||
"Default display {0} is not volume control control provider", DefaultDisplay.Key);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
display.SetVolume(DefaultVolume);
|
|
||||||
};
|
|
||||||
disp.IsCoolingDownFeedback.OutputChange += (o, a) => IsCoolingDownFeedback.FireUpdate();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SourceListKey = "default";
|
if (!display.PowerIsOnFeedback.BoolValue)
|
||||||
EnablePowerOnToLastSource = true;
|
{
|
||||||
}
|
CurrentSourceInfo = null;
|
||||||
|
}
|
||||||
|
OnFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void IsWarmingUpFeedbackOnOutputChange(object sender, FeedbackEventArgs feedbackEventArgs)
|
||||||
|
{
|
||||||
|
IsWarmingUpFeedback.FireUpdate();
|
||||||
|
|
||||||
|
if (IsWarmingUpFeedback.BoolValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var displayVolumeControl = DefaultDisplay as IBasicVolumeWithFeedback;
|
||||||
|
|
||||||
|
if (displayVolumeControl == null)
|
||||||
|
{
|
||||||
|
Debug.Console(0, this, Debug.ErrorLogLevel.Error,
|
||||||
|
"Default display {0} is not volume control control provider", DefaultDisplay.Key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
displayVolumeControl.SetVolume(DefaultVolume);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void CustomSetConfig(DeviceConfig config)
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -48,65 +48,7 @@ namespace PepperDash.Essentials
|
|||||||
public BoolFeedback IsSharingFeedback { get; private set; }
|
public BoolFeedback IsSharingFeedback { get; private set; }
|
||||||
|
|
||||||
//************************
|
//************************
|
||||||
|
|
||||||
public override string SourceListKey
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return _SourceListKey;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
_SourceListKey = value;
|
|
||||||
SetCodecExternalSources();
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Func<bool> OnFeedbackFunc
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
var val = CurrentSourceInfo != null
|
|
||||||
&& CurrentSourceInfo.Type == eSourceListItemType.Route
|
|
||||||
&& disp != null;
|
|
||||||
//&& disp.PowerIsOnFeedback.BoolValue;
|
|
||||||
return val;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
protected override Func<bool> IsWarmingFeedbackFunc
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
return disp != null && disp.IsWarmingUpFeedback.BoolValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/// <summary>
|
|
||||||
///
|
|
||||||
/// </summary>
|
|
||||||
protected override Func<bool> IsCoolingFeedbackFunc
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return () =>
|
|
||||||
{
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
return disp != null && disp.IsCoolingDownFeedback.BoolValue;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; }
|
public EssentialsHuddleVtc1PropertiesConfig PropertiesConfig { get; private set; }
|
||||||
|
|
||||||
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
public IRoutingSinkWithSwitching DefaultDisplay { get; private set; }
|
||||||
@@ -129,34 +71,6 @@ namespace PepperDash.Essentials
|
|||||||
public bool EnablePowerOnToLastSource { get; set; }
|
public bool EnablePowerOnToLastSource { get; set; }
|
||||||
private string _lastSourceKey;
|
private string _lastSourceKey;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Sets the volume control device, and attaches/removes InUseTrackers with "audio"
|
|
||||||
/// tag to device.
|
|
||||||
/// </summary>
|
|
||||||
public IBasicVolumeControls CurrentVolumeControls
|
|
||||||
{
|
|
||||||
get { return _currentAudioDevice; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == _currentAudioDevice) return;
|
|
||||||
|
|
||||||
var oldDev = _currentAudioDevice;
|
|
||||||
// derigister this room from the device, if it can
|
|
||||||
if (oldDev is IInUseTracking)
|
|
||||||
(oldDev as IInUseTracking).InUseTracker.RemoveUser(this, "audio");
|
|
||||||
var handler = CurrentVolumeDeviceChange;
|
|
||||||
if (handler != null)
|
|
||||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.WillChange));
|
|
||||||
_currentAudioDevice = value;
|
|
||||||
if (handler != null)
|
|
||||||
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(oldDev, value, ChangeType.DidChange));
|
|
||||||
// register this room with new device, if it can
|
|
||||||
if (_currentAudioDevice is IInUseTracking)
|
|
||||||
(_currentAudioDevice as IInUseTracking).InUseTracker.AddUser(this, "audio");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
IBasicVolumeControls _currentAudioDevice;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The SourceListItem last run - containing names and icons
|
/// The SourceListItem last run - containing names and icons
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -264,48 +178,6 @@ namespace PepperDash.Essentials
|
|||||||
return inAudioCall || inVideoCall;
|
return inAudioCall || inVideoCall;
|
||||||
});
|
});
|
||||||
|
|
||||||
var disp = DefaultDisplay as DisplayBase;
|
|
||||||
if (disp != null)
|
|
||||||
{
|
|
||||||
// Link power, warming, cooling to display
|
|
||||||
var dispTwoWay = disp as IHasPowerControlWithFeedback;
|
|
||||||
if (dispTwoWay != null)
|
|
||||||
{
|
|
||||||
dispTwoWay.PowerIsOnFeedback.OutputChange += (o, a) =>
|
|
||||||
{
|
|
||||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
|
||||||
{
|
|
||||||
if (!dispTwoWay.PowerIsOnFeedback.BoolValue)
|
|
||||||
CurrentSourceInfo = null;
|
|
||||||
OnFeedback.FireUpdate();
|
|
||||||
}
|
|
||||||
if (dispTwoWay.PowerIsOnFeedback.BoolValue)
|
|
||||||
{
|
|
||||||
SetDefaultLevels();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
disp.IsWarmingUpFeedback.OutputChange += (o, a) =>
|
|
||||||
{
|
|
||||||
IsWarmingUpFeedback.FireUpdate();
|
|
||||||
if (IsWarmingUpFeedback.BoolValue)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var basicVolumeWithFeedback = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
|
||||||
if (basicVolumeWithFeedback != null)
|
|
||||||
{
|
|
||||||
basicVolumeWithFeedback.SetVolume(DefaultVolume);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
disp.IsCoolingDownFeedback.OutputChange += (o, a) => IsCoolingDownFeedback.FireUpdate();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
|
// Get Microphone Privacy object, if any MUST HAPPEN AFTER setting InCallFeedback
|
||||||
MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
|
MicrophonePrivacy = EssentialsRoomConfigHelper.GetMicrophonePrivacy(PropertiesConfig, this);
|
||||||
|
|
||||||
@@ -334,6 +206,18 @@ namespace PepperDash.Essentials
|
|||||||
|
|
||||||
SourceListKey = "default";
|
SourceListKey = "default";
|
||||||
EnablePowerOnToLastSource = true;
|
EnablePowerOnToLastSource = true;
|
||||||
|
|
||||||
|
var disp = DefaultDisplay as DisplayBase;
|
||||||
|
if (disp == null)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OnFeedbackFunc = () => CurrentSourceInfo != null
|
||||||
|
&& CurrentSourceInfo.Type == eSourceListItemType.Route;
|
||||||
|
|
||||||
|
InitializeDisplay(disp);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@@ -341,6 +225,50 @@ namespace PepperDash.Essentials
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Overrides of EssentialsRoomBase
|
||||||
|
|
||||||
|
protected override void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs args)
|
||||||
|
{
|
||||||
|
var disp = sender as DisplayBase;
|
||||||
|
|
||||||
|
if (disp == null) return;
|
||||||
|
|
||||||
|
if (disp.PowerIsOnFeedback.BoolValue != OnFeedback.BoolValue)
|
||||||
|
{
|
||||||
|
if (!disp.PowerIsOnFeedback.BoolValue)
|
||||||
|
CurrentSourceInfo = null;
|
||||||
|
OnFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
if (disp.PowerIsOnFeedback.BoolValue)
|
||||||
|
{
|
||||||
|
SetDefaultLevels();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void IsCoolingDownFeedbackOnOutputChange(object sender, FeedbackEventArgs args)
|
||||||
|
{
|
||||||
|
IsCoolingDownFeedback.FireUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void IsWarmingUpFeedbackOnOutputChange(object sender, FeedbackEventArgs args)
|
||||||
|
{
|
||||||
|
IsWarmingUpFeedback.FireUpdate();
|
||||||
|
|
||||||
|
if (IsWarmingUpFeedback.BoolValue)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var basicVolumeWithFeedback = CurrentVolumeControls as IBasicVolumeWithFeedback;
|
||||||
|
if (basicVolumeWithFeedback != null)
|
||||||
|
{
|
||||||
|
basicVolumeWithFeedback.SetVolume(DefaultVolume);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
protected override void CustomSetConfig(DeviceConfig config)
|
protected override void CustomSetConfig(DeviceConfig config)
|
||||||
{
|
{
|
||||||
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>(config.Properties.ToString());
|
var newPropertiesConfig = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>(config.Properties.ToString());
|
||||||
|
|||||||
@@ -1,315 +1,377 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using PepperDash.Core;
|
using Crestron.SimplSharp.Reflection;
|
||||||
using PepperDash.Essentials.Core.Config;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core.Devices;
|
using PepperDash.Essentials.Core.Config;
|
||||||
|
using PepperDash.Essentials.Core.Devices;
|
||||||
namespace PepperDash.Essentials.Core
|
|
||||||
{
|
namespace PepperDash.Essentials.Core
|
||||||
/// <summary>
|
{
|
||||||
///
|
/// <summary>
|
||||||
/// </summary>
|
///
|
||||||
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
/// </summary>
|
||||||
{
|
public abstract class EssentialsRoomBase : ReconfigurableDevice
|
||||||
public BoolFeedback OnFeedback { get; private set; }
|
{
|
||||||
|
public event EventHandler<VolumeDeviceChangeEventArgs> CurrentVolumeDeviceChange;
|
||||||
/// <summary>
|
|
||||||
/// Fires when the RoomOccupancy object is set
|
/// <summary>
|
||||||
/// </summary>
|
/// Sets the volume control device, and attaches/removes InUseTrackers with "audio"
|
||||||
public event EventHandler<EventArgs> RoomOccupancyIsSet;
|
/// tag to device.
|
||||||
|
/// </summary>
|
||||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
public IBasicVolumeControls CurrentVolumeControls
|
||||||
public BoolFeedback IsCoolingDownFeedback { get; private set; }
|
{
|
||||||
|
get { return CurrentAudioDevice; }
|
||||||
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
|
set
|
||||||
|
{
|
||||||
public bool OccupancyStatusProviderIsRemote { get; private set; }
|
if (value == CurrentAudioDevice)
|
||||||
|
{
|
||||||
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
|
return;
|
||||||
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
|
}
|
||||||
|
|
||||||
/// <summary>
|
var handler = CurrentVolumeDeviceChange;
|
||||||
/// The config name of the source list
|
|
||||||
/// </summary>
|
if (handler != null)
|
||||||
public string SourceListKey { get; set; }
|
{
|
||||||
|
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(CurrentAudioDevice, value, ChangeType.WillChange));
|
||||||
/// <summary>
|
CurrentVolumeDeviceChange(this, new VolumeDeviceChangeEventArgs(CurrentAudioDevice, value, ChangeType.DidChange));
|
||||||
/// Timer used for informing the UIs of a shutdown
|
}
|
||||||
/// </summary>
|
|
||||||
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
|
var oldDevice = value as IInUseTracking;
|
||||||
|
var newDevice = value as IInUseTracking;
|
||||||
public int ShutdownPromptSeconds { get; set; }
|
|
||||||
public int ShutdownVacancySeconds { get; set; }
|
UpdateInUseTracking(oldDevice, newDevice);
|
||||||
public eShutdownType ShutdownType { get; private set; }
|
|
||||||
|
CurrentAudioDevice = value;
|
||||||
public EssentialsRoomEmergencyBase Emergency { get; set; }
|
}
|
||||||
|
}
|
||||||
public Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
|
protected IBasicVolumeControls CurrentAudioDevice;
|
||||||
|
|
||||||
public string LogoUrl { get; set; }
|
public BoolFeedback OnFeedback { get; private set; }
|
||||||
|
|
||||||
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
/// <summary>
|
||||||
|
/// Fires when the RoomOccupancy object is set
|
||||||
public eVacancyMode VacancyMode { get; private set; }
|
/// </summary>
|
||||||
|
public event EventHandler<EventArgs> RoomOccupancyIsSet;
|
||||||
/// <summary>
|
|
||||||
/// Seconds after vacancy prompt is displayed until shutdown
|
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||||
/// </summary>
|
public BoolFeedback IsCoolingDownFeedback { get; private set; }
|
||||||
protected int RoomVacancyShutdownSeconds;
|
|
||||||
|
public IOccupancyStatusProvider RoomOccupancy { get; private set; }
|
||||||
/// <summary>
|
|
||||||
/// Seconds after vacancy detected until prompt is displayed
|
public bool OccupancyStatusProviderIsRemote { get; private set; }
|
||||||
/// </summary>
|
|
||||||
protected int RoomVacancyShutdownPromptSeconds;
|
protected Func<bool> IsWarmingFeedbackFunc;
|
||||||
|
protected Func<bool> IsCoolingFeedbackFunc;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
/// The config name of the source list
|
||||||
/// </summary>
|
/// </summary>
|
||||||
protected abstract Func<bool> OnFeedbackFunc { get; }
|
public string SourceListKey { get; set; }
|
||||||
|
|
||||||
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
|
/// <summary>
|
||||||
|
/// Timer used for informing the UIs of a shutdown
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// When volume control devices change, should we zero the one that we are leaving?
|
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
|
||||||
/// </summary>
|
|
||||||
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
public int ShutdownPromptSeconds { get; set; }
|
||||||
|
public int ShutdownVacancySeconds { get; set; }
|
||||||
|
public eShutdownType ShutdownType { get; private set; }
|
||||||
protected EssentialsRoomBase(DeviceConfig config)
|
|
||||||
: base(config)
|
public EssentialsRoomEmergencyBase Emergency { get; set; }
|
||||||
{
|
|
||||||
// Setup the ShutdownPromptTimer
|
public Privacy.MicrophonePrivacyController MicrophonePrivacy { get; set; }
|
||||||
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
|
||||||
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
public string LogoUrl { get; set; }
|
||||||
{
|
|
||||||
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
|
||||||
ShutdownType = eShutdownType.None;
|
|
||||||
};
|
public eVacancyMode VacancyMode { get; private set; }
|
||||||
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
|
|
||||||
|
/// <summary>
|
||||||
ShutdownPromptSeconds = 60;
|
/// Seconds after vacancy prompt is displayed until shutdown
|
||||||
ShutdownVacancySeconds = 120;
|
/// </summary>
|
||||||
|
protected int RoomVacancyShutdownSeconds;
|
||||||
ShutdownType = eShutdownType.None;
|
|
||||||
|
/// <summary>
|
||||||
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
/// Seconds after vacancy detected until prompt is displayed
|
||||||
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
/// </summary>
|
||||||
//{
|
protected int RoomVacancyShutdownPromptSeconds;
|
||||||
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
|
||||||
// ShutdownType = ShutdownType.Vacancy;
|
/// <summary>
|
||||||
//};
|
///
|
||||||
RoomVacancyShutdownTimer.HasFinished += RoomVacancyShutdownPromptTimer_HasFinished; // Shutdown is triggered
|
/// </summary>
|
||||||
|
protected Func<bool> OnFeedbackFunc;
|
||||||
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
|
||||||
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
protected Dictionary<IBasicVolumeWithFeedback, uint> SavedVolumeLevels = new Dictionary<IBasicVolumeWithFeedback, uint>();
|
||||||
VacancyMode = eVacancyMode.None;
|
|
||||||
|
/// <summary>
|
||||||
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
/// When volume control devices change, should we zero the one that we are leaving?
|
||||||
|
/// </summary>
|
||||||
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
|
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; private set; }
|
||||||
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
|
|
||||||
|
|
||||||
AddPostActivationAction(() =>
|
protected EssentialsRoomBase(DeviceConfig config)
|
||||||
{
|
: base(config)
|
||||||
if (RoomOccupancy != null)
|
{
|
||||||
OnRoomOccupancyIsSet();
|
// Setup the ShutdownPromptTimer
|
||||||
});
|
ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer");
|
||||||
}
|
ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||||
|
{
|
||||||
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue)
|
||||||
{
|
ShutdownType = eShutdownType.None;
|
||||||
switch (VacancyMode)
|
};
|
||||||
{
|
ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered
|
||||||
case eVacancyMode.None:
|
|
||||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
ShutdownPromptSeconds = 60;
|
||||||
break;
|
ShutdownVacancySeconds = 120;
|
||||||
case eVacancyMode.InInitialVacancy:
|
|
||||||
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
ShutdownType = eShutdownType.None;
|
||||||
break;
|
|
||||||
case eVacancyMode.InShutdownWarning:
|
RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer");
|
||||||
{
|
//RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) =>
|
||||||
StartShutdown(eShutdownType.Vacancy);
|
//{
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
|
// if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue)
|
||||||
break;
|
// ShutdownType = ShutdownType.Vacancy;
|
||||||
}
|
//};
|
||||||
}
|
RoomVacancyShutdownTimer.HasFinished += RoomVacancyShutdownPromptTimer_HasFinished; // Shutdown is triggered
|
||||||
}
|
|
||||||
|
RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning
|
||||||
/// <summary>
|
RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt
|
||||||
///
|
VacancyMode = eVacancyMode.None;
|
||||||
/// </summary>
|
|
||||||
/// <param name="type"></param>
|
OnFeedback = new BoolFeedback(OnFeedbackFunc);
|
||||||
public void StartShutdown(eShutdownType type)
|
|
||||||
{
|
IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc);
|
||||||
// Check for shutdowns running. Manual should override other shutdowns
|
IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc);
|
||||||
|
|
||||||
switch (type)
|
AddPostActivationAction(() =>
|
||||||
{
|
{
|
||||||
case eShutdownType.Manual:
|
if (RoomOccupancy != null)
|
||||||
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
OnRoomOccupancyIsSet();
|
||||||
break;
|
});
|
||||||
case eShutdownType.Vacancy:
|
}
|
||||||
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
|
||||||
break;
|
protected void InitializeDisplay(DisplayBase display)
|
||||||
}
|
{
|
||||||
ShutdownType = type;
|
// Link power, warming, cooling to display
|
||||||
ShutdownPromptTimer.Start();
|
display.PowerIsOnFeedback.OutputChange += PowerIsOnFeedbackOnOutputChange;
|
||||||
|
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
display.IsWarmingUpFeedback.OutputChange += IsWarmingUpFeedbackOnOutputChange;
|
||||||
}
|
display.IsCoolingDownFeedback.OutputChange += IsCoolingDownFeedbackOnOutputChange;
|
||||||
|
}
|
||||||
public void StartRoomVacancyTimer(eVacancyMode mode)
|
|
||||||
{
|
protected void UpdateInUseTracking(IInUseTracking oldDev, IInUseTracking newDev)
|
||||||
switch (mode)
|
{
|
||||||
{
|
// derigister this room from the device, if it can
|
||||||
case eVacancyMode.None:
|
if (oldDev != null)
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
{
|
||||||
break;
|
oldDev.InUseTracker.RemoveUser(this, "audio");
|
||||||
case eVacancyMode.InInitialVacancy:
|
}
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
|
||||||
break;
|
// register this room with new device, if it can
|
||||||
case eVacancyMode.InShutdownWarning:
|
if (newDev != null)
|
||||||
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
{
|
||||||
break;
|
newDev.InUseTracker.AddUser(this, "audio");
|
||||||
}
|
}
|
||||||
VacancyMode = mode;
|
}
|
||||||
RoomVacancyShutdownTimer.Start();
|
|
||||||
|
protected abstract void PowerIsOnFeedbackOnOutputChange(object sender, FeedbackEventArgs args);
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
protected abstract void IsWarmingUpFeedbackOnOutputChange(object sender, FeedbackEventArgs args);
|
||||||
}
|
protected abstract void IsCoolingDownFeedbackOnOutputChange(object sender, FeedbackEventArgs args);
|
||||||
|
|
||||||
/// <summary>
|
private void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
|
||||||
/// Resets the vacancy mode and shutsdwon the room
|
{
|
||||||
/// </summary>
|
switch (VacancyMode)
|
||||||
public void Shutdown()
|
{
|
||||||
{
|
case eVacancyMode.None:
|
||||||
VacancyMode = eVacancyMode.None;
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
EndShutdown();
|
break;
|
||||||
}
|
case eVacancyMode.InInitialVacancy:
|
||||||
|
StartRoomVacancyTimer(eVacancyMode.InShutdownWarning);
|
||||||
/// <summary>
|
break;
|
||||||
/// This method is for the derived class to define it's specific shutdown
|
case eVacancyMode.InShutdownWarning:
|
||||||
/// requirements but should not be called directly. It is called by Shutdown()
|
{
|
||||||
/// </summary>
|
StartShutdown(eShutdownType.Vacancy);
|
||||||
protected abstract void EndShutdown();
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Shutting Down due to vacancy.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
/// <summary>
|
}
|
||||||
/// Override this to implement a default volume level(s) method
|
}
|
||||||
/// </summary>
|
|
||||||
public abstract void SetDefaultLevels();
|
/// <summary>
|
||||||
|
///
|
||||||
/// <summary>
|
/// </summary>
|
||||||
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
|
/// <param name="type"></param>
|
||||||
/// </summary>
|
public void StartShutdown(eShutdownType type)
|
||||||
/// <param name="statusProvider"></param>
|
{
|
||||||
/// <param name="timeoutMinutes"></param>
|
// Check for shutdowns running. Manual should override other shutdowns
|
||||||
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
|
||||||
{
|
switch (type)
|
||||||
var provider = statusProvider as IKeyed;
|
{
|
||||||
|
case eShutdownType.Manual:
|
||||||
if (provider == null)
|
ShutdownPromptTimer.SecondsToCount = ShutdownPromptSeconds;
|
||||||
{
|
break;
|
||||||
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
case eShutdownType.Vacancy:
|
||||||
return;
|
ShutdownPromptTimer.SecondsToCount = ShutdownVacancySeconds;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", provider.Key);
|
ShutdownType = type;
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
|
ShutdownPromptTimer.Start();
|
||||||
|
|
||||||
// If status provider is fusion, set flag to remote
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "ShutdownPromptTimer Started. Type: {0}. Seconds: {1}", ShutdownType, ShutdownPromptTimer.SecondsToCount);
|
||||||
if (statusProvider is Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
|
}
|
||||||
OccupancyStatusProviderIsRemote = true;
|
|
||||||
|
public void StartRoomVacancyTimer(eVacancyMode mode)
|
||||||
if(timeoutMinutes > 0)
|
{
|
||||||
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
switch (mode)
|
||||||
|
{
|
||||||
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
case eVacancyMode.None:
|
||||||
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownPromptSeconds;
|
||||||
RoomOccupancy = statusProvider;
|
break;
|
||||||
|
case eVacancyMode.InInitialVacancy:
|
||||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
|
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
|
||||||
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
break;
|
||||||
|
case eVacancyMode.InShutdownWarning:
|
||||||
OnRoomOccupancyIsSet();
|
RoomVacancyShutdownTimer.SecondsToCount = 60;
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
void OnRoomOccupancyIsSet()
|
VacancyMode = mode;
|
||||||
{
|
RoomVacancyShutdownTimer.Start();
|
||||||
var handler = RoomOccupancyIsSet;
|
|
||||||
if (handler != null)
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Vacancy Timer Started. Mode: {0}. Seconds: {1}", VacancyMode, RoomVacancyShutdownTimer.SecondsToCount);
|
||||||
handler(this, new EventArgs());
|
}
|
||||||
}
|
|
||||||
|
/// <summary>
|
||||||
/// <summary>
|
/// Resets the vacancy mode and shutsdwon the room
|
||||||
/// To allow base class to power room on to last source
|
/// </summary>
|
||||||
/// </summary>
|
public void Shutdown()
|
||||||
public abstract void PowerOnToDefaultOrLastSource();
|
{
|
||||||
|
VacancyMode = eVacancyMode.None;
|
||||||
/// <summary>
|
EndShutdown();
|
||||||
/// To allow base class to power room on to default source
|
}
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
/// <summary>
|
||||||
public abstract bool RunDefaultPresentRoute();
|
/// 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()
|
||||||
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
|
/// </summary>
|
||||||
{
|
protected abstract void EndShutdown();
|
||||||
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
|
||||||
{
|
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
|
/// <summary>
|
||||||
// Trigger the timer when the room is vacant
|
/// Override this to implement a default volume level(s) method
|
||||||
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
/// </summary>
|
||||||
}
|
public abstract void SetDefaultLevels();
|
||||||
else
|
|
||||||
{
|
/// <summary>
|
||||||
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
|
/// Sets the object to be used as the IOccupancyStatusProvider for the room. Can be an Occupancy Aggregator or a specific device
|
||||||
// Reset the timer when the room is occupied
|
/// </summary>
|
||||||
RoomVacancyShutdownTimer.Cancel();
|
/// <param name="statusProvider"></param>
|
||||||
}
|
/// <param name="timeoutMinutes"></param>
|
||||||
}
|
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider, int timeoutMinutes)
|
||||||
|
{
|
||||||
/// <summary>
|
var provider = statusProvider as IKeyed;
|
||||||
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
|
||||||
/// </summary>
|
if (provider == null)
|
||||||
/// <param name="o"></param>
|
{
|
||||||
public abstract void RoomVacatedForTimeoutPeriod(object o);
|
Debug.Console(0, this, "ERROR: Occupancy sensor device is null");
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
/// <summary>
|
|
||||||
/// To describe the various ways a room may be shutting down
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Room Occupancy set to device: '{0}'", provider.Key);
|
||||||
/// </summary>
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "Timeout Minutes from Config is: {0}", timeoutMinutes);
|
||||||
public enum eShutdownType
|
|
||||||
{
|
// If status provider is fusion, set flag to remote
|
||||||
None = 0,
|
if (statusProvider is Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
|
||||||
External,
|
OccupancyStatusProviderIsRemote = true;
|
||||||
Manual,
|
|
||||||
Vacancy
|
if(timeoutMinutes > 0)
|
||||||
}
|
RoomVacancyShutdownSeconds = timeoutMinutes * 60;
|
||||||
|
|
||||||
public enum eVacancyMode
|
Debug.Console(0, this, Debug.ErrorLogLevel.Notice, "RoomVacancyShutdownSeconds set to {0}", RoomVacancyShutdownSeconds);
|
||||||
{
|
|
||||||
None = 0,
|
RoomOccupancy = statusProvider;
|
||||||
InInitialVacancy,
|
|
||||||
InShutdownWarning
|
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange -= RoomIsOccupiedFeedback_OutputChange;
|
||||||
}
|
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
|
||||||
|
|
||||||
/// <summary>
|
OnRoomOccupancyIsSet();
|
||||||
///
|
}
|
||||||
/// </summary>
|
|
||||||
public enum eWarmingCoolingMode
|
void OnRoomOccupancyIsSet()
|
||||||
{
|
{
|
||||||
None,
|
var handler = RoomOccupancyIsSet;
|
||||||
Warming,
|
if (handler != null)
|
||||||
Cooling
|
handler(this, new EventArgs());
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract class EssentialsRoomEmergencyBase : IKeyed
|
/// <summary>
|
||||||
{
|
/// To allow base class to power room on to last source
|
||||||
public string Key { get; private set; }
|
/// </summary>
|
||||||
|
public abstract void PowerOnToDefaultOrLastSource();
|
||||||
protected EssentialsRoomEmergencyBase(string key)
|
|
||||||
{
|
/// <summary>
|
||||||
Key = key;
|
/// To allow base class to power room on to default source
|
||||||
}
|
/// </summary>
|
||||||
}
|
/// <returns></returns>
|
||||||
|
public abstract bool RunDefaultPresentRoute();
|
||||||
|
|
||||||
|
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if (RoomOccupancy.RoomIsOccupiedFeedback.BoolValue == false)
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Vacancy Detected");
|
||||||
|
// Trigger the timer when the room is vacant
|
||||||
|
StartRoomVacancyTimer(eVacancyMode.InInitialVacancy);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.Console(1, this, Debug.ErrorLogLevel.Notice, "Notice: Occupancy Detected");
|
||||||
|
// Reset the timer when the room is occupied
|
||||||
|
RoomVacancyShutdownTimer.Cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Executes when RoomVacancyShutdownTimer expires. Used to trigger specific room actions as needed. Must nullify the timer object when executed
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="o"></param>
|
||||||
|
public abstract void RoomVacatedForTimeoutPeriod(object o);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// To describe the various ways a room may be shutting down
|
||||||
|
/// </summary>
|
||||||
|
public enum eShutdownType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
External,
|
||||||
|
Manual,
|
||||||
|
Vacancy
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum eVacancyMode
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
InInitialVacancy,
|
||||||
|
InShutdownWarning
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
///
|
||||||
|
/// </summary>
|
||||||
|
public enum eWarmingCoolingMode
|
||||||
|
{
|
||||||
|
None,
|
||||||
|
Warming,
|
||||||
|
Cooling
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract class EssentialsRoomEmergencyBase : IKeyed
|
||||||
|
{
|
||||||
|
public string Key { get; private set; }
|
||||||
|
|
||||||
|
protected EssentialsRoomEmergencyBase(string key)
|
||||||
|
{
|
||||||
|
Key = key;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user