de.wagner_ibw.iow.spi
Class SPI

java.lang.Object
  |
  +--de.wagner_ibw.iow.spi.SPI
All Implemented Interfaces:
SpecialModeFunction

public class SPI
extends java.lang.Object
implements SpecialModeFunction

Implementation of the SPI special mode function

Author:
Thomas Wagner

Field Summary
private  AbstractSPIDevice device
           
private  AbstractIowDevcie iow
           
(package private) static java.lang.String name
          Name of this special mode function.
private  int spiMode
           
 
Fields inherited from interface de.wagner_ibw.iow.SpecialModeFunction
SMF_CPS_ID, SMF_I2C_ID, SMF_LCD_ID, SMF_LED_ID, SMF_RC5_ID, SMF_SMX_ID, SMF_SPI_ID
 
Constructor Summary
SPI(int mode)
          Constructor.
 
Method Summary
 java.lang.String checkCompatibility(int id, int Revision, int specialModes)
          Checks if it is possible to activate this special mode function.
 int[] getDisableReport()
          Returns the report that disables the special mode function.
 int[] getEnableReport()
          Returns the report that enables the special mode function.
 int[] getIowSpecialBits(int deviceIdentifier)
          Returns an array of bitmask(s) for port 0...1 or 0...3 if this special mode function runs on this iow device.
 java.lang.String getName()
          Returns the name of the special mode function.
 int[] getReportIds()
          Returns the report id(s) which the implementation is interested in.
 int getSpecialModeFuncionId()
          Returns the special mode function for this implementation.
 boolean matchReportId(int reportId)
          Checks if this implementation is interested in this report.
 void removeSPIDevice()
          Removes the spi device implementation.
 void reportReceived(int[] readBuffer)
          Callback method is called when a matching report was received.
 void setIowDevice(AbstractIowDevcie iow)
          Sets the reference to an iow device for write report operations.
 void setSPIDevice(AbstractSPIDevice dev)
          Adds the spi device implementation (e.g. an instance of M95020.java).
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

static final java.lang.String name
Name of this special mode function.

See Also:
Constant Field Values

spiMode

private int spiMode

device

private AbstractSPIDevice device

iow

private AbstractIowDevcie iow
Constructor Detail

SPI

public SPI(int mode)
Constructor.

Parameters:
mode - SPI special mode function mode byte.
Method Detail

setSPIDevice

public void setSPIDevice(AbstractSPIDevice dev)
Adds the spi device implementation (e.g. an instance of M95020.java).

Parameters:
dev - Instance of an spi device implemenation.

removeSPIDevice

public void removeSPIDevice()
Removes the spi device implementation.


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

getDisableReport

public int[] getDisableReport()
Description copied from interface: SpecialModeFunction
Returns the report that disables the special mode function.

Specified by:
getDisableReport in interface SpecialModeFunction
Returns:
Special mode function disable report.

getEnableReport

public int[] getEnableReport()
Description copied from interface: SpecialModeFunction
Returns the report that enables the special mode function.

Specified by:
getEnableReport in interface SpecialModeFunction
Returns:
Special mode function enable report.

getIowSpecialBits

public int[] getIowSpecialBits(int deviceIdentifier)
Description copied from interface: SpecialModeFunction
Returns an array of bitmask(s) for port 0...1 or 0...3 if this special mode function runs on this iow device. Returns a array of lenght zero if no bits used by this special mode function. 1 means this bit is dedicated by special mode function. 0 means this bit is free for normal pin io operations.

Specified by:
getIowSpecialBits in interface SpecialModeFunction
Parameters:
deviceIdentifier - Iow device identifier (AbstractIowDevcie.IOW24ID or AbstractIowDevcie.IOW40ID).
Returns:
Array of int that contains bitmask(s) for special mode function bits.

getReportIds

public int[] getReportIds()
Description copied from interface: SpecialModeFunction
Returns the report id(s) which the implementation is interested in.

Specified by:
getReportIds in interface SpecialModeFunction
Returns:
Int array of special mode function id(s).

getSpecialModeFuncionId

public int getSpecialModeFuncionId()
Description copied from interface: SpecialModeFunction
Returns the special mode function for this implementation.

Specified by:
getSpecialModeFuncionId in interface SpecialModeFunction
Returns:
Special mode function id (SMF_LCD_ID,SMF_RC5_ID,SMF_I2C_ID,SMF_CPS_ID,SMF_SPI_ID).

matchReportId

public boolean matchReportId(int reportId)
Description copied from interface: SpecialModeFunction
Checks if this implementation is interested in this report.

Specified by:
matchReportId in interface SpecialModeFunction
Parameters:
reportId - Report id of the received report.
Returns:
True if it fits or false if not.

reportReceived

public void reportReceived(int[] readBuffer)
Description copied from interface: SpecialModeFunction
Callback method is called when a matching report was received.

Specified by:
reportReceived in interface SpecialModeFunction
Parameters:
readBuffer - Read buffer from a received report.

setIowDevice

public void setIowDevice(AbstractIowDevcie iow)
Description copied from interface: SpecialModeFunction
Sets the reference to an iow device for write report operations.

Specified by:
setIowDevice in interface SpecialModeFunction
Parameters:
iow - Instance of an iow device.

checkCompatibility

public java.lang.String checkCompatibility(int id,
                                           int Revision,
                                           int specialModes)
Description copied from interface: SpecialModeFunction
Checks if it is possible to activate this special mode function. This depends on id and/or rev of the iow device and/or already activated special mode functions.

Specified by:
checkCompatibility in interface SpecialModeFunction
Parameters:
id - Id of the current iow device.
Revision - Rev of the current iow device.
specialModes - Special modes from the current iow device.
Returns:
Error string if special mode function is not available. Returns null if special mode function is available.

getName

public java.lang.String getName()
Description copied from interface: SpecialModeFunction
Returns the name of the special mode function.

Specified by:
getName in interface SpecialModeFunction
Returns:
Name of the special mode function.