Skip to content

Commit

Permalink
refactor(cbus): split up applications in sub mspecs
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Jul 26, 2022
1 parent 6021471 commit b7fb2d6
Show file tree
Hide file tree
Showing 18 changed files with 2,471 additions and 2,169 deletions.
4 changes: 2 additions & 2 deletions plc4go/protocols/cbus/readwrite/ParserHelper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions plc4go/protocols/cbus/readwrite/XmlParserHelper.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions protocols/c-bus/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@
<artifactId>plc4x-code-generation-protocol-base-mspec</artifactId>
<version>0.10.0-SNAPSHOT</version>
</dependency>

<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,80 @@
import org.apache.plc4x.plugins.codegenerator.protocol.Protocol;
import org.apache.plc4x.plugins.codegenerator.protocol.TypeContext;
import org.apache.plc4x.plugins.codegenerator.types.exceptions.GenerationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class CBusProtocol implements Protocol, ProtocolHelpers {

private static final Logger LOGGER = LoggerFactory.getLogger(CBusProtocol.class);

@Override
public String getName() {
return "c-bus";
}

@Override
public TypeContext getTypeContext() throws GenerationException {
ValidatableTypeContext typeContext = new MessageFormatParser().parse(getMspecStream());
ValidatableTypeContext typeContext;
String mspecName;

mspecName = getName() + "_lighting_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName));

mspecName = getName() + "_security_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_metering_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_trigger_control_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_enable_control_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_temperature_broadcast_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_access_control_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_media_transport_control_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_clock_and_timekeeping_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_telephony_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_air_conditioning_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_measurement_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

mspecName = getName() + "_error_reporting_application";
LOGGER.info("Parsing: {}.mspec", mspecName);
typeContext = new MessageFormatParser().parse(getMspecStream(mspecName), typeContext);

LOGGER.info("Parsing: c-bus.mspec");
typeContext = new MessageFormatParser().parse(getMspecStream(), typeContext);

typeContext.validate();

return typeContext;
}

Expand Down
Loading

0 comments on commit b7fb2d6

Please sign in to comment.