getting started with EssentialsTechRoom

This commit is contained in:
Andrew Welker
2020-12-01 16:20:59 -07:00
parent f283f82bbc
commit 008a052045
4 changed files with 291 additions and 163 deletions

View File

@@ -22,30 +22,25 @@ namespace PepperDash.Essentials.Room.Config
public static Device GetRoomObject(DeviceConfig roomConfig)
{
var typeName = roomConfig.Type.ToLower();
if (typeName == "huddle")
{
var huddle = new EssentialsHuddleSpaceRoom(roomConfig);
return huddle;
return new EssentialsHuddleSpaceRoom(roomConfig);
}
else if (typeName == "huddlevtc1")
{
var rm = new EssentialsHuddleVtc1Room(roomConfig);
return rm;
}
else if (typeName == "ddvc01Bridge")
{
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
}
else if (typeName == "dualdisplay")
{
var rm = new EssentialsDualDisplayRoom(roomConfig);
if (typeName == "huddlevtc1")
{
return new EssentialsHuddleVtc1Room(roomConfig);
}
if (typeName == "ddvc01Bridge")
{
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
}
if (typeName == "dualdisplay")
{
return new EssentialsDualDisplayRoom(roomConfig);
}
return rm;
}
return null;
return typeName != "techRoom" ? null : new EssentialsTechRoom(roomConfig);
}
/// <summary>

View File

@@ -0,0 +1,20 @@
using System.Collections.Generic;
namespace PepperDash.Essentials.Room.Config
{
public class EssentialsTechRoomConfig
{
public List<string> Displays;
public List<string> Tuners;
public string ScheduleProviderKey;
public string UserPin;
public string TechPin;
public string PresetsFileName;
public EssentialsTechRoomConfig()
{
Displays = new List<string>();
Tuners = new List<string>();
}
}
}

View File

@@ -0,0 +1,94 @@
using System;
using System.Collections.Generic;
using System.Linq;
using PepperDash.Core;
using PepperDash.Essentials.Core;
using PepperDash.Essentials.Core.Config;
using PepperDash.Essentials.Core.Presets;
using PepperDash.Essentials.Devices.Common;
using PepperDash.Essentials.Room.Config;
namespace PepperDash.Essentials
{
public class EssentialsTechRoom:EssentialsRoomBase
{
private Dictionary<string, IRSetTopBoxBase> _tuners;
private Dictionary<string, TwoWayDisplayBase> _displays;
private DevicePresetsModel _tunerPresets;
private readonly EssentialsTechRoomConfig _config;
public EssentialsTechRoom(DeviceConfig config) : base(config)
{
_config = config.Properties.ToObject<EssentialsTechRoomConfig>();
_tunerPresets = new DevicePresetsModel(String.Format("{0}-presets", config.Key), _config.PresetsFileName);
_tuners = GetDevices<IRSetTopBoxBase>(_config.Tuners);
_displays = GetDevices<TwoWayDisplayBase>(_config.Displays);
}
private Dictionary<string, T> GetDevices<T>(ICollection<string> config) where T:IKeyed
{
try
{
var returnValue = DeviceManager.AllDevices.OfType<T>()
.Where(d => config.Contains(d.Key))
.ToDictionary(d => d.Key, d => d);
return returnValue;
}
catch
{
Debug.Console(0, this, Debug.ErrorLogLevel.Error, "Error getting devices. Check Essentials Configuration");
return null;
}
}
#region Overrides of EssentialsRoomBase
protected override Func<bool> IsWarmingFeedbackFunc
{
get { throw new NotImplementedException(); }
}
protected override Func<bool> IsCoolingFeedbackFunc
{
get { throw new NotImplementedException(); }
}
protected override Func<bool> OnFeedbackFunc
{
get { throw new NotImplementedException(); }
}
protected override void EndShutdown()
{
throw new NotImplementedException();
}
public override void SetDefaultLevels()
{
throw new NotImplementedException();
}
public override void PowerOnToDefaultOrLastSource()
{
throw new NotImplementedException();
}
public override bool RunDefaultPresentRoute()
{
throw new NotImplementedException();
}
public override void RoomVacatedForTimeoutPeriod(object o)
{
throw new NotImplementedException();
}
#endregion
}
}