com.java4less.rfax
Class FaxModem

java.lang.Object
  |
  +--com.java4less.rfax.FaxModem

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:

2: 4800 bps 3: 9600 bps
 boolean debug
          debug, send log to System.out
 boolean dialTone
          dial tone/pulse
 boolean directBitOrder
          bit order, if true LSB2MSB
 int faxClass
          requested fax class
 java.lang.String faxFile
          temporary fax file.
 int flowControl
          flow control
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
 java.lang.String noEcho
          No echo command
 java.lang.String ownId
          own telephone number
 int pageCode
          result last page
 FaxProducer producer
          fax producer
 java.lang.String resetCommand
          AT reset command (ATZ)
 int resolution
          resolution normal or fine (default)
static int RESOLUTION_FINE
          196 dpi vertical resolution
static int RESOLUTION_NORMAL
          98 dpi vertical resolution
 int timeout
          response timeout seconds (30)
 
Constructor Summary
FaxModem()
          constructor
 
Method Summary
 boolean close()
          closes connection to modem
 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

maxRetries

public int maxRetries
maximum number of page transmision retries

bitRate

public int bitRate
bit rate:

2: 4800 bps 3: 9600 bps

resolution

public int resolution
resolution normal or fine (default)

RESOLUTION_NORMAL

public static final int RESOLUTION_NORMAL
98 dpi vertical resolution

RESOLUTION_FINE

public static final int RESOLUTION_FINE
196 dpi vertical resolution

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

resetCommand

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

timeout

public int timeout
response timeout seconds (30)

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

FLOWCONTROL_XONXOFF

public static final int FLOWCONTROL_XONXOFF

FLOWCONTROL_RTSCTS

public static final int FLOWCONTROL_RTSCTS

flowControl

public int flowControl
flow control

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

ownId

public java.lang.String ownId
own telephone number

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.
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

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