Ejemplo n.º 1
0
        public void ResponseBytesToReadCoilsNoData()
        {
            var transport = new ModbusRtuTransport(StreamResource, Factory, NullModbusLogger.Instance);

            byte[] frameStart = { 0x11, 0x01, 0x00, 0x00, 0x00 };
            Assert.Equal(1, transport.ResponseBytesToRead(frameStart));
        }
Ejemplo n.º 2
0
        public void ResponseBytesToReadInvalidFunctionCode()
        {
            var transport = new ModbusRtuTransport(StreamResource, Factory, NullModbusLogger.Instance);

            byte[] frame = { 0x11, 0x16, 0x00, 0x01, 0x00, 0x02, 0x04 };
            Assert.Throws <NotImplementedException>(() => transport.ResponseBytesToRead(frame));
        }
Ejemplo n.º 3
0
        public void ResponseBytesToReadSlaveException()
        {
            var transport = new ModbusRtuTransport(StreamResource, Factory, NullModbusLogger.Instance);

            byte[] frameStart = { 0x01, Modbus.ExceptionOffset + 1, 0x01 };
            Assert.Equal(1, transport.ResponseBytesToRead(frameStart));
        }
Ejemplo n.º 4
0
        public void ResponseBytesToReadDiagnostics()
        {
            var transport = new ModbusRtuTransport(StreamResource, Factory, NullModbusLogger.Instance);

            byte[] frameStart = { 0x01, 0x08, 0x00, 0x00 };
            Assert.Equal(4, transport.ResponseBytesToRead(frameStart));
        }
Ejemplo n.º 5
0
        public void ResponseBytesToReadWriteCoilsResponse()
        {
            var transport = new ModbusRtuTransport(StreamResource, Factory, NullModbusLogger.Instance);

            byte[] frameStart = { 0x11, 0x0F, 0x00, 0x13, 0x00, 0x0A, 0, 0 };
            Assert.Equal(4, transport.ResponseBytesToRead(frameStart));
        }
Ejemplo n.º 6
0
        public void ResponseBytesToReadCoils()
        {
            var transport = new ModbusRtuTransport(StreamResource, Factory, NullModbusLogger.Instance);

            byte[] frameStart = { 0x11, 0x01, 0x05, 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
            Assert.Equal(6, transport.ResponseBytesToRead(frameStart));
        }
Ejemplo n.º 7
0
 public void ResponseBytesToReadCoilsNoData()
 {
     byte[] frameStart = { 0x11, 0x01, 0x00, 0x00, 0x00 };
     Assert.Equal(1, ModbusRtuTransport.ResponseBytesToRead(frameStart));
 }
Ejemplo n.º 8
0
 public void ResponseBytesToReadCoils()
 {
     byte[] frameStart = { 0x11, 0x01, 0x05, 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
     Assert.Equal(6, ModbusRtuTransport.ResponseBytesToRead(frameStart));
 }
 public void ResponseBytesToReadInvalidFunctionCode()
 {
     byte[] frame = { 0x11, 0x16, 0x00, 0x01, 0x00, 0x02, 0x04 };
     ModbusRtuTransport.ResponseBytesToRead <ReadCoilsInputsResponse>(frame, null);
     Assert.Fail();
 }
Ejemplo n.º 10
0
 public void ResponseBytesToReadSlaveException()
 {
     byte[] frameStart = { 0x01, Modbus.ExceptionOffset + 1, 0x01 };
     Assert.AreEqual(1, ModbusRtuTransport.ResponseBytesToRead <ReadCoilsInputsResponse>(frameStart, null));
 }
Ejemplo n.º 11
0
 public void ResponseBytesToReadDiagnostics()
 {
     byte[] frameStart = { 0x01, 0x08, 0x00, 0x00 };
     Assert.AreEqual(4, ModbusRtuTransport.ResponseBytesToRead <DiagnosticsRequestResponse>(frameStart, null));
 }
Ejemplo n.º 12
0
 public void ResponseBytesToReadSlaveException()
 {
     byte[] frameStart = { 0x01, Modbus.ExceptionOffset + 1, 0x01 };
     Assert.Equal(1, ModbusRtuTransport.ResponseBytesToRead(frameStart));
 }
Ejemplo n.º 13
0
 public void ResponseBytesToReadCoils()
 {
     byte[] frameStart = { 0x11, 0x01, 0x05, 0xCD, 0x6B, 0xB2, 0x0E, 0x1B };
     Assert.AreEqual(6, ModbusRtuTransport.ResponseBytesToRead <ReadCoilsInputsResponse>(frameStart, null));
 }
Ejemplo n.º 14
0
 public void ResponseBytesToReadInvalidFunctionCode()
 {
     byte[] frame = { 0x11, 0x16, 0x00, 0x01, 0x00, 0x02, 0x04 };
     ModbusRtuTransport.ResponseBytesToRead(frame);
     Assert.Fail();
 }
Ejemplo n.º 15
0
 public void ResponseBytesToReadWriteCoilsResponse()
 {
     byte[] frameStart = { 0x11, 0x0F, 0x00, 0x13, 0x00, 0x0A, 0, 0 };
     Assert.Equal(4, ModbusRtuTransport.ResponseBytesToRead(frameStart));
 }
Ejemplo n.º 16
0
 public void ResponseBytesToReadDiagnostics()
 {
     byte[] frameStart = { 0x01, 0x08, 0x00, 0x00 };
     Assert.Equal(4, ModbusRtuTransport.ResponseBytesToRead(frameStart));
 }
Ejemplo n.º 17
0
 public void ResponseBytesToReadCoilsNoData()
 {
     byte[] frameStart = { 0x11, 0x01, 0x00, 0x00, 0x00 };
     Assert.AreEqual(1, ModbusRtuTransport.ResponseBytesToRead <ReadCoilsInputsResponse>(frameStart, null));
 }
Ejemplo n.º 18
0
 public void ResponseBytesToReadInvalidFunctionCode()
 {
     byte[] frame = { 0x11, 0x16, 0x00, 0x01, 0x00, 0x02, 0x04 };
     Assert.Throws <NotImplementedException>(() => ModbusRtuTransport.ResponseBytesToRead(frame));
 }
Ejemplo n.º 19
0
 public void ResponseBytesToReadWriteCoilsResponse()
 {
     byte[] frameStart = { 0x11, 0x0F, 0x00, 0x13, 0x00, 0x0A, 0, 0 };
     Assert.AreEqual(4, ModbusRtuTransport.ResponseBytesToRead <ReadCoilsInputsResponse>(frameStart, null));
 }