de.wagner_ibw.iow.i2c
Class PCF8574A

java.lang.Object
  |
  +--de.wagner_ibw.iow.i2c.AbstractI2CDevice
        |
        +--de.wagner_ibw.iow.i2c.PCF8574A
All Implemented Interfaces:
I2CDevice, IowPortChangeListener

public class PCF8574A
extends AbstractI2CDevice
implements IowPortChangeListener

This is the implemenation of the PCF8574A device, "Remote 8-Bit I/O Expander". !!!! under construction !!!!

Since:
0.9.5
Author:
Thomas Wagner

Field Summary
static int CLASS
          Group 1 part of slave address for PCF8574A (PCF8574A device specific constant).
static java.lang.String NAME
          PCF8574A device specific constants.
 
Fields inherited from class de.wagner_ibw.iow.i2c.AbstractI2CDevice
MAX_I2C_LENGTH
 
Constructor Summary
PCF8574A(int deviceAddress)
          Constructor
PCF8574A(int deviceAddress, int intPort, int intBit)
          Constructor for interrupt using.
 
Method Summary
 boolean equals(java.lang.Object o)
          Indicates whether some other PCF8574A object is "equal to" this one.
 int hashCode()
          Returns a hash code value for this PCF8574A object.
 void portChanged(IowPort port)
           
 int readPort()
          Reads the port.
 void setIowDevice(AbstractIowDevice iow)
          Sets the reference to an IO-Warrior device for write report operations.
 java.lang.String toString()
          Returns Information about this PCF8574A as String.
 void writePort(int data)
          Writes the port.
 
Methods inherited from class de.wagner_ibw.iow.i2c.AbstractI2CDevice
getI2cAddress, getName, readI2C, reportReceived, setMonitor, writeI2C
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
PCF8574A device specific constants.

See Also:
Constant Field Values

CLASS

public static final int CLASS
Group 1 part of slave address for PCF8574A (PCF8574A device specific constant).

See Also:
Constant Field Values
Constructor Detail

PCF8574A

public PCF8574A(int deviceAddress)
         throws java.lang.Exception
Constructor

Parameters:
deviceAddress - Group 2 part of slave address (possible values 0...7).
Throws:
java.lang.Exception - If anything goes wrong.

PCF8574A

public PCF8574A(int deviceAddress,
                int intPort,
                int intBit)
         throws java.lang.Exception
Constructor for interrupt using.

Parameters:
deviceAddress - Group 2 part of slave address (possible values 0...7).
intPort - port number for interrupt signal.
intBit - bit number for interrupt signal.
Throws:
java.lang.Exception - If anything goes wrong.
Method Detail

readPort

public int readPort()
             throws java.lang.Exception
Reads the port.

Returns:
read value
Throws:
java.lang.Exception - If any transmission error occurred.

writePort

public void writePort(int data)
               throws java.lang.Exception
Writes the port.

Parameters:
data -
Throws:
java.lang.Exception - If any transmission error occurred.

setIowDevice

public void setIowDevice(AbstractIowDevice iow)
Description copied from interface: I2CDevice
Sets the reference to an IO-Warrior device for write report operations.

Specified by:
setIowDevice in interface I2CDevice
Specified by:
setIowDevice in class AbstractI2CDevice
Parameters:
iow - Instance of an IO-Warrior device.

toString

public java.lang.String toString()
Returns Information about this PCF8574A as String.

Overrides:
toString in class AbstractI2CDevice
Returns:
String representation of information about this PCF8574A. (slave address, temperatures, ...).

equals

public boolean equals(java.lang.Object o)
Indicates whether some other PCF8574A object is "equal to" this one. Criterias are the i2c device class and i2c device address (in I2CAddress).

Overrides:
equals in class AbstractI2CDevice
Returns:
True if this object is the same as the obj argument; false otherwise.

hashCode

public int hashCode()
Returns a hash code value for this PCF8574A object. It is derived from the i2c device class and i2c device address.

Overrides:
hashCode in class AbstractI2CDevice
Returns:
a hash code value for this object.

portChanged

public void portChanged(IowPort port)
Specified by:
portChanged in interface IowPortChangeListener