Commit 89a8a818 authored by Alexander David Hellwig's avatar Alexander David Hellwig

Merge branch 'dev' into 'master'

Add MQTT MiddlewareSymbol to EmbeddedMontiArc

See merge request !15
parents ffd664b9 97fa6f0a
Pipeline #153669 passed with stage
in 2 minutes and 32 seconds
This diff is collapsed.
......@@ -24,6 +24,7 @@ import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instance
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.unit.constant.EMAConstantValue;
import de.monticore.lang.embeddedmontiarc.helper.SymbolPrinter;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.MiddlewareSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.mqtt.MqttConnectionSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol;
import de.monticore.lang.monticar.stream._symboltable.NamedStreamSymbol;
import de.monticore.lang.monticar.ts.MCTypeSymbol;
......@@ -292,4 +293,8 @@ public class EMAPortSymbol extends CommonSymbol implements EMAElementSymbol {
public boolean isRosPort(){
return getMiddlewareSymbol().isPresent() && getMiddlewareSymbol().get().isKindOf(RosConnectionSymbol.KIND);
}
public boolean isMqttPort() {
return getMiddlewareSymbol().isPresent() && getMiddlewareSymbol().get().isKindOf(MqttConnectionSymbol.KIND);
}
}
......@@ -26,6 +26,7 @@ import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc.unit.constant.EMAConstantValue;
import de.monticore.lang.embeddedmontiarc.helper.SymbolPrinter;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.MiddlewareSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.mqtt.MqttConnectionSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.ros.RosConnectionSymbol;
import de.monticore.lang.monticar.stream._symboltable.NamedStreamSymbol;
import de.monticore.lang.monticar.ts.MCTypeSymbol;
......@@ -278,4 +279,8 @@ public class EMAPortInstanceSymbol extends EMAPortSymbol implements EMAElementIn
public boolean isRosPort(){
return getMiddlewareSymbol().isPresent() && getMiddlewareSymbol().get().isKindOf(RosConnectionSymbol.KIND);
}
public boolean isMqttPort() {
return getMiddlewareSymbol().isPresent() && getMiddlewareSymbol().get().isKindOf(MqttConnectionSymbol.KIND);
}
}
package de.monticore.lang.embeddedmontiarc.tagging.middleware.mqtt;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.MiddlewareSymbol;
import de.monticore.lang.tagging._symboltable.TagKind;
import java.util.Optional;
public class MqttConnectionSymbol extends MiddlewareSymbol {
public static final MqttConnectionKind KIND = MqttConnectionKind.INSTANCE;
public MqttConnectionSymbol() {
super(KIND, Optional.empty(), Optional.empty());
}
public MqttConnectionSymbol(String topicName) {
this(KIND, topicName);
}
public MqttConnectionSymbol(MqttConnectionKind kind, String topicName) {
super(kind, Optional.ofNullable(topicName), Optional.empty());
}
public MqttConnectionSymbol(String topicName, String msgField) {
this(KIND, topicName, msgField);
}
protected MqttConnectionSymbol(MqttConnectionKind kind, String topicName, String msgField) {
super(kind, Optional.ofNullable(topicName), Optional.ofNullable(msgField));
}
@Override
public String toString() {
return String.format("MqttConnection = %s, %s",
getTopicName(), getMsgField());
}
public Optional<String> getTopicName() {
return getValue(0);
}
public void setTopicName(String topicName) {
this.values.set(0, Optional.ofNullable(topicName));
}
public Optional<String> getMsgField() {
return getValue(1);
}
public void setMsgField(String msgField) {
this.values.set(1, Optional.ofNullable(msgField));
}
public static class MqttConnectionKind extends TagKind {
public static final MqttConnectionKind INSTANCE = new MqttConnectionKind();
protected MqttConnectionKind() {
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment