Visualizing the FSM

HTML Output

HTML pages can be generated with the -th command line switch.

PlantUML

Or, the PlantUML code for creating the following diagrams can be generated with the -tp command line switch.

/'
        hsmCommunicator.plantuml

        This file automatically generated by FSMLang


'/

@startuml
state IDLE
state ESTABLISHING_SESSION
state IN_SESSION
IDLE:  The wakeup state.  Also, this is the state to which the machine\n        returns when a session times out.\n    \n
ESTABLISHING_SESSION:  The machine is establishing a session.  The actual work is being done by the <i>establishSession</i>\n        submachine.  While in this state, the <i>MESSAGE_RECEIVED</i> event is forwarded to that submachine.\n    \n
IN_SESSION:  A session has been established, and messages are being exchanged with the peer.  While in this\n        state, the <i>MESSAGE_RECEIVED</i> event is forwarded to the <i>sendMessage</i> submachine.\n    \n

[*] --> IDLE
IDLE --> ESTABLISHING_SESSION : **Event:** SEND_MESSAGE\n**Action:** startSessionEstablishment\n**Event shared with:**\nsendMessage\n

note on link
 Start the session establishment process by activating the <i>establishSession</i> machine.
end note
ESTABLISHING_SESSION --> IN_SESSION : **Event:** SESSION_ESTABLISHED\n**Action:** completeSessionStart
note on link
 Start the session timer and notify the <i>sendMessage</i> machine that the session is established.
end note

note left of ESTABLISHING_SESSION
**These events loop back:**

SEND_MESSAGE: queueMessage
 Extend the session timer and queue the message

Shared with:
sendMessage

MESSAGE_RECEIVED: passMessageReceived
 Pass the MESSAGE_RECEIVED event along.

Shared with:
establishSession
sendMessage

end note
IN_SESSION --> IDLE : **Event:** SESSION_TIMEOUT\n**Action:** none

note left of IN_SESSION
**These events loop back:**

SEND_MESSAGE: requestMessageTransmission
 Extend the session timer and pass the message to be sent to the <i>sendMessage</i> machine.

Shared with:
sendMessage

MESSAGE_RECEIVED: passMessageReceived
 Pass the MESSAGE_RECEIVED event along.

Shared with:
establishSession
sendMessage

end note
@enduml

hsmCommunicator

/'
        establishSession.plantuml

        This file automatically generated by FSMLang


'/

@startuml
state IDLE
state AWAITING_RESPONSE

[*] --> IDLE
IDLE --> AWAITING_RESPONSE : **Event:** ESTABLISH_SESSION_REQUEST\n**Action:** sendStep0Message
note on link
 Start the session establishment process.
end note
AWAITING_RESPONSE --> IDLE : **Event:** STEP1_RESPONSE\n**Action:** notifyParent
note on link
 Notify parent that session is established.
end note

note left of AWAITING_RESPONSE
**These events loop back:**

STEP0_RESPONSE: sendStep1Message
 Continue session establisment

MESSAGE_RECEIVED: parseMessage
 Parse the incoming message

end note
@enduml

establishSession

/'
        sendMessage.plantuml

        This file automatically generated by FSMLang


'/

@startuml
state IDLE
state AWAITING_ACK

[*] --> IDLE
IDLE --> AWAITING_ACK : **Event:** (hsmCommunicator::) SEND_MESSAGE\n**Action:** sendMessage
note on link
 Dequeue and transmit message to the peer.
end note
AWAITING_ACK --> IDLE : **Event:** ACK\n**Action:** checkQueue
note on link
 Check queue for messages; if found return SEND_MESSAGE; otherwise, return noEvent.
end note
AWAITING_ACK --> AWAITING_ACK : **Event:** (hsmCommunicator::) MESSAGE_RECEIVED\n**Action:** parseMessage
@enduml

sendMessage