mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-14 12:15:01 +00:00
Implemented Device Usage feature for Fusion.
This commit is contained in:
@@ -13,7 +13,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A bridge class to cover the basic features of GenericBase hardware
|
/// A bridge class to cover the basic features of GenericBase hardware
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor
|
public class CrestronGenericBaseDevice : Device, IOnline, IHasFeedback, ICommunicationMonitor, IUsageTracking
|
||||||
{
|
{
|
||||||
public virtual GenericBase Hardware { get; protected set; }
|
public virtual GenericBase Hardware { get; protected set; }
|
||||||
|
|
||||||
@@ -87,7 +87,13 @@ namespace PepperDash.Essentials.Core
|
|||||||
#region IStatusMonitor Members
|
#region IStatusMonitor Members
|
||||||
|
|
||||||
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
public StatusMonitorBase CommunicationMonitor { get; private set; }
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IUsageTracking Members
|
||||||
|
|
||||||
|
public UsageTracking UsageTracker { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
||||||
//***********************************************************************************
|
//***********************************************************************************
|
||||||
|
|||||||
@@ -0,0 +1,81 @@
|
|||||||
|
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.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>
|
||||||
///
|
///
|
||||||
/// </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 PowerIsOnFeedback { get; protected set; }
|
||||||
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
public BoolFeedback IsCoolingDownFeedback { get; protected set; }
|
||||||
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
public BoolFeedback IsWarmingUpFeedback { get; private set; }
|
||||||
|
|
||||||
|
public UsageTracking UsageTracker { get; set; }
|
||||||
|
|
||||||
public uint WarmupTime { get; set; }
|
public uint WarmupTime { get; set; }
|
||||||
public uint CooldownTime { get; set; }
|
public uint CooldownTime { get; set; }
|
||||||
|
|
||||||
@@ -77,7 +79,7 @@ namespace PepperDash.Essentials.Core
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class TwoWayDisplayBase : DisplayBase
|
public abstract class TwoWayDisplayBase : DisplayBase
|
||||||
{
|
{
|
||||||
public StringFeedback CurrentInputFeedback { get; private set; }
|
public StringFeedback CurrentInputFeedback { get; private set; }
|
||||||
|
|
||||||
@@ -104,6 +106,8 @@ namespace PepperDash.Essentials.Core
|
|||||||
CooldownTime = 15000;
|
CooldownTime = 15000;
|
||||||
|
|
||||||
Feedbacks.Add(CurrentInputFeedback);
|
Feedbacks.Add(CurrentInputFeedback);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,7 @@
|
|||||||
<Compile Include="Config\DeviceConfig.cs" />
|
<Compile Include="Config\DeviceConfig.cs" />
|
||||||
<Compile Include="Constants\CommonCues.cs" />
|
<Compile Include="Constants\CommonCues.cs" />
|
||||||
<Compile Include="Devices\DisplayUiConstants.cs" />
|
<Compile Include="Devices\DisplayUiConstants.cs" />
|
||||||
|
<Compile Include="Devices\IUsageTracking.cs" />
|
||||||
<Compile Include="Devices\REMOVE DeviceConfig.cs" />
|
<Compile Include="Devices\REMOVE DeviceConfig.cs" />
|
||||||
<Compile Include="Devices\DeviceJsonApi.cs" />
|
<Compile Include="Devices\DeviceJsonApi.cs" />
|
||||||
<Compile Include="Devices\SourceListItem.cs" />
|
<Compile Include="Devices\SourceListItem.cs" />
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -1,308 +1,314 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Crestron.SimplSharp;
|
using Crestron.SimplSharp;
|
||||||
using Crestron.SimplSharpPro;
|
using Crestron.SimplSharpPro;
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials.Core;
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Core.Routing;
|
using PepperDash.Essentials.Core.Routing;
|
||||||
|
|
||||||
namespace PepperDash.Essentials.Devices.Common
|
namespace PepperDash.Essentials.Devices.Common
|
||||||
{
|
{
|
||||||
public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs
|
public class IRBlurayBase : Device, IDiscPlayerControls, IUiDisplayInfo, IRoutingOutputs, IUsageTracking
|
||||||
{
|
{
|
||||||
public IrOutputPortController IrPort { get; private set; }
|
public IrOutputPortController IrPort { get; private set; }
|
||||||
|
|
||||||
public uint DisplayUiType { get { return DisplayUiConstants.TypeBluray; } }
|
public uint DisplayUiType { get { return DisplayUiConstants.TypeBluray; } }
|
||||||
|
|
||||||
public IRBlurayBase(string key, string name, IrOutputPortController portCont)
|
public IRBlurayBase(string key, string name, IrOutputPortController portCont)
|
||||||
: base(key, name)
|
: base(key, name)
|
||||||
{
|
{
|
||||||
IrPort = portCont;
|
IrPort = portCont;
|
||||||
DeviceManager.AddDevice(portCont);
|
DeviceManager.AddDevice(portCont);
|
||||||
|
|
||||||
HasKeypadAccessoryButton1 = true;
|
HasKeypadAccessoryButton1 = true;
|
||||||
KeypadAccessoryButton1Command = "Clear";
|
KeypadAccessoryButton1Command = "Clear";
|
||||||
KeypadAccessoryButton1Label = "Clear";
|
KeypadAccessoryButton1Label = "Clear";
|
||||||
|
|
||||||
HasKeypadAccessoryButton2 = true;
|
HasKeypadAccessoryButton2 = true;
|
||||||
KeypadAccessoryButton2Command = "NumericEnter";
|
KeypadAccessoryButton2Command = "NumericEnter";
|
||||||
KeypadAccessoryButton2Label = "Enter";
|
KeypadAccessoryButton2Label = "Enter";
|
||||||
|
|
||||||
PowerIsOnFeedback = new BoolFeedback(() => _PowerIsOn);
|
PowerIsOnFeedback = new BoolFeedback(() => _PowerIsOn);
|
||||||
|
|
||||||
HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.AudioVideo,
|
HdmiOut = new RoutingOutputPort(RoutingPortNames.HdmiOut, eRoutingSignalType.AudioVideo,
|
||||||
eRoutingPortConnectionType.Hdmi, null, this);
|
eRoutingPortConnectionType.Hdmi, null, this);
|
||||||
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
AnyAudioOut = new RoutingOutputPort(RoutingPortNames.AnyAudioOut, eRoutingSignalType.Audio,
|
||||||
eRoutingPortConnectionType.DigitalAudio, null, this);
|
eRoutingPortConnectionType.DigitalAudio, null, this);
|
||||||
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
|
OutputPorts = new RoutingPortCollection<RoutingOutputPort> { HdmiOut, AnyAudioOut };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region IDPad Members
|
#region IDPad Members
|
||||||
|
|
||||||
public void Up(bool pressRelease)
|
public void Up(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_UP_ARROW, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_UP_ARROW, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Down(bool pressRelease)
|
public void Down(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_DN_ARROW, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_DN_ARROW, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Left(bool pressRelease)
|
public void Left(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_LEFT_ARROW, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_LEFT_ARROW, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Right(bool pressRelease)
|
public void Right(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RIGHT_ARROW, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_RIGHT_ARROW, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Select(bool pressRelease)
|
public void Select(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_ENTER, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Menu(bool pressRelease)
|
public void Menu(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_MENU, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_MENU, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Exit(bool pressRelease)
|
public void Exit(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_EXIT, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_EXIT, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region INumericKeypad Members
|
#region INumericKeypad Members
|
||||||
|
|
||||||
public void Digit0(bool pressRelease)
|
public void Digit0(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_0, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_0, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit1(bool pressRelease)
|
public void Digit1(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_1, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_1, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit2(bool pressRelease)
|
public void Digit2(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_2, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_2, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit3(bool pressRelease)
|
public void Digit3(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_3, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_3, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit4(bool pressRelease)
|
public void Digit4(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_4, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_4, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit5(bool pressRelease)
|
public void Digit5(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_5, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_5, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit6(bool pressRelease)
|
public void Digit6(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_6, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_6, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit7(bool pressRelease)
|
public void Digit7(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_7, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_7, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit8(bool pressRelease)
|
public void Digit8(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_8, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_8, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Digit9(bool pressRelease)
|
public void Digit9(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_9, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_9, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to true
|
/// Defaults to true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasKeypadAccessoryButton1 { get; set; }
|
public bool HasKeypadAccessoryButton1 { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to "-"
|
/// Defaults to "-"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string KeypadAccessoryButton1Label { get; set; }
|
public string KeypadAccessoryButton1Label { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to "Dash"
|
/// Defaults to "Dash"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string KeypadAccessoryButton1Command { get; set; }
|
public string KeypadAccessoryButton1Command { get; set; }
|
||||||
|
|
||||||
public void KeypadAccessoryButton1(bool pressRelease)
|
public void KeypadAccessoryButton1(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
|
IrPort.PressRelease(KeypadAccessoryButton1Command, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to true
|
/// Defaults to true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasKeypadAccessoryButton2 { get; set; }
|
public bool HasKeypadAccessoryButton2 { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to "Enter"
|
/// Defaults to "Enter"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string KeypadAccessoryButton2Label { get; set; }
|
public string KeypadAccessoryButton2Label { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Defaults to "Enter"
|
/// Defaults to "Enter"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string KeypadAccessoryButton2Command { get; set; }
|
public string KeypadAccessoryButton2Command { get; set; }
|
||||||
|
|
||||||
public void KeypadAccessoryButton2(bool pressRelease)
|
public void KeypadAccessoryButton2(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(KeypadAccessoryButton2Command, pressRelease);
|
IrPort.PressRelease(KeypadAccessoryButton2Command, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IChannelFunctions Members
|
#region IChannelFunctions Members
|
||||||
|
|
||||||
public void ChannelUp(bool pressRelease)
|
public void ChannelUp(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_PLUS, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChannelDown(bool pressRelease)
|
public void ChannelDown(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_MINUS, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_CH_MINUS, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LastChannel(bool pressRelease)
|
public void LastChannel(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_LAST, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_LAST, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Guide(bool pressRelease)
|
public void Guide(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_GUIDE, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_GUIDE, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Info(bool pressRelease)
|
public void Info(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_INFO, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_INFO, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IColorFunctions Members
|
#region IColorFunctions Members
|
||||||
|
|
||||||
public void Red(bool pressRelease)
|
public void Red(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RED, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_RED, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Green(bool pressRelease)
|
public void Green(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_GREEN, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_GREEN, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Yellow(bool pressRelease)
|
public void Yellow(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_YELLOW, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_YELLOW, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Blue(bool pressRelease)
|
public void Blue(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_BLUE, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_BLUE, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IRoutingOutputs Members
|
#region IRoutingOutputs Members
|
||||||
|
|
||||||
public RoutingOutputPort HdmiOut { get; private set; }
|
public RoutingOutputPort HdmiOut { get; private set; }
|
||||||
public RoutingOutputPort AnyAudioOut { get; private set; }
|
public RoutingOutputPort AnyAudioOut { get; private set; }
|
||||||
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
public RoutingPortCollection<RoutingOutputPort> OutputPorts { get; private set; }
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region IPower Members
|
#region IPower Members
|
||||||
|
|
||||||
public void PowerOn()
|
public void PowerOn()
|
||||||
{
|
{
|
||||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, 200);
|
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_ON, 200);
|
||||||
_PowerIsOn = true;
|
_PowerIsOn = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PowerOff()
|
public void PowerOff()
|
||||||
{
|
{
|
||||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, 200);
|
IrPort.Pulse(IROutputStandardCommands.IROut_POWER_OFF, 200);
|
||||||
_PowerIsOn = false;
|
_PowerIsOn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PowerToggle()
|
public void PowerToggle()
|
||||||
{
|
{
|
||||||
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, 200);
|
IrPort.Pulse(IROutputStandardCommands.IROut_POWER, 200);
|
||||||
_PowerIsOn = false;
|
_PowerIsOn = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BoolFeedback PowerIsOnFeedback { get; set; }
|
public BoolFeedback PowerIsOnFeedback { get; set; }
|
||||||
bool _PowerIsOn;
|
bool _PowerIsOn;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region ITransport Members
|
#region ITransport Members
|
||||||
|
|
||||||
public void Play(bool pressRelease)
|
public void Play(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_PLAY, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_PLAY, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Pause(bool pressRelease)
|
public void Pause(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_PAUSE, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_PAUSE, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Rewind(bool pressRelease)
|
public void Rewind(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_RSCAN, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_RSCAN, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void FFwd(bool pressRelease)
|
public void FFwd(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_FSCAN, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_FSCAN, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChapMinus(bool pressRelease)
|
public void ChapMinus(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_MINUS, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChapPlus(bool pressRelease)
|
public void ChapPlus(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_TRACK_PLUS, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop(bool pressRelease)
|
public void Stop(bool pressRelease)
|
||||||
{
|
{
|
||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Record(bool pressRelease)
|
public void Record(bool pressRelease)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
|
||||||
|
#region IUsageTracking Members
|
||||||
|
|
||||||
|
public UsageTracking UsageTracker { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
@@ -12,7 +12,7 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||||
/// </summary>
|
/// </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 uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||||
public string IconName { get; set; }
|
public string IconName { get; set; }
|
||||||
@@ -50,6 +50,12 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
get { return this.GetVideoStatuses().ToList(); }
|
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>
|
/// <summary>
|
||||||
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
/// This DVD class should cover most IR, one-way DVD and Bluray fuctions
|
||||||
/// </summary>
|
/// </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 uint DisplayUiType { get { return DisplayUiConstants.TypeLaptop; } }
|
||||||
public string IconName { get; set; }
|
public string IconName { get; set; }
|
||||||
@@ -50,6 +50,12 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
get { return this.GetVideoStatuses().ToList(); }
|
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
|
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; }
|
public IrOutputPortController IrPort { get; private set; }
|
||||||
|
|
||||||
@@ -332,6 +332,12 @@ namespace PepperDash.Essentials.Devices.Common
|
|||||||
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
|
IrPort.PressRelease(IROutputStandardCommands.IROut_STOP, pressRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region IUsageTracking Members
|
||||||
|
|
||||||
|
public UsageTracking UsageTracker { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -175,8 +175,6 @@ namespace PepperDash.Essentials
|
|||||||
DeviceManager.AddDevice(room);
|
DeviceManager.AddDevice(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
#warning Add Fusion connector to room factory?
|
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
Debug.Console(0, "WARNING: Cannot create room from config, key '{0}'", roomConfig.Key);
|
||||||
|
|||||||
@@ -14,10 +14,9 @@ using Crestron.SimplSharpPro.Fusion;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
|
|
||||||
using PepperDash.Essentials.Core;
|
|
||||||
|
|
||||||
using PepperDash.Core;
|
using PepperDash.Core;
|
||||||
using PepperDash.Essentials;
|
using PepperDash.Essentials;
|
||||||
|
using PepperDash.Essentials.Core;
|
||||||
using PepperDash.Essentials.Devices.Common;
|
using PepperDash.Essentials.Devices.Common;
|
||||||
|
|
||||||
|
|
||||||
@@ -314,6 +313,7 @@ namespace PepperDash.Essentials.Fusion
|
|||||||
NetMask1 = FusionRoom.CreateOffsetStringSig(63, "Info - Processor - Net Mask 1", eSigIoMask.InputSigOnly);
|
NetMask1 = FusionRoom.CreateOffsetStringSig(63, "Info - Processor - Net Mask 1", eSigIoMask.InputSigOnly);
|
||||||
NetMask2 = FusionRoom.CreateOffsetStringSig(64, "Info - Processor - Net Mask 2", eSigIoMask.InputSigOnly);
|
NetMask2 = FusionRoom.CreateOffsetStringSig(64, "Info - Processor - Net Mask 2", eSigIoMask.InputSigOnly);
|
||||||
|
|
||||||
|
SetProcessorEthernetValues();
|
||||||
|
|
||||||
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
CrestronEnvironment.EthernetEventHandler += new EthernetEventHandler(CrestronEnvironment_EthernetEventHandler);
|
||||||
}
|
}
|
||||||
@@ -815,6 +815,18 @@ namespace PepperDash.Essentials.Fusion
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
foreach (var kvp in dict)
|
||||||
|
{
|
||||||
|
var usageDevice = kvp.Value.SourceDevice as IUsageTracking;
|
||||||
|
|
||||||
|
if (usageDevice != null)
|
||||||
|
{
|
||||||
|
usageDevice.UsageTracker = new UsageTracking();
|
||||||
|
|
||||||
|
usageDevice.UsageTracker.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_SourceUsageEnded);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -824,6 +836,31 @@ 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_SourceUsageEnded(object sender, DeviceUsageEventArgs e)
|
||||||
|
{
|
||||||
|
var device = sender as Device;
|
||||||
|
|
||||||
|
var configDevice = ConfigReader.ConfigObject.Devices.Where(d => d.Key.Equals(device.Key));
|
||||||
|
|
||||||
|
string group = "";
|
||||||
|
|
||||||
|
#warning Figure out how to get the group value from the device config
|
||||||
|
|
||||||
|
|
||||||
|
//Double check my time and date formatting in the ToString() methods
|
||||||
|
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, "asset_id", CurrentMeeting.MeetingID);
|
||||||
|
|
||||||
|
|
||||||
|
FusionRoom.DeviceUsage.InputSig.StringValue = deviceUsage;
|
||||||
|
}
|
||||||
|
|
||||||
void TryAddRouteActionSigs(string attrName, uint attrNum, string routeKey, Device pSrc)
|
void TryAddRouteActionSigs(string attrName, uint attrNum, string routeKey, Device pSrc)
|
||||||
{
|
{
|
||||||
Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
|
Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
|
||||||
@@ -924,6 +961,10 @@ namespace PepperDash.Essentials.Fusion
|
|||||||
|
|
||||||
void SetUpDisplay()
|
void SetUpDisplay()
|
||||||
{
|
{
|
||||||
|
//Setup Display Usage Monitoring
|
||||||
|
|
||||||
|
#warning Somehow get list of room's displays and activate Usage tracking and subscribe to event
|
||||||
|
|
||||||
var display = Room.DefaultDisplay as DisplayBase;
|
var display = Room.DefaultDisplay as DisplayBase;
|
||||||
if (display == null)
|
if (display == null)
|
||||||
{
|
{
|
||||||
@@ -984,9 +1025,6 @@ namespace PepperDash.Essentials.Fusion
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Helper to get the number from the end of a device's key string
|
/// Helper to get the number from the end of a device's key string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -83,7 +83,7 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
<HintPath>..\..\..\pepperdash-simplsharp-core\Pepperdash Core\CLZ Builds\PepperDash_Core.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
|
<HintPath>..\..\Essentials Core\PepperDashEssentialsBase\bin\PepperDash_Essentials_Core.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user