mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-29 04:15:00 +00:00
Finished merge with 307
This commit is contained in:
@@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
/// A bridge class to cover the basic features of GenericBase hardware
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
|
||||
//***********************************************************************************
|
||||
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IPower
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public interface IPower
|
||||
{
|
||||
void PowerOn();
|
||||
void PowerOff();
|
||||
void PowerToggle();
|
||||
BoolFeedback PowerIsOnFeedback { get; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> 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
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> 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
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> 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:");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> 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:");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
{
|
||||
/// <summary>
|
||||
/// This method shall return a list of all Output objects on a device,
|
||||
/// including all "aggregate" devices.
|
||||
/// </summary>
|
||||
List<Feedback> 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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<DeviceUsageEventArgs> 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<EventArgs>(InUseFeedback_OutputChange);
|
||||
}
|
||||
|
||||
void InUseFeedback_OutputChange(object sender, EventArgs e)
|
||||
{
|
||||
if(InUseTracker.InUseFeedback.BoolValue)
|
||||
{
|
||||
StartDeviceUsage();
|
||||
}
|
||||
else
|
||||
{
|
||||
EndDeviceUsage();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Stores the usage start time
|
||||
/// </summary>
|
||||
public void StartDeviceUsage()
|
||||
{
|
||||
UsageStartTime = DateTime.Now;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
/// </summary>
|
||||
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; }
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,14 @@ namespace PepperDash.Essentials.Core
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -58,6 +58,10 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.EthernetCommunications.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Fusion, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Fusion.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Crestron.SimplSharpPro.Remotes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=1099c178b3b54c3b, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\..\ProgramData\Crestron\SDK\SSPDevices\Crestron.SimplSharpPro.Remotes.dll</HintPath>
|
||||
@@ -112,6 +116,7 @@
|
||||
<Compile Include="Config\DeviceConfig.cs" />
|
||||
<Compile Include="Constants\CommonCues.cs" />
|
||||
<Compile Include="Devices\DisplayUiConstants.cs" />
|
||||
<Compile Include="Devices\IUsageTracking.cs" />
|
||||
<Compile Include="Devices\REMOVE DeviceConfig.cs" />
|
||||
<Compile Include="Devices\DeviceJsonApi.cs" />
|
||||
<Compile Include="Devices\SourceListItem.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<RoutingOutputPort> { 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "-"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Dash"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Command { get; set; }
|
||||
|
||||
public void KeypadAccessoryButton1(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton2Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
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<RoutingOutputPort> 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<RoutingOutputPort> { 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton1 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "-"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Dash"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton1Command { get; set; }
|
||||
|
||||
public void KeypadAccessoryButton1(bool pressRelease)
|
||||
{
|
||||
IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true
|
||||
/// </summary>
|
||||
public bool HasKeypadAccessoryButton2 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
public string KeypadAccessoryButton2Label { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to "Enter"
|
||||
/// </summary>
|
||||
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<RoutingOutputPort> 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
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Devices.Common
|
||||
/// <summary>
|
||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||
/// </summary>
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -29,8 +29,8 @@ namespace PepperDash.Essentials
|
||||
/// </summary>
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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);
|
||||
|
||||
399
Essentials/PepperDashEssentials/Fusion/FusionRviDataClasses.cs
Normal file
399
Essentials/PepperDashEssentials/Fusion/FusionRviDataClasses.cs
Normal file
@@ -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
|
||||
|
||||
/// <summary>
|
||||
/// Stores GUIDs to be written to a file in NVRAM
|
||||
/// </summary>
|
||||
public class FusionRoomGuids
|
||||
{
|
||||
public string RoomName { get; set; }
|
||||
public uint IpId { get; set; }
|
||||
public string RoomGuid { get; set; }
|
||||
public List<FusionAsset> StaticAssets { get; set; }
|
||||
|
||||
public FusionRoomGuids()
|
||||
{
|
||||
StaticAssets = new List<FusionAsset>();
|
||||
}
|
||||
|
||||
public FusionRoomGuids(string roomName, uint ipId, string roomGuid, List<FusionAsset> staticAssets)
|
||||
{
|
||||
RoomName = roomName;
|
||||
IpId = ipId;
|
||||
RoomGuid = roomGuid;
|
||||
|
||||
StaticAssets = new List<FusionAsset>(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<Event> Meetings { get; set; }
|
||||
|
||||
public RoomSchedule()
|
||||
{
|
||||
Meetings = new List<Event>();
|
||||
}
|
||||
}
|
||||
|
||||
//****************************************************************************************************
|
||||
// Helper Classes for XML API
|
||||
|
||||
/// <summary>
|
||||
/// Data needed to request the local time from the Fusion server
|
||||
/// </summary>
|
||||
public class LocalTimeRequest
|
||||
{
|
||||
public string RequestID { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All the data needed for a full schedule request in a room
|
||||
/// </summary>
|
||||
/// //[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<Parameter> Parameters { get; set; }
|
||||
|
||||
public RequestAction(string roomID, string actionID, List<Parameter> 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<Parameter> 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> Parameter { get; set; }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Data structure for a ScheduleResponse from Fusion
|
||||
/// </summary>
|
||||
/// //[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<Event> Events { get; set; }
|
||||
|
||||
public ScheduleResponse()
|
||||
{
|
||||
Events = new List<Event>();
|
||||
}
|
||||
}
|
||||
|
||||
//[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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the duration of the meeting
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the meeting is in progress
|
||||
/// </summary>
|
||||
public bool isInProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetInProgress();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the meeting is in progress
|
||||
/// </summary>
|
||||
/// <returns>Returns true if in progress</returns>
|
||||
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> 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<string> Attendee { get; set; }
|
||||
}
|
||||
|
||||
//[XmlRoot(ElementName = "Optional")]
|
||||
public class Optional
|
||||
{
|
||||
//[XmlElement(ElementName = "Attendee")]
|
||||
public List<string> 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> 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; }
|
||||
}
|
||||
}
|
||||
@@ -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<Device, BoolInputSig> SourceToFeedbackSigs =
|
||||
new Dictionary<Device, BoolInputSig>();
|
||||
|
||||
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<StaticAsset> StaticAssets;
|
||||
List<FusionAsset> FusionAssets;
|
||||
|
||||
//ScheduleResponseEvent NextMeeting;
|
||||
|
||||
@@ -83,7 +99,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
IpId = ipId;
|
||||
|
||||
StaticAssets = new List<StaticAsset>();
|
||||
FusionAssets = new List<FusionAsset>();
|
||||
|
||||
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
|
||||
"<Parameter ID='Field' Value='MeetingID' />\n" +
|
||||
"<Parameter ID='Field' Value='RVMeetingID' />\n" +
|
||||
"<Parameter ID='Field' Value='InstanceID' />\n" +
|
||||
//"<Parameter ID='Field' Value='Recurring' />\n" +
|
||||
"<Parameter ID='Field' Value='dtStart' />\n" +
|
||||
"<Parameter ID='Field' Value='dtEnd' />\n" +
|
||||
"<Parameter ID='Field' Value='Subject' />\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("<LocalTimeRequest><RequestID>{0}</RequestID></LocalTimeRequest>", 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<ActionResponse>(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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -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<DeviceUsageEventArgs>(UsageTracker_DeviceUsageEnded);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
@@ -735,6 +839,35 @@ namespace PepperDash.Essentials.Fusion
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Collects usage data from source and sends to Fusion
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
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<DeviceUsageEventArgs>(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<bool>(b => { if (!b) display.PowerOn(); });
|
||||
var dispPowerOffAction = new Action<bool>(b => { if (!b) display.PowerOff(); });
|
||||
var dispPowerOnAction = new Action<bool>(b => { if (!b) defaultDisplay.PowerOn(); });
|
||||
var dispPowerOffAction = new Action<bool>(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;
|
||||
//}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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
|
||||
|
||||
/// <summary>
|
||||
/// Stores GUIDs to be written to a file in NVRAM
|
||||
/// </summary>
|
||||
public class FusionRoomGuids
|
||||
{
|
||||
public string RoomName { get; set; }
|
||||
public uint IpId { get; set; }
|
||||
public string RoomGuid { get; set; }
|
||||
public List<StaticAsset> StaticAssets { get; set; }
|
||||
|
||||
public FusionRoomGuids()
|
||||
{
|
||||
StaticAssets = new List<StaticAsset>();
|
||||
}
|
||||
|
||||
public FusionRoomGuids(string roomName, uint ipId, string roomGuid, List<StaticAsset> staticAssets)
|
||||
{
|
||||
RoomName = roomName;
|
||||
IpId = ipId;
|
||||
RoomGuid = roomGuid;
|
||||
|
||||
StaticAssets = new List<StaticAsset>(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<Event> Meetings { get; set; }
|
||||
|
||||
public RoomSchedule()
|
||||
{
|
||||
Meetings = new List<Event>();
|
||||
}
|
||||
}
|
||||
|
||||
//****************************************************************************************************
|
||||
// Helper Classes for XML API
|
||||
|
||||
/// <summary>
|
||||
/// All the data needed for a full schedule request in a room
|
||||
/// </summary>
|
||||
/// //[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<Parameter> Parameters { get; set; }
|
||||
|
||||
public RequestAction(string roomID, string actionID, List<Parameter> 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<Parameter> 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> Parameter { get; set; }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Data structure for a ScheduleResponse from Fusion
|
||||
/// </summary>
|
||||
/// //[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<Event> Events { get; set; }
|
||||
|
||||
public ScheduleResponse()
|
||||
{
|
||||
Events = new List<Event>();
|
||||
}
|
||||
}
|
||||
|
||||
//[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; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the duration of the meeting
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the remaining time in the meeting. Returns null if the meeting is not currently in progress.
|
||||
/// </summary>
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Indicates that the meeting is in progress
|
||||
/// </summary>
|
||||
public bool isInProgress
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetInProgress();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines if the meeting is in progress
|
||||
/// </summary>
|
||||
/// <returns>Returns true if in progress</returns>
|
||||
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> 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<string> Attendee { get; set; }
|
||||
}
|
||||
|
||||
//[XmlRoot(ElementName = "Optional")]
|
||||
public class Optional
|
||||
{
|
||||
//[XmlElement(ElementName = "Attendee")]
|
||||
public List<string> 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> 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; }
|
||||
}
|
||||
|
||||
}
|
||||
@@ -83,7 +83,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.12925, Culture=neutral, processorArchitecture=MSIL">
|
||||
<Reference Include="PepperDash_Essentials_Core, Version=1.0.0.18243, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -135,6 +135,7 @@
|
||||
<Compile Include="Devices\NUMERIC AppleTV.cs" />
|
||||
<Compile Include="ControlSystem.cs" />
|
||||
<Compile Include="Fusion\FusionEventHandlers.cs" />
|
||||
<Compile Include="Fusion\FusionRviDataClasses.cs" />
|
||||
<Compile Include="REMOVE EssentialsApp.cs" />
|
||||
<Compile Include="Fusion\FusionSystemController.cs" />
|
||||
<Compile Include="HttpApiHandler.cs" />
|
||||
|
||||
Reference in New Issue
Block a user