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

Parse manufacturer data in AdStructure #138

Merged
merged 1 commit into from
Oct 12, 2024

Conversation

iamtio
Copy link
Contributor

@iamtio iamtio commented Oct 12, 2024

Implemented parsing of the manufacturer data for AdStructure

Comment on lines 488 to 489
0xff => Ok(AdStructure::ManufacturerSpecificData {
company_identifier: LittleEndian::read_u16(&data[..2]),

Choose a reason for hiding this comment

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

You can use u16::from_le_bytes() to avoid the byteorder dependency. Also, this clause should probably guarded to ensure the data is at least 2 bytes long (e.g. 0xff if data.len() >= 2 => Ok(...))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed. And thank you. I am new in Rust. Still don't know a lot of things

@iamtio iamtio force-pushed the adstructure-parse-manufacturer-data branch from ed6bcd1 to 75929cd Compare October 12, 2024 17:33
@iamtio iamtio requested a review from alexmoon October 12, 2024 17:35
@lulf
Copy link
Member

lulf commented Oct 12, 2024

/test

@lulf lulf merged commit 9482d97 into embassy-rs:main Oct 12, 2024
2 checks passed
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.

3 participants