CJT188ReadFromCoreServer 方法 (Byte) |
将二进制的数据发送到管道中去,然后从管道里接收二进制的数据回来,并返回是否成功的结果对象。
Send binary data to the pipeline, and then receive binary data back from the pipeline, and return whether the success of the result object
命名空间:
HslCommunication.Instrument.CJT
程序集:
HslCommunication (在 HslCommunication.dll 中) 版本:12.1.2.0 (12.1.2.0)
语法 public override OperateResult<byte[]> ReadFromCoreServer(
byte[] send
)
Public Overrides Function ReadFromCoreServer (
send As Byte()
) As OperateResult(Of Byte())
public:
virtual OperateResult<array<unsigned char>^>^ ReadFromCoreServer(
array<unsigned char>^ send
) override
abstract ReadFromCoreServer :
send : byte[] -> OperateResult<byte[]>
override ReadFromCoreServer :
send : byte[] -> OperateResult<byte[]>
参数
- send
- 类型:SystemByte
发送的完整的报文信息
返回值
类型:
OperateResultByte接收的完整的报文信息
实现
IReadWriteDeviceReadFromCoreServer(Byte)备注
本方法用于实现本组件还未实现的一些报文功能,例如有些modbus服务器会有一些特殊的功能码支持,需要收发特殊的报文,详细请看示例
示例
此处举例有个modbus服务器,有个特殊的功能码0x09,后面携带子数据0x01即可,发送字节为 0x00 0x00 0x00 0x00 0x00 0x03 0x01 0x09 0x01
ModbusTcpNet modbus = new ModbusTcpNet( "192.168.0.100" );
OperateResult<byte[]> read = modbus.ReadFromCoreServer( SoftBasic.HexStringToBytes( "0x00 0x00 0x00 0x00 0x00 0x03 0x01 0x09 0x01" ) );
if (read.IsSuccess)
{
Console.WriteLine( SoftBasic.ByteToHexString( read.Content, ' ' ) );
}
else
{
}
参见