-
Notifications
You must be signed in to change notification settings - Fork 32
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
Multi variable bit size #1436
Multi variable bit size #1436
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1436 +/- ##
==========================================
+ Coverage 75.65% 75.77% +0.12%
==========================================
Files 603 605 +2
Lines 44832 45025 +193
Branches 787 787
==========================================
+ Hits 33918 34119 +201
+ Misses 10827 10818 -9
- Partials 87 88 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
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.
I still need to run locally and see about the coverage and additional testing
required: true | ||
description: The key to access this item | ||
values: .+ | ||
example: KEY $.book.title |
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.
Why was this removed? You still have an example in access_tlm.txt of KEY on an ITEM.
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.
It was just remove from item_modifiers because it was a dup (I think). It is also in param_item_modifiers.
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.
Right and that's used by both ... not sure why it didn't get duplicated in the output though
item.bit_size = 30 | ||
else | ||
item.bit_size = 62 | ||
end |
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.
Why are they all 2 bits short?
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.
Its the QUIC variable size integer format. See: https://datatracker.ietf.org/doc/html/rfc9000#name-variable-length-integer-enc
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.
That's above and beyond ... I thought you were just going to do strings, lol
# Skip items before this item and derived items and items with negative bit offsets | ||
next | ||
end | ||
if sitem != item |
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 <=> operator in structure_item is based on bit_offset so you might be able to remove this check and just change the above check to sitem.bit_offset <= item.bit_offset
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.
Maybe, but this code appears to work with my current testing.
# Minimum QUIC encoded integer | ||
minimum_data_bits = 6 | ||
elsif item.variable_bit_size['length_value_bit_offset'] > 0 | ||
minimum_data_bits = item.variable_bit_size['length_value_bit_offset'] * item.variable_bit_size['length_bits_per_count'] |
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 is effectively the STRING and BLOCK section?
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.
Its STRING, BLOCK, or array
@packet.write("item2_length", 8) # Lengths must be initialized to zero equivalent | ||
item2.variable_bit_size = {'length_item_name' => 'item2_length', 'length_value_bit_offset' => -64, 'length_bits_per_count' => 8} | ||
expect(item2.bit_offset).to eql 48 | ||
expect(@packet.buffer).to eql "\x00\x00\x00\x04\x00\x08" |
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.
I'm not sure what's going on with this test. How did we get the 4 and 8? Negative offset is a positive value? What happens if you have a value offset of +32?
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 test is handling the case where the value field includes itself in the count (so that has to be subtracted out)
A positive offset would be something like CCSDS where a value of 0 = 1 byte = 8 bits. Don't have a test for that yet.
parser.verify_num_parameters(0, 0, usage) | ||
@current_packet.hidden = true | ||
@current_packet.disabled = true | ||
@current_packet.virtual = true |
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.
What is a VIRTUAL packet and how is it going to be used?
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.
VIRTUAL packs aren't involved in identification. So it provides a way to declare embedded structures that can be used within packets. Effectively packets in packets.
require 'openc3/conversions/conversion' | ||
|
||
module OpenC3 | ||
class ObjectReadConversion < Conversion |
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.
What is this for?
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.
Used with virtual. This is a new conversion that references a packet structure, and then dumps the BLOCK data into that packet, and returns a hash of key/value pairs generated using the packet structure.
require 'openc3/conversions/object_read_conversion' | ||
|
||
module OpenC3 | ||
class ObjectWriteConversion < Conversion |
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.
What is this for?
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.
Used with virtual, to write a hash of items, into a packet, and then fill in a BLOCK item.
elsif bytes < 0 | ||
# Remove extra bytes because we're adjusting smaller | ||
buffer[item_offset + -bytes, -bytes] = '' | ||
end |
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 is my new buffer adjustment logic
buffer[item_offset, original_length - item_offset] | ||
elsif bytes < 0 | ||
# Remove extra bytes because we're adjusting smaller | ||
buffer[item_offset + -bytes, -bytes] = '' |
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 doesn't seem right. Let's say we got 7 bytes smaller.
buffer[0 + 7, 7] = "" will destroy a bunch of real data.
Should it always be: buffer[item_offset + 1, -bytes] = '' ?
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.
Would like tests for the new conversion classes, and I think packet_config_spec should also include some new tests.
Quality Gate passedIssues Measures |
Tests added and packet_config.rb is at 96.58% |
Looks good! |
closes #78