Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.etrice.doc/doc/030-tutorial-ped-lights.textile')
-rw-r--r--plugins/org.eclipse.etrice.doc/doc/030-tutorial-ped-lights.textile173
1 files changed, 2 insertions, 171 deletions
diff --git a/plugins/org.eclipse.etrice.doc/doc/030-tutorial-ped-lights.textile b/plugins/org.eclipse.etrice.doc/doc/030-tutorial-ped-lights.textile
index 3083dd045..a9f361d05 100644
--- a/plugins/org.eclipse.etrice.doc/doc/030-tutorial-ped-lights.textile
+++ b/plugins/org.eclipse.etrice.doc/doc/030-tutorial-ped-lights.textile
@@ -24,177 +24,8 @@ h2. Setup the model
* Use the ??New Model Wizzard?? to create a new eTrice project and name it ??PedLightsController??.
* Copy the package ??de.protos.PedLightGUI?? to your ??src?? directory (see blinky tutorial).
* In PedestrianLightWndNoTcp.jav uncomment line 15 (import), 36, 122 (usage) and 132-134 (registration).
-* Copy the following model to your model file:
-
-bc..
-RoomModel PedLightsController {
-
- LogicalSystem LogSys_PedLights {
- SubSystemRef application: SubSys_PedLights
- }
-
- SubSystemClass SubSys_PedLights {
- ActorRef PedLightsTopRef: PedLightsTop
- ActorRef timingService: room.basic.service.timing.ATimingService
- LayerConnection ref PedLightsTopRef satisfied_by timingService.timer
- LayerConnection ref PedLightsTopRef satisfied_by timingService.timeout
- }
-
- ActorClass PedLightsTop {
- Structure {
- ActorRef adapter: GuiAdapter
- ActorRef controller: Controller
- Binding adapter.ControlPort and controller.ControlPort
- }
- Behavior { }
- }
-
- ActorClass GuiAdapter {
- Interface {
- conjugated Port ControlPort: PedControlProtocol
- }
- Structure {
- usercode1 {
- "import PedLightGUI.*;"
- }
- usercode2 {
- "private PedestrianLightWndNoTcp lights = new PedestrianLightWndNoTcp(\"Pedestrian Lights\",\" external port connection \");"
- "private TrafficLight3 carLights;"
- "private TrafficLight2 pedLights;"
- }
- external Port ControlPort
- }
- Behavior {
- Operation destroyUser() {
- "lights.closeWindow();"
- }
- StateMachine {
- Transition init: initial -> running {
- action {
- "carLights=lights.getCarLights();"
- "pedLights=lights.getPedLights();"
- "carLights.setState(TrafficLight3.OFF);"
- "pedLights.setState(TrafficLight2.OFF);"
- "lights.setPort(ControlPort);"
- }
- }
- Transition tr0: running -> running {
- triggers {
- <setCarLights: ControlPort>
- }
- action {
- "carLights.setState(state);"
- }
- }
- Transition tr1: running -> running {
- triggers {
- <setPedLights: ControlPort>
- }
- action {
- "pedLights.setState(state);"
- }
- }
- State running
- }
- }
- }
-
- ActorClass Controller {
- Interface {
- Port ControlPort: PedControlProtocol
- }
- Structure {
- usercode1 {
- "import PedLightGUI.*;"
- }
- external Port ControlPort
- SAP timer: room.basic.service.timing.PTimeout
- }
- Behavior {
- StateMachine {
- Transition init: initial -> off { }
- Transition tr0: off -> carsGreen {
- triggers {
- <start: ControlPort>
- }
- action {
- "timer.Start(700);"
- "ControlPort.setCarLights(TrafficLight3.GREEN);"
- "ControlPort.setPedLights(TrafficLight2.RED);"
- }
- }
- Transition tr1: carsGreen -> carsYellow {
- triggers {
- <timeoutTick: timer>
- }
- action {
- "timer.Start(700);"
- "ControlPort.setCarLights(TrafficLight3.YELLOW);"
- "ControlPort.setPedLights(TrafficLight2.RED);"
- }
- }
- Transition tr2: carsYellow -> carsRed {
- triggers {
- <timeoutTick: timer>
- }
- action {
- "timer.Start(1500);"
- "ControlPort.setCarLights(TrafficLight3.RED);"
- "ControlPort.setPedLights(TrafficLight2.GREEN);"
- }
- }
- Transition tr3: carsRed -> carsYellowRed {
- triggers {
- <timeoutTick: timer>
- }
- action {
- "timer.Start(700);"
- "ControlPort.setCarLights(TrafficLight3.YELLOW_RED);"
- "ControlPort.setPedLights(TrafficLight2.RED);"
- }
- }
- Transition tr4: carsYellowRed -> carsGreen2 {
- triggers {
- <timeoutTick: timer>
- }
- action {
- "timer.Start(700);"
- "ControlPort.setCarLights(TrafficLight3.GREEN);"
- "ControlPort.setPedLights(TrafficLight2.RED);"
- }
- }
- Transition tr5: carsGreen2 -> off {
- triggers {
- <timeoutTick: timer>
- }
- action {
- "ControlPort.setCarLights(TrafficLight3.OFF);"
- "ControlPort.setPedLights(TrafficLight2.OFF);"
- }
- }
- State off
- State carsGreen
- State carsYellow
- State carsRed
- State carsYellowRed
- State carsGreen2
- }
- }
- }
-
- ProtocolClass PedControlProtocol {
- incoming {
- Message start()
- }
- outgoing {
- Message setCarLights(state: int32)
- Message setPedLights(state: int32)
- }
- }
-}
-bq.
-
-* Arrange the Structure and the Statemachines to understand the model
+* Copy the model from /org.eclipse.etrice.tutorials/model/PedLightsController to your model file, or run the model directly in the tutorial directory:
+* Arrange the Structure and the Statemachines to understand the model
!images/030-PedLights01.PNG!
The ??GuiAdapter?? represents the interface to the external code. It registers its ??ControlPort?? by the external code.

Back to the top