net.wimpi.modbus
Class ModbusCoupler

java.lang.Object
  extended by net.wimpi.modbus.ModbusCoupler

public class ModbusCoupler
extends Object

Class implemented following a Singleton pattern, to couple the slave side with a master side or with a device.

At the moment it only provides a reference to the OO model of the process image.

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

Method Summary
 ProcessImage getProcessImage()
          Returns a reference to the ProcessImage of this ModbusCoupler.
 ProcessImageFactory getProcessImageFactory()
          Returns the actual ProcessImageFactory instance.
static ModbusCoupler getReference()
          Returns a reference to the singleton instance.
 int getUnitID()
          Returns the identifier of this unit.
 boolean isMaster()
          Tests if this instance is a master device.
 boolean isSlave()
          Tests if this instance is not a master device.
 void setMaster(boolean master)
          Sets this instance to be or not to be a master device.
 void setProcessImage(ProcessImage procimg)
          Sets the reference to the ProcessImage of this ModbusCoupler.
 void setProcessImageFactory(ProcessImageFactory factory)
          Sets the ProcessImageFactory instance.
 void setUnitID(int id)
          Sets the identifier of this unit, which is needed to be determined in a serial network.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProcessImageFactory

public ProcessImageFactory getProcessImageFactory()
Returns the actual ProcessImageFactory instance.

Returns:
a ProcessImageFactory instance.

setProcessImageFactory

public void setProcessImageFactory(ProcessImageFactory factory)
Sets the ProcessImageFactory instance.

Parameters:
factory - the instance to be used for creating process image instances.

getProcessImage

public ProcessImage getProcessImage()
Returns a reference to the ProcessImage of this ModbusCoupler.

Returns:
the ProcessImage.

setProcessImage

public void setProcessImage(ProcessImage procimg)
Sets the reference to the ProcessImage of this ModbusCoupler.

Parameters:
procimg - the ProcessImage to be set.

getUnitID

public int getUnitID()
Returns the identifier of this unit. This identifier is required to be set for serial protocol slave implementations.

Returns:
the unit identifier as int.

setUnitID

public void setUnitID(int id)
Sets the identifier of this unit, which is needed to be determined in a serial network.

Parameters:
id - the new unit identifier as int.

isMaster

public boolean isMaster()
Tests if this instance is a master device.

Returns:
true if master, false otherwise.

isSlave

public boolean isSlave()
Tests if this instance is not a master device.

Returns:
true if slave, false otherwise.

setMaster

public void setMaster(boolean master)
Sets this instance to be or not to be a master device.

Parameters:
master - true if master device, false otherwise.

getReference

public static final ModbusCoupler getReference()
Returns a reference to the singleton instance.

Returns:
the ModbusCoupler instance reference.


Copyright © 2010. All Rights Reserved.