Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

plp.rs232
Class TestCommunicationDevice  view TestCommunicationDevice download TestCommunicationDevice.java

java.lang.Object
  extended byplp.rs232.AbstractCommunicationDevice
      extended byplp.rs232.TestCommunicationDevice
All Implemented Interfaces:
CommunicationDevice

public class TestCommunicationDevice
extends AbstractCommunicationDevice
implements CommunicationDevice

A class to test software that uses a CommunicationDevice interface


Field Summary
private  tools.ByteBuffer dataReceived
           
private  byte[] dataToExpect
           
private  boolean foundData
           
 
Constructor Summary
TestCommunicationDevice()
           
 
Method Summary
 void addDataListener(DataListener listener)
          accessor method for DataListeners, implementation of CommunicationDevice
protected  void addDataReceived(byte[] data)
           
protected  void checkData()
           
 void close()
          closes and releases the hardwareresources associated with this Device.
protected  boolean dataFound()
           
 boolean expect(byte[] dataToExpect, int timeOutMillies)
          Method used by testing software: returns true if the dataToExpect is send by the software to test within timeOUtMillies milliseconds.
protected  void fireReceiveDataEvent(byte[] data)
          fires data event
 tools.ByteBuffer getDataReceived()
           
protected  byte[] getDataToExpect()
           
protected  DataListener getListenerAt(int index)
          accessor method for DataListeners
protected  int getNumberOfListeners()
          accessor method for DataListeners
protected  boolean isExpectingData()
           
 void removeDataListener(DataListener listener)
          accessor method for DataListeners, implementation of CommunicationDevice
 void sendData(byte[] data)
          Method used by software to test
 void sendToSoftware(byte[] data)
          Method used by testing software
protected  void setDataFound(boolean found)
           
protected  void setDataToExpect(byte[] dataToExpect)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface plp.rs232.CommunicationDevice
addDataListener, removeDataListener
 

Field Detail

dataReceived

private tools.ByteBuffer dataReceived

dataToExpect

private byte[] dataToExpect

foundData

private boolean foundData
Constructor Detail

TestCommunicationDevice

public TestCommunicationDevice()
Method Detail

sendData

public void sendData(byte[] data)
Method used by software to test

Specified by:
sendData in interface CommunicationDevice

checkData

protected void checkData()

dataFound

protected boolean dataFound()

setDataFound

protected void setDataFound(boolean found)

sendToSoftware

public void sendToSoftware(byte[] data)
Method used by testing software


expect

public boolean expect(byte[] dataToExpect,
                      int timeOutMillies)
Method used by testing software: returns true if the dataToExpect is send by the software to test within timeOUtMillies milliseconds.


setDataToExpect

protected void setDataToExpect(byte[] dataToExpect)

getDataToExpect

protected byte[] getDataToExpect()

isExpectingData

protected boolean isExpectingData()

close

public void close()
Description copied from interface: CommunicationDevice
closes and releases the hardwareresources associated with this Device.

Specified by:
close in interface CommunicationDevice

getDataReceived

public tools.ByteBuffer getDataReceived()

addDataReceived

protected void addDataReceived(byte[] data)

getNumberOfListeners

protected int getNumberOfListeners()
accessor method for DataListeners


getListenerAt

protected DataListener getListenerAt(int index)
accessor method for DataListeners


addDataListener

public void addDataListener(DataListener listener)
accessor method for DataListeners, implementation of CommunicationDevice

Specified by:
addDataListener in interface CommunicationDevice

removeDataListener

public void removeDataListener(DataListener listener)
accessor method for DataListeners, implementation of CommunicationDevice

Specified by:
removeDataListener in interface CommunicationDevice

fireReceiveDataEvent

protected void fireReceiveDataEvent(byte[] data)
fires data event