Updates to add necessary functionality for occupancy sensors to trigger room to power on to default source during specific hours on certain days.

This commit is contained in:
Neil Dorin
2018-08-21 18:23:31 -06:00
parent c839cea495
commit c0c90f926e
7 changed files with 412 additions and 345 deletions

View File

@@ -99,6 +99,10 @@
<SpecificVersion>False</SpecificVersion> <SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath> <HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpReflectionInterface.dll</HintPath>
</Reference> </Reference>
<Reference Include="SimplSharpTimerEventInterface, Version=1.0.6197.20052, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\..\ProgramData\Crestron\SDK\SimplSharpTimerEventInterface.dll</HintPath>
</Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Core" /> <Reference Include="System.Core" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />

View File

@@ -4,5 +4,5 @@
[assembly: AssemblyCompany("PepperDash Technology Corp")] [assembly: AssemblyCompany("PepperDash Technology Corp")]
[assembly: AssemblyProduct("PepperDashEssentials")] [assembly: AssemblyProduct("PepperDashEssentials")]
[assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")] [assembly: AssemblyCopyright("Copyright © PepperDash Technology Corp 2018")]
[assembly: AssemblyVersion("1.2.5.*")] [assembly: AssemblyVersion("1.2.6.*")]

View File

@@ -1,334 +1,364 @@
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 Newtonsoft.Json; using Newtonsoft.Json;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials; using PepperDash.Essentials;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config; using PepperDash.Essentials.Core.Config;
namespace PepperDash.Essentials.Room.Config namespace PepperDash.Essentials.Room.Config
{ {
public class EssentialsRoomConfig : DeviceConfig public class EssentialsRoomConfig : DeviceConfig
{ {
/// <summary> /// <summary>
/// Returns a room object from this config data /// Returns a room object from this config data
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
public Device GetRoomObject() public Device GetRoomObject()
{ {
var typeName = Type.ToLower(); var typeName = Type.ToLower();
if (typeName == "huddle") if (typeName == "huddle")
{ {
var props = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig> var props = JsonConvert.DeserializeObject<EssentialsHuddleRoomPropertiesConfig>
(this.Properties.ToString()); (this.Properties.ToString());
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching; var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching; var audio = DeviceManager.GetDeviceForKey(props.DefaultAudioKey) as IRoutingSinkNoSwitching;
var huddle = new EssentialsHuddleSpaceRoom(Key, Name, disp, audio, props); var huddle = new EssentialsHuddleSpaceRoom(Key, Name, disp, audio, props);
if (props.Occupancy != null) if (props.Occupancy != null)
huddle.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as huddle.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes); PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes);
huddle.LogoUrl = props.Logo.GetUrl(); huddle.LogoUrl = props.Logo.GetUrl();
huddle.SourceListKey = props.SourceListKey; huddle.SourceListKey = props.SourceListKey;
huddle.DefaultSourceItem = props.DefaultSourceItem; huddle.DefaultSourceItem = props.DefaultSourceItem;
huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100); huddle.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
return huddle; return huddle;
} }
//else if (typeName == "presentation") //else if (typeName == "presentation")
//{ //{
// var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig> // var props = JsonConvert.DeserializeObject<EssentialsPresentationRoomPropertiesConfig>
// (this.Properties.ToString()); // (this.Properties.ToString());
// var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>(); // var displaysDict = new Dictionary<uint, IRoutingSinkNoSwitching>();
// uint i = 1; // uint i = 1;
// foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list // foreach (var dispKey in props.DisplayKeys) // read in the ordered displays list
// { // {
// var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching; // var disp = DeviceManager.GetDeviceForKey(dispKey) as IRoutingSinkWithSwitching;
// displaysDict.Add(i++, disp); // displaysDict.Add(i++, disp);
// } // }
// // Get the master volume control // // Get the master volume control
// IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice(); // IBasicVolumeWithFeedback masterVolumeControlDev = props.Volumes.Master.GetDevice();
// var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props); // var presRoom = new EssentialsPresentationRoom(Key, Name, displaysDict, masterVolumeControlDev, props);
// return presRoom; // return presRoom;
//} //}
else if (typeName == "huddlevtc1") else if (typeName == "huddlevtc1")
{ {
var props = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig> var props = JsonConvert.DeserializeObject<EssentialsHuddleVtc1PropertiesConfig>
(this.Properties.ToString()); (this.Properties.ToString());
var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching; var disp = DeviceManager.GetDeviceForKey(props.DefaultDisplayKey) as IRoutingSinkWithSwitching;
var codec = DeviceManager.GetDeviceForKey(props.VideoCodecKey) as var codec = DeviceManager.GetDeviceForKey(props.VideoCodecKey) as
PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase; PepperDash.Essentials.Devices.Common.VideoCodec.VideoCodecBase;
var rm = new EssentialsHuddleVtc1Room(Key, Name, disp, codec, codec, props); var rm = new EssentialsHuddleVtc1Room(Key, Name, disp, codec, codec, props);
// Add Occupancy object from config // Add Occupancy object from config
if (props.Occupancy != null) if (props.Occupancy != null)
rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes); PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider, props.Occupancy.TimoutMinutes);
rm.LogoUrl = props.Logo.GetUrl(); rm.LogoUrl = props.Logo.GetUrl();
rm.SourceListKey = props.SourceListKey; rm.SourceListKey = props.SourceListKey;
rm.DefaultSourceItem = props.DefaultSourceItem; rm.DefaultSourceItem = props.DefaultSourceItem;
rm.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100); rm.DefaultVolume = (ushort)(props.Volumes.Master.Level * 65535 / 100);
rm.MicrophonePrivacy = GetMicrophonePrivacy(props, rm); // Get Microphone Privacy object, if any rm.MicrophonePrivacy = GetMicrophonePrivacy(props, rm); // Get Microphone Privacy object, if any
rm.Emergency = GetEmergency(props, rm); // Get emergency object, if any rm.Emergency = GetEmergency(props, rm); // Get emergency object, if any
return rm; return rm;
} }
else if (typeName == "ddvc01Bridge") else if (typeName == "ddvc01Bridge")
{ {
return new Device(Key, Name); // placeholder device that does nothing. return new Device(Key, Name); // placeholder device that does nothing.
} }
return null; return null;
} }
/// <summary> /// <summary>
/// Gets and operating, standalone emergegncy object that can be plugged into a room. /// Gets and operating, standalone emergegncy object that can be plugged into a room.
/// Returns null if there is no emergency defined /// Returns null if there is no emergency defined
/// </summary> /// </summary>
EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room) EssentialsRoomEmergencyBase GetEmergency(EssentialsRoomPropertiesConfig props, EssentialsRoomBase room)
{ {
// This emergency // This emergency
var emergency = props.Emergency; var emergency = props.Emergency;
if (emergency != null) if (emergency != null)
{ {
//switch on emergency type here. Right now only contact and shutdown //switch on emergency type here. Right now only contact and shutdown
var e = new EssentialsRoomEmergencyContactClosure(room.Key + "-emergency", props.Emergency, room); var e = new EssentialsRoomEmergencyContactClosure(room.Key + "-emergency", props.Emergency, room);
DeviceManager.AddDevice(e); DeviceManager.AddDevice(e);
} }
return null; return null;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="props"></param> /// <param name="props"></param>
/// <param name="room"></param> /// <param name="room"></param>
/// <returns></returns> /// <returns></returns>
PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy( PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController GetMicrophonePrivacy(
EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room) EssentialsRoomPropertiesConfig props, EssentialsHuddleVtc1Room room)
{ {
var microphonePrivacy = props.MicrophonePrivacy; var microphonePrivacy = props.MicrophonePrivacy;
if (microphonePrivacy == null) if (microphonePrivacy == null)
{ {
Debug.Console(0, "ERROR: Cannot create microphone privacy with null properties"); Debug.Console(0, "ERROR: Cannot create microphone privacy with null properties");
return null; return null;
} }
// Get the MicrophonePrivacy device from the device manager // Get the MicrophonePrivacy device from the device manager
var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as var mP = (DeviceManager.GetDeviceForKey(props.MicrophonePrivacy.DeviceKey) as
PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController); PepperDash.Essentials.Devices.Common.Microphones.MicrophonePrivacyController);
// Set this room as the IPrivacy device // Set this room as the IPrivacy device
if (mP == null) if (mP == null)
{ {
Debug.Console(0, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey); Debug.Console(0, "ERROR: Selected device {0} is not MicrophonePrivacyController", props.MicrophonePrivacy.DeviceKey);
return null; return null;
} }
mP.SetPrivacyDevice(room); mP.SetPrivacyDevice(room);
var behaviour = props.MicrophonePrivacy.Behaviour.ToLower(); var behaviour = props.MicrophonePrivacy.Behaviour.ToLower();
if (behaviour == null) if (behaviour == null)
{ {
Debug.Console(0, "WARNING: No behaviour defined for MicrophonePrivacyController"); Debug.Console(0, "WARNING: No behaviour defined for MicrophonePrivacyController");
return null; return null;
} }
if (behaviour == "trackroomstate") if (behaviour == "trackroomstate")
{ {
// Tie LED enable to room power state // Tie LED enable to room power state
room.OnFeedback.OutputChange += (o, a) => room.OnFeedback.OutputChange += (o, a) =>
{ {
if (room.OnFeedback.BoolValue) if (room.OnFeedback.BoolValue)
mP.EnableLeds = true; mP.EnableLeds = true;
else else
mP.EnableLeds = false; mP.EnableLeds = false;
}; };
mP.EnableLeds = room.OnFeedback.BoolValue; mP.EnableLeds = room.OnFeedback.BoolValue;
} }
else if (behaviour == "trackcallstate") else if (behaviour == "trackcallstate")
{ {
// Tie LED enable to room power state // Tie LED enable to room power state
room.InCallFeedback.OutputChange += (o, a) => room.InCallFeedback.OutputChange += (o, a) =>
{ {
if (room.InCallFeedback.BoolValue) if (room.InCallFeedback.BoolValue)
mP.EnableLeds = true; mP.EnableLeds = true;
else else
mP.EnableLeds = false; mP.EnableLeds = false;
}; };
mP.EnableLeds = room.InCallFeedback.BoolValue; mP.EnableLeds = room.InCallFeedback.BoolValue;
} }
return mP; return mP;
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class EssentialsRoomPropertiesConfig public class EssentialsRoomPropertiesConfig
{ {
[JsonProperty("addresses")] [JsonProperty("addresses")]
public EssentialsRoomAddressPropertiesConfig Addresses { get; set; } public EssentialsRoomAddressPropertiesConfig Addresses { get; set; }
[JsonProperty("description")] [JsonProperty("description")]
public string Description { get; set; } public string Description { get; set; }
[JsonProperty("emergency")] [JsonProperty("emergency")]
public EssentialsRoomEmergencyConfig Emergency { get; set; } public EssentialsRoomEmergencyConfig Emergency { get; set; }
[JsonProperty("help")] [JsonProperty("help")]
public EssentialsHelpPropertiesConfig Help { get; set; } public EssentialsHelpPropertiesConfig Help { get; set; }
[JsonProperty("helpMessage")] [JsonProperty("helpMessage")]
public string HelpMessage { get; set; } public string HelpMessage { get; set; }
[JsonProperty("environment")] [JsonProperty("environment")]
public EssentialsEnvironmentPropertiesConfig Environment { get; set; } public EssentialsEnvironmentPropertiesConfig Environment { get; set; }
[JsonProperty("logo")] [JsonProperty("logo")]
public EssentialsLogoPropertiesConfig Logo { get; set; } public EssentialsLogoPropertiesConfig Logo { get; set; }
[JsonProperty("microphonePrivacy")] [JsonProperty("microphonePrivacy")]
public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; } public EssentialsRoomMicrophonePrivacyConfig MicrophonePrivacy { get; set; }
[JsonProperty("occupancy")] [JsonProperty("occupancy")]
public EssentialsRoomOccSensorConfig Occupancy { get; set; } public EssentialsRoomOccSensorConfig Occupancy { get; set; }
[JsonProperty("oneButtonMeeting")] [JsonProperty("oneButtonMeeting")]
public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; } public EssentialsOneButtonMeetingPropertiesConfig OneButtonMeeting { get; set; }
[JsonProperty("shutdownVacancySeconds")] [JsonProperty("shutdownVacancySeconds")]
public int ShutdownVacancySeconds { get; set; } public int ShutdownVacancySeconds { get; set; }
[JsonProperty("shutdownPromptSeconds")] [JsonProperty("shutdownPromptSeconds")]
public int ShutdownPromptSeconds { get; set; } public int ShutdownPromptSeconds { get; set; }
[JsonProperty("tech")] [JsonProperty("tech")]
public EssentialsRoomTechConfig Tech { get; set; } public EssentialsRoomTechConfig Tech { get; set; }
[JsonProperty("volumes")] [JsonProperty("volumes")]
public EssentialsRoomVolumesConfig Volumes { get; set; } public EssentialsRoomVolumesConfig Volumes { get; set; }
[JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")] [JsonProperty("zeroVolumeWhenSwtichingVolumeDevices")]
public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; } public bool ZeroVolumeWhenSwtichingVolumeDevices { get; set; }
} }
public class EssentialsEnvironmentPropertiesConfig public class EssentialsEnvironmentPropertiesConfig
{ {
public bool Enabled { get; set; } public bool Enabled { get; set; }
[JsonProperty("deviceKeys")] [JsonProperty("deviceKeys")]
public List<string> DeviceKeys { get; set; } public List<string> DeviceKeys { get; set; }
public EssentialsEnvironmentPropertiesConfig() public EssentialsEnvironmentPropertiesConfig()
{ {
DeviceKeys = new List<string>(); DeviceKeys = new List<string>();
} }
} }
public class EssentialsRoomMicrophonePrivacyConfig public class EssentialsRoomMicrophonePrivacyConfig
{ {
[JsonProperty("deviceKey")] [JsonProperty("deviceKey")]
public string DeviceKey { get; set; } public string DeviceKey { get; set; }
[JsonProperty("behaviour")] [JsonProperty("behaviour")]
public string Behaviour { get; set; } public string Behaviour { get; set; }
} }
/// <summary> /// <summary>
/// Properties for the help text box /// Properties for the help text box
/// </summary> /// </summary>
public class EssentialsHelpPropertiesConfig public class EssentialsHelpPropertiesConfig
{ {
[JsonProperty("message")] [JsonProperty("message")]
public string Message { get; set; } public string Message { get; set; }
[JsonProperty("showCallButton")] [JsonProperty("showCallButton")]
public bool ShowCallButton { get; set; } public bool ShowCallButton { get; set; }
/// <summary> /// <summary>
/// Defaults to "Call Help Desk" /// Defaults to "Call Help Desk"
/// </summary> /// </summary>
[JsonProperty("callButtonText")] [JsonProperty("callButtonText")]
public string CallButtonText { get; set; } public string CallButtonText { get; set; }
public EssentialsHelpPropertiesConfig() public EssentialsHelpPropertiesConfig()
{ {
CallButtonText = "Call Help Desk"; CallButtonText = "Call Help Desk";
} }
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public class EssentialsOneButtonMeetingPropertiesConfig public class EssentialsOneButtonMeetingPropertiesConfig
{ {
[JsonProperty("enable")] [JsonProperty("enable")]
public bool Enable { get; set; } public bool Enable { get; set; }
} }
public class EssentialsRoomAddressPropertiesConfig public class EssentialsRoomAddressPropertiesConfig
{ {
[JsonProperty("phoneNumber")] [JsonProperty("phoneNumber")]
public string PhoneNumber { get; set; } public string PhoneNumber { get; set; }
[JsonProperty("sipAddress")] [JsonProperty("sipAddress")]
public string SipAddress { get; set; } public string SipAddress { get; set; }
} }
/// <summary> /// <summary>
/// Properties for the room's logo on panels /// Properties for the room's logo on panels
/// </summary> /// </summary>
public class EssentialsLogoPropertiesConfig public class EssentialsLogoPropertiesConfig
{ {
[JsonProperty("type")] [JsonProperty("type")]
public string Type { get; set; } public string Type { get; set; }
[JsonProperty("url")] [JsonProperty("url")]
public string Url { get; set; } public string Url { get; set; }
/// <summary> /// <summary>
/// Gets either the custom URL, a local-to-processor URL, or null if it's a default logo /// Gets either the custom URL, a local-to-processor URL, or null if it's a default logo
/// </summary> /// </summary>
public string GetUrl() public string GetUrl()
{ {
if (Type == "url") if (Type == "url")
return Url; return Url;
if (Type == "system") if (Type == "system")
return string.Format("http://{0}:8080/logo.png", return string.Format("http://{0}:8080/logo.png",
CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0)); CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0));
return null; return null;
} }
} }
/// <summary> /// <summary>
/// Represents occupancy sensor(s) setup for a room /// Represents occupancy sensor(s) setup for a room
/// </summary> /// </summary>
public class EssentialsRoomOccSensorConfig public class EssentialsRoomOccSensorConfig
{ {
[JsonProperty("deviceKey")] [JsonProperty("deviceKey")]
public string DeviceKey { get; set; } public string DeviceKey { get; set; }
[JsonProperty("timoutMinutes")] [JsonProperty("timoutMinutes")]
public int TimoutMinutes { get; set; } public int TimoutMinutes { get; set; }
}
[JsonProperty("enableRoomOnWhenOccupied")]
public class EssentialsRoomTechConfig public bool EnableRoomOnWhenOccupied { get; set; }
{
[JsonProperty("password")] [JsonProperty("occupancyStartTime")]
public string Password { get; set; } public string OccupancyStartTime { get; set; }
}
[JsonProperty("occupancyEndTime")]
public string OccupancyEndTime { get; set; }
[JsonProperty("enableSunday")]
public bool EnableSunday { get; set; }
[JsonProperty("enableMonday")]
public bool EnableMonday { get; set; }
[JsonProperty("enableTuesday")]
public bool EnableTuesday { get; set; }
[JsonProperty("enableWednesday")]
public bool EnableWednesday { get; set; }
[JsonProperty("enableThursday")]
public bool EnableThursday { get; set; }
[JsonProperty("enableFriday")]
public bool EnableFriday { get; set; }
[JsonProperty("enableSaturday")]
public bool EnableSaturday { get; set; }
}
public class EssentialsRoomTechConfig
{
[JsonProperty("password")]
public string Password { get; set; }
}
} }

View File

@@ -387,7 +387,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Will power the room on with the last-used source /// Will power the room on with the last-used source
/// </summary> /// </summary>
public void PowerOnToDefaultOrLastSource() public override void PowerOnToDefaultOrLastSource()
{ {
if (!EnablePowerOnToLastSource || LastSourceKey == null) if (!EnablePowerOnToLastSource || LastSourceKey == null)
return; return;

View File

@@ -532,7 +532,7 @@ namespace PepperDash.Essentials
/// <summary> /// <summary>
/// Will power the room on with the last-used source /// Will power the room on with the last-used source
/// </summary> /// </summary>
public void PowerOnToDefaultOrLastSource() public override void PowerOnToDefaultOrLastSource()
{ {
if (!EnablePowerOnToLastSource || LastSourceKey == null) if (!EnablePowerOnToLastSource || LastSourceKey == null)
return; return;

View File

@@ -59,7 +59,23 @@ namespace PepperDash.Essentials
/// <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>
/// The time of day at which the room occupancy power on feature should be enabled
/// </summary>
protected DateTime RoomOccpuancyPowerOnStart;
/// <summary>
/// The time of day at which the room occupancy power on feature should be disabled
/// </summary>
protected DateTime RoomOccupancyPowerOnEnd;
/// <summary>
/// Should the room power on to the default source if occupied between the start and end times
/// </summary>
protected bool RoomOccupancyPowerOnIsEnabled;
/// <summary> /// <summary>
/// ///
@@ -203,7 +219,12 @@ namespace PepperDash.Essentials
RoomOccupancy = statusProvider; RoomOccupancy = statusProvider;
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange; RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += RoomIsOccupiedFeedback_OutputChange;
} }
/// <summary>
/// To allow base class to power room on to default source
/// </summary>
public abstract void PowerOnToDefaultOrLastSource();
void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e) void RoomIsOccupiedFeedback_OutputChange(object sender, EventArgs e)
{ {
@@ -217,16 +238,28 @@ namespace PepperDash.Essentials
{ {
Debug.Console(1, this, "Notice: Occupancy Detected"); Debug.Console(1, this, "Notice: Occupancy Detected");
// Reset the timer when the room is occupied // Reset the timer when the room is occupied
RoomVacancyShutdownTimer.Cancel();
RoomVacancyShutdownTimer.Cancel(); if(RoomOccupancyPowerOnIsEnabled)
{
var currentTime = DateTime.Now.TimeOfDay;
if (currentTime.CompareTo(RoomOccpuancyPowerOnStart.TimeOfDay) > 0 && RoomOccupancyPowerOnEnd.TimeOfDay.CompareTo(currentTime) > 0)
{
PowerOnToDefaultOrLastSource();
}
}
} }
}
/// <summary>
/// Sets up events in the scheduler for the start and end times of the appropriate days to enable and disable the RoomOccupancyPowerOnIsEnabled flag
/// </summary>
void SetUpOccupancyRoomOnEventsInScheduler()
{
} }
//void SwapVolumeDevices(IBasicVolumeControls currentDevice, IBasicVolumeControls newDevice)
//{
//}
/// <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>