Professional Documents
Culture Documents
RunPlayService(CurrentEvent)
Switch on CurrentState
Case WAITING_TO_START:
Set ReturnEvent and CurrentEvent to return value of
DuringWaiDngToStart funcDon with parameter CurrentEvent
If EventType of CurrentEvent is not ES_NO_EVENT
Switch on EventType of CurrentEvent
Case EV_STATE_CHANGE:
Set NextState to EventParam of CurrentEvent
Set MakeTransiDon to true
Break
Case ES_TIMEOUT
If EventParam of CurrentEvent is LED_TIMER
Start LED_TIMER
Toggle LED pin
Endif
Break
Endswitch
Endif
Break
Case FACE_OFF:
Set ReturnEvent and CurrentEvent to return value of
DuringFaceOff funcDon with parameter CurrentEvent
If EventType of CurrentEvent is not ES_NO_EVENT
Switch on EventType of CurrentEvent
Case EV_STATE_CHANGE:
Set NextState to EventParam of CurrentEvent
Set MakeTransiDon to true
Set EventType of EntryEventKind to ES_ENTRY
Break
Endswitch
Endif
Break
Case OFFENSE:
Set ReturnEvent and CurrentEvent to return value of
DuringOffense funcDon with parameter CurrentEvent
If EventType of CurrentEvent is not ES_NO_EVENT
Switch on EventType of CurrentEvent
Case EV_STATE_CHANGE:
Set NextState to EventParam of CurrentEvent
Set MakeTransiDon to true
Break
Case EV_EARLY_DEFENSE
Set NextState to DEFENSE
Set MakeTransiDon to true
Break
Case ES_TIMEOUT
If EventParam of CurrentEvent is GAME_TIMER
Set NextState to EventParam of CurrentEvent
If return value of GetShotClock funcDon is
greater than or equal to 5.5 seconds
Start GAME_TIMER_2
Endif
Elseif EventParam of CurrentEvent is GAME_TIMER_2
Set NextState to EvenParam of CurrentEvent
If return value of GetRedScore funcDon is
return value of GetBlueScore funcDon
Declare OverDmeEvent as type ES_Event_t
Set EventType of OverDmeEvent as
EV_STATE_CHANGE
Set EventParam of OverDmeEvent as OVERTIME
Call PostMasterSM with parameter OverDmeEvent
Endif
Endif
Break
Endswitch
Endif
Break
Case DEFENSE:
Set ReturnEvent and CurrentEvent to return value of
DuringDefense funcDon with parameter CurrentEvent
If EventType of CurrentEvent is not ES_NO_EVENT
Switch on EventType of CurrentEvent
Case EV_STATE_CHANGE:
If EventParam of CurrentEvent is not DEFENSE
Set NextState to EventParam of CurrentEvent
Set MakeTransiDon to true
Endif
Break
Endswitch
Endif
Break
Case GAME_OVER:
Set ReturnEvent and CurrentEvent to return value of
DuringGameOver funcDon with parameter CurrentEvent
If EventType of CurrentEvent is not ES_NO_EVENT
Switch on EventType of CurrentEvent
Case EV_STATE_CHANGE:
Set NextState to EventParam of CurrentEvent
Set MakeTransiDon to true
Break
Endswitch
Endif
Break
Case OVERTIME:
Set ReturnEvent and CurrentEvent to return value of
DuringOverDme funcDon with parameter CurrentEvent
If EventType of CurrentEvent is not ES_NO_EVENT
Switch on EventType of CurrentEvent
Case EV_STATE_CHANGE:
If EventType of CurrentEvent is not OVERTIME
Set MakeTransiDon to true
Set NextState to EventParam of CurrentEvent
Endif
Break
Endswitch
Endif
Break
Endswitch
If MakeTransiDon is true
Set EventType of CurrentEvent to ES_EXIT
Call RunPlayService funcDon with parameter CurrentEvent
Set CurrentState to NextState
Call RunPlayService with parameter EntryEventKind
Endif
Return ReturnEvent
End of funcDon
StartPlayService(CurrentEvent)
End of funcDon
QueryPlayService
Return CurrentState
End of funcDon
GetTeamColor
Return TeamColor
End of funcDon
ResetGoalEdges
Set NumGoalEdges to 0
End of funcDon
ResetReloadEdges
Set NumReloadEdges to 0
End of funcDon
ReadTeamColor
DuringWaiDngToStart(Event)
Else
Endif
Return ReturnEvent
End of funcDon
DuringFaceOff(Event)
Return ReturnEvent
End of funcDon
DuringOffense(Event)
Return ReturnEvent
End of funcDon
DuringDefense(Event)
Return ReturnEvent
End of funcDon
DuringDuringGameOver(Event)
Else
Endif
Return ReturnEvent
End of funcDon
DuringOverDme(Event)
Return ReturnEvent
End of funcDon
OverDme_ISR
End of funcDon
Goal_Beacon_ISR
End of funcDon
Reload_Beacon_ISR
End of funcDon