Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-01-20 10:47:26 +0000
committerHenrik Rentz-Reichert2012-01-20 10:47:26 +0000
commitedaf429ae3856c19eaa729d843d90febe4fd5d42 (patch)
treeb59198c6725da9ed29dcd0d4bbde9f45d82d09d0 /examples/org.eclipse.etrice.tutorials
parent256d137bee23040a655b4d3c99946f0b834b316a (diff)
downloadorg.eclipse.etrice-edaf429ae3856c19eaa729d843d90febe4fd5d42.tar.gz
org.eclipse.etrice-edaf429ae3856c19eaa729d843d90febe4fd5d42.tar.xz
org.eclipse.etrice-edaf429ae3856c19eaa729d843d90febe4fd5d42.zip
[tutorials, ui.runtime] import of JavaTypes.room
Diffstat (limited to 'examples/org.eclipse.etrice.tutorials')
-rw-r--r--examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room335
-rw-r--r--examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room274
2 files changed, 306 insertions, 303 deletions
diff --git a/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room b/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room
index 48876222e..37cf6c1e9 100644
--- a/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room
+++ b/examples/org.eclipse.etrice.tutorials/model/PedLightsController/PedLightsController.room
@@ -1,168 +1,169 @@
-RoomModel PedLightsController {
-
- import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib/models/TimingService.room"
-
- LogicalSystem LogSys_PedLights {
- SubSystemRef application: SubSys_PedLights
- }
-
- SubSystemClass SubSys_PedLights {
- ActorRef PedLightsTopRef: PedLightsTop
- ActorRef timingService: 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 org.eclipse.etrice.tutorials.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 org.eclipse.etrice.tutorials.PedLightGUI.*;"
- }
- external Port ControlPort
- SAP timer: 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)
- }
- }
-
+RoomModel PedLightsController {
+
+ import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib/models/TimingService.room"
+ import room.basic.types.java.* from "../../../org.eclipse.etrice.modellib/models/JavaTypes.room"
+
+ LogicalSystem LogSys_PedLights {
+ SubSystemRef application: SubSys_PedLights
+ }
+
+ SubSystemClass SubSys_PedLights {
+ ActorRef PedLightsTopRef: PedLightsTop
+ ActorRef timingService: 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 org.eclipse.etrice.tutorials.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 org.eclipse.etrice.tutorials.PedLightGUI.*;"
+ }
+ external Port ControlPort
+ SAP timer: 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)
+ }
+ }
+
} \ No newline at end of file
diff --git a/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room b/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room
index ed6184d09..fc2bcc25f 100644
--- a/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room
+++ b/examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room
@@ -1,137 +1,139 @@
-RoomModel SendingData {
-
- LogicalSystem SendingData_LogSystem {
- SubSystemRef SendingDataAppl: SendingData_SubSystem
- }
-
- SubSystemClass SendingData_SubSystem {
- ActorRef SendigDataTopRef: SendingDataTop
- }
-
- ActorClass SendingDataTop {
- Structure {
- ActorRef ref0: MrPing
- ActorRef ref1: MrPong
- Binding ref0.PingPongPort and ref1.PingPongPort
- }
- Behavior { }
- }
-
- ActorClass MrPing {
- Interface {
- conjugated Port PingPongPort: PingPongProtocol
- }
- Structure {
- external Port PingPongPort
- }
- Behavior {
-
- Operation printData(d: DemoData) : void {
- "System.out.printf(\"d.int32Val: %d\\n\",d.int32Val);"
- "System.out.printf(\"d.float64Val: %f\\n\",d.float64Val);"
- "System.out.printf(\"d.int8Array: \");"
- "for(int i = 0; i<d.int8Array.length; i++) {"
- "System.out.printf(\"%d \",d.int8Array[i]);}"
- "System.out.printf(\"\\nd.stringVal: %s\\n\",d.stringVal);"
- }
-
- StateMachine {
- Transition wait2: waitForPong -> waitForPong {
- triggers {
- <pong: PingPongPort>
- }
- action {
- "printData(data);"
- }
- }
- Transition wait1: waitForPongSimple -> waitForPongSimple {
- triggers {
- <pongSimple: PingPongPort guard {
- "data < 10"
- }>
- }
- action {
- "// keep in mind that MrPong increments"
- "PingPongPort.pingSimple(data);"
- "System.out.printf(\"data: %d\\n\",data);"
- }
- }
- Transition next: waitForPongSimple -> waitForPong {
- triggers {
- <pongSimple: PingPongPort>
- }
- action {
- "System.out.printf(\"data: %d\\n\",data);"
- ""
- "DemoData d = new DemoData();"
- "// send the default values"
- "PingPongPort.ping(d);"
- "d.int32Val=815;"
- "for (int i = 0; i<d.int8Array.length;i++){"
- "\td.int8Array[i]=(byte)(i+100);"
- "\t}"
- "d.stringVal=\"some contents\";"
- "d.float64Val=3.141234;"
- "PingPongPort.ping(d);"
- }
- }
- Transition init0: initial -> waitForPongSimple {
- action {
- "PingPongPort.pingSimple(0);"
- }
- }
- State waitForPong
- State waitForPongSimple
- }
- }
- }
-
- ActorClass MrPong {
- Interface {
- Port PingPongPort: PingPongProtocol
- }
- Structure {
- external Port PingPongPort
- }
- Behavior {
- StateMachine {
- Transition init: initial -> looping { }
- Transition tr0: looping -> looping {
- triggers {
- <ping: PingPongPort>
- }
- action {
- "PingPongPort.pong(data);"
- }
- }
- Transition tr1: looping -> looping {
- triggers {
- <pingSimple: PingPongPort>
- }
- action {
- "PingPongPort.pongSimple(data+1);"
- }
- }
- State looping
- }
- }
- }
-
- ProtocolClass PingPongProtocol {
- incoming {
- Message ping(data: DemoData)
- Message pingSimple(data: int32)
- }
- outgoing {
- Message pong(data: DemoData)
- Message pongSimple(data: int32)
- }
- }
-
- DataClass DemoData {
- Attribute int32Val: int32 = "4711"
- Attribute int8Array [ 10 ]: int8 = "{1,2,3,4,5,6,7,8,9,10}"
- Attribute float64Val: float64 = "0.0"
- Attribute stringVal: string = "\"empty\""
- }
+RoomModel SendingData {
+
+ import room.basic.types.java.* from "../../../org.eclipse.etrice.modellib/models/JavaTypes.room"
+
+ LogicalSystem SendingData_LogSystem {
+ SubSystemRef SendingDataAppl: SendingData_SubSystem
+ }
+
+ SubSystemClass SendingData_SubSystem {
+ ActorRef SendigDataTopRef: SendingDataTop
+ }
+
+ ActorClass SendingDataTop {
+ Structure {
+ ActorRef ref0: MrPing
+ ActorRef ref1: MrPong
+ Binding ref0.PingPongPort and ref1.PingPongPort
+ }
+ Behavior { }
+ }
+
+ ActorClass MrPing {
+ Interface {
+ conjugated Port PingPongPort: PingPongProtocol
+ }
+ Structure {
+ external Port PingPongPort
+ }
+ Behavior {
+
+ Operation printData(d: DemoData) : void {
+ "System.out.printf(\"d.int32Val: %d\\n\",d.int32Val);"
+ "System.out.printf(\"d.float64Val: %f\\n\",d.float64Val);"
+ "System.out.printf(\"d.int8Array: \");"
+ "for(int i = 0; i<d.int8Array.length; i++) {"
+ "System.out.printf(\"%d \",d.int8Array[i]);}"
+ "System.out.printf(\"\\nd.stringVal: %s\\n\",d.stringVal);"
+ }
+
+ StateMachine {
+ Transition wait2: waitForPong -> waitForPong {
+ triggers {
+ <pong: PingPongPort>
+ }
+ action {
+ "printData(data);"
+ }
+ }
+ Transition wait1: waitForPongSimple -> waitForPongSimple {
+ triggers {
+ <pongSimple: PingPongPort guard {
+ "data < 10"
+ }>
+ }
+ action {
+ "// keep in mind that MrPong increments"
+ "PingPongPort.pingSimple(data);"
+ "System.out.printf(\"data: %d\\n\",data);"
+ }
+ }
+ Transition next: waitForPongSimple -> waitForPong {
+ triggers {
+ <pongSimple: PingPongPort>
+ }
+ action {
+ "System.out.printf(\"data: %d\\n\",data);"
+ ""
+ "DemoData d = new DemoData();"
+ "// send the default values"
+ "PingPongPort.ping(d);"
+ "d.int32Val=815;"
+ "for (int i = 0; i<d.int8Array.length;i++){"
+ "\td.int8Array[i]=(byte)(i+100);"
+ "\t}"
+ "d.stringVal=\"some contents\";"
+ "d.float64Val=3.141234;"
+ "PingPongPort.ping(d);"
+ }
+ }
+ Transition init0: initial -> waitForPongSimple {
+ action {
+ "PingPongPort.pingSimple(0);"
+ }
+ }
+ State waitForPong
+ State waitForPongSimple
+ }
+ }
+ }
+
+ ActorClass MrPong {
+ Interface {
+ Port PingPongPort: PingPongProtocol
+ }
+ Structure {
+ external Port PingPongPort
+ }
+ Behavior {
+ StateMachine {
+ Transition init: initial -> looping { }
+ Transition tr0: looping -> looping {
+ triggers {
+ <ping: PingPongPort>
+ }
+ action {
+ "PingPongPort.pong(data);"
+ }
+ }
+ Transition tr1: looping -> looping {
+ triggers {
+ <pingSimple: PingPongPort>
+ }
+ action {
+ "PingPongPort.pongSimple(data+1);"
+ }
+ }
+ State looping
+ }
+ }
+ }
+
+ ProtocolClass PingPongProtocol {
+ incoming {
+ Message ping(data: DemoData)
+ Message pingSimple(data: int32)
+ }
+ outgoing {
+ Message pong(data: DemoData)
+ Message pongSimple(data: int32)
+ }
+ }
+
+ DataClass DemoData {
+ Attribute int32Val: int32 = "4711"
+ Attribute int8Array [10]: int8 = "{1,2,3,4,5,6,7,8,9,10}"
+ Attribute float64Val: float64 = "0.0"
+ Attribute stringVal: string = "\"empty\""
+ }
} \ No newline at end of file

Back to the top