using DeviceCommand.Base;
using System;
using System.Collections.Generic;
using System.IO.Ports;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BenchMovementModule.HardwareDrive
{
    public class GantryControlRtu : GantryControlBase
    {
        // 暴露出底层的 ModbusRtu 实例以便修改串口配置
        public ModbusRtu RtuDevice => (ModbusRtu)_device;

        public GantryControlRtu(string portName, int baudRate = 9600, byte slaveAddress = 1)
            : base(new ModbusRtu(), slaveAddress)
        {
            RtuDevice.ConfigureDevice(portName, baudRate);
        }

        public GantryControlRtu(string portName, int baudRate, int dataBits, StopBits stopBits, Parity parity, byte slaveAddress = 1)
            : base(new ModbusRtu(), slaveAddress)
        {
            RtuDevice.ConfigureDevice(portName, baudRate, dataBits, stopBits, parity);
        }
    }
}
