com.java4less.rfax
Class FaxModem

java.lang.Object
  extended by com.java4less.rfax.FaxModem
Direct Known Subclasses:
FaxReceiverModem

public class FaxModem
extends java.lang.Object

Fax modem. The steps to send a fax are:

- create faxModem Object
- set port and modem class
- call open()
- call sendFax()
- call close()


Field Summary
 boolean AtFBOR
          FBOR command?
 java.lang.String ATFlowControlNone
          AT command for flow control none
 java.lang.String ATFlowControlRTSCTS
          AT command for flow control rts/cts
 java.lang.String ATFlowControlXONXOFF
          AT command for flow control xon/xoff
 int bitRate
          bit rate:

0: 2400 bps
1: 4800 bps
2: 7200 bps
3: 9600 bps
4: 12000 bps
5: 14400 bps
*
static int BITRATE_12000
           
static int BITRATE_14400
           
static int BITRATE_2400
           
static int BITRATE_4800
           
static int BITRATE_7200
           
static int BITRATE_9600
           
 boolean debug
          debug, send log to System.out
 boolean dialTone
          dial tone/pulse
 boolean directBitOrder
          bit order, if true LSB2MSB
 boolean disablePortReadTimeout
           
 int faxClass
          requested fax class, 1 (recommended), 2 or 2.0
 java.lang.String faxFile
          temporary fax file.
 int flowControl
          flow controlf
static int FLOWCONTROL_NONE
           
static int FLOWCONTROL_RTSCTS
           
static int FLOWCONTROL_XONXOFF
           
 int hangCode
          hangup code
 java.lang.String[] initCommands
          list of init AT commands
 java.lang.String lastError
          description of last error
 int lastResponse
          last response
 FaxStatusListener listener
          status listener.
 boolean log
          log mode
 java.lang.String logStr
          log output
 int maxRetries
          maximum number of page transmision retries
 int MPSEOPdelay
          delay between RTC and MPS/EOP default is 8 (80 ms)
 java.lang.String noEcho
          No echo command
 java.lang.String ownId
          own telephone number
 int pageCode
          result last page
 int portRate
          serial port rate
 FaxProducer producer
          fax producer
 java.lang.String remoteId
          telephone number of the remote fax machine
 java.lang.String resetCommand
          AT reset command (ATZ)
 int resetDelay
          delay after ATZ (reset command) in msecs, default is 0
 int resolution
          resolution normal or fine (default)
static int RESOLUTION_FINE
          196 dpi vertical resolution
static int RESOLUTION_NORMAL
          98 dpi vertical resolution
 byte[] reverseBytes
           
 int sendBufferSize
          size of send buffer
 int timeout
          response timeout seconds (30)
 int trainingRetries
          how many times shall we try the training?
 
Constructor Summary
FaxModem()
          constructor
 
Method Summary
 boolean close()
          closes connection to modem
 boolean close(boolean reusePort)
          closes connection to modem
 boolean createFaxFiles(FaxProducer p)
          create fax files
 T4Encoder getEncoder()
          get t.4 encoder
 java.lang.String getInitString()
          get modem init.
 boolean open(FaxProducer p)
          open connection
 boolean sendFax(java.lang.String destId)
          send fax
 void setInitString(java.lang.String s)
          set modem init.
 void setPortName(java.lang.String p)
          select modem/port, for example COM1 , COM2 (for windows) or /dev/term/a for unix like systems
 boolean supportsClass1()
          is a class 1 fax modem?
 boolean supportsClass2()
          is a class 2 fax modem?
 boolean supportsClass20()
          is a class 20 fax modem?
 boolean waitFor(java.lang.String resp)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reverseBytes

public byte[] reverseBytes

maxRetries

public int maxRetries
maximum number of page transmision retries


BITRATE_2400

public static final int BITRATE_2400
See Also:
Constant Field Values

BITRATE_4800

public static final int BITRATE_4800
See Also:
Constant Field Values

BITRATE_7200

public static final int BITRATE_7200
See Also:
Constant Field Values

BITRATE_9600

public static final int BITRATE_9600
See Also:
Constant Field Values

BITRATE_12000

public static final int BITRATE_12000
See Also:
Constant Field Values

BITRATE_14400

public static final int BITRATE_14400
See Also:
Constant Field Values

portRate

public int portRate
serial port rate


bitRate

public int bitRate
bit rate:

0: 2400 bps
1: 4800 bps
2: 7200 bps
3: 9600 bps
4: 12000 bps
5: 14400 bps
*


resolution

public int resolution
resolution normal or fine (default)


RESOLUTION_NORMAL

public static final int RESOLUTION_NORMAL
98 dpi vertical resolution

See Also:
Constant Field Values

RESOLUTION_FINE

public static final int RESOLUTION_FINE
196 dpi vertical resolution

See Also:
Constant Field Values

faxFile

public java.lang.String faxFile
temporary fax file. The extension 1,2,3... will be added for the different pages


lastError

public java.lang.String lastError
description of last error


trainingRetries

public int trainingRetries
how many times shall we try the training?


resetCommand

public java.lang.String resetCommand
AT reset command (ATZ)


timeout

public int timeout
response timeout seconds (30)


resetDelay

public int resetDelay
delay after ATZ (reset command) in msecs, default is 0


lastResponse

public int lastResponse
last response


pageCode

public int pageCode
result last page


hangCode

public int hangCode
hangup code


FLOWCONTROL_NONE

public static final int FLOWCONTROL_NONE
See Also:
Constant Field Values

FLOWCONTROL_XONXOFF

public static final int FLOWCONTROL_XONXOFF
See Also:
Constant Field Values

FLOWCONTROL_RTSCTS

public static final int FLOWCONTROL_RTSCTS
See Also:
Constant Field Values

flowControl

public int flowControl
flow controlf


ATFlowControlNone

public java.lang.String ATFlowControlNone
AT command for flow control none


ATFlowControlXONXOFF

public java.lang.String ATFlowControlXONXOFF
AT command for flow control xon/xoff


ATFlowControlRTSCTS

public java.lang.String ATFlowControlRTSCTS
AT command for flow control rts/cts


directBitOrder

public boolean directBitOrder
bit order, if true LSB2MSB


AtFBOR

public boolean AtFBOR
FBOR command?


dialTone

public boolean dialTone
dial tone/pulse


faxClass

public int faxClass
requested fax class, 1 (recommended), 2 or 2.0


ownId

public java.lang.String ownId
own telephone number


remoteId

public java.lang.String remoteId
telephone number of the remote fax machine


noEcho

public java.lang.String noEcho
No echo command


log

public boolean log
log mode


debug

public boolean debug
debug, send log to System.out


logStr

public java.lang.String logStr
log output


producer

public FaxProducer producer
fax producer


initCommands

public java.lang.String[] initCommands
list of init AT commands


listener

public FaxStatusListener listener
status listener. Use this interface to get progress feedback.


MPSEOPdelay

public int MPSEOPdelay
delay between RTC and MPS/EOP default is 8 (80 ms)


sendBufferSize

public int sendBufferSize
size of send buffer


disablePortReadTimeout

public boolean disablePortReadTimeout
Constructor Detail

FaxModem

public FaxModem()
constructor

Method Detail

getInitString

public java.lang.String getInitString()
get modem init. String


setInitString

public void setInitString(java.lang.String s)
set modem init. String


setPortName

public void setPortName(java.lang.String p)
select modem/port, for example COM1 , COM2 (for windows) or /dev/term/a for unix like systems


supportsClass1

public boolean supportsClass1()
is a class 1 fax modem?


supportsClass2

public boolean supportsClass2()
is a class 2 fax modem?


supportsClass20

public boolean supportsClass20()
is a class 20 fax modem?


getEncoder

public T4Encoder getEncoder()
get t.4 encoder


createFaxFiles

public boolean createFaxFiles(FaxProducer p)
create fax files


open

public boolean open(FaxProducer p)
open connection


sendFax

public boolean sendFax(java.lang.String destId)
send fax


waitFor

public boolean waitFor(java.lang.String resp)

close

public boolean close()
closes connection to modem


close

public boolean close(boolean reusePort)
closes connection to modem