net.wimpi.modbus.msg
Class ExceptionResponse

java.lang.Object
  extended by net.wimpi.modbus.msg.ModbusMessageImpl
      extended by net.wimpi.modbus.msg.ModbusResponse
          extended by net.wimpi.modbus.msg.ExceptionResponse
All Implemented Interfaces:
Transportable, ModbusMessage

public class ExceptionResponse
extends ModbusResponse

Provides the aModbusResponse implementation that represents a Modbus exception.

Version:
@version@ (@date@)
Author:
Dieter Wimberger

Constructor Summary
ExceptionResponse()
          Constructs a new ExceptionResponse instance.
ExceptionResponse(int fc)
          Constructs a new ExceptionResponse instance with a given function code.
ExceptionResponse(int fc, int exc)
          Constructs a new ExceptionResponse instance with a given function code and an exception code.
 
Method Summary
 int getExceptionCode()
          Returns the Modbus exception code of this ExceptionResponse.
 void readData(DataInput din)
          Reads the subclass specific data from the given DataInput instance.
 void writeData(DataOutput dout)
          Writes the subclass specific data to the given DataOutput.
 
Methods inherited from class net.wimpi.modbus.msg.ModbusResponse
createModbusResponse
 
Methods inherited from class net.wimpi.modbus.msg.ModbusMessageImpl
getDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readFrom, setDataLength, setHeadless, setProtocolID, setTransactionID, setUnitID, writeTo
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExceptionResponse

public ExceptionResponse()
Constructs a new ExceptionResponse instance.


ExceptionResponse

public ExceptionResponse(int fc)
Constructs a new ExceptionResponse instance with a given function code. Adds the exception offset automatically.

Parameters:
fc - the function code as int.

ExceptionResponse

public ExceptionResponse(int fc,
                         int exc)
Constructs a new ExceptionResponse instance with a given function code and an exception code. The function code will be automatically increased with the exception offset.

Parameters:
fc - the function code as int.
exc - the exception code as int.
Method Detail

getExceptionCode

public int getExceptionCode()
Returns the Modbus exception code of this ExceptionResponse.

Returns:
the exception code as int.

writeData

public void writeData(DataOutput dout)
               throws IOException
Description copied from class: ModbusMessageImpl
Writes the subclass specific data to the given DataOutput.

Specified by:
writeData in class ModbusMessageImpl
Parameters:
dout - the DataOutput to be written to.
Throws:
IOException - if an I/O related error occurs.

readData

public void readData(DataInput din)
              throws IOException
Description copied from class: ModbusMessageImpl
Reads the subclass specific data from the given DataInput instance.

Specified by:
readData in class ModbusMessageImpl
Parameters:
din - the DataInput to read from.
Throws:
IOException - if an I/O related error occurs.


Copyright © 2010. All Rights Reserved.