-
Notifications
You must be signed in to change notification settings - Fork 498
feat(plc4j/slmp): add Batch Write (0x1401) support #2651
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
Merged
sruehl
merged 15 commits into
apache:develop
from
LivingLikeKrillin:feature/slmp-batch-write
Jul 21, 2026
Merged
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
37a5e70
feat(plc4j/slmp): model Batch Write (0x1401) request in the mspec
LivingLikeKrillin fb48c02
test(plc4j/slmp): pin the Batch Write 0x1401 frame bytes
LivingLikeKrillin 910a371
docs(plc4j/slmp): sync mspec header section index and SlmpRequestData…
LivingLikeKrillin 3c3695c
feat(plc4j/slmp): add SlmpDataType.encode (mirror of decode)
LivingLikeKrillin a85b145
feat(plc4j/slmp): map Batch Write endCode to a per-tag response code
LivingLikeKrillin d82a5e7
feat(plc4j/slmp): implement Batch Write onWrite path
LivingLikeKrillin 7fd1885
refactor(plc4j/slmp): generalize single-frame ceiling wording for bat…
LivingLikeKrillin 9b31bb1
test(plc4j/slmp): end-to-end Batch Write driver-testsuite case
LivingLikeKrillin 822d503
fix(plc4j/slmp): declare write capability in SlmpDriver
LivingLikeKrillin 0f6abc9
docs(plc4j/slmp): drop stale read-only wording now that Batch Write i…
LivingLikeKrillin 55557ee
docs(plc4j/slmp): drop stale read-only wording from the driver POM de…
LivingLikeKrillin 65c87ac
docs(plc4j/slmp): correct SH-080008 section references against the ma…
LivingLikeKrillin 006f344
refactor(plc4j/slmp): address review feedback
LivingLikeKrillin 2bc9889
fix(plc4j/slmp): echo builder error items instead of NPE-masking them…
LivingLikeKrillin 10f2f94
fix(plc4j/slmp): reject unexpected payload on write success; document…
LivingLikeKrillin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
172 changes: 172 additions & 0 deletions
172
...rivers/slmp/src/main/generated/org/apache/plc4x/java/slmp/readwrite/SlmpWriteRequest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // https://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| package org.apache.plc4x.java.slmp.readwrite; | ||
|
|
||
| import org.apache.plc4x.java.spi.buffers.api.Message; | ||
| import org.apache.plc4x.java.spi.buffers.api.ReadBuffer; | ||
| import org.apache.plc4x.java.spi.buffers.api.WithOption; | ||
| import org.apache.plc4x.java.spi.buffers.api.WriteBuffer; | ||
| import org.apache.plc4x.java.spi.buffers.api.exceptions.BufferException; | ||
| import org.apache.plc4x.java.spi.fields.data.reader.DataReaderFactory; | ||
| import org.apache.plc4x.java.spi.fields.data.writer.DataWriterFactory; | ||
| import org.apache.plc4x.java.spi.fields.fields.reader.FieldReaderFactory; | ||
| import org.apache.plc4x.java.spi.fields.fields.writer.FieldWriterFactory; | ||
| import org.apache.plc4x.java.spi.fields.utils.ThreadLocalHelper; | ||
|
|
||
| /** | ||
| * Code generated by code-generation. DO NOT EDIT. | ||
| */ | ||
| public class SlmpWriteRequest extends SlmpRequestData implements Message { | ||
| protected final int headDeviceNumber; | ||
|
|
||
| protected final SlmpDeviceCode deviceCode; | ||
|
|
||
| protected final int numberOfPoints; | ||
|
|
||
| protected final byte[] writeData; | ||
|
|
||
| public SlmpWriteRequest(Integer headDeviceNumber, SlmpDeviceCode deviceCode, | ||
| Integer numberOfPoints, byte[] writeData) { | ||
| this.headDeviceNumber = headDeviceNumber; | ||
| this.deviceCode = deviceCode; | ||
| this.numberOfPoints = numberOfPoints; | ||
| this.writeData = writeData; | ||
| } | ||
|
|
||
| /** | ||
| * Discriminator field command | ||
| */ | ||
| @Override | ||
| public int getCommand() { | ||
| return (int) 0x1401; | ||
| } | ||
|
|
||
| /** | ||
| * Property field headDeviceNumber | ||
| */ | ||
| public int getHeadDeviceNumber() { | ||
| return headDeviceNumber; | ||
| } | ||
|
|
||
| /** | ||
| * Property field deviceCode | ||
| */ | ||
| public SlmpDeviceCode getDeviceCode() { | ||
| return deviceCode; | ||
| } | ||
|
|
||
| /** | ||
| * Property field numberOfPoints | ||
| */ | ||
| public int getNumberOfPoints() { | ||
| return numberOfPoints; | ||
| } | ||
|
|
||
| /** | ||
| * Property field writeData | ||
| */ | ||
| public byte[] getWriteData() { | ||
| return writeData; | ||
| } | ||
|
|
||
| public static SlmpRequestDataBuilder staticParseSlmpRequestDataBuilder(ReadBuffer readBuffer, | ||
| int command) throws BufferException { | ||
| readBuffer.pushContext(WithOption.WithName("SlmpWriteRequest")); | ||
| int startPos = readBuffer.getPositionInBits(); | ||
| boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); | ||
| // Simple Field: headDeviceNumber | ||
| int headDeviceNumber = FieldReaderFactory.readSimpleField(DataReaderFactory.readUnsignedInt(readBuffer, 24), WithOption.WithName("headDeviceNumber")); | ||
|
|
||
| // Simple Field (enum): deviceCode | ||
| SlmpDeviceCode deviceCode = FieldReaderFactory.readEnumField(DataReaderFactory.readEnum(SlmpDeviceCode::enumForValue, DataReaderFactory.readUnsignedShort(readBuffer, 8)), WithOption.WithName("deviceCode")); | ||
|
|
||
| // Simple Field: numberOfPoints | ||
| int numberOfPoints = FieldReaderFactory.readSimpleField(DataReaderFactory.readUnsignedInt(readBuffer, 16), WithOption.WithName("numberOfPoints")); | ||
|
|
||
| // Array Field: writeData | ||
| byte[] writeData = readBuffer.readBits(Math.toIntExact(((numberOfPoints) * (2)) * 8), WithOption.WithName("writeData")); | ||
|
|
||
| readBuffer.popContext(); | ||
| return new SlmpRequestDataBuilderImpl(headDeviceNumber, deviceCode, numberOfPoints, writeData); | ||
| } | ||
|
|
||
| protected void serializeSlmpRequestDataChild(WriteBuffer writeBuffer) throws BufferException { | ||
| writeBuffer.pushContext(WithOption.WithName("SlmpWriteRequest")); | ||
| int startPos = writeBuffer.getPositionInBits(); | ||
| boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); | ||
| // Simple Field: headDeviceNumber | ||
| FieldWriterFactory.writeSimpleField((int) headDeviceNumber, DataWriterFactory.writeUnsignedInt(writeBuffer, 24), WithOption.WithName("headDeviceNumber")); | ||
|
|
||
| // Simple Field (enum): deviceCode | ||
| FieldWriterFactory.writeSimpleEnumField((SlmpDeviceCode) deviceCode, DataWriterFactory.writeEnum(SlmpDeviceCode::getValue, SlmpDeviceCode::name, DataWriterFactory.writeUnsignedShort(writeBuffer, 8)), WithOption.WithName("deviceCode")); | ||
|
|
||
| // Simple Field: numberOfPoints | ||
| FieldWriterFactory.writeSimpleField((int) numberOfPoints, DataWriterFactory.writeUnsignedInt(writeBuffer, 16), WithOption.WithName("numberOfPoints")); | ||
|
|
||
| // Array Field: writeData | ||
| FieldWriterFactory.writeByteArrayField(writeData, DataWriterFactory.writeByteArray(writeBuffer, (int) ((writeData != null) ? writeData.length : 0)), WithOption.WithName("writeData")); | ||
|
|
||
| writeBuffer.popContext(); | ||
| } | ||
|
|
||
| @Override | ||
| public int getLengthInBytes() { | ||
| return (int) Math.ceil((float) getLengthInBits() / 8.0); | ||
| } | ||
|
|
||
| @Override | ||
| public int getLengthInBits() { | ||
| int lengthInBits = super.getLengthInBits(); | ||
| SlmpWriteRequest _value = this; | ||
| boolean _lastItem = ThreadLocalHelper.lastItemThreadLocal.get(); | ||
| // Simple Field: headDeviceNumber | ||
| lengthInBits += 24; | ||
|
|
||
| // Simple Field: deviceCode | ||
| lengthInBits += 8; | ||
|
|
||
| // Simple Field: numberOfPoints | ||
| lengthInBits += 16; | ||
|
|
||
| // Array Field: writeData | ||
| lengthInBits += 8 * ((writeData != null) ? writeData.length : 0); | ||
|
|
||
| return lengthInBits; | ||
| } | ||
|
|
||
| public static class SlmpRequestDataBuilderImpl implements SlmpRequestData.SlmpRequestDataBuilder { | ||
| private final int headDeviceNumber; | ||
|
|
||
| private final SlmpDeviceCode deviceCode; | ||
|
|
||
| private final int numberOfPoints; | ||
|
|
||
| private final byte[] writeData; | ||
|
|
||
| public SlmpRequestDataBuilderImpl(int headDeviceNumber, SlmpDeviceCode deviceCode, | ||
| int numberOfPoints, byte[] writeData) { | ||
| this.headDeviceNumber = headDeviceNumber; | ||
| this.deviceCode = deviceCode; | ||
| this.numberOfPoints = numberOfPoints; | ||
| this.writeData = writeData; | ||
| } | ||
|
|
||
| public SlmpRequestData build() { | ||
| return new SlmpWriteRequest(headDeviceNumber, deviceCode, numberOfPoints, writeData); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.