-
Notifications
You must be signed in to change notification settings - Fork 1
Feature/img_packet_spec #14
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: master
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 |
|---|---|---|
|
|
@@ -72,8 +72,13 @@ void from_buffer (Img& i, Buffer& b) { | |
| i.image_id = static_cast<uint8_t>(b.get(8)); | ||
| i.fragment_id = static_cast<uint16_t>(b.get(16)); | ||
| i.num_fragments = static_cast<uint16_t>(b.get(16)); | ||
| char image_data[6] = { 'i', 'm', 'a', 'g', 'e', '\0' }; | ||
| std::copy(image_data, image_data+6, i.image_data); | ||
| char image_data[76]; | ||
| uint64_t fragment_len = b.len()-(b.pos()+144); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| uint32_t num_bytes = fragment_len/8; | ||
| uint8_t num_bits = fragment_len%8; | ||
| for(int i=0; i<num_bytes; i++) { image_data[i] = static_cast<char>b.get(8); } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there should be parens around |
||
| image_data[num_bytes] = static_cast<char>b.get(num_bits); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this has some spaces in its indentation
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there should be parens around |
||
| std::copy(image_data, image_data+num_bytes, i.image_data); | ||
| } | ||
|
|
||
| void from_buffer (Health& h, Buffer& b) { | ||
|
|
||
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.
these should be
get_lenandget_pos