com.java4less.rfax
Class FaxReceiverModemRXTX

java.lang.Object
  extended by com.java4less.rfax.FaxModemRXTX
      extended by com.java4less.rfax.FaxReceiverModemRXTX
All Implemented Interfaces:
gnu.io.SerialPortEventListener, java.lang.Runnable, java.util.EventListener

public class FaxReceiverModemRXTX
extends FaxModemRXTX
implements gnu.io.SerialPortEventListener, java.lang.Runnable

This class is used for receiving faxes (with RXTX). It can be used in the following way:


FaxReceiverModem m= new FaxReceiverModem();
m.ATFlowControlRTSCTS="AT&K3";
m.flowControl=m.FLOWCONTROL_RTSCTS;
m.setPortName("COM3");
m.faxClass=1;
m.debug=true;
m.faxReceiver=this;
m.openReception();
m.waitForFax(); // starts a thread which will wait for an incomming call.

where "this" must implement the IFaxReceiver interface.

In order to stop the FaxReceiverModem thread you must execute:

m.close();


Field Summary
 int answerAfterRings
          wait this number of rings before answering incomming call.
 IFaxReceiver faxReceiver
          fax receiver.
 java.lang.String inDirectory
          directory where incomming faxes (tiff files) will be stored.
 boolean retryFRM
          some modem can retrun +FCERROR after ATFRM, retry in this case up to 3 times
 
Fields inherited from class com.java4less.rfax.FaxModemRXTX
AtFBOR, ATFlowControlNone, ATFlowControlRTSCTS, ATFlowControlXONXOFF, bitRate, BITRATE_12000, BITRATE_14400, BITRATE_2400, BITRATE_4800, BITRATE_7200, BITRATE_9600, debug, dialTone, directBitOrder, disablePortReadTimeout, faxClass, faxFile, flowControl, FLOWCONTROL_NONE, FLOWCONTROL_RTSCTS, FLOWCONTROL_XONXOFF, hangCode, initCommands, lastError, lastResponse, listener, log, logStr, maxRetries, MPSEOPdelay, noEcho, ownId, pageCode, portRate, producer, remoteId, resetCommand, resetDelay, resolution, RESOLUTION_FINE, RESOLUTION_NORMAL, reverseBytes, sendBufferSize, timeout, trainingRetries
 
Constructor Summary
FaxReceiverModemRXTX()
          constructor
 
Method Summary
 boolean close()
          close port and do not wait for call anymore
 boolean openReception()
          open port for reception
 boolean receiveFax()
          wait for Fax
 void run()
          run thread, wait for call
 void serialEvent(gnu.io.SerialPortEvent ev)
          event listener
 void waitForFax()
          wait for fax
 
Methods inherited from class com.java4less.rfax.FaxModemRXTX
close, createFaxFiles, getEncoder, getInitString, open, sendFax, setInitString, setPortName, supportsClass1, supportsClass2, supportsClass20, waitFor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

faxReceiver

public IFaxReceiver faxReceiver
fax receiver. This is the user application that will wait for incomming faxes.


answerAfterRings

public int answerAfterRings
wait this number of rings before answering incomming call. Default is 1.


retryFRM

public boolean retryFRM
some modem can retrun +FCERROR after ATFRM, retry in this case up to 3 times


inDirectory

public java.lang.String inDirectory
directory where incomming faxes (tiff files) will be stored. Must end with separator / or \

Constructor Detail

FaxReceiverModemRXTX

public FaxReceiverModemRXTX()
constructor

Method Detail

openReception

public boolean openReception()
open port for reception


serialEvent

public void serialEvent(gnu.io.SerialPortEvent ev)
event listener

Specified by:
serialEvent in interface gnu.io.SerialPortEventListener

waitForFax

public void waitForFax()
wait for fax


run

public void run()
run thread, wait for call

Specified by:
run in interface java.lang.Runnable

close

public boolean close()
close port and do not wait for call anymore

Overrides:
close in class FaxModemRXTX

receiveFax

public boolean receiveFax()
wait for Fax