Files
ACP/XCPCore/XCPCore/DaqListConfig.cs
T
2026-10-14 16:45:58 +08:00

86 lines
2.6 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections.Generic;
namespace XCPCore
{
/// <summary>
/// DAQ 列表配置,描述一个完整的 DAQ 采集方案
/// </summary>
public class DaqListConfig
{
/// <summary>
/// DAQ 列表编号
/// </summary>
public ushort DaqListNumber { get; set; }
/// <summary>
/// DAQ 列表模式:0x00=默认,0x01=时间戳附加,0x02=优先级,0x04=预设 DAQ 列表
/// </summary>
public byte Mode { get; set; } = 0x00;
/// <summary>
/// 事件通道编号(决定采集触发源)
/// </summary>
public ushort EventChannel { get; set; }
/// <summary>
/// 预分频值(每 N 个事件触发一次采集,0 表示每个事件都采集)
/// </summary>
public ushort Prescaler { get; set; } = 1;
/// <summary>
/// DAQ 列表是否启动(true=启动,false=停止)
/// </summary>
public bool Enable { get; set; } = true;
/// <summary>
/// ODT(Object Descriptor Table)条目列表
/// 每个 ODT 描述一组要采集的信号(地址 + 长度)
/// </summary>
public List<OdEntry> OdEntries { get; set; } = new List<OdEntry>();
}
/// <summary>
/// OD(Object Descriptor)条目,描述单个要采集的信号
/// </summary>
public class OdEntry
{
/// <summary>
/// 信号地址(从站内存地址)
/// </summary>
public uint Address { get; set; }
/// <summary>
/// 地址扩展(用于 > 32 位地址的从站)
/// </summary>
public byte AddressExtension { get; set; } = 0;
/// <summary>
/// 信号长度(字节)
/// </summary>
public byte Length { get; set; }
/// <summary>
/// 信号名称(便于上层引用,非协议字段)
/// </summary>
public string Name { get; set; } = "";
}
/// <summary>
/// XCP 协议配置模型(由 ATS 传入 XcpMaster 使用)
/// </summary>
public class XcpConfig
{
/// <summary>连接超时时间(毫秒)</summary>
public int ConnectTimeoutMs { get; set; } = 3000;
/// <summary>命令响应超时时间(毫秒)</summary>
public int CommandTimeoutMs { get; set; } = 1000;
/// <summary>
/// 地址粒度:1=BYTE,2=WORD,4=DWORD
/// 影响 SET_MTA 和 UPLOAD 等命令中地址和长度的单位
/// </summary>
public byte AddressGranularity { get; set; } = 1;
}
}