Skip to content

Commit 5f6c232

Browse files
glcjceos01
andauthored
Issue/s7h (apache#1214)
* Important flaws in the management of pipe lines are corrected. Time adjustment is added. Pending in the interpretation of the URL. * Fixed URL handling in S7MuxImpl. Pending with parameter management in parameter management in tcp transports. * Reorganization of the examples by type of PLC. * Updated example for S7-1200. * Improved CYC example. Go to develop. --------- Co-authored-by: Cesar Garcia <[email protected]>
1 parent 02c6782 commit 5f6c232

File tree

61 files changed

+5367
-1426
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+5367
-1426
lines changed

images/s7h_image01.png

13.2 KB
Loading

images/s7h_image02.png

39.5 KB
Loading

images/s7h_image03.png

39.5 KB
Loading

images/s7h_image04.png

31.2 KB
Loading

images/s7h_image05.png

30.4 KB
Loading

images/s7h_image06.png

89.4 KB
Loading

images/s7h_image07.png

13.2 KB
Loading

images/s7h_szlxy11demo.png

28.1 KB
Loading

plc4j/drivers/s7/pom.xml

Lines changed: 74 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,25 @@
3737

3838
<build>
3939
<plugins>
40+
<plugin>
41+
<groupId>org.apache.plc4x.plugins</groupId>
42+
<artifactId>plc4x-maven-plugin</artifactId>
43+
<executions>
44+
<execution>
45+
<id>generate-driver</id>
46+
<phase>generate-sources</phase>
47+
<goals>
48+
<goal>generate-driver</goal>
49+
</goals>
50+
<configuration>
51+
<protocolName>s7</protocolName>
52+
<languageName>java</languageName>
53+
<outputFlavor>read-write</outputFlavor>
54+
<outputDir>src/main/generated</outputDir>
55+
</configuration>
56+
</execution>
57+
</executions>
58+
</plugin>
4059
<plugin>
4160
<groupId>org.apache.karaf.tooling</groupId>
4261
<artifactId>karaf-maven-plugin</artifactId>
@@ -85,6 +104,16 @@
85104
</instructions>
86105
</configuration>
87106
</plugin>
107+
<plugin>
108+
<groupId>org.apache.maven.plugins</groupId>
109+
<artifactId>maven-dependency-plugin</artifactId>
110+
<configuration>
111+
<usedDependencies combine.children="append">
112+
<usedDependency>org.apache.plc4x:plc4x-code-generation-language-java</usedDependency>
113+
<usedDependency>org.apache.plc4x:plc4x-protocols-s7</usedDependency>
114+
</usedDependencies>
115+
</configuration>
116+
</plugin>
88117
</plugins>
89118
</build>
90119

@@ -122,46 +151,45 @@
122151
<groupId>io.netty</groupId>
123152
<artifactId>netty-transport</artifactId>
124153
</dependency>
125-
<dependency>
126-
<groupId>io.netty</groupId>
127-
<artifactId>netty-handler</artifactId>
128-
</dependency>
129-
<dependency>
130-
<groupId>io.netty</groupId>
131-
<artifactId>netty-codec</artifactId>
132-
</dependency>
133-
<dependency>
134-
<groupId>io.netty</groupId>
135-
<artifactId>netty-common</artifactId>
136-
</dependency>
137154
<dependency>
138155
<groupId>io.vavr</groupId>
139156
<artifactId>vavr</artifactId>
140157
</dependency>
141-
<dependency>
142-
<groupId>org.json</groupId>
143-
<artifactId>json</artifactId>
144-
</dependency>
145158

146159
<dependency>
147160
<groupId>org.apache.plc4x</groupId>
148161
<artifactId>plc4j-utils-test-utils</artifactId>
149162
<version>0.12.0-SNAPSHOT</version>
150163
<scope>test</scope>
151164
</dependency>
152-
153165
<dependency>
154166
<groupId>org.skyscreamer</groupId>
155167
<artifactId>jsonassert</artifactId>
168+
<version>1.5.1</version>
156169
<scope>test</scope>
170+
<exclusions>
171+
<exclusion>
172+
<groupId>com.vaadin.external.google</groupId>
173+
<artifactId>android-json</artifactId>
174+
</exclusion>
175+
</exclusions>
157176
</dependency>
158177

159178
<dependency>
160-
<groupId>com.fasterxml.jackson.core</groupId>
161-
<artifactId>jackson-annotations</artifactId>
162-
<scope>test</scope>
179+
<groupId>org.apache.plc4x</groupId>
180+
<artifactId>plc4x-code-generation-language-java</artifactId>
181+
<version>0.12.0-SNAPSHOT</version>
182+
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
183+
<scope>provided</scope>
163184
</dependency>
164185

186+
<dependency>
187+
<groupId>org.apache.plc4x</groupId>
188+
<artifactId>plc4x-protocols-s7</artifactId>
189+
<version>0.12.0-SNAPSHOT</version>
190+
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
191+
<scope>provided</scope>
192+
</dependency>
165193
<dependency>
166194
<groupId>org.apache.plc4x</groupId>
167195
<artifactId>plc4x-protocols-s7</artifactId>
@@ -170,53 +198,32 @@
170198
<type>test-jar</type>
171199
<scope>test</scope>
172200
</dependency>
201+
<dependency>
202+
<groupId>io.netty</groupId>
203+
<artifactId>netty-handler</artifactId>
204+
<version>${netty.version}</version>
205+
</dependency>
206+
<dependency>
207+
<groupId>io.netty</groupId>
208+
<artifactId>netty-codec</artifactId>
209+
<version>${netty.version}</version>
210+
</dependency>
211+
<dependency>
212+
<groupId>io.netty</groupId>
213+
<artifactId>netty-common</artifactId>
214+
<version>${netty.version}</version>
215+
</dependency>
216+
<dependency>
217+
<groupId>org.json</groupId>
218+
<artifactId>json</artifactId>
219+
<version>20230618</version>
220+
<type>jar</type>
221+
</dependency>
222+
<dependency>
223+
<groupId>com.fasterxml.jackson.core</groupId>
224+
<artifactId>jackson-annotations</artifactId>
225+
<scope>test</scope>
226+
</dependency>
173227
</dependencies>
174228

175-
<profiles>
176-
<profile>
177-
<id>update-generated-code</id>
178-
<build>
179-
<plugins>
180-
<plugin>
181-
<groupId>org.apache.plc4x.plugins</groupId>
182-
<artifactId>plc4x-maven-plugin</artifactId>
183-
<executions>
184-
<execution>
185-
<id>generate-driver</id>
186-
<phase>generate-sources</phase>
187-
<goals>
188-
<goal>generate-driver</goal>
189-
</goals>
190-
<configuration>
191-
<protocolName>s7</protocolName>
192-
<languageName>java</languageName>
193-
<outputFlavor>read-write</outputFlavor>
194-
<outputDir>src/main/generated</outputDir>
195-
</configuration>
196-
</execution>
197-
</executions>
198-
</plugin>
199-
</plugins>
200-
</build>
201-
202-
<dependencies>
203-
<dependency>
204-
<groupId>org.apache.plc4x</groupId>
205-
<artifactId>plc4x-code-generation-language-java</artifactId>
206-
<version>0.12.0-SNAPSHOT</version>
207-
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
208-
<scope>provided</scope>
209-
</dependency>
210-
211-
<dependency>
212-
<groupId>org.apache.plc4x</groupId>
213-
<artifactId>plc4x-protocols-s7</artifactId>
214-
<version>0.12.0-SNAPSHOT</version>
215-
<!-- Scope is 'provided' as this way it's not shipped with the driver -->
216-
<scope>provided</scope>
217-
</dependency>
218-
</dependencies>
219-
</profile>
220-
</profiles>
221-
222229
</project>

plc4j/drivers/s7/src/main/generated/org/apache/plc4x/java/s7/readwrite/CycServiceItemAnyType.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ protected void serializeCycServiceItemTypeChild(WriteBuffer writeBuffer)
8989
boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
9090
writeBuffer.pushContext("CycServiceItemAnyType");
9191

92-
// Simple Field (transportSize)
93-
writeSimpleEnumField(
92+
// Enum field (transportSize)
93+
writeEnumField(
9494
"transportSize",
9595
"TransportSize",
9696
transportSize,
9797
new DataWriterEnumDefault<>(
98-
TransportSize::getValue, TransportSize::name, writeUnsignedShort(writeBuffer, 8)));
98+
TransportSize::getCode, TransportSize::name, writeUnsignedShort(writeBuffer, 8)));
9999

100100
// Simple Field (length)
101101
writeSimpleField("length", length, writeUnsignedInt(writeBuffer, 16));
@@ -128,7 +128,7 @@ public int getLengthInBits() {
128128
CycServiceItemAnyType _value = this;
129129
boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get();
130130

131-
// Simple field (transportSize)
131+
// Enum Field (transportSize)
132132
lengthInBits += 8;
133133

134134
// Simple field (length)
@@ -156,8 +156,7 @@ public static CycServiceItemTypeBuilder staticParseCycServiceItemTypeBuilder(
156156
readEnumField(
157157
"transportSize",
158158
"TransportSize",
159-
new DataReaderEnumDefault<>(
160-
TransportSize::enumForValue, readUnsignedShort(readBuffer, 8)));
159+
readEnum(TransportSize::firstEnumForFieldCode, readUnsignedShort(readBuffer, 8)));
161160

162161
int length = readSimpleField("length", readUnsignedInt(readBuffer, 16));
163162

0 commit comments

Comments
 (0)