diff --git a/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs b/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs
index 6979dded..da6127fd 100644
--- a/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs
+++ b/Essentials Core/PepperDashEssentialsBase/Crestron/CrestronGenericBaseDevice.cs
@@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core
///
/// A bridge class to cover the basic features of GenericBase hardware
///
- public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor
+ public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
{
public virtual GenericBase Hardware { get; protected set; }
@@ -87,7 +87,13 @@ namespace PepperDash.Essentials.Core
#region IStatusMonitor Members
public StatusMonitorBase CommunicationMonitor { get; private set; }
- #endregion
+ #endregion
+
+ #region IUsageTracking Members
+
+ public UsageTracking UsageTracker { get; set; }
+
+ #endregion
}
//***********************************************************************************
diff --git a/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IPower.cs b/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IPower.cs
index c8750610..863e138d 100644
--- a/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IPower.cs
+++ b/Essentials Core/PepperDashEssentialsBase/DeviceTypeInterfaces/IPower.cs
@@ -1,46 +1,68 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-using Crestron.SimplSharpPro.DeviceSupport;
-
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.SmartObjects;
-
-namespace PepperDash.Essentials.Core
-{
- ///
- ///
- ///
- public interface IPower
- {
- void PowerOn();
- void PowerOff();
- void PowerToggle();
- BoolFeedback PowerIsOnFeedback { get; }
- }
-
- ///
- ///
- ///
- public static class IPowerExtensions
- {
- public static void LinkButtons(this IPower dev, BasicTriList triList)
- {
- triList.SetSigFalseAction(101, dev.PowerOn);
- triList.SetSigFalseAction(102, dev.PowerOff);
- triList.SetSigFalseAction(103, dev.PowerToggle);
- dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
- }
-
- public static void UnlinkButtons(this IPower dev, BasicTriList triList)
- {
- triList.ClearBoolSigAction(101);
- triList.ClearBoolSigAction(102);
- triList.ClearBoolSigAction(103);
- dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
- }
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharpPro;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharpPro.Fusion;
+
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.SmartObjects;
+
+
+namespace PepperDash.Essentials.Core
+{
+ ///
+ ///
+ ///
+ public interface IPower
+ {
+ void PowerOn();
+ void PowerOff();
+ void PowerToggle();
+ BoolFeedback PowerIsOnFeedback { get; }
+ }
+
+ ///
+ ///
+ ///
+ public static class IPowerExtensions
+ {
+ public static void LinkButtons(this IPower dev, BasicTriList triList)
+ {
+ triList.SetSigFalseAction(101, dev.PowerOn);
+ triList.SetSigFalseAction(102, dev.PowerOff);
+ triList.SetSigFalseAction(103, dev.PowerToggle);
+ dev.PowerIsOnFeedback.LinkInputSig(triList.BooleanInput[101]);
+ }
+
+ public static void UnlinkButtons(this IPower dev, BasicTriList triList)
+ {
+ triList.ClearBoolSigAction(101);
+ triList.ClearBoolSigAction(102);
+ triList.ClearBoolSigAction(103);
+ dev.PowerIsOnFeedback.UnlinkInputSig(triList.BooleanInput[101]);
+ }
+ }
+/*
+ public static class IFusionPowerExtensions
+ {
+ public static void LinkAttributes(this IPower dev, FusionRoom room)
+ {
+ dev.PowerIsOnFeedback.LinkInputSig(room.DisplayPowerOn.InputSig);
+
+ room.DisplayPowerOn.OutputSig.SetSigFalseAction(dev.PowerOn);
+ room.DisplayPowerOff.OutputSig.SetSigFalseAction(dev.PowerOff);
+ }
+
+ public static void UnlinkAttributes(this IPower dev, FusionRoom room)
+ {
+ dev.PowerIsOnFeedback.UnlinkInputSig(room.DisplayPowerOn.InputSig);
+
+ room.DisplayPowerOn.OutputSig.SetSigFalseAction(null);
+ room.DisplayPowerOff.OutputSig.SetSigFalseAction(null);
+ }
+ }
+*/
}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_BASE_3692.cs.swp b/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_BASE_3692.cs.swp
new file mode 100644
index 00000000..827c466a
Binary files /dev/null and b/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_BASE_3692.cs.swp differ
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_LOCAL_3692.cs.swp b/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_LOCAL_3692.cs.swp
new file mode 100644
index 00000000..e06196a4
Binary files /dev/null and b/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_LOCAL_3692.cs.swp differ
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_REMOTE_3692.cs.swp b/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_REMOTE_3692.cs.swp
new file mode 100644
index 00000000..842256cc
Binary files /dev/null and b/Essentials Core/PepperDashEssentialsBase/Devices/.IHasFeedbacks_REMOTE_3692.cs.swp differ
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_BACKUP_3692.cs b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_BACKUP_3692.cs
new file mode 100644
index 00000000..8af64e92
--- /dev/null
+++ b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_BACKUP_3692.cs
@@ -0,0 +1,135 @@
+<<<<<<< HEAD
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharp.Reflection;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasFeedback : IKeyed
+ {
+ ///
+ /// This method shall return a list of all Output objects on a device,
+ /// including all "aggregate" devices.
+ ///
+ List Feedbacks { get; }
+
+ }
+
+
+ public static class IHasFeedbackExtensions
+ {
+ public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
+ {
+ CType t = source.GetType();
+ // get the properties and set them into a new collection of NameType wrappers
+ var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
+
+
+
+ var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
+ if (feedbacks != null)
+ {
+ Debug.Console(0, source, "\n\nAvailable feedbacks:");
+ foreach (var f in feedbacks)
+ {
+ string val = "";
+ string type = "";
+ if (getCurrentStates)
+ {
+ if (f is BoolFeedback)
+ {
+ val = f.BoolValue.ToString();
+ type = "boolean";
+ }
+ else if (f is IntFeedback)
+ {
+ val = f.IntValue.ToString();
+ type = "integer";
+ }
+ else if (f is StringFeedback)
+ {
+ val = f.StringValue;
+ type = "string";
+ }
+ }
+ Debug.Console(0, "{0,-12} {1, -25} {2}", type,
+ (string.IsNullOrEmpty(f.Cue.Name) ? "-no name-" : f.Cue.Name), val);
+ }
+ }
+ else
+ Debug.Console(0, source, "No available outputs:");
+ }
+ }
+=======
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharpPro.DeviceSupport;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasFeedback : IKeyed
+ {
+ ///
+ /// This method shall return a list of all Output objects on a device,
+ /// including all "aggregate" devices.
+ ///
+ List Feedbacks { get; }
+
+ }
+
+
+ public static class IHasFeedbackExtensions
+ {
+ public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
+ {
+ var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
+ if (feedbacks != null)
+ {
+ Debug.Console(0, source, "\n\nAvailable feedbacks:");
+ foreach (var f in feedbacks)
+ {
+ string val = "";
+ if (getCurrentStates)
+ {
+ if (f is BoolFeedback)
+ val = " = " + f.BoolValue;
+ else if(f is IntFeedback)
+ val = " = " + f.IntValue;
+ else if(f is StringFeedback)
+ val = " = " + f.StringValue;
+
+ //switch (f.Type)
+ //{
+ // case eCueType.Bool:
+ // val = " = " + f.BoolValue;
+ // break;
+ // case eCueType.Int:
+ // val = " = " + f.IntValue;
+ // break;
+ // case eCueType.String:
+ // val = " = " + f.StringValue;
+ // break;
+ // //case eOutputType.Other:
+ // // break;
+ //}
+ }
+ Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
+ (string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
+ }
+ }
+ else
+ Debug.Console(0, source, "No available outputs:");
+ }
+ }
+
+ public static class IHasFeedbackFusionExtensions
+ {
+
+ }
+>>>>>>> origin/feature/ecs-307
+}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_BASE_3692.cs b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_BASE_3692.cs
new file mode 100644
index 00000000..446577f6
--- /dev/null
+++ b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_BASE_3692.cs
@@ -0,0 +1,63 @@
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharpPro.DeviceSupport;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasFeedback : IKeyed
+ {
+ ///
+ /// This method shall return a list of all Output objects on a device,
+ /// including all "aggregate" devices.
+ ///
+ List Feedbacks { get; }
+
+ }
+
+
+ public static class IHasFeedbackExtensions
+ {
+ public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
+ {
+ var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
+ if (feedbacks != null)
+ {
+ Debug.Console(0, source, "\n\nAvailable feedbacks:");
+ foreach (var f in feedbacks)
+ {
+ string val = "";
+ if (getCurrentStates)
+ {
+ if (f is BoolFeedback)
+ val = " = " + f.BoolValue;
+ else if(f is IntFeedback)
+ val = " = " + f.IntValue;
+ else if(f is StringFeedback)
+ val = " = " + f.StringValue;
+
+ //switch (f.Type)
+ //{
+ // case eCueType.Bool:
+ // val = " = " + f.BoolValue;
+ // break;
+ // case eCueType.Int:
+ // val = " = " + f.IntValue;
+ // break;
+ // case eCueType.String:
+ // val = " = " + f.StringValue;
+ // break;
+ // //case eOutputType.Other:
+ // // break;
+ //}
+ }
+ Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
+ (string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
+ }
+ }
+ else
+ Debug.Console(0, source, "No available outputs:");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_LOCAL_3692.cs b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_LOCAL_3692.cs
new file mode 100644
index 00000000..5d33afa9
--- /dev/null
+++ b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_LOCAL_3692.cs
@@ -0,0 +1,65 @@
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharpPro.DeviceSupport;
+using Crestron.SimplSharp.Reflection;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasFeedback : IKeyed
+ {
+ ///
+ /// This method shall return a list of all Output objects on a device,
+ /// including all "aggregate" devices.
+ ///
+ List Feedbacks { get; }
+
+ }
+
+
+ public static class IHasFeedbackExtensions
+ {
+ public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
+ {
+ CType t = source.GetType();
+ // get the properties and set them into a new collection of NameType wrappers
+ var props = t.GetProperties().Select(p => new PropertyNameType(p, t));
+
+
+
+ var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
+ if (feedbacks != null)
+ {
+ Debug.Console(0, source, "\n\nAvailable feedbacks:");
+ foreach (var f in feedbacks)
+ {
+ string val = "";
+ string type = "";
+ if (getCurrentStates)
+ {
+ if (f is BoolFeedback)
+ {
+ val = f.BoolValue.ToString();
+ type = "boolean";
+ }
+ else if (f is IntFeedback)
+ {
+ val = f.IntValue.ToString();
+ type = "integer";
+ }
+ else if (f is StringFeedback)
+ {
+ val = f.StringValue;
+ type = "string";
+ }
+ }
+ Debug.Console(0, "{0,-12} {1, -25} {2}", type,
+ (string.IsNullOrEmpty(f.Cue.Name) ? "-no name-" : f.Cue.Name), val);
+ }
+ }
+ else
+ Debug.Console(0, source, "No available outputs:");
+ }
+ }
+}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_REMOTE_3692.cs b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_REMOTE_3692.cs
new file mode 100644
index 00000000..1ac02c71
--- /dev/null
+++ b/Essentials Core/PepperDashEssentialsBase/Devices/IHasFeedbacks_REMOTE_3692.cs
@@ -0,0 +1,68 @@
+using System.Collections.Generic;
+using System.Linq;
+using Crestron.SimplSharpPro.DeviceSupport;
+
+using PepperDash.Core;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IHasFeedback : IKeyed
+ {
+ ///
+ /// This method shall return a list of all Output objects on a device,
+ /// including all "aggregate" devices.
+ ///
+ List Feedbacks { get; }
+
+ }
+
+
+ public static class IHasFeedbackExtensions
+ {
+ public static void DumpFeedbacksToConsole(this IHasFeedback source, bool getCurrentStates)
+ {
+ var feedbacks = source.Feedbacks.OrderBy(x => x.Type);
+ if (feedbacks != null)
+ {
+ Debug.Console(0, source, "\n\nAvailable feedbacks:");
+ foreach (var f in feedbacks)
+ {
+ string val = "";
+ if (getCurrentStates)
+ {
+ if (f is BoolFeedback)
+ val = " = " + f.BoolValue;
+ else if(f is IntFeedback)
+ val = " = " + f.IntValue;
+ else if(f is StringFeedback)
+ val = " = " + f.StringValue;
+
+ //switch (f.Type)
+ //{
+ // case eCueType.Bool:
+ // val = " = " + f.BoolValue;
+ // break;
+ // case eCueType.Int:
+ // val = " = " + f.IntValue;
+ // break;
+ // case eCueType.String:
+ // val = " = " + f.StringValue;
+ // break;
+ // //case eOutputType.Other:
+ // // break;
+ //}
+ }
+ Debug.Console(0, "{0,-8} {1}{2}", f.GetType(),
+ (string.IsNullOrEmpty(f.Cue.Name) ? "-none-" : f.Cue.Name), val);
+ }
+ }
+ else
+ Debug.Console(0, source, "No available outputs:");
+ }
+ }
+
+ public static class IHasFeedbackFusionExtensions
+ {
+
+ }
+}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Devices/IUsageTracking.cs b/Essentials Core/PepperDashEssentialsBase/Devices/IUsageTracking.cs
new file mode 100644
index 00000000..787dc4bf
--- /dev/null
+++ b/Essentials Core/PepperDashEssentialsBase/Devices/IUsageTracking.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Core
+{
+ public interface IUsageTracking
+ {
+ UsageTracking UsageTracker { get; set; }
+ }
+
+ //public static class IUsageTrackingExtensions
+ //{
+ // public static void EnableUsageTracker(this IUsageTracking device)
+ // {
+ // device.UsageTracker = new UsageTracking();
+ // }
+ //}
+
+ public class UsageTracking
+ {
+ public event EventHandler DeviceUsageEnded;
+
+ public InUseTracking InUseTracker { get; protected set; }
+
+ public bool UsageIsTracked { get; set; }
+ public DateTime UsageStartTime { get; protected set; }
+ public DateTime UsageEndTime { get; protected set; }
+
+ public UsageTracking()
+ {
+ InUseTracker = new InUseTracking();
+
+ InUseTracker.InUseFeedback.OutputChange +=new EventHandler(InUseFeedback_OutputChange);
+ }
+
+ void InUseFeedback_OutputChange(object sender, EventArgs e)
+ {
+ if(InUseTracker.InUseFeedback.BoolValue)
+ {
+ StartDeviceUsage();
+ }
+ else
+ {
+ EndDeviceUsage();
+ }
+ }
+
+
+ ///
+ /// Stores the usage start time
+ ///
+ public void StartDeviceUsage()
+ {
+ UsageStartTime = DateTime.Now;
+ }
+
+ ///
+ /// Calculates the difference between the usage start and end times, gets the total minutes used and fires an event to pass that info to a consumer
+ ///
+ public void EndDeviceUsage()
+ {
+ UsageEndTime = DateTime.Now;
+
+ var timeUsed = UsageEndTime - UsageStartTime;
+
+ var handler = DeviceUsageEnded;
+
+ if (handler != null)
+ {
+ handler(this, new DeviceUsageEventArgs() { UsageEndTime = UsageEndTime, MinutesUsed = timeUsed.Minutes });
+ }
+ }
+ }
+
+ public class DeviceUsageEventArgs : EventArgs
+ {
+ public DateTime UsageEndTime { get; set; }
+ public int MinutesUsed { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs b/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs
index 83d77cea..e4d18584 100644
--- a/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs
+++ b/Essentials Core/PepperDashEssentialsBase/Display/DisplayBase.cs
@@ -16,12 +16,14 @@ namespace PepperDash.Essentials.Core
///
///
///
- public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling
+ public abstract class DisplayBase : Device, IHasFeedback, IRoutingSinkWithSwitching, IPower, IWarmingCooling, IUsageTracking
{
public BoolFeedback PowerIsOnFeedback { get; protected set; }
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
public BoolFeedback IsWarmingUpFeedback { get; private set; }
+ public UsageTracking UsageTracker { get; set; }
+
public uint WarmupTime { get; set; }
public uint CooldownTime { get; set; }
@@ -77,7 +79,7 @@ namespace PepperDash.Essentials.Core
///
///
///
- public abstract class TwoWayDisplayBase : DisplayBase
+ public abstract class TwoWayDisplayBase : DisplayBase
{
public StringFeedback CurrentInputFeedback { get; private set; }
@@ -104,6 +106,8 @@ namespace PepperDash.Essentials.Core
CooldownTime = 15000;
Feedbacks.Add(CurrentInputFeedback);
+
+
}
}
diff --git a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
index e02792ac..10282fc4 100644
--- a/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
+++ b/Essentials Core/PepperDashEssentialsBase/PepperDash_Essentials_Core.csproj
@@ -58,6 +58,10 @@
False
..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll
+
+ False
+ ..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll
+
False
..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll
@@ -112,6 +116,7 @@
+
diff --git a/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs b/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs
index 95b3eda8..f4d3c241 100644
--- a/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs
+++ b/Essentials Devices Common/Essentials Devices Common/DiscPlayer/IRDiscPlayerBase.cs
@@ -1,308 +1,314 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using Crestron.SimplSharp;
-using Crestron.SimplSharpPro;
-
-using PepperDash.Core;
-using PepperDash.Essentials.Core;
-using PepperDash.Essentials.Core.Routing;
-
-namespace PepperDash.Essentials.Devices.Common
-{
- public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs
- {
- public IrOutputPortController IrPort { get; private set; }
-
- public uint DisplayUiType { get { return DisplayUiConstants.TypeBluray; } }
-
- public IRBlurayBase(string key, string name, IrOutputPortController portCont)
- : base(key, name)
- {
- IrPort = portCont;
- DeviceManager.AddDevice(portCont);
-
- HasKeypadAccessoryButton1 = true;
- KeypadAccessoryButton1Command = "Clear";
- KeypadAccessoryButton1Label = "Clear";
-
- HasKeypadAccessoryButton2 = true;
- KeypadAccessoryButton2Command = "NumericEnter";
- KeypadAccessoryButton2Label = "Enter";
-
- PowerIsOnFeedback = new BoolFeedback(() => _PowerIsOn);
-
- HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.AudioVideo,
- eRoutingPortConnectionType.Hdmi, null, this);
- AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
- eRoutingPortConnectionType.DigitalAudio, null, this);
- OutputPorts = new RoutingPortCollection { HdmiOut, AnyAudioOut };
- }
-
-
- #region IDPad Members
-
- public void Up(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_UP_ARROW, pressRelease);
- }
-
- public void Down(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_DN_ARROW, pressRelease);
- }
-
- public void Left(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_LEFT_ARROW, pressRelease);
- }
-
- public void Right(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_RIGHT_ARROW, pressRelease);
- }
-
- public void Select(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease);
- }
-
- public void Menu(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_MENU, pressRelease);
- }
-
- public void Exit(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_EXIT, pressRelease);
- }
-
- #endregion
-
- #region INumericKeypad Members
-
- public void Digit0(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_0, pressRelease);
- }
-
- public void Digit1(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_1, pressRelease);
- }
-
- public void Digit2(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_2, pressRelease);
- }
-
- public void Digit3(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_3, pressRelease);
- }
-
- public void Digit4(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_4, pressRelease);
- }
-
- public void Digit5(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_5, pressRelease);
- }
-
- public void Digit6(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_6, pressRelease);
- }
-
- public void Digit7(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_7, pressRelease);
- }
-
- public void Digit8(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_8, pressRelease);
- }
-
- public void Digit9(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_9, pressRelease);
- }
-
- ///
- /// Defaults to true
- ///
- public bool HasKeypadAccessoryButton1 { get; set; }
-
- ///
- /// Defaults to "-"
- ///
- public string KeypadAccessoryButton1Label { get; set; }
-
-
- ///
- /// Defaults to "Dash"
- ///
- public string KeypadAccessoryButton1Command { get; set; }
-
- public void KeypadAccessoryButton1(bool pressRelease)
- {
- IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
- }
-
- ///
- /// Defaults to true
- ///
- public bool HasKeypadAccessoryButton2 { get; set; }
-
- ///
- /// Defaults to "Enter"
- ///
- public string KeypadAccessoryButton2Label { get; set; }
-
-
- ///
- /// Defaults to "Enter"
- ///
- public string KeypadAccessoryButton2Command { get; set; }
-
- public void KeypadAccessoryButton2(bool pressRelease)
- {
- IrPort.PressRelease(KeypadAccessoryButton2Command, pressRelease);
- }
-
- #endregion
-
- #region IChannelFunctions Members
-
- public void ChannelUp(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, pressRelease);
- }
-
- public void ChannelDown(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_CH_MINUS, pressRelease);
- }
-
- public void LastChannel(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_LAST, pressRelease);
- }
-
- public void Guide(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_GUIDE, pressRelease);
- }
-
- public void Info(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_INFO, pressRelease);
- }
-
- #endregion
-
- #region IColorFunctions Members
-
- public void Red(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_RED, pressRelease);
- }
-
- public void Green(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_GREEN, pressRelease);
- }
-
- public void Yellow(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_YELLOW, pressRelease);
- }
-
- public void Blue(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_BLUE, pressRelease);
- }
-
- #endregion
-
- #region IRoutingOutputs Members
-
- public RoutingOutputPort HdmiOut { get; private set; }
- public RoutingOutputPort AnyAudioOut { get; private set; }
- public RoutingPortCollection OutputPorts { get; private set; }
-
- #endregion
-
- #region IPower Members
-
- public void PowerOn()
- {
- IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, 200);
- _PowerIsOn = true;
- }
-
- public void PowerOff()
- {
- IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, 200);
- _PowerIsOn = false;
- }
-
- public void PowerToggle()
- {
- IrPort.Pulse(IROutputStandardCommands.IROut_POWER, 200);
- _PowerIsOn = false;
- }
-
- public BoolFeedback PowerIsOnFeedback { get; set; }
- bool _PowerIsOn;
-
- #endregion
-
- #region ITransport Members
-
- public void Play(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_PLAY, pressRelease);
- }
-
- public void Pause(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_PAUSE, pressRelease);
- }
-
- public void Rewind(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_RSCAN, pressRelease);
- }
-
- public void FFwd(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_FSCAN, pressRelease);
- }
-
- public void ChapMinus(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease);
- }
-
- public void ChapPlus(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease);
- }
-
- public void Stop(bool pressRelease)
- {
- IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
- }
-
- public void Record(bool pressRelease)
- {
- }
-
- #endregion
- }
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+using Crestron.SimplSharpPro;
+
+using PepperDash.Core;
+using PepperDash.Essentials.Core;
+using PepperDash.Essentials.Core.Routing;
+
+namespace PepperDash.Essentials.Devices.Common
+{
+ public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
+ {
+ public IrOutputPortController IrPort { get; private set; }
+
+ public uint DisplayUiType { get { return DisplayUiConstants.TypeBluray; } }
+
+ public IRBlurayBase(string key, string name, IrOutputPortController portCont)
+ : base(key, name)
+ {
+ IrPort = portCont;
+ DeviceManager.AddDevice(portCont);
+
+ HasKeypadAccessoryButton1 = true;
+ KeypadAccessoryButton1Command = "Clear";
+ KeypadAccessoryButton1Label = "Clear";
+
+ HasKeypadAccessoryButton2 = true;
+ KeypadAccessoryButton2Command = "NumericEnter";
+ KeypadAccessoryButton2Label = "Enter";
+
+ PowerIsOnFeedback = new BoolFeedback(() => _PowerIsOn);
+
+ HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.AudioVideo,
+ eRoutingPortConnectionType.Hdmi, null, this);
+ AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
+ eRoutingPortConnectionType.DigitalAudio, null, this);
+ OutputPorts = new RoutingPortCollection { HdmiOut, AnyAudioOut };
+ }
+
+
+ #region IDPad Members
+
+ public void Up(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_UP_ARROW, pressRelease);
+ }
+
+ public void Down(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_DN_ARROW, pressRelease);
+ }
+
+ public void Left(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_LEFT_ARROW, pressRelease);
+ }
+
+ public void Right(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_RIGHT_ARROW, pressRelease);
+ }
+
+ public void Select(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease);
+ }
+
+ public void Menu(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_MENU, pressRelease);
+ }
+
+ public void Exit(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_EXIT, pressRelease);
+ }
+
+ #endregion
+
+ #region INumericKeypad Members
+
+ public void Digit0(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_0, pressRelease);
+ }
+
+ public void Digit1(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_1, pressRelease);
+ }
+
+ public void Digit2(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_2, pressRelease);
+ }
+
+ public void Digit3(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_3, pressRelease);
+ }
+
+ public void Digit4(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_4, pressRelease);
+ }
+
+ public void Digit5(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_5, pressRelease);
+ }
+
+ public void Digit6(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_6, pressRelease);
+ }
+
+ public void Digit7(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_7, pressRelease);
+ }
+
+ public void Digit8(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_8, pressRelease);
+ }
+
+ public void Digit9(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_9, pressRelease);
+ }
+
+ ///
+ /// Defaults to true
+ ///
+ public bool HasKeypadAccessoryButton1 { get; set; }
+
+ ///
+ /// Defaults to "-"
+ ///
+ public string KeypadAccessoryButton1Label { get; set; }
+
+
+ ///
+ /// Defaults to "Dash"
+ ///
+ public string KeypadAccessoryButton1Command { get; set; }
+
+ public void KeypadAccessoryButton1(bool pressRelease)
+ {
+ IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
+ }
+
+ ///
+ /// Defaults to true
+ ///
+ public bool HasKeypadAccessoryButton2 { get; set; }
+
+ ///
+ /// Defaults to "Enter"
+ ///
+ public string KeypadAccessoryButton2Label { get; set; }
+
+
+ ///
+ /// Defaults to "Enter"
+ ///
+ public string KeypadAccessoryButton2Command { get; set; }
+
+ public void KeypadAccessoryButton2(bool pressRelease)
+ {
+ IrPort.PressRelease(KeypadAccessoryButton2Command, pressRelease);
+ }
+
+ #endregion
+
+ #region IChannelFunctions Members
+
+ public void ChannelUp(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, pressRelease);
+ }
+
+ public void ChannelDown(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_CH_MINUS, pressRelease);
+ }
+
+ public void LastChannel(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_LAST, pressRelease);
+ }
+
+ public void Guide(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_GUIDE, pressRelease);
+ }
+
+ public void Info(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_INFO, pressRelease);
+ }
+
+ #endregion
+
+ #region IColorFunctions Members
+
+ public void Red(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_RED, pressRelease);
+ }
+
+ public void Green(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_GREEN, pressRelease);
+ }
+
+ public void Yellow(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_YELLOW, pressRelease);
+ }
+
+ public void Blue(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_BLUE, pressRelease);
+ }
+
+ #endregion
+
+ #region IRoutingOutputs Members
+
+ public RoutingOutputPort HdmiOut { get; private set; }
+ public RoutingOutputPort AnyAudioOut { get; private set; }
+ public RoutingPortCollection OutputPorts { get; private set; }
+
+ #endregion
+
+ #region IPower Members
+
+ public void PowerOn()
+ {
+ IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, 200);
+ _PowerIsOn = true;
+ }
+
+ public void PowerOff()
+ {
+ IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, 200);
+ _PowerIsOn = false;
+ }
+
+ public void PowerToggle()
+ {
+ IrPort.Pulse(IROutputStandardCommands.IROut_POWER, 200);
+ _PowerIsOn = false;
+ }
+
+ public BoolFeedback PowerIsOnFeedback { get; set; }
+ bool _PowerIsOn;
+
+ #endregion
+
+ #region ITransport Members
+
+ public void Play(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_PLAY, pressRelease);
+ }
+
+ public void Pause(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_PAUSE, pressRelease);
+ }
+
+ public void Rewind(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_RSCAN, pressRelease);
+ }
+
+ public void FFwd(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_FSCAN, pressRelease);
+ }
+
+ public void ChapMinus(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease);
+ }
+
+ public void ChapPlus(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease);
+ }
+
+ public void Stop(bool pressRelease)
+ {
+ IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
+ }
+
+ public void Record(bool pressRelease)
+ {
+ }
+
+ #endregion
+
+ #region IUsageTracking Members
+
+ public UsageTracking UsageTracker { get; set; }
+
+ #endregion
+ }
}
\ No newline at end of file
diff --git a/Essentials Devices Common/Essentials Devices Common/PC/InRoomPc.cs b/Essentials Devices Common/Essentials Devices Common/PC/InRoomPc.cs
index ee43356b..cc8c5121 100644
--- a/Essentials Devices Common/Essentials Devices Common/PC/InRoomPc.cs
+++ b/Essentials Devices Common/Essentials Devices Common/PC/InRoomPc.cs
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Devices.Common
///
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
///
- public class InRoomPc : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo
+ public class InRoomPc : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
{
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
public string IconName { get; set; }
@@ -50,6 +50,12 @@ namespace PepperDash.Essentials.Devices.Common
get { return this.GetVideoStatuses().ToList(); }
}
- #endregion
+ #endregion
+
+ #region IUsageTracking Members
+
+ public UsageTracking UsageTracker { get; set; }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Essentials Devices Common/Essentials Devices Common/PC/Laptop.cs b/Essentials Devices Common/Essentials Devices Common/PC/Laptop.cs
index 3d6f2834..e8a67705 100644
--- a/Essentials Devices Common/Essentials Devices Common/PC/Laptop.cs
+++ b/Essentials Devices Common/Essentials Devices Common/PC/Laptop.cs
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Devices.Common
///
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
///
- public class Laptop : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo
+ public class Laptop : Device, IHasFeedback, IRoutingOutputs, IAttachVideoStatus, IUiDisplayInfo, IUsageTracking
{
public uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
public string IconName { get; set; }
@@ -50,6 +50,12 @@ namespace PepperDash.Essentials.Devices.Common
get { return this.GetVideoStatuses().ToList(); }
}
- #endregion
+ #endregion
+
+ #region IUsageTracking Members
+
+ public UsageTracking UsageTracker { get; set; }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs b/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs
index a5e730c1..671272f5 100644
--- a/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs
+++ b/Essentials Devices Common/Essentials Devices Common/SetTopBox/IRSetTopBoxBase.cs
@@ -12,7 +12,7 @@ using PepperDash.Essentials.Core.Routing;
namespace PepperDash.Essentials.Devices.Common
{
- public class IRSetTopBoxBase : Device, ISetTopBoxControls, IUiDisplayInfo, IRoutingOutputs
+ public class IRSetTopBoxBase : Device, ISetTopBoxControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
{
public IrOutputPortController IrPort { get; private set; }
@@ -332,6 +332,12 @@ namespace PepperDash.Essentials.Devices.Common
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
}
- #endregion
+ #endregion
+
+ #region IUsageTracking Members
+
+ public UsageTracking UsageTracker { get; set; }
+
+ #endregion
}
}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/Config/ConfigReader.cs b/Essentials/PepperDashEssentials/Config/ConfigReader.cs
index 3d89bbaa..812d288b 100644
--- a/Essentials/PepperDashEssentials/Config/ConfigReader.cs
+++ b/Essentials/PepperDashEssentials/Config/ConfigReader.cs
@@ -152,5 +152,11 @@ namespace PepperDash.Essentials
return o1;
}
+ public static string GetGroupForDeviceKey(string key)
+ {
+ var dev = ConfigObject.Devices.FirstOrDefault(d => d.Key.Equals(key, StringComparison.OrdinalIgnoreCase));
+ return dev == null ? null : dev.Group;
+ }
+
}
}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/ControlSystem.cs b/Essentials/PepperDashEssentials/ControlSystem.cs
index febcaa1b..1c16c428 100644
--- a/Essentials/PepperDashEssentials/ControlSystem.cs
+++ b/Essentials/PepperDashEssentials/ControlSystem.cs
@@ -29,8 +29,8 @@ namespace PepperDash.Essentials
///
public override void InitializeSystem()
{
- //CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
- // ConsoleAccessLevelEnum.AccessOperator);
+ CrestronConsole.AddNewConsoleCommand(s => GoWithLoad(), "go", "Reloads configuration file",
+ ConsoleAccessLevelEnum.AccessOperator);
//CrestronConsole.AddNewConsoleCommand(s => TearDown(), "ungo", "Reloads configuration file",
// ConsoleAccessLevelEnum.AccessOperator);
CrestronConsole.AddNewConsoleCommand(s =>
@@ -40,7 +40,7 @@ namespace PepperDash.Essentials
},
"listtielines", "Prints out all tie lines", ConsoleAccessLevelEnum.AccessOperator);
- GoWithLoad();
+ //GoWithLoad();
}
///
@@ -62,11 +62,6 @@ namespace PepperDash.Essentials
LoadDevices();
LoadTieLines();
LoadRooms();
- // FUSION - should go per room I believe. See CreateSystems in original Configuration.cs
- // ???
-
- //Temp Cotija testing
- //CotijaSystemController CotijaInterface = new CotijaSystemController("WebClient1");
DeviceManager.ActivateAll();
Debug.Console(0, "Essentials load complete\r" +
@@ -192,8 +187,6 @@ namespace PepperDash.Essentials
DeviceManager.AddDevice(room);
}
-#warning Add Fusion connector to room factory?
-
}
else
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
diff --git a/Essentials/PepperDashEssentials/Fusion/FusionRviDataClasses.cs b/Essentials/PepperDashEssentials/Fusion/FusionRviDataClasses.cs
new file mode 100644
index 00000000..c1ad5078
--- /dev/null
+++ b/Essentials/PepperDashEssentials/Fusion/FusionRviDataClasses.cs
@@ -0,0 +1,399 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using Crestron.SimplSharp;
+
+namespace PepperDash.Essentials.Fusion
+{
+ // Helper Classes for GUIDs
+
+ ///
+ /// Stores GUIDs to be written to a file in NVRAM
+ ///
+ public class FusionRoomGuids
+ {
+ public string RoomName { get; set; }
+ public uint IpId { get; set; }
+ public string RoomGuid { get; set; }
+ public List StaticAssets { get; set; }
+
+ public FusionRoomGuids()
+ {
+ StaticAssets = new List();
+ }
+
+ public FusionRoomGuids(string roomName, uint ipId, string roomGuid, List staticAssets)
+ {
+ RoomName = roomName;
+ IpId = ipId;
+ RoomGuid = roomGuid;
+
+ StaticAssets = new List(staticAssets);
+ }
+ }
+
+ public class FusionAsset
+ {
+ public uint Number { get; set; }
+ public string Name { get; set; }
+ public string Type { get; set; }
+ public string InstanceID { get; set; }
+
+ public FusionAsset()
+ {
+
+ }
+
+ public FusionAsset(uint slotNum, string assetName, string type, string instanceID)
+ {
+ Number = slotNum;
+ Name = assetName;
+ Type = type;
+ if (string.IsNullOrEmpty(instanceID))
+ {
+ InstanceID = Guid.NewGuid().ToString();
+ }
+ else
+ {
+ InstanceID = instanceID;
+ }
+ }
+ }
+
+ //***************************************************************************************************
+
+ public class RoomSchedule
+ {
+ public List Meetings { get; set; }
+
+ public RoomSchedule()
+ {
+ Meetings = new List();
+ }
+ }
+
+ //****************************************************************************************************
+ // Helper Classes for XML API
+
+ ///
+ /// Data needed to request the local time from the Fusion server
+ ///
+ public class LocalTimeRequest
+ {
+ public string RequestID { get; set; }
+ }
+
+ ///
+ /// All the data needed for a full schedule request in a room
+ ///
+ /// //[XmlRoot(ElementName = "RequestSchedule")]
+ public class RequestSchedule
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "RoomID")]
+ public string RoomID { get; set; }
+ //[XmlElement(ElementName = "Start")]
+ public DateTime Start { get; set; }
+ //[XmlElement(ElementName = "HourSpan")]
+ public double HourSpan { get; set; }
+
+ public RequestSchedule(string requestID, string roomID)
+ {
+ RequestID = requestID;
+ RoomID = roomID;
+ Start = DateTime.Now;
+ HourSpan = 24;
+ }
+ }
+
+
+ //[XmlRoot(ElementName = "RequestAction")]
+ public class RequestAction
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "RoomID")]
+ public string RoomID { get; set; }
+ //[XmlElement(ElementName = "ActionID")]
+ public string ActionID { get; set; }
+ //[XmlElement(ElementName = "Parameters")]
+ public List Parameters { get; set; }
+
+ public RequestAction(string roomID, string actionID, List parameters)
+ {
+ RoomID = roomID;
+ ActionID = actionID;
+ Parameters = parameters;
+ }
+ }
+
+ //[XmlRoot(ElementName = "ActionResponse")]
+ public class ActionResponse
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "ActionID")]
+ public string ActionID { get; set; }
+ //[XmlElement(ElementName = "Parameters")]
+ public List Parameters { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "Parameter")]
+ public class Parameter
+ {
+ //[XmlAttribute(AttributeName = "ID")]
+ public string ID { get; set; }
+ //[XmlAttribute(AttributeName = "Value")]
+ public string Value { get; set; }
+ }
+
+ ////[XmlRoot(ElementName = "Parameters")]
+ //public class Parameters
+ //{
+ // //[XmlElement(ElementName = "Parameter")]
+ // public List Parameter { get; set; }
+ //}
+
+ ///
+ /// Data structure for a ScheduleResponse from Fusion
+ ///
+ /// //[XmlRoot(ElementName = "ScheduleResponse")]
+ public class ScheduleResponse
+ {
+ //[XmlElement(ElementName = "RequestID")]
+ public string RequestID { get; set; }
+ //[XmlElement(ElementName = "RoomID")]
+ public string RoomID { get; set; }
+ //[XmlElement(ElementName = "RoomName")]
+ public string RoomName { get; set; }
+ //[XmlElement("Event")]
+ public List Events { get; set; }
+
+ public ScheduleResponse()
+ {
+ Events = new List();
+ }
+ }
+
+ //[XmlRoot(ElementName = "Event")]
+ public class Event
+ {
+ //[XmlElement(ElementName = "MeetingID")]
+ public string MeetingID { get; set; }
+ //[XmlElement(ElementName = "RVMeetingID")]
+ public string RVMeetingID { get; set; }
+ //[XmlElement(ElementName = "Recurring")]
+ public string Recurring { get; set; }
+ //[XmlElement(ElementName = "InstanceID")]
+ public string InstanceID { get; set; }
+ //[XmlElement(ElementName = "dtStart")]
+ public DateTime dtStart { get; set; }
+ //[XmlElement(ElementName = "dtEnd")]
+ public DateTime dtEnd { get; set; }
+ //[XmlElement(ElementName = "Organizer")]
+ public string Organizer { get; set; }
+ //[XmlElement(ElementName = "Attendees")]
+ public Attendees Attendees { get; set; }
+ //[XmlElement(ElementName = "Resources")]
+ public Resources Resources { get; set; }
+ //[XmlElement(ElementName = "IsEvent")]
+ public string IsEvent { get; set; }
+ //[XmlElement(ElementName = "IsRoomViewMeeting")]
+ public string IsRoomViewMeeting { get; set; }
+ //[XmlElement(ElementName = "IsPrivate")]
+ public string IsPrivate { get; set; }
+ //[XmlElement(ElementName = "IsExchangePrivate")]
+ public string IsExchangePrivate { get; set; }
+ //[XmlElement(ElementName = "MeetingTypes")]
+ public MeetingTypes MeetingTypes { get; set; }
+ //[XmlElement(ElementName = "ParticipantCode")]
+ public string ParticipantCode { get; set; }
+ //[XmlElement(ElementName = "PhoneNo")]
+ public string PhoneNo { get; set; }
+ //[XmlElement(ElementName = "WelcomeMsg")]
+ public string WelcomeMsg { get; set; }
+ //[XmlElement(ElementName = "Subject")]
+ public string Subject { get; set; }
+ //[XmlElement(ElementName = "LiveMeeting")]
+ public LiveMeeting LiveMeeting { get; set; }
+ //[XmlElement(ElementName = "ShareDocPath")]
+ public string ShareDocPath { get; set; }
+ //[XmlElement(ElementName = "HaveAttendees")]
+ public string HaveAttendees { get; set; }
+ //[XmlElement(ElementName = "HaveResources")]
+ public string HaveResources { get; set; }
+
+ ///
+ /// Gets the duration of the meeting
+ ///
+ public string DurationInMinutes
+ {
+ get
+ {
+ string duration;
+
+ var timeSpan = dtEnd.Subtract(dtStart);
+ int hours = timeSpan.Hours;
+ double minutes = timeSpan.Minutes;
+ double roundedMinutes = Math.Round(minutes);
+ if (hours > 0)
+ {
+ duration = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
+ }
+ else
+ {
+ duration = string.Format("{0} minutes", roundedMinutes);
+ }
+
+ return duration;
+ }
+ }
+
+ ///
+ /// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
+ ///
+ public string RemainingTime
+ {
+ get
+ {
+ var now = DateTime.Now;
+
+ string remainingTime;
+
+ if (GetInProgress())
+ {
+ var timeSpan = dtEnd.Subtract(now);
+ int hours = timeSpan.Hours;
+ double minutes = timeSpan.Minutes;
+ double roundedMinutes = Math.Round(minutes);
+ if (hours > 0)
+ {
+ remainingTime = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
+ }
+ else
+ {
+ remainingTime = string.Format("{0} minutes", roundedMinutes);
+ }
+
+ return remainingTime;
+ }
+ else
+ return null;
+ }
+
+ }
+
+ ///
+ /// Indicates that the meeting is in progress
+ ///
+ public bool isInProgress
+ {
+ get
+ {
+ return GetInProgress();
+ }
+ }
+
+ ///
+ /// Determines if the meeting is in progress
+ ///
+ /// Returns true if in progress
+ bool GetInProgress()
+ {
+ var now = DateTime.Now;
+
+ if (now > dtStart && now < dtEnd)
+ {
+ return true;
+ }
+ else
+ return false;
+ }
+ }
+
+ //[XmlRoot(ElementName = "Resources")]
+ public class Resources
+ {
+ //[XmlElement(ElementName = "Rooms")]
+ public Rooms Rooms { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "Rooms")]
+ public class Rooms
+ {
+ //[XmlElement(ElementName = "Room")]
+ public List Room { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "Room")]
+ public class Room
+ {
+ //[XmlElement(ElementName = "Name")]
+ public string Name { get; set; }
+ //[XmlElement(ElementName = "ID")]
+ public string ID { get; set; }
+ //[XmlElement(ElementName = "MPType")]
+ public string MPType { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "Attendees")]
+ public class Attendees
+ {
+ //[XmlElement(ElementName = "Required")]
+ public Required Required { get; set; }
+ //[XmlElement(ElementName = "Optional")]
+ public Optional Optional { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "Required")]
+ public class Required
+ {
+ //[XmlElement(ElementName = "Attendee")]
+ public List Attendee { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "Optional")]
+ public class Optional
+ {
+ //[XmlElement(ElementName = "Attendee")]
+ public List Attendee { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "MeetingType")]
+ public class MeetingType
+ {
+ //[XmlAttribute(AttributeName = "ID")]
+ public string ID { get; set; }
+ //[XmlAttribute(AttributeName = "Value")]
+ public string Value { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "MeetingTypes")]
+ public class MeetingTypes
+ {
+ //[XmlElement(ElementName = "MeetingType")]
+ public List MeetingType { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "LiveMeeting")]
+ public class LiveMeeting
+ {
+ //[XmlElement(ElementName = "URL")]
+ public string URL { get; set; }
+ //[XmlElement(ElementName = "ID")]
+ public string ID { get; set; }
+ //[XmlElement(ElementName = "Key")]
+ public string Key { get; set; }
+ //[XmlElement(ElementName = "Subject")]
+ public string Subject { get; set; }
+ }
+
+ //[XmlRoot(ElementName = "LiveMeetingURL")]
+ public class LiveMeetingURL
+ {
+ //[XmlElement(ElementName = "LiveMeeting")]
+ public LiveMeeting LiveMeeting { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/Fusion/FusionSystemController.cs b/Essentials/PepperDashEssentials/Fusion/FusionSystemController.cs
index 1b794f77..9c871c07 100644
--- a/Essentials/PepperDashEssentials/Fusion/FusionSystemController.cs
+++ b/Essentials/PepperDashEssentials/Fusion/FusionSystemController.cs
@@ -14,10 +14,9 @@ using Crestron.SimplSharpPro.Fusion;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
-using PepperDash.Essentials.Core;
-
using PepperDash.Core;
using PepperDash.Essentials;
+using PepperDash.Essentials.Core;
using PepperDash.Essentials.Devices.Common;
@@ -35,10 +34,27 @@ namespace PepperDash.Essentials.Fusion
Dictionary SourceToFeedbackSigs =
new Dictionary();
+ BooleanSigData OccupancyStatusSig;
+
StatusMonitorCollection ErrorMessageRollUp;
StringSigData SourceNameSig;
+ //ProcessorEthernet Info
+#region
+ StringSigData Ip1;
+ StringSigData Ip2;
+ StringSigData Gateway;
+ StringSigData Hostname;
+ StringSigData Domain;
+ StringSigData Dns1;
+ StringSigData Dns2;
+ StringSigData Mac1;
+ StringSigData Mac2;
+ StringSigData NetMask1;
+ StringSigData NetMask2;
+#endregion
+
RoomSchedule CurrentSchedule;
Event NextMeeting;
@@ -71,7 +87,7 @@ namespace PepperDash.Essentials.Fusion
public long PushNotificationTimeout = 5000;
- List StaticAssets;
+ List FusionAssets;
//ScheduleResponseEvent NextMeeting;
@@ -83,7 +99,7 @@ namespace PepperDash.Essentials.Fusion
IpId = ipId;
- StaticAssets = new List();
+ FusionAssets = new List();
GUIDs = new FusionRoomGuids();
@@ -113,33 +129,34 @@ namespace PepperDash.Essentials.Fusion
SetUpCommunitcationMonitors();
SetUpDisplay();
SetUpError();
-
+ SetUpOccupancy();
+
// test assets --- THESE ARE BOTH WIRED TO AssetUsage somewhere internally.
- var tempAsset1 = new StaticAsset();
- var tempAsset2 = new StaticAsset();
+ //var tempAsset1 = new StaticAsset();
+ //var tempAsset2 = new StaticAsset();
- //Check for existing GUID
- if (GuidFileExists)
- {
- tempAsset1 = StaticAssets.FirstOrDefault(a => a.Number.Equals(1));
+ ////Check for existing GUID
+ //if (GuidFileExists)
+ //{
+ // tempAsset1 = StaticAssets.FirstOrDefault(a => a.Number.Equals(1));
- tempAsset2 = StaticAssets.FirstOrDefault(a => a.Number.Equals(2));
- }
- else
- {
- tempAsset1 = new StaticAsset(1, "Test Asset 1", "Test Asset 1", "");
- StaticAssets.Add(tempAsset1);
+ // tempAsset2 = StaticAssets.FirstOrDefault(a => a.Number.Equals(2));
+ //}
+ //else
+ //{
+ // tempAsset1 = new StaticAsset(1, "Test Asset 1", "Test Asset 1", "");
+ // StaticAssets.Add(tempAsset1);
- tempAsset2 = new StaticAsset(2, "Test Asset 2", "Test Asset 2", "");
- StaticAssets.Add(tempAsset2);
- }
+ // tempAsset2 = new StaticAsset(2, "Test Asset 2", "Test Asset 2", "");
+ // StaticAssets.Add(tempAsset2);
+ //}
- var ta1 = FusionRoom.CreateStaticAsset(tempAsset1.Number, tempAsset1.Name, tempAsset1.Type, tempAsset1.InstanceID);
- ta1.AssetError.InputSig.StringValue = "This should be error";
+ //var ta1 = FusionRoom.CreateStaticAsset(tempAsset1.Number, tempAsset1.Name, tempAsset1.Type, tempAsset1.InstanceID);
+ //ta1.AssetError.InputSig.StringValue = "This should be error";
- var ta2 = FusionRoom.CreateStaticAsset(tempAsset2.Number, tempAsset2.Name, tempAsset2.Type, tempAsset2.InstanceID);
- ta2.AssetUsage.InputSig.StringValue = "This should be usage";
+ //var ta2 = FusionRoom.CreateStaticAsset(tempAsset2.Number, tempAsset2.Name, tempAsset2.Type, tempAsset2.InstanceID);
+ //ta2.AssetUsage.InputSig.StringValue = "This should be usage";
// Make it so!
FusionRVI.GenerateFileForAllFusionDevices();
@@ -170,7 +187,7 @@ namespace PepperDash.Essentials.Fusion
Debug.Console(1, this, "Writing GUIDs to file");
- GUIDs = new FusionRoomGuids(Room.Name, IpId, RoomGuid, StaticAssets);
+ GUIDs = new FusionRoomGuids(Room.Name, IpId, RoomGuid, FusionAssets);
var JSON = JsonConvert.SerializeObject(GUIDs, Newtonsoft.Json.Formatting.Indented);
@@ -223,7 +240,7 @@ namespace PepperDash.Essentials.Fusion
IpId = GUIDs.IpId;
- StaticAssets = GUIDs.StaticAssets;
+ FusionAssets = GUIDs.StaticAssets;
}
@@ -231,7 +248,7 @@ namespace PepperDash.Essentials.Fusion
Debug.Console(1, this, "\nRoom Name: {0}\nIPID: {1:x}\n RoomGuid: {2}", Room.Name, IpId, RoomGuid);
- foreach (StaticAsset asset in StaticAssets)
+ foreach (FusionAsset asset in FusionAssets)
{
Debug.Console(1, this, "\nAsset Name: {0}\nAsset No: {1}\n Guid: {2}", asset.Name, asset.Number, asset.InstanceID);
}
@@ -270,7 +287,7 @@ namespace PepperDash.Essentials.Fusion
// Room to fusion room
Room.OnFeedback.LinkInputSig(FusionRoom.SystemPowerOn.InputSig);
- SourceNameSig = FusionRoom.CreateOffsetStringSig(50, "Source - Name", eSigIoMask.InputSigOnly);
+ SourceNameSig = FusionRoom.CreateOffsetStringSig(84, "Source - Name", eSigIoMask.InputSigOnly);
// Don't think we need to get current status of this as nothing should be alive yet.
Room.CurrentSingleSourceChange += new SourceInfoChangeHandler(Room_CurrentSourceInfoChange);
@@ -281,8 +298,55 @@ namespace PepperDash.Essentials.Fusion
FusionRoom.ErrorMessage.InputSig.StringValue =
"3: 7 Errors: This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;This is a really long error message;";
+ // Processor Info
- }
+ FusionRoom.CreateOffsetStringSig(50, "Info - Processor - System Name", eSigIoMask.InputSigOnly);
+ FusionRoom.CreateOffsetStringSig(51, "Info - Processor - Model", eSigIoMask.InputSigOnly);
+ FusionRoom.CreateOffsetStringSig(52, "Info - Processor - Serial Number", eSigIoMask.InputSigOnly);
+ FusionRoom.CreateOffsetStringSig(53, "Info - Processor - Uptime", eSigIoMask.InputSigOnly);
+ Ip1 = FusionRoom.CreateOffsetStringSig(54, "Info - Processor - IP 1", eSigIoMask.InputSigOnly);
+ Ip2 = FusionRoom.CreateOffsetStringSig(55, "Info - Processor - IP 2", eSigIoMask.InputSigOnly);
+ Gateway = FusionRoom.CreateOffsetStringSig(56, "Info - Processor - Gateway", eSigIoMask.InputSigOnly);
+ Hostname = FusionRoom.CreateOffsetStringSig(57, "Info - Processor - Hostname", eSigIoMask.InputSigOnly);
+ Domain = FusionRoom.CreateOffsetStringSig(58, "Info - Processor - Domain", eSigIoMask.InputSigOnly);
+ Dns1 = FusionRoom.CreateOffsetStringSig(59, "Info - Processor - DNS 1", eSigIoMask.InputSigOnly);
+ Dns2 = FusionRoom.CreateOffsetStringSig(60, "Info - Processor - DNS 2", eSigIoMask.InputSigOnly);
+ Mac1 = FusionRoom.CreateOffsetStringSig(61, "Info - Processor - MAC 1", eSigIoMask.InputSigOnly);
+ Mac2 = FusionRoom.CreateOffsetStringSig(62, "Info - Processor - MAC 2", eSigIoMask.InputSigOnly);
+ NetMask1 = FusionRoom.CreateOffsetStringSig(63, "Info - Processor - Net Mask 1", eSigIoMask.InputSigOnly);
+ NetMask2 = FusionRoom.CreateOffsetStringSig(64, "Info - Processor - Net Mask 2", eSigIoMask.InputSigOnly);
+
+ SetProcessorEthernetValues();
+
+ CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
+ }
+
+ void CrestronEnvironment_EthernetEventHandler(EthernetEventArgs ethernetEventArgs)
+ {
+ if (ethernetEventArgs.EthernetEventType == eEthernetEventType.LinkUp)
+ {
+ SetProcessorEthernetValues();
+ }
+ }
+
+ void SetProcessorEthernetValues()
+ {
+ Ip1.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 0);
+ Ip2.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_ADDRESS, 1);
+ Gateway.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_ROUTER, 0);
+ Hostname.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_HOSTNAME, 0);
+ Domain.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DOMAIN_NAME, 0);
+
+ var dnsServers = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_DNS_SERVER, 0).Split(',');
+ Dns1.InputSig.StringValue = dnsServers[0];
+ if (dnsServers.Length > 1)
+ Dns2.InputSig.StringValue = dnsServers[1];
+
+ Mac1.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, 0);
+ Mac2.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_MAC_ADDRESS, 1);
+ NetMask1.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, 0);
+ NetMask2.InputSig.StringValue = CrestronEthernetHelper.GetEthernetParameter(CrestronEthernetHelper.ETHERNET_PARAMETER_TO_GET.GET_CURRENT_IP_MASK, 1);
+ }
void FusionRoom_OnlineStatusChange(GenericBase currentDevice, OnlineOfflineEventArgs args)
{
@@ -306,7 +370,6 @@ namespace PepperDash.Essentials.Fusion
"\n" +
"\n" +
"\n" +
- //"\n" +
"\n" +
"\n" +
"\n" +
@@ -324,6 +387,15 @@ namespace PepperDash.Essentials.Fusion
Debug.Console(2, this, "Sending Fusion ActionRequest: \n{0}", actionRequest);
FusionRoom.ExtenderFusionRoomDataReservedSigs.ActionQuery.StringValue = actionRequest;
+
+
+ // Request current Fusion Server Time
+
+ string timeRequestID = "TimeRequest";
+
+ string timeRequest = string.Format("{0}", timeRequestID);
+
+ FusionRoom.ExtenderFusionRoomDataReservedSigs.LocalDateTimeQuery.StringValue = timeRequest;
}
}
@@ -480,20 +552,6 @@ namespace PepperDash.Essentials.Fusion
{
try
{
- //ActionResponse actionResponse = new ActionResponse();
-
- //TextReader reader = new StringReader(args.Sig.StringValue);
-
- //actionResponse = CrestronXMLSerialization.DeSerializeObject(reader);
-
- //if (actionResponse != null)
- //{
- // if (actionResponse.RequestID == "InitialPushRequest")
- // {
- // if (actionResponse.Parameters != null)
- // {
- // var tempParam = actionResponse.Parameters.FirstOrDefault(p => p.ID.Equals("Registered"));
-
XmlDocument message = new XmlDocument();
message.LoadXml(args.Sig.StringValue);
@@ -560,6 +618,40 @@ namespace PepperDash.Essentials.Fusion
Debug.Console(1, this, "Error parsing ActionQueryResponse: {0}", e);
}
}
+ else if (args.Sig == FusionRoom.ExtenderFusionRoomDataReservedSigs.LocalDateTimeQueryResponse)
+ {
+ try
+ {
+ XmlDocument message = new XmlDocument();
+
+ message.LoadXml(args.Sig.StringValue);
+
+ var localDateTimeResponse = message["LocalTimeResponse"];
+
+ if (localDateTimeResponse != null)
+ {
+ var localDateTime = localDateTimeResponse["LocalDateTime"];
+
+ if (localDateTime != null)
+ {
+ var tempLocalDateTime = localDateTime.InnerText;
+
+ DateTime currentTime = DateTime.Parse(tempLocalDateTime);
+
+ Debug.Console(1, this, "DateTime from Fusion Server: {0}", currentTime);
+
+ // Parse time and date from response and insert values
+ CrestronEnvironment.SetTimeAndDate((ushort)currentTime.Hour, (ushort)currentTime.Minute, (ushort)currentTime.Second, (ushort)currentTime.Month, (ushort)currentTime.Day, (ushort)currentTime.Year);
+
+ Debug.Console(1, this, "Processor time set to {0}", CrestronEnvironment.GetLocalTime());
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ Debug.Console(1, this, "Error parsing LocalDateTimeQueryResponse: {0}", e);
+ }
+ }
}
///
@@ -726,6 +818,18 @@ namespace PepperDash.Essentials.Fusion
break;
}
+
+ foreach (var kvp in dict)
+ {
+ var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
+
+ if (usageDevice != null)
+ {
+ usageDevice.UsageTracker = new UsageTracking();
+ usageDevice.UsageTracker.UsageIsTracked = true;
+ usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler(UsageTracker_DeviceUsageEnded);
+ }
+ }
}
else
@@ -735,6 +839,35 @@ namespace PepperDash.Essentials.Fusion
}
}
+
+ ///
+ /// Collects usage data from source and sends to Fusion
+ ///
+ ///
+ ///
+ void UsageTracker_DeviceUsageEnded(object sender, DeviceUsageEventArgs e)
+ {
+ var device = sender as Device;
+
+ var configDevice = ConfigReader.ConfigObject.Devices.Where(d => d.Key.Equals(device.Key));
+
+ string group = ConfigReader.GetGroupForDeviceKey(device.Key);
+
+ string currentMeetingId = "";
+
+ if (CurrentMeeting != null)
+ currentMeetingId = CurrentMeeting.MeetingID;
+
+ //String Format: "USAGE||[Date YYYY-MM-DD]||[Time HH-mm-ss]||TIME||[Asset_Type]||[Asset_Name]||[Minutes_used]||[Asset_ID]||[Meeting_ID]"
+ // [Asset_ID] property does not appear to be used in Crestron SSI examples. They are sending "-" instead so that's what is replicated here
+ string deviceUsage = string.Format("USAGE||{0}||{1}||TIME||{2}||{3}||{4}||{5}||{6})", e.UsageEndTime.ToString("YYYY-MM-DD"), e.UsageEndTime.ToString("HH-mm-ss"),
+ group, device.Name, e.MinutesUsed, "-", currentMeetingId);
+
+
+ FusionRoom.DeviceUsage.InputSig.StringValue = deviceUsage;
+ }
+
+
void TryAddRouteActionSigs(string attrName, uint attrNum, string routeKey, Device pSrc)
{
Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
@@ -777,22 +910,35 @@ namespace PepperDash.Essentials.Fusion
string attrName = null;
uint attrNum = Convert.ToUInt32(keyNum);
- //if (dev is SmartGraphicsTouchpanelControllerBase)
- //{
- // if (attrNum > 10)
- // continue;
- // attrName = "Device Ok - Touch Panel " + attrNum;
- // attrNum += 200;
- //}
- //// add xpanel here
+
+
+ if (dev is BasicTriListWithSmartObject)
+ {
+ if (attrNum > 10)
+ continue;
+ attrName = "Online - Touch Panel " + attrNum;
+ attrNum += 200;
+#warning should this be 150
+ }
+ // add xpanel here
+
+ if (dev is Crestron.SimplSharpPro.UI.XpanelForSmartGraphics)
+ {
+ if (attrNum > 10)
+ continue;
+ attrName = "Online - Touch Panel " + attrNum;
+ attrNum += 160;
+#warning should this be 160
+ }
//else
if (dev is DisplayBase)
{
if (attrNum > 10)
continue;
- attrName = "Device Ok - Display " + attrNum;
+ attrName = "Online - Display " + attrNum;
attrNum += 240;
+#warning should this be 170
}
//else if (dev is DvdDeviceBase)
//{
@@ -822,42 +968,61 @@ namespace PepperDash.Essentials.Fusion
void SetUpDisplay()
{
- var display = Room.DefaultDisplay as DisplayBase;
- if (display == null)
+ //Setup Display Usage Monitoring
+
+ var displays = DeviceManager.AllDevices.Where(d => d is DisplayBase);
+
+#warning should work for now in single room systems but will grab all devices regardless of room assignment. In multi-room systems, this will need to be handled differently.
+
+ foreach (DisplayBase display in displays)
+ {
+ display.UsageTracker = new UsageTracking();
+ display.UsageTracker.UsageIsTracked = true;
+ display.UsageTracker.DeviceUsageEnded += new EventHandler(UsageTracker_DeviceUsageEnded);
+ }
+
+ var defaultDisplay = Room.DefaultDisplay as DisplayBase;
+ if (defaultDisplay == null)
{
Debug.Console(1, this, "Cannot link null display to Fusion");
return;
}
- var dispPowerOnAction = new Action(b => { if (!b) display.PowerOn(); });
- var dispPowerOffAction = new Action(b => { if (!b) display.PowerOff(); });
+ var dispPowerOnAction = new Action(b => { if (!b) defaultDisplay.PowerOn(); });
+ var dispPowerOffAction = new Action(b => { if (!b) defaultDisplay.PowerOff(); });
// Display to fusion room sigs
FusionRoom.DisplayPowerOn.OutputSig.UserObject = dispPowerOnAction;
FusionRoom.DisplayPowerOff.OutputSig.UserObject = dispPowerOffAction;
- display.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
- if (display is IDisplayUsage)
- (display as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
+ defaultDisplay.PowerIsOnFeedback.LinkInputSig(FusionRoom.DisplayPowerOn.InputSig);
+ if (defaultDisplay is IDisplayUsage)
+ (defaultDisplay as IDisplayUsage).LampHours.LinkInputSig(FusionRoom.DisplayUsage.InputSig);
// static assets --------------- testing
// Make a display asset
string dispAssetInstanceId;
//Check for existing GUID
- var tempAsset = StaticAssets.FirstOrDefault(a => a.Number.Equals(3));
+ var tempAsset = FusionAssets.FirstOrDefault(a => a.Name.Equals("Display"));
if(tempAsset != null)
dispAssetInstanceId = tempAsset.InstanceID;
else
- dispAssetInstanceId = "";
+ {
+ var nextSlotNum = FusionAssets.Count + 1;
- var dispAsset = FusionRoom.CreateStaticAsset(3, display.Name, "Display", dispAssetInstanceId);
+ tempAsset = new FusionAsset((uint)nextSlotNum, defaultDisplay.Name, "Display", "");
+ FusionAssets.Add(tempAsset);
+ dispAssetInstanceId = tempAsset.InstanceID;
+ }
+
+ var dispAsset = FusionRoom.CreateStaticAsset(3, defaultDisplay.Name, "Display", dispAssetInstanceId);
dispAsset.PowerOn.OutputSig.UserObject = dispPowerOnAction;
dispAsset.PowerOff.OutputSig.UserObject = dispPowerOffAction;
- display.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
+ defaultDisplay.PowerIsOnFeedback.LinkInputSig(dispAsset.PowerOn.InputSig);
// NO!! display.PowerIsOn.LinkComplementInputSig(dispAsset.PowerOff.InputSig);
// Use extension methods
- dispAsset.TrySetMakeModel(display);
- dispAsset.TryLinkAssetErrorToCommunication(display);
+ dispAsset.TrySetMakeModel(defaultDisplay);
+ dispAsset.TryLinkAssetErrorToCommunication(defaultDisplay);
}
void SetUpError()
@@ -883,7 +1048,31 @@ namespace PepperDash.Essentials.Fusion
}
+ void SetUpOccupancy()
+ {
+#warning Add actual object logic check here
+ //if (Room.OccupancyObj != null)
+ //{
+ string occAssetId;
+ var tempAsset = FusionAssets.FirstOrDefault(a => a.Type.Equals("Occupancy Sensor"));
+
+ if(tempAsset != null)
+ occAssetId = tempAsset.InstanceID;
+ else
+ {
+ var nextAssetNum = FusionAssets.Count + 1;
+
+ tempAsset = new FusionAsset((uint)nextAssetNum, "Occupancy Sensor", "Occupancy Sensor", "");
+ FusionAssets.Add(tempAsset);
+ occAssetId = tempAsset.InstanceID;
+ }
+
+ FusionRoom.AddAsset(eAssetType.OccupancySensor, tempAsset.Number, tempAsset.Name, tempAsset.Type, tempAsset.InstanceID);
+
+ ((FusionOccupancySensor)FusionRoom.UserConfigurableAssetDetails[tempAsset.Number].Asset).RoomOccupied.InputSig.BoolValue = OccupancyStatusSig.InputSig.BoolValue;
+ //}
+ }
///
/// Helper to get the number from the end of a device's key string
@@ -1063,386 +1252,5 @@ namespace PepperDash.Essentials.Fusion
}
}
- // Helper Classes for GUIDs
-
- ///
- /// Stores GUIDs to be written to a file in NVRAM
- ///
- public class FusionRoomGuids
- {
- public string RoomName { get; set; }
- public uint IpId { get; set; }
- public string RoomGuid { get; set; }
- public List StaticAssets { get; set; }
-
- public FusionRoomGuids()
- {
- StaticAssets = new List();
- }
-
- public FusionRoomGuids(string roomName, uint ipId, string roomGuid, List staticAssets)
- {
- RoomName = roomName;
- IpId = ipId;
- RoomGuid = roomGuid;
-
- StaticAssets = new List(staticAssets);
- }
- }
-
- public class StaticAsset
- {
- public uint Number { get; set; }
- public string Name { get; set; }
- public string Type { get; set; }
- public string InstanceID { get; set; }
-
- public StaticAsset()
- {
-
- }
-
- public StaticAsset(uint slotNum, string assetName, string type, string instanceID)
- {
- Number = slotNum;
- Name = assetName;
- Type = type;
- if(string.IsNullOrEmpty(instanceID))
- {
- InstanceID = Guid.NewGuid().ToString();
- }
- else
- {
- InstanceID = instanceID;
- }
- }
- }
-
- //***************************************************************************************************
-
- public class RoomSchedule
- {
- public List Meetings { get; set; }
-
- public RoomSchedule()
- {
- Meetings = new List();
- }
- }
-
- //****************************************************************************************************
- // Helper Classes for XML API
-
- ///
- /// All the data needed for a full schedule request in a room
- ///
- /// //[XmlRoot(ElementName = "RequestSchedule")]
- public class RequestSchedule
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "RoomID")]
- public string RoomID { get; set; }
- //[XmlElement(ElementName = "Start")]
- public DateTime Start { get; set; }
- //[XmlElement(ElementName = "HourSpan")]
- public double HourSpan { get; set; }
-
- public RequestSchedule(string requestID, string roomID)
- {
- RequestID = requestID;
- RoomID = roomID;
- Start = DateTime.Now;
- HourSpan = 24;
- }
- }
-
-
- //[XmlRoot(ElementName = "RequestAction")]
- public class RequestAction
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "RoomID")]
- public string RoomID { get; set; }
- //[XmlElement(ElementName = "ActionID")]
- public string ActionID { get; set; }
- //[XmlElement(ElementName = "Parameters")]
- public List Parameters { get; set; }
-
- public RequestAction(string roomID, string actionID, List parameters)
- {
- RoomID = roomID;
- ActionID = actionID;
- Parameters = parameters;
- }
- }
-
- //[XmlRoot(ElementName = "ActionResponse")]
- public class ActionResponse
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "ActionID")]
- public string ActionID { get; set; }
- //[XmlElement(ElementName = "Parameters")]
- public List Parameters { get; set; }
- }
-
- //[XmlRoot(ElementName = "Parameter")]
- public class Parameter
- {
- //[XmlAttribute(AttributeName = "ID")]
- public string ID { get; set; }
- //[XmlAttribute(AttributeName = "Value")]
- public string Value { get; set; }
- }
-
- ////[XmlRoot(ElementName = "Parameters")]
- //public class Parameters
- //{
- // //[XmlElement(ElementName = "Parameter")]
- // public List Parameter { get; set; }
- //}
-
- ///
- /// Data structure for a ScheduleResponse from Fusion
- ///
- /// //[XmlRoot(ElementName = "ScheduleResponse")]
- public class ScheduleResponse
- {
- //[XmlElement(ElementName = "RequestID")]
- public string RequestID { get; set; }
- //[XmlElement(ElementName = "RoomID")]
- public string RoomID { get; set; }
- //[XmlElement(ElementName = "RoomName")]
- public string RoomName { get; set; }
- //[XmlElement("Event")]
- public List Events { get; set; }
-
- public ScheduleResponse()
- {
- Events = new List();
- }
- }
-
- //[XmlRoot(ElementName = "Event")]
- public class Event
- {
- //[XmlElement(ElementName = "MeetingID")]
- public string MeetingID { get; set; }
- //[XmlElement(ElementName = "RVMeetingID")]
- public string RVMeetingID { get; set; }
- //[XmlElement(ElementName = "Recurring")]
- public string Recurring { get; set; }
- //[XmlElement(ElementName = "InstanceID")]
- public string InstanceID { get; set; }
- //[XmlElement(ElementName = "dtStart")]
- public DateTime dtStart { get; set; }
- //[XmlElement(ElementName = "dtEnd")]
- public DateTime dtEnd { get; set; }
- //[XmlElement(ElementName = "Organizer")]
- public string Organizer { get; set; }
- //[XmlElement(ElementName = "Attendees")]
- public Attendees Attendees { get; set; }
- //[XmlElement(ElementName = "Resources")]
- public Resources Resources { get; set; }
- //[XmlElement(ElementName = "IsEvent")]
- public string IsEvent { get; set; }
- //[XmlElement(ElementName = "IsRoomViewMeeting")]
- public string IsRoomViewMeeting { get; set; }
- //[XmlElement(ElementName = "IsPrivate")]
- public string IsPrivate { get; set; }
- //[XmlElement(ElementName = "IsExchangePrivate")]
- public string IsExchangePrivate { get; set; }
- //[XmlElement(ElementName = "MeetingTypes")]
- public MeetingTypes MeetingTypes { get; set; }
- //[XmlElement(ElementName = "ParticipantCode")]
- public string ParticipantCode { get; set; }
- //[XmlElement(ElementName = "PhoneNo")]
- public string PhoneNo { get; set; }
- //[XmlElement(ElementName = "WelcomeMsg")]
- public string WelcomeMsg { get; set; }
- //[XmlElement(ElementName = "Subject")]
- public string Subject { get; set; }
- //[XmlElement(ElementName = "LiveMeeting")]
- public LiveMeeting LiveMeeting { get; set; }
- //[XmlElement(ElementName = "ShareDocPath")]
- public string ShareDocPath { get; set; }
- //[XmlElement(ElementName = "HaveAttendees")]
- public string HaveAttendees { get; set; }
- //[XmlElement(ElementName = "HaveResources")]
- public string HaveResources { get; set; }
-
- ///
- /// Gets the duration of the meeting
- ///
- public string DurationInMinutes
- {
- get
- {
- string duration;
-
- var timeSpan = dtEnd.Subtract(dtStart);
- int hours = timeSpan.Hours;
- double minutes = timeSpan.Minutes;
- double roundedMinutes = Math.Round(minutes);
- if(hours > 0)
- {
- duration = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
- }
- else
- {
- duration = string.Format("{0} minutes", roundedMinutes);
- }
-
- return duration;
- }
- }
-
- ///
- /// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
- ///
- public string RemainingTime
- {
- get
- {
- var now = DateTime.Now;
-
- string remainingTime;
-
- if (GetInProgress())
- {
- var timeSpan = dtEnd.Subtract(now);
- int hours = timeSpan.Hours;
- double minutes = timeSpan.Minutes;
- double roundedMinutes = Math.Round(minutes);
- if (hours > 0)
- {
- remainingTime = string.Format("{0} hours {1} minutes", hours, roundedMinutes);
- }
- else
- {
- remainingTime = string.Format("{0} minutes", roundedMinutes);
- }
-
- return remainingTime;
- }
- else
- return null;
- }
-
- }
-
- ///
- /// Indicates that the meeting is in progress
- ///
- public bool isInProgress
- {
- get
- {
- return GetInProgress();
- }
- }
-
- ///
- /// Determines if the meeting is in progress
- ///
- /// Returns true if in progress
- bool GetInProgress()
- {
- var now = DateTime.Now;
-
- if (now > dtStart && now < dtEnd)
- {
- return true;
- }
- else
- return false;
- }
- }
-
- //[XmlRoot(ElementName = "Resources")]
- public class Resources
- {
- //[XmlElement(ElementName = "Rooms")]
- public Rooms Rooms { get; set; }
- }
-
- //[XmlRoot(ElementName = "Rooms")]
- public class Rooms
- {
- //[XmlElement(ElementName = "Room")]
- public List Room { get; set; }
- }
-
- //[XmlRoot(ElementName = "Room")]
- public class Room
- {
- //[XmlElement(ElementName = "Name")]
- public string Name { get; set; }
- //[XmlElement(ElementName = "ID")]
- public string ID { get; set; }
- //[XmlElement(ElementName = "MPType")]
- public string MPType { get; set; }
- }
-
- //[XmlRoot(ElementName = "Attendees")]
- public class Attendees
- {
- //[XmlElement(ElementName = "Required")]
- public Required Required { get; set; }
- //[XmlElement(ElementName = "Optional")]
- public Optional Optional { get; set; }
- }
-
- //[XmlRoot(ElementName = "Required")]
- public class Required
- {
- //[XmlElement(ElementName = "Attendee")]
- public List Attendee { get; set; }
- }
-
- //[XmlRoot(ElementName = "Optional")]
- public class Optional
- {
- //[XmlElement(ElementName = "Attendee")]
- public List Attendee { get; set; }
- }
-
- //[XmlRoot(ElementName = "MeetingType")]
- public class MeetingType
- {
- //[XmlAttribute(AttributeName = "ID")]
- public string ID { get; set; }
- //[XmlAttribute(AttributeName = "Value")]
- public string Value { get; set; }
- }
-
- //[XmlRoot(ElementName = "MeetingTypes")]
- public class MeetingTypes
- {
- //[XmlElement(ElementName = "MeetingType")]
- public List MeetingType { get; set; }
- }
-
- //[XmlRoot(ElementName = "LiveMeeting")]
- public class LiveMeeting
- {
- //[XmlElement(ElementName = "URL")]
- public string URL { get; set; }
- //[XmlElement(ElementName = "ID")]
- public string ID { get; set; }
- //[XmlElement(ElementName = "Key")]
- public string Key { get; set; }
- //[XmlElement(ElementName = "Subject")]
- public string Subject { get; set; }
- }
-
- //[XmlRoot(ElementName = "LiveMeetingURL")]
- public class LiveMeetingURL
- {
- //[XmlElement(ElementName = "LiveMeeting")]
- public LiveMeeting LiveMeeting { get; set; }
- }
+
}
\ No newline at end of file
diff --git a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
index b4205def..fc5a780d 100644
--- a/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
+++ b/Essentials/PepperDashEssentials/PepperDashEssentials.csproj
@@ -83,7 +83,7 @@
False
..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll
-
+
False
..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll
@@ -135,6 +135,7 @@
+