public class Connection extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
accumulatedKeys |
private static int |
CHANGE_GREETING |
private static int |
CHANGE_PASSCODE |
private static int |
CONNECTED |
private Mailbox |
currentMailbox |
private java.lang.String |
currentRecording |
private static int |
DISCONNECTED |
private static java.lang.String |
INITIAL_PROMPT |
private static int |
MAILBOX_MENU |
private static java.lang.String |
MAILBOX_MENU_TEXT |
private static int |
MESSAGE_MENU |
private static java.lang.String |
MESSAGE_MENU_TEXT |
private Telephone |
phone |
private static int |
RECORDING |
private int |
state |
private MailSystem |
system |
Constructor and Description |
---|
Connection(MailSystem s,
Telephone p)
Construct a Connection object.
|
Modifier and Type | Method and Description |
---|---|
private void |
changeGreeting(java.lang.String key)
Change greeting.
|
private void |
changePasscode(java.lang.String key)
Change passcode.
|
private void |
connect(java.lang.String key)
Try to connect the user with the specified mailbox.
|
void |
dial(java.lang.String key)
Respond to the user's pressing a key on the phone touchpad
|
void |
hangup()
The user hangs up the phone.
|
private void |
login(java.lang.String key)
Try to log in the user.
|
private void |
mailboxMenu(java.lang.String key)
Respond to the user's selection from mailbox menu.
|
private void |
messageMenu(java.lang.String key)
Respond to the user's selection from message menu.
|
void |
record(java.lang.String voice)
Record voice.
|
private void |
resetConnection()
Reset the connection to the initial state and prompt
for mailbox number
|
private MailSystem system
private Mailbox currentMailbox
private java.lang.String currentRecording
private java.lang.String accumulatedKeys
private int state
private static final int DISCONNECTED
private static final int CONNECTED
private static final int RECORDING
private static final int MAILBOX_MENU
private static final int MESSAGE_MENU
private static final int CHANGE_PASSCODE
private static final int CHANGE_GREETING
private static final java.lang.String INITIAL_PROMPT
private static final java.lang.String MAILBOX_MENU_TEXT
private static final java.lang.String MESSAGE_MENU_TEXT
public Connection(MailSystem s, Telephone p)
s
- a MailSystem objectp
- a Telephone objectpublic void dial(java.lang.String key)
key
- the phone key pressed by the userpublic void record(java.lang.String voice)
voice
- voice spoken by the userpublic void hangup()
private void resetConnection()
private void connect(java.lang.String key)
key
- the phone key pressed by the userprivate void login(java.lang.String key)
key
- the phone key pressed by the userprivate void changePasscode(java.lang.String key)
key
- the phone key pressed by the userprivate void changeGreeting(java.lang.String key)
key
- the phone key pressed by the userprivate void mailboxMenu(java.lang.String key)
key
- the phone key pressed by the userprivate void messageMenu(java.lang.String key)
key
- the phone key pressed by the user