Skip to content

Commit 277b3d8

Browse files
committed
chore(plc4go): fix codegen for raw arrays
1 parent 86334e0 commit 277b3d8

3 files changed

Lines changed: 55 additions & 35 deletions

File tree

code-generation/language/go/src/main/resources/templates/go/data-io-template.go.ftlh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ func ${type.name}ParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffe
128128
<#if !field.isCountArrayField() && !field.isLengthArrayField()>
129129
return nil, errors.Wrap(_${arrayField.name}Err, "Array fields of type byte only support 'count' and 'length' loop-types.")<@emitImport import="github.com/pkg/errors" />
130130
</#if>
131-
${arrayField.name}, _${arrayField.name}Err := readBuffer.ReadByteArray("${arrayField.name}", int(${helper.toParseExpression(null, null, arrayField.loopExpression, parserArguments)}))<#if arrayField.loopExpression.contains("CEIL")><@emitImport import="math" /></#if>
131+
${arrayField.name}Raw, _${arrayField.name}Err := readBuffer.ReadByteArray("${arrayField.name}", int(${helper.toParseExpression(null, null, arrayField.loopExpression, parserArguments)}))<#if arrayField.loopExpression.contains("CEIL")><@emitImport import="math" /></#if>
132132
if _${arrayField.name}Err != nil {
133133
return nil, errors.Wrap(_${arrayField.name}Err, "Error parsing '${arrayField.name}' field")<@emitImport import="github.com/pkg/errors" />
134134
}
135+
${arrayField.name} := []api.PlcValue{values.NewPlcRawByteArray(${arrayField.name}Raw)}
135136
<#else>
136137
var ${arrayField.name} []api.PlcValue
137138
for i := 0; i < int(${helper.toParseExpression(null, null, arrayField.loopExpression, parserArguments)}); i++ {

plc4go/protocols/knxnetip/readwrite/model/KnxProperty.go

Lines changed: 48 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pom.xml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -205,16 +205,6 @@
205205
<artifactId>freemarker</artifactId>
206206
<version>${freemarker.version}</version>
207207
</dependency>
208-
<dependency>
209-
<groupId>org.osgi</groupId>
210-
<artifactId>osgi.core</artifactId>
211-
<version>8.0.0</version>
212-
</dependency>
213-
<dependency>
214-
<groupId>org.osgi</groupId>
215-
<artifactId>org.osgi.service.component.annotations</artifactId>
216-
<version>1.5.1</version>
217-
</dependency>
218208

219209
<dependency>
220210
<groupId>io.netty</groupId>
@@ -494,6 +484,11 @@
494484
</dependency>
495485

496486
<!-- OSGi Dependencies -->
487+
<dependency>
488+
<groupId>org.osgi</groupId>
489+
<artifactId>osgi.core</artifactId>
490+
<version>8.0.0</version>
491+
</dependency>
497492
<dependency>
498493
<groupId>org.osgi</groupId>
499494
<artifactId>org.osgi.service.component.annotations</artifactId>

0 commit comments

Comments
 (0)