|
|
@ -15,7 +15,7 @@ namespace NDSD_Screwdriver.Tool
|
|
|
|
{
|
|
|
|
{
|
|
|
|
SerialPortClient clientSerialPortClient = new SerialPortClient();
|
|
|
|
SerialPortClient clientSerialPortClient = new SerialPortClient();
|
|
|
|
private IWaitingClient<ISerialPortClient, IReceiverResult> waitClient;
|
|
|
|
private IWaitingClient<ISerialPortClient, IReceiverResult> waitClient;
|
|
|
|
public SerialPortFactory(string portName="COM13")
|
|
|
|
public SerialPortFactory(string portName)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
clientSerialPortClient.Connecting = (client, e) => EasyTask.CompletedTask;//即将连接到端口
|
|
|
|
clientSerialPortClient.Connecting = (client, e) => EasyTask.CompletedTask;//即将连接到端口
|
|
|
|
clientSerialPortClient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
|
|
|
|
clientSerialPortClient.Connected = (client, e) => { return EasyTask.CompletedTask; };//成功连接到端口
|
|
|
@ -25,7 +25,7 @@ namespace NDSD_Screwdriver.Tool
|
|
|
|
BaudRate = 115200, //波特率
|
|
|
|
BaudRate = 115200, //波特率
|
|
|
|
DataBits = 8, //数据位
|
|
|
|
DataBits = 8, //数据位
|
|
|
|
Parity = System.IO.Ports.Parity.None, //校验位
|
|
|
|
Parity = System.IO.Ports.Parity.None, //校验位
|
|
|
|
PortName = "COM13", //COM
|
|
|
|
PortName =portName,
|
|
|
|
StopBits = System.IO.Ports.StopBits.One //停止位
|
|
|
|
StopBits = System.IO.Ports.StopBits.One //停止位
|
|
|
|
}).SetSerialDataHandlingAdapter(() => new MyFixedHeaderCustomDataHandlingAdapter()));
|
|
|
|
}).SetSerialDataHandlingAdapter(() => new MyFixedHeaderCustomDataHandlingAdapter()));
|
|
|
|
|
|
|
|
|