Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenrik Rentz-Reichert2012-02-20 12:29:41 +0000
committerHenrik Rentz-Reichert2012-02-20 12:29:41 +0000
commit6ec755817dbe5c1d83c697a9a99dfa14348877bb (patch)
tree7ba481e00c1c463471b9dce5fed1ea3a8b1a3ad2 /runtime
parent0e65f36df8f6230800ab0792f5adcf2350d63c1e (diff)
downloadorg.eclipse.etrice-6ec755817dbe5c1d83c697a9a99dfa14348877bb.tar.gz
org.eclipse.etrice-6ec755817dbe5c1d83c697a9a99dfa14348877bb.tar.xz
org.eclipse.etrice-6ec755817dbe5c1d83c697a9a99dfa14348877bb.zip
[modellib] re-generated
Diffstat (limited to 'runtime')
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java83
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java53
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java270
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java70
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java272
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java63
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java227
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java3
-rw-r--r--runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java3
9 files changed, 1038 insertions, 6 deletions
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java
new file mode 100644
index 000000000..5e1106c73
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketConfiguration.java
@@ -0,0 +1,83 @@
+package org.eclipse.etrice.modellib.Socket;
+
+
+
+
+public class DSocketConfiguration {
+
+
+ //--------------------- attributes
+ protected String serverName;
+ protected int portNumber;
+ protected int protocol;
+ protected boolean checkCookie;
+ protected int mode;
+
+ //--------------------- attribute setters and getters
+ public void setServerName (String serverName) {
+ this.serverName = serverName;
+ }
+ public String getServerName () {
+ return this.serverName;
+ }
+ public void setPortNumber (int portNumber) {
+ this.portNumber = portNumber;
+ }
+ public int getPortNumber () {
+ return this.portNumber;
+ }
+ public void setProtocol (int protocol) {
+ this.protocol = protocol;
+ }
+ public int getProtocol () {
+ return this.protocol;
+ }
+ public void setCheckCookie (boolean checkCookie) {
+ this.checkCookie = checkCookie;
+ }
+ public boolean getCheckCookie () {
+ return this.checkCookie;
+ }
+ public void setMode (int mode) {
+ this.mode = mode;
+ }
+ public int getMode () {
+ return this.mode;
+ }
+
+ //--------------------- operations
+
+ // default constructor
+ public DSocketConfiguration() {
+ super();
+
+ // initialize attributes
+ serverName = "";
+ portNumber = 0;
+ protocol = 0;
+ checkCookie = false;
+ mode = 0;
+ }
+
+ // constructor using fields
+ public DSocketConfiguration(String serverName, int portNumber, int protocol, boolean checkCookie, int mode) {
+ super();
+
+ this.serverName = serverName;
+ this.portNumber = portNumber;
+ this.protocol = protocol;
+ this.checkCookie = checkCookie;
+ this.mode = mode;
+ }
+
+ // deep copy
+ public DSocketConfiguration deepCopy() {
+ DSocketConfiguration copy = new DSocketConfiguration();
+ copy.serverName = serverName;
+ copy.portNumber = portNumber;
+ copy.protocol = protocol;
+ copy.checkCookie = checkCookie;
+ copy.mode = mode;
+ return copy;
+ }
+};
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java
new file mode 100644
index 000000000..d2972a986
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/DSocketData.java
@@ -0,0 +1,53 @@
+package org.eclipse.etrice.modellib.Socket;
+
+
+
+
+public class DSocketData {
+
+
+ //--------------------- attributes
+ protected int size;
+ protected String data;
+
+ //--------------------- attribute setters and getters
+ public void setSize (int size) {
+ this.size = size;
+ }
+ public int getSize () {
+ return this.size;
+ }
+ public void setData (String data) {
+ this.data = data;
+ }
+ public String getData () {
+ return this.data;
+ }
+
+ //--------------------- operations
+
+ // default constructor
+ public DSocketData() {
+ super();
+
+ // initialize attributes
+ size = 0;
+ data = "";
+ }
+
+ // constructor using fields
+ public DSocketData(int size, String data) {
+ super();
+
+ this.size = size;
+ this.data = data;
+ }
+
+ // deep copy
+ public DSocketData deepCopy() {
+ DSocketData copy = new DSocketData();
+ copy.size = size;
+ copy.data = data;
+ return copy;
+ }
+};
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
new file mode 100644
index 000000000..a52561e58
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/PSocket.java
@@ -0,0 +1,270 @@
+package org.eclipse.etrice.modellib.Socket;
+
+import java.util.ArrayList;
+
+import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.Message;
+import org.eclipse.etrice.runtime.java.modelbase.*;
+import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
+
+
+
+public class PSocket {
+ // message IDs
+ public static final int MSG_MIN = 0;
+ public static final int OUT_connected = 1;
+ public static final int OUT_disconnected = 2;
+ public static final int OUT_receivedData = 3;
+ public static final int OUT_sentData = 4;
+ public static final int OUT_error = 5;
+ public static final int IN_connect = 6;
+ public static final int IN_disconnect = 7;
+ public static final int IN_sendData = 8;
+ public static final int MSG_MAX = 9;
+
+
+ private static String messageStrings[] = {"MIN", "connected","disconnected","receivedData","sentData","error", "connect","disconnect","sendData","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 PSocketPort extends PortBase {
+ // constructors
+ public PSocketPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
+ super(actor, name, localId, 0, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+ public PSocketPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
+ super(actor, name, localId, idx, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+
+ @Override
+ public void receive(Message m) {
+ if (!(m instanceof EventMessage))
+ return;
+ EventMessage msg = (EventMessage) m;
+ if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
+ System.out.println("unknown");
+ else {
+ if (messageStrings[msg.getEvtId()] != "timerTick"){
+ 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 connected() {
+ if (messageStrings[ OUT_connected] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_connected]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_connected));
+ }
+ public void disconnected() {
+ if (messageStrings[ OUT_disconnected] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_disconnected]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_disconnected));
+ }
+ public void receivedData() {
+ if (messageStrings[ OUT_receivedData] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_receivedData]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_receivedData));
+ }
+ public void sentData() {
+ if (messageStrings[ OUT_sentData] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_sentData]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_sentData));
+ }
+ public void error() {
+ if (messageStrings[ OUT_error] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_error]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), OUT_error));
+ }
+ }
+
+ // replicated port class
+ static public class PSocketPortRepl {
+ private ArrayList<PSocketPort> ports;
+ private int replication;
+
+ public PSocketPortRepl(IEventReceiver actor, String name, int localId, Address[] addr,
+ Address[] peerAddress) {
+ replication = addr.length;
+ ports = new ArrayList<PSocket.PSocketPort>(replication);
+ for (int i=0; i<replication; ++i) {
+ ports.add(new PSocketPort(
+ actor, name+i, localId, i, addr[i], peerAddress[i]));
+ }
+ }
+
+ public int getReplication() {
+ return replication;
+ }
+
+ public int getIndexOf(InterfaceItemBase ifitem){
+ return ifitem.getIdx();
+ }
+
+ public PSocketPort get(int i) {
+ return ports.get(i);
+ }
+
+ // outgoing messages
+ public void connected(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).connected();
+ }
+ }
+ public void disconnected(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).disconnected();
+ }
+ }
+ public void receivedData(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).receivedData();
+ }
+ }
+ public void sentData(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).sentData();
+ }
+ }
+ public void error(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).error();
+ }
+ }
+ }
+
+
+ // port class
+ static public class PSocketConjPort extends PortBase {
+ // constructors
+ public PSocketConjPort(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
+ super(actor, name, localId, 0, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+ public PSocketConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
+ super(actor, name, localId, idx, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+
+ @Override
+ public void receive(Message m) {
+ if (!(m instanceof EventMessage))
+ return;
+ EventMessage msg = (EventMessage) m;
+ if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
+ System.out.println("unknown");
+ else {
+ if (messageStrings[msg.getEvtId()] != "timerTick"){
+ 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 connect(DSocketConfiguration config) {
+ if (messageStrings[ IN_connect] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_connect]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_connect, config.deepCopy()));
+ }
+ public void connect(String serverName, int portNumber, int protocol, boolean checkCookie, int mode) {
+ connect(new DSocketConfiguration(serverName, portNumber, protocol, checkCookie, mode));
+ }
+ public void disconnect() {
+ if (messageStrings[ IN_disconnect] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_disconnect]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_disconnect));
+ }
+ public void sendData(DSocketData data) {
+ if (messageStrings[ IN_sendData] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_sendData]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_sendData, data.deepCopy()));
+ }
+ public void sendData(int size, String data) {
+ sendData(new DSocketData(size, data));
+ }
+ }
+
+ // replicated port class
+ static public class PSocketConjPortRepl {
+ private ArrayList<PSocketConjPort> ports;
+ private int replication;
+
+ public PSocketConjPortRepl(IEventReceiver actor, String name, int localId, Address[] addr,
+ Address[] peerAddress) {
+ replication = addr.length;
+ ports = new ArrayList<PSocket.PSocketConjPort>(replication);
+ for (int i=0; i<replication; ++i) {
+ ports.add(new PSocketConjPort(
+ actor, name+i, localId, i, addr[i], peerAddress[i]));
+ }
+ }
+
+ public int getReplication() {
+ return replication;
+ }
+
+ public int getIndexOf(InterfaceItemBase ifitem){
+ return ifitem.getIdx();
+ }
+
+ public PSocketConjPort get(int i) {
+ return ports.get(i);
+ }
+
+ // incoming messages
+ public void connect(DSocketConfiguration config){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).connect( config);
+ }
+ }
+ public void disconnect(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).disconnect();
+ }
+ }
+ public void sendData(DSocketData data){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).sendData( data);
+ }
+ }
+ }
+
+}
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java
new file mode 100644
index 000000000..ea7c3b2eb
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/org/eclipse/etrice/modellib/Socket/SocketClient.java
@@ -0,0 +1,70 @@
+package org.eclipse.etrice.modellib.Socket;
+
+import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.IRTObject;
+import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
+import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
+import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
+import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
+import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
+
+
+import org.eclipse.etrice.modellib.Socket.PSocket.*;
+
+
+
+public class SocketClient extends ActorClassBase {
+
+
+ //--------------------- ports
+ protected PSocketPort fct = null;
+ //--------------------- saps
+ //--------------------- services
+
+ //--------------------- interface item IDs
+ public static final int IFITEM_fct = 1;
+
+ //--------------------- attributes
+ //--------------------- operations
+
+ //--------------------- construction
+ public SocketClient(IRTObject parent, String name, Address[][] port_addr, Address[][] peer_addr){
+ super(parent, name, port_addr[0][0], peer_addr[0][0]);
+ setClassName("SocketClient");
+
+ // initialize attributes
+
+ // own ports
+ fct = new PSocketPort(this, "fct", IFITEM_fct, 0, port_addr[IFITEM_fct][0], peer_addr[IFITEM_fct][0]);
+ // own saps
+ // own service implementations
+ }
+
+
+ //--------------------- lifecycle functions
+ public void init(){
+ initUser();
+ }
+
+ public void start(){
+ startUser();
+ }
+
+ public void stop(){
+ stopUser();
+ }
+
+ public void destroy(){
+ destroyUser();
+ }
+
+ //--------------------- no state machine
+ @Override
+ public void receiveEvent(InterfaceItemBase ifitem, int evt, Object data) {
+ handleSystemEvent(ifitem, evt, data);
+ }
+
+ @Override
+ public void executeInitTransition(){
+ }
+};
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java
new file mode 100644
index 000000000..1f124a84a
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/ALogService.java
@@ -0,0 +1,272 @@
+package room.basic.service.logging;
+
+import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.IRTObject;
+import org.eclipse.etrice.runtime.java.messaging.IMessageReceiver;
+import org.eclipse.etrice.runtime.java.modelbase.ActorClassBase;
+import org.eclipse.etrice.runtime.java.modelbase.SubSystemClassBase;
+import org.eclipse.etrice.runtime.java.modelbase.InterfaceItemBase;
+import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
+
+
+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 LogPortRepl log = null;
+
+ //--------------------- 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, Address[][] port_addr, Address[][] peer_addr){
+ super(parent, name, port_addr[0][0], peer_addr[0][0]);
+ setClassName("ALogService");
+
+ // initialize attributes
+
+ // own ports
+ // own saps
+ // own service implementations
+ log = new LogPortRepl(this, "log", IFITEM_log, port_addr[IFITEM_log], peer_addr[IFITEM_log]);
+ }
+
+
+ //--------------------- lifecycle functions
+ public void init(){
+ initUser();
+ }
+
+ public void start(){
+ startUser();
+ }
+
+ public void stop(){
+ stopUser();
+ }
+
+ public void destroy(){
+ destroyUser();
+ }
+
+
+ /* state IDs */
+ public static final int STATE_closed = 2;
+ public static final int STATE_opened = 3;
+
+ /* transition chains */
+ public static final int CHAIN_TRANS_INITIAL_TO__closed = 1;
+ public static final int CHAIN_TRANS_closed_TO_opened_BY_openlog = 2;
+ public static final int CHAIN_TRANS_opened_TO_closed_BY_closelog = 3;
+ public static final int CHAIN_TRANS_opened_TO_opened_BY_internalLoglog_tr1 = 4;
+
+ /* triggers */
+ 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;
+ public static final int TRIG_log__open = IFITEM_log + EVT_SHIFT*Log.IN_open;
+
+ // 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]);
+ if (stateStrings[new_state]!="Idle") {
+ System.out.println(getInstancePath() + " -> " + stateStrings[new_state]);
+ }
+ this.state = new_state;
+ }
+
+ //*** Entry and Exit Codes
+
+ //*** Action Codes
+ protected void action_TRANS_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_opened_TO_closed_BY_closelog(InterfaceItemBase ifitem) {
+ p.flush();
+ p.close();
+ p=null;
+ }
+ protected void action_TRANS_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 - the current state
+ * @param to - the final parent state
+ * @param handler - entry and exit codes are called only if not handler (for handler TransitionPoints)
+ */
+ private void exitTo(int current, int to, boolean handler) {
+ while (current!=to) {
+ switch (current) {
+ case STATE_closed:
+ this.history[STATE_TOP] = STATE_closed;
+ current = STATE_TOP;
+ break;
+ case STATE_opened:
+ this.history[STATE_TOP] = STATE_opened;
+ current = STATE_TOP;
+ 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 - the chain ID
+ * @param generic_data - the generic data pointer
+ * @return the ID of the final state
+ */
+ private int executeTransitionChain(int chain, InterfaceItemBase ifitem, Object generic_data) {
+ switch (chain) {
+ case CHAIN_TRANS_INITIAL_TO__closed:
+ {
+ return STATE_closed;
+ }
+ case CHAIN_TRANS_closed_TO_opened_BY_openlog:
+ {
+ String fileName = (String) generic_data;
+ action_TRANS_closed_TO_opened_BY_openlog(ifitem, fileName);
+ return STATE_opened;
+ }
+ case CHAIN_TRANS_opened_TO_closed_BY_closelog:
+ {
+ action_TRANS_opened_TO_closed_BY_closelog(ifitem);
+ return STATE_closed;
+ }
+ case CHAIN_TRANS_opened_TO_opened_BY_internalLoglog_tr1:
+ {
+ InternalLogData data = (InternalLogData) generic_data;
+ action_TRANS_opened_TO_opened_BY_internalLoglog_tr1(ifitem, data);
+ return STATE_opened;
+ }
+ }
+ return NO_STATE;
+ }
+
+ /**
+ * calls entry codes while entering a state's history. The ID of the final leaf state is returned
+ * @param state - the state which is entered
+ * @param handler - entry code is executed if not handler
+ * @return - the ID of the final leaf state
+ */
+ private int enterHistory(int state, boolean handler, boolean skip_entry) {
+ while (true) {
+ switch (state) {
+ 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 = this.history[STATE_TOP];
+ break;
+ }
+ skip_entry = false;
+ }
+ //return NO_STATE; // required by CDT but detected as unreachable by JDT because of while (true)
+ }
+
+ public void executeInitTransition() {
+ int chain = CHAIN_TRANS_INITIAL_TO__closed;
+ int next = executeTransitionChain(chain, null, null);
+ next = enterHistory(next, false, false);
+ setState(next);
+ }
+
+ /* receiveEvent contains the main implementation of the FSM */
+ public void receiveEvent(InterfaceItemBase ifitem, int evt, Object generic_data) {
+ int trigger = ifitem.getLocalId() + EVT_SHIFT*evt;
+ int chain = NOT_CAUGHT;
+ int catching_state = NO_STATE;
+ boolean is_handler = false;
+ boolean skip_entry = false;
+
+ if (!handleSystemEvent(ifitem, evt, generic_data)) {
+ switch (this.state) {
+ case STATE_closed:
+ switch(trigger) {
+ case TRIG_log__open:
+ {
+ chain = CHAIN_TRANS_closed_TO_opened_BY_openlog;
+ catching_state = STATE_TOP;
+ }
+ break;
+ }
+ break;
+ case STATE_opened:
+ switch(trigger) {
+ case TRIG_log__close:
+ {
+ chain = CHAIN_TRANS_opened_TO_closed_BY_closelog;
+ catching_state = STATE_TOP;
+ }
+ break;
+ case TRIG_log__internalLog:
+ {
+ chain = CHAIN_TRANS_opened_TO_opened_BY_internalLoglog_tr1;
+ catching_state = STATE_TOP;
+ }
+ break;
+ }
+ break;
+ }
+ }
+ if (chain != NOT_CAUGHT) {
+ exitTo(this.state, catching_state, is_handler);
+ int next = executeTransitionChain(chain, ifitem, generic_data);
+ next = enterHistory(next, is_handler, skip_entry);
+ setState(next);
+ }
+ }
+
+ //******************************************
+ // END of generated code for FSM
+ //******************************************
+};
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java
new file mode 100644
index 000000000..29e88a363
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/InternalLogData.java
@@ -0,0 +1,63 @@
+package room.basic.service.logging;
+
+
+
+
+public class InternalLogData {
+
+
+ //--------------------- attributes
+ protected String userString;
+ protected String sender;
+ protected 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
+ userString = "";
+ sender = "";
+ timeStamp = 0;
+ }
+
+ // 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/src-gen/room/basic/service/logging/Log.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
new file mode 100644
index 000000000..efbb493f6
--- /dev/null
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/logging/Log.java
@@ -0,0 +1,227 @@
+package room.basic.service.logging;
+
+import java.util.ArrayList;
+
+import org.eclipse.etrice.runtime.java.messaging.Address;
+import org.eclipse.etrice.runtime.java.messaging.Message;
+import org.eclipse.etrice.runtime.java.modelbase.*;
+import org.eclipse.etrice.runtime.java.debugging.DebuggingService;
+
+
+
+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(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
+ super(actor, name, localId, 0, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+ public LogPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
+ super(actor, name, localId, idx, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+
+ @Override
+ public void receive(Message m) {
+ if (!(m instanceof EventMessage))
+ return;
+ EventMessage msg = (EventMessage) m;
+ if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
+ System.out.println("unknown");
+ else {
+ if (messageStrings[msg.getEvtId()] != "timerTick"){
+ 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 LogPortRepl {
+ private ArrayList<LogPort> ports;
+ private int replication;
+
+ public LogPortRepl(IEventReceiver actor, String name, int localId, Address[] addr,
+ Address[] peerAddress) {
+ replication = addr.length;
+ ports = new ArrayList<Log.LogPort>(replication);
+ for (int i=0; i<replication; ++i) {
+ ports.add(new LogPort(
+ actor, name+i, localId, i, addr[i], peerAddress[i]));
+ }
+ }
+
+ public int getReplication() {
+ return replication;
+ }
+
+ public int getIndexOf(InterfaceItemBase ifitem){
+ return ifitem.getIdx();
+ }
+
+ public LogPort get(int i) {
+ return ports.get(i);
+ }
+
+ // 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(IEventReceiver actor, String name, int localId, Address addr, Address peerAddress) {
+ super(actor, name, localId, 0, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+ public LogConjPort(IEventReceiver actor, String name, int localId, int idx, Address addr, Address peerAddress) {
+ super(actor, name, localId, idx, addr, peerAddress);
+ DebuggingService.getInstance().addPortInstance(this);
+ }
+
+ @Override
+ public void receive(Message m) {
+ if (!(m instanceof EventMessage))
+ return;
+ EventMessage msg = (EventMessage) m;
+ if (msg.getEvtId() <= 0 || msg.getEvtId() >= MSG_MAX)
+ System.out.println("unknown");
+ else {
+ if (messageStrings[msg.getEvtId()] != "timerTick"){
+ 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
+ //--------------------- operations
+ public void setLogLevel(int l) {
+ logLevel=l;
+ if (logLevel > LOG_LEVEL_HIGH) logLevel=LOG_LEVEL_HIGH;
+ }
+ public void log(int logLevel, String userString) {
+ long s;
+ if (logLevel>this.logLevel){
+ d.userString=userString;
+ d.timeStamp=System.currentTimeMillis();
+ d.sender=getInstancePath();
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_internalLog, d));
+ }
+ }
+
+ // sent messages
+ public void open(String fileName) {
+ if (messageStrings[ IN_open] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_open]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventWithDataMessage(getPeerAddress(), IN_open, fileName));
+ }
+ public void close() {
+ if (messageStrings[ IN_close] != "timerTick"){
+ DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[IN_close]);
+ }
+ if (getPeerAddress()!=null)
+ getPeerMsgReceiver().receive(new EventMessage(getPeerAddress(), IN_close));
+ }
+ private void internalLog(InternalLogData data) {
+ if (messageStrings[ IN_internalLog] != "timerTick"){
+ 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 LogConjPortRepl {
+ private ArrayList<LogConjPort> ports;
+ private int replication;
+
+ public LogConjPortRepl(IEventReceiver actor, String name, int localId, Address[] addr,
+ Address[] peerAddress) {
+ replication = addr.length;
+ ports = new ArrayList<Log.LogConjPort>(replication);
+ for (int i=0; i<replication; ++i) {
+ ports.add(new LogConjPort(
+ actor, name+i, localId, i, addr[i], peerAddress[i]));
+ }
+ }
+
+ public int getReplication() {
+ return replication;
+ }
+
+ public int getIndexOf(InterfaceItemBase ifitem){
+ return ifitem.getIdx();
+ }
+
+ public LogConjPort get(int i) {
+ return ports.get(i);
+ }
+
+ // incoming messages
+ public void open(String fileName){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).open( fileName);
+ }
+ }
+ public void close(){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).close();
+ }
+ }
+ private void internalLog(InternalLogData data){
+ for (int i=0; i<replication; ++i) {
+ ports.get(i).internalLog( data);
+ }
+ }
+ }
+
+}
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
index 3f06d4ae0..7656628f2 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimeout.java
@@ -96,7 +96,6 @@ public class PTimeout {
System.out.println("unknown");
else {
if (messageStrings[msg.getEvtId()] != "timerTick"){
- // TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
}
switch (msg.getEvtId()) {
@@ -142,7 +141,6 @@ public class PTimeout {
// sent messages
public void timeoutTick() {
if (messageStrings[ OUT_timeoutTick] != "timerTick"){
- // TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_timeoutTick]);
}
if (getPeerAddress()!=null)
@@ -211,7 +209,6 @@ public class PTimeout {
System.out.println("unknown");
else {
if (messageStrings[msg.getEvtId()] != "timerTick"){
- // TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
}
switch (msg.getEvtId()) {
diff --git a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
index aaa64e4bc..7eb3a2ea1 100644
--- a/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
+++ b/runtime/org.eclipse.etrice.modellib/src-gen/room/basic/service/timing/PTimer.java
@@ -96,7 +96,6 @@ public class PTimer {
System.out.println("unknown");
else {
if (messageStrings[msg.getEvtId()] != "timerTick"){
- // TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
}
switch (msg.getEvtId()) {
@@ -142,7 +141,6 @@ public class PTimer {
// sent messages
public void timerTick() {
if (messageStrings[ OUT_timerTick] != "timerTick"){
- // TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncOut(getAddress(), getPeerAddress(), messageStrings[OUT_timerTick]);
}
if (getPeerAddress()!=null)
@@ -211,7 +209,6 @@ public class PTimer {
System.out.println("unknown");
else {
if (messageStrings[msg.getEvtId()] != "timerTick"){
- // TODOTS: model switch for activation
DebuggingService.getInstance().addMessageAsyncIn(getPeerAddress(), getAddress(), messageStrings[msg.getEvtId()]);
}
switch (msg.getEvtId()) {

Back to the top