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