Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2018-01-05 21:16:05 +0000
committerHenrik Rentz-Reichert2018-01-08 19:47:48 +0000
commit33e5411e9632baa741e2e93e91922cd40693cfd3 (patch)
tree1814b0a170406345b83937901b928040fd58c6a9 /runtime
parent97db531e8fa6d639abf4ac2bbbb1dbdb5ad79f15 (diff)
downloadorg.eclipse.etrice-33e5411e9632baa741e2e93e91922cd40693cfd3.tar.gz
org.eclipse.etrice-33e5411e9632baa741e2e93e91922cd40693cfd3.tar.xz
org.eclipse.etrice-33e5411e9632baa741e2e93e91922cd40693cfd3.zip
Bug 529445 - [newfsmgen] make old style transition data deprecated
Implementation as suggested in the bug. Change-Id: I6a6f6ea966e4060646427078d82cb2b12eb046b6
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/room/basic/service/tcp/ATcpClient.h2
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.c1
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpServer.h2
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c30
-rw-r--r--runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.h2
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room444
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp30
-rw-r--r--runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.h1
-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/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/room/basic/service/logging/Log.java16
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java35
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java48
-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/PTimer.java52
22 files changed, 1084 insertions, 1224 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 945725c5e..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, transitionData->connectionId, transitionData->length, transitionData->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, transitionData->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, transitionData->IPAddr, transitionData->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, transitionData->length, transitionData->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 95863bd08..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=transitionData/1000;"
- "\tt.nSec=(transitionData%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=transitionData/1000;"
- "\tt.nSec=(transitionData%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/room/basic/service/tcp/ATcpClient.h b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/tcp/ATcpClient.h
index 366a447b0..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
@@ -41,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 3fdc8eda4..484ae1df4 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 */
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 a83b955a0..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
@@ -41,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/timing/ATimingService.c b/runtime/org.eclipse.etrice.modellib.c/src-gen/room/basic/service/timing/ATimingService.c
index 0a7cc630c..983774436 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
@@ -103,30 +103,30 @@ static void action_TRANS_INITIAL_TO__Operational(ATimingService* self) {
}
}
static void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(ATimingService* self, const InterfaceItemBase* ifitem, uint32 transitionData) {
- etTimerControlBlock* timer = getTcb();
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer!= 0){
+ if (transitionDatar!= 0){
t.sec=transitionData/1000;
t.nSec=(transitionData%1000)*1000000L;
- timer->pTime.sec = 0;
- timer->pTime.nSec = 0;
- timer->portIdx=((etReplSubPort*)ifitem)->index;
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime),&t);
- putTcbToUsedList(timer);
+ 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 transitionData) {
- etTimerControlBlock* timer = getTcb();
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer!= 0){
+ if (transitionDatar!= 0){
t.sec=transitionData/1000;
t.nSec=(transitionData%1000)*1000000L;
- timer->pTime = t;
- timer->portIdx=((etReplSubPort*)ifitem)->index;
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime),&t);
- putTcbToUsedList(timer);
+ 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) {
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 6a4b62231..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
@@ -46,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.cpp/model/TimingService.room b/runtime/org.eclipse.etrice.modellib.cpp/model/TimingService.room
index a8f0248ef..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 = transitionData / 1000;"
- "\tt.nSec = (transitionData % 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 = transitionData / 1000;"
- "\tt.nSec = (transitionData % 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/room/basic/service/timing/ATimingService.cpp b/runtime/org.eclipse.etrice.modellib.cpp/src-gen/room/basic/service/timing/ATimingService.cpp
index db590f23b..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
@@ -213,30 +213,30 @@ void ATimingService::action_TRANS_INITIAL_TO__Operational() {
}
}
void ATimingService::action_TRANS_tr1_FROM_Operational_TO_Operational_BY_startTimeouttimer_tr1(const InterfaceItemBase* ifitem, uint32 transitionData) {
- etTimerControlBlock* timer = getTcb();
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer != 0) {
+ if (transitionDatar != 0) {
t.sec = transitionData / 1000;
t.nSec = (transitionData % 1000) * 1000000L;
- timer->pTime.sec = 0;
- timer->pTime.nSec = 0;
- timer->portIdx = ifitem->getIdx();
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime), &t);
- putTcbToUsedList(timer);
+ 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 transitionData) {
- etTimerControlBlock* timer = getTcb();
+ etTimerControlBlock* transitionDatar = getTcb();
etTime t;
- if (timer != 0) {
+ if (transitionDatar != 0) {
t.sec = transitionData / 1000;
t.nSec = (transitionData % 1000) * 1000000L;
- timer->pTime = t;
- timer->portIdx = ifitem->getIdx();
- getTimeFromTarget(&(timer->expTime));
- addTime(&(timer->expTime), &t);
- putTcbToUsedList(timer);
+ 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) {
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 8b75c3ea4..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;
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/model/ALogService.room b/runtime/org.eclipse.etrice.modellib.java/model/ALogService.room
index ec36490f3..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(transitionData);"
- "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(transitionData.timeStamp-tStart) + \"ms\");"
- "p.println(\"SenderInstance: \"+ transitionData.sender);"
- "p.println(\"UserString: \" + transitionData.userString);"
- "p.println(\"--------------------------------------------------\");"
- "System.out.printf(transitionData.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 152035ec0..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(transitionData.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(transitionData.getConnectionId()).write(transitionData.getData(),0,transitionData.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(transitionData.IPAddr,transitionData.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(transitionData.getData(),0,transitionData.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 588654646..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 = transitionData.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(), transitionData.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/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 554c8eabf..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());
}
@@ -173,12 +174,13 @@ public class ATcpClient extends ActorClassBase {
protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl transitionData) {
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;
+ 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,8 +188,9 @@ 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 transitionData) {
@@ -196,17 +199,19 @@ public class ATcpClient extends ActorClassBase {
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 transitionData) {
try{
out.write(transitionData.getData(),0,transitionData.length);
- }catch(IOException e){
- System.err.println(e.toString());
- }
+ }
+ catch(IOException e){
+ System.err.println(e.toString());
+ }
}
/* State Switch Methods */
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 abaae95bb..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());}
}
@@ -213,19 +217,21 @@ public class ATcpServer extends ActorClassBase {
protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl transitionData) {
lastError=0;
try{
- socket = new ServerSocket(transitionData.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());
}
}
@@ -235,16 +241,18 @@ public class ATcpServer extends ActorClassBase {
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 transitionData) {
try{
- outStreams.get(transitionData.getConnectionId()).write(transitionData.getData(),0,transitionData.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());
}
}
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/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);
}
}
}

Back to the top