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