jamod at SF

net.wimpi.modbus.msg
Class ModbusRequest

java.lang.Object
  extended bynet.wimpi.modbus.msg.ModbusMessageImpl
      extended bynet.wimpi.modbus.msg.ModbusRequest
All Implemented Interfaces:
ModbusMessage, Transportable
Direct Known Subclasses:
IllegalFunctionRequest, ReadCoilsRequest, ReadInputDiscretesRequest, ReadInputRegistersRequest, ReadMultipleRegistersRequest, WriteCoilRequest, WriteMultipleCoilsRequest, WriteMultipleRegistersRequest, WriteSingleRegisterRequest

public abstract class ModbusRequest
extends ModbusMessageImpl

Abstract class implementing a ModbusRequest. This class provides specialised implementations with the functionality they have in common.

Version:
1.2rc1 (09/11/2004)
Author:
Dieter Wimberger

Constructor Summary
ModbusRequest()
           
 
Method Summary
 ModbusResponse createExceptionResponse(int EXCEPTION_CODE)
          Factory method for creating exception responses with the given exception code.
static ModbusRequest createModbusRequest(int functionCode)
          Factory method creating the required specialized ModbusRequest instance.
abstract  ModbusResponse createResponse()
          Returns the ModbusResponse that represents the answer to this ModbusRequest.
 
Methods inherited from class net.wimpi.modbus.msg.ModbusMessageImpl
getDataLength, getFunctionCode, getHexMessage, getOutputLength, getProtocolID, getTransactionID, getUnitID, isHeadless, readData, readFrom, setDataLength, setFunctionCode, setHeadless, setHeadless, setProtocolID, setTransactionID, setUnitID, writeData, writeTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModbusRequest

public ModbusRequest()
Method Detail

createResponse

public abstract ModbusResponse createResponse()
Returns the ModbusResponse that represents the answer to this ModbusRequest.

The implementation should take care about assembling the reply to this ModbusRequest.

Returns:
the corresponding ModbusResponse.

createExceptionResponse

public ModbusResponse createExceptionResponse(int EXCEPTION_CODE)
Factory method for creating exception responses with the given exception code.

Parameters:
EXCEPTION_CODE - the code of the exception.
Returns:
a ModbusResponse instance representing the exception response.

createModbusRequest

public static ModbusRequest createModbusRequest(int functionCode)
Factory method creating the required specialized ModbusRequest instance.

Parameters:
functionCode - the function code of the request as int.
Returns:
a ModbusRequest instance specific for the given function type.

jamod at SF

Copyright © 2002-2004 jamod development team.