This machine manages communications using a "stop and wait" protocol. Only one message is allowed to be outstanding.
| Number of events | 3 |
|---|---|
| Events not handled | 0 |
| Events handled in one state | 1 |
| At least one event handled the same in all states? | yes |
| Number of states | 2 |
| Number of states with entry functions | 0 |
| Number of states with exit functions | 0 |
| States handling no events | 0 |
| States handling exactly one event | 0 |
| States with no way in | 0 |
| States with no way out | 0 |
| SEND_MESSAGE | NEVER_SEEN | ACK | |
|---|---|---|---|
| IDLE | sendMessage returns:
transition : AWAITING_ACK Since we're idle, we can simply send the message. Transitioning to the AWAITING_ACK state ensures that any other messages we're asked to send will be queued. |
neverExecuted transition : none |
transition : none |
| AWAITING_ACK | queueMessage returns:
transition : none Since we're busy, we must queue the message for later sending. The queue will be checked when the ACK is received. |
neverExecuted transition : none |
checkQueue returns:
transition : IDLE We've received our ACK for the previous message. It is time to check for any others. |
| Events | |||||||||
|---|---|---|---|---|---|---|---|---|---|
|
|||||||||
| SEND_MESSAGE |
Handled In 2 of 2 (100 %) States:
Causes these actions to be taken:
|
||||||||
| NEVER_SEEN |
Handled In 2 of 2 (100 %) States:
Causes these actions to be taken:
|
||||||||
| ACK |
Handled In 1 of 2 (50 %) States:
Causes these actions to be taken:
|
||||||||
| States | |||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||
| IDLE |
Inbound Transitions:
Outbound Transitions:
Events Handled (2 of 3 for 66%):
Actions Taken:
| ||||||||||||
| AWAITING_ACK |
Inbound Transitions:
Outbound Transitions:
Events Handled (3 of 3 for 100%):
Actions Taken:
| ||||||||||||
| Actions | |
|---|---|
| neverExecuted |
Matrices:
|
| sendMessage |
sendMessage sends a message from the queue. The
message is expected to be there, since
checkQueue will have been previously called.
Returns:
Matrices:
|
| queueMessage |
queueMessage adds a message to the queue
Returns:
Matrices:
|
| checkQueue |
checkQueue only checks; it does not dequeue; that
is done by sendMessage.
Return SEND_MESSAGE when the queue is not empty.
Returns:
Matrices:
|