设备驱动修改
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Model.Model;
|
||||
@@ -6,12 +7,28 @@ using Model.Model;
|
||||
namespace DeviceCommand.Base
|
||||
{
|
||||
/// <summary>
|
||||
/// Enova3 上位机数据上报核心接口
|
||||
/// Enova3 通道数据接收事件参数
|
||||
/// </summary>
|
||||
public class EnovaChannelDataReceivedEventArgs : EventArgs
|
||||
{
|
||||
public List<EnovaChannelData> DataList { get; }
|
||||
public DateTime ReceivedTime { get; }
|
||||
|
||||
public EnovaChannelDataReceivedEventArgs(List<EnovaChannelData> dataList)
|
||||
{
|
||||
DataList = dataList ?? new List<EnovaChannelData>();
|
||||
ReceivedTime = DateTime.Now;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enova3 上位机数据上报 / 接收核心接口
|
||||
/// 既支持上位机主动推送数据到客户平台,也支持接收下位机通过 HTTP POST 上报的数据
|
||||
/// </summary>
|
||||
public interface IEnovaDataReporter
|
||||
{
|
||||
/// <summary>
|
||||
/// 客户平台接收数据的目标 HTTP URL
|
||||
/// 客户平台接收数据的目标 HTTP URL(用于主动推送)
|
||||
/// </summary>
|
||||
string TargetUrl { get; set; }
|
||||
|
||||
@@ -20,12 +37,25 @@ namespace DeviceCommand.Base
|
||||
/// </summary>
|
||||
int TimeoutMilliseconds { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 当 EnovaDataController 收到下位机 POST 上报的数据时触发
|
||||
/// </summary>
|
||||
event EventHandler<EnovaChannelDataReceivedEventArgs> ChannelDataReceived;
|
||||
|
||||
/// <summary>
|
||||
/// 异步推送通道的实时状态数据到客户平台
|
||||
/// </summary>
|
||||
/// <param name="dataList">包含各通道状态的采集数据集合</param>
|
||||
/// <param name="ct">取消令牌</param>
|
||||
/// <returns>平台服务器的响应状态</returns>
|
||||
Task<EnovaReportResponse> ReportChannelStateAsync(List<EnovaChannelReportData> dataList, CancellationToken ct = default);
|
||||
Task<ApiResponse> ReportChannelStateAsync(List<EnovaChannelData> dataList, CancellationToken ct = default);
|
||||
|
||||
/// <summary>
|
||||
/// 处理 EnovaDataController 转发过来的下位机上报数据
|
||||
/// 由 Controller 在收到 HTTP POST 后调用,内部会触发 <see cref="ChannelDataReceived"/> 事件
|
||||
/// </summary>
|
||||
/// <param name="dataList">下位机上报的通道数据集合</param>
|
||||
/// <returns>处理结果,将作为 HTTP 响应返回给下位机</returns>
|
||||
ApiResponse HandleIncomingChannelData(List<EnovaChannelData> dataList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user