Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Haug2015-08-17 11:49:33 +0000
committerJuergen Haug2015-08-17 11:49:33 +0000
commit27b02924bc1fed8258b7f6f357a29ee39288f7b4 (patch)
treec3b740c7ea0a884f337980a7c4958605c836dcf0 /runtime
parent0cb48be142ff9b13f146d2a4bf89cf914ea367b1 (diff)
downloadorg.eclipse.etrice-27b02924bc1fed8258b7f6f357a29ee39288f7b4.tar.gz
org.eclipse.etrice-27b02924bc1fed8258b7f6f357a29ee39288f7b4.tar.xz
org.eclipse.etrice-27b02924bc1fed8258b7f6f357a29ee39288f7b4.zip
removed xbase fragment from etmap,etphys and config
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/.gitignore8
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java303
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/InternalLogData.java67
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java217
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java378
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java417
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpControl.java57
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpPayload.java74
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java202
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java183
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java281
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java366
-rw-r--r--runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/TimerData.java56
13 files changed, 6 insertions, 2603 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.java/.gitignore b/runtime/org.eclipse.etrice.modellib.java/.gitignore
index f30d372e8..db5801d65 100644
--- a/runtime/org.eclipse.etrice.modellib.java/.gitignore
+++ b/runtime/org.eclipse.etrice.modellib.java/.gitignore
@@ -1,6 +1,10 @@
bin
-doc-gen
-target
+src-gen/*
!src-gen/readme.txt
src-gen-info/*
!src-gen-info/readme.txt
+doc-gen/*
+!doc-gen/readme.txt
+log/*
+!log/readme.txt
+target
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java
deleted file mode 100644
index c64760366..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/ALogService.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package room.basic.service.logging;
-
-import org.eclipse.etrice.runtime.java.messaging.*;
-import org.eclipse.etrice.runtime.java.modelbase.*;
-import org.eclipse.etrice.runtime.java.debugging.*;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-import room.basic.service.logging.Log.*;
-
-/*--------------------- begin user code ---------------------*/
-import java.io.*;
-import java.util.*;
-/*--------------------- end user code ---------------------*/
-
-
-public class ALogService extends ActorClassBase {
-
- /*--------------------- begin user code ---------------------*/
- FileOutputStream file = null;
- PrintStream p = null;
- static long tStart = System.currentTimeMillis();
- /*--------------------- end user code ---------------------*/
-
- //--------------------- ports
-
- //--------------------- saps
-
- //--------------------- services
- protected LogReplPort log = null;
-
- //--------------------- optional actors
-
- //--------------------- interface item IDs
- public static final int IFITEM_log = 1;
-
- /*--------------------- attributes ---------------------*/
- /*--------------------- operations ---------------------*/
- public void destroyUser() {
- if (p!= null) {
- p.flush();
- p.close();
- p=null;
- }
- }
-
- //--------------------- construction
- public ALogService(IRTObject parent, String name) {
- super(parent, name);
- setClassName("ALogService");
-
- // initialize attributes
-
- // own ports
-
- // own saps
-
- // own service implementations
- log = new LogReplPort(this, "log", IFITEM_log);
-
- // sub actors
-
- // wiring
-
-
-
- }
-
- /* --------------------- attribute setters and getters */
-
-
- //--------------------- port getters
- public LogReplPort getLog (){
- return this.log;
- }
-
- //--------------------- lifecycle functions
- public void stop(){
- stopUser();
- super.stop();
- }
-
- public void destroy() {
- DebuggingService.getInstance().addMessageActorDestroy(this);
- super.destroy();
- }
-
- /* state IDs */
- public static final int STATE_closed = 2;
- public static final int STATE_opened = 3;
- public static final int STATE_MAX = 4;
-
- /* transition chains */
- public static final int CHAIN_TRANS_INITIAL_TO__closed = 1;
- public static final int CHAIN_TRANS_open_FROM_closed_TO_opened_BY_openlog = 2;
- public static final int CHAIN_TRANS_tr0_FROM_opened_TO_closed_BY_closelog = 3;
- public static final int CHAIN_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1 = 4;
-
- /* triggers */
- public static final int POLLING = 0;
- public static final int TRIG_log__open = IFITEM_log + EVT_SHIFT*Log.IN_open;
- public static final int TRIG_log__close = IFITEM_log + EVT_SHIFT*Log.IN_close;
- public static final int TRIG_log__internalLog = IFITEM_log + EVT_SHIFT*Log.IN_internalLog;
-
- // state names
- protected static final String stateStrings[] = {
- "<no state>",
- "<top>",
- "closed",
- "opened"
- };
-
- // history
- protected int history[] = {NO_STATE, NO_STATE, NO_STATE, NO_STATE};
-
- private void setState(int new_state) {
- DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);
- this.state = new_state;
- }
-
- /* Entry and Exit Codes */
-
- /* Action Codes */
- protected void action_TRANS_open_FROM_closed_TO_opened_BY_openlog(InterfaceItemBase ifitem, String fileName) {
- Date d=new Date(tStart);
- try{
- file=new FileOutputStream(fileName);
- p=new PrintStream(file);
- p.println("Log opened at "+ d.toString());
- p.println("--------------------------------------------------");
- } catch (Exception e){
- System.out.println("Log file not opened !");
- }
- }
- protected void action_TRANS_tr0_FROM_opened_TO_closed_BY_closelog(InterfaceItemBase ifitem) {
- p.flush();
- p.close();
- p=null;
- }
- protected void action_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1(InterfaceItemBase ifitem, InternalLogData data) {
- p.println("Timestamp: " + Long.toString(data.timeStamp-tStart) + "ms");
- p.println("SenderInstance: "+ data.sender);
- p.println("UserString: " + data.userString);
- p.println("--------------------------------------------------");
- System.out.printf(data.userString);
- }
-
- /**
- * calls exit codes while exiting from the current state to one of its
- * parent states while remembering the history
- * @param current__et - the current state
- * @param to - the final parent state
- */
- private void exitTo(int current__et, int to) {
- while (current__et!=to) {
- switch (current__et) {
- case STATE_closed:
- this.history[STATE_TOP] = STATE_closed;
- current__et = STATE_TOP;
- break;
- case STATE_opened:
- this.history[STATE_TOP] = STATE_opened;
- current__et = STATE_TOP;
- break;
- default:
- /* should not occur */
- break;
- }
- }
- }
-
- /**
- * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data
- * matching the trigger of this chain. The ID of the final state is returned
- * @param chain__et - the chain ID
- * @param generic_data__et - the generic data pointer
- * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa
- */
- private int executeTransitionChain(int chain__et, InterfaceItemBase ifitem, Object generic_data__et) {
- switch (chain__et) {
- case CHAIN_TRANS_INITIAL_TO__closed:
- {
- return STATE_closed;
- }
- case CHAIN_TRANS_open_FROM_closed_TO_opened_BY_openlog:
- {
- String fileName = (String) generic_data__et;
- action_TRANS_open_FROM_closed_TO_opened_BY_openlog(ifitem, fileName);
- return STATE_opened;
- }
- case CHAIN_TRANS_tr0_FROM_opened_TO_closed_BY_closelog:
- {
- action_TRANS_tr0_FROM_opened_TO_closed_BY_closelog(ifitem);
- return STATE_closed;
- }
- case CHAIN_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1:
- {
- InternalLogData data = (InternalLogData) generic_data__et;
- action_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1(ifitem, data);
- return STATE_opened;
- }
- default:
- /* should not occur */
- break;
- }
- return NO_STATE;
- }
-
- /**
- * calls entry codes while entering a state's history. The ID of the final leaf state is returned
- * @param state__et - the state which is entered
- * @return - the ID of the final leaf state
- */
- private int enterHistory(int state__et) {
- boolean skip_entry__et = false;
- if (state__et >= STATE_MAX) {
- state__et = (state__et - STATE_MAX);
- skip_entry__et = true;
- }
- while (true) {
- switch (state__et) {
- case STATE_closed:
- /* in leaf state: return state id */
- return STATE_closed;
- case STATE_opened:
- /* in leaf state: return state id */
- return STATE_opened;
- case STATE_TOP:
- state__et = this.history[STATE_TOP];
- break;
- default:
- /* should not occur */
- break;
- }
- skip_entry__et = false;
- }
- /* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */
- }
-
- public void executeInitTransition() {
- int chain__et = CHAIN_TRANS_INITIAL_TO__closed;
- int next__et = executeTransitionChain(chain__et, null, null);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
-
- /* receiveEvent contains the main implementation of the FSM */
- public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data__et) {
- int trigger__et = ifitem.getLocalId() + EVT_SHIFT*evt;
- int chain__et = NOT_CAUGHT;
- int catching_state__et = NO_STATE;
-
- if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
- switch (getState()) {
- case STATE_closed:
- switch(trigger__et) {
- case TRIG_log__open:
- {
- chain__et = CHAIN_TRANS_open_FROM_closed_TO_opened_BY_openlog;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_opened:
- switch(trigger__et) {
- case TRIG_log__close:
- {
- chain__et = CHAIN_TRANS_tr0_FROM_opened_TO_closed_BY_closelog;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_log__internalLog:
- {
- chain__et = CHAIN_TRANS_tr1_FROM_opened_TO_opened_BY_internalLoglog_tr1;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- }
- if (chain__et != NOT_CAUGHT) {
- exitTo(getState(), catching_state__et);
- {
- int next__et = executeTransitionChain(chain__et, ifitem, generic_data__et);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
- }
- }
-
-
-};
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/InternalLogData.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/InternalLogData.java
deleted file mode 100644
index e4e1d55ea..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/InternalLogData.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package room.basic.service.logging;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-import java.io.Serializable;
-
-
-
-
-public class InternalLogData implements Serializable {
-
- private static final long serialVersionUID = 463634558L;
-
-
- /*--------------------- attributes ---------------------*/
- String userString;
- String sender;
- long timeStamp;
-
- /* --------------------- attribute setters and getters */
- public void setUserString (String userString) {
- this.userString = userString;
- }
- public String getUserString () {
- return this.userString;
- }
- public void setSender (String sender) {
- this.sender = sender;
- }
- public String getSender () {
- return this.sender;
- }
- public void setTimeStamp (long timeStamp) {
- this.timeStamp = timeStamp;
- }
- public long getTimeStamp () {
- return this.timeStamp;
- }
-
- /*--------------------- operations ---------------------*/
-
- // default constructor
- public InternalLogData() {
- super();
-
- // initialize attributes
- this.setUserString("");
- this.setSender("");
- }
-
- // constructor using fields
- public InternalLogData(String userString, String sender, long timeStamp) {
- super();
-
- this.userString = userString;
- this.sender = sender;
- this.timeStamp = timeStamp;
- }
-
- // deep copy
- public InternalLogData deepCopy() {
- InternalLogData copy = new InternalLogData();
- copy.userString = userString;
- copy.sender = sender;
- copy.timeStamp = timeStamp;
- return copy;
- }
-};
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
deleted file mode 100644
index 988e0e1df..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/logging/Log.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package room.basic.service.logging;
-
-import org.eclipse.etrice.runtime.java.messaging.Message;
-import org.eclipse.etrice.runtime.java.modelbase.EventMessage;
-import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage;
-import org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner;
-import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
-import org.eclipse.etrice.runtime.java.modelbase.PortBase;
-import org.eclipse.etrice.runtime.java.modelbase.ReplicatedPortBase;
-import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-
-
-public class Log {
- // message IDs
- public static final int MSG_MIN = 0;
- public static final int IN_open = 1;
- public static final int IN_close = 2;
- public static final int IN_internalLog = 3;
- public static final int MSG_MAX = 4;
-
- /*--------------------- begin user code ---------------------*/
- public static final int LOG_LEVEL_LOW = 1;
- public static final int LOG_LEVEL_MEDIUM = 2;
- public static final int LOG_LEVEL_HIGH = 3;
- /*--------------------- end user code ---------------------*/
-
- private static String messageStrings[] = {"MIN", "open","close","internalLog","MAX"};
-
- public String getMessageString(int msg_id) {
- if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
- // id out of range
- return "Message ID out of range";
- }
- else{
- return messageStrings[msg_id];
- }
- }
-
-
- // port class
- static public class LogPort extends PortBase {
- // constructors
- public LogPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public LogPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
-
-
- // sent messages
- }
-
- // replicated port class
- static public class LogReplPort extends ReplicatedPortBase {
-
- public LogReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public LogPort get(int idx) {
- return (LogPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new LogPort(rcv, name, lid, idx);
- }
-
- // outgoing messages
- }
-
-
- // port class
- static public class LogConjPort extends PortBase {
- /*--------------------- begin user code ---------------------*/
- static int logLevel=0;
- InternalLogData d = new InternalLogData();
- /*--------------------- end user code ---------------------*/
- // constructors
- public LogConjPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public LogConjPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- // initialize attributes
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
-
- /*--------------------- attributes ---------------------*/
- /* --------------------- attribute setters and getters */
- /*--------------------- operations ---------------------*/
- public void setLogLevel(int l) {
- logLevel=l;
- if (logLevel > LOG_LEVEL_HIGH) logLevel=LOG_LEVEL_HIGH;
- }
- public void log(int logLevel, String userString) {
- 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()));
- }
- }
-
- // sent messages
- public void open(String fileName) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_open]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, fileName));
- }
- 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) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalLog]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, data.deepCopy()));
- }
- public void internalLog(String userString, String sender, long timeStamp) {
- internalLog(new InternalLogData(userString, sender, timeStamp));
- }
- }
-
- // replicated port class
- static public class LogConjReplPort extends ReplicatedPortBase {
-
- public LogConjReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public LogConjPort get(int idx) {
- return (LogConjPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new LogConjPort(rcv, name, lid, idx);
- }
-
- // incoming messages
- public void open(String fileName){
- for (InterfaceItemBase item : getItems()) {
- ((LogConjPort)item).open( fileName);
- }
- }
- public void close(){
- for (InterfaceItemBase item : getItems()) {
- ((LogConjPort)item).close();
- }
- }
- private void internalLog(InternalLogData data){
- for (InterfaceItemBase item : getItems()) {
- ((LogConjPort)item).internalLog( data);
- }
- }
- }
-
-}
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
deleted file mode 100644
index 657334041..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpClient.java
+++ /dev/null
@@ -1,378 +0,0 @@
-package room.basic.service.tcp;
-
-import org.eclipse.etrice.runtime.java.messaging.*;
-import org.eclipse.etrice.runtime.java.modelbase.*;
-import org.eclipse.etrice.runtime.java.debugging.*;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-import room.basic.service.tcp.PTcpControl.*;
-import room.basic.service.tcp.PTcpPayload.*;
-
-/*--------------------- begin user code ---------------------*/
-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());
- }
-
- }
- }
-/*--------------------- end user code ---------------------*/
-
-
-public class ATcpClient extends ActorClassBase {
-
- /*--------------------- begin user code ---------------------*/
- Socket socket;
- InputStream in;
- OutputStream out;
- /*--------------------- end user code ---------------------*/
-
- //--------------------- ports
- protected PTcpControlPort ControlPort = null;
- protected PTcpPayloadPort PayloadPort = null;
-
- //--------------------- saps
-
- //--------------------- services
-
- //--------------------- optional actors
-
- //--------------------- interface item IDs
- public static final int IFITEM_ControlPort = 1;
- public static final int IFITEM_PayloadPort = 2;
-
- /*--------------------- attributes ---------------------*/
- int lastError;
- /*--------------------- operations ---------------------*/
- public void stopUser() {
- try{
- if(socket != null){
- socket.close();
- }
- }catch(IOException e){
- System.err.println(e.toString());}
- }
-
- //--------------------- construction
- public ATcpClient(IRTObject parent, String name) {
- super(parent, name);
- setClassName("ATcpClient");
-
- // initialize attributes
- this.setLastError(0);
-
- // own ports
- ControlPort = new PTcpControlPort(this, "ControlPort", IFITEM_ControlPort);
- PayloadPort = new PTcpPayloadPort(this, "PayloadPort", IFITEM_PayloadPort);
-
- // own saps
-
- // own service implementations
-
- // sub actors
-
- // wiring
-
-
-
- }
-
- /* --------------------- attribute setters and getters */
- public void setLastError (int lastError) {
- this.lastError = lastError;
- }
- public int getLastError () {
- return this.lastError;
- }
-
-
- //--------------------- port getters
- public PTcpControlPort getControlPort (){
- return this.ControlPort;
- }
- public PTcpPayloadPort getPayloadPort (){
- return this.PayloadPort;
- }
-
- //--------------------- lifecycle functions
- public void stop(){
- stopUser();
- super.stop();
- }
-
- public void destroy() {
- DebuggingService.getInstance().addMessageActorDestroy(this);
- super.destroy();
- }
-
- /* state IDs */
- public static final int STATE_closed = 2;
- public static final int STATE_opened = 3;
- public static final int STATE_error = 4;
- public static final int STATE_MAX = 5;
-
- /* transition chains */
- public static final int CHAIN_TRANS_INITIAL_TO__closed = 1;
- public static final int CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort = 2;
- public static final int CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort = 3;
- public static final int CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3 = 4;
-
- /* triggers */
- public static final int POLLING = 0;
- public static final int TRIG_ControlPort__open = IFITEM_ControlPort + EVT_SHIFT*PTcpControl.IN_open;
- public static final int TRIG_ControlPort__close = IFITEM_ControlPort + EVT_SHIFT*PTcpControl.IN_close;
- public static final int TRIG_PayloadPort__send = IFITEM_PayloadPort + EVT_SHIFT*PTcpPayload.IN_send;
-
- // state names
- protected static final String stateStrings[] = {
- "<no state>",
- "<top>",
- "closed",
- "opened",
- "error"
- };
-
- // history
- protected int history[] = {NO_STATE, NO_STATE, NO_STATE, NO_STATE, NO_STATE};
-
- private void setState(int new_state) {
- DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);
- this.state = new_state;
- }
-
- /* Entry and Exit Codes */
-
- /* Action Codes */
- protected void action_TRANS_INITIAL_TO__closed() {
- System.out.println("Client Init !");
- }
- protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl data) {
- lastError=0;
- try{
- socket = new Socket(data.IPAddr,data.TcpPort);
- (new ClientRxThread(PayloadPort, socket)).start();
- out = socket.getOutputStream();
- }catch(IOException e){
- System.err.println(e.toString());
- lastError=1;
- }
- }
- protected void action_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort(InterfaceItemBase ifitem) {
- try{
- if (socket!=null){
- socket.close();
- }
- } catch (IOException e){
- System.err.println(e.toString());
- }
- }
- protected void action_TRANS_tr2_FROM_cp0_TO_opened(InterfaceItemBase ifitem, DTcpControl data) {
- ControlPort.established();
- }
- protected void action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(InterfaceItemBase ifitem, DTcpControl data) {
- ControlPort.error();
- try{
- socket.close();
- } catch(IOException e){
- System.err.println(e.toString());
- }
- }
- protected void action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(InterfaceItemBase ifitem, DTcpPayload data) {
- try{
- out.write(data.getData(),0,data.length);
- }catch(IOException e){
- System.err.println(e.toString());
- }
- }
-
- /**
- * calls exit codes while exiting from the current state to one of its
- * parent states while remembering the history
- * @param current__et - the current state
- * @param to - the final parent state
- */
- private void exitTo(int current__et, int to) {
- while (current__et!=to) {
- switch (current__et) {
- case STATE_closed:
- this.history[STATE_TOP] = STATE_closed;
- current__et = STATE_TOP;
- break;
- case STATE_opened:
- this.history[STATE_TOP] = STATE_opened;
- current__et = STATE_TOP;
- break;
- case STATE_error:
- this.history[STATE_TOP] = STATE_error;
- current__et = STATE_TOP;
- break;
- default:
- /* should not occur */
- break;
- }
- }
- }
-
- /**
- * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data
- * matching the trigger of this chain. The ID of the final state is returned
- * @param chain__et - the chain ID
- * @param generic_data__et - the generic data pointer
- * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa
- */
- private int executeTransitionChain(int chain__et, InterfaceItemBase ifitem, Object generic_data__et) {
- switch (chain__et) {
- case CHAIN_TRANS_INITIAL_TO__closed:
- {
- action_TRANS_INITIAL_TO__closed();
- return STATE_closed;
- }
- case CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort:
- {
- DTcpControl data = (DTcpControl) generic_data__et;
- action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(ifitem, data);
- if (lastError!=0) {
- action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(ifitem, data);
- return STATE_error;}
- else {
- action_TRANS_tr2_FROM_cp0_TO_opened(ifitem, data);
- return STATE_opened;}
- }
- case CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort:
- {
- action_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort(ifitem);
- return STATE_closed;
- }
- case CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3:
- {
- DTcpPayload data = (DTcpPayload) generic_data__et;
- action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(ifitem, data);
- return STATE_opened;
- }
- default:
- /* should not occur */
- break;
- }
- return NO_STATE;
- }
-
- /**
- * calls entry codes while entering a state's history. The ID of the final leaf state is returned
- * @param state__et - the state which is entered
- * @return - the ID of the final leaf state
- */
- private int enterHistory(int state__et) {
- boolean skip_entry__et = false;
- if (state__et >= STATE_MAX) {
- state__et = (state__et - STATE_MAX);
- skip_entry__et = true;
- }
- while (true) {
- switch (state__et) {
- case STATE_closed:
- /* in leaf state: return state id */
- return STATE_closed;
- case STATE_opened:
- /* in leaf state: return state id */
- return STATE_opened;
- case STATE_error:
- /* in leaf state: return state id */
- return STATE_error;
- case STATE_TOP:
- state__et = this.history[STATE_TOP];
- break;
- default:
- /* should not occur */
- break;
- }
- skip_entry__et = false;
- }
- /* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */
- }
-
- public void executeInitTransition() {
- int chain__et = CHAIN_TRANS_INITIAL_TO__closed;
- int next__et = executeTransitionChain(chain__et, null, null);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
-
- /* receiveEvent contains the main implementation of the FSM */
- public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data__et) {
- int trigger__et = ifitem.getLocalId() + EVT_SHIFT*evt;
- int chain__et = NOT_CAUGHT;
- int catching_state__et = NO_STATE;
-
- if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
- switch (getState()) {
- case STATE_closed:
- switch(trigger__et) {
- case TRIG_ControlPort__open:
- {
- chain__et = CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_opened:
- switch(trigger__et) {
- case TRIG_ControlPort__close:
- {
- chain__et = CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_PayloadPort__send:
- {
- chain__et = CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_error:
- break;
- default:
- /* should not occur */
- break;
- }
- }
- if (chain__et != NOT_CAUGHT) {
- exitTo(getState(), catching_state__et);
- {
- int next__et = executeTransitionChain(chain__et, ifitem, generic_data__et);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
- }
- }
-
-
-};
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
deleted file mode 100644
index 40c2fa030..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/ATcpServer.java
+++ /dev/null
@@ -1,417 +0,0 @@
-package room.basic.service.tcp;
-
-import org.eclipse.etrice.runtime.java.messaging.*;
-import org.eclipse.etrice.runtime.java.modelbase.*;
-import org.eclipse.etrice.runtime.java.debugging.*;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-import room.basic.service.tcp.PTcpControl.*;
-import room.basic.service.tcp.PTcpPayload.*;
-
-/*--------------------- begin user code ---------------------*/
-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());
- }
- }
- }
-
-/*--------------------- end user code ---------------------*/
-
-
-public class ATcpServer extends ActorClassBase {
-
- /*--------------------- begin user code ---------------------*/
- 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);
- }
-
- /*--------------------- end user code ---------------------*/
-
- //--------------------- ports
- protected PTcpControlPort ControlPort = null;
- protected PTcpPayloadPort PayloadPort = null;
-
- //--------------------- saps
-
- //--------------------- services
-
- //--------------------- optional actors
-
- //--------------------- interface item IDs
- public static final int IFITEM_ControlPort = 1;
- public static final int IFITEM_PayloadPort = 2;
-
- /*--------------------- attributes ---------------------*/
- int lastError;
- int payloadPortReplocation;
- /*--------------------- operations ---------------------*/
- public void stopUser() {
- try{
- if(socket != null){
- socket.close();
- }
- }catch(IOException e){
- System.err.println(e.toString());}
- }
-
- //--------------------- construction
- public ATcpServer(IRTObject parent, String name) {
- super(parent, name);
- setClassName("ATcpServer");
-
- // initialize attributes
- this.setLastError(0);
- this.setPayloadPortReplocation(0);
-
- // own ports
- ControlPort = new PTcpControlPort(this, "ControlPort", IFITEM_ControlPort);
- PayloadPort = new PTcpPayloadPort(this, "PayloadPort", IFITEM_PayloadPort);
-
- // own saps
-
- // own service implementations
-
- // sub actors
-
- // wiring
-
-
-
- }
-
- /* --------------------- attribute setters and getters */
- public void setLastError (int lastError) {
- this.lastError = lastError;
- }
- public int getLastError () {
- return this.lastError;
- }
- public void setPayloadPortReplocation (int payloadPortReplocation) {
- this.payloadPortReplocation = payloadPortReplocation;
- }
- public int getPayloadPortReplocation () {
- return this.payloadPortReplocation;
- }
-
-
- //--------------------- port getters
- public PTcpControlPort getControlPort (){
- return this.ControlPort;
- }
- public PTcpPayloadPort getPayloadPort (){
- return this.PayloadPort;
- }
-
- //--------------------- lifecycle functions
- public void stop(){
- stopUser();
- super.stop();
- }
-
- public void destroy() {
- DebuggingService.getInstance().addMessageActorDestroy(this);
- super.destroy();
- }
-
- /* state IDs */
- public static final int STATE_closed = 2;
- public static final int STATE_opened = 3;
- public static final int STATE_error = 4;
- public static final int STATE_MAX = 5;
-
- /* transition chains */
- public static final int CHAIN_TRANS_INITIAL_TO__closed = 1;
- public static final int CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort = 2;
- public static final int CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort = 3;
- public static final int CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3 = 4;
-
- /* triggers */
- public static final int POLLING = 0;
- public static final int TRIG_ControlPort__open = IFITEM_ControlPort + EVT_SHIFT*PTcpControl.IN_open;
- public static final int TRIG_ControlPort__close = IFITEM_ControlPort + EVT_SHIFT*PTcpControl.IN_close;
- public static final int TRIG_PayloadPort__send = IFITEM_PayloadPort + EVT_SHIFT*PTcpPayload.IN_send;
-
- // state names
- protected static final String stateStrings[] = {
- "<no state>",
- "<top>",
- "closed",
- "opened",
- "error"
- };
-
- // history
- protected int history[] = {NO_STATE, NO_STATE, NO_STATE, NO_STATE, NO_STATE};
-
- private void setState(int new_state) {
- DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);
- this.state = new_state;
- }
-
- /* Entry and Exit Codes */
-
- /* Action Codes */
- protected void action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(InterfaceItemBase ifitem, DTcpControl data) {
- lastError=0;
- try{
- socket = new ServerSocket(data.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){
- System.err.println(e.toString());
- }
- }
- protected void action_TRANS_tr2_FROM_cp0_TO_opened(InterfaceItemBase ifitem, DTcpControl data) {
- ControlPort.established();
- }
- protected void action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(InterfaceItemBase ifitem, DTcpControl data) {
- ControlPort.error();
- try{
- socket.close();
- } catch(IOException e){
- System.err.println(e.toString());
- }
- }
- protected void action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(InterfaceItemBase ifitem, DTcpPayload data) {
- try{
- outStreams.get(data.getConnectionId()).write(data.getData(),0,data.length);
- }catch(IOException e){
- System.err.println(e.toString());
- }
- }
-
- /**
- * calls exit codes while exiting from the current state to one of its
- * parent states while remembering the history
- * @param current__et - the current state
- * @param to - the final parent state
- */
- private void exitTo(int current__et, int to) {
- while (current__et!=to) {
- switch (current__et) {
- case STATE_closed:
- this.history[STATE_TOP] = STATE_closed;
- current__et = STATE_TOP;
- break;
- case STATE_opened:
- this.history[STATE_TOP] = STATE_opened;
- current__et = STATE_TOP;
- break;
- case STATE_error:
- this.history[STATE_TOP] = STATE_error;
- current__et = STATE_TOP;
- break;
- default:
- /* should not occur */
- break;
- }
- }
- }
-
- /**
- * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data
- * matching the trigger of this chain. The ID of the final state is returned
- * @param chain__et - the chain ID
- * @param generic_data__et - the generic data pointer
- * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa
- */
- private int executeTransitionChain(int chain__et, InterfaceItemBase ifitem, Object generic_data__et) {
- switch (chain__et) {
- case CHAIN_TRANS_INITIAL_TO__closed:
- {
- return STATE_closed;
- }
- case CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort:
- {
- DTcpControl data = (DTcpControl) generic_data__et;
- action_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort(ifitem, data);
- if (lastError!=0) {
- action_TRANS_socketError_FROM_cp0_TO_error_COND_socketError(ifitem, data);
- return STATE_error;}
- else {
- action_TRANS_tr2_FROM_cp0_TO_opened(ifitem, data);
- return STATE_opened;}
- }
- case CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort:
- {
- action_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort(ifitem);
- return STATE_closed;
- }
- case CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3:
- {
- DTcpPayload data = (DTcpPayload) generic_data__et;
- action_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3(ifitem, data);
- return STATE_opened;
- }
- default:
- /* should not occur */
- break;
- }
- return NO_STATE;
- }
-
- /**
- * calls entry codes while entering a state's history. The ID of the final leaf state is returned
- * @param state__et - the state which is entered
- * @return - the ID of the final leaf state
- */
- private int enterHistory(int state__et) {
- boolean skip_entry__et = false;
- if (state__et >= STATE_MAX) {
- state__et = (state__et - STATE_MAX);
- skip_entry__et = true;
- }
- while (true) {
- switch (state__et) {
- case STATE_closed:
- /* in leaf state: return state id */
- return STATE_closed;
- case STATE_opened:
- /* in leaf state: return state id */
- return STATE_opened;
- case STATE_error:
- /* in leaf state: return state id */
- return STATE_error;
- case STATE_TOP:
- state__et = this.history[STATE_TOP];
- break;
- default:
- /* should not occur */
- break;
- }
- skip_entry__et = false;
- }
- /* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */
- }
-
- public void executeInitTransition() {
- int chain__et = CHAIN_TRANS_INITIAL_TO__closed;
- int next__et = executeTransitionChain(chain__et, null, null);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
-
- /* receiveEvent contains the main implementation of the FSM */
- public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data__et) {
- int trigger__et = ifitem.getLocalId() + EVT_SHIFT*evt;
- int chain__et = NOT_CAUGHT;
- int catching_state__et = NO_STATE;
-
- if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
- switch (getState()) {
- case STATE_closed:
- switch(trigger__et) {
- case TRIG_ControlPort__open:
- {
- chain__et = CHAIN_TRANS_tr0_FROM_closed_TO_cp0_BY_openControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_opened:
- switch(trigger__et) {
- case TRIG_ControlPort__close:
- {
- chain__et = CHAIN_TRANS_tr1_FROM_opened_TO_closed_BY_closeControlPort;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_PayloadPort__send:
- {
- chain__et = CHAIN_TRANS_tr3_FROM_opened_TO_opened_BY_sendPayloadPort_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- case STATE_error:
- break;
- default:
- /* should not occur */
- break;
- }
- }
- if (chain__et != NOT_CAUGHT) {
- exitTo(getState(), catching_state__et);
- {
- int next__et = executeTransitionChain(chain__et, ifitem, generic_data__et);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
- }
- }
-
-
-};
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpControl.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpControl.java
deleted file mode 100644
index d943fe9c4..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpControl.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package room.basic.service.tcp;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-import java.io.Serializable;
-
-
-
-
-public class DTcpControl implements Serializable {
-
- private static final long serialVersionUID = -156692117L;
-
-
- /*--------------------- attributes ---------------------*/
- String IPAddr;
- int TcpPort;
-
- /* --------------------- attribute setters and getters */
- public void setIPAddr (String IPAddr) {
- this.IPAddr = IPAddr;
- }
- public String getIPAddr () {
- return this.IPAddr;
- }
- public void setTcpPort (int TcpPort) {
- this.TcpPort = TcpPort;
- }
- public int getTcpPort () {
- return this.TcpPort;
- }
-
- /*--------------------- operations ---------------------*/
-
- // default constructor
- public DTcpControl() {
- super();
-
- // initialize attributes
- this.setIPAddr("");
- }
-
- // constructor using fields
- public DTcpControl(String IPAddr, int TcpPort) {
- super();
-
- this.IPAddr = IPAddr;
- this.TcpPort = TcpPort;
- }
-
- // deep copy
- public DTcpControl deepCopy() {
- DTcpControl copy = new DTcpControl();
- copy.IPAddr = IPAddr;
- copy.TcpPort = TcpPort;
- return copy;
- }
-};
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpPayload.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpPayload.java
deleted file mode 100644
index a724f7df9..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/DTcpPayload.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package room.basic.service.tcp;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-import java.io.Serializable;
-
-
-
-
-public class DTcpPayload implements Serializable {
-
- private static final long serialVersionUID = -1894937188L;
-
-
- /*--------------------- attributes ---------------------*/
- int connectionId;
- int length;
- byte data[];
-
- /* --------------------- attribute setters and getters */
- public void setConnectionId (int connectionId) {
- this.connectionId = connectionId;
- }
- public int getConnectionId () {
- return this.connectionId;
- }
- public void setLength (int length) {
- this.length = length;
- }
- public int getLength () {
- return this.length;
- }
- public void setData (byte[] data) {
- this.data = data;
- }
- public byte[] getData () {
- return this.data;
- }
-
- /*--------------------- operations ---------------------*/
-
- // default constructor
- public DTcpPayload() {
- super();
-
- // initialize attributes
- {
- byte[] array = new byte[1000];
- for (int i=0;i<1000;i++){
- array[i] = (byte)0;
- }
- this.setData(array);
- }
- }
-
- // constructor using fields
- public DTcpPayload(int connectionId, int length, byte[] data) {
- super();
-
- this.connectionId = connectionId;
- this.length = length;
- this.data = data;
- }
-
- // deep copy
- public DTcpPayload deepCopy() {
- DTcpPayload copy = new DTcpPayload();
- copy.connectionId = connectionId;
- copy.length = length;
- for (int i=0;i<data.length;i++){
- copy.data[i] = data[i];
- }
- return copy;
- }
-};
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
deleted file mode 100644
index 7575e548b..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpControl.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package room.basic.service.tcp;
-
-import org.eclipse.etrice.runtime.java.messaging.Message;
-import org.eclipse.etrice.runtime.java.modelbase.EventMessage;
-import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage;
-import org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner;
-import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
-import org.eclipse.etrice.runtime.java.modelbase.PortBase;
-import org.eclipse.etrice.runtime.java.modelbase.ReplicatedPortBase;
-import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-
-
-public class PTcpControl {
- // message IDs
- public static final int MSG_MIN = 0;
- public static final int OUT_established = 1;
- public static final int OUT_error = 2;
- public static final int IN_open = 3;
- public static final int IN_close = 4;
- public static final int MSG_MAX = 5;
-
-
- private static String messageStrings[] = {"MIN", "established","error", "open","close","MAX"};
-
- public String getMessageString(int msg_id) {
- if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
- // id out of range
- return "Message ID out of range";
- }
- else{
- return messageStrings[msg_id];
- }
- }
-
-
- // port class
- static public class PTcpControlPort extends PortBase {
- // constructors
- public PTcpControlPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public PTcpControlPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
-
-
- // sent messages
- public void established() {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_established]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_established));
- }
- public void error() {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_error]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_error));
- }
- }
-
- // replicated port class
- static public class PTcpControlReplPort extends ReplicatedPortBase {
-
- public PTcpControlReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public PTcpControlPort get(int idx) {
- return (PTcpControlPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new PTcpControlPort(rcv, name, lid, idx);
- }
-
- // outgoing messages
- public void established(){
- for (InterfaceItemBase item : getItems()) {
- ((PTcpControlPort)item).established();
- }
- }
- public void error(){
- for (InterfaceItemBase item : getItems()) {
- ((PTcpControlPort)item).error();
- }
- }
- }
-
-
- // port class
- static public class PTcpControlConjPort extends PortBase {
- // constructors
- public PTcpControlConjPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public PTcpControlConjPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
-
-
- // sent messages
- public void open(DTcpControl data) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_open]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, data.deepCopy()));
- }
- public void open(String IPAddr, int TcpPort) {
- open(new DTcpControl(IPAddr, TcpPort));
- }
- public void close() {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_close]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_close));
- }
- }
-
- // replicated port class
- static public class PTcpControlConjReplPort extends ReplicatedPortBase {
-
- public PTcpControlConjReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public PTcpControlConjPort get(int idx) {
- return (PTcpControlConjPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new PTcpControlConjPort(rcv, name, lid, idx);
- }
-
- // incoming messages
- public void open(DTcpControl data){
- for (InterfaceItemBase item : getItems()) {
- ((PTcpControlConjPort)item).open( data);
- }
- }
- public void close(){
- for (InterfaceItemBase item : getItems()) {
- ((PTcpControlConjPort)item).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
deleted file mode 100644
index 7b29bcab2..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/tcp/PTcpPayload.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package room.basic.service.tcp;
-
-import org.eclipse.etrice.runtime.java.messaging.Message;
-import org.eclipse.etrice.runtime.java.modelbase.EventMessage;
-import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage;
-import org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner;
-import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
-import org.eclipse.etrice.runtime.java.modelbase.PortBase;
-import org.eclipse.etrice.runtime.java.modelbase.ReplicatedPortBase;
-import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-
-
-public class PTcpPayload {
- // message IDs
- public static final int MSG_MIN = 0;
- public static final int OUT_receive = 1;
- public static final int IN_send = 2;
- public static final int MSG_MAX = 3;
-
-
- private static String messageStrings[] = {"MIN", "receive", "send","MAX"};
-
- public String getMessageString(int msg_id) {
- if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
- // id out of range
- return "Message ID out of range";
- }
- else{
- return messageStrings[msg_id];
- }
- }
-
-
- // port class
- static public class PTcpPayloadPort extends PortBase {
- // constructors
- public PTcpPayloadPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public PTcpPayloadPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
-
-
- // sent messages
- public void receive(DTcpPayload data) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_receive]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_receive, data.deepCopy()));
- }
- public void receive(int connectionId, int length, byte[] data) {
- receive(new DTcpPayload(connectionId, length, data));
- }
- }
-
- // replicated port class
- static public class PTcpPayloadReplPort extends ReplicatedPortBase {
-
- public PTcpPayloadReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public PTcpPayloadPort get(int idx) {
- return (PTcpPayloadPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new PTcpPayloadPort(rcv, name, lid, idx);
- }
-
- // outgoing messages
- public void receive(DTcpPayload data){
- for (InterfaceItemBase item : getItems()) {
- ((PTcpPayloadPort)item).receive( data);
- }
- }
- }
-
-
- // port class
- static public class PTcpPayloadConjPort extends PortBase {
- // constructors
- public PTcpPayloadConjPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public PTcpPayloadConjPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
-
-
- // sent messages
- public void send(DTcpPayload data) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_send]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_send, data.deepCopy()));
- }
- public void send(int connectionId, int length, byte[] data) {
- send(new DTcpPayload(connectionId, length, data));
- }
- }
-
- // replicated port class
- static public class PTcpPayloadConjReplPort extends ReplicatedPortBase {
-
- public PTcpPayloadConjReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public PTcpPayloadConjPort get(int idx) {
- return (PTcpPayloadConjPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new PTcpPayloadConjPort(rcv, name, lid, idx);
- }
-
- // incoming messages
- public void send(DTcpPayload data){
- for (InterfaceItemBase item : getItems()) {
- ((PTcpPayloadConjPort)item).send( data);
- }
- }
- }
-
-}
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java
deleted file mode 100644
index deaec2deb..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/ATimingService.java
+++ /dev/null
@@ -1,281 +0,0 @@
-package room.basic.service.timing;
-
-import org.eclipse.etrice.runtime.java.messaging.*;
-import org.eclipse.etrice.runtime.java.modelbase.*;
-import org.eclipse.etrice.runtime.java.debugging.*;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-import room.basic.service.timing.PTimer.*;
-
-/*--------------------- begin user code ---------------------*/
-import java.util.Timer;
-/*--------------------- end user code ---------------------*/
-
-
-public class ATimingService extends ActorClassBase {
-
- /*--------------------- begin user code ---------------------*/
- private Timer timerService = null;
- private int taskCount = 0;
- private static final int PURGE_LIMIT = 1000;
- /*--------------------- end user code ---------------------*/
-
- //--------------------- ports
-
- //--------------------- saps
-
- //--------------------- services
- protected PTimerReplPort timer = null;
-
- //--------------------- optional actors
-
- //--------------------- interface item IDs
- public static final int IFITEM_timer = 1;
-
- /*--------------------- attributes ---------------------*/
- /*--------------------- operations ---------------------*/
- public void stop() {
- System.out.println(toString() + "::stop()");
- timerService.cancel();
- timerService = null;
- }
-
- //--------------------- construction
- public ATimingService(IRTObject parent, String name) {
- super(parent, name);
- setClassName("ATimingService");
-
- // initialize attributes
-
- // own ports
-
- // own saps
-
- // own service implementations
- timer = new PTimerReplPort(this, "timer", IFITEM_timer);
-
- // sub actors
-
- // wiring
-
-
-
- }
-
- /* --------------------- attribute setters and getters */
-
-
- //--------------------- port getters
- public PTimerReplPort getTimer (){
- return this.timer;
- }
-
- //--------------------- lifecycle functions
-
- public void destroy() {
- DebuggingService.getInstance().addMessageActorDestroy(this);
- super.destroy();
- }
-
- /* state IDs */
- public static final int STATE_Operational = 2;
- public static final int STATE_MAX = 3;
-
- /* transition chains */
- public static final int CHAIN_TRANS_INITIAL_TO__Operational = 1;
- public static final int CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1 = 2;
- public static final int CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3 = 3;
- public static final int CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4 = 4;
-
- /* triggers */
- public static final int POLLING = 0;
- public static final int TRIG_timer__kill = IFITEM_timer + EVT_SHIFT*PTimer.IN_kill;
- public static final int TRIG_timer__internalStartTimer = IFITEM_timer + EVT_SHIFT*PTimer.IN_internalStartTimer;
- public static final int TRIG_timer__internalStartTimeout = IFITEM_timer + EVT_SHIFT*PTimer.IN_internalStartTimeout;
-
- // state names
- protected static final String stateStrings[] = {
- "<no state>",
- "<top>",
- "Operational"
- };
-
- // history
- protected int history[] = {NO_STATE, NO_STATE, NO_STATE};
-
- private void setState(int new_state) {
- DebuggingService.getInstance().addActorState(this,stateStrings[new_state]);
- this.state = new_state;
- }
-
- /* Entry and Exit Codes */
- protected void entry_Operational() {
- // prepare
- }
-
- /* Action Codes */
- protected void action_TRANS_INITIAL_TO__Operational() {
- timerService = new Timer();
- }
- protected void action_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1(InterfaceItemBase ifitem, TimerData td) {
- // start timer
- taskCount++;
- if (taskCount>PURGE_LIMIT) timerService.purge();
- int t = td.getTime();
- timerService.scheduleAtFixedRate(((PTimerPort)ifitem).getTask(),t,t);
- }
- protected void action_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3(InterfaceItemBase ifitem, TimerData td) {
- // start timeout
- taskCount++;
- if (taskCount>PURGE_LIMIT) timerService.purge();
- timerService.schedule(((PTimerPort)ifitem).getTask(), ((TimerData)td).getTime());
- }
- protected void action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(InterfaceItemBase ifitem) {
- // nothing to do to kill timer (handled by timer)
- }
-
- /**
- * calls exit codes while exiting from the current state to one of its
- * parent states while remembering the history
- * @param current__et - the current state
- * @param to - the final parent state
- */
- private void exitTo(int current__et, int to) {
- while (current__et!=to) {
- switch (current__et) {
- case STATE_Operational:
- this.history[STATE_TOP] = STATE_Operational;
- current__et = STATE_TOP;
- break;
- default:
- /* should not occur */
- break;
- }
- }
- }
-
- /**
- * calls action, entry and exit codes along a transition chain. The generic data are cast to typed data
- * matching the trigger of this chain. The ID of the final state is returned
- * @param chain__et - the chain ID
- * @param generic_data__et - the generic data pointer
- * @return the +/- ID of the final state either with a positive sign, that indicates to execute the state's entry code, or a negative sign vice versa
- */
- private int executeTransitionChain(int chain__et, InterfaceItemBase ifitem, Object generic_data__et) {
- switch (chain__et) {
- case CHAIN_TRANS_INITIAL_TO__Operational:
- {
- action_TRANS_INITIAL_TO__Operational();
- return STATE_Operational;
- }
- case CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1:
- {
- TimerData td = (TimerData) generic_data__et;
- action_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1(ifitem, td);
- return STATE_Operational;
- }
- case CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3:
- {
- TimerData td = (TimerData) generic_data__et;
- action_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3(ifitem, td);
- return STATE_Operational;
- }
- case CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4:
- {
- action_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4(ifitem);
- return STATE_Operational;
- }
- default:
- /* should not occur */
- break;
- }
- return NO_STATE;
- }
-
- /**
- * calls entry codes while entering a state's history. The ID of the final leaf state is returned
- * @param state__et - the state which is entered
- * @return - the ID of the final leaf state
- */
- private int enterHistory(int state__et) {
- boolean skip_entry__et = false;
- if (state__et >= STATE_MAX) {
- state__et = (state__et - STATE_MAX);
- skip_entry__et = true;
- }
- while (true) {
- switch (state__et) {
- case STATE_Operational:
- if (!(skip_entry__et)) entry_Operational();
- /* in leaf state: return state id */
- return STATE_Operational;
- case STATE_TOP:
- state__et = this.history[STATE_TOP];
- break;
- default:
- /* should not occur */
- break;
- }
- skip_entry__et = false;
- }
- /* return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true) */
- }
-
- public void executeInitTransition() {
- int chain__et = CHAIN_TRANS_INITIAL_TO__Operational;
- int next__et = executeTransitionChain(chain__et, null, null);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
-
- /* receiveEvent contains the main implementation of the FSM */
- public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data__et) {
- int trigger__et = ifitem.getLocalId() + EVT_SHIFT*evt;
- int chain__et = NOT_CAUGHT;
- int catching_state__et = NO_STATE;
-
- if (!handleSystemEvent(ifitem, evt, generic_data__et)) {
- switch (getState()) {
- case STATE_Operational:
- switch(trigger__et) {
- case TRIG_timer__internalStartTimer:
- {
- chain__et = CHAIN_TRANS_tr1_FROM_Operational_TO_Operational_BY_internalStartTimertimer_tr1;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__internalStartTimeout:
- {
- chain__et = CHAIN_TRANS_tr3_FROM_Operational_TO_Operational_BY_internalStartTimeouttimer_tr3;
- catching_state__et = STATE_TOP;
- }
- break;
- case TRIG_timer__kill:
- {
- chain__et = CHAIN_TRANS_tr4_FROM_Operational_TO_Operational_BY_killtimer_tr4;
- catching_state__et = STATE_TOP;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- break;
- default:
- /* should not occur */
- break;
- }
- }
- if (chain__et != NOT_CAUGHT) {
- exitTo(getState(), catching_state__et);
- {
- int next__et = executeTransitionChain(chain__et, ifitem, generic_data__et);
- next__et = enterHistory(next__et);
- setState(next__et);
- }
- }
- }
-
-
-};
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
deleted file mode 100644
index 807ec0c72..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/PTimer.java
+++ /dev/null
@@ -1,366 +0,0 @@
-package room.basic.service.timing;
-
-import org.eclipse.etrice.runtime.java.messaging.Message;
-import org.eclipse.etrice.runtime.java.modelbase.EventMessage;
-import org.eclipse.etrice.runtime.java.modelbase.EventWithDataMessage;
-import org.eclipse.etrice.runtime.java.modelbase.IInterfaceItemOwner;
-import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
-import org.eclipse.etrice.runtime.java.modelbase.PortBase;
-import org.eclipse.etrice.runtime.java.modelbase.ReplicatedPortBase;
-import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-
-/*--------------------- begin user code ---------------------*/
-import java.util.TimerTask;
-import org.eclipse.etrice.runtime.java.messaging.RTServices;
-/*--------------------- end user code ---------------------*/
-
-
-public class PTimer {
- // message IDs
- public static final int MSG_MIN = 0;
- public static final int OUT_timeout = 1;
- public static final int OUT_internalTimer = 2;
- public static final int OUT_internalTimeout = 3;
- public static final int IN_kill = 4;
- public static final int IN_internalStartTimer = 5;
- public static final int IN_internalStartTimeout = 6;
- public static final int MSG_MAX = 7;
-
- /*--------------------- begin user code ---------------------*/
- 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;
- }
- }
-
- /*--------------------- end user code ---------------------*/
-
- private static String messageStrings[] = {"MIN", "timeout","internalTimer","internalTimeout", "kill","internalStartTimer","internalStartTimeout","MAX"};
-
- public String getMessageString(int msg_id) {
- if (msg_id<MSG_MIN || msg_id>MSG_MAX+1){
- // id out of range
- return "Message ID out of range";
- }
- else{
- return messageStrings[msg_id];
- }
- }
-
-
- // port class
- static public class PTimerPort extends PortBase {
- /*--------------------- begin user code ---------------------*/
- private FireTimeoutTask task = null;
-
- public TimerTask getTask() { return task; }
- /*--------------------- end user code ---------------------*/
- // constructors
- public PTimerPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public PTimerPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- // initialize attributes
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- switch (msg.getEvtId()) {
- 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);
- }
- 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);
- }
- break;
- case IN_kill:
- {
- //regular PortClass handle kill
- EventWithDataMessage dataMsg = (EventWithDataMessage) msg;
- TimerData td = (TimerData)dataMsg.getData();
- if (task!=null && task.getId()==td.getId()) {
- task.cancel();
- }
- }
- break;
- default:
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
- }
-
- /*--------------------- attributes ---------------------*/
- /* --------------------- attribute setters and getters */
- /*--------------------- operations ---------------------*/
-
- // sent messages
- public void timeout() {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_timeout]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_timeout));
- }
- private void internalTimer(TimerData td) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_internalTimer]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_internalTimer, td.deepCopy()));
- }
- public void internalTimer(int time, int id) {
- internalTimer(new TimerData(time, id));
- }
- private void internalTimeout(TimerData td) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_internalTimeout]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), OUT_internalTimeout, td.deepCopy()));
- }
- public void internalTimeout(int time, int id) {
- internalTimeout(new TimerData(time, id));
- }
- }
-
- // replicated port class
- static public class PTimerReplPort extends ReplicatedPortBase {
-
- public PTimerReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public PTimerPort get(int idx) {
- return (PTimerPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new PTimerPort(rcv, name, lid, idx);
- }
-
- // outgoing messages
- public void timeout(){
- for (InterfaceItemBase item : getItems()) {
- ((PTimerPort)item).timeout();
- }
- }
- private void internalTimer(TimerData td){
- for (InterfaceItemBase item : getItems()) {
- ((PTimerPort)item).internalTimer( td);
- }
- }
- private void internalTimeout(TimerData td){
- for (InterfaceItemBase item : getItems()) {
- ((PTimerPort)item).internalTimeout( td);
- }
- }
- }
-
-
- // port class
- static public class PTimerConjPort extends PortBase {
- /*--------------------- begin user code ---------------------*/
- private int currentId = 0;
- private boolean active = false;
- /*--------------------- end user code ---------------------*/
- // constructors
- public PTimerConjPort(IInterfaceItemOwner actor, String name, int localId) {
- this(actor, name, localId, 0);
- }
- public PTimerConjPort(IInterfaceItemOwner actor, String name, int localId, int idx) {
- super(actor, name, localId, idx);
- // initialize attributes
- DebuggingService.getInstance().addPortInstance(this);
- }
-
- public void destroy() {
- DebuggingService.getInstance().removePortInstance(this);
- super.destroy();
- }
-
- @Override
- public void receive(Message m) {
- if (!(m instanceof EventMessage))
- return;
- EventMessage msg = (EventMessage) m;
- if (0 < msg.getEvtId() && msg.getEvtId() < MSG_MAX) {
- DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
- switch (msg.getEvtId()) {
- case OUT_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);
- }
- }
- break;
- case OUT_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);
- }
- }
- break;
- default:
- if (msg instanceof EventWithDataMessage)
- getActor().receiveEvent(this, msg.getEvtId(), ((EventWithDataMessage)msg).getData());
- else
- getActor().receiveEvent(this, msg.getEvtId(), null);
- }
- }
- }
-
- /*--------------------- attributes ---------------------*/
- /* --------------------- attribute setters and getters */
- /*--------------------- operations ---------------------*/
- public void startTimer(int time_ms) {
-
- 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)));
- }
- public void startTimeout(int time_ms) {
-
- 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)));
- }
-
- // sent messages
- public void kill() {
- //conjugated PortClass kill
- if (active) {
- active = false;
- TimerData td = new TimerData();
- td.setId(currentId);
- getPeerMsgReceiver().receive(
- new EventWithDataMessage(getPeerAddress(), IN_kill, td));
- }
- }
- private void internalStartTimer(TimerData td) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimer]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimer, td.deepCopy()));
- }
- public void internalStartTimer(int time, int id) {
- internalStartTimer(new TimerData(time, id));
- }
- private void internalStartTimeout(TimerData td) {
- DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_internalStartTimeout]);
- if (getPeerAddress()!=null)
- getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalStartTimeout, td.deepCopy()));
- }
- public void internalStartTimeout(int time, int id) {
- internalStartTimeout(new TimerData(time, id));
- }
- }
-
- // replicated port class
- static public class PTimerConjReplPort extends ReplicatedPortBase {
-
- public PTimerConjReplPort(IInterfaceItemOwner actor, String name, int localId) {
- super(actor, name, localId);
- }
-
- public int getReplication() {
- return getNInterfaceItems();
- }
-
- public int getIndexOf(InterfaceItemBase ifitem){
- return ifitem.getIdx();
- }
-
- public PTimerConjPort get(int idx) {
- return (PTimerConjPort) getInterfaceItem(idx);
- }
-
- protected InterfaceItemBase createInterfaceItem(IInterfaceItemOwner rcv, String name, int lid, int idx) {
- return new PTimerConjPort(rcv, name, lid, idx);
- }
-
- // incoming messages
- public void kill(){
- for (InterfaceItemBase item : getItems()) {
- ((PTimerConjPort)item).kill();
- }
- }
- private void internalStartTimer(TimerData td){
- for (InterfaceItemBase item : getItems()) {
- ((PTimerConjPort)item).internalStartTimer( td);
- }
- }
- private void internalStartTimeout(TimerData td){
- for (InterfaceItemBase item : getItems()) {
- ((PTimerConjPort)item).internalStartTimeout( td);
- }
- }
- }
-
-}
diff --git a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/TimerData.java b/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/TimerData.java
deleted file mode 100644
index 158115272..000000000
--- a/runtime/org.eclipse.etrice.modellib.java/src-gen/room/basic/service/timing/TimerData.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package room.basic.service.timing;
-
-import static org.eclipse.etrice.runtime.java.etunit.EtUnit.*;
-import java.io.Serializable;
-
-
-
-
-public class TimerData implements Serializable {
-
- private static final long serialVersionUID = 633780889L;
-
-
- /*--------------------- attributes ---------------------*/
- int time;
- int id;
-
- /* --------------------- attribute setters and getters */
- public void setTime (int time) {
- this.time = time;
- }
- public int getTime () {
- return this.time;
- }
- public void setId (int id) {
- this.id = id;
- }
- public int getId () {
- return this.id;
- }
-
- /*--------------------- operations ---------------------*/
-
- // default constructor
- public TimerData() {
- super();
-
- // initialize attributes
- }
-
- // constructor using fields
- public TimerData(int time, int id) {
- super();
-
- this.time = time;
- this.id = id;
- }
-
- // deep copy
- public TimerData deepCopy() {
- TimerData copy = new TimerData();
- copy.time = time;
- copy.id = id;
- return copy;
- }
-};

Back to the top