net.wimpi.modbus.procimg
Class SynchronizedAbstractRegister

java.lang.Object
  extended by net.wimpi.modbus.procimg.SynchronizedAbstractRegister
All Implemented Interfaces:
InputRegister, Register
Direct Known Subclasses:
SimpleInputRegister, SimpleRegister

public abstract class SynchronizedAbstractRegister
extends Object
implements Register

Abstract class with synchronized register operations.

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

Constructor Summary
SynchronizedAbstractRegister()
           
 
Method Summary
 int getValue()
          Returns the value of this InputRegister.
 void setValue(byte[] bytes)
          Sets the content of this register from the given raw bytes.
 void setValue(int v)
          Sets the content of this Register from the given unsigned 16-bit value (unsigned short).
 void setValue(short s)
          Sets the content of this register from the given signed 16-bit value (short).
 byte[] toBytes()
          Returns the content of this Register as bytes.
 short toShort()
          Returns the content of this Register as signed 16-bit value (short).
 int toUnsignedShort()
          Returns the content of this Register as unsigned 16-bit value (unsigned short).
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SynchronizedAbstractRegister

public SynchronizedAbstractRegister()
Method Detail

getValue

public int getValue()
Description copied from interface: InputRegister
Returns the value of this InputRegister. The value is stored as int but should be treated like a 16-bit word.

Specified by:
getValue in interface InputRegister
Returns:
the value as int.

toUnsignedShort

public final int toUnsignedShort()
Description copied from interface: InputRegister
Returns the content of this Register as unsigned 16-bit value (unsigned short).

Specified by:
toUnsignedShort in interface InputRegister
Returns:
the content as unsigned short (int).

setValue

public final void setValue(int v)
Description copied from interface: Register
Sets the content of this Register from the given unsigned 16-bit value (unsigned short).

Specified by:
setValue in interface Register
Parameters:
v - the value as unsigned short (int).

toShort

public final short toShort()
Description copied from interface: InputRegister
Returns the content of this Register as signed 16-bit value (short).

Specified by:
toShort in interface InputRegister
Returns:
the content as short.

setValue

public final void setValue(short s)
Description copied from interface: Register
Sets the content of this register from the given signed 16-bit value (short).

Specified by:
setValue in interface Register
Parameters:
s - the value as short.

setValue

public final void setValue(byte[] bytes)
Description copied from interface: Register
Sets the content of this register from the given raw bytes.

Specified by:
setValue in interface Register
Parameters:
bytes - the raw data as byte[].

toBytes

public byte[] toBytes()
Description copied from interface: InputRegister
Returns the content of this Register as bytes.

Specified by:
toBytes in interface InputRegister
Returns:
a byte[] with length 2.


Copyright © 2010. All Rights Reserved.