Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2018-07-06 17:19:51 +0000
committerHenrik Rentz-Reichert2018-07-06 17:22:00 +0000
commit0509ac03bea494b08a92251e68e9efc92e415a20 (patch)
treed070ca8800c829827df8aff75c1b773fe1115908 /runtime
parentc2dfdeabf15d7e367bcd92731e6ac8651ffb9cac (diff)
parentbed42b94fbf934db15e792b247ee747f0c37ebf4 (diff)
downloadorg.eclipse.etrice-0509ac03bea494b08a92251e68e9efc92e415a20.tar.gz
org.eclipse.etrice-0509ac03bea494b08a92251e68e9efc92e415a20.tar.xz
org.eclipse.etrice-0509ac03bea494b08a92251e68e9efc92e415a20.zip
Merge remote-tracking branch 'newfsmgen_finalize'
Conflicts: plugins/org.eclipse.etrice.ui.behavior.fsm/META-INF/MANIFEST.MF plugins/org.eclipse.etrice.ui.behavior/META-INF/MANIFEST.MF Change-Id: Icc81a851cdcdb35081b8eaa3d5b025c1f850de54
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/model/PInterrupt.room48
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/model/TcpService.room285
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/model/TimingService.room408
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt4
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/pinterrupt/PInterrupt.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.c138
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.h3
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.c147
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.h3
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpControl.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpPayload.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpControl.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpPayload.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c114
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h3
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/PTimer.h1
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room444
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt4
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp112
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h5
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp52
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h15
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/.classpath1
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/build.gradle5
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/model/ALogService.room127
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/model/TcpService.room406
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/model/TimingService.room280
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt4
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java92
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java16
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java145
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java156
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java8
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java16
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java72
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java52
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c3
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c27
-rw-r--r--runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h39
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/.classpath6
-rw-r--r--runtime/org.eclipse.etrice.runtime.java/build.gradle2
41 files changed, 1573 insertions, 1675 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/PInterrupt.room b/runtime/org.eclipse.etrice.modellib.c/model/PInterrupt.room
index d39e11980..bc435f106 100644
--- a/runtime/org.eclipse.etrice.modellib.c/model/PInterrupt.room
+++ b/runtime/org.eclipse.etrice.modellib.c/model/PInterrupt.room
@@ -8,33 +8,29 @@ RoomModel room.basic.service.pinterrupt {
}
conjugated PortClass
{
- usercode {
- "#include \"messaging/etMessageService.h\""
- }
+ usercode '''#include "messaging/etMessageService.h"'''
handle
- incoming event {
- "// the message should be sent via the fire operation !!"
- }
- Operation export(): PInterruptConjPort ref {
- "msg.address = self->peerAddress;"
- "msg.evtID = PInterrupt_IN_event;"
- "callback.func=(void (*)(void*))PInterruptConjPort_dispatch;"
- "callback.param=(void *)self;"
- "etMessageService_registerHighPrioFunc(self->msgService,&callback);"
- "return self;"
- }
- Operation dispatch() {
- "// this operation will be executed from the message service"
- "if (enable){"
- " enable=0;"
- " self->msgService->msgDispatcher(&msg);"
- "}"
- }
- Operation fire() {
- "// this method runs on interrupt level"
- "enable=1;"
- "etSema_wakeupFromISR(&self->msgService->executionSemaphore);"
- }
+ incoming event '''// the message should be sent via the fire operation !!'''
+ Operation export(): PInterruptConjPort ref '''
+ msg.address = self->peerAddress;
+ msg.evtID = PInterrupt_IN_event;
+ callback.func=(void (*)(void*))PInterruptConjPort_dispatch;
+ callback.param=(void *)self;
+ etMessageService_registerHighPrioFunc(self->msgService,&callback);
+ return self;
+ '''
+ Operation dispatch() '''
+ // this operation will be executed from the message service
+ if (enable){
+ enable=0;
+ self->msgService->msgDispatcher(&msg);
+ }
+ '''
+ Operation fire() '''
+ // this method runs on interrupt level
+ enable=1;
+ etSema_wakeupFromISR(&self->msgService->executionSemaphore);
+ '''
Attribute msg: etMessage = "0"
Attribute callback: etHighPrioFunc = "{0,0}"
Attribute enable: uint8 = "0"
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room b/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room
index 4a828dc3b..bc76416b6 100644
--- a/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room
+++ b/runtime/org.eclipse.etrice.modellib.c/model/TcpService.room
@@ -2,109 +2,95 @@ RoomModel room.basic.service.tcp {
import room.basic.types.* from "Types.room"
-
ActorClass ATcpServer {
Interface {
Port controlPort: PTcpControl
Port payloadPort: PTcpPayload
}
Structure {
- usercode1 {
- "#include \"osal/etTcpSockets.h\""
- }
- usercode3 {
- "static int8* bufferProvider(void* slf, int* size) {"
- " ATcpServer* self = (ATcpServer*) slf;"
- " *size = DTcpPayload_getMaxLength(&payloadRecvBuffer);"
- " return payloadRecvBuffer.data;"
- "}"
- ""
- "static int socketReceiver(void* slf, int channel, int size, const int8* data) {"
- " ATcpServer* self = (ATcpServer*) slf;"
- " DTcpPayload_setData(&payloadRecvBuffer, data, size);"
- " payloadPort_dataPackage(&payloadRecvBuffer);"
- " return ETSOCKET_OK;"
- "}"
- }
+ usercode1 '''#include "osal/etTcpSockets.h"'''
+ usercode3 '''
+ static int8* bufferProvider(void* slf, int* size) {
+ ATcpServer* self = (ATcpServer*) slf;
+ *size = DTcpPayload_getMaxLength(&payloadRecvBuffer);
+ return payloadRecvBuffer.data;
+ }
+
+ static int socketReceiver(void* slf, int channel, int size, const int8* data) {
+ ATcpServer* self = (ATcpServer*) slf;
+ DTcpPayload_setData(&payloadRecvBuffer, data, size);
+ payloadPort_dataPackage(&payloadRecvBuffer);
+ return ETSOCKET_OK;
+ }
+ '''
external Port controlPort
external Port payloadPort
Attribute lastError: int32
- Attribute payloadRecvBuffer : DTcpPayload
+ Attribute payloadRecvBuffer: DTcpPayload
Attribute server: etSocketServerData ref
}
Behavior {
- ctor {
- "setErrorCode(etInitSockets());"
- "server = etCreateSocketServerData();"
- "server->receiver = socketReceiver;"
- "server->bufferProvider = bufferProvider;"
- "server->userData = self;"
- }
- dtor {
- "etCleanupSockets();"
- "etFreeSocketServerData(server);"
- }
+ ctor '''
+ setErrorCode(etInitSockets());
+ server = etCreateSocketServerData();
+ server->receiver = socketReceiver;
+ server->bufferProvider = bufferProvider;
+ server->userData = self;
+ '''
+ dtor '''
+ etCleanupSockets();
+ etFreeSocketServerData(server);
+ '''
+
// Operation stopUser() {
// "/* stop user: close socket */"
// }
- Operation hasError() : boolean {
- "return lastError != ETSOCKET_OK;"
- }
- Operation setErrorCode(value : int32){
- "lastError = value;"
- }
+ Operation hasError(): boolean '''return lastError != ETSOCKET_OK;'''
+ Operation setErrorCode(value: int32) '''lastError = value;'''
StateMachine {
Transition init: initial -> cp cp0
Transition tr5: connected -> connected {
triggers {
<dataPackage: payloadPort>
}
- action {
- "/* send payload to connection */"
- "setErrorCode(etWriteServerSocket(server, data->connectionId, data->length, data->data));"
- "if(hasError())"
- "\tcontrolPort.error();"
- }
+ action '''
+ /* send payload to connection */
+ setErrorCode(etWriteServerSocket(server, transitionData->connectionId, transitionData->length, transitionData->data));
+ if(hasError())
+ controlPort.error();
+ '''
}
Transition tr6: connected -> unconnected {
triggers {
<disconnect: controlPort>
}
- action {
- "/* close accept thread */"
- "etCloseAllServerSockets(server);"
- "etStopSocketServer(server);"
- ""
- "controlPort.disconnected();"
- }
+ action '''
+ /* close accept thread */
+ etCloseAllServerSockets(server);
+ etStopSocketServer(server);
+
+ controlPort.disconnected();
+ '''
}
Transition tr7: unconnected -> cp cp1 {
triggers {
<connect: controlPort>
}
- action {
- "/* start accept thread */"
- "setErrorCode(etStartListening(server, data->TcpPort));"
- }
+ action '''
+ /* start accept thread */
+ setErrorCode(etStartListening(server, transitionData->TcpPort));
+ '''
}
Transition tr4: cp cp1 -> connected {
- action {
- "controlPort.connected();"
- }
+ action '''controlPort.connected();'''
}
Transition tr8: cp cp1 -> unconnected {
- cond {
- "hasError()"
- }
- action {
- "controlPort.error();"
- }
+ cond '''hasError()'''
+ action '''controlPort.error();'''
}
Transition tr0: cp cp0 -> unconnected
Transition tr1: cp cp0 -> initError {
- cond {
- "hasError()"
- }
+ cond '''hasError()'''
}
Transition tr2: initError -> initError {
triggers {
@@ -116,9 +102,7 @@ RoomModel room.basic.service.tcp {
State connected
State unconnected
State initError {
- entry {
- "controlPort.error();"
- }
+ entry '''controlPort.error();'''
}
}
}
@@ -130,23 +114,20 @@ RoomModel room.basic.service.tcp {
Port payloadPort: PTcpPayload
}
Structure {
- usercode1 {
- "#include \"osal/etTcpSockets.h\""
- }
- usercode3 {
- "static int8* bufferProvider(void* slf, int* size) {"
- " ATcpClient* self = (ATcpClient*) slf;"
- " *size = DTcpPayload_getMaxLength(&payloadRecvBuffer);"
- " return payloadRecvBuffer.data;"
- "}"
- ""
- "static int socketReceiver(void* slf, int channel, int size, const int8* data) {"
- " ATcpClient* self = (ATcpClient*) slf;"
- " DTcpPayload_setData(&payloadRecvBuffer, /* cast away constness to avoid warning*/(int8*)data, size);"
- " payloadPort_dataPackage(&payloadRecvBuffer);"
- " return ETSOCKET_OK;"
- "}"
- }
+ usercode1 '''#include "osal/etTcpSockets.h"'''
+ usercode3 '''
+ static int8* bufferProvider(void* slf, int* size) {
+ ATcpClient* self = (ATcpClient*) slf;
+ *size = DTcpPayload_getMaxLength(&payloadRecvBuffer);
+ return payloadRecvBuffer.data;
+ }
+
+ static int socketReceiver(void* slf, int channel, int size, const int8* data) {
+ ATcpClient* self = (ATcpClient*) slf;
+ DTcpPayload_setData(&payloadRecvBuffer, /* cast away constness to avoid warning*/(int8*)data, size);
+ payloadPort_dataPackage(&payloadRecvBuffer);
+ return ETSOCKET_OK;
+ }'''
external Port controlPort
external Port payloadPort
Attribute lastError: int32
@@ -154,81 +135,63 @@ RoomModel room.basic.service.tcp {
Attribute client: etSocketConnectionData ref
}
Behavior {
- ctor {
- "setErrorCode(etInitSockets());"
- "client = etCreateSocketConnectionData();"
- "client->receiver = socketReceiver;"
- "client->bufferProvider = bufferProvider;"
- "client->userData = self;"
- }
- dtor {
- "etCloseSocket(client);"
- "etCleanupSockets();"
- "etFreeSocketConnectionData(client);"
- }
+ ctor '''
+ setErrorCode(etInitSockets());
+ client = etCreateSocketConnectionData();
+ client->receiver = socketReceiver;
+ client->bufferProvider = bufferProvider;
+ client->userData = self;'''
+ dtor '''
+ etCloseSocket(client);
+ etCleanupSockets();
+ etFreeSocketConnectionData(client);'''
+
// Operation stopUser() {
// "/* stop user: close socket */"
// }
- Operation hasError() : boolean {
- "return lastError != ETSOCKET_OK;"
- }
- Operation setErrorCode(value : int32){
- "lastError = value;"
- }
+ Operation hasError(): boolean '''return lastError != ETSOCKET_OK;'''
+ Operation setErrorCode(value: int32) '''lastError = value;'''
StateMachine {
Transition init: initial -> cp cp1 {
- action {
- "printf(\"Client Init!\\n\");"
- }
+ action '''printf("Client Init!\n");'''
}
Transition tr0: unconnected -> cp cp0 {
triggers {
<connect: controlPort>
}
- action {
- "/* connect to server */"
- "setErrorCode(etConnectServer(client, data->IPAddr, data->TcpPort));"
- }
+ action '''
+ /* connect to server */
+ setErrorCode(etConnectServer(client, transitionData->IPAddr, transitionData->TcpPort));'''
}
Transition tr1: connected -> unconnected {
triggers {
<disconnect: controlPort>
}
- action {
- "/* close read thread */"
- "etCloseSocket(client);"
- ""
- "controlPort.disconnected();"
- }
+ action '''
+ /* close read thread */
+ etCloseSocket(client);
+
+ controlPort.disconnected();'''
}
Transition tr2: cp cp0 -> connected {
- action {
- "controlPort.connected();"
- }
+ action '''controlPort.connected();'''
}
Transition tr7: cp cp0 -> unconnected {
- cond {
- "hasError()"
- }
- action {
- "controlPort.error();"
- }
+ cond '''hasError()'''
+ action '''controlPort.error();'''
}
Transition tr3: connected -> connected {
triggers {
<dataPackage: payloadPort>
}
- action {
- "setErrorCode(etWriteSocket(client, data->length, data->data));"
- "if(hasError())"
- "\tcontrolPort.error();"
- }
+ action '''
+ setErrorCode(etWriteSocket(client, transitionData->length, transitionData->data));
+ if(hasError())
+ controlPort.error();'''
}
Transition tr4: cp cp1 -> unconnected
Transition tr5: cp cp1 -> initError {
- cond {
- "hasError()"
- }
+ cond '''hasError()'''
}
Transition tr6: initError -> initError {
triggers {
@@ -240,9 +203,7 @@ RoomModel room.basic.service.tcp {
State unconnected
State connected
State initError {
- entry {
- "controlPort.error();"
- }
+ entry '''controlPort.error();'''
}
}
}
@@ -250,7 +211,7 @@ RoomModel room.basic.service.tcp {
ProtocolClass PTcpControl {
incoming {
- Message connect(data: DTcpControl)
+ Message connect(DTcpControl)
Message disconnect()
}
outgoing {
@@ -262,10 +223,10 @@ RoomModel room.basic.service.tcp {
ProtocolClass PTcpPayload {
incoming {
- Message dataPackage(data: DTcpPayload)
+ Message dataPackage(DTcpPayload)
}
outgoing {
- Message dataPackage(data: DTcpPayload)
+ Message dataPackage(DTcpPayload)
}
}
@@ -277,34 +238,28 @@ RoomModel room.basic.service.tcp {
DataClass DTcpPayload {
Attribute connectionId: int32
Attribute length: int32
- Attribute data [ 32 ]: int8
-
- Operation getMaxLength() : int32 {
- "return 32;"
- }
-
- Operation setAsString(value : charPtr){
- "/* used macros: data, length */"
- "int valLength = (strlen(value)+1 > 32)? 32 : strlen(value) + 1;"
- "memcpy(data, value, valLength);"
- "data[31] = '\\0';"
- "length = valLength;"
- }
-
- Operation setData(value : int8 ref, size : int32){
- "/* used macros: data, length */"
- "strncpy(data, value, ((size>32)?32:size));"
- "length = size;"
- }
-
- Operation getAsString() : charPtr{
- "/* used macros: data */"
- "data[31] = '\\0';"
- "return data;"
- }
+ Attribute data [32]: int8
+
+ Operation getMaxLength(): int32 '''return 32;'''
+
+ Operation setAsString(value: charPtr) '''
+ /* used macros: data, length */
+ int valLength = (strlen(value)+1 > 32)? 32 : strlen(value) + 1;
+ memcpy(data, value, valLength);
+ data[31] = '\0';
+ length = valLength;'''
+
+ Operation setData(value: int8 ref, size: int32) '''
+ /* used macros: data, length */
+ strncpy(data, value, ((size>32)?32:size));
+ length = size;'''
+
+ Operation getAsString(): charPtr '''
+ /* used macros: data */
+ data[31] = '\0';
+ return data;'''
}
ExternalType etSocketServerData -> "etSocketServerData"
ExternalType etSocketConnectionData -> "etSocketConnectionData"
-
} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.c/model/TimingService.room b/runtime/org.eclipse.etrice.modellib.c/model/TimingService.room
index f71a0a16f..a4ed1dbee 100644
--- a/runtime/org.eclipse.etrice.modellib.c/model/TimingService.room
+++ b/runtime/org.eclipse.etrice.modellib.c/model/TimingService.room
@@ -7,119 +7,108 @@ RoomModel room.basic.service.timing {
SPP timer: PTimer
}
Structure {
- usercode1 {
- "#include \"osal/etTime.h\" "
- "#define ET_NB_OF_TCBS 30"
- "typedef struct etTCB etTimerControlBlock; "
- "struct etTCB {"
- " etTime expTime;"
- " etTime pTime;"
- " int32 portIdx;"
- " etTimerControlBlock* next;"
- " };"
- }
- usercode2 {
- "/*uc2*/"
- }
- usercode3{
- "/*uc3*/"
- }
- ServiceImplementation of timer
- Attribute tcbs[30]:tcb
- Attribute usedTcbsRoot : tcb ref
- Attribute freeTcbsRoot : tcb ref
+ usercode1 '''
+ #include "osal/etTime.h"
+ #define ET_NB_OF_TCBS 30
+ typedef struct etTCB etTimerControlBlock;
+ struct etTCB {
+ etTime expTime;
+ etTime pTime;
+ int32 portIdx;
+ etTimerControlBlock* next;
+ };'''
+ usercode2 '''/*uc2*/'''
+ usercode3 '''/*uc3*/'''
+ ServiceImplementation of timer
+ Attribute tcbs [30]: tcb
+ Attribute usedTcbsRoot: tcb ref
+ Attribute freeTcbsRoot: tcb ref
}
Behavior {
- Operation getTcb():tcb ref{
- "etTimerControlBlock* temp = freeTcbsRoot;"
- ""
- "if(freeTcbsRoot!=0) {"
- " freeTcbsRoot=freeTcbsRoot->next;"
- " temp->next=0;"
- " }"
- "return temp;"
- }
- Operation returnTcb(block:tcb ref){
- "block->next=freeTcbsRoot;"
- "freeTcbsRoot=block;"
- }
- Operation removeTcbFromUsedList(idx:int32){
- "etTimerControlBlock* temp=usedTcbsRoot;"
- "etTimerControlBlock* temp2=usedTcbsRoot;"
- ""
- "if (temp==0) return;"
- ""
- "if (usedTcbsRoot->portIdx == idx){"
- " /* element found, the first one */"
- " usedTcbsRoot = usedTcbsRoot->next;"
- " returnTcb(temp);"
- " return;"
- "}"
- ""
- "temp=temp->next;"
- "while(temp!=0){"
- " if(temp->portIdx==idx){"
- " temp2->next=temp->next;"
- " returnTcb(temp);"
- " return; "
- " }else{"
- " /* try next */"
- " temp2=temp;"
- " temp=temp->next;"
- " }"
- "}"
- }
- Operation putTcbToUsedList(block:tcb ref){
- "etTimerControlBlock* temp=usedTcbsRoot;"
- "etTimerControlBlock* temp2=usedTcbsRoot;"
- ""
- "if (temp==0){"
- " /* list empty put new block to root */"
- " block->next=0;"
- " usedTcbsRoot=block;"
- " return;"
- " }"
- ""
- "while(1){"
- " if (temp != 0){"
- " if (isTimeGreater(&block->expTime,&temp->expTime)){"
- " /* try next position */"
- " temp2=temp; "
- " temp=temp->next;"
- " }else{"
- " /* right position found */"
- " block->next=temp;"
- " if(temp==usedTcbsRoot){"
- " usedTcbsRoot=block;"
- " }else{"
- " temp2->next=block;"
- " }"
- " return;"
- " }"
- " }else{"
- " /* end of list reached */"
- " block->next=0;"
- " temp2->next=block;"
- " return;"
- " }"
- "}"
- }
- Operation isTimeGreater(t1:targetTime ref, t2 :targetTime ref):boolean{
- "if (t1->sec > t2->sec) return ET_TRUE;"
- "if (t1->sec < t2->sec) return ET_FALSE;"
- "if (t1->nSec > t2->nSec) return ET_TRUE;"
- "return ET_FALSE;"
- }
-
- Operation addTime(t1:targetTime ref, t2:targetTime ref){
- "t1->sec += t2->sec;"
- "t1->nSec += t2->nSec;"
- "while(t1->nSec >= 1000000000L){"
- " t1->sec++;"
- " t1->nSec-=1000000000L;"
- "}"
- }
-
+ Operation getTcb(): tcb ref '''
+ etTimerControlBlock* temp = freeTcbsRoot;
+
+ if(freeTcbsRoot!=0) {
+ freeTcbsRoot=freeTcbsRoot->next;
+ temp->next=0;
+ }
+ return temp;'''
+ Operation returnTcb(block: tcb ref) '''
+ block->next=freeTcbsRoot;
+ freeTcbsRoot=block;'''
+ Operation removeTcbFromUsedList(idx: int32) '''
+ etTimerControlBlock* temp=usedTcbsRoot;
+ etTimerControlBlock* temp2=usedTcbsRoot;
+
+ if (temp==0) return;
+
+ if (usedTcbsRoot->portIdx == idx){
+ /* element found, the first one */
+ usedTcbsRoot = usedTcbsRoot->next;
+ returnTcb(temp);
+ return;
+ }
+
+ temp=temp->next;
+ while(temp!=0){
+ if(temp->portIdx==idx){
+ temp2->next=temp->next;
+ returnTcb(temp);
+ return;
+ }else{
+ /* try next */
+ temp2=temp;
+ temp=temp->next;
+ }
+ }'''
+ Operation putTcbToUsedList(block: tcb ref) '''
+ etTimerControlBlock* temp=usedTcbsRoot;
+ etTimerControlBlock* temp2=usedTcbsRoot;
+
+ if (temp==0){
+ /* list empty put new block to root */
+ block->next=0;
+ usedTcbsRoot=block;
+ return;
+ }
+
+ while(1){
+ if (temp != 0){
+ if (isTimeGreater(&block->expTime,&temp->expTime)){
+ /* try next position */
+ temp2=temp;
+ temp=temp->next;
+ }else{
+ /* right position found */
+ block->next=temp;
+ if(temp==usedTcbsRoot){
+ usedTcbsRoot=block;
+ }else{
+ temp2->next=block;
+ }
+ return;
+ }
+ }else{
+ /* end of list reached */
+ block->next=0;
+ temp2->next=block;
+ return;
+ }
+ }'''
+ Operation isTimeGreater(t1: targetTime ref, t2: targetTime ref): boolean '''
+ if (t1->sec > t2->sec) return ET_TRUE;
+ if (t1->sec < t2->sec) return ET_FALSE;
+ if (t1->nSec > t2->nSec) return ET_TRUE;
+ return ET_FALSE;'''
+
+ Operation addTime(t1: targetTime ref, t2: targetTime ref) '''
+ t1->sec += t2->sec;
+ t1->nSec += t2->nSec;
+ while(t1->nSec >= 1000000000L){
+ t1->sec++;
+ t1->nSec-=1000000000L;
+ }'''
+
// Operation printList(){
// "etTimerControlBlock* temp=usedTcbsRoot;"
// " printf(\"list: \");"
@@ -131,105 +120,94 @@ RoomModel room.basic.service.timing {
// }
StateMachine {
Transition tr0: initial -> Operational {
- action {
- "int i;"
- "usedTcbsRoot=0;"
- "freeTcbsRoot=&tcbs[0];"
- "tcbs[ET_NB_OF_TCBS-1].next=0;"
- "for (i=0;i<ET_NB_OF_TCBS-1;i++){"
- "\ttcbs[i].next=&tcbs[i+1];"
- "\t}"
- }
+ action '''
+ int i;
+ usedTcbsRoot=0;
+ freeTcbsRoot=&tcbs[0];
+ tcbs[ET_NB_OF_TCBS-1].next=0;
+ for (i=0;i<ET_NB_OF_TCBS-1;i++){
+ tcbs[i].next=&tcbs[i+1];
+ }'''
}
Transition tr1: Operational -> Operational {
triggers {
<startTimeout: timer>
}
- action {
- "etTimerControlBlock* timer = getTcb();"
- "etTime t;"
- "if (timer!= 0){"
- "\tt.sec=time/1000;"
- "\tt.nSec=(time%1000)*1000000L;"
- "\ttimer->pTime.sec = 0;"
- "\ttimer->pTime.nSec = 0;"
- "\ttimer->portIdx=((etReplSubPort*)ifitem)->index;"
- "\tgetTimeFromTarget(&(timer->expTime));"
- "\taddTime(&(timer->expTime),&t);"
- "\tputTcbToUsedList(timer);"
- "\t}"
- }
+ action '''
+ etTimerControlBlock* transitionDatar = getTcb();
+ etTime t;
+ if (transitionDatar!= 0){
+ t.sec=transitionData/1000;
+ t.nSec=(transitionData%1000)*1000000L;
+ transitionDatar->pTime.sec = 0;
+ transitionDatar->pTime.nSec = 0;
+ transitionDatar->portIdx=((etReplSubPort*)ifitem)->index;
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime),&t);
+ putTcbToUsedList(transitionDatar);
+ }'''
}
Transition tr3: Operational -> Operational {
triggers {
<startTimer: timer>
}
- action {
- "etTimerControlBlock* timer = getTcb();"
- "etTime t;"
- "if (timer!= 0){"
- "\tt.sec=time/1000;"
- "\tt.nSec=(time%1000)*1000000L;"
- "\ttimer->pTime = t;"
- "\ttimer->portIdx=((etReplSubPort*)ifitem)->index;"
- "\tgetTimeFromTarget(&(timer->expTime));"
- "\taddTime(&(timer->expTime),&t);"
- "\tputTcbToUsedList(timer);"
- "\t}"
- }
+ action '''
+ etTimerControlBlock* transitionDatar = getTcb();
+ etTime t;
+ if (transitionDatar!= 0){
+ t.sec=transitionData/1000;
+ t.nSec=(transitionData%1000)*1000000L;
+ transitionDatar->pTime = t;
+ transitionDatar->portIdx=((etReplSubPort*)ifitem)->index;
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime),&t);
+ putTcbToUsedList(transitionDatar);
+ }'''
}
Transition tr4: Operational -> Operational {
triggers {
<kill: timer>
}
- action {
- "removeTcbFromUsedList(((etReplSubPort*)ifitem)->index);"
- }
+ action '''removeTcbFromUsedList(((etReplSubPort*)ifitem)->index);'''
}
State Operational {
- entry {
- "/* prepare */"
- } do {
- "/* maintain timers */"
- "etTimerControlBlock* temp;"
- "etTime t;"
- ""
- "getTimeFromTarget(&t);"
- "while (usedTcbsRoot !=0 ){"
- "\tif (isTimeGreater(&t,&(usedTcbsRoot->expTime))){"
- "\t\ttimer[usedTcbsRoot->portIdx].timeout();"
- "\t\ttemp=usedTcbsRoot;"
- "\t\tusedTcbsRoot=usedTcbsRoot->next;"
- "\t\tif((temp->pTime.sec==0)&&(temp->pTime.nSec==0)){"
- "\t\t\t/* single shot timer */"
- "\t\t\treturnTcb(temp);"
- "\t\t}else{"
- "\t\t\t/* periodic timer */"
- "\t\t\taddTime(&temp->expTime,&temp->pTime);"
- "\t\t\tputTcbToUsedList(temp);"
- "\t\t\t}"
- "\t\t}else{"
- "\t\t\tbreak;"
- "\t\t\t}"
- "\t}"
- }
+ entry '''/* prepare */'''
+ do '''
+ /* maintain timers */
+ etTimerControlBlock* temp;
+ etTime t;
+
+ getTimeFromTarget(&t);
+ while (usedTcbsRoot !=0 ){
+ if (isTimeGreater(&t,&(usedTcbsRoot->expTime))){
+ timer[usedTcbsRoot->portIdx].timeout();
+ temp=usedTcbsRoot;
+ usedTcbsRoot=usedTcbsRoot->next;
+ if((temp->pTime.sec==0)&&(temp->pTime.nSec==0)){
+ /* single shot timer */
+ returnTcb(temp);
+ }else{
+ /* periodic timer */
+ addTime(&temp->expTime,&temp->pTime);
+ putTcbToUsedList(temp);
+ }
+ }else{
+ break;
+ }
+ }'''
}
}
}
}
-
ProtocolClass PTimer {
- usercode1 {
- "#define ET_TIMER_RUNNING 0x01"
- "#define ET_TIMER_PERIODIC 0x02"
- }
- usercode2 {
- "/*uc2*/"
- }
+ usercode1 '''
+ #define ET_TIMER_RUNNING 0x01
+ #define ET_TIMER_PERIODIC 0x02'''
+ usercode2 '''/*uc2*/'''
incoming {
- Message startTimer(time: uint32)
- Message startTimeout(time: uint32)
+ Message startTimer(uint32)
+ Message startTimeout(uint32)
Message kill()
}
outgoing {
@@ -237,40 +215,34 @@ RoomModel room.basic.service.timing {
}
conjugated PortClass
{
- handle incoming startTimer{
- "if (status==0){"
- " status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC;"
- " etPort_sendMessage(self, PTimer_IN_startTimer, sizeof(int32), &data__et);"
- "}"
- }
- handle incoming startTimeout{
- "if (status==0){"
- " status = ET_TIMER_RUNNING;"
- " etPort_sendMessage(self, PTimer_IN_startTimeout, sizeof(int32), &data__et);"
- "}"
- }
- handle outgoing timeout{
- "/* TODO: clear active bit in case of single shot timer */"
- "if (status!=0){"
- " if (status==ET_TIMER_RUNNING){"
- " /* single shot timer */"
- " status=0;"
- " }"
- " /* msg to fsm */"
- " (*receiveMessageFunc)(actor, self, msg);"
- "}"
- }
- handle incoming kill {
- "if (status!=0){"
- " status=0;"
- " etPort_sendMessage(self, PTimer_IN_kill, 0,NULL);"
- "}"
- }
- Attribute status:int8="0"
+ handle incoming startTimer '''
+ if (status==0){
+ status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC;
+ etPort_sendMessage(self, PTimer_IN_startTimer, sizeof(int32), &data__et);
+ }'''
+ handle incoming startTimeout '''
+ if (status==0){
+ status = ET_TIMER_RUNNING;
+ etPort_sendMessage(self, PTimer_IN_startTimeout, sizeof(int32), &data__et);
+ }'''
+ handle outgoing timeout '''
+ /* TODO: clear active bit in case of single shot timer */
+ if (status!=0){
+ if (status==ET_TIMER_RUNNING){
+ /* single shot timer */
+ status=0;
+ }
+ /* msg to fsm */
+ (*receiveMessageFunc)(actor, self, msg);
+ }'''
+ handle incoming kill '''
+ if (status!=0){
+ status=0;
+ etPort_sendMessage(self, PTimer_IN_kill, 0,NULL);
+ }'''
+ Attribute status: int8 = "0"
}
}
ExternalType tcb -> "etTimerControlBlock" default "{{0,0},{0,0},0,NULL}"
ExternalType targetTime -> "etTime" default "{0,0}"
}
-
- \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt
new file mode 100644
index 000000000..1dc2b35ab
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/readme.txt
@@ -0,0 +1,4 @@
+This directory is an eTrice code generation target.
+It will be erased every time the generator is executed.
+
+DO NOT PLACE OTHER FILES HERE!
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/pinterrupt/PInterrupt.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/pinterrupt/PInterrupt.h
index 602d5601a..340b8068e 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/pinterrupt/PInterrupt.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/pinterrupt/PInterrupt.h
@@ -12,6 +12,7 @@
#include "modelbase/etPort.h"
+/* include all referenced room classes */
/* message IDs */
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.c
index b72cf1235..7896aa283 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.c
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.c
@@ -74,7 +74,7 @@ static char* stateStrings[] = {"<no state>","<top>","unconnected",
static void setState(ATcpClient* self, etInt16 new_state) {
self->state = new_state;
- ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state])
+ ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state]);
}
static etInt16 getState(ATcpClient* self) {
@@ -90,9 +90,9 @@ static void entry_initError(ATcpClient* self) {
static void action_TRANS_INITIAL_TO__cp1(ATcpClient* self) {
printf("Client Init!\n");
}
-static void action_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpControl* data) {
+static void action_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpControl* transitionData) {
/* connect to server */
- setErrorCode(etConnectServer(client, data->IPAddr, data->TcpPort));
+ setErrorCode(etConnectServer(client, transitionData->IPAddr, transitionData->TcpPort));
}
static void action_TRANS_tr1_FROM_connected_TO_unconnected_BY_disconnectcontrolPort(ATcpClient* self, const InterfaceItemBase* ifitem) {
/* close read thread */
@@ -100,14 +100,14 @@ static void action_TRANS_tr1_FROM_connected_TO_unconnected_BY_disconnectcontrolP
controlPort_disconnected();
}
-static void action_TRANS_tr2_FROM_cp0_TO_connected(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpControl* data) {
+static void action_TRANS_tr2_FROM_cp0_TO_connected(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpControl* transitionData) {
controlPort_connected();
}
-static void action_TRANS_tr7_FROM_cp0_TO_unconnected_COND_tr7(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpControl* data) {
+static void action_TRANS_tr7_FROM_cp0_TO_unconnected_COND_tr7(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpControl* transitionData) {
controlPort_error();
}
-static void action_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpPayload* data) {
- setErrorCode(etWriteSocket(client, data->length, data->data));
+static void action_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3(ATcpClient* self, const InterfaceItemBase* ifitem, DTcpPayload* transitionData) {
+ setErrorCode(etWriteSocket(client, transitionData->length, transitionData->data));
if(hasError())
controlPort_error();
}
@@ -122,10 +122,6 @@ static void action_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPo
static void exitTo(ATcpClient* self, etInt16 current__et, etInt16 to) {
while (current__et!=to) {
switch (current__et) {
- case STATE_unconnected:
- self->history[STATE_TOP] = STATE_unconnected;
- current__et = STATE_TOP;
- break;
case STATE_connected:
self->history[STATE_TOP] = STATE_connected;
current__et = STATE_TOP;
@@ -134,6 +130,10 @@ static void exitTo(ATcpClient* self, etInt16 current__et, etInt16 to) {
self->history[STATE_TOP] = STATE_initError;
current__et = STATE_TOP;
break;
+ case STATE_unconnected:
+ self->history[STATE_TOP] = STATE_unconnected;
+ current__et = STATE_TOP;
+ break;
default:
/* should not occur */
break;
@@ -160,13 +160,13 @@ static etInt16 executeTransitionChain(ATcpClient* self, int chain__et, const Int
}
case CHAIN_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort:
{
- DTcpControl* data = ((DTcpControl*) generic_data__et);
- action_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort(self, ifitem, data);
+ DTcpControl* transitionData = ((DTcpControl*) generic_data__et);
+ action_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort(self, ifitem, transitionData);
if (hasError()) {
- action_TRANS_tr7_FROM_cp0_TO_unconnected_COND_tr7(self, ifitem, data);
+ action_TRANS_tr7_FROM_cp0_TO_unconnected_COND_tr7(self, ifitem, transitionData);
return STATE_unconnected;}
else {
- action_TRANS_tr2_FROM_cp0_TO_connected(self, ifitem, data);
+ action_TRANS_tr2_FROM_cp0_TO_connected(self, ifitem, transitionData);
return STATE_connected;}
}
case CHAIN_TRANS_tr1_FROM_connected_TO_unconnected_BY_disconnectcontrolPort:
@@ -176,13 +176,13 @@ static etInt16 executeTransitionChain(ATcpClient* self, int chain__et, const Int
}
case CHAIN_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3:
{
- DTcpPayload* data = ((DTcpPayload*) generic_data__et);
- action_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3(self, ifitem, data);
+ DTcpPayload* transitionData = ((DTcpPayload*) generic_data__et);
+ action_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3(self, ifitem, transitionData);
return STATE_connected;
}
case CHAIN_TRANS_tr6_FROM_initError_TO_initError_BY_connectcontrolPort_tr6:
{
- DTcpControl* data = ((DTcpControl*) generic_data__et);
+ DTcpControl* transitionData = ((DTcpControl*) generic_data__et);
return STATE_initError;
}
default:
@@ -205,9 +205,6 @@ static etInt16 enterHistory(ATcpClient* self, etInt16 state__et) {
}
while (ET_TRUE) {
switch (state__et) {
- case STATE_unconnected:
- /* in leaf state: return state id */
- return STATE_unconnected;
case STATE_connected:
/* in leaf state: return state id */
return STATE_connected;
@@ -215,6 +212,9 @@ static etInt16 enterHistory(ATcpClient* self, etInt16 state__et) {
if (!(skip_entry__et)) entry_initError(self);
/* in leaf state: return state id */
return STATE_initError;
+ case STATE_unconnected:
+ /* in leaf state: return state id */
+ return STATE_unconnected;
case STATE_TOP:
state__et = self->history[STATE_TOP];
break;
@@ -243,54 +243,54 @@ static void ATcpClient_receiveEventInternal(ATcpClient* self, InterfaceItemBase*
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState(self)) {
- case STATE_unconnected:
- switch(trigger__et) {
- case TRIG_controlPort__connect:
- {
- chain__et = CHAIN_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_connected:
- switch(trigger__et) {
- case TRIG_controlPort__disconnect:
- {
- chain__et = CHAIN_TRANS_tr1_FROM_connected_TO_unconnected_BY_disconnectcontrolPort;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_payloadPort__dataPackage:
- {
- chain__et = CHAIN_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_initError:
- switch(trigger__et) {
- case TRIG_controlPort__connect:
- {
- chain__et = CHAIN_TRANS_tr6_FROM_initError_TO_initError_BY_connectcontrolPort_tr6;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
+ case STATE_connected:
+ switch(trigger__et) {
+ case TRIG_controlPort__disconnect:
+ {
+ chain__et = CHAIN_TRANS_tr1_FROM_connected_TO_unconnected_BY_disconnectcontrolPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_payloadPort__dataPackage:
+ {
+ chain__et = CHAIN_TRANS_tr3_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr3;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_initError:
+ switch(trigger__et) {
+ case TRIG_controlPort__connect:
+ {
+ chain__et = CHAIN_TRANS_tr6_FROM_initError_TO_initError_BY_connectcontrolPort_tr6;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_unconnected:
+ switch(trigger__et) {
+ case TRIG_controlPort__connect:
+ {
+ chain__et = CHAIN_TRANS_tr0_FROM_unconnected_TO_cp0_BY_connectcontrolPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.h
index 3f6962c52..a814e21e3 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.h
@@ -11,6 +11,7 @@
#include "etDatatypes.h"
#include "messaging/etMessage.h"
+/* include all referenced room classes */
#include "room/basic/service/tcp/DTcpPayload.h"
#include "room/basic/service/tcp/PTcpControl.h"
#include "room/basic/service/tcp/PTcpPayload.h"
@@ -40,7 +41,7 @@ typedef struct ATcpClient_const {
/* constant for state machine data */
-#define ATCPCLIENT_HISTORY_SIZE 2
+#define ATCPCLIENT_HISTORY_SIZE 5
/* variable part of ActorClass (RAM) */
struct ATcpClient {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.c
index 17d9dc398..098797ea6 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.c
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.c
@@ -31,6 +31,7 @@ static int socketReceiver(void* slf, int channel, int size, const int8* data) {
payloadPort_dataPackage(&payloadRecvBuffer);
return ETSOCKET_OK;
}
+
/*--------------------- end user code ---------------------*/
/* interface item IDs */
@@ -74,7 +75,7 @@ static char* stateStrings[] = {"<no state>","<top>","connected",
static void setState(ATcpServer* self, etInt16 new_state) {
self->state = new_state;
- ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state])
+ ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state]);
}
static etInt16 getState(ATcpServer* self) {
@@ -87,9 +88,9 @@ static void entry_initError(ATcpServer* self) {
}
/* Action Codes */
-static void action_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpPayload* data) {
+static void action_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpPayload* transitionData) {
/* send payload to connection */
- setErrorCode(etWriteServerSocket(server, data->connectionId, data->length, data->data));
+ setErrorCode(etWriteServerSocket(server, transitionData->connectionId, transitionData->length, transitionData->data));
if(hasError())
controlPort_error();
}
@@ -100,14 +101,14 @@ static void action_TRANS_tr6_FROM_connected_TO_unconnected_BY_disconnectcontrolP
controlPort_disconnected();
}
-static void action_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpControl* data) {
+static void action_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpControl* transitionData) {
/* start accept thread */
- setErrorCode(etStartListening(server, data->TcpPort));
+ setErrorCode(etStartListening(server, transitionData->TcpPort));
}
-static void action_TRANS_tr4_FROM_cp1_TO_connected(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpControl* data) {
+static void action_TRANS_tr4_FROM_cp1_TO_connected(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpControl* transitionData) {
controlPort_connected();
}
-static void action_TRANS_tr8_FROM_cp1_TO_unconnected_COND_tr8(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpControl* data) {
+static void action_TRANS_tr8_FROM_cp1_TO_unconnected_COND_tr8(ATcpServer* self, const InterfaceItemBase* ifitem, DTcpControl* transitionData) {
controlPort_error();
}
@@ -125,14 +126,14 @@ static void exitTo(ATcpServer* self, etInt16 current__et, etInt16 to) {
self->history[STATE_TOP] = STATE_connected;
current__et = STATE_TOP;
break;
- case STATE_unconnected:
- self->history[STATE_TOP] = STATE_unconnected;
- current__et = STATE_TOP;
- break;
case STATE_initError:
self->history[STATE_TOP] = STATE_initError;
current__et = STATE_TOP;
break;
+ case STATE_unconnected:
+ self->history[STATE_TOP] = STATE_unconnected;
+ current__et = STATE_TOP;
+ break;
default:
/* should not occur */
break;
@@ -156,10 +157,15 @@ static etInt16 executeTransitionChain(ATcpServer* self, int chain__et, const Int
else {
return STATE_unconnected;}
}
+ case CHAIN_TRANS_tr2_FROM_initError_TO_initError_BY_connectcontrolPort_tr2:
+ {
+ DTcpControl* transitionData = ((DTcpControl*) generic_data__et);
+ return STATE_initError;
+ }
case CHAIN_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5:
{
- DTcpPayload* data = ((DTcpPayload*) generic_data__et);
- action_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5(self, ifitem, data);
+ DTcpPayload* transitionData = ((DTcpPayload*) generic_data__et);
+ action_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5(self, ifitem, transitionData);
return STATE_connected;
}
case CHAIN_TRANS_tr6_FROM_connected_TO_unconnected_BY_disconnectcontrolPort:
@@ -169,20 +175,15 @@ static etInt16 executeTransitionChain(ATcpServer* self, int chain__et, const Int
}
case CHAIN_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort:
{
- DTcpControl* data = ((DTcpControl*) generic_data__et);
- action_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort(self, ifitem, data);
+ DTcpControl* transitionData = ((DTcpControl*) generic_data__et);
+ action_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort(self, ifitem, transitionData);
if (hasError()) {
- action_TRANS_tr8_FROM_cp1_TO_unconnected_COND_tr8(self, ifitem, data);
+ action_TRANS_tr8_FROM_cp1_TO_unconnected_COND_tr8(self, ifitem, transitionData);
return STATE_unconnected;}
else {
- action_TRANS_tr4_FROM_cp1_TO_connected(self, ifitem, data);
+ action_TRANS_tr4_FROM_cp1_TO_connected(self, ifitem, transitionData);
return STATE_connected;}
}
- case CHAIN_TRANS_tr2_FROM_initError_TO_initError_BY_connectcontrolPort_tr2:
- {
- DTcpControl* data = ((DTcpControl*) generic_data__et);
- return STATE_initError;
- }
default:
/* should not occur */
break;
@@ -206,13 +207,13 @@ static etInt16 enterHistory(ATcpServer* self, etInt16 state__et) {
case STATE_connected:
/* in leaf state: return state id */
return STATE_connected;
- case STATE_unconnected:
- /* in leaf state: return state id */
- return STATE_unconnected;
case STATE_initError:
if (!(skip_entry__et)) entry_initError(self);
/* in leaf state: return state id */
return STATE_initError;
+ case STATE_unconnected:
+ /* in leaf state: return state id */
+ return STATE_unconnected;
case STATE_TOP:
state__et = self->history[STATE_TOP];
break;
@@ -241,54 +242,54 @@ static void ATcpServer_receiveEventInternal(ATcpServer* self, InterfaceItemBase*
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState(self)) {
- case STATE_connected:
- switch(trigger__et) {
- case TRIG_payloadPort__dataPackage:
- {
- chain__et = CHAIN_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_controlPort__disconnect:
- {
- chain__et = CHAIN_TRANS_tr6_FROM_connected_TO_unconnected_BY_disconnectcontrolPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_unconnected:
- switch(trigger__et) {
- case TRIG_controlPort__connect:
- {
- chain__et = CHAIN_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_initError:
- switch(trigger__et) {
- case TRIG_controlPort__connect:
- {
- chain__et = CHAIN_TRANS_tr2_FROM_initError_TO_initError_BY_connectcontrolPort_tr2;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
+ case STATE_connected:
+ switch(trigger__et) {
+ case TRIG_controlPort__disconnect:
+ {
+ chain__et = CHAIN_TRANS_tr6_FROM_connected_TO_unconnected_BY_disconnectcontrolPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_payloadPort__dataPackage:
+ {
+ chain__et = CHAIN_TRANS_tr5_FROM_connected_TO_connected_BY_dataPackagepayloadPort_tr5;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_initError:
+ switch(trigger__et) {
+ case TRIG_controlPort__connect:
+ {
+ chain__et = CHAIN_TRANS_tr2_FROM_initError_TO_initError_BY_connectcontrolPort_tr2;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_unconnected:
+ switch(trigger__et) {
+ case TRIG_controlPort__connect:
+ {
+ chain__et = CHAIN_TRANS_tr7_FROM_unconnected_TO_cp1_BY_connectcontrolPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.h
index 2bff8d75e..39e4c75bd 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.h
@@ -11,6 +11,7 @@
#include "etDatatypes.h"
#include "messaging/etMessage.h"
+/* include all referenced room classes */
#include "room/basic/service/tcp/DTcpPayload.h"
#include "room/basic/service/tcp/PTcpControl.h"
#include "room/basic/service/tcp/PTcpPayload.h"
@@ -40,7 +41,7 @@ typedef struct ATcpServer_const {
/* constant for state machine data */
-#define ATCPSERVER_HISTORY_SIZE 2
+#define ATCPSERVER_HISTORY_SIZE 5
/* variable part of ActorClass (RAM) */
struct ATcpServer {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpControl.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpControl.h
index 0d1c71664..ed7edcdd0 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpControl.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpControl.h
@@ -10,6 +10,7 @@
#include "etDatatypes.h"
+/* include all referenced room classes */
typedef struct {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpPayload.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpPayload.h
index 23aa03dd3..99fc0cf07 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpPayload.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/DTcpPayload.h
@@ -10,6 +10,7 @@
#include "etDatatypes.h"
+/* include all referenced room classes */
typedef struct {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpControl.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpControl.h
index 2809a5f03..d0e781960 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpControl.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpControl.h
@@ -12,6 +12,7 @@
#include "modelbase/etPort.h"
+/* include all referenced room classes */
#include "room/basic/service/tcp/DTcpControl.h"
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpPayload.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpPayload.h
index b27deac85..9a30653ab 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpPayload.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/PTcpPayload.h
@@ -12,6 +12,7 @@
#include "modelbase/etPort.h"
+/* include all referenced room classes */
#include "room/basic/service/tcp/DTcpPayload.h"
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
index c2f7f4acd..d164a2cdc 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
@@ -56,7 +56,7 @@ static char* stateStrings[] = {"<no state>","<top>","Operational"
static void setState(ATimingService* self, etInt16 new_state) {
self->state = new_state;
- ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state])
+ ET_MSC_LOGGER_CHANGE_STATE(self->constData->instName, stateStrings[new_state]);
}
static etInt16 getState(ATimingService* self) {
@@ -102,31 +102,31 @@ static void action_TRANS_INITIAL_TO__Operational(ATimingService* self) {
tcbs[i].next=&tcbs[i+1];
}
}
-static void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(ATimingService* self, const InterfaceItemBase* ifitem, uint32 time) {
- etTimerControlBlock* timer = getTcb();
+static void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(ATimingService* self, const InterfaceItemBase* ifitem, uint32 transitionData) {
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer!= 0){
- t.sec=time/1000;
- t.nSec=(time%1000)*1000000L;
- timer->pTime.sec = 0;
- timer->pTime.nSec = 0;
- timer->portIdx=((etReplSubPort*)ifitem)->index;
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime),&t);
- putTcbToUsedList(timer);
+ if (transitionDatar!= 0){
+ t.sec=transitionData/1000;
+ t.nSec=(transitionData%1000)*1000000L;
+ transitionDatar->pTime.sec = 0;
+ transitionDatar->pTime.nSec = 0;
+ transitionDatar->portIdx=((etReplSubPort*)ifitem)->index;
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime),&t);
+ putTcbToUsedList(transitionDatar);
}
}
-static void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(ATimingService* self, const InterfaceItemBase* ifitem, uint32 time) {
- etTimerControlBlock* timer = getTcb();
+static void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(ATimingService* self, const InterfaceItemBase* ifitem, uint32 transitionData) {
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer!= 0){
- t.sec=time/1000;
- t.nSec=(time%1000)*1000000L;
- timer->pTime = t;
- timer->portIdx=((etReplSubPort*)ifitem)->index;
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime),&t);
- putTcbToUsedList(timer);
+ if (transitionDatar!= 0){
+ t.sec=transitionData/1000;
+ t.nSec=(transitionData%1000)*1000000L;
+ transitionDatar->pTime = t;
+ transitionDatar->portIdx=((etReplSubPort*)ifitem)->index;
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime),&t);
+ putTcbToUsedList(transitionDatar);
}
}
static void action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(ATimingService* self, const InterfaceItemBase* ifitem) {
@@ -170,14 +170,14 @@ static etInt16 executeTransitionChain(ATimingService* self, int chain__et, const
}
case CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1:
{
- uint32 time = *((uint32*) generic_data__et);
- action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(self, ifitem, time);
+ uint32 transitionData = *((uint32*) generic_data__et);
+ action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(self, ifitem, transitionData);
return STATE_Operational;
}
case CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3:
{
- uint32 time = *((uint32*) generic_data__et);
- action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(self, ifitem, time);
+ uint32 transitionData = *((uint32*) generic_data__et);
+ action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(self, ifitem, transitionData);
return STATE_Operational;
}
case CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4:
@@ -237,37 +237,37 @@ static void ATimingService_receiveEventInternal(ATimingService* self, InterfaceI
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState(self)) {
- case STATE_Operational:
- switch(trigger__et) {
- case POLLING:
- do_Operational(self);
- break;
- case TRIG_timer__startTimeout:
- {
- chain__et = CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__startTimer:
- {
- chain__et = CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__kill:
- {
- chain__et = CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
+ case STATE_Operational:
+ switch(trigger__et) {
+ case POLLING:
+ do_Operational(self);
+ break;
+ case TRIG_timer__kill:
+ {
+ chain__et = CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_timer__startTimeout:
+ {
+ chain__et = CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_timer__startTimer:
+ {
+ chain__et = CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h
index 36e86ddc9..d8cafada4 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h
@@ -11,6 +11,7 @@
#include "etDatatypes.h"
#include "messaging/etMessage.h"
+/* include all referenced room classes */
#include "room/basic/service/timing/PTimer.h"
/*--------------------- begin user code ---------------------*/
@@ -45,7 +46,7 @@ typedef struct ATimingService_const {
/* constant for state machine data */
-#define ATIMINGSERVICE_HISTORY_SIZE 2
+#define ATIMINGSERVICE_HISTORY_SIZE 3
/* variable part of ActorClass (RAM) */
struct ATimingService {
diff --git a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/PTimer.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/PTimer.h
index 585239128..faeea093e 100644
--- a/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/PTimer.h
+++ b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/PTimer.h
@@ -16,6 +16,7 @@
#define ET_TIMER_PERIODIC 0x02
/*--------------------- end user code ---------------------*/
+/* include all referenced room classes */
/* message IDs */
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room
index c1e56cd71..ede76423d 100644
--- a/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room
+++ b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room
@@ -7,235 +7,221 @@ RoomModel room.basic.service.timing {
SPP timer: PTimer
}
Structure {
- usercode1 {
- "#include \"osal/etTime.h\" "
- "#define ET_NB_OF_TCBS 30"
- "typedef struct etTCB etTimerControlBlock;"
- "struct etTCB {"
- " etTime expTime;"
- " etTime pTime;"
- " int32 portIdx;"
- " etTimerControlBlock* next;"
- "};"
- }
- usercode2 {
- "// uc2"
- } usercode3 {
- "// uc3"
- }
- Attribute tcbs [ 30 ]: tcb
+ usercode1 '''
+ #include "osal/etTime.h"
+ #define ET_NB_OF_TCBS 30
+ typedef struct etTCB etTimerControlBlock;
+ struct etTCB {
+ etTime expTime;
+ etTime pTime;
+ int32 portIdx;
+ etTimerControlBlock* next;
+ };
+ '''
+ usercode2 '''// uc2'''
+ usercode3 '''// uc3'''
+ Attribute tcbs [30]: tcb
Attribute usedTcbsRoot: tcb ref
Attribute freeTcbsRoot: tcb ref
ServiceImplementation of timer
}
Behavior {
- ctor {
- "memset(tcbs.getData(), sizeof(tcbs), 0);"
- }
- Operation getTcb(): tcb ref {
- "etTimerControlBlock* temp = freeTcbsRoot;"
- ""
- "if (freeTcbsRoot != 0) {"
- " freeTcbsRoot = freeTcbsRoot->next;"
- " temp->next = 0;"
- "}"
- "return temp;"
- ""
- }
- Operation returnTcb(block: tcb ref) {
- "block->next = freeTcbsRoot;"
- "freeTcbsRoot = block;"
- }
- Operation removeTcbFromUsedList(idx: int32) {
- "etTimerControlBlock* temp = usedTcbsRoot;"
- "etTimerControlBlock* temp2 = usedTcbsRoot;"
- ""
- "if (temp == 0)"
- " return;"
- ""
- "if (usedTcbsRoot->portIdx == idx) {"
- " /* element found, the first one */"
- " usedTcbsRoot = usedTcbsRoot->next;"
- " returnTcb(temp);"
- " return;"
- "}"
- ""
- "temp = temp->next;"
- "while (temp != 0) {"
- " if (temp->portIdx == idx) {"
- " temp2->next = temp->next;"
- " returnTcb(temp);"
- " return;"
- " } else {"
- " /* try next */"
- " temp2 = temp;"
- " temp = temp->next;"
- " }"
- "}"
- }
- Operation putTcbToUsedList(block: tcb ref) {
- "etTimerControlBlock* temp = usedTcbsRoot;"
- "etTimerControlBlock* temp2 = usedTcbsRoot;"
- ""
- "if (temp == 0) {"
- " /* list empty put new block to root */"
- " block->next = 0;"
- " usedTcbsRoot = block;"
- " return;"
- "}"
- ""
- "while (1) {"
- " if (temp != 0) {"
- " if (isTimeGreater(&block->expTime, &temp->expTime)) {"
- " /* try next position */"
- " temp2 = temp;"
- " temp = temp->next;"
- " } else {"
- " /* right position found */"
- " block->next = temp;"
- " if (temp == usedTcbsRoot) {"
- " usedTcbsRoot = block;"
- " } else {"
- " temp2->next = block;"
- " }"
- " return;"
- " }"
- " } else {"
- " /* end of list reached */"
- " block->next = 0;"
- " temp2->next = block;"
- " return;"
- " }"
- "}"
- }
- Operation isTimeGreater(t1: targetTime ref, t2: targetTime ref): boolean {
- "if (t1->sec > t2->sec)"
- " return ET_TRUE;"
- "if (t1->sec < t2->sec)"
- " return ET_FALSE;"
- "if (t1->nSec > t2->nSec)"
- " return ET_TRUE;"
- "return ET_FALSE;"
- }
- Operation addTime(t1: targetTime ref, t2: targetTime ref) {
- "t1->sec += t2->sec;"
- "t1->nSec += t2->nSec;"
- "while (t1->nSec >= 1000000000L) {"
- " t1->sec++;"
- " t1->nSec -= 1000000000L;"
- "}"
- }
-
- // Operation printList(){
- // "etTimerControlBlock* temp=usedTcbsRoot;"
- // " printf(\"list: \");"
- // " while (temp!=0){"
- // " printf(\"(%ld,%ld),\",temp->expTime.sec,temp->expTime.nSec);"
- // " temp=temp->next;"
- // " }"
- // " printf(\"\\n\");"
- // }
+ ctor '''memset(tcbs.getData(), sizeof(tcbs), 0);'''
+ Operation getTcb(): tcb ref '''
+ etTimerControlBlock* temp = freeTcbsRoot;
+
+ if (freeTcbsRoot != 0) {
+ freeTcbsRoot = freeTcbsRoot->next;
+ temp->next = 0;
+ }
+ return temp;
+ '''
+ Operation returnTcb(block: tcb ref) '''
+ block->next = freeTcbsRoot;
+ freeTcbsRoot = block;
+ '''
+ Operation removeTcbFromUsedList(idx: int32) '''
+ etTimerControlBlock* temp = usedTcbsRoot;
+ etTimerControlBlock* temp2 = usedTcbsRoot;
+
+ if (temp == 0)
+ return;
+
+ if (usedTcbsRoot->portIdx == idx) {
+ /* element found, the first one */
+ usedTcbsRoot = usedTcbsRoot->next;
+ returnTcb(temp);
+ return;
+ }
+
+ temp = temp->next;
+ while (temp != 0) {
+ if (temp->portIdx == idx) {
+ temp2->next = temp->next;
+ returnTcb(temp);
+ return;
+ } else {
+ /* try next */
+ temp2 = temp;
+ temp = temp->next;
+ }
+ }
+ '''
+ Operation putTcbToUsedList(block: tcb ref) '''
+ etTimerControlBlock* temp = usedTcbsRoot;
+ etTimerControlBlock* temp2 = usedTcbsRoot;
+
+ if (temp == 0) {
+ /* list empty put new block to root */
+ block->next = 0;
+ usedTcbsRoot = block;
+ return;
+ }
+
+ while (1) {
+ if (temp != 0) {
+ if (isTimeGreater(&block->expTime, &temp->expTime)) {
+ /* try next position */
+ temp2 = temp;
+ temp = temp->next;
+ } else {
+ /* right position found */
+ block->next = temp;
+ if (temp == usedTcbsRoot) {
+ usedTcbsRoot = block;
+ } else {
+ temp2->next = block;
+ }
+ return;
+ }
+ } else {
+ /* end of list reached */
+ block->next = 0;
+ temp2->next = block;
+ return;
+ }
+ }
+ '''
+ Operation isTimeGreater(t1: targetTime ref, t2: targetTime ref): boolean '''
+ if (t1->sec > t2->sec)
+ return ET_TRUE;
+ if (t1->sec < t2->sec)
+ return ET_FALSE;
+ if (t1->nSec > t2->nSec)
+ return ET_TRUE;
+ return ET_FALSE;
+ '''
+ Operation addTime(t1: targetTime ref, t2: targetTime ref) '''
+ t1->sec += t2->sec;
+ t1->nSec += t2->nSec;
+ while (t1->nSec >= 1000000000L) {
+ t1->sec++;
+ t1->nSec -= 1000000000L;
+ }
+ '''
+ // Operation printList(){
+ // "etTimerControlBlock* temp=usedTcbsRoot;"
+ // " printf(\"list: \");"
+ // " while (temp!=0){"
+ // " printf(\"(%ld,%ld),\",temp->expTime.sec,temp->expTime.nSec);"
+ // " temp=temp->next;"
+ // " }"
+ // " printf(\"\\n\");"
+ // }
StateMachine {
Transition tr0: initial -> Operational {
- action {
- "int i;"
- "usedTcbsRoot = 0;"
- "freeTcbsRoot = &tcbs[0];"
- "tcbs[ET_NB_OF_TCBS - 1].next = 0;"
- "for (i = 0; i < ET_NB_OF_TCBS - 1; i++) {"
- "\ttcbs[i].next = &tcbs[i + 1];"
- "}"
- }
+ action '''
+ int i;
+ usedTcbsRoot = 0;
+ freeTcbsRoot = &tcbs[0];
+ tcbs[ET_NB_OF_TCBS - 1].next = 0;
+ for (i = 0; i < ET_NB_OF_TCBS - 1; i++) {
+ tcbs[i].next = &tcbs[i + 1];
+ }
+ '''
}
Transition tr1: Operational -> Operational {
triggers {
<startTimeout: timer>
}
- action {
- "etTimerControlBlock* timer = getTcb();"
- "etTime t;"
- "if (timer != 0) {"
- "\tt.sec = time / 1000;"
- "\tt.nSec = (time % 1000) * 1000000L;"
- "\ttimer->pTime.sec = 0;"
- "\ttimer->pTime.nSec = 0;"
- "\ttimer->portIdx = ifitem->getIdx();"
- "\tgetTimeFromTarget(&(timer->expTime));"
- "\taddTime(&(timer->expTime), &t);"
- "\tputTcbToUsedList(timer);"
- "}"
- }
+ action '''
+ etTimerControlBlock* transitionDatar = getTcb();
+ etTime t;
+ if (transitionDatar != 0) {
+ t.sec = transitionData / 1000;
+ t.nSec = (transitionData % 1000) * 1000000L;
+ transitionDatar->pTime.sec = 0;
+ transitionDatar->pTime.nSec = 0;
+ transitionDatar->portIdx = ifitem->getIdx();
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime), &t);
+ putTcbToUsedList(transitionDatar);
+ }'''
}
Transition tr3: Operational -> Operational {
triggers {
<startTimer: timer>
}
- action {
- "etTimerControlBlock* timer = getTcb();"
- "etTime t;"
- "if (timer != 0) {"
- "\tt.sec = time / 1000;"
- "\tt.nSec = (time % 1000) * 1000000L;"
- "\ttimer->pTime = t;"
- "\ttimer->portIdx = ifitem->getIdx();"
- "\tgetTimeFromTarget(&(timer->expTime));"
- "\taddTime(&(timer->expTime), &t);"
- "\tputTcbToUsedList(timer);"
- "}"
- }
+ action '''
+ etTimerControlBlock* transitionDatar = getTcb();
+ etTime t;
+ if (transitionDatar != 0) {
+ t.sec = transitionData / 1000;
+ t.nSec = (transitionData % 1000) * 1000000L;
+ transitionDatar->pTime = t;
+ transitionDatar->portIdx = ifitem->getIdx();
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime), &t);
+ putTcbToUsedList(transitionDatar);
+ }'''
}
Transition tr4: Operational -> Operational {
triggers {
<kill: timer>
}
- action {
- "removeTcbFromUsedList(ifitem->getIdx());"
- }
+ action '''removeTcbFromUsedList(ifitem->getIdx());'''
}
State Operational {
- entry {
- "// prepare"
- } do {
- "// maintain timers"
- "etTimerControlBlock* temp;"
- "etTime t;"
- ""
- "getTimeFromTarget(&t);"
- "while (usedTcbsRoot != 0) {"
- "\tif (isTimeGreater(&t, &(usedTcbsRoot->expTime))) {"
- "\t\ttimer.get(usedTcbsRoot->portIdx).timeout();"
- "\t\ttemp = usedTcbsRoot;"
- "\t\tusedTcbsRoot = usedTcbsRoot->next;"
- "\t\tif ((temp->pTime.sec == 0) && (temp->pTime.nSec == 0)) {"
- "\t\t\t// single shot timer"
- "\t\t\treturnTcb(temp);"
- "\t\t} else {"
- "\t\t\t// periodic timer"
- "\t\t\taddTime(&temp->expTime, &temp->pTime);"
- "\t\t\tputTcbToUsedList(temp);"
- "\t\t}"
- "\t} else {"
- "\t\tbreak;"
- "\t}"
- "}"
- }
+ entry '''// prepare'''
+ do '''
+ // maintain timers
+ etTimerControlBlock* temp;
+ etTime t;
+
+ getTimeFromTarget(&t);
+ while (usedTcbsRoot != 0) {
+ if (isTimeGreater(&t, &(usedTcbsRoot->expTime))) {
+ timer.get(usedTcbsRoot->portIdx).timeout();
+ temp = usedTcbsRoot;
+ usedTcbsRoot = usedTcbsRoot->next;
+ if ((temp->pTime.sec == 0) && (temp->pTime.nSec == 0)) {
+ // single shot timer
+ returnTcb(temp);
+ } else {
+ // periodic timer
+ addTime(&temp->expTime, &temp->pTime);
+ putTcbToUsedList(temp);
+ }
+ } else {
+ break;
+ }
+ }
+ '''
}
}
}
}
ProtocolClass PTimer {
- usercode1 {
- "#define ET_TIMER_RUNNING 0x01"
- "#define ET_TIMER_PERIODIC 0x02"
- }
- usercode2 {
- "//uc2 "
- }
+ usercode1 '''
+ #define ET_TIMER_RUNNING 0x01
+ #define ET_TIMER_PERIODIC 0x02
+ '''
+ usercode2 '''//uc2'''
incoming {
- Message startTimer(time: uint32)
- Message startTimeout(time: uint32)
+ Message startTimer(uint32)
+ Message startTimeout(uint32)
Message kill()
}
outgoing {
@@ -244,45 +230,35 @@ RoomModel room.basic.service.timing {
conjugated PortClass
{
Attribute status: int8 = "0"
- handle
- incoming startTimer {
- "if (status==0){
- status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC;
- startTimer_impl(time);
- }
- "
- }
- handle
- incoming startTimeout {
- "if (status==0){
- status = ET_TIMER_RUNNING;
- startTimeout_impl(time);
- }
- "
- }
- handle
- outgoing timeout {
- "
- //TODO: clear active bit in case of single shot timer
- if (status!=0){
- if (status==ET_TIMER_RUNNING){
- // single shot timer
+ handle incoming startTimer '''
+ if (status==0){
+ status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC;
+ startTimer_impl(transitionData);
+ }
+ '''
+ handle incoming startTimeout '''
+ if (status==0){
+ status = ET_TIMER_RUNNING;
+ startTimeout_impl(transitionData);
+ }
+ '''
+ handle outgoing timeout '''
+ //TODO: clear active bit in case of single shot timer
+ if (status!=0){
+ if (status==ET_TIMER_RUNNING){
+ // single shot timer
+ status=0;
+ }
+ // msg to fsm
+ getActor()->receiveEvent(this, msg->getEvtId(), msg->getData());
+ }
+ '''
+ handle incoming kill '''
+ if (status!=0){
status=0;
+ kill_impl();
}
- // msg to fsm
- getActor()->receiveEvent(this, msg->getEvtId(), msg->getData());
- }
- "
- }
- handle
- incoming kill {
- "
- if (status!=0){
- status=0;
- kill_impl();
- }
- "
- }
+ '''
}
}
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt
new file mode 100644
index 000000000..1dc2b35ab
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/readme.txt
@@ -0,0 +1,4 @@
+This directory is an eTrice code generation target.
+It will be erased every time the generator is executed.
+
+DO NOT PLACE OTHER FILES HERE!
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp
index 8639764df..08a07e5df 100644
--- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp
+++ b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp
@@ -212,31 +212,31 @@ void ATimingService::action_TRANS_INITIAL_TO__Operational() {
tcbs[i].next = &tcbs[i + 1];
}
}
-void ATimingService::action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const InterfaceItemBase* ifitem, uint32 time) {
- etTimerControlBlock* timer = getTcb();
+void ATimingService::action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const InterfaceItemBase* ifitem, uint32 transitionData) {
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer != 0) {
- t.sec = time / 1000;
- t.nSec = (time % 1000) * 1000000L;
- timer->pTime.sec = 0;
- timer->pTime.nSec = 0;
- timer->portIdx = ifitem->getIdx();
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime), &t);
- putTcbToUsedList(timer);
+ if (transitionDatar != 0) {
+ t.sec = transitionData / 1000;
+ t.nSec = (transitionData % 1000) * 1000000L;
+ transitionDatar->pTime.sec = 0;
+ transitionDatar->pTime.nSec = 0;
+ transitionDatar->portIdx = ifitem->getIdx();
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime), &t);
+ putTcbToUsedList(transitionDatar);
}
}
-void ATimingService::action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(const InterfaceItemBase* ifitem, uint32 time) {
- etTimerControlBlock* timer = getTcb();
+void ATimingService::action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(const InterfaceItemBase* ifitem, uint32 transitionData) {
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer != 0) {
- t.sec = time / 1000;
- t.nSec = (time % 1000) * 1000000L;
- timer->pTime = t;
- timer->portIdx = ifitem->getIdx();
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime), &t);
- putTcbToUsedList(timer);
+ if (transitionDatar != 0) {
+ t.sec = transitionData / 1000;
+ t.nSec = (transitionData % 1000) * 1000000L;
+ transitionDatar->pTime = t;
+ transitionDatar->portIdx = ifitem->getIdx();
+ getTimeFromTarget(&(transitionDatar->expTime));
+ addTime(&(transitionDatar->expTime), &t);
+ putTcbToUsedList(transitionDatar);
}
}
void ATimingService::action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(const InterfaceItemBase* ifitem) {
@@ -280,14 +280,14 @@ etInt16 ATimingService::executeTransitionChain(int chain__et, const InterfaceIte
}
case ATimingService::CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1:
{
- uint32 time = *(static_cast<uint32*>(generic_data__et));
- action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(ifitem, time);
+ uint32 transitionData = *(static_cast<uint32*>(generic_data__et));
+ action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(ifitem, transitionData);
return STATE_Operational;
}
case ATimingService::CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3:
{
- uint32 time = *(static_cast<uint32*>(generic_data__et));
- action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(ifitem, time);
+ uint32 transitionData = *(static_cast<uint32*>(generic_data__et));
+ action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(ifitem, transitionData);
return STATE_Operational;
}
case ATimingService::CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4:
@@ -346,37 +346,37 @@ void ATimingService::receiveEventInternal(InterfaceItemBase* ifitem, int localId
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState()) {
- case STATE_Operational:
- switch(trigger__et) {
- case POLLING:
- do_Operational();
- break;
- case TRIG_timer__startTimeout:
- {
- chain__et = ATimingService::CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__startTimer:
- {
- chain__et = ATimingService::CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__kill:
- {
- chain__et = ATimingService::CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
+ case STATE_Operational:
+ switch(trigger__et) {
+ case POLLING:
+ do_Operational();
+ break;
+ case TRIG_timer__kill:
+ {
+ chain__et = ATimingService::CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_timer__startTimeout:
+ {
+ chain__et = ATimingService::CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_timer__startTimer:
+ {
+ chain__et = ATimingService::CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h
index d351dd0aa..5e80a4e0a 100644
--- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h
+++ b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h
@@ -32,6 +32,7 @@ struct etTCB {
int32 portIdx;
etTimerControlBlock* next;
};
+
/*--------------------- end user code ---------------------*/
using namespace etRuntime;
@@ -119,8 +120,8 @@ class ATimingService : public etRuntime::ActorClassBase {
/* Action Codes */
virtual void action_TRANS_INITIAL_TO__Operational();
- virtual void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const InterfaceItemBase* ifitem, uint32 time);
- virtual void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(const InterfaceItemBase* ifitem, uint32 time);
+ virtual void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const InterfaceItemBase* ifitem, uint32 transitionData);
+ virtual void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_startTimertimer_tr3(const InterfaceItemBase* ifitem, uint32 transitionData);
virtual void action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(const InterfaceItemBase* ifitem);
/* State Switch Methods */
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp
index dce6afef7..5cf3b0146 100644
--- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp
+++ b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.cpp
@@ -124,16 +124,15 @@ void PTimerConjPort::receive(const Message* msg) {
switch (msg->getEvtId()) {
case PTimer::OUT_timeout:
{
-
- //TODO: clear active bit in case of single shot timer
- if (status!=0){
- if (status==ET_TIMER_RUNNING){
- // single shot timer
- status=0;
- }
- // msg to fsm
- getActor()->receiveEvent(this, msg->getEvtId(), msg->getData());
- }
+ //TODO: clear active bit in case of single shot timer
+ if (status!=0){
+ if (status==ET_TIMER_RUNNING){
+ // single shot timer
+ status=0;
+ }
+ // msg to fsm
+ getActor()->receiveEvent(this, msg->getEvtId(), msg->getData());
+ }
}
break;
default:
@@ -145,46 +144,45 @@ void PTimerConjPort::receive(const Message* msg) {
/*--------------------- operations ---------------------*/
// sent messages
-void PTimerConjPort::startTimer(uint32 time) {
+void PTimerConjPort::startTimer(uint32 transitionData) {
if (status==0){
status=ET_TIMER_RUNNING | ET_TIMER_PERIODIC;
- startTimer_impl(time);
+ startTimer_impl(transitionData);
}
}
-void PTimerConjPort::startTimer_impl(uint32 time) {
+void PTimerConjPort::startTimer_impl(uint32 transitionData) {
DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
PTimer::getMessageString(PTimer::IN_startTimer).c_str());
if (getPeerAddress().isValid()) {
Message* buffer = dynamic_cast<IMessageService*>(getPeerMsgReceiver())->getMessageBuffer(sizeof(DataMessage<uint32>));
if (buffer) {
- getPeerMsgReceiver()->receive(new (buffer) DataMessage<uint32>(getPeerAddress(), PTimer::IN_startTimer, time));
+ getPeerMsgReceiver()->receive(new (buffer) DataMessage<uint32>(getPeerAddress(), PTimer::IN_startTimer, transitionData));
}
}
}
-void PTimerConjPort::startTimeout(uint32 time) {
+void PTimerConjPort::startTimeout(uint32 transitionData) {
if (status==0){
status = ET_TIMER_RUNNING;
- startTimeout_impl(time);
+ startTimeout_impl(transitionData);
}
}
-void PTimerConjPort::startTimeout_impl(uint32 time) {
+void PTimerConjPort::startTimeout_impl(uint32 transitionData) {
DebuggingService::getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(),
PTimer::getMessageString(PTimer::IN_startTimeout).c_str());
if (getPeerAddress().isValid()) {
Message* buffer = dynamic_cast<IMessageService*>(getPeerMsgReceiver())->getMessageBuffer(sizeof(DataMessage<uint32>));
if (buffer) {
- getPeerMsgReceiver()->receive(new (buffer) DataMessage<uint32>(getPeerAddress(), PTimer::IN_startTimeout, time));
+ getPeerMsgReceiver()->receive(new (buffer) DataMessage<uint32>(getPeerAddress(), PTimer::IN_startTimeout, transitionData));
}
}
}
void PTimerConjPort::kill() {
-
- if (status!=0){
- status=0;
- kill_impl();
- }
+ if (status!=0){
+ status=0;
+ kill_impl();
+ }
}
void PTimerConjPort::kill_impl() {
@@ -207,14 +205,14 @@ PTimerConjReplPort::PTimerConjReplPort(IInterfaceItemOwner* actor, const String&
}
// incoming messages
-void PTimerConjReplPort::startTimer(uint32 time){
+void PTimerConjReplPort::startTimer(uint32 transitionData){
for (Vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {
- (dynamic_cast<PTimerConjPort*>(*it))->startTimer( time);
+ (dynamic_cast<PTimerConjPort*>(*it))->startTimer( transitionData);
}
}
-void PTimerConjReplPort::startTimeout(uint32 time){
+void PTimerConjReplPort::startTimeout(uint32 transitionData){
for (Vector<etRuntime::InterfaceItemBase*>::iterator it = getItems().begin(); it != getItems().end(); ++it) {
- (dynamic_cast<PTimerConjPort*>(*it))->startTimeout( time);
+ (dynamic_cast<PTimerConjPort*>(*it))->startTimeout( transitionData);
}
}
void PTimerConjReplPort::kill(){
diff --git a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h
index be5e64f10..b6c07b9ed 100644
--- a/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h
+++ b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/PTimer.h
@@ -18,6 +18,7 @@
/*--------------------- begin user code ---------------------*/
#define ET_TIMER_RUNNING 0x01
#define ET_TIMER_PERIODIC 0x02
+
/*--------------------- end user code ---------------------*/
@@ -34,7 +35,7 @@ class PTimer {
} msg_ids;
/*--------------------- begin user code ---------------------*/
- //uc2
+ //uc2
/*--------------------- end user code ---------------------*/
static bool isValidEvtID(int evtId) {
@@ -109,10 +110,10 @@ class PTimerConjPort : public etRuntime::PortBase {
/*--------------------- operations ---------------------*/
// sent messages
- public: void startTimer(uint32 time);
- private: void startTimer_impl(uint32 time);
- public: void startTimeout(uint32 time);
- private: void startTimeout_impl(uint32 time);
+ public: void startTimer(uint32 transitionData);
+ private: void startTimer_impl(uint32 transitionData);
+ public: void startTimeout(uint32 transitionData);
+ private: void startTimeout_impl(uint32 transitionData);
public: void kill();
private: void kill_impl();
};
@@ -130,8 +131,8 @@ class PTimerConjReplPort : public etRuntime::ReplicatedPortBase {
PTimerConjPort& get(int idx) const { return *dynamic_cast<PTimerConjPort*>(getInterfaceItem(idx)); }
// incoming messages
- public: void startTimer(uint32 time);
- public: void startTimeout(uint32 time);
+ public: void startTimer(uint32 transitionData);
+ public: void startTimeout(uint32 transitionData);
public: void kill();
protected:
diff --git a/runtime/org.eclipse.etrice.modellib.java/.classpath b/runtime/org.eclipse.etrice.modellib.java/.classpath
index 2b29ce094..13453a62f 100644
--- a/runtime/org.eclipse.etrice.modellib.java/.classpath
+++ b/runtime/org.eclipse.etrice.modellib.java/.classpath
@@ -2,6 +2,7 @@
<classpath>
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src-gen">
<attributes>
+ <attribute name="ignore_optional_problems" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
diff --git a/runtime/org.eclipse.etrice.modellib.java/build.gradle b/runtime/org.eclipse.etrice.modellib.java/build.gradle
index 4d49f6b64..9a5d77227 100644
--- a/runtime/org.eclipse.etrice.modellib.java/build.gradle
+++ b/runtime/org.eclipse.etrice.modellib.java/build.gradle
@@ -1,5 +1,6 @@
apply plugin: 'java'
+apply from: "$rootDir/gradle/publish.gradle"
apply from: "$rootDir/gradle/etGenerator.gradle"
def models = [
@@ -17,6 +18,10 @@ sourceSets {
java {
srcDirs = ['src-gen']
}
+ resources {
+ srcDirs = [projectDir]
+ includes = ['model/*.room']
+ }
}
}
diff --git a/runtime/org.eclipse.etrice.modellib.java/model/ALogService.room b/runtime/org.eclipse.etrice.modellib.java/model/ALogService.room
index 51a868f60..e20934293 100644
--- a/runtime/org.eclipse.etrice.modellib.java/model/ALogService.room
+++ b/runtime/org.eclipse.etrice.modellib.java/model/ALogService.room
@@ -1,70 +1,65 @@
RoomModel room.basic.service.logging {
-
+
import room.basic.types.* from "Types.room"
-
+
ActorClass ALogService {
Interface {
SPP log: Log
}
Structure {
- usercode1 {
- "import java.io.*;"
- "import java.util.*;"
- }
- usercode2 {
- "FileOutputStream file = null;"
- "PrintStream p = null;"
- "static long tStart = System.currentTimeMillis();"
- }
+ usercode1 '''
+ import java.io.*;
+ import java.util.*;'''
+ usercode2 '''
+ FileOutputStream file = null;
+ PrintStream p = null;
+ static long tStart = System.currentTimeMillis();'''
ServiceImplementation of log
}
Behavior {
- Operation destroyUser() {
- "if (p!= null) {"
- "p.flush();"
- "p.close();"
- "p=null;"
- "}"
- }
+ Operation destroyUser() '''
+ if (p!= null) {
+ p.flush();
+ p.close();
+ p=null;
+ }'''
StateMachine {
- Transition init: initial -> closed { }
+ Transition init: initial -> closed {
+ }
Transition open: closed -> opened {
triggers {
<open: log>
}
- action {
- "Date d=new Date(tStart);"
- "try{"
- "file=new FileOutputStream(fileName);"
- "p=new PrintStream(file);"
- "p.println(\"Log opened at \"+ d.toString());"
- "p.println(\"--------------------------------------------------\");"
- "} catch (Exception e){"
- "System.out.println(\"Log file not opened !\");"
- "}"
- }
+ action '''
+ Date d=new Date(tStart);
+ try{
+ file=new FileOutputStream(transitionData);
+ p=new PrintStream(file);
+ p.println("Log opened at "+ d.toString());
+ p.println("--------------------------------------------------");
+ } catch (Exception e){
+ System.out.println("Log file not opened !");
+ }'''
}
Transition tr0: opened -> closed {
triggers {
<close: log>
}
- action {
- "p.flush();"
- "p.close();"
- "p=null;"
- }
+ action '''
+ p.flush();
+ p.close();
+ p=null;'''
}
Transition tr1: opened -> opened {
triggers {
<internalLog: log>
}
- action {
- "p.println(\"Timestamp: \" + Long.toString(data.timeStamp-tStart) + \"ms\");"
- "p.println(\"SenderInstance: \"+ data.sender);"
- "p.println(\"UserString: \" + data.userString);"
- "p.println(\"--------------------------------------------------\");"
- "System.out.printf(data.userString);"
- }
+ action '''
+ p.println("Timestamp: " + Long.toString(transitionData.timeStamp-tStart) + "ms");
+ p.println("SenderInstance: "+ transitionData.sender);
+ p.println("UserString: " + transitionData.userString);
+ p.println("--------------------------------------------------");
+ System.out.printf(transitionData.userString);'''
}
State closed
State opened
@@ -73,35 +68,32 @@ RoomModel room.basic.service.logging {
}
ProtocolClass Log {
- usercode2 {
- "public static final int LOG_LEVEL_LOW = 1;"
- "public static final int LOG_LEVEL_MEDIUM = 2;"
- "public static final int LOG_LEVEL_HIGH = 3;"
- }
+ usercode2 '''
+ public static final int LOG_LEVEL_LOW = 1;
+ public static final int LOG_LEVEL_MEDIUM = 2;
+ public static final int LOG_LEVEL_HIGH = 3;'''
incoming {
- Message open(fileName: string)
+ Message open(string)
Message close()
- private Message internalLog(data: InternalLogData)
+ private Message internalLog(InternalLogData)
}
- conjugated PortClass {
- usercode {
- "static int logLevel=0;"
- "InternalLogData d = new InternalLogData();"
- }
- Operation setLogLevel(l: int32) {
- "logLevel=l;"
- "if (logLevel > LOG_LEVEL_HIGH) logLevel=LOG_LEVEL_HIGH;"
- }
- Operation log(logLevel: int32, userString: string) sends internalLog {
- "if (logLevel>LogConjPort.logLevel){"
- "d.userString=userString;"
- "d.timeStamp=System.currentTimeMillis();"
- "d.sender=getInstancePath();"
- "if (getPeerAddress()!=null)"
- "getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d.deepCopy()));"
- "}"
- }
+ conjugated PortClass
+ {
+ usercode '''
+ static int logLevel=0;
+ InternalLogData d = new InternalLogData();'''
+ Operation setLogLevel(l: int32) '''
+ logLevel=l;
+ if (logLevel > LOG_LEVEL_HIGH) logLevel=LOG_LEVEL_HIGH;'''
+ Operation log(logLevel: int32, userString: string) sends internalLog '''
+ if (logLevel>LogConjPort.logLevel){
+ d.userString=userString;
+ d.timeStamp=System.currentTimeMillis();
+ d.sender=getInstancePath();
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d.deepCopy()));
+ }'''
}
}
@@ -110,5 +102,4 @@ RoomModel room.basic.service.logging {
Attribute sender: string
Attribute timeStamp: int64
}
-
} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.java/model/TcpService.room b/runtime/org.eclipse.etrice.modellib.java/model/TcpService.room
index 5af3819d6..40621266a 100644
--- a/runtime/org.eclipse.etrice.modellib.java/model/TcpService.room
+++ b/runtime/org.eclipse.etrice.modellib.java/model/TcpService.room
@@ -2,96 +2,96 @@ RoomModel room.basic.service.tcp {
import room.basic.types.* from "Types.room"
-
ActorClass ATcpServer {
Interface {
Port ControlPort: PTcpControl
Port PayloadPort: PTcpPayload
}
Structure {
- usercode1 {
- "import java.net.ServerSocket;"
- "import java.net.Socket;"
- "import java.io.*;"
- "import java.util.*;"
- ""
- "class ServerRxThread extends Thread{"
- " private int connectionId;"
- " private Socket sock;"
- " PTcpPayloadPort port;"
- ""
- " public ServerRxThread (int connectionId, PTcpPayloadPort port, Socket sock){"
- " this.sock = sock;"
- " this.connectionId = connectionId;"
- " this.port = port;"
- " }"
- ""
- " public void run(){"
- " try{"
- " InputStream in = sock.getInputStream();"
- " DTcpPayload d = new DTcpPayload();"
- " d.setConnectionId(connectionId);"
- " int c;"
- " while ((c=in.read(d.getData()))!=-1){"
- " d.setLength(c);"
- " port.receive(d); "
- " }"
- " }catch (IOException e){"
- " System.err.println(\"ServerRx: \" + e.toString());"
- " }"
- " }"
- "}"
- ""
- "class ServerAcceptThread extends Thread{"
- " private ServerSocket sock;"
- " private PTcpPayloadPort port;"
- " private ATcpServer parent;"
- " public ServerAcceptThread (PTcpPayloadPort port, ServerSocket sock, ATcpServer parent){"
- " this.sock = sock;"
- " this.port = port;"
- " this.parent = parent;"
- " }"
- " public void run(){"
- " int cnt=0;"
- " try{"
- " while (true){"
- " Socket s = sock.accept();"
- " parent.addOutStreamToHashmap(cnt, s.getOutputStream());"
- " (new ServerRxThread(cnt, port, s)).start();"
- " cnt++;"
- " }"
- " }catch (IOException e){"
- " System.err.println(\"Server Accept: \" + e.toString());"
- " }"
- " }"
- "}"
- " "
- }
- usercode2 {
- "ServerSocket socket = null;"
- "InputStream in = null;"
- "OutputStream out = null;"
- "Hashtable<Integer,OutputStream> outStreams = new Hashtable<Integer,OutputStream>();"
- ""
- "synchronized protected void addOutStreamToHashmap(int cnt, OutputStream out){"
- " outStreams.put(cnt,out);"
- "}"
- ""
- }
+ usercode1 '''
+ import java.net.ServerSocket;
+ import java.net.Socket;
+ import java.io.*;
+ import java.util.*;
+
+ class ServerRxThread extends Thread{
+ private int connectionId;
+ private Socket sock;
+ PTcpPayloadPort port;
+
+ public ServerRxThread (int connectionId, PTcpPayloadPort port, Socket sock){
+ this.sock = sock;
+ this.connectionId = connectionId;
+ this.port = port;
+ }
+
+ public void run(){
+ try{
+ InputStream in = sock.getInputStream();
+ DTcpPayload d = new DTcpPayload();
+ d.setConnectionId(connectionId);
+ int c;
+ while ((c=in.read(d.getData()))!=-1){
+ d.setLength(c);
+ port.receive(d);
+ }
+ }
+ catch (IOException e){
+ System.err.println("ServerRx: " + e.toString());
+ }
+ }
+ }
+
+ class ServerAcceptThread extends Thread{
+ private ServerSocket sock;
+ private PTcpPayloadPort port;
+ private ATcpServer parent;
+ public ServerAcceptThread (PTcpPayloadPort port, ServerSocket sock, ATcpServer parent){
+ this.sock = sock;
+ this.port = port;
+ this.parent = parent;
+ }
+ public void run(){
+ int cnt=0;
+ try{
+ while (true){
+ Socket s = sock.accept();
+ parent.addOutStreamToHashmap(cnt, s.getOutputStream());
+ (new ServerRxThread(cnt, port, s)).start();
+ cnt++;
+ }
+ }
+ catch (IOException e){
+ System.err.println("Server Accept: " + e.toString());
+ }
+ }
+ }
+ '''
+ usercode2 '''
+ ServerSocket socket = null;
+ InputStream in = null;
+ OutputStream out = null;
+ Hashtable<Integer,OutputStream> outStreams = new Hashtable<Integer,OutputStream>();
+
+ synchronized protected void addOutStreamToHashmap(int cnt, OutputStream out){
+ outStreams.put(cnt,out);
+ }
+ '''
external Port ControlPort
external Port PayloadPort
Attribute lastError: int32
Attribute payloadPortReplocation: int32
}
Behavior {
- Operation stopUser() {
- "try{"
- "if(socket != null){"
- "socket.close();"
- "}"
- "}catch(IOException e){"
- "System.err.println(e.toString());}"
- }
+ Operation stopUser() '''
+ try{
+ if (socket != null){
+ socket.close();
+ }
+ }
+ catch (IOException e){
+ System.err.println(e.toString());
+ }'''
StateMachine {
Transition init: initial -> closed {
}
@@ -99,60 +99,56 @@ RoomModel room.basic.service.tcp {
triggers {
<open: ControlPort>
}
- action {
- "lastError=0;"
- "try{"
- "socket = new ServerSocket(data.TcpPort);"
- "(new ServerAcceptThread(PayloadPort, socket, this)).start();"
- "}catch(IOException e){"
- "System.err.println(e.toString());"
- "lastError=1;"
- "}"
- }
+ action '''
+ lastError=0;
+ try{
+ socket = new ServerSocket(transitionData.TcpPort);
+ (new ServerAcceptThread(PayloadPort, socket, this)).start();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ lastError=1;
+ }'''
}
Transition tr1: opened -> closed {
triggers {
<close: ControlPort>
}
- action {
- "try{"
- "\tif(socket!=null){"
- "\t\tsocket.close();"
- "\t\t}"
- "\t}catch(IOException e){"
- "\tSystem.err.println(e.toString());"
- "}"
- }
+ action '''
+ try{
+ if(socket!=null){
+ socket.close();
+ }
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }'''
}
Transition tr2: cp cp0 -> opened {
- action {
- "ControlPort.established();"
- }
+ action '''ControlPort.established();'''
}
Transition socketError: cp cp0 -> error {
- cond {
- "lastError!=0"
- }
- action {
- "ControlPort.error();"
- "try{"
- "socket.close();"
- "} catch(IOException e){"
- "System.err.println(e.toString());"
- "}"
- }
+ cond '''lastError!=0'''
+ action '''
+ ControlPort.error();
+ try{
+ socket.close();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }'''
}
Transition tr3: opened -> opened {
triggers {
<send: PayloadPort>
}
- action {
- "try{"
- "outStreams.get(data.getConnectionId()).write(data.getData(),0,data.length);"
- "}catch(IOException e){"
- "System.err.println(e.toString());"
- "}"
- }
+ action '''
+ try{
+ outStreams.get(transitionData.getConnectionId()).write(transitionData.getData(),0,transitionData.length);
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }'''
}
ChoicePoint cp0
State closed
@@ -168,119 +164,110 @@ RoomModel room.basic.service.tcp {
Port PayloadPort: PTcpPayload
}
Structure {
- usercode1 {
- "import java.net.Socket;"
- "import java.io.*;"
-
- " "
- "class ClientRxThread extends Thread{ "
- " private Socket sock;"
- " PTcpPayloadPort port;"
- " public ClientRxThread (PTcpPayloadPort port, Socket sock){"
- " this.sock = sock;"
- " this.port = port;"
- " }"
- " public void run(){"
- " try{"
- " InputStream in = sock.getInputStream();"
- " DTcpPayload d = new DTcpPayload();"
- " d.setConnectionId(0);"
- " int c;"
- " while ((c=in.read(d.getData()))!=-1){"
- " d.setLength(c);"
- " port.receive(d);"
- " }"
- " }catch (IOException e){"
- " System.err.println(\"ClientRx: \" + e.toString());"
- " }"
- " "
- " }"
- "}"
- ""
- }
- usercode2 {
- "Socket socket;"
- "InputStream in;"
- "OutputStream out;"
- }
+ usercode1 '''
+ import java.net.Socket;
+ import java.io.*;
+
+ class ClientRxThread extends Thread{
+ private Socket sock;
+ PTcpPayloadPort port;
+ public ClientRxThread (PTcpPayloadPort port, Socket sock){
+ this.sock = sock;
+ this.port = port;
+ }
+ public void run(){
+ try{
+ InputStream in = sock.getInputStream();
+ DTcpPayload d = new DTcpPayload();
+ d.setConnectionId(0);
+ int c;
+ while ((c=in.read(d.getData()))!=-1){
+ d.setLength(c);
+ port.receive(d);
+ }
+ }
+ catch (IOException e){
+ System.err.println("ClientRx: " + e.toString());
+ }
+
+ }
+ }
+ '''
+ usercode2 '''
+ Socket socket;
+ InputStream in;
+ OutputStream out;'''
external Port ControlPort
external Port PayloadPort
Attribute lastError: int32
}
Behavior {
- Operation stopUser() {
- "try{"
- "if(socket != null){"
- "socket.close();"
- "}"
- "}catch(IOException e){"
- "System.err.println(e.toString());}"
- }
+ Operation stopUser() '''
+ try{
+ if(socket != null){
+ socket.close();
+ }
+ }catch(IOException e){
+ System.err.println(e.toString());}'''
StateMachine {
Transition init: initial -> closed {
- action {
- "System.out.println(\"Client Init !\");"
- }
+ action '''System.out.println("Client Init !");'''
}
Transition tr0: closed -> cp cp0 {
triggers {
<open: ControlPort>
}
- action {
- "lastError=0;"
- "try{"
- "socket = new Socket(data.IPAddr,data.TcpPort);"
- "(new ClientRxThread(PayloadPort, socket)).start();"
- "out = socket.getOutputStream();"
- "}catch(IOException e){"
- "System.err.println(e.toString());"
- "lastError=1;"
- "}"
- }
+ action '''
+ lastError=0;
+ try{
+ socket = new Socket(transitionData.IPAddr,transitionData.TcpPort);
+ (new ClientRxThread(PayloadPort, socket)).start();
+ out = socket.getOutputStream();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ lastError=1;
+ }'''
}
Transition tr1: opened -> closed {
triggers {
<close: ControlPort>
}
- action {
- "try{"
- "\tif (socket!=null){"
- "\t\tsocket.close();"
- "\t}"
- "} catch (IOException e){"
- "System.err.println(e.toString());"
- "}"
- }
+ action '''
+ try{
+ if (socket!=null){
+ socket.close();
+ }
+ }
+ catch (IOException e){
+ System.err.println(e.toString());
+ }'''
}
Transition tr2: cp cp0 -> opened {
- action {
- "ControlPort.established();"
- }
+ action '''ControlPort.established();'''
}
Transition socketError: cp cp0 -> error {
- cond {
- "lastError!=0"
- }
- action {
- "ControlPort.error();"
- "try{"
- "socket.close();"
- "} catch(IOException e){"
- "System.err.println(e.toString());"
- "}"
- }
+ cond '''lastError!=0'''
+ action '''
+ ControlPort.error();
+ try{
+ socket.close();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }'''
}
Transition tr3: opened -> opened {
triggers {
<send: PayloadPort>
}
- action {
- "try{"
- "\tout.write(data.getData(),0,data.length);"
- "\t}catch(IOException e){"
- "\t\tSystem.err.println(e.toString());"
- "\t}"
- }
+ action '''
+ try{
+ out.write(transitionData.getData(),0,transitionData.length);
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }'''
}
ChoicePoint cp0
State closed
@@ -292,7 +279,7 @@ RoomModel room.basic.service.tcp {
ProtocolClass PTcpControl {
incoming {
- Message open(data: DTcpControl)
+ Message open(DTcpControl)
Message close()
}
outgoing {
@@ -303,10 +290,10 @@ RoomModel room.basic.service.tcp {
ProtocolClass PTcpPayload {
incoming {
- Message send(data: DTcpPayload)
+ Message send(DTcpPayload)
}
outgoing {
- Message receive(data: DTcpPayload)
+ Message receive(DTcpPayload)
}
}
@@ -318,7 +305,6 @@ RoomModel room.basic.service.tcp {
DataClass DTcpPayload {
Attribute connectionId: int32
Attribute length: int32
- Attribute data [ 1000 ]: int8
+ Attribute data [1000]: int8
}
-
} \ No newline at end of file
diff --git a/runtime/org.eclipse.etrice.modellib.java/model/TimingService.room b/runtime/org.eclipse.etrice.modellib.java/model/TimingService.room
index ed6dad1ae..1361e4412 100644
--- a/runtime/org.eclipse.etrice.modellib.java/model/TimingService.room
+++ b/runtime/org.eclipse.etrice.modellib.java/model/TimingService.room
@@ -7,200 +7,170 @@ RoomModel room.basic.service.timing {
SPP timer: PTimer
}
Structure {
- usercode1 {
- "import java.util.Timer;"
- }
- usercode2 {
- "private Timer timerService = null;"
- "private int taskCount = 0;"
- "private static final int PURGE_LIMIT = 1000;"
- }
+ usercode1 '''import java.util.Timer;'''
+ usercode2 '''
+ private Timer timerService = null;
+ private int taskCount = 0;
+ private static final int PURGE_LIMIT = 1000;'''
ServiceImplementation of timer
}
Behavior {
- Operation stop() {
- "System.out.println(toString() + \"::stop()\");"
- "timerService.cancel();"
- "timerService = null;"
- }
+ Operation stop() '''
+ System.out.println(toString() + "::stop()");
+ timerService.cancel();
+ timerService = null;'''
StateMachine {
Transition tr0: initial -> Operational {
- action {
- "timerService = new Timer();"
- }
+ action '''timerService = new Timer();'''
}
Transition tr1: Operational -> Operational {
triggers {
<internalStartTimer: timer>
}
- action {
- "// start timer"
- "taskCount++;"
- "if (taskCount>PURGE_LIMIT) timerService.purge();"
- "int t = td.getTime();"
- "timerService.scheduleAtFixedRate(((PTimerPort)ifitem).getTask(),t,t);"
- }
+ action '''
+ // start timer
+ taskCount++;
+ if (taskCount>PURGE_LIMIT) timerService.purge();
+ int t = transitionData.getTime();
+ timerService.scheduleAtFixedRate(((PTimerPort)ifitem).getTask(),t,t);'''
}
Transition tr3: Operational -> Operational {
triggers {
<internalStartTimeout: timer>
}
- action {
- "// start timeout"
- "taskCount++;"
- "if (taskCount>PURGE_LIMIT) timerService.purge();"
- "timerService.schedule(((PTimerPort)ifitem).getTask(), ((TimerData)td).getTime());"
- }
+ action '''
+ // start timeout
+ taskCount++;
+ if (taskCount>PURGE_LIMIT) timerService.purge();
+ timerService.schedule(((PTimerPort)ifitem).getTask(), transitionData.getTime());'''
}
Transition tr4: Operational -> Operational {
triggers {
<kill: timer>
}
- action {
- "// nothing to do to kill timer (handled by timer)"
- }
+ action '''// nothing to do to kill timer (handled by timer)'''
}
State Operational {
- entry {
- "// prepare"
- }
+ entry '''// prepare'''
}
}
}
}
ProtocolClass PTimer {
- usercode1 {
- "import java.util.TimerTask;"
- "import org.eclipse.etrice.runtime.java.messaging.RTServices;"
- }
- usercode2 {
- "static protected class FireTimeoutTask extends TimerTask {"
- " "
- " private int time;"
- " private int id;"
- " private boolean periodic;"
- " private PTimerPort port;"
- " "
- " public FireTimeoutTask(int time, int id, boolean periodic, PTimerPort port) {"
- " this.time = time;"
- " this.id = id;"
- " this.periodic = periodic;"
- " this.port = port;"
- " }"
- " "
- " @Override"
- " public void run() {"
- " TimerData td = new TimerData(0,id);"
- " if (periodic)"
- " port.internalTimer(td);"
- " else"
- " port.internalTimeout(td);"
- " }"
- " "
- " public int getTime() {"
- " return time;"
- " }"
- " "
- " public int getId() {"
- " return id;"
- " }"
- "}"
- ""
- }
+ usercode1 '''
+ import java.util.TimerTask;
+ import org.eclipse.etrice.runtime.java.messaging.RTServices;'''
+ usercode2 '''
+ static protected class FireTimeoutTask extends TimerTask {
+
+ private int time;
+ private int id;
+ private boolean periodic;
+ private PTimerPort port;
+
+ public FireTimeoutTask(int time, int id, boolean periodic, PTimerPort port) {
+ this.time = time;
+ this.id = id;
+ this.periodic = periodic;
+ this.port = port;
+ }
+
+ @Override
+ public void run() {
+ TimerData td = new TimerData(0,id);
+ if (periodic)
+ port.internalTimer(td);
+ else
+ port.internalTimeout(td);
+ }
+
+ public int getTime() {
+ return time;
+ }
+
+ public int getId() {
+ return id;
+ }
+ }
+ '''
incoming {
Message kill()
- private Message internalStartTimer(td: TimerData)
- private Message internalStartTimeout(td: TimerData)
+ private Message internalStartTimer(TimerData)
+ private Message internalStartTimeout(TimerData)
}
outgoing {
Message timeout()
- private Message internalTimer(td: TimerData)
- private Message internalTimeout(td: TimerData)
+ private Message internalTimer(TimerData)
+ private Message internalTimeout(TimerData)
}
regular PortClass
{
- usercode {
- "private FireTimeoutTask task = null;"
- "public TimerTask getTask() { return task; }"
- }
- handle
- incoming internalStartTimer {
- "EventWithDataMessage dataMsg = (EventWithDataMessage) msg;"
- "TimerData td = (TimerData)dataMsg.getData();"
- "task = new FireTimeoutTask(td.time, td.id, true, this);"
- "getActor().receiveEvent(this, IN_internalStartTimer, td);"
- }
- handle
- incoming internalStartTimeout {
- "EventWithDataMessage dataMsg = (EventWithDataMessage) msg;"
- "TimerData td = (TimerData)dataMsg.getData();"
- "task = new FireTimeoutTask(td.time, td.id, false, this);"
- "getActor().receiveEvent(this, IN_internalStartTimeout, td);"
- }
- handle
- incoming kill {
- "//regular PortClass handle kill"
- "EventWithDataMessage dataMsg = (EventWithDataMessage) msg;"
- "TimerData td = (TimerData)dataMsg.getData();"
- "if (task!=null && task.getId()==td.getId()) {"
- " task.cancel();"
- "}"
- }
+ usercode '''
+ private FireTimeoutTask task = null;
+ public TimerTask getTask() { return task; }'''
+ handle incoming internalStartTimer '''
+ EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
+ TimerData transitionData = (TimerData)dataMsg.getData();
+ task = new FireTimeoutTask(transitionData.time, transitionData.id, true, this);
+ getActor().receiveEvent(this, IN_internalStartTimer, transitionData);'''
+ handle incoming internalStartTimeout '''
+ EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
+ TimerData transitionData = (TimerData)dataMsg.getData();
+ task = new FireTimeoutTask(transitionData.time, transitionData.id, false, this);
+ getActor().receiveEvent(this, IN_internalStartTimeout, transitionData);'''
+ handle incoming kill '''
+ //regular PortClass handle kill
+ EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
+ TimerData td = (TimerData)dataMsg.getData();
+ if (task!=null && task.getId()==td.getId()) {
+ task.cancel();
+ }'''
}
conjugated PortClass
{
- usercode {
- "private int currentId = 0;"
- "private boolean active = false;"
- }
- handle
- outgoing internalTimer {
- "//conjugated PortClass handle timer"
- "EventWithDataMessage dataMsg = (EventWithDataMessage) msg;"
- "TimerData td = (TimerData) dataMsg.getData();"
- "if (active && td.getId()==currentId) {"
- " getActor().receiveEvent(this, OUT_timeout, null);"
- "}"
- }
- handle
- outgoing internalTimeout {
- "//conjugated PortClass handle timeout"
- "EventWithDataMessage dataMsg = (EventWithDataMessage) msg;"
- "TimerData td = (TimerData) dataMsg.getData();"
- "if (active && td.getId()==currentId) {"
- " active = false;"
- " getActor().receiveEvent(this, OUT_timeout, null);"
- "}"
- }
- handle
- incoming kill {
- "//conjugated PortClass kill"
- "if (active) {"
- " active = false;"
- " TimerData td = new TimerData();"
- " td.setId(currentId);"
- " getPeerMsgReceiver().receive("
- " new EventWithDataMessage(getPeerAddress(), IN_kill, td));"
- "}"
- }
- Operation startTimer(time_ms: int32) sends internalStartTimer {
- "if (active) return;"
- " active = true;"
- ""
- "if (RTServices.getInstance().getSubSystem().hasGeneratedMSCInstrumentation())"
- " DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimer]);"
- "getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimer, new TimerData(time_ms,++currentId)));"
- ""
- }
- Operation startTimeout(time_ms: int32) sends internalStartTimeout {
- "if (active) return;"
- " active = true;"
- ""
- "if (RTServices.getInstance().getSubSystem().hasGeneratedMSCInstrumentation())"
- " DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimeout]);"
- "getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimeout, new TimerData(time_ms,++currentId)));"
- }
+ usercode '''
+ private int currentId = 0;
+ private boolean active = false;'''
+ handle outgoing internalTimer '''
+ //conjugated PortClass handle timer
+ EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
+ TimerData transitionData = (TimerData) dataMsg.getData();
+ if (active && transitionData.getId()==currentId) {
+ getActor().receiveEvent(this, OUT_timeout, null);
+ }'''
+ handle outgoing internalTimeout '''
+ //conjugated PortClass handle timeout
+ EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
+ TimerData transitionData = (TimerData) dataMsg.getData();
+ if (active && transitionData.getId()==currentId) {
+ active = false;
+ getActor().receiveEvent(this, OUT_timeout, null);
+ }'''
+ handle incoming kill '''
+ //conjugated PortClass kill
+ if (active) {
+ active = false;
+ TimerData td = new TimerData();
+ td.setId(currentId);
+ getPeerMsgReceiver().receive(
+ new EventWithDataMessage(getPeerAddress(), IN_kill, td));
+ }'''
+ Operation startTimer(time_ms: int32) sends internalStartTimer '''
+ if (active) return;
+ active = true;
+
+ if (RTServices.getInstance().getSubSystem().hasGeneratedMSCInstrumentation())
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimer]);
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimer, new TimerData(time_ms,++currentId)));
+ '''
+ Operation startTimeout(time_ms: int32) sends internalStartTimeout '''
+ if (active) return;
+ active = true;
+
+ if (RTServices.getInstance().getSubSystem().hasGeneratedMSCInstrumentation())
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimeout]);
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimeout, new TimerData(time_ms,++currentId)));'''
}
}
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt b/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt
new file mode 100644
index 000000000..1dc2b35ab
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/readme.txt
@@ -0,0 +1,4 @@
+This directory is an eTrice code generation target.
+It will be erased every time the generator is executed.
+
+DO NOT PLACE OTHER FILES HERE!
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java
index 427ed97bb..0690a7f6e 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java
@@ -124,10 +124,10 @@ public class ALogService extends ActorClassBase {
/* Entry and Exit Codes */
/* Action Codes */
- protected void action_TRANS_open_FROM_closed_TO_opened_BY_openlog(InterfaceItemBase ifitem, String fileName) {
+ protected void action_TRANS_open_FROM_closed_TO_opened_BY_openlog(InterfaceItemBase ifitem, String transitionData) {
Date d=new Date(tStart);
try{
- file=new FileOutputStream(fileName);
+ file=new FileOutputStream(transitionData);
p=new PrintStream(file);
p.println("Log opened at "+ d.toString());
p.println("--------------------------------------------------");
@@ -140,12 +140,12 @@ public class ALogService extends ActorClassBase {
p.close();
p=null;
}
- protected void action_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1(InterfaceItemBase ifitem, InternalLogData data) {
- p.println("Timestamp: " + Long.toString(data.timeStamp-tStart) + "ms");
- p.println("SenderInstance: "+ data.sender);
- p.println("UserString: " + data.userString);
+ protected void action_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1(InterfaceItemBase ifitem, InternalLogData transitionData) {
+ p.println("Timestamp: " + Long.toString(transitionData.timeStamp-tStart) + "ms");
+ p.println("SenderInstance: "+ transitionData.sender);
+ p.println("UserString: " + transitionData.userString);
p.println("--------------------------------------------------");
- System.out.printf(data.userString);
+ System.out.printf(transitionData.userString);
}
/* State Switch Methods */
@@ -188,8 +188,8 @@ public class ALogService extends ActorClassBase {
}
case ALogService.CHAIN_TRANS_open_FROM_closed_TO_opened_BY_openlog:
{
- String fileName = (String) generic_data__et;
- action_TRANS_open_FROM_closed_TO_opened_BY_openlog(ifitem, fileName);
+ String transitionData = (String) generic_data__et;
+ action_TRANS_open_FROM_closed_TO_opened_BY_openlog(ifitem, transitionData);
return STATE_opened;
}
case ALogService.CHAIN_TRANS_tr0_FROM_opened_TO_closed_BY_closelog:
@@ -199,8 +199,8 @@ public class ALogService extends ActorClassBase {
}
case ALogService.CHAIN_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1:
{
- InternalLogData data = (InternalLogData) generic_data__et;
- action_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1(ifitem, data);
+ InternalLogData transitionData = (InternalLogData) generic_data__et;
+ action_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1(ifitem, transitionData);
return STATE_opened;
}
default:
@@ -253,41 +253,41 @@ public class ALogService extends ActorClassBase {
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState()) {
- case STATE_closed:
- switch(trigger__et) {
- case TRIG_log__open:
- {
- chain__et = ALogService.CHAIN_TRANS_open_FROM_closed_TO_opened_BY_openlog;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_opened:
- switch(trigger__et) {
- case TRIG_log__close:
- {
- chain__et = ALogService.CHAIN_TRANS_tr0_FROM_opened_TO_closed_BY_closelog;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_log__internalLog:
- {
- chain__et = ALogService.CHAIN_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
+ case STATE_closed:
+ switch(trigger__et) {
+ case TRIG_log__open:
+ {
+ chain__et = ALogService.CHAIN_TRANS_open_FROM_closed_TO_opened_BY_openlog;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_opened:
+ switch(trigger__et) {
+ case TRIG_log__close:
+ {
+ chain__et = ALogService.CHAIN_TRANS_tr0_FROM_opened_TO_closed_BY_closelog;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_log__internalLog:
+ {
+ chain__et = ALogService.CHAIN_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java
index 6939ebcad..ed23fe20e 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java
@@ -153,20 +153,20 @@ public class Log {
}
// sent messages
- public void open(String fileName) {
+ public void open(String transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_open]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, fileName));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, transitionData));
}
public void close() {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_close]);
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_close));
}
- private void internalLog(InternalLogData data) {
+ private void internalLog(InternalLogData transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalLog]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, data.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, transitionData.deepCopy()));
}
public void internalLog(String userString, String sender, long timeStamp) {
internalLog(new InternalLogData(userString, sender, timeStamp));
@@ -197,9 +197,9 @@ public class Log {
}
// incoming messages
- public void open(String fileName){
+ public void open(String transitionData){
for (InterfaceItemBase item : getItems()) {
- ((LogConjPort)item).open( fileName);
+ ((LogConjPort)item).open( transitionData);
}
}
public void close(){
@@ -207,9 +207,9 @@ public class Log {
((LogConjPort)item).close();
}
}
- private void internalLog(InternalLogData data){
+ private void internalLog(InternalLogData transitionData){
for (InterfaceItemBase item : getItems()) {
- ((LogConjPort)item).internalLog( data);
+ ((LogConjPort)item).internalLog( transitionData);
}
}
}
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java
index 212e2e702..9c3c2bb5e 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java
@@ -30,7 +30,8 @@ class ClientRxThread extends Thread{
d.setLength(c);
port.receive(d);
}
- }catch (IOException e){
+ }
+ catch (IOException e){
System.err.println("ClientRx: " + e.toString());
}
@@ -170,15 +171,16 @@ public class ATcpClient extends ActorClassBase {
protected void action_TRANS_INITIAL_TO__closed() {
System.out.println("Client Init !");
}
- protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl data) {
+ protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl transitionData) {
lastError=0;
try{
- socket = new Socket(data.IPAddr,data.TcpPort);
- (new ClientRxThread(PayloadPort, socket)).start();
- out = socket.getOutputStream();
- }catch(IOException e){
- System.err.println(e.toString());
- lastError=1;
+ socket = new Socket(transitionData.IPAddr,transitionData.TcpPort);
+ (new ClientRxThread(PayloadPort, socket)).start();
+ out = socket.getOutputStream();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ lastError=1;
}
}
protected void action_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort(InterfaceItemBase ifitem) {
@@ -186,27 +188,30 @@ public class ATcpClient extends ActorClassBase {
if (socket!=null){
socket.close();
}
- } catch (IOException e){
- System.err.println(e.toString());
+ }
+ catch (IOException e){
+ System.err.println(e.toString());
}
}
- protected void action_TRANS_tr2_FROM_cp0_TO_opened(InterfaceItemBase ifitem, DTcpControl data) {
+ protected void action_TRANS_tr2_FROM_cp0_TO_opened(InterfaceItemBase ifitem, DTcpControl transitionData) {
ControlPort.established();
}
- protected void action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(InterfaceItemBase ifitem, DTcpControl data) {
+ protected void action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(InterfaceItemBase ifitem, DTcpControl transitionData) {
ControlPort.error();
try{
- socket.close();
- } catch(IOException e){
- System.err.println(e.toString());
+ socket.close();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
}
}
- protected void action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(InterfaceItemBase ifitem, DTcpPayload data) {
+ protected void action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(InterfaceItemBase ifitem, DTcpPayload transitionData) {
try{
- out.write(data.getData(),0,data.length);
- }catch(IOException e){
- System.err.println(e.toString());
- }
+ out.write(transitionData.getData(),0,transitionData.length);
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }
}
/* State Switch Methods */
@@ -223,14 +228,14 @@ public class ATcpClient extends ActorClassBase {
this.history[STATE_TOP] = STATE_closed;
current__et = STATE_TOP;
break;
- case STATE_opened:
- this.history[STATE_TOP] = STATE_opened;
- current__et = STATE_TOP;
- break;
case STATE_error:
this.history[STATE_TOP] = STATE_error;
current__et = STATE_TOP;
break;
+ case STATE_opened:
+ this.history[STATE_TOP] = STATE_opened;
+ current__et = STATE_TOP;
+ break;
default:
/* should not occur */
break;
@@ -254,13 +259,13 @@ public class ATcpClient extends ActorClassBase {
}
case ATcpClient.CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort:
{
- DTcpControl data = (DTcpControl) generic_data__et;
- action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(ifitem, data);
+ DTcpControl transitionData = (DTcpControl) generic_data__et;
+ action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(ifitem, transitionData);
if (lastError!=0) {
- action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(ifitem, data);
+ action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(ifitem, transitionData);
return STATE_error;}
else {
- action_TRANS_tr2_FROM_cp0_TO_opened(ifitem, data);
+ action_TRANS_tr2_FROM_cp0_TO_opened(ifitem, transitionData);
return STATE_opened;}
}
case ATcpClient.CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort:
@@ -270,8 +275,8 @@ public class ATcpClient extends ActorClassBase {
}
case ATcpClient.CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3:
{
- DTcpPayload data = (DTcpPayload) generic_data__et;
- action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(ifitem, data);
+ DTcpPayload transitionData = (DTcpPayload) generic_data__et;
+ action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(ifitem, transitionData);
return STATE_opened;
}
default:
@@ -295,12 +300,12 @@ public class ATcpClient extends ActorClassBase {
case STATE_closed:
/* in leaf state: return state id */
return STATE_closed;
- case STATE_opened:
- /* in leaf state: return state id */
- return STATE_opened;
case STATE_error:
/* in leaf state: return state id */
return STATE_error;
+ case STATE_opened:
+ /* in leaf state: return state id */
+ return STATE_opened;
case STATE_TOP:
state__et = this.history[STATE_TOP];
break;
@@ -327,43 +332,43 @@ public class ATcpClient extends ActorClassBase {
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState()) {
- case STATE_closed:
- switch(trigger__et) {
- case TRIG_ControlPort__open:
- {
- chain__et = ATcpClient.CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_opened:
- switch(trigger__et) {
- case TRIG_ControlPort__close:
- {
- chain__et = ATcpClient.CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_PayloadPort__send:
- {
- chain__et = ATcpClient.CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_error:
- break;
- default:
- /* should not occur */
- break;
+ case STATE_closed:
+ switch(trigger__et) {
+ case TRIG_ControlPort__open:
+ {
+ chain__et = ATcpClient.CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_error:
+ break;
+ case STATE_opened:
+ switch(trigger__et) {
+ case TRIG_ControlPort__close:
+ {
+ chain__et = ATcpClient.CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_PayloadPort__send:
+ {
+ chain__et = ATcpClient.CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java
index a5f807a7b..599fb59c3 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java
@@ -36,7 +36,8 @@ class ServerRxThread extends Thread{
d.setLength(c);
port.receive(d);
}
- }catch (IOException e){
+ }
+ catch (IOException e){
System.err.println("ServerRx: " + e.toString());
}
}
@@ -60,12 +61,13 @@ class ServerAcceptThread extends Thread{
(new ServerRxThread(cnt, port, s)).start();
cnt++;
}
- }catch (IOException e){
+ }
+ catch (IOException e){
System.err.println("Server Accept: " + e.toString());
}
}
}
-
+
/*--------------------- end user code ---------------------*/
@@ -104,11 +106,13 @@ public class ATcpServer extends ActorClassBase {
/*--------------------- operations ---------------------*/
public void stopUser() {
try{
- if(socket != null){
- socket.close();
+ if (socket != null){
+ socket.close();
+ }
+ }
+ catch (IOException e){
+ System.err.println(e.toString());
}
- }catch(IOException e){
- System.err.println(e.toString());}
}
@@ -210,41 +214,45 @@ public class ATcpServer extends ActorClassBase {
/* Entry and Exit Codes */
/* Action Codes */
- protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl data) {
+ protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl transitionData) {
lastError=0;
try{
- socket = new ServerSocket(data.TcpPort);
- (new ServerAcceptThread(PayloadPort, socket, this)).start();
- }catch(IOException e){
- System.err.println(e.toString());
- lastError=1;
+ socket = new ServerSocket(transitionData.TcpPort);
+ (new ServerAcceptThread(PayloadPort, socket, this)).start();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ lastError=1;
}
}
protected void action_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort(InterfaceItemBase ifitem) {
try{
if(socket!=null){
socket.close();
- }
- }catch(IOException e){
+ }
+ }
+ catch(IOException e){
System.err.println(e.toString());
}
}
- protected void action_TRANS_tr2_FROM_cp0_TO_opened(InterfaceItemBase ifitem, DTcpControl data) {
+ protected void action_TRANS_tr2_FROM_cp0_TO_opened(InterfaceItemBase ifitem, DTcpControl transitionData) {
ControlPort.established();
}
- protected void action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(InterfaceItemBase ifitem, DTcpControl data) {
+ protected void action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(InterfaceItemBase ifitem, DTcpControl transitionData) {
ControlPort.error();
try{
- socket.close();
- } catch(IOException e){
- System.err.println(e.toString());
+ socket.close();
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
}
}
- protected void action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(InterfaceItemBase ifitem, DTcpPayload data) {
+ protected void action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(InterfaceItemBase ifitem, DTcpPayload transitionData) {
try{
- outStreams.get(data.getConnectionId()).write(data.getData(),0,data.length);
- }catch(IOException e){
- System.err.println(e.toString());
+ outStreams.get(transitionData.getConnectionId()).write(transitionData.getData(),0,transitionData.length);
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
}
}
@@ -262,14 +270,14 @@ public class ATcpServer extends ActorClassBase {
this.history[STATE_TOP] = STATE_closed;
current__et = STATE_TOP;
break;
- case STATE_opened:
- this.history[STATE_TOP] = STATE_opened;
- current__et = STATE_TOP;
- break;
case STATE_error:
this.history[STATE_TOP] = STATE_error;
current__et = STATE_TOP;
break;
+ case STATE_opened:
+ this.history[STATE_TOP] = STATE_opened;
+ current__et = STATE_TOP;
+ break;
default:
/* should not occur */
break;
@@ -292,13 +300,13 @@ public class ATcpServer extends ActorClassBase {
}
case ATcpServer.CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort:
{
- DTcpControl data = (DTcpControl) generic_data__et;
- action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(ifitem, data);
+ DTcpControl transitionData = (DTcpControl) generic_data__et;
+ action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(ifitem, transitionData);
if (lastError!=0) {
- action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(ifitem, data);
+ action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(ifitem, transitionData);
return STATE_error;}
else {
- action_TRANS_tr2_FROM_cp0_TO_opened(ifitem, data);
+ action_TRANS_tr2_FROM_cp0_TO_opened(ifitem, transitionData);
return STATE_opened;}
}
case ATcpServer.CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort:
@@ -308,8 +316,8 @@ public class ATcpServer extends ActorClassBase {
}
case ATcpServer.CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3:
{
- DTcpPayload data = (DTcpPayload) generic_data__et;
- action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(ifitem, data);
+ DTcpPayload transitionData = (DTcpPayload) generic_data__et;
+ action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(ifitem, transitionData);
return STATE_opened;
}
default:
@@ -333,12 +341,12 @@ public class ATcpServer extends ActorClassBase {
case STATE_closed:
/* in leaf state: return state id */
return STATE_closed;
- case STATE_opened:
- /* in leaf state: return state id */
- return STATE_opened;
case STATE_error:
/* in leaf state: return state id */
return STATE_error;
+ case STATE_opened:
+ /* in leaf state: return state id */
+ return STATE_opened;
case STATE_TOP:
state__et = this.history[STATE_TOP];
break;
@@ -365,43 +373,43 @@ public class ATcpServer extends ActorClassBase {
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState()) {
- case STATE_closed:
- switch(trigger__et) {
- case TRIG_ControlPort__open:
- {
- chain__et = ATcpServer.CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_opened:
- switch(trigger__et) {
- case TRIG_ControlPort__close:
- {
- chain__et = ATcpServer.CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_PayloadPort__send:
- {
- chain__et = ATcpServer.CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_error:
- break;
- default:
- /* should not occur */
- break;
+ case STATE_closed:
+ switch(trigger__et) {
+ case TRIG_ControlPort__open:
+ {
+ chain__et = ATcpServer.CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ case STATE_error:
+ break;
+ case STATE_opened:
+ switch(trigger__et) {
+ case TRIG_ControlPort__close:
+ {
+ chain__et = ATcpServer.CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_PayloadPort__send:
+ {
+ chain__et = ATcpServer.CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java
index 26ceadc86..1e6bfec72 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java
@@ -148,10 +148,10 @@ public class PTcpControl {
// sent messages
- public void open(DTcpControl data) {
+ public void open(DTcpControl transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_open]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, data.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, transitionData.deepCopy()));
}
public void open(String IPAddr, int TcpPort) {
open(new DTcpControl(IPAddr, TcpPort));
@@ -187,9 +187,9 @@ public class PTcpControl {
}
// incoming messages
- public void open(DTcpControl data){
+ public void open(DTcpControl transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTcpControlConjPort)item).open( data);
+ ((PTcpControlConjPort)item).open( transitionData);
}
}
public void close(){
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java
index 824f95db1..972ab7eed 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java
@@ -65,10 +65,10 @@ public class PTcpPayload {
// sent messages
- public void receive(DTcpPayload data) {
+ public void receive(DTcpPayload transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_receive]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_receive, data.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_receive, transitionData.deepCopy()));
}
public void receive(int connectionId, int length, byte[] data) {
receive(new DTcpPayload(connectionId, length, data));
@@ -99,9 +99,9 @@ public class PTcpPayload {
}
// outgoing messages
- public void receive(DTcpPayload data){
+ public void receive(DTcpPayload transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTcpPayloadPort)item).receive( data);
+ ((PTcpPayloadPort)item).receive( transitionData);
}
}
}
@@ -139,10 +139,10 @@ public class PTcpPayload {
// sent messages
- public void send(DTcpPayload data) {
+ public void send(DTcpPayload transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_send]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_send, data.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_send, transitionData.deepCopy()));
}
public void send(int connectionId, int length, byte[] data) {
send(new DTcpPayload(connectionId, length, data));
@@ -173,9 +173,9 @@ public class PTcpPayload {
}
// incoming messages
- public void send(DTcpPayload data){
+ public void send(DTcpPayload transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTcpPayloadConjPort)item).send( data);
+ ((PTcpPayloadConjPort)item).send( transitionData);
}
}
}
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java
index 89ca94411..879caea9c 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java
@@ -122,18 +122,18 @@ public class ATimingService extends ActorClassBase {
protected void action_TRANS_INITIAL_TO__Operational() {
timerService = new Timer();
}
- protected void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1(InterfaceItemBase ifitem, TimerData td) {
+ protected void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1(InterfaceItemBase ifitem, TimerData transitionData) {
// start timer
taskCount++;
if (taskCount>PURGE_LIMIT) timerService.purge();
- int t = td.getTime();
+ int t = transitionData.getTime();
timerService.scheduleAtFixedRate(((PTimerPort)ifitem).getTask(),t,t);
}
- protected void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3(InterfaceItemBase ifitem, TimerData td) {
+ protected void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3(InterfaceItemBase ifitem, TimerData transitionData) {
// start timeout
taskCount++;
if (taskCount>PURGE_LIMIT) timerService.purge();
- timerService.schedule(((PTimerPort)ifitem).getTask(), ((TimerData)td).getTime());
+ timerService.schedule(((PTimerPort)ifitem).getTask(), transitionData.getTime());
}
protected void action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(InterfaceItemBase ifitem) {
// nothing to do to kill timer (handled by timer)
@@ -176,14 +176,14 @@ public class ATimingService extends ActorClassBase {
}
case ATimingService.CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1:
{
- TimerData td = (TimerData) generic_data__et;
- action_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1(ifitem, td);
+ TimerData transitionData = (TimerData) generic_data__et;
+ action_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1(ifitem, transitionData);
return STATE_Operational;
}
case ATimingService.CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3:
{
- TimerData td = (TimerData) generic_data__et;
- action_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3(ifitem, td);
+ TimerData transitionData = (TimerData) generic_data__et;
+ action_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3(ifitem, transitionData);
return STATE_Operational;
}
case ATimingService.CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4:
@@ -242,34 +242,34 @@ public class ATimingService extends ActorClassBase {
if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
switch (getState()) {
- case STATE_Operational:
- switch(trigger__et) {
- case TRIG_timer__internalStartTimer:
- {
- chain__et = ATimingService.CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__internalStartTimeout:
- {
- chain__et = ATimingService.CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__kill:
- {
- chain__et = ATimingService.CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
+ case STATE_Operational:
+ switch(trigger__et) {
+ case TRIG_timer__internalStartTimeout:
+ {
+ chain__et = ATimingService.CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_timer__internalStartTimer:
+ {
+ chain__et = ATimingService.CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ case TRIG_timer__kill:
+ {
+ chain__et = ATimingService.CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
+ catching_state__et = STATE_TOP;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
+ }
+ break;
+ default:
+ /* should not occur */
+ break;
}
}
if (chain__et != NOT_CAUGHT) {
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java
index 7204d9562..155158ad9 100644
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java
+++ b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java
@@ -107,17 +107,17 @@ public class PTimer {
case IN_internalStartTimer:
{
EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
- TimerData td = (TimerData)dataMsg.getData();
- task = new FireTimeoutTask(td.time, td.id, true, this);
- getActor().receiveEvent(this, IN_internalStartTimer, td);
+ TimerData transitionData = (TimerData)dataMsg.getData();
+ task = new FireTimeoutTask(transitionData.time, transitionData.id, true, this);
+ getActor().receiveEvent(this, IN_internalStartTimer, transitionData);
}
break;
case IN_internalStartTimeout:
{
EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
- TimerData td = (TimerData)dataMsg.getData();
- task = new FireTimeoutTask(td.time, td.id, false, this);
- getActor().receiveEvent(this, IN_internalStartTimeout, td);
+ TimerData transitionData = (TimerData)dataMsg.getData();
+ task = new FireTimeoutTask(transitionData.time, transitionData.id, false, this);
+ getActor().receiveEvent(this, IN_internalStartTimeout, transitionData);
}
break;
case IN_kill:
@@ -149,18 +149,18 @@ public class PTimer {
if (getPeerAddress()!=null)
getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_timeout));
}
- private void internalTimer(TimerData td) {
+ private void internalTimer(TimerData transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_internalTimer]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_internalTimer, td.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_internalTimer, transitionData.deepCopy()));
}
public void internalTimer(int time, int id) {
internalTimer(new TimerData(time, id));
}
- private void internalTimeout(TimerData td) {
+ private void internalTimeout(TimerData transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_internalTimeout]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_internalTimeout, td.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_internalTimeout, transitionData.deepCopy()));
}
public void internalTimeout(int time, int id) {
internalTimeout(new TimerData(time, id));
@@ -196,14 +196,14 @@ public class PTimer {
((PTimerPort)item).timeout();
}
}
- private void internalTimer(TimerData td){
+ private void internalTimer(TimerData transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTimerPort)item).internalTimer( td);
+ ((PTimerPort)item).internalTimer( transitionData);
}
}
- private void internalTimeout(TimerData td){
+ private void internalTimeout(TimerData transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTimerPort)item).internalTimeout( td);
+ ((PTimerPort)item).internalTimeout( transitionData);
}
}
}
@@ -242,8 +242,8 @@ public class PTimer {
{
//conjugated PortClass handle timer
EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
- TimerData td = (TimerData) dataMsg.getData();
- if (active && td.getId()==currentId) {
+ TimerData transitionData = (TimerData) dataMsg.getData();
+ if (active && transitionData.getId()==currentId) {
getActor().receiveEvent(this, OUT_timeout, null);
}
}
@@ -252,8 +252,8 @@ public class PTimer {
{
//conjugated PortClass handle timeout
EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
- TimerData td = (TimerData) dataMsg.getData();
- if (active && td.getId()==currentId) {
+ TimerData transitionData = (TimerData) dataMsg.getData();
+ if (active && transitionData.getId()==currentId) {
active = false;
getActor().receiveEvent(this, OUT_timeout, null);
}
@@ -299,18 +299,18 @@ public class PTimer {
new EventWithDataMessage(getPeerAddress(), IN_kill, td));
}
}
- private void internalStartTimer(TimerData td) {
+ private void internalStartTimer(TimerData transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimer]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimer, td.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimer, transitionData.deepCopy()));
}
public void internalStartTimer(int time, int id) {
internalStartTimer(new TimerData(time, id));
}
- private void internalStartTimeout(TimerData td) {
+ private void internalStartTimeout(TimerData transitionData) {
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimeout]);
if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimeout, td.deepCopy()));
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimeout, transitionData.deepCopy()));
}
public void internalStartTimeout(int time, int id) {
internalStartTimeout(new TimerData(time, id));
@@ -346,14 +346,14 @@ public class PTimer {
((PTimerConjPort)item).kill();
}
}
- private void internalStartTimer(TimerData td){
+ private void internalStartTimer(TimerData transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTimerConjPort)item).internalStartTimer( td);
+ ((PTimerConjPort)item).internalStartTimer( transitionData);
}
}
- private void internalStartTimeout(TimerData td){
+ private void internalStartTimeout(TimerData transitionData){
for (InterfaceItemBase item : getItems()) {
- ((PTimerConjPort)item).internalStartTimeout( td);
+ ((PTimerConjPort)item).internalStartTimeout( transitionData);
}
}
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
index e701c0544..459fda8f3 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/debugging/etMSCLogger.c
@@ -57,17 +57,20 @@ void etMSCLogger_syncReturn(const char* sourceName, const char* targetName){
void etMSCLogger_asyncOut(const char* sourceName, const char* messageName, const char* targetName){
if (etMSCLogger_fileHandle != NULL) {
etLogger_fprintf(etMSCLogger_fileHandle, "%s >-- %s %s\n", sourceName, targetName, messageName);
+ fflush(etMSCLogger_fileHandle);
}
}
void etMSCLogger_asyncIn(const char* sourceName, const char* messageName, const char* targetName){
if (etMSCLogger_fileHandle != NULL) {
etLogger_fprintf(etMSCLogger_fileHandle, "%s --> %s %s\n", sourceName, targetName, messageName);
+ fflush(etMSCLogger_fileHandle);
}
}
void etMSCLogger_setState(const char* objectName, const char* stateName){
if (etMSCLogger_fileHandle != NULL) {
etLogger_fprintf(etMSCLogger_fileHandle, "%s >>> %s\n", objectName, stateName);
+ fflush(etMSCLogger_fileHandle);
}
}
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
index 77e832b80..603b14c07 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.c
@@ -65,7 +65,6 @@ typedef etFloat32 etUnitFloat;
#endif
#endif
-
/* forward declarations of private functions */
static void expect_equal_int(etInt16 id, const char* message, etInt32 expected, etInt32 actual, const char* file, int line);
/* currently not used
@@ -93,9 +92,9 @@ void etUnit_open(const char* testResultPath, const char* testFileName) {
int i;
if (testResultPath != NULL)
- sprintf(filename, "%s/%s.etu", testResultPath, testFileName);
+ snprintf(filename, sizeof(filename), "%s/%s.etu", testResultPath, testFileName);
else
- sprintf(filename, "%s.etu", testFileName);
+ snprintf(filename, sizeof(filename),"%s.etu", testFileName);
/* init global data */
for (i = 0; i < ETUNIT_ORDER_MAX; ++i)
@@ -198,7 +197,7 @@ void etUnit_testFinished(etInt16 id) {
void expectTrue(etInt16 id, const char* message, etBool condition, const char* file, int line) {
if (condition == ET_FALSE) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: *** EXPECT_TRUE == FALSE", message);
+ snprintf(testresult, sizeof(testresult), "%s: *** EXPECT_TRUE == FALSE", message);
etUnit_handleExpect(id, ET_FALSE, testresult, "TRUE", "FALSE", file, line);
} else {
etUnit_handleExpect(id, ET_TRUE, "", NULL, NULL, file, line);
@@ -208,7 +207,7 @@ void expectTrue(etInt16 id, const char* message, etBool condition, const char* f
void expectFalse(etInt16 id, const char* message, etBool condition, const char* file, int line) {
if (condition == ET_TRUE) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: EXPECT_FALSE == TRUE", message);
+ snprintf(testresult, sizeof(testresult), "%s: EXPECT_FALSE == TRUE", message);
etUnit_handleExpect(id, ET_FALSE, testresult, "FALSE", "TRUE", file, line);
} else {
etUnit_handleExpect(id, ET_TRUE, "", NULL, NULL, file, line);
@@ -243,7 +242,7 @@ void expect_equal_void_ptr(etInt16 id, const char* message, const void* expected
if (expected != actual) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[16], act[16];
- sprintf(testresult, "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual);
+ snprintf(testresult, sizeof(testresult), "%s: expected=%ld, actual=%ld", message, (etUInt32) expected, (etUInt32) actual);
sprintf(exp, "%ld", (etUInt32) expected);
sprintf(act, "%ld", (etUInt32) actual);
etUnit_handleExpect(id, ET_FALSE, testresult, exp, act, file, line);
@@ -255,7 +254,7 @@ void expect_equal_void_ptr(etInt16 id, const char* message, const void* expected
void expectEqualStr(etInt16 id, const char* message, const char* expected, const char* actual, const char* file, int line) {
if (!(expected || actual || strcmp(expected, actual) == 0)) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "%s: expected=%s, actual=%s", message, expected, actual);
+ snprintf(testresult, sizeof(testresult), "%s: expected=%s, actual=%s", message, expected, actual);
etUnit_handleExpect(id, ET_FALSE, testresult, expected, actual, file, line);
} else {
etUnit_handleExpect(id, ET_TRUE, "", NULL, NULL, file, line);
@@ -301,7 +300,7 @@ void expectOrder(etInt16 id, const char* message, etInt16 identifier, const char
if (info->list[info->currentIndex] != identifier) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[16], act[16];
- sprintf(testresult, "EXPECT_ORDER %s: index=%d, expected=%d, actual=%d", message, info->currentIndex, identifier,
+ snprintf(testresult, sizeof(testresult), "EXPECT_ORDER %s: index=%d, expected=%d, actual=%d", message, info->currentIndex, identifier,
info->list[info->currentIndex]);
sprintf(exp, "%d", identifier);
sprintf(act, "%d", info->list[info->currentIndex]);
@@ -312,7 +311,7 @@ void expectOrder(etInt16 id, const char* message, etInt16 identifier, const char
}
} else {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "EXPECT_ORDER: index(%d) is too big in %s", info->currentIndex, message);
+ snprintf(testresult, sizeof(testresult), "EXPECT_ORDER: index(%d) is too big in %s", info->currentIndex, message);
etUnit_handleExpect(id, ET_FALSE, testresult, NULL, NULL, file, line);
etLogger_logInfoF("EXPECT_ORDER: index too big in %s", message);
}
@@ -324,7 +323,7 @@ void expectOrderEnd(etInt16 id, const char* message, etInt16 identifier, const c
expectOrder(id, message, identifier, file, line);
if (info->currentIndex != info->size) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
- sprintf(testresult, "EXPECT_ORDER_END %s: wrong index at the end: expected=%d, actual=%d", message, info->size, info->currentIndex);
+ snprintf(testresult, sizeof(testresult), "EXPECT_ORDER_END %s: wrong index at the end: expected=%d, actual=%d", message, info->size, info->currentIndex);
etUnit_handleExpect(id, ET_FALSE, testresult, NULL, NULL, file, line);
}
}
@@ -339,7 +338,7 @@ static void expect_equal_int(etInt16 id, const char* message, etInt32 expected,
if (expected != actual) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[16], act[16];
- sprintf(testresult, "%s: expected=%ld, actual=%ld", message, expected, actual);
+ snprintf(testresult, sizeof(testresult), "%s: expected=%ld, actual=%ld", message, expected, actual);
sprintf(exp, "%ld", expected);
sprintf(act, "%ld", actual);
etUnit_handleExpect(id, ET_FALSE, testresult, exp, act, file, line);
@@ -372,7 +371,7 @@ static void expect_equal_uint(etInt16 id, const char* message, etUInt32 expected
if (expected != actual) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[16], act[16];
- sprintf(testresult, "%s: expected=%lu, actual=%lu", message, expected, actual);
+ snprintf(testresult, sizeof(testresult), "%s: expected=%lu, actual=%lu", message, expected, actual);
sprintf(exp, "%lu", expected);
sprintf(act, "%lu", actual);
etUnit_handleExpect(id, ET_FALSE, testresult, exp, act, file, line);
@@ -406,7 +405,7 @@ static void expect_equal_float(etInt16 id, const char* message, etUnitFloat expe
if (expected - actual < -precision || expected - actual > precision) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[16], act[16];
- sprintf(testresult, "%s: expected=%f, actual=%f", message, expected, actual);
+ snprintf(testresult, sizeof(testresult), "%s: expected=%f, actual=%f", message, expected, actual);
sprintf(exp, "%f", expected);
sprintf(act, "%f", actual);
etUnit_handleExpect(id, ET_FALSE, testresult, exp, act, file, line);
@@ -419,7 +418,7 @@ static void expect_range_float(etInt16 id, const char* message, etUnitFloat min,
if (actual < min || actual > max) {
char testresult[ETUNIT_FAILURE_TEXT_LEN];
char exp[64], act[16];
- sprintf(testresult, "%s: min=%f, max=%f, actual=%f", message, min, max, actual);
+ snprintf(testresult, sizeof(testresult), "%s: min=%f, max=%f, actual=%f", message, min, max, actual);
if (actual < min) {
sprintf(exp, ">=%f(min)", min);
sprintf(act, "%f", actual);
diff --git a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
index 004f2843f..f427e2d65 100644
--- a/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
+++ b/runtime/org.eclipse.etrice.runtime.c/src/common/etUnit/etUnit.h
@@ -27,7 +27,10 @@ extern "C" {
#define _ETUNIT_H_
#include "etDatatypes.h"
+#include <string.h>
+// compile time evaluated
+#define ETUNIT_FILENAME (strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__))
/**
* opens a file to protocol the test results
@@ -107,43 +110,43 @@ void etUnit_closeAll(etInt16 id);
/**
* calls \ref expectTrue()
*/
-#define EXPECT_TRUE(id, msg, condition) expectTrue(id, msg, condition, __FILE__, __LINE__)
+#define EXPECT_TRUE(id, msg, condition) expectTrue(id, msg, condition, ETUNIT_FILENAME, __LINE__)
/** calls \ref expectFalse() */
-#define EXPECT_FALSE(id, msg, condition) expectFalse(id, msg, condition, __FILE__, __LINE__)
+#define EXPECT_FALSE(id, msg, condition) expectFalse(id, msg, condition, ETUNIT_FILENAME, __LINE__)
/*
* signed integer values
*/
/** calls \ref expectEqualInt8() */
-#define EXPECT_EQUAL_INT8(id, msg, expected, actual) expectEqualInt8(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_INT8(id, msg, expected, actual) expectEqualInt8(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/** calls \ref expectEqualInt16() */
-#define EXPECT_EQUAL_INT16(id, msg, expected, actual) expectEqualInt16(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_INT16(id, msg, expected, actual) expectEqualInt16(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/** calls \ref expectEqualInt32() */
-#define EXPECT_EQUAL_INT32(id, msg, expected, actual) expectEqualInt32(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_INT32(id, msg, expected, actual) expectEqualInt32(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/*
* unsigned integer values
*/
/** calls \ref expectEqualUInt8() */
-#define EXPECT_EQUAL_UINT8(id, msg, expected, actual) expectEqualUInt8(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_UINT8(id, msg, expected, actual) expectEqualUInt8(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/** calls \ref expectEqualUInt16() */
-#define EXPECT_EQUAL_UINT16(id, msg, expected, actual) expectEqualUInt16(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_UINT16(id, msg, expected, actual) expectEqualUInt16(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/** calls \ref expectEqualUInt32() */
-#define EXPECT_EQUAL_UINT32(id, msg, expected, actual) expectEqualUInt32(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_UINT32(id, msg, expected, actual) expectEqualUInt32(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/*
* float values
*/
#ifdef ET_FLOAT32
/** calls \ref expectEqualFloat32() */
-#define EXPECT_EQUAL_FLOAT32(id, msg, expected, actual, precision) expectEqualFloat32(id, msg, expected, actual, precision, __FILE__, __LINE__)
-#define EXPECT_RANGE_FLOAT32(id, msg, min, max, actual) expectRangeFloat32(id, msg, min, max, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_FLOAT32(id, msg, expected, actual, precision) expectEqualFloat32(id, msg, expected, actual, precision, ETUNIT_FILENAME, __LINE__)
+#define EXPECT_RANGE_FLOAT32(id, msg, min, max, actual) expectRangeFloat32(id, msg, min, max, actual, ETUNIT_FILENAME, __LINE__)
#endif
#ifdef ET_FLOAT64
/** calls \ref expectEqualFloat64() */
-#define EXPECT_EQUAL_FLOAT64(id, msg, expected, actual, precision) expectEqualFloat64(id, msg, expected, actual, precision, __FILE__, __LINE__)
-#define EXPECT_RANGE_FLOAT64(id, msg, min, max, actual) expectRangeFloat64(id, msg, min, max, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_FLOAT64(id, msg, expected, actual, precision) expectEqualFloat64(id, msg, expected, actual, precision, ETUNIT_FILENAME, __LINE__)
+#define EXPECT_RANGE_FLOAT64(id, msg, min, max, actual) expectRangeFloat64(id, msg, min, max, actual, ETUNIT_FILENAME, __LINE__)
#endif
@@ -152,26 +155,26 @@ void etUnit_closeAll(etInt16 id);
*/
/** calls \ref expect_equal_void_ptr() */
#define EXPECT_EQUAL_PTR(id, msg, expected, actual) \
- expect_equal_void_ptr(id, msg, (const void*) expected, (const void*) actual, __FILE__, __LINE__)
+ expect_equal_void_ptr(id, msg, (const void*) expected, (const void*) actual, ETUNIT_FILENAME, __LINE__)
/*
* Strings
*/
-#define EXPECT_EQUAL_STR(id, msg, expected, actual) expectEqualStr(id, msg, expected, actual, __FILE__, __LINE__)
+#define EXPECT_EQUAL_STR(id, msg, expected, actual) expectEqualStr(id, msg, expected, actual, ETUNIT_FILENAME, __LINE__)
/*
* more specialized functions
*/
/** calls \ref expectOrderStart() */
#ifdef __cplusplus
-#define EXPECT_ORDER_START(id, list, size) expectOrderStart(id, list.getData(), size, __FILE__, __LINE__)
+#define EXPECT_ORDER_START(id, list, size) expectOrderStart(id, list.getData(), size, ETUNIT_FILENAME, __LINE__)
#else
-#define EXPECT_ORDER_START(id, list, size) expectOrderStart(id, list, size, __FILE__, __LINE__)
+#define EXPECT_ORDER_START(id, list, size) expectOrderStart(id, list, size, ETUNIT_FILENAME, __LINE__)
#endif
/** calls \ref expectOrder() */
-#define EXPECT_ORDER(id, msg, val) expectOrder(id, msg, val, __FILE__, __LINE__)
+#define EXPECT_ORDER(id, msg, val) expectOrder(id, msg, val, ETUNIT_FILENAME, __LINE__)
/** calls \ref expectOrderEnd() */
-#define EXPECT_ORDER_END(id, msg, val) expectOrderEnd(id, msg, val, __FILE__, __LINE__)
+#define EXPECT_ORDER_END(id, msg, val) expectOrderEnd(id, msg, val, ETUNIT_FILENAME, __LINE__)
/*
diff --git a/runtime/org.eclipse.etrice.runtime.java/.classpath b/runtime/org.eclipse.etrice.runtime.java/.classpath
index cf1ee92a9..695d89ba1 100644
--- a/runtime/org.eclipse.etrice.runtime.java/.classpath
+++ b/runtime/org.eclipse.etrice.runtime.java/.classpath
@@ -6,7 +6,11 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
- <classpathentry kind="src" path="src-gen"/>
+ <classpathentry kind="src" path="src-gen">
+ <attributes>
+ <attribute name="ignore_optional_problems" value="true"/>
+ </attributes>
+ </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
diff --git a/runtime/org.eclipse.etrice.runtime.java/build.gradle b/runtime/org.eclipse.etrice.runtime.java/build.gradle
index 643372bff..3a9666e98 100644
--- a/runtime/org.eclipse.etrice.runtime.java/build.gradle
+++ b/runtime/org.eclipse.etrice.runtime.java/build.gradle
@@ -1,5 +1,7 @@
apply plugin: 'java'
+apply from: "$rootDir/gradle/publish.gradle"
+
sourceSets {
main {
java {

Back to the top