@startuml Power_Control participant TD as TD participant SW as SW participant UI as UI actor USER as US 'Possible actions and interaction types ' External on CANBus ' TD -> SW: MSG: Message ' SW -> TD: MSG: Message ' Internal to the application ' XX -> YY: CMD: Command ' XX -> XX: ACT: Action ' External on OS/FS ' SW -> Script: ACT: Command ' Script -> OS: CMD: Command ' Script -> SW: MSG: Message ' OS -> Script: MSG: Message ' US -> UI: User actions are: ' ASK: Display a ' ENT: User enters a value or string ' TCH: User touches a button (RadioButton, CheckBox, ...) ' SCL: User scrolls a flip-able area == Power Off Sequence == US -> TD: TCH: Press Hard Power Button alt Accepted TD -> SW: MSG: [xB5: #3] Confirm Request \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mCommand=0 (GENERIC_CONFIRM_CMD_REQUEST_OPEN) \ \n\t(U32) mReason=0 SW -> UI: ACT: Power Off Request UI -> US: ACT: Display Confirm shutdown dialog alt User Presses Cancel US -> UI: TCH: Press Cancel UI -> SW: ACT: Shutdown confirm response SW -> TD: MSG: [xB6: #2] Response \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mConfirm=0(cancel) TD -> SW: MSG: [xB5: #3] Confirm Request \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mCommand=3 (GENERIC_CONFIRM_CMD_ACCEPT_CLOSE) \ \n\t(U32) mReason=0 SW -> UI: ACT: Confirm Request close dialog UI -> US: ACT: Close Dialog else #LightBlue User Presses Shutdown US -> UI: TCH: Press Shutdown UI -> SW: ACT: Shutdown confirm response SW -> TD: MSG: [xB6: #2] Response \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mConfirm=1 (shutdown) alt Accepted TD -> SW: MSG: [xB5: #3] Confirm Request \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mCommand=3 (GENERIC_CONFIRM_CMD_ACCEPT_CLOSE) \ \n\t(U32) mReason=0 SW -> UI: ACT: Confirm Request close dialog UI -> US: ACT: Close Dialog TD -> SW: MSG: [x22: #0] Power Off Warning TD -> TD: ACT: Shutdown System ⟲ (May take a ~2 seconds) SW -> UI: ACT: Power Off Warning UI -> US: ACT: Display auto-close dialog (5 seconds)\ \n\tNotify user system is shutting down else #Pink Rejected TD -> SW: MSG: [xB5: #3] Confirm Request \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mCommand=2 (GENERIC_CONFIRM_CMD_REJECT) \ \n\t(U32) mReason>0 SW -> UI: ACT: Confirm Request rejected UI -> US: ACT: Display rejection reason end end else #Pink Rejected TD -> SW: MSG: [xB5: #3] Confirm Request \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mCommand=2 (GENERIC_CONFIRM_CMD_REJECT) \ \n\t(U32) mReason>0 SW -> UI: ACT: Confirm Request rejected UI -> US: ACT: Display Auto-Hide dialog with rejection reason end == Power Off Sequence Timeout == loop Timeout US -> US: ACT: User idle for timeout limit end TD -> SW: MSG: [xB5: #3] Confirm Request \ \n\t(U32) mId=0 (Shutdown) \ \n\t(U32) mCommand=1 (GENERIC_CONFIRM_CMD_TIMEOUT_CLOSE) \ \n\t(U32) mReason=0 SW -> UI: ACT: Confirm Request timeout close UI -> US: ACT: Close Dialog @enduml