Commit before merging in Heath's branch

This commit is contained in:
Neil Dorin
2017-10-17 21:10:23 -06:00
parent b9fceb830f
commit f5626fcd8b
9 changed files with 214 additions and 148 deletions

View File

@@ -18,6 +18,8 @@ namespace PepperDash.Essentials.Devices.Common.Codec
public interface IHasScheduleAwareness public interface IHasScheduleAwareness
{ {
CodecScheduleAwareness CodecSchedule { get; } CodecScheduleAwareness CodecSchedule { get; }
void GetSchedule();
} }
public class CodecScheduleAwareness public class CodecScheduleAwareness

View File

@@ -767,6 +767,14 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco
SendText("xCommand CallHistory Recents Limit: 20 Order: OccurrenceTime"); SendText("xCommand CallHistory Recents Limit: 20 Order: OccurrenceTime");
} }
/// <summary>
/// Required for IHasScheduleAwareness
/// </summary>
public void GetSchedule()
{
GetBookings(null);
}
/// <summary> /// <summary>
/// Gets the bookings for today /// Gets the bookings for today
/// </summary> /// </summary>

View File

@@ -340,6 +340,11 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec
#region IHasScheduleAwareness Members #region IHasScheduleAwareness Members
public void GetSchedule()
{
}
public CodecScheduleAwareness CodecSchedule public CodecScheduleAwareness CodecSchedule
{ {
get { get {

View File

@@ -12,7 +12,7 @@ using PepperDash.Essentials.Devices.Common.Codec;
namespace PepperDash.Essentials.Devices.Common.VideoCodec namespace PepperDash.Essentials.Devices.Common.VideoCodec
{ {
public abstract class VideoCodecBase : Device, IRoutingInputsOutputs, public abstract class VideoCodecBase : Device, IRoutingInputsOutputs,
IUsageTracking, IHasDialer, IHasSharing, ICodecAudio, iCodecInfo IUsageTracking, IHasDialer, IHasSharing, ICodecAudio, iCodecInfo //, ICommunicationMonitor
{ {
/// <summary> /// <summary>
/// Fires when the status of any active, dialing, or incoming call changes or is new /// Fires when the status of any active, dialing, or incoming call changes or is new

View File

@@ -189,7 +189,7 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(room); DeviceManager.AddDevice(room);
Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion"); Debug.Console(1, "Room is EssentialsHuddleSpaceRoom, attempting to add to DeviceManager with Fusion");
DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemController((EssentialsHuddleSpaceRoom)room, 0xf1)); DeviceManager.AddDevice(new EssentialsHuddleSpaceFusionSystemControllerBase((EssentialsHuddleSpaceRoom)room, 0xf1));
var cotija = DeviceManager.GetDeviceForKey("cotijaServer") as CotijaSystemController; var cotija = DeviceManager.GetDeviceForKey("cotijaServer") as CotijaSystemController;

View File

@@ -17,13 +17,14 @@ using Newtonsoft.Json.Linq;
using PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials; using PepperDash.Essentials;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common; using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Devices.Common.Occupancy;
namespace PepperDash.Essentials.Fusion namespace PepperDash.Essentials.Fusion
{ {
public class EssentialsHuddleSpaceFusionSystemController : Device public class EssentialsHuddleSpaceFusionSystemControllerBase : Device, IOccupancyStatusProvider
{ {
public event EventHandler<ScheduleChangeEventArgs> ScheduleChange; public event EventHandler<ScheduleChangeEventArgs> ScheduleChange;
//public event EventHandler<MeetingChangeEventArgs> MeetingEndWarning; //public event EventHandler<MeetingChangeEventArgs> MeetingEndWarning;
@@ -34,8 +35,6 @@ namespace PepperDash.Essentials.Fusion
Dictionary<Device, BoolInputSig> SourceToFeedbackSigs = Dictionary<Device, BoolInputSig> SourceToFeedbackSigs =
new Dictionary<Device, BoolInputSig>(); new Dictionary<Device, BoolInputSig>();
//BooleanSigData OccupancyStatusSig;
StatusMonitorCollection ErrorMessageRollUp; StatusMonitorCollection ErrorMessageRollUp;
StringSigData CurrentRoomSourceNameSig; StringSigData CurrentRoomSourceNameSig;
@@ -103,13 +102,27 @@ namespace PepperDash.Essentials.Fusion
public long PushNotificationTimeout = 5000; public long PushNotificationTimeout = 5000;
Dictionary<int, FusionAsset> FusionStaticAssets; Dictionary<int, FusionAsset> FusionStaticAssets;
FusionOccupancySensorAsset FusionOccSensor; // For use with local occ sensor devices which will relay to Fusion the current occupancy status
FusionRemoteOccupancySensor FusionRemoteOccSensor;
// For use with occ sensor attached to a scheduling panel in Fusion
FusionOccupancySensorAsset FusionOccSensor;
public BoolFeedback RoomIsOccupiedFeedback { get; private set; }
protected Func<bool> RoomIsOccupiedFeedbackFunc
{
get
{
return () => FusionRemoteOccSensor.RoomOccupied.OutputSig.BoolValue;
}
}
//ScheduleResponseEvent NextMeeting; //ScheduleResponseEvent NextMeeting;
public EssentialsHuddleSpaceFusionSystemController(EssentialsHuddleSpaceRoom room, uint ipId) public EssentialsHuddleSpaceFusionSystemControllerBase(EssentialsHuddleSpaceRoom room, uint ipId)
: base(room.Key + "-fusion") : base(room.Key + "-fusion")
{ {
@@ -143,8 +156,17 @@ namespace PepperDash.Essentials.Fusion
SetUpCommunitcationMonitors(); SetUpCommunitcationMonitors();
SetUpDisplay(); SetUpDisplay();
SetUpError(); SetUpError();
//SetUpOccupancy();
if(Room.RoomOccupancy != null)
{
if(Room.OccupancyStatusProviderIsRemote)
SetUpRemoteOccupancy();
else
{
SetUpLocalOccupancy();
}
}
// Make it so! // Make it so!
FusionRVI.GenerateFileForAllFusionDevices(); FusionRVI.GenerateFileForAllFusionDevices();
@@ -1174,9 +1196,27 @@ namespace PepperDash.Essentials.Fusion
FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message; FusionRoom.ErrorMessage.InputSig.StringValue = ErrorMessageRollUp.Message;
}; };
} }
/// <summary>
/// Sets up a local occupancy sensor, such as one attached to a Fusion Scheduling panel. The occupancy status of the room will be read from Fusion
/// </summary>
void SetUpLocalOccupancy()
{
RoomIsOccupiedFeedback = new BoolFeedback(RoomIsOccupiedFeedbackFunc);
// Build Occupancy Asset?
// Link sigs?
Room.SetRoomOccupancy(this);
}
void SetUpOccupancy() /// <summary>
/// Sets up remote occupancy that will relay the occupancy status determined by local system devices to Fusion
/// </summary>
void SetUpRemoteOccupancy()
{ {
// Need to have the room occupancy object first and somehow determine the slot number of the Occupancy asset but will not be able to use the UID from config likely. // Need to have the room occupancy object first and somehow determine the slot number of the Occupancy asset but will not be able to use the UID from config likely.
@@ -1195,7 +1235,7 @@ namespace PepperDash.Essentials.Fusion
var occSensorAsset = FusionRoom.CreateOccupancySensorAsset(tempOccAsset.SlotNumber, tempOccAsset.Name, "Occupancy Sensor", tempOccAsset.InstanceId); var occSensorAsset = FusionRoom.CreateOccupancySensorAsset(tempOccAsset.SlotNumber, tempOccAsset.Name, "Occupancy Sensor", tempOccAsset.InstanceId);
occSensorAsset.RoomOccupied.AddSigToRVIFile = true; occSensorAsset.RoomOccupied.AddSigToRVIFile = true;
var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig); var occSensorShutdownMinutes = FusionRoom.CreateOffsetUshortSig(70, "Occ Shutdown - Minutes", eSigIoMask.InputOutputSig);
@@ -1203,7 +1243,7 @@ namespace PepperDash.Essentials.Fusion
//occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b)); //occSensorShutdownMinutes.OutputSig.UserObject(new Action(ushort)(b => Room.OccupancyObj.SetShutdownMinutes(b));
// use Room.OccObject.RoomOccupiedFeedback.LinkInputSig(occSensorAsset.InputSig); Room.RoomOccupancy.RoomIsOccupiedFeedback.LinkInputSig(occSensorAsset.RoomOccupied.InputSig);
//} //}
} }

View File

@@ -64,8 +64,10 @@ namespace PepperDash.Essentials.Room.Config
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
#warning Add in occupancy object from config if found and link up device to occupancy feedback
if (props.Occupancy != null)
rm.SetRoomOccupancy(DeviceManager.GetDeviceForKey(props.Occupancy.DeviceKey) as PepperDash.Essentials.Devices.Common.Occupancy.IOccupancyStatusProvider);
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;

View File

@@ -1,54 +1,56 @@
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 PepperDash.Core; using PepperDash.Core;
using PepperDash.Essentials.Core; using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common.Occupancy; using PepperDash.Essentials.Devices.Common.Occupancy;
namespace PepperDash.Essentials namespace PepperDash.Essentials
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public interface IHasCurrentSourceInfoChange public interface IHasCurrentSourceInfoChange
{ {
event SourceInfoChangeHandler CurrentSingleSourceChange; event SourceInfoChangeHandler CurrentSingleSourceChange;
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public abstract class EssentialsRoomBase : Device public abstract class EssentialsRoomBase : Device
{ {
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public BoolFeedback OnFeedback { get; private set; } public BoolFeedback OnFeedback { get; private set; }
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; }
protected abstract Func<bool> IsWarmingFeedbackFunc { get; } public bool OccupancyStatusProviderIsRemote { get; private set; }
protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
protected abstract Func<bool> IsWarmingFeedbackFunc { get; }
/// <summary> protected abstract Func<bool> IsCoolingFeedbackFunc { get; }
/// Timer used for informing the UIs of a shutdown
/// </summary> /// <summary>
public SecondsCountdownTimer ShutdownPromptTimer { get; private set; } /// Timer used for informing the UIs of a shutdown
/// </summary>
/// <summary> public SecondsCountdownTimer ShutdownPromptTimer { get; private set; }
///
/// </summary> /// <summary>
public int ShutdownPromptSeconds { get; set; } ///
public int ShutdownVacancySeconds { get; set; } /// </summary>
public eShutdownType ShutdownType { get; private set; } public int ShutdownPromptSeconds { get; set; }
public int ShutdownVacancySeconds { get; set; }
public PepperDash.Essentials.Room.EssentialsRoomEmergencyBase Emergency { get; set; } public eShutdownType ShutdownType { get; private set; }
public PepperDash.Essentials.Room.EssentialsRoomEmergencyBase Emergency { get; set; }
public string LogoUrl { get; set; } public string LogoUrl { get; set; }
protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; } protected SecondsCountdownTimer RoomVacancyShutdownTimer { get; private set; }
@@ -63,49 +65,49 @@ 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> /// <summary>
/// ///
/// </summary> /// </summary>
protected abstract Func<bool> OnFeedbackFunc { get; } protected abstract Func<bool> OnFeedbackFunc { get; }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
/// <param name="key"></param> /// <param name="key"></param>
/// <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 // 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);
} }
void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e) void RoomVacancyShutdownPromptTimer_HasFinished(object sender, EventArgs e)
@@ -124,22 +126,22 @@ namespace PepperDash.Essentials
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();
} }
public void StartRoomVacancyTimer(eVacancyMode mode) public void StartRoomVacancyTimer(eVacancyMode mode)
@@ -150,11 +152,11 @@ namespace PepperDash.Essentials
RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds; RoomVacancyShutdownTimer.SecondsToCount = RoomVacancyShutdownSeconds;
VacancyMode = mode; VacancyMode = mode;
RoomVacancyShutdownTimer.Start(); RoomVacancyShutdownTimer.Start();
} }
/// <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;
@@ -166,11 +168,11 @@ namespace PepperDash.Essentials
/// 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>
@@ -179,6 +181,10 @@ namespace PepperDash.Essentials
/// <param name="statusProvider"></param> /// <param name="statusProvider"></param>
public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider) public void SetRoomOccupancy(IOccupancyStatusProvider statusProvider)
{ {
// If status provider is fusion, set flag to remote
if (statusProvider is PepperDash.Essentials.Fusion.EssentialsHuddleSpaceFusionSystemControllerBase)
OccupancyStatusProviderIsRemote = true;
RoomOccupancy = statusProvider; RoomOccupancy = statusProvider;
RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += new EventHandler<EventArgs>(RoomIsOccupiedFeedback_OutputChange); RoomOccupancy.RoomIsOccupiedFeedback.OutputChange += new EventHandler<EventArgs>(RoomIsOccupiedFeedback_OutputChange);
@@ -203,18 +209,18 @@ namespace PepperDash.Essentials
/// 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
@@ -222,15 +228,15 @@ namespace PepperDash.Essentials
None = 0, None = 0,
InInitialVacancy, InInitialVacancy,
InShutdownWarning InShutdownWarning
} }
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
public enum eWarmingCoolingMode public enum eWarmingCoolingMode
{ {
None, None,
Warming, Warming,
Cooling Cooling
} }
} }

View File

@@ -1017,6 +1017,9 @@ namespace PepperDash.Essentials
/// </summary> /// </summary>
void RefreshMeetingsList() void RefreshMeetingsList()
{ {
// See if this is helpful or if the callback response in the codec class maybe doesn't come it time?
CurrentRoom.ScheduleSource.GetSchedule();
TriList.SetString(UIStringJoin.MeetingsOrContactMethodListIcon, "Calendar"); TriList.SetString(UIStringJoin.MeetingsOrContactMethodListIcon, "Calendar");
TriList.SetString(UIStringJoin.MeetingsOrContactMethodListTitleText, "Today's Meetings"); TriList.SetString(UIStringJoin.MeetingsOrContactMethodListTitleText, "Today's Meetings");