Skip to content

Add ApplicationDataValueWrite::SignedInt and UnsignedInt variants.#9

Merged
ninjasource merged 3 commits intoninjasource:mainfrom
de-vri-es:support-integer-writes
Mar 30, 2026
Merged

Add ApplicationDataValueWrite::SignedInt and UnsignedInt variants.#9
ninjasource merged 3 commits intoninjasource:mainfrom
de-vri-es:support-integer-writes

Conversation

@de-vri-es
Copy link
Copy Markdown
Contributor

This PR adds a SignedInt and UnsignedInt variants for ApplicationDataValueWrite to support writing integer values.

@de-vri-es de-vri-es force-pushed the support-integer-writes branch from 545f377 to 253b784 Compare March 25, 2026 17:49
@de-vri-es de-vri-es force-pushed the support-integer-writes branch from 253b784 to bc4846f Compare March 25, 2026 21:22
@de-vri-es de-vri-es force-pushed the support-integer-writes branch from 46c6978 to 9b4418c Compare March 27, 2026 09:33
@de-vri-es de-vri-es force-pushed the support-integer-writes branch from bae1f20 to 4733806 Compare March 27, 2026 10:33
@ninjasource
Copy link
Copy Markdown
Owner

ninjasource commented Mar 27, 2026

Hey, thanks for your contribution. I really appreciate it. Can you please just write a short description of what you have added so that I don't have to read the code to figure it out. Just a bit more detail than you put in. This will help me answer two questions. Is this change here to get some proprietary device to work that won't benefit anyone else? Is the code written by an human? (it changes the way I review it). No offense intended btw, just the nature of things these days. :)

@de-vri-es
Copy link
Copy Markdown
Contributor Author

de-vri-es commented Mar 30, 2026

No offense taken. It's all written by me personally. No AI.

The changes:

  • ApplicationDataValue:
    • The UnsignedInt variant now holds a u64 instead of a u32.
    • The SignedInt variant was added, which holds an i64.
  • ApplicationDataValueWrite
    • Added UnsignedInt and SignedInt variants, holding a u64 and i64 respectively.
  • In common/helpers.rs I've refactored integer encoding and decoding. It now always encodes int as the smallest value (as technically required by the standard), and it also implements parsing integers which are 5, 6 or 7 bytes in length.
    • I've added some tests for counting the number of bytes to be skipped when encoding.
  • I've disabled the simple module when the alloc feature is disabled, because it doesn't compile. I couldn't see an easy fix, otherwise I would have implemented it.

This is not for any specific quirk in a proprietary device, but to extend support for standard integer properties: reading signed values, writing signed and unsigned values, and decoding more valid integer encodings.

Copy link
Copy Markdown
Owner

@ninjasource ninjasource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution, looks good! I really appreciate it.

@ninjasource ninjasource merged commit 48658ba into ninjasource:main Mar 30, 2026
@de-vri-es
Copy link
Copy Markdown
Contributor Author

Thanks for the quick review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants