点击或拖拽改变大小

SerialBaseReadFromCoreServer 方法 (SerialPort, Byte, Boolean, Boolean)

将数据发送到当前的串口通道上去,并且从串口通道接收一串原始的字节报文,默认对方必须返回数据,也可以手动修改不返回数据信息。
Send data to the current serial channel, and receive a string of original byte messages from the serial channel. By default, the other party must return data, or you can manually modify it to not return data information.

命名空间:  HslCommunication.Serial
程序集:  HslCommunication (在 HslCommunication.dll 中) 版本:11.8.2.0 (11.8.2.0)
语法
public virtual OperateResult<byte[]> ReadFromCoreServer(
	SerialPort sp,
	byte[] send,
	bool hasResponseData = true,
	bool usePackAndUnpack = true
)

参数

sp
类型:System.IO.PortsSerialPort
指定的串口通信对象,最终将使用该串口进行数据的收发
send
类型:SystemByte
发送到串口的报文数据信息,如果usePackAndUnpackTrue,那么就使用PackCommandWithHeader(Byte)方法打包发送的报文信息。
hasResponseData (Optional)
类型:SystemBoolean
是否等待数据的返回,默认为 True
usePackAndUnpack (Optional)
类型:SystemBoolean
是否需要对命令重新打包,在重写PackCommandWithHeader(Byte)方法后才会有影响

返回值

类型:OperateResultByte
接收的完整的报文信息
参见