using System;
|
using System.Collections.Generic;
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
namespace Plugin.DeviceDebug.Entity
|
{
|
/// <summary>
|
/// 调试命令基类
|
/// </summary>
|
public partial class DebugCommand : ObservableObject
|
{
|
public DebugCommand()
|
{
|
CommandId = Guid.NewGuid().ToString();
|
CreatedAt = DateTime.Now;
|
Parameters = new Dictionary<string, object>();
|
}
|
|
[ObservableProperty] private string _commandId = string.Empty;
|
[ObservableProperty] private string _commandType = string.Empty;
|
[ObservableProperty] private string _deviceId = string.Empty;
|
[ObservableProperty] private int _channel;
|
[ObservableProperty] private Dictionary<string, object> _parameters = new();
|
[ObservableProperty] private DateTime _createdAt = DateTime.Now;
|
}
|
|
/// <summary>
|
/// 电源设置命令
|
/// </summary>
|
public class PowerSetCommand : DebugCommand
|
{
|
public PowerSetCommand() { CommandType = "PowerSet"; }
|
public double Voltage { get; set; }
|
public double CurrentLimit { get; set; }
|
public bool Output { get; set; }
|
}
|
|
/// <summary>
|
/// 电源测量命令
|
/// </summary>
|
public class PowerMeasureCommand : DebugCommand
|
{
|
public PowerMeasureCommand() { CommandType = "PowerMeasure"; }
|
}
|
|
/// <summary>
|
/// CAN发送命令
|
/// </summary>
|
public class CanSendCommand : DebugCommand
|
{
|
public CanSendCommand() { CommandType = "CanSend"; }
|
public string Frame { get; set; } = string.Empty;
|
public byte[] Data { get; set; } = Array.Empty<byte>();
|
}
|
|
/// <summary>
|
/// PLC写入命令
|
/// </summary>
|
public class PlcWriteCommand : DebugCommand
|
{
|
public PlcWriteCommand() { CommandType = "PlcWrite"; }
|
public string IoAddress { get; set; } = string.Empty;
|
public bool Value { get; set; }
|
}
|
}
|