Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor / improve python modbus #1581

Merged
merged 173 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
a5d746d
fix(plc4py/umas): Start to add write support
hutcheb Mar 7, 2024
ebfe381
build(deps): bump github.com/stretchr/testify in /plc4go (#1439)
dependabot[bot] Mar 11, 2024
02a6f24
build(deps): bump golang.org/x/tools from 0.18.0 to 0.19.0 in /plc4go…
dependabot[bot] Mar 11, 2024
4e1f5bc
build(deps): bump logback.version from 1.5.0 to 1.5.1 (#1435)
dependabot[bot] Mar 11, 2024
f65dbd7
build(deps): bump github.com/gdamore/tcell/v2 in /plc4go (#1438)
dependabot[bot] Mar 11, 2024
eb662d4
build(deps): bump golang.org/x/net from 0.21.0 to 0.22.0 in /plc4go (…
dependabot[bot] Mar 11, 2024
061ebfc
build(deps): bump jakarta.activation:jakarta.activation-api (#1436)
dependabot[bot] Mar 11, 2024
39538e0
fix(plc4j/genericcan) Fix of generic CAN driver and CAN transports af…
splatch Mar 11, 2024
9352b0a
chore: Disabled a flaky test in GO
chrisdutz Mar 13, 2024
539d252
docs: Updated the url for the opie tool
chrisdutz Mar 13, 2024
604ba8a
chore: Updated vendor ids
chrisdutz Mar 13, 2024
22b3099
docs: Added some information on the site plugin and the asciidoctor p…
chrisdutz Mar 13, 2024
0f5f2f4
chore: Updated vendor ids
chrisdutz Mar 13, 2024
5723fad
build: Continued fine-tuning the reproducible build release-scripts.
chrisdutz Mar 13, 2024
52009e3
chore: Updated vendor ids
chrisdutz Mar 13, 2024
8323caf
feat: The S7 driver now returns supporting S7, if the connected devic…
chrisdutz Mar 13, 2024
53adbaf
fix: Fixed logging in the example.
chrisdutz Mar 13, 2024
ba11ff1
refactor: Made the "protocol" accessible in the AbstractPlcConnection
chrisdutz Mar 13, 2024
215d1bf
refactor: Added S7-400 to the list of supported devices.
chrisdutz Mar 13, 2024
49b882d
fix: Fixed the dependency usage error.
chrisdutz Mar 13, 2024
bc874ea
Fix/s7async (#1451)
glcj Mar 15, 2024
575bf83
build(deps): bump com.google.googlejavaformat:google-java-format (#1449)
dependabot[bot] Mar 18, 2024
3a15b84
build(deps): bump logback.version from 1.5.1 to 1.5.3 (#1448)
dependabot[bot] Mar 18, 2024
e295259
build(deps): bump com.gradle:common-custom-user-data-maven-extension …
dependabot[bot] Mar 18, 2024
3b21a8c
Update PlcRawByteArray.java (#1453)
mrwhy-orig Mar 18, 2024
a90e492
chore: Disabled some OPC-UA tests, that were continuously failing the…
chrisdutz Mar 18, 2024
1f20465
chore: Disabled some OPC-UA tests, that were continuously failing the…
chrisdutz Mar 18, 2024
55efeec
feat: Added a new flag allowing to disable tests on Jenkins. Added th…
chrisdutz Mar 18, 2024
f596a26
build(deps-dev): bump org.apache.commons:commons-compress (#1456)
dependabot[bot] Mar 20, 2024
f694abf
build(deps): bump org.awaitility:awaitility from 4.2.0 to 4.2.1 (#1455)
dependabot[bot] Mar 20, 2024
8933491
docs: Added "slave-id" to the description of the unit-identifier.
chrisdutz Mar 21, 2024
195e4ad
chore: Disabled the OpcuaPlcDriverTest as it also seems to regularly …
chrisdutz Mar 21, 2024
0b68f16
build(deps): bump org.springframework.boot:spring-boot-maven-plugin (…
dependabot[bot] Mar 22, 2024
0511e3c
build(deps): bump com.google.errorprone:error_prone_annotations (#1461)
dependabot[bot] Mar 22, 2024
07350bd
build(deps): bump org.springframework.boot:spring-boot-dependencies (…
dependabot[bot] Mar 22, 2024
11920e1
docs: Updated some documentation on the code-generation.
chrisdutz Mar 22, 2024
e594988
refactor: Renamed the paddingField paddingCondition to timesPadding
chrisdutz Mar 22, 2024
ed8dae0
chore: Removed some unneeded code.
chrisdutz Mar 22, 2024
934aa11
chore: Updated vendor ids
chrisdutz Mar 22, 2024
ae38064
chore: Cleaned up in the sandbox
chrisdutz Mar 23, 2024
016ad77
fix(plc4py): type extensions module added to setup.py
hutcheb Mar 23, 2024
80b75aa
fix(plc4py): Move out of sandbox
hutcheb Mar 23, 2024
dab01f0
chore(sandbox): Remove the Sandbox Directory
hutcheb Mar 23, 2024
90d671b
chore(plc4px): Remove manual test
hutcheb Mar 23, 2024
cb5714b
feat(plc4x/modbus): Add support for unit-id option for modbus tags.
splatch Mar 27, 2024
2ea34de
build(deps): bump nl.jqno.equalsverifier:equalsverifier (#1467)
dependabot[bot] Apr 2, 2024
71fb92f
build(deps): bump org.cyclonedx:cyclonedx-maven-plugin (#1466)
dependabot[bot] Apr 2, 2024
508a18c
build(deps): bump org.apache.maven.plugins:maven-remote-resources-plu…
dependabot[bot] Apr 2, 2024
3c03181
build(deps): bump org.aspectj:aspectjweaver from 1.9.21.1 to 1.9.22 (…
dependabot[bot] Apr 3, 2024
3652bb4
build(deps): bump jakarta.xml.bind:jakarta.xml.bind-api (#1474)
dependabot[bot] Apr 3, 2024
86060a1
build(deps): bump com.google.guava:guava from 33.0.0-jre to 33.1.0-jr…
dependabot[bot] Apr 3, 2024
efc10e9
build(deps): bump golang.org/x/net from 0.22.0 to 0.23.0 in /plc4go (…
dependabot[bot] Apr 4, 2024
3c2b30c
build(deps): bump mockito.version from 5.10.0 to 5.11.0 (#1478)
dependabot[bot] Apr 4, 2024
0157fe0
build(deps): bump io.swagger:swagger-annotations from 1.6.13 to 1.6.1…
dependabot[bot] Apr 4, 2024
a47ea37
build(deps): bump org.sonarsource.scanner.maven:sonar-maven-plugin (#…
dependabot[bot] Apr 4, 2024
2489556
Update PlcCHAR.java add Character type check to of method (#1489)
mrwhy-orig Apr 5, 2024
2e3d44b
build(deps): bump golang.org/x/net from 0.23.0 to 0.24.0 in /plc4go (…
dependabot[bot] Apr 5, 2024
da2aa30
build(deps): bump groovy.version from 4.0.18 to 4.0.20 (#1486)
dependabot[bot] Apr 5, 2024
2da79f2
build(deps): bump org.jacoco:jacoco-maven-plugin from 0.8.11 to 0.8.1…
dependabot[bot] Apr 5, 2024
03a2588
build(deps): bump org.apache.maven.plugins:maven-source-plugin (#1484)
dependabot[bot] Apr 5, 2024
6f9bcce
build(deps): bump golang.org/x/tools from 0.19.0 to 0.20.0 in /plc4go…
dependabot[bot] Apr 5, 2024
fb0e145
fix: A compilation error.
chrisdutz Apr 5, 2024
cc17fe5
refactor: Moved the examples, integrations and other extra stuff into…
chrisdutz Apr 5, 2024
820d3aa
fix: Disabling "Trivy Scan" workflow as it's randomy failing and I ca…
chrisdutz Apr 5, 2024
b67f559
chore: Updated the issue-tracker settings to point to GitHub instead …
chrisdutz Apr 5, 2024
33030f9
build(deps): bump nl.jqno.equalsverifier:equalsverifier (#1490)
dependabot[bot] Apr 8, 2024
373fd86
build(deps): bump org.apache.maven.plugins:maven-assembly-plugin (#1491)
dependabot[bot] Apr 8, 2024
e818b67
fix(plc4py): Fix exception on closing the connection
hutcheb Apr 9, 2024
c41e3a3
fix(plc4py): Fix connection lost exception being raised
hutcheb Apr 9, 2024
57c52e6
fix(plc4py): set test to manual
hutcheb Apr 9, 2024
e229c54
fix(plc4py): Got rid of returning future, starting to understand it a…
hutcheb Apr 9, 2024
a238c00
build(deps): bump jakarta.annotation:jakarta.annotation-api (#1494)
dependabot[bot] Apr 9, 2024
a0d41fd
build(deps): bump io.netty:netty-bom from 4.1.107.Final to 4.1.108.Fi…
dependabot[bot] Apr 9, 2024
24e59ef
fix(plc4py): Add to dependabot
hutcheb Apr 9, 2024
bdaacf2
build(deps): bump pytest-mock from 3.12.0 to 3.14.0 in /plc4py (#1501)
dependabot[bot] Apr 9, 2024
65a2325
build(deps): bump identify from 2.5.33 to 2.5.35 in /plc4py (#1500)
dependabot[bot] Apr 9, 2024
9e2fd21
build(deps): bump packaging from 23.2 to 24.0 in /plc4py (#1499)
dependabot[bot] Apr 9, 2024
debb8a6
build(deps): bump pytest-asyncio from 0.23.5 to 0.23.6 in /plc4py (#1…
dependabot[bot] Apr 9, 2024
1c27f79
build(deps): bump build from 1.0.3 to 1.2.1 in /plc4py (#1496)
dependabot[bot] Apr 9, 2024
004c2f8
fix(plc4py): Use packet length estimator to be able to handle multipl…
hutcheb Apr 12, 2024
ecfadf9
Update apache-kafka links to plc4x extra
ottlukas Apr 10, 2024
adf1568
feat(plc4go): change to TestingLog interface for TestLogger
sruehl Apr 10, 2024
2599310
build(deps): bump com.fasterxml.jackson.datatype:jackson-datatype-jsr…
dependabot[bot] Apr 11, 2024
a095a17
build(deps): bump com.gradle:common-custom-user-data-maven-extension …
dependabot[bot] Apr 11, 2024
84d6802
build(deps): bump mypy from 1.8.0 to 1.9.0 in /plc4py (#1502)
dependabot[bot] Apr 11, 2024
b85c765
build(deps): bump black from 24.1.1 to 24.3.0 in /plc4py (#1503)
dependabot[bot] Apr 11, 2024
6a6bade
build(deps): bump filelock from 3.13.1 to 3.13.4 in /plc4py (#1504)
dependabot[bot] Apr 11, 2024
6911bc9
build(deps): bump virtualenv from 20.25.0 to 20.25.1 in /plc4py (#1506)
dependabot[bot] Apr 11, 2024
7fb8b42
build(deps): bump typing-extensions from 4.9.0 to 4.11.0 in /plc4py (…
dependabot[bot] Apr 11, 2024
6f4bed9
build(deps): bump org.apache.maven.plugins:maven-invoker-plugin (#1514)
dependabot[bot] Apr 12, 2024
e5b90c6
build(deps): bump org.asciidoctor:asciidoctorj from 2.5.11 to 2.5.12 …
dependabot[bot] Apr 12, 2024
0f9520a
build(deps): bump com.google.googlejavaformat:google-java-format (#1516)
dependabot[bot] Apr 12, 2024
5fa88da
build(deps): bump coverage from 7.4.1 to 7.4.4 in /plc4py (#1511)
dependabot[bot] Apr 12, 2024
cb15079
build(deps): bump pytest from 8.0.0 to 8.1.1 in /plc4py (#1510)
dependabot[bot] Apr 12, 2024
906fa87
build(deps): bump pre-commit from 3.6.0 to 3.7.0 in /plc4py (#1512)
dependabot[bot] Apr 12, 2024
e551fb7
build(deps): bump pip-tools from 7.3.0 to 7.4.1 in /plc4py (#1513)
dependabot[bot] Apr 12, 2024
4da7244
fix(plc4j/ads): Fixed List serialization passing invalid datatype for…
IsmoLeszczynski Apr 12, 2024
b7529aa
feat: Changed the ManualTest to allow enabling read and write request…
chrisdutz Apr 12, 2024
dd5aad4
fix(plc4j/opcua): Cleanup discovery connection resources.
splatch Apr 12, 2024
3589478
fix(plc4j/ads): Invalid size writing multiple tags (#1524)
IsmoLeszczynski Apr 13, 2024
d4c2066
fix: Added the struct back to the manual ads test.
chrisdutz Apr 13, 2024
8a2f138
fix(plc4j/opcua): Make sure UA subscription acknowledges are retained…
splatch Apr 14, 2024
c98e9fc
chore: Updated vendor ids
chrisdutz Apr 14, 2024
ea61a35
chore: Addressed most high severity sonarcloud issues
chrisdutz Apr 14, 2024
257aff4
build(deps): bump black from 24.3.0 to 24.4.0 in /plc4py (#1528)
dependabot[bot] Apr 15, 2024
beaf82b
build(deps): bump org.apache.maven.plugins:maven-compiler-plugin (#1525)
dependabot[bot] Apr 15, 2024
1faae83
build(deps): bump org.codehaus.plexus:plexus-compiler-api (#1526)
dependabot[bot] Apr 15, 2024
11267a2
build(deps): bump com.google.errorprone:error_prone_annotations (#1527)
dependabot[bot] Apr 15, 2024
73913e0
build(deps): bump logback.version from 1.5.3 to 1.5.5 (#1531)
dependabot[bot] Apr 16, 2024
0872d89
build(deps): bump io.netty:netty-bom from 4.1.108.Final to 4.1.109.Fi…
dependabot[bot] Apr 16, 2024
384471f
build(deps): bump groovy.version from 4.0.20 to 4.0.21 (#1533)
dependabot[bot] Apr 16, 2024
cd38cb0
fix(plc4j/ads): Fixed connection hang on exception (#1530)
IsmoLeszczynski Apr 16, 2024
08f9260
build(deps): bump virtualenv from 20.25.1 to 20.25.2 in /plc4py (#1537)
dependabot[bot] Apr 17, 2024
6d42733
Remove Protocols section in developers section (duplicate from
ottlukas Apr 17, 2024
af6a4b8
Delete src/site/asciidoc/developers/protocols directory
ottlukas Apr 17, 2024
0ab6465
chore: Updated vendor ids
chrisdutz Apr 17, 2024
1c320f5
feat: Added a default-payload-byte-order option to the modbus driver …
chrisdutz Apr 17, 2024
63094a3
chore: Addressed more of the high severity sonarcloud issues
chrisdutz Apr 17, 2024
d8720ad
build(deps): bump slf4j.version from 2.0.12 to 2.0.13 (#1536)
dependabot[bot] Apr 17, 2024
b9846ed
build(deps): bump org.jetbrains.kotlin:kotlin-stdlib-jdk8 (#1534)
dependabot[bot] Apr 17, 2024
60f079d
Revert "Remove Protocols section in developers section (duplicate from "
ottlukas Apr 17, 2024
ab46e7a
Revert "Delete src/site/asciidoc/developers/protocols directory"
ottlukas Apr 17, 2024
c8bb411
Modbus in progress
ottlukas Apr 18, 2024
8e59aec
add index for protocol usage page
ottlukas Apr 18, 2024
12e646f
Add eip
ottlukas Apr 18, 2024
0d3ee01
fixing URLs
ottlukas Apr 18, 2024
5256375
build(deps): bump org.apache.commons:commons-configuration2 (#1541)
dependabot[bot] Apr 18, 2024
663034d
build(deps): bump org.apache.karaf.tooling:karaf-maven-plugin (#1539)
dependabot[bot] Apr 18, 2024
06cda0f
build(deps): bump com.googlecode.maven-download-plugin:download-maven…
dependabot[bot] Apr 18, 2024
ea50932
build(deps): bump virtualenv from 20.25.2 to 20.25.3 in /plc4py (#1542)
dependabot[bot] Apr 18, 2024
4cdd64a
build(deps): bump net.bytebuddy:byte-buddy from 1.14.12 to 1.14.13 (#…
dependabot[bot] Apr 19, 2024
71121e3
build(deps-dev): bump commons-io:commons-io from 2.15.1 to 2.16.1 (#1…
dependabot[bot] Apr 19, 2024
6212b0a
build(deps): bump org.apache.commons:commons-text from 1.11.0 to 1.12…
dependabot[bot] Apr 19, 2024
a95115d
chore: Made line-breaks in the configuration option descriptions get …
chrisdutz Apr 19, 2024
4dd77dd
chore: Updated vendor ids
chrisdutz Apr 19, 2024
834ab08
feat: Added device-group options for local, remote and remote2 to the…
chrisdutz Apr 19, 2024
8efab49
chore: Disabled the OpcuaSubscriptionHandleTest all together as it al…
chrisdutz Apr 19, 2024
4fffc88
feat: Added a "Since" annotation that provides information on when a …
chrisdutz Apr 19, 2024
75342ba
feat: Create a source bundle for PLC4C
chrisdutz Apr 19, 2024
8c87b04
chore: Added newly generated files.
chrisdutz Apr 19, 2024
f346f9f
build(deps): bump org.codehaus.mojo:extra-enforcer-rules (#1548)
dependabot[bot] Apr 22, 2024
85ee0bc
build(deps): bump logback.version from 1.5.5 to 1.5.6 (#1549)
dependabot[bot] Apr 22, 2024
6981261
build(deps): bump bouncycastle.version from 1.77 to 1.78.1 (#1550)
dependabot[bot] Apr 22, 2024
b1fabc9
build(deps): bump identify from 2.5.35 to 2.5.36 in /plc4py (#1546)
dependabot[bot] Apr 22, 2024
6c514bf
build(deps): bump pluggy from 1.4.0 to 1.5.0 in /plc4py (#1547)
dependabot[bot] Apr 22, 2024
431b9e3
build(deps): bump com.fazecast:jSerialComm from 2.10.4 to 2.11.0 (#1554)
dependabot[bot] Apr 23, 2024
104313f
feat(plc4j/api): Convert the string address into a PlcTag (#1468)
qtvbwfn Apr 23, 2024
fcfa85e
build(deps): bump commons-logging:commons-logging from 1.3.0 to 1.3.1…
dependabot[bot] Apr 23, 2024
b0aa7aa
build(deps-dev): bump org.json:json from 20240205 to 20240303 (#1552)
dependabot[bot] Apr 23, 2024
0fcc8b2
build(deps): bump org.apache.maven.plugins:maven-jar-plugin (#1559)
dependabot[bot] Apr 24, 2024
5762d51
build(deps): bump virtualenv from 20.25.3 to 20.26.0 in /plc4py (#1555)
dependabot[bot] Apr 24, 2024
8abefe6
build(deps): bump platformdirs from 4.2.0 to 4.2.1 in /plc4py (#1556)
dependabot[bot] Apr 24, 2024
109efa1
build(deps): bump coverage from 7.4.4 to 7.5.0 in /plc4py (#1557)
dependabot[bot] Apr 24, 2024
435edd7
build(deps): bump net.bytebuddy:byte-buddy from 1.14.13 to 1.14.14 (#…
dependabot[bot] Apr 25, 2024
1c684a8
build(deps): bump commons-cli:commons-cli from 1.6.0 to 1.7.0 (#1563)
dependabot[bot] Apr 25, 2024
720cdc9
build(deps): bump org.apache:apache from 31 to 32 (#1558)
dependabot[bot] Apr 25, 2024
453eef4
Change Python version to 3.10+
ottlukas Apr 25, 2024
bb63281
fix(plc4py/umas): Start to add write support
hutcheb Mar 7, 2024
c0f0f67
rebase umas
ottlukas Apr 25, 2024
67274f5
Merge branch 'develop' into feat/plc4py/umas_write_support
ottlukas May 1, 2024
3876158
Some small changes to python code
ottlukas May 3, 2024
46c0f7a
add additional comments in python code
ottlukas May 3, 2024
3e9054a
Merge branch 'develop' into Refactor-/-Improve-Python-Modbus
ottlukas May 7, 2024
e7a0510
fix(plc4py): Fix optional fields and clean some template stuff up
hutcheb May 8, 2024
d870810
Reset to capture timeouts
ottlukas May 8, 2024
7fc2b1f
Revert "Reset to capture timeouts"
ottlukas May 8, 2024
bc9b82a
Adding commentary / explaination for PLC4Py
ottlukas May 10, 2024
5799461
Merge branch 'develop' into Refactor-/-Improve-Python-Modbus
ottlukas May 10, 2024
e0735e8
some smaller changes
ottlukas May 10, 2024
26b333a
fix(plc4py): start to make the umas and modbus drivers act similialy.
hutcheb May 10, 2024
d751833
fix(plc4py/umas): Start to add write support
ottlukas May 15, 2024
13e9f79
Merge branch 'develop' into Refactor-/-Improve-Python-Modbus
ottlukas May 15, 2024
74de652
add @pytest.mark.xfail so that PLC4Py build succeeds (to be changed o…
ottlukas May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,43 +29,156 @@

public class PythonLanguageOutput extends FreemarkerLanguageOutput {

/**
* Returns the name of the language, which is used for outputting the generated code.
*
* @return The name of the language.
*/
@Override
public String getName() {
return "Python";
}

/**
* Returns a set of options that are supported by this language output flavor.
* Options are key-value pairs that can be passed to the code generator to customize the generated code.
*
* @return A set of supported options.
*/
@Override
public Set<String> supportedOptions() {
return Collections.singleton("package");
}


/**
* Returns a list of output flavors that are supported by this language output flavor.
* An output flavor is a customization option that can be passed to the code generator to
* produce code for a specific use case.
*
* @return A list of supported output flavors.
*/
@Override
public List<String> supportedOutputFlavors() {
return Arrays.asList("read-write", "read-only", "passive");
}

/**
* Returns a list of templates that are used to generate a specification of the generated code.
* The specification is usually a markdown file that contains information about the structure of the
* generated code, such as method signatures, comments, and so on.
*
* @return A list of templates that are used to generate the specification.
*/
@Override
protected List<Template> getSpecTemplates(Configuration freemarkerConfiguration) {
/**
* Python does not need a spec as it generates the code directly for the user.
* Therefore, this method returns an empty list.
*/
return Collections.emptyList();
}

/**
* Returns a list of templates that are used to generate code for a complex type.
* A complex type is a type that is composed of multiple fields.
*
* @param freemarkerConfiguration The configuration of the FreeMarker engine.
* @return A list of templates that are used to generate code for a complex type.
* @throws IOException Thrown if an error occurs while reading a template file.
*/
@Override
protected List<Template> getComplexTypeTemplates(Configuration freemarkerConfiguration) throws IOException {
/**
* The template used to generate code for a complex type is currently a single file.
* The template is stored at 'templates/python/complex-type-template.python.ftlh'.
*
* The template is used to generate code for a complex type by passing the complex type
* object as a variable named 'type' to the template.
*
* The template is also passed information about the fields of the complex type,
* such as their names, types and so on.
*/
return List.of(freemarkerConfiguration.getTemplate("templates/python/complex-type-template.python.ftlh"));
}

/**
* Returns a list of templates that are used to generate code for an enumeration type.
* An enumeration type is a type that is composed of a set of constants.
*
* @param freemarkerConfiguration The configuration of the FreeMarker engine.
* @return A list of templates that are used to generate code for an enumeration type.
* @throws IOException Thrown if an error occurs while reading a template file.
*/
@Override
protected List<Template> getEnumTypeTemplates(Configuration freemarkerConfiguration) throws IOException {
/**
* The template used to generate code for an enumeration type is currently a single file.
* The template is stored at 'templates/python/enum-template.python.ftlh'.
*
* The template is used to generate code for an enumeration type by passing the enumeration type
* object as a variable named 'type' to the template.
*
* The template is also passed information about the constants of the enumeration type,
* such as their names and so on.
*/
return Collections.singletonList(
freemarkerConfiguration.getTemplate("templates/python/enum-template.python.ftlh"));
}

/**
* Returns a list of templates that are used to generate code for a data IO class.
*
* A data IO class is a class that is responsible for reading and/or writing
* a specific type of data from and/or to a PLC (Programmable Logic Controller).
*
* The templates are used to generate code for a data IO class by passing the
* type of data that is being read and/or written as a variable named 'type'
* to the templates.
*
* The templates are also passed information about the fields of the type
* that is being read and/or written, such as their names, types and so on.
*
* @param freemarkerConfiguration The configuration of the FreeMarker engine.
* @return A list of templates that are used to generate code for a data IO class.
* @throws IOException Thrown if an error occurs while reading a template file.
*/
@Override
protected List<Template> getDataIoTemplates(Configuration freemarkerConfiguration) throws IOException {
/**
* The template used to generate code for a data IO class is currently a single file.
* The template is stored at 'templates/python/data-io-template.python.ftlh'.
*
* The template is used to generate code for a data IO class by passing the
* type of data that is being read and/or written as a variable named 'type' to the
* template.
*
* The template is also passed information about the fields of the type
* that is being read and/or written, such as their names, types and so on.
*/
return Collections.singletonList(
freemarkerConfiguration.getTemplate("templates/python/data-io-template.python.ftlh"));
}

/**
* Returns an instance of a helper class that is used by the code generation
* templates to generate code.
*
* The helper class is responsible for generating code that is dependent on the
* language and the type of code being generated (e.g. data IO, enum, etc.).
*
* The helper class is also responsible for generating code that is dependent on
* the PLC protocol that is being generated code for.
*
* @param thisType The type that is being generated code for.
* @param protocolName The name of the PLC protocol that the code is being generated
* for.
* @param flavorName The name of the code generation flavor that the code is being
* generated for.
* @param types A map of type definitions.
* @param options A map of options that are passed to the code generator.
* @return An instance of a helper class.
*/
@Override
protected FreemarkerLanguageTemplateHelper getHelper(TypeDefinition thisType, String protocolName, String flavorName, Map<String, TypeDefinition> types,
Map<String, String> options) {
Expand Down
Loading
Loading