mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-08-31 19:08:29 +00:00
Refator: Refactor timer implementation across multiple classes to use System.Timers.Timer instead of CTimer for improved consistency and performance.
- Updated RelayControlledShade to utilize Timer for output pulsing. - Refactored MockVC to replace CTimer with Timer for call status simulation. - Modified VideoCodecBase to enhance documentation and improve feedback handling. - Removed obsolete IHasCamerasMessenger and updated related classes to use IHasCamerasWithControls. - Adjusted PressAndHoldHandler to implement Timer for button hold actions. - Enhanced logging throughout MobileControl and RoomBridges for better debugging and information tracking. - Cleaned up unnecessary comments and improved exception handling in various classes.
This commit is contained in:
parent
b4d53dbe0e
commit
7076eafc21
56 changed files with 1343 additions and 2197 deletions
|
|
@ -1,4 +1,4 @@
|
|||
using Crestron.SimplSharp;
|
||||
using System.Timers;
|
||||
namespace PepperDash.Essentials.Core
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -20,7 +20,7 @@ namespace PepperDash.Essentials.Core
|
|||
/// Gets or sets the Feedback
|
||||
/// </summary>
|
||||
public BoolFeedback Feedback { get; private set; }
|
||||
CTimer Timer;
|
||||
Timer Timer;
|
||||
|
||||
bool _BoolValue;
|
||||
|
||||
|
|
@ -51,16 +51,22 @@ namespace PepperDash.Essentials.Core
|
|||
{
|
||||
_BoolValue = true;
|
||||
Feedback.FireUpdate();
|
||||
Timer = new CTimer(o =>
|
||||
Timer = new Timer(TimeoutMs) { AutoReset = false };
|
||||
Timer.Elapsed += (s, e) =>
|
||||
{
|
||||
_BoolValue = false;
|
||||
Feedback.FireUpdate();
|
||||
Timer = null;
|
||||
}, TimeoutMs);
|
||||
};
|
||||
Timer.Start();
|
||||
}
|
||||
// Timer is running, if retrigger is set, reset it.
|
||||
else if (CanRetrigger)
|
||||
Timer.Reset(TimeoutMs);
|
||||
{
|
||||
Timer.Stop();
|
||||
Timer.Interval = TimeoutMs;
|
||||
Timer.Start();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -69,7 +75,11 @@ namespace PepperDash.Essentials.Core
|
|||
public void Cancel()
|
||||
{
|
||||
if (Timer != null)
|
||||
Timer.Reset(0);
|
||||
{
|
||||
Timer.Stop();
|
||||
Timer.Interval = 1;
|
||||
Timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,8 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Crestron.SimplSharp;
|
||||
using Crestron.SimplSharpPro;
|
||||
using System.Timers;
|
||||
namespace PepperDash.Essentials.Core;
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -21,7 +20,7 @@ namespace PepperDash.Essentials.Core;
|
|||
/// Gets the Feedback
|
||||
/// </summary>
|
||||
public BoolFeedback Feedback { get; private set; }
|
||||
CTimer Timer;
|
||||
Timer Timer;
|
||||
|
||||
/// <summary>
|
||||
/// When set to true, will cause Feedback to go high, and cancel the timer.
|
||||
|
|
@ -49,7 +48,11 @@ namespace PepperDash.Essentials.Core;
|
|||
else
|
||||
{
|
||||
if (Timer == null)
|
||||
Timer = new CTimer(o => ClearFeedback(), TimeoutMs);
|
||||
{
|
||||
Timer = new Timer(TimeoutMs) { AutoReset = false };
|
||||
Timer.Elapsed += (s, e) => ClearFeedback();
|
||||
Timer.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue