Sic.Framework-Nanjing-Baishi/MECF.Framework.Common/MECF/Framework/Common/Device/Bases/STBlinkPattern.cs

66 lines
1.8 KiB
C#
Raw Normal View History

using System;
using System.Diagnostics;
using System.Runtime.Serialization;
namespace MECF.Framework.Common.Device.Bases;
/// <summary>
/// 信号灯塔元件闪烁模式。
/// </summary>
[Serializable]
[DataContract]
public class STBlinkPattern
{
#region Constructors
/// <summary>
/// 构造信号灯元件闪烁模式。
/// <para>如果未指定闪烁模式则默认1s闪一次一直闪。</para>
/// </summary>
public STBlinkPattern()
{
TotalCycles = 0;
OnMilliSec = 1000;
OffMilliSec = 1000;
}
/// <summary>
/// 创建信号灯塔元件闪烁模式对象的实例。
/// </summary>
/// <param name="totalCycles">总循环次数0或负值表示无限循环。</param>
/// <param name="onMilliSec">打开状态的保持时长,单位毫秒。</param>
/// <param name="offMilliSec">关闭状态的保持时长,单位毫秒。</param>
public STBlinkPattern(uint totalCycles, uint onMilliSec, uint offMilliSec)
{
Debug.Assert(onMilliSec > 0, "duration ON must be greater than 0.");
Debug.Assert(offMilliSec > 0, "duration OFF must be greater than 0.");
TotalCycles = totalCycles;
OnMilliSec = onMilliSec;
OffMilliSec = offMilliSec;
}
#endregion
#region Properties
/// <summary>
/// 设置或返回总循环次数。
/// </summary>
[DataMember]
public uint TotalCycles { get; set; }
/// <summary>
/// 设置或返回打开状态的保持时长。
/// </summary>
[DataMember]
public uint OnMilliSec { get; set; }
/// <summary>
/// 设置或返回关闭状态的保持时长。
/// </summary>
[DataMember]
public uint OffMilliSec { get; set; }
#endregion
}