-
Notifications
You must be signed in to change notification settings - Fork 1
docs: clarify write operations in Javadoc #11
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -39,10 +39,10 @@ | |||||||||||||||||||
| * <p><strong>For read commands:</strong> The {@link StorageCard} memory image is updated with the | ||||||||||||||||||||
| * data retrieved from the card. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * <p><strong>For write commands:</strong> The {@link StorageCard} memory image is <strong>not | ||||||||||||||||||||
| * updated</strong> even when the command appears successful, as some storage card technologies do | ||||||||||||||||||||
| * not provide reliable confirmation of write completion. Applications should perform explicit read | ||||||||||||||||||||
| * operations after writes to verify the actual card content and update the memory image. | ||||||||||||||||||||
| * <p><strong>For write commands:</strong> The {@link StorageCard} memory image is updated with the | ||||||||||||||||||||
| * written data once the write is confirmed successful. For card technologies that do not provide | ||||||||||||||||||||
| * reliable status codes (e.g. ST25/SRT512), confirmation is obtained via an automatic verification | ||||||||||||||||||||
| * read; the memory image is updated only if this verification passes. | ||||||||||||||||||||
|
Comment on lines
+42
to
+45
|
||||||||||||||||||||
| * | ||||||||||||||||||||
| * <p>The process is interrupted at the first failed command. | ||||||||||||||||||||
| * | ||||||||||||||||||||
|
|
@@ -78,12 +78,6 @@ public interface StorageCardTransactionManager | |||||||||||||||||||
| * | ||||||||||||||||||||
| * <p>The data length must match the block size defined by the card's {@link ProductType}. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * <p><strong>Important:</strong> After execution of this write command, the {@link StorageCard} | ||||||||||||||||||||
| * memory image is <strong>not automatically updated</strong>. Some storage card technologies do | ||||||||||||||||||||
| * not provide reliable status codes to confirm successful write operations. To ensure data | ||||||||||||||||||||
| * consistency, an explicit read operation must be performed after the write to refresh the memory | ||||||||||||||||||||
| * image and verify the actual content stored on the card. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * @param data The data to be written to the system block. The length must match the card's block | ||||||||||||||||||||
| * size. | ||||||||||||||||||||
| * @return The current instance. | ||||||||||||||||||||
|
|
@@ -122,14 +116,17 @@ public interface StorageCardTransactionManager | |||||||||||||||||||
| * | ||||||||||||||||||||
| * <p>The data length must match the block size defined by the card's {@link ProductType}. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * <p><strong>Important:</strong> After execution of this write command, the {@link StorageCard} | ||||||||||||||||||||
| * memory image is <strong>not automatically updated</strong>. ST25/SRT512 cards do not provide | ||||||||||||||||||||
| * reliable status codes to confirm successful write operations. To ensure data consistency, an | ||||||||||||||||||||
| * explicit read operation must be performed after the write to refresh the memory image and | ||||||||||||||||||||
| * verify the actual content stored on the card. | ||||||||||||||||||||
| * <p><strong>Important:</strong> It is the user's responsibility to ensure that the write | ||||||||||||||||||||
| * operations are coherent with the target card's technology (e.g., OTP bits). The data provided | ||||||||||||||||||||
| * must represent the <b>expected final state</b> of the system block after the write operation. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * @param data The data to be written to the system block. The length must match the card's block | ||||||||||||||||||||
| * size. | ||||||||||||||||||||
| * <p>ST25/SRT512 cards do not provide reliable status codes to confirm successful write | ||||||||||||||||||||
| * operations. Consequently, the library performs an automatic verification read. This check will | ||||||||||||||||||||
| * fail if the physical state of the system block after the write does not exactly match the | ||||||||||||||||||||
| * provided data. | ||||||||||||||||||||
|
Comment on lines
+123
to
+126
|
||||||||||||||||||||
| * | ||||||||||||||||||||
| * @param data The data to be written to the system block (expected final state). The length must | ||||||||||||||||||||
| * match the card's block size. | ||||||||||||||||||||
| * @return The current instance. | ||||||||||||||||||||
| * @throws IllegalArgumentException If data is null or its length does not match the block size. | ||||||||||||||||||||
| * @throws UnsupportedOperationException If the current card type is not ST25/SRT512. | ||||||||||||||||||||
|
|
@@ -180,15 +177,18 @@ public interface StorageCardTransactionManager | |||||||||||||||||||
| * array divided by the block size of the storage card. The block size is provided by {@link | ||||||||||||||||||||
| * ProductType#getBlockSize()}. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * <p><strong>Important:</strong> Some storage card technologies do not provide reliable status | ||||||||||||||||||||
| * codes to confirm successful write operations. For such cards (e.g., SRT512/ST25), the library | ||||||||||||||||||||
| * automatically performs a verification read after each write to ensure that the data has been | ||||||||||||||||||||
| * correctly stored. For cards that provide a reliable write acknowledgment, no additional read is | ||||||||||||||||||||
| * performed. In all cases, the library guarantees the integrity of the written data, and the | ||||||||||||||||||||
| * application does not need to explicitly perform verification reads. | ||||||||||||||||||||
| * <p><strong>Important:</strong> It is the user's responsibility to ensure that the write | ||||||||||||||||||||
| * operations are coherent with the target card's technology (e.g., OTP bits, counters). The data | ||||||||||||||||||||
| * provided must represent the <b>expected final state</b> of the blocks after the write | ||||||||||||||||||||
| * operation. | ||||||||||||||||||||
| * | ||||||||||||||||||||
| * <p>For cards that do not provide reliable status codes (e.g., SRT512/ST25), the library | ||||||||||||||||||||
|
||||||||||||||||||||
| * <p>For cards that do not provide reliable status codes (e.g., SRT512/ST25), the library | |
| * <p>For cards that do not provide reliable status codes (e.g., ST25/SRT512), the library |
Copilot
AI
Apr 7, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This Javadoc describes an automatic verification read for cards without reliable write status codes, which conflicts with the interface-level note stating that applications should perform explicit reads after writes and that the StorageCard memory image is not updated for write commands. Please align these two pieces of documentation and clarify whether the verification read updates the StorageCard memory image or is only used for internal comparison during processCommands().
| * performs an automatic verification read. This check will fail if the physical state of the card | |
| * after the write does not exactly match the provided data. For cards providing reliable | |
| * acknowledgment, no additional read is performed. | |
| * performs an automatic verification read during {@link #processCommands(ChannelControl)} for | |
| * internal comparison with the provided data. This check will fail if the physical state of the | |
| * card after the write does not exactly match the expected final state. This verification read | |
| * does <strong>not</strong> update the {@link StorageCard} memory image; applications must | |
| * prepare an explicit read command after the write if they need to refresh the memory image. For | |
| * cards providing reliable acknowledgment, no additional verification read is performed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog entry says the Javadoc clarification is limited to
prepareWriteBlocksandprepareSt25WriteSystemBlock, but this PR also changes the higher-levelprocessCommands()write contract (memory image update semantics) and removes text from the deprecatedprepareWriteSystemBlockdocs. Please adjust this entry to reflect the full scope of the documentation changes (or narrow the code changes to match the entry).