| RoomModel PiModel { |
| import room.basic.service.tcp.* from "../../../org.eclipse.etrice.modellib.java/model/TcpService.room" |
| import room.basic.types.* from "../../../org.eclipse.etrice.modellib.java/model/Types.room" |
| import room.basic.service.timing.* from "../../../org.eclipse.etrice.modellib.java/model/TimingService.room" |
| import trafficlight.connector.* from "trafficlight.connector.room" |
| |
| LogicalSystem PiSystem { |
| SubSystemRef piSubSys:PiSubSys |
| } |
| SubSystemClass PiSubSys { |
| ActorRef application:Application |
| ActorRef timing: ATimingService |
| LayerConnection ref application satisfied_by timing.timer |
| LogicalThread defaultThread |
| } |
| ActorClass Application { |
| Structure { |
| ActorRef tcpIp: ATcpClient |
| ActorRef tfIf: TrafficLightInterface |
| ActorRef controller: Comtroller |
| ActorRef mqtt: MqttWrapperActor |
| Binding tfIf.control and tcpIp.ControlPort |
| Binding tfIf.payload and tcpIp.PayloadPort |
| Binding controller.traffic and tfIf.fct |
| Binding controller.mqtt and mqtt.fct |
| } |
| Behavior { } |
| } |
| |
| ActorClass Comtroller { |
| Interface { |
| conjugated Port traffic: PTrafficLightInterface |
| conjugated Port mqtt: PMqtt |
| } |
| Structure { |
| external Port traffic |
| external Port mqtt |
| SAP timer: PTimer |
| } |
| Behavior { |
| StateMachine { |
| Transition init: initial -> MQTTInit { } |
| Transition tr0: Initialize -> tp0 of Initialized { |
| triggers { |
| <initialized: traffic> |
| } |
| } |
| Transition tr1: MQTTInit -> Initialize { |
| triggers { |
| <connected: mqtt> |
| } |
| } |
| State Initialize { |
| entry { |
| "traffic.initialize();" |
| } |
| } |
| State Initialized { |
| entry { |
| "traffic.pedRed();" |
| "mqtt.publish(new DMqttMessage(\"eTrice/TraaficLight/Controller\", \"State: Initialized\", true, 1));" |
| } |
| subgraph { |
| Transition tr0: my tp0 -> On |
| Transition tr1: On -> Off { |
| triggers { |
| <timeout: timer> |
| } |
| } |
| Transition tr2: Off -> On { |
| triggers { |
| <timeout: timer> |
| } |
| } |
| EntryPoint tp0 |
| State On { |
| entry { |
| "traffic.pedRed();" |
| "traffic.carRed();" |
| "timer.startTimeout(1000);" |
| } |
| exit { |
| "traffic.pedOff();" |
| "traffic.carOff();" |
| } |
| } |
| State Off { |
| entry { |
| "timer.startTimeout(1000);" |
| } |
| } |
| } |
| } |
| State MQTTInit { |
| entry { |
| "mqtt.connect(new DMqttConfig(\"tcp://m2m.eclipse.org:1883\", \"eTrice-Paho-Tester\"));" |
| } |
| } |
| } |
| } |
| } |
| |
| } |