ExtendAttribute.cs 957 Bytes
using Rcs.Domain.Entities;

namespace Rcs.Domain.Attributes;

/// <summary>
/// 用于标注协议名称和版本的特性
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
public sealed class ProtocolInfoAttribute : Attribute
{
    /// <summary>
    /// 协议名称
    /// </summary>
    public string Manufacturer { get; }

    /// <summary>
    /// 协议版本
    /// </summary>
    public string Version { get; }
    /// <summary>
    /// 协议主题
    /// </summary>
    public string Topic { get; set; }
    /// <summary>
    /// 设备类型
    /// </summary>
    public RobotType RobotType { get; set; }

    public ProtocolInfoAttribute(string protocolName, string version, string topic, RobotType robotType = RobotType.Forklift)
    {
        Manufacturer = protocolName;
        Version = version;
        Topic = topic;
        RobotType = robotType;
    }
}