’’’’’’
’’’
## room
```room
import room.basic.types.* from "../../../org.eclipse.etrice.modellib.c/model/Types.room"
ActorClass InternalEndPortExample {
Structure {
Port internalEndPort : PSimpleProtocol
ActorRef actorRef1 : SimpleActorClass1
// internalEndPort lives 'local'
// and thus needs a Binding to port of an ActorRef
Binding internalEndPort and actorRef1.externalPort
}
Behavior {
// send/receive messages from internalEndPorts
}
}
ActorClass Receiver {
Interface {
Port sender: PingPongProtocol
}
Structure {
external Port sender
SAP timing : PTimer
}
Behavior {
StateMachine {
Transition init: initial -> WaitingForPing { }
Transition tr0: WaitingForPing -> WaitingForAWhile {
triggers {
<ping: sender>
}
}
Transition tr1: WaitingForAWhile -> SentPong {
triggers {
<timeout: timing>
}
}
State WaitingForPing
State SentPong {
entry {
"sender.pong();"
}
}
State WaitingForAWhile {
entry {
"timing.startTimeout(1000);"
}
}
}
}
}
// eventdriven ProtocolClass (asynchronous message passing, bidirectional)
eventdriven ProtocolClass ProtocolClassEvt {
// ProtocolClass ProtocolClassEvt { // same like above because eventdriven is default
incoming {
// incoming means incoming for a regular port and outging for a conjugated port
Message message1() // message without data
Message message2(data: int32) // message with simple data
Message message3(data: DMessageData) // message with complex data (DataClass)
}
outgoing {
// outgoing means outging for a regular port and incoming for a conjugated port
Message message1(data: int32) // incoming and outgoing Messages can have the same name to enable symmetric protocols
}
}
// DataClass for sending complex data via message
DataClass DMessageData {
Attribute SomeData: int16
Attribute SomeMoreData: int32
}
```
## etMap
```etmap
MappingModel PingPongMapping {
import PingPong_Model.* from "PingPong.room"
import GenericPhysicalModel.* from "GenericPhysical.etphys"
Mapping LogSys -> PhysSys1 {
SubSystemMapping subSystemRef -> nodeRef1 {
ThreadMapping defaultThread -> PhysicalThread1
}
}
}
```
## etPhys
```etphys
PhysicalModel GenericPhysicalModel {
PhysicalSystem PhysSys1 {
NodeRef nodeRef1 : NodeClass1
}
NodeClass NodeClass1 {
runtime = RuntimeClass1
priomin = -10
priomax = 10
DefaultThread PhysicalThread1 {
execmode = mixed
interval = 100ms
prio = 0
stacksize = 1024
msgblocksize = 64
msgpoolsize = 100
}
}
RuntimeClass RuntimeClass1 {
model = multiThreaded
}
}
```
## config
```config
/*******************************************************************************
* Copyright (c) 2012 protos software gmbh (http://www.protos.de).
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* CONTRIBUTORS:
* Thomas Schuetz (initial contribution)
*
*******************************************************************************/
ConfigModel trafficlight.example.config {
import TrafficLight_Model.* from "TrafficLight.room"
ActorInstanceConfig LSTraffic/mainSS/application/pedestrianLight {
Attr ipConfig{
Attr IPAddr="localhost"
Attr TcpPort=4443
}
}
}
```
<pre lang="no-highlight"><code>
```
"no highlighting" /* comment */
// nop
```
```no-highlight
"no highlighting" /* comment */
// nop
```
</code></pre>
```
"no highlighting" /* comment */
// nop
```
```no-highlight
"no highlighting" /* comment */
// nop
```
## TODO
Syntax highlighting for other languages like c:
```c
void etMessageQueue_push(etMessageQueue* self, etMessage* msg){
/* TODO: optimize queue for concurrent push / pop */
ET_MSC_LOGGER_SYNC_ENTRY("etMessageQueue", "push")
if (self->first == NULL) {
/*no message in queue*/
self->first = self->last = msg;
}
else {
/*at least one message in queue*/
self->last->next = msg;
self->last = msg;
}
msg->next = NULL; /*TODO: optimization: this line could be removed if we assume that all messages are initialized*/
if (++self->size > self->highWaterMark)
self->highWaterMark++;
ET_MSC_LOGGER_SYNC_EXIT
}
```
'''