mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-05 15:55:02 +00:00
Implemented Device Usage feature for Fusion.
This commit is contained in:
@@ -175,8 +175,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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -314,6 +313,7 @@ namespace PepperDash.Essentials.Fusion
|
||||
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);
|
||||
}
|
||||
@@ -815,6 +815,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.DeviceUsageEnded += new EventHandler<DeviceUsageEventArgs>(UsageTracker_SourceUsageEnded);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
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)
|
||||
{
|
||||
Debug.Console(2, this, "Creating attribute '{0}' with join {1} for source {2}",
|
||||
@@ -924,6 +961,10 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
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;
|
||||
if (display == null)
|
||||
{
|
||||
@@ -984,9 +1025,6 @@ namespace PepperDash.Essentials.Fusion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Helper to get the number from the end of a device's key string
|
||||
/// </summary>
|
||||
|
||||
@@ -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>
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user