cnrg.itx.gtwy
Class ListenChannel

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--cnrg.itx.gtwy.ListenChannel

public class ListenChannel
extends java.lang.Thread

Takes care of servicing incoming calls from the phone. Sets up a connection with a computer if a call has been accepted. Services the next incoming phone call when the connection ends or the previous call has been rejected.


Field Summary
private  Gateway myGate
          The Gateway instance.
private  Line myLine
          The Line instance corresponding to ListenChannel's line.
 
Fields inherited from class java.lang.Thread
contextClassLoader, daemon, eetop, group, inheritedAccessControlContext, MAX_PRIORITY, MIN_PRIORITY, name, NORM_PRIORITY, priority, single_step, stillborn, stopThreadPermission, target, threadInitNumber, threadQ, values
 
Constructor Summary
protected ListenChannel(Line lin, Gateway g)
           
 
Method Summary
(package private) static void ()
           
private  java.lang.String getExtension(int chDev, boolean isSecondTime)
          This is where the channel gets the phone's requested extension number.
protected  void makeWait()
          Puts the ListenChannel to "sleep".
private  void rejectCallMessage(int chDev)
          Plays out a message to a phone when a call has been rejected.
protected  void restart()
          "Wakes up" the ListenChannel to listen for the next incoming call.
 void run()
           
private  void waitForCall(int chDev)
          Sets up the channel to wait for a phone to dial in.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, exit, getContextClassLoader, getName, getPriority, getThreadGroup, init, interrupt, interrupt0, interrupted, isAlive, isDaemon, isInterrupted, isInterrupted, join, join, join, nextThreadNum, registerNatives, resume, resume0, setContextClassLoader, setDaemon, setName, setPriority, setPriority0, sleep, sleep, start, stop, stop, stop0, suspend, suspend0, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myLine

private Line myLine
The Line instance corresponding to ListenChannel's line.

myGate

private Gateway myGate
The Gateway instance.
Constructor Detail

ListenChannel

protected ListenChannel(Line lin,
                        Gateway g)
Parameters:
lin - the Line instance corresponding to ListenChannel's line. Provides information concerning that line.
g - the Gateway instance to access line state.
See Also:
Line, Gateway
Method Detail

static void ()

makeWait

protected void makeWait()
Puts the ListenChannel to "sleep". Used when a connection is being set up.
See Also:
Gateway.setUpConnection(Line, Connection)

restart

protected void restart()
"Wakes up" the ListenChannel to listen for the next incoming call.

run

public void run()
Overrides:
run in class java.lang.Thread
See Also:
Runnable

waitForCall

private void waitForCall(int chDev)
Sets up the channel to wait for a phone to dial in.
Parameters:
chDev - the channel's device handler.

getExtension

private java.lang.String getExtension(int chDev,
                                      boolean isSecondTime)
This is where the channel gets the phone's requested extension number. Number corresponds with whomever phone user wishes to contact.
Parameters:
chDev - the channel's device handler.
isSecondTime - true if this is not the first call to getExtension during session.
Returns:
the extension number.

rejectCallMessage

private void rejectCallMessage(int chDev)
Plays out a message to a phone when a call has been rejected.
Parameters:
chDev - the channel's device handler.