Commit 00c16ca6 authored by Alexander David Hellwig's avatar Alexander David Hellwig

Merge branch '23-tag-parsing' into 'master'

Prepare for hand in

See merge request !6
parents ac244fc5 f4bd0ef2
Pipeline #186122 passed with stage
in 2 minutes and 54 seconds
......@@ -3,11 +3,11 @@
A project that generates a SomeIP-Adapter for EmbeddedMontiArcMath components.
### Install SOME/IP:
## Install SOME/IP:
Get vsomeip from: https://github.com/GENIVI/vsomeip
Build instruction is in the readme on the site, short summary:
Build instruction and further documentation is in the readme on the site, short summary of the install instruction:
- A C++11 enabled compiler like gcc >= 4.8 is needed.
- vsomeip uses CMake as buildsystem.
- vsomeip uses Boost (boost.org), version has to be >= 1.55 and < 1.66:
......@@ -32,13 +32,30 @@ If build fails, try to apply this fix:
https://github.com/GENIVI/vsomeip/issues/25
Summary of the fix:
Replace "return &sockaddr;" with "return reinterpret_cast<struct sockaddr*>(&sockaddr);"
in the file: implementation/endpoints/include/netlink_connector.hpp
##### Build the documentation:
To build the documentation asciidoc, source-highlight, doxygen and graphviz is needed:
To build the documentation (after building vsomeip) asciidoc, source-highlight, doxygen and graphviz are needed:
```bash
sudo apt-get install asciidoc source-highlight doxygen graphviz
make doc
```
## Use SOME/IP:
One example which uses SOME/IP can be found in the example folder. Building it with cmake will produce two executables, publisher and subscriber. In this example, the publisher publishes the double 2.5, which will be printed to the standard out of the subscriber . One way to try it is by executing the files in two different consoles, starting with the publisher.
#### Use SOME/IP with docker:
A docker image with installed vsomeip can be found in the container registry of this project. The docker image can also be produced by using the dockerfile in the docker folder.
## Install and use the project
The SomeIP-Adapter can be installed and used with maven and java, using the command
```bash
mvn clean install -s settings.xml
```
The project uses Freemarker template to produce the adapter files, which are built in target/generated-sources.
......@@ -10,8 +10,8 @@ include_directories (
${VSOMEIP_INCLUDE_DIRS}
)
add_executable(service-example ../src/service-example.cpp)
target_link_libraries(service-example vsomeip ${Boost_LIBRARIES})
add_executable(client-example ../src/client-example.cpp)
target_link_libraries(client-example vsomeip ${Boost_LIBRARIES})
add_executable(publisher ../src/publisher.cpp)
target_link_libraries(publisher vsomeip ${Boost_LIBRARIES})
add_executable(subscriber ../src/subscriber.cpp)
target_link_libraries(subscriber vsomeip ${Boost_LIBRARIES})
......@@ -20,6 +20,10 @@ public class GeneratorSomeIP {
public void setGenerationTargetPath(String generationTargetPath) {
this.generationTargetPath = generationTargetPath.endsWith("/") ? generationTargetPath : generationTargetPath + "/";
File directory = new File(generationTargetPath);
directory.mkdirs();
}
......
/* (c) https://github.com/MontiCore/monticore */
package de.monticore.lang.monticar.generator.someip.helper;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.cncModel.EMAPortSymbol;
import de.monticore.lang.embeddedmontiarc.embeddedmontiarc._symboltable.instanceStructure.EMAComponentInstanceSymbol;
import de.monticore.lang.embeddedmontiarc.tagging.middleware.someip.SomeIPConnectionSymbol;
import de.monticore.lang.tagging._symboltable.TagSymbol;
import de.monticore.lang.tagging._symboltable.TaggingResolver;
import java.util.*;
public class SomeIPTagHelper {
private SomeIPTagHelper() {
}
public static Map<EMAPortSymbol, SomeIPConnectionSymbol> resolveTags(TaggingResolver taggingResolver, EMAComponentInstanceSymbol componentInstanceSymbol) {
Map<EMAPortSymbol, SomeIPConnectionSymbol> someIPConnectionSymbols = new HashMap<>();
componentInstanceSymbol.getPortInstanceList().forEach(p -> {
Collection<TagSymbol> tmpTags = taggingResolver.getTags(p, SomeIPConnectionSymbol.KIND);
if (tmpTags.size() == 1) {
someIPConnectionSymbols.put(p, (SomeIPConnectionSymbol) tmpTags.iterator().next());
}
});
componentInstanceSymbol.getSubComponents().forEach(sc -> someIPConnectionSymbols.putAll(SomeIPTagHelper.resolveTags(taggingResolver, sc)));
return someIPConnectionSymbols;
}
}
\ No newline at end of file
......@@ -107,8 +107,10 @@ public class AbstractSymtabTest {
}
lines1 = discardEmptyLines(lines1);
lines1 = discardCommentLines(lines1);
lines1 = discardCopyrightNotice(lines1);
lines2 = discardEmptyLines(lines2);
lines2 = discardCommentLines(lines2);
lines2 = discardCopyrightNotice(lines2);
if (lines1.size() != lines2.size()) {
Assert.fail(
"files have different number of lines: "
......@@ -133,6 +135,12 @@ public class AbstractSymtabTest {
return true;
}
private static List<String> discardCopyrightNotice(List<String> lines) {
return lines.stream()
.filter(l -> !l.contains("(c) https://github.com/MontiCore/monticore"))
.collect(Collectors.toList());
}
private static List<String> discardEmptyLines(List<String> lines) {
return lines.stream()
.map(String::trim)
......
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