namespace EC.Util.Port;
///
/// 串口构建类
///
public class SerialPortBuilder
{
///
///
///
///
public static YcSerialPort CreateSerialPort(SerialPortParam param)
{
return new YcSerialPort(param);
}
///
///
///
public static YcSerialPort CreateSerialPort(string comName)
{
var param = new SerialPortParam
{
ComName = comName
};
return new YcSerialPort(param);
}
///
///
///
///
///
public static YcSerialPort CreateSerialPort(string comName, int baudRate)
{
var param = new SerialPortParam
{
ComName = comName,
BaudRate = baudRate
};
return new YcSerialPort(param);
}
///
///
///
///
///
///
public static YcSerialPort CreateSerialPort(string comName, int baudRate, int receivedBytesThreshold)
{
var param = new SerialPortParam
{
ComName = comName,
BaudRate = baudRate,
ReceivedBytesThreshold = receivedBytesThreshold
};
return new YcSerialPort(param);
}
}