|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.ObjectSerialio.modem.Modem
Creates a modem object.
| Field Summary | |
static int |
ABORT
|
protected boolean |
abortRequest
|
static int |
CONNECT
|
protected java.lang.String[] |
controlName
|
protected java.util.Locale |
curLocale
|
static int |
DIAL_BLIND
|
static int |
DISCONNECT
|
protected java.lang.String |
eMsg
|
protected java.lang.String |
evMsg
|
static int |
GET_CONNECT
|
static int |
INITIALIZE
The modem thread |
protected byte[] |
match
|
protected ModemEvent |
me
|
protected ModemInterfaceProvider |
mip
|
protected java.io.InputStream |
mis
|
protected java.io.OutputStream |
mos
|
protected Serialio.modem.Modem.ModemTask |
mTask
|
protected byte[] |
phoneNumber
|
protected byte[] |
rdBuf
|
protected int |
rdCnt
|
protected java.util.ResourceBundle |
sMsgs
|
protected Serialio.SnoopLoop |
spy
|
protected ModemStatusAcceptor |
statusMsgNotify
|
static int |
STOP
|
static int |
STOP_WAIT_RING
|
protected boolean |
stopRequest
|
protected boolean |
stopWaitRing
|
static int |
WAIT_DONE
|
static int |
WAIT_RING
|
| Constructor Summary | |
Modem()
Creates a modem object |
|
Modem(ModemInterfaceProvider mip,
java.io.OutputStream os,
java.io.InputStream is)
Creates a modem object |
|
| Method Summary | |
void |
abort()
Abort the current request |
protected void |
checkInitialized()
Check to see if the modem is initialized. |
protected void |
checkOpen()
Check to see if the modem is 'open'. |
boolean |
cmdReply(byte[] snd,
byte[] waitData,
int tmo)
send the dat, wait for data. |
boolean |
cmdReply(java.lang.String snd,
java.lang.String waitData,
int tmo)
send the dat, wait for data. |
void |
commandMode()
Sent the modem 'Attention' command. |
boolean |
contains(java.lang.String toMatch)
Checks to see if the given String is contained in the reply buffer |
byte[] |
getConnectMsg()
Get the connect message returned by the modem |
int |
getConnectWaitTime()
|
ModemStatusAcceptor |
getModemStatusAcceptor()
Get the object that will receive modem status msgs |
boolean |
getNotifyBeforeModemEvent()
|
java.lang.String |
getPhoneNumber()
|
boolean |
getShowModemData()
|
boolean |
getShowModemStatus()
|
boolean |
getShowModemStatusExpert()
|
java.lang.String |
hexString()
Creates a String from the data in the SerialData object |
boolean |
isInitialized()
Returns true if the modem was initialized. |
void |
request(int code)
Request modem to perform an action. |
void |
setConnectWaitTime(int timeInSecs)
Set the time the modem will wait for connection after sending the dial command. |
void |
setDialCommand(java.lang.String cmd)
Set the modem dial mode command string. |
void |
setDTR(boolean onOff)
Set the modem DTR line |
void |
setInitCommand(java.lang.String cmd)
Set the modem initialization command string. |
void |
setInitTime(int tmo)
Set the modem initialization timeout value. |
void |
setInterfaceProvider(ModemInterfaceProvider mip)
Set the ModemInterfaceProvider. |
void |
setLocale(java.util.Locale newLocale)
Set the locale. |
void |
setModemStatusAcceptor(ModemStatusAcceptor viewer)
Set the object to receive modem status msgs |
void |
setNotifyBeforeModemEvent(boolean s)
Set notifyBeforeModemEvent. |
void |
setPhoneNumber(java.lang.String number)
Set the phone number the modem will dial when a connect command is requted |
void |
setShowModemData(boolean onOff)
When enabled this mode sends the received modem data to the registered viewer. |
void |
setShowModemStatus(boolean onOff)
Set the modem status messages. |
void |
setShowModemStatusExpert(boolean onOff)
Set the 'expert' modem status messages. |
void |
setStreams(java.io.OutputStream os,
java.io.InputStream is)
Set the streams used by the modem. |
void |
snoopEvent(byte[] snoopData)
Callback for SnoopListener (contains data pattern 'snooped' for) |
void |
snoopLoopEvent(byte[] streamData,
int cnt)
Callback for SnoopLoopListener |
void |
start()
Start the modem task. |
void |
statusMsg(java.lang.String msg)
Put a msg to the assigned status area |
void |
statusMsgExpert(java.lang.String msg)
Status msg for 'Experts' to the console |
void |
statusMsgLn(java.lang.String msg)
Put a msg line to the assigned status area |
void |
stop()
Request the modem thread to stop |
void |
write(byte[] data)
Write data to the output stream |
void |
write(java.lang.String data)
Write data to the output stream |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected java.lang.String eMsg
protected boolean abortRequest
protected boolean stopRequest
protected boolean stopWaitRing
protected java.lang.String evMsg
protected ModemEvent me
protected java.io.OutputStream mos
protected java.io.InputStream mis
protected ModemInterfaceProvider mip
protected ModemStatusAcceptor statusMsgNotify
protected java.util.Locale curLocale
protected java.util.ResourceBundle sMsgs
protected Serialio.SnoopLoop spy
protected Serialio.modem.Modem.ModemTask mTask
protected byte[] phoneNumber
public static final int INITIALIZE
public static final int DIAL_BLIND
public static final int CONNECT
public static final int ABORT
public static final int DISCONNECT
public static final int WAIT_DONE
public static final int STOP
public static final int WAIT_RING
public static final int GET_CONNECT
public static final int STOP_WAIT_RING
protected byte[] rdBuf
protected byte[] match
protected int rdCnt
protected java.lang.String[] controlName
| Constructor Detail |
public Modem()
public Modem(ModemInterfaceProvider mip,
java.io.OutputStream os,
java.io.InputStream is)
mip - the object providing the interface to the modem portos - the output stream the modem is connected tois - the input stream the modem is connected to| Method Detail |
public void start()
public void setLocale(java.util.Locale newLocale)
newLocale - the desired locale. providing the interface to the modem portpublic void setInterfaceProvider(ModemInterfaceProvider mip)
mip - the ModemInterfaceProvider
public void setStreams(java.io.OutputStream os,
java.io.InputStream is)
os - the output stream the modem is connected tois - the input stream the modem is connected topublic void setInitCommand(java.lang.String cmd)
cmd - the command stringpublic void setDialCommand(java.lang.String cmd)
cmd - the command stringpublic void setInitTime(int tmo)
tmo - the timeout in millisecspublic byte[] getConnectMsg()
public boolean isInitialized()
public void setModemStatusAcceptor(ModemStatusAcceptor viewer)
public ModemStatusAcceptor getModemStatusAcceptor()
public void setConnectWaitTime(int timeInSecs)
public int getConnectWaitTime()
public void setShowModemStatus(boolean onOff)
onOff - set true to enablepublic boolean getShowModemStatus()
public void setShowModemStatusExpert(boolean onOff)
onOff - set true to enablepublic boolean getShowModemStatusExpert()
public void setShowModemData(boolean onOff)
onOff - set true to enablepublic boolean getShowModemData()
public void setPhoneNumber(java.lang.String number)
public java.lang.String getPhoneNumber()
public void setNotifyBeforeModemEvent(boolean s)
public boolean getNotifyBeforeModemEvent()
public void snoopLoopEvent(byte[] streamData,
int cnt)
snoopLoopEvent in interface Serialio.SnoopLoopListenerpublic void snoopEvent(byte[] snoopData)
snoopEvent in interface Serialio.SnoopListenerpublic void request(int code)
code - the request code
protected void checkOpen()
throws ModemException
ModemException
protected void checkInitialized()
throws ModemException
ModemException
public void commandMode()
throws java.io.IOException,
java.lang.InterruptedException
IOException, - InterruptedException
java.io.IOException
java.lang.InterruptedException
public boolean cmdReply(java.lang.String snd,
java.lang.String waitData,
int tmo)
throws java.io.IOException,
java.lang.InterruptedException
snd - the data to sendwaitData - the data to wait fortmo - the timeout if waitData is not seen
IOException, - InterruptedException
java.io.IOException
java.lang.InterruptedException
public boolean cmdReply(byte[] snd,
byte[] waitData,
int tmo)
throws java.io.IOException,
java.lang.InterruptedException
snd - the data to sendwaitData - the data to wait fortmo - the timeout if waitData is not seen
IOException, - InterruptedException
java.io.IOException
java.lang.InterruptedException
public void setDTR(boolean onOff)
throws java.io.IOException
java.io.IOException
public void write(java.lang.String data)
throws java.io.IOException
java.io.IOException
public void write(byte[] data)
throws java.io.IOException
java.io.IOExceptionpublic void statusMsgExpert(java.lang.String msg)
public void statusMsg(java.lang.String msg)
public void statusMsgLn(java.lang.String msg)
public void abort()
public void stop()
public boolean contains(java.lang.String toMatch)
toMatch - The String to match the SerialData objectpublic java.lang.String hexString()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||