/// <summary> /// /// </summary> /// <param name="key"></param> public SecondsCountdownTimer(string key) { Key = key; IsRunningFeedback = new BoolFeedback(() => _IsRunning); TimeRemainingFeedback = new StringFeedback(() => { // Need to handle up and down here. if (StartTime == null || FinishTime == null) { return(""); } var timeSpan = FinishTime - DateTime.Now; return(Math.Round(timeSpan.TotalSeconds).ToString()); }); PercentFeedback = new IntFeedback(() => { if (StartTime == null || FinishTime == null) { return(0); } double percent = (FinishTime - DateTime.Now).TotalSeconds / (FinishTime - StartTime).TotalSeconds * 100; return((int)percent); }); }
public VideoStatusOutputs(VideoStatusFuncsWrapper funcs) { HasVideoStatusFeedback = new BoolFeedback("HasVideoStatusFeedback", funcs.HasVideoStatusFunc); HdcpActiveFeedback = new BoolFeedback("HdcpActiveFeedback", funcs.HdcpActiveFeedbackFunc); HdcpStateFeedback = new StringFeedback("HdcpStateFeedback", funcs.HdcpStateFeedbackFunc); VideoResolutionFeedback = new StringFeedback("VideoResolutionFeedback", funcs.VideoResolutionFeedbackFunc); VideoSyncFeedback = new BoolFeedback("VideoSyncFeedback", funcs.VideoSyncFeedbackFunc); }
protected DisplayBase(string key, string name) : base(key, name) { PowerIsOnFeedback = new BoolFeedback("PowerOnFeedback", PowerIsOnFeedbackFunc); IsCoolingDownFeedback = new BoolFeedback("IsCoolingDown", IsCoolingDownFeedbackFunc); IsWarmingUpFeedback = new BoolFeedback("IsWarmingUp", IsWarmingUpFeedbackFunc); InputPorts = new RoutingPortCollection <RoutingInputPort>(); PowerIsOnFeedback.OutputChange += PowerIsOnFeedback_OutputChange; }
public void RemoveOutputIn(BoolFeedback output) { // Don't double up outputs if (OutputsIn.Contains(output)) { return; } OutputsIn.Remove(output); output.OutputChange -= AnyInput_OutputChange; Evaluate(); }
protected CrestronGenericBaseDevice(string key, string name, GenericBase hardware) : base(key, name) { Feedbacks = new FeedbackCollection <Feedback>(); Hardware = hardware; IsOnline = new BoolFeedback("IsOnlineFeedback", () => Hardware.IsOnline); IsRegistered = new BoolFeedback("IsRegistered", () => Hardware.Registered); IpConnectionsText = new StringFeedback("IpConnectionsText", () => Hardware.ConnectedIpList != null ? string.Join(",", Hardware.ConnectedIpList.Select(cip => cip.DeviceIpAddress).ToArray()) : string.Empty); AddToFeedbackList(IsOnline, IpConnectionsText); CommunicationMonitor = new CrestronGenericBaseCommunicationMonitor(this, hardware, 120000, 300000); }
public StatusMonitorBase(IKeyed parent, long warningTime, long errorTime) { Parent = parent; if (warningTime > errorTime) { throw new ArgumentException("warningTime must be less than errorTime"); } if (warningTime < 5000 || errorTime < 5000) { throw new ArgumentException("time values cannot be less that 5000 ms"); } IsOnlineFeedback = new BoolFeedback(() => { return(IsOnline); }); Status = MonitorStatus.StatusUnknown; WarningTime = warningTime; ErrorTime = errorTime; }
public MockDisplay(string key, string name) : base(key, name) { HdmiIn1 = new RoutingInputPort(RoutingPortNames.HdmiIn1, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this); HdmiIn2 = new RoutingInputPort(RoutingPortNames.HdmiIn2, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this); HdmiIn3 = new RoutingInputPort(RoutingPortNames.HdmiIn3, eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, null, this); ComponentIn1 = new RoutingInputPort(RoutingPortNames.ComponentIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Component, null, this); VgaIn1 = new RoutingInputPort(RoutingPortNames.VgaIn, eRoutingSignalType.Video, eRoutingPortConnectionType.Composite, null, this); InputPorts.AddRange(new[] { HdmiIn1, HdmiIn2, HdmiIn3, ComponentIn1, VgaIn1 }); VolumeLevelFeedback = new IntFeedback(() => { return(_FakeVolumeLevel); }); MuteFeedback = new BoolFeedback("MuteOn", () => _IsMuted); }
public EssentialsRoomBase(DeviceConfig config) : base(config) { // Setup the ShutdownPromptTimer ShutdownPromptTimer = new SecondsCountdownTimer(Key + "-offTimer"); ShutdownPromptTimer.IsRunningFeedback.OutputChange += (o, a) => { if (!ShutdownPromptTimer.IsRunningFeedback.BoolValue) { ShutdownType = eShutdownType.None; } }; ShutdownPromptTimer.HasFinished += (o, a) => Shutdown(); // Shutdown is triggered ShutdownPromptSeconds = 60; ShutdownVacancySeconds = 120; ShutdownType = eShutdownType.None; RoomVacancyShutdownTimer = new SecondsCountdownTimer(Key + "-vacancyOffTimer"); //RoomVacancyShutdownTimer.IsRunningFeedback.OutputChange += (o, a) => //{ // if (!RoomVacancyShutdownTimer.IsRunningFeedback.BoolValue) // ShutdownType = ShutdownType.Vacancy; //}; RoomVacancyShutdownTimer.HasFinished += new EventHandler <EventArgs>(RoomVacancyShutdownPromptTimer_HasFinished); // Shutdown is triggered RoomVacancyShutdownPromptSeconds = 1500; // 25 min to prompt warning RoomVacancyShutdownSeconds = 240; // 4 min after prompt will trigger shutdown prompt VacancyMode = eVacancyMode.None; OnFeedback = new BoolFeedback(OnFeedbackFunc); IsWarmingUpFeedback = new BoolFeedback(IsWarmingFeedbackFunc); IsCoolingDownFeedback = new BoolFeedback(IsCoolingFeedbackFunc); AddPostActivationAction(() => { if (RoomOccupancy != null) { OnRoomOccupancyIsSet(); } }); }
/// <summary> /// Constructor /// </summary> /// <param name="key"></param> public SecondsCountdownTimer(string key) { Key = key; IsRunningFeedback = new BoolFeedback(() => _IsRunning); TimeRemainingFeedback = new StringFeedback(() => { // Need to handle up and down here. if (StartTime == null || FinishTime == null) { return(""); } var timeSpan = FinishTime - DateTime.Now; if (timeSpan.TotalSeconds < 60) { return(Math.Round(timeSpan.TotalSeconds).ToString()); } else { Debug.Console(2, this, "timeSpan.Minutes == {0}, timeSpan.Seconds == {1}", timeSpan.Minutes, timeSpan.Seconds); return(String.Format("{0:D2}:{1:D2}", timeSpan.Minutes, timeSpan.Seconds)); } }); PercentFeedback = new IntFeedback(() => { if (StartTime == null || FinishTime == null) { return(0); } double percent = (FinishTime - DateTime.Now).TotalSeconds / (FinishTime - StartTime).TotalSeconds * 100; return((int)percent); }); }
/// <summary> /// Constructor /// </summary> /// <param name="timeoutMs">The time which the true state will be extended after set to false</param> public BoolFeedbackPulseExtender(uint timeoutMs) { TimeoutMs = timeoutMs; Feedback = new BoolFeedback(() => this.BoolValue); }
/// <summary> /// Create a retriggerable one shot by setting canRetrigger true /// </summary> public BoolFeedbackPulse(uint timeoutMs, bool canRetrigger) { TimeoutMs = timeoutMs; CanRetrigger = canRetrigger; Feedback = new BoolFeedback(() => _BoolValue); }
public InUseTracking() { InUseFeedback = new BoolFeedback(() => _Users.Count > 0); InUseCountFeedback = new IntFeedback(() => _Users.Count); }
public BoolFeedbackLogic() { Output = new BoolFeedback(() => ComputedValue); }