An array of PacketFields? #100
joeymukherjee
started this conversation in
Ideas
Replies: 1 comment
-
Hi @joeymukherjee, Thanks for writing! I think the way to do this is as follows.... right now there isn't something like what you're proposing, but this solution should get you going! packet_fields = [
PacketField(name='SHCOARSE', data_type='uint', bit_length=32),
PacketField(name='SHFINE', data_type='uint', bit_length=20),
PacketField(name='OPMODE', data_type='uint', bit_length=3),
PacketField(name='SPACER', data_type='fill', bit_length=1),
PacketField(name='VOLTAGE', data_type='int', bit_length=8),
]
for i in range(48):
packet_fields.extend([
PacketField(name=f'ID{i}', data_type='uint', bit_length=32),
PacketField(name=f'FLAGS{i}', data_type='uint', bit_length=8),
PacketField(name=f'COUNTER{i}', data_type='uint', bit_length=3),
PacketField(name=f'DATA{i}', data_type='uint', bit_length=192),
PacketField(name=f'CHECKSUM{i}', data_type='int', bit_length=8)
])
pkt = ccsdspy.FixedLength(packet_fields) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
How would I do something like this? I have a fixed length packet, but within the packet, I have an array of other packet fields. I made some pseudocode below which defines a SENSOR_GRID which have 5 packet fields that repeat 48 times.
THIS IS NOT VALID CODE:. (so no cut/paste!)
Beta Was this translation helpful? Give feedback.
All reactions