📄 topstate1.vsr
字号:
@visualSTATE @RuleBase @Format2 "NoName"
@Directives
@visualSTATE 5-4-1-1290;
@Date 2008-07-21;
@Time 17:00:36;
@Declaration
@ActionFunction
VS_VOID CashDoorClosed(),
VS_VOID CashDoorOpen(),
VS_BOOL CheckAccount(),
VS_BOOL CheckPassword(),
VS_VOID DeductAccount(),
VS_VOID EjectCard(),
VS_VOID GetAccount(),
VS_VOID GetCashRequire(),
VS_VOID InputPasswordInterface(),
VS_VOID MainServiceInterface(),
VS_VOID WelcomeInterface();
@Definition
@Event
evCardInserted()
[[ Expl = "This event should be send when the card is inserted or taken out.0x0d0x0aThe argument indicates if it was inserted.0x0d0x0aIf 0 then it was taken out else it was inserted."
]],
evCashTaken(),
evGetCash(),
evKeyBack(),
evKeyEnter()
[[ Expl = "This event should be send when the password is examined.0x0d0x0aThe argument indicates if it was valid.0x0d0x0aIf 0 then it was invalid else it was valid."
]],
evKeyExit();
@InternalVariable
VS_BOOL bValid = { 0 };
@Signal
sChecked(),
sFail(),
sOpenDoor(),
sPass();
@Implementation
@StateMachine StateMachineSpec_6 =
@State;
@StateRegion;
@Entry;
@Exit;
@Do;
@InternalRule
evKeyEnter() : [|bValid=CheckAccount()|] ^sChecked();
@TransitionRule;
@TerminationRule;
@End;
@StateMachine StateMachineSpec_5 =
@State;
@StateRegion;
@Entry
#MainServiceInterface();
@Exit;
@Do;
@InternalRule;
@TransitionRule;
@TerminationRule;
@End;
@StateMachine StateMachineSpec_4 =
@State;
@StateRegion;
@Entry
#WelcomeInterface();
@Exit;
@Do;
@InternalRule;
@TransitionRule;
@TerminationRule;
@End;
@StateMachine StateMachineSpec_3 (@State StateArgument_26) =
@State
Editing = StateMachineSpec_6
[[ Pos440 = "369 526 505 573 16 1 1638401" ]],
@Initial _InitialState1
[[ Pos440 = "340 491 360 511 114689" ]],
Cashing
[[ Pos440 = "371 617 507 665 16 1 1638401" ]];
@StateRegion
Region1 (Editing, _InitialState1, Cashing)
[[ Pos440 = "0 0 200 181" ]];
@Entry
#GetCashRequire();
@Exit;
@Do;
@InternalRule;
@TransitionRule
sPass() @Src Editing : @Dest Cashing StateArgument_26 #CashDoorOpen()
^sOpenDoor()
[[ Pos440 = "360 580 473 610 1 809894017 0 33 350 598 0 19" ]],
sFail() @Src Editing : @Dest Editing
[[ Pos440 = "448 500 528 530 1 809894017 126 0 515 506 525 516 136 10"
]],
@NoEvent @Src _InitialState1 : @Dest Editing
[[ Pos440 = "336 501 416 531 0 809894016 16 20 8 0" ]];
@TerminationRule;
@End;
@StateMachine StateMachineSpec_2 (@State StateArgument_23,
@State StateArgument_26) =
@State
Main = StateMachineSpec_5
[[ Pos440 = "68 501 195 591 16 1 1638401" ]],
GetCash = StateMachineSpec_3 (StateArgument_26)
[[ Pos440 = "334 452 534 668 35 1 114689" ]],
@Initial _InitialState2
[[ Pos440 = "47 460 67 480 114689" ]];
@StateRegion
Region1 (Main, GetCash, _InitialState2)
[[ Pos440 = "0 0 499 229" ]];
@Entry;
@Exit;
@Do;
@InternalRule;
@TransitionRule
evGetCash() @Src Main : @Dest GetCash
[[ Pos440 = "217 478 297 508 1 809894017 127 17 257 500 0 60" ]],
evKeyBack() @Src GetCash !StateArgument_23 : @Dest Main
[[ Pos440 = "220 554 300 581 0 809894016 0 86 127 37" ]],
@NoEvent @Src _InitialState2 : @Dest Main
[[ Pos440 = "38 480 75 509 0 809894016 20 8 0 1" ]];
@TerminationRule;
@End;
@StateMachine StateMachineSpec_1 =
@State;
@StateRegion
Region1
[[ Pos440 = "0 0 210 44" ]];
@Entry
#InputPasswordInterface();
@Exit;
@Do;
@InternalRule
evKeyEnter() : [|bValid=CheckPassword()|] ^sChecked();
@TransitionRule;
@TerminationRule;
@End;
@StateMachine StateMachineSpec_0 =
@State
WelcomeInterface = StateMachineSpec_4
[[ Pos440 = "72 173 524 207 16 1 1638401" ]],
@Initial _InitialState0
[[ Pos440 = "26 172 46 192 114689" ]],
CheckUser = StateMachineSpec_1
[[ Pos440 = "83 270 293 381 67 1 114689" ]],
Service = StateMachineSpec_2 (Open, Invalid)
[[ Pos440 = "43 426 542 671 16 1 114689" ]],
NoCard
[[ Pos440 = "652 229 754 289 16 1 1638401" ]],
CardPresent
[[ Pos440 = "655 396 754 455 16 1 1638401" ]],
@Initial _InitialState3
[[ Pos440 = "626 185 646 205 114689" ]],
Closed
[[ Pos440 = "899 235 1011 300 16 1 1638401" ]],
Open
[[ Pos440 = "896 387 1016 450 16 1 1638401" ]],
@Initial _InitialState4
[[ Pos440 = "870 195 890 215 114689" ]],
Invalid
[[ Pos440 = "1139 238 1248 301 16 1 1638401" ]],
Valid
[[ Pos440 = "1141 388 1252 453 16 1 1638401" ]],
@Initial _InitialState5
[[ Pos440 = "1117 192 1137 212 114689" ]];
@StateRegion
rATMOperationStatus (WelcomeInterface, _InitialState0, CheckUser, Service)
[[ Pos440 = "0 0 568 561" ]],
rCardStatus (NoCard, CardPresent, _InitialState3)
[[ Pos440 = "1 0 246 561" ]],
rCashDoorStatus (Closed, Open, _InitialState4)
[[ Pos440 = "2 0 248 561" ]],
rCheckStatus (Invalid, Valid, _InitialState5)
[[ Pos440 = "3 0 237 561" ]];
@Entry;
@Exit;
@Do;
@InternalRule;
@TransitionRule
@NoEvent @Src _InitialState0 : @Dest WelcomeInterface
[[ Pos440 = "15 190 95 220 0 809894016 20 10 0 7" ]],
sPass() @Src CheckUser : @Dest Service Invalid
[[ Pos440 = "128 389 231 428 0 809894016 42 111 82 0" ]],
sFail() @Src CheckUser : @Dest WelcomeInterface NoCard
[[ Pos440 = "330 313 410 343 1 809894017 210 58 366 299 326 34" ]],
evKeyExit() @Src Service !Open : @Dest WelcomeInterface
[[ Pos440 = "478 306 558 336 0 809894016 421 0 392 34" ]],
evCardInserted() @Src NoCard : @Dest CardPresent CheckUser #GetAccount()
[[ Pos440 = "596 318 676 348 0 809894017 24 60 21 0" ]],
evKeyExit() @Src CardPresent !Open !CheckUser : @Dest NoCard
WelcomeInterface #EjectCard()
[[ Pos440 = "728 321 808 351 0 809894017 73 0 76 60" ]],
@NoEvent @Src _InitialState3 : @Dest NoCard
[[ Pos440 = "617 197 697 227 0 809894016 20 16 12 0" ]],
sOpenDoor() @Src Closed : @Dest Open
[[ Pos440 = "853 330 933 360 0 809894016 34 65 37 0" ]],
evCashTaken() @Src Open : @Dest Closed Service.Main #CashDoorClosed()
#DeductAccount()
[[ Pos440 = "984 330 1064 360 0 809894016 85 0 82 65" ]],
@NoEvent @Src _InitialState4 : @Dest Closed
[[ Pos440 = "861 204 941 234 0 809894016 20 20 11 0" ]],
sChecked() @Src Invalid [|bValid!=0|] : @Dest Valid ^sPass()
[[ Pos440 = "1082 323 1162 372 0 809894016 23 63 21 0" ]],
sChecked() @Src Invalid [|bValid==0|] : @Dest Invalid ^sFail()
[[ Pos440 = "1192 169 1272 225 1 809894017 99 0 1258 218 1268 228 109 10"
]],
@NoEvent @Src _InitialState5 : @Dest Invalid
[[ Pos440 = "1110 203 1190 233 0 809894016 20 17 13 0" ]];
@TerminationRule;
@End;
@TopStateMachine ATM =
@State
ATMPowerOn = StateMachineSpec_0
[[ Pos440 = "15 98 1314 696 37 1 114689" ]],
@Initial _InitialState6
[[ Pos440 = "14 57 34 77 114689" ]];
@StateRegion
@OffPage Region1 (ATMPowerOn, _InitialState6)
[[ Pos440 = "0 0 120 34", TextDisplayNote = "Preserve",
TextDisplayState = "Preserve", TextDisplayTransDesc = "Preserve",
View = "2 2 7" ]];
@Entry;
@Exit;
@Do;
@InternalRule;
@TransitionRule
@NoEvent @Src _InitialState6 : @Dest ATMPowerOn
[[ Pos440 = "-1 69 79 99 0 809894016 11 20 36 0" ]];
@TerminationRule;
[[ Pos440 = "10 10 130 60 16 1 114689" ]]
@End;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -