|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.java4less.sms.adapters.Modem
This class is used to access the SMSC using a analog dial up connection. The class can be used like this:
// create object Modem modem= new Modem(); modem.setPortName("COM3"); modem.dataBits=SerialPort.DATABITS_8; // do not forget to check if the SMSC uses 7 or 8 bits // open port , initialize and connect if (modem.openPort()) { if (modem.initializeModem()) if (modem.dial("900900900")) { // send the sms now using the Modem adapter SmsSender sender=new SmsSender(modem); sender.createSMS51("123","456","Hello"); sender.sendMessage(); // close connection modem.hangup(); } modem.closePort(); }
Field Summary | |
int |
answerAfterRings
wait this number of rings before answering incomming call. |
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_1200
|
static int |
BITRATE_12000
|
static int |
BITRATE_14400
|
static int |
BITRATE_2400
|
static int |
BITRATE_4800
|
static int |
BITRATE_7200
|
static int |
BITRATE_9600
|
int |
dataBits
Data bits (SerialPort.DATABITS_8 or SerialPort.DATABITS_7) |
boolean |
debug
debug, send log to System.out |
boolean |
dialTone
dial tone/pulse |
int |
flowControl
flow controlf |
static int |
FLOWCONTROL_NONE
|
static int |
FLOWCONTROL_RTSCTS
|
static int |
FLOWCONTROL_XONXOFF
|
int |
guardTime
guard time in milliseconds (default is 1500) |
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 |
boolean |
log
log mode |
java.lang.String |
logStr
log output |
java.lang.String |
noEcho
No echo command |
int |
parity
parity, default is SerialPort.PARITY_NONE |
java.lang.String |
resetCommand
AT reset command (ATZ) |
int |
resetDelay
delay after ATZ (reset command) in msecs, default is 0 |
int |
sendBufferSize
size of send buffer |
int |
stopBits
Stop bits, default is SerialPort.STOPBITS_1 |
int |
timeout
response timeout seconds (30) |
Constructor Summary | |
Modem()
constructor |
Method Summary | |
boolean |
closePort()
closes connection to modem |
boolean |
dial(java.lang.String phoneNumber)
connect |
java.lang.String |
getInitString()
get modem init. |
void |
hangup()
hang up |
boolean |
initializeModem()
initialize modem (ATZ ....) |
boolean |
openPort()
open connection |
byte[] |
receiveData(java.lang.String endDelimiter,
int ptout)
receive data |
boolean |
sendATCommandnoWait(java.lang.String messageString)
send AT command , do not wait for response |
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 |
transmitBytes(byte[] b,
int len)
transmit bytes |
boolean |
waitForCall()
wait for call |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int BITRATE_1200
public static final int BITRATE_2400
public static final int BITRATE_4800
public static final int BITRATE_7200
public static final int BITRATE_9600
public static final int BITRATE_12000
public static final int BITRATE_14400
public int bitRate
public int guardTime
public java.lang.String lastError
public int dataBits
public int stopBits
public int parity
public int answerAfterRings
public java.lang.String resetCommand
public int timeout
public int resetDelay
public int lastResponse
public int hangCode
public static final int FLOWCONTROL_NONE
public static final int FLOWCONTROL_XONXOFF
public static final int FLOWCONTROL_RTSCTS
public int flowControl
public java.lang.String ATFlowControlNone
public java.lang.String ATFlowControlXONXOFF
public java.lang.String ATFlowControlRTSCTS
public boolean dialTone
public java.lang.String noEcho
public boolean log
public boolean debug
public java.lang.String logStr
public java.lang.String[] initCommands
public int sendBufferSize
Constructor Detail |
public Modem()
Method Detail |
public java.lang.String getInitString()
public void setInitString(java.lang.String s)
public void setPortName(java.lang.String p)
public boolean openPort()
public boolean initializeModem()
public boolean waitForCall()
public byte[] receiveData(java.lang.String endDelimiter, int ptout)
receiveData
in interface Adapter
public boolean dial(java.lang.String phoneNumber)
public void hangup()
public boolean closePort()
public boolean sendATCommandnoWait(java.lang.String messageString)
public boolean transmitBytes(byte[] b, int len)
transmitBytes
in interface Adapter
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |