diff options
author | Henrik Rentz-Reichert | 2012-01-20 10:47:26 +0000 |
---|---|---|
committer | Henrik Rentz-Reichert | 2012-01-20 10:47:26 +0000 |
commit | edaf429ae3856c19eaa729d843d90febe4fd5d42 (patch) | |
tree | b59198c6725da9ed29dcd0d4bbde9f45d82d09d0 /examples/org.eclipse.etrice.tutorials/model/SendingData | |
parent | 256d137bee23040a655b4d3c99946f0b834b316a (diff) | |
download | org.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/model/SendingData')
-rw-r--r-- | examples/org.eclipse.etrice.tutorials/model/SendingData/SendingData.room | 274 |
1 files changed, 138 insertions, 136 deletions
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 |