===================
Visualizing the FSM
===================
-----------
HTML Output
-----------
`HTML pages <../_static/HSM/hsmCommunicator.html>`_ 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.
.. uml::
:width: 100%
:caption: hsmCommunicator
/'
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 establishSession\n submachine. While in this state, the MESSAGE_RECEIVED 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 MESSAGE_RECEIVED event is forwarded to the sendMessage 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 establishSession machine.
end note
ESTABLISHING_SESSION --> IN_SESSION : **Event:** SESSION_ESTABLISHED\n**Action:** completeSessionStart
note on link
Start the session timer and notify the sendMessage 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 sendMessage machine.
Shared with:
sendMessage
MESSAGE_RECEIVED: passMessageReceived
Pass the MESSAGE_RECEIVED event along.
Shared with:
establishSession
sendMessage
end note
@enduml
.. uml::
:width: 100%
:caption: establishSession
/'
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
.. uml::
:width: 100%
:caption: sendMessage
/'
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