fixes to get it to load

This commit is contained in:
Andrew Welker
2020-12-07 16:32:06 -07:00
parent 43d7fab04d
commit 9c4650b4af
4 changed files with 35 additions and 22 deletions

View File

@@ -31,7 +31,7 @@ namespace PepperDash.Essentials.Room.Config
{ {
return new EssentialsHuddleVtc1Room(roomConfig); return new EssentialsHuddleVtc1Room(roomConfig);
} }
if (typeName == "ddvc01Bridge") if (typeName == "ddvc01bridge")
{ {
return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing. return new Device(roomConfig.Key, roomConfig.Name); // placeholder device that does nothing.
} }
@@ -40,7 +40,7 @@ namespace PepperDash.Essentials.Room.Config
return new EssentialsDualDisplayRoom(roomConfig); return new EssentialsDualDisplayRoom(roomConfig);
} }
return typeName != "techRoom" ? null : new EssentialsTechRoom(roomConfig); return typeName != "techroom" ? null : new EssentialsTechRoom(roomConfig);
} }
/// <summary> /// <summary>

View File

@@ -1,22 +1,33 @@
using System.Collections.Generic; using System.Collections.Generic;
using Newtonsoft.Json;
namespace PepperDash.Essentials.Room.Config namespace PepperDash.Essentials.Room.Config
{ {
public class EssentialsTechRoomConfig public class EssentialsTechRoomConfig
{ {
[JsonProperty("displays")]
public List<string> Displays; public List<string> Displays;
[JsonProperty("tuners")]
public List<string> Tuners; public List<string> Tuners;
public string ScheduleProviderKey;
[JsonProperty("userPin")]
public string UserPin; public string UserPin;
[JsonProperty("techPin")]
public string TechPin; public string TechPin;
[JsonProperty("presetFileName")]
public string PresetsFileName; public string PresetsFileName;
public List<ScheduledEventConfig> RoomScheduledEvents;
[JsonProperty("scheduledEvents")]
public List<ScheduledEventConfig> ScheduledEvents;
public EssentialsTechRoomConfig() public EssentialsTechRoomConfig()
{ {
Displays = new List<string>(); Displays = new List<string>();
Tuners = new List<string>(); Tuners = new List<string>();
RoomScheduledEvents = new List<ScheduledEventConfig>(); ScheduledEvents = new List<ScheduledEventConfig>();
} }
} }
} }

View File

@@ -74,7 +74,7 @@ namespace PepperDash.Essentials
private void CreateOrUpdateScheduledEvents() private void CreateOrUpdateScheduledEvents()
{ {
var eventsConfig = _config.RoomScheduledEvents; var eventsConfig = _config.ScheduledEvents;
GetOrCreateScheduleGroup(); GetOrCreateScheduleGroup();
@@ -127,11 +127,11 @@ namespace PepperDash.Essentials
{ {
//update config based on key of scheduleEvent //update config based on key of scheduleEvent
GetOrCreateScheduleGroup(); GetOrCreateScheduleGroup();
var existingEvent = _config.RoomScheduledEvents.FirstOrDefault(e => e.Key == scheduledEvent.Key); var existingEvent = _config.ScheduledEvents.FirstOrDefault(e => e.Key == scheduledEvent.Key);
if (existingEvent == null) if (existingEvent == null)
{ {
_config.RoomScheduledEvents.Add(scheduledEvent); _config.ScheduledEvents.Add(scheduledEvent);
} }
//create or update event based on config //create or update event based on config
@@ -144,7 +144,7 @@ namespace PepperDash.Essentials
OnScheduledEventUpdate(); OnScheduledEventUpdate();
} }
public void OnScheduledEventUpdate() private void OnScheduledEventUpdate()
{ {
var handler = ScheduledEventsChanged; var handler = ScheduledEventsChanged;
@@ -153,14 +153,14 @@ namespace PepperDash.Essentials
return; return;
} }
handler(this, new ScheduledEventEventArgs {ScheduledEvents = _config.RoomScheduledEvents}); handler(this, new ScheduledEventEventArgs {ScheduledEvents = _config.ScheduledEvents});
} }
public event EventHandler<ScheduledEventEventArgs> ScheduledEventsChanged; public event EventHandler<ScheduledEventEventArgs> ScheduledEventsChanged;
private void HandleScheduledEvent(ScheduledEvent schevent, ScheduledEventCommon.eCallbackReason type) private void HandleScheduledEvent(ScheduledEvent schevent, ScheduledEventCommon.eCallbackReason type)
{ {
var eventConfig = _config.RoomScheduledEvents.FirstOrDefault(e => e.Key == schevent.Name); var eventConfig = _config.ScheduledEvents.FirstOrDefault(e => e.Key == schevent.Name);
if (eventConfig == null) if (eventConfig == null)
{ {
@@ -221,42 +221,42 @@ namespace PepperDash.Essentials
protected override Func<bool> IsWarmingFeedbackFunc protected override Func<bool> IsWarmingFeedbackFunc
{ {
get { throw new NotImplementedException(); } get { return () => false; }
} }
protected override Func<bool> IsCoolingFeedbackFunc protected override Func<bool> IsCoolingFeedbackFunc
{ {
get { throw new NotImplementedException(); } get { return () => false; }
} }
protected override Func<bool> OnFeedbackFunc protected override Func<bool> OnFeedbackFunc
{ {
get { throw new NotImplementedException(); } get { return () => RoomPowerIsOn; }
} }
protected override void EndShutdown() protected override void EndShutdown()
{ {
throw new NotImplementedException();
} }
public override void SetDefaultLevels() public override void SetDefaultLevels()
{ {
throw new NotImplementedException();
} }
public override void PowerOnToDefaultOrLastSource() public override void PowerOnToDefaultOrLastSource()
{ {
throw new NotImplementedException();
} }
public override bool RunDefaultPresentRoute() public override bool RunDefaultPresentRoute()
{ {
throw new NotImplementedException(); return false;
} }
public override void RoomVacatedForTimeoutPeriod(object o) public override void RoomVacatedForTimeoutPeriod(object o)
{ {
throw new NotImplementedException();
} }
#endregion #endregion

View File

@@ -175,13 +175,15 @@ namespace PepperDash.Essentials.Core
scheduledEvent.DateAndTime.SetFirstDayOfWeek(ScheduledEventCommon.eFirstDayOfWeek.Sunday); scheduledEvent.DateAndTime.SetFirstDayOfWeek(ScheduledEventCommon.eFirstDayOfWeek.Sunday);
scheduledEvent.Recurrence.Weekly(config.Days);
var eventTime = DateTime.Parse(config.Time); var eventTime = DateTime.Parse(config.Time);
if (DateTime.Now < eventTime) eventTime.AddDays(1); if (DateTime.Now > eventTime) eventTime = eventTime.AddDays(1);
scheduledEvent.DateAndTime.SetAbsoluteEventTime(eventTime); scheduledEvent.DateAndTime.SetAbsoluteEventTime(eventTime);
scheduledEvent.Recurrence.Weekly(config.Days);
} }
} }
} }