Skip to content
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

Unable to use a variable length structure #3

Open
brutella opened this issue Nov 21, 2024 · 0 comments
Open

Unable to use a variable length structure #3

brutella opened this issue Nov 21, 2024 · 0 comments

Comments

@brutella
Copy link

How would I use DataKit to encode a variable length structure?

My bytes representation looks like this.

( 1 Byte )
[ Length ][ Type ][ ID ][ Version ]...[ ID ][ Version ]

(Length is the overall byte count.)

I've tried to create a struct but I'm unable to provide a write format.

typealias ID = UInt8
typealias Version = UInt8
struct InfoBlock {
    let blockType: UInt8
    let values: [ID:Version]
}

How would the format look like to map it to the above mentioned bytes representation?

Thanks for the help.

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

No branches or pull requests

1 participant