37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace StandardScene.Chained.Loop
|
|
{
|
|
/// <summary>
|
|
/// 触发器适配器统一接口:外部设备(PLC、按钮盒、API 网关等)实现此接口并触发事件。
|
|
/// </summary>
|
|
public interface ITriggerAdapter : IDisposable
|
|
{
|
|
/// <summary>
|
|
/// 外部触发事件:Source 用于区分来源("PLC","ButtonBox","API"等),Key/Value 为业务自定义负载。
|
|
/// </summary>
|
|
event EventHandler<TriggerEventArgs> TriggerRaised;
|
|
|
|
/// <summary>
|
|
/// 可选:启动适配器(开启轮询、建立连接等)。
|
|
/// </summary>
|
|
void Start();
|
|
|
|
/// <summary>
|
|
/// 可选:停止适配器。
|
|
/// </summary>
|
|
void Stop();
|
|
}
|
|
|
|
public class TriggerEventArgs : EventArgs
|
|
{
|
|
public string Source { get; set; } = string.Empty;
|
|
public string Key { get; set; } = string.Empty;
|
|
public object Value { get; set; }
|
|
}
|
|
}
|