Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
148 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from spacepackets.uslp.header import ( | ||
PrimaryHeader, | ||
SourceOrDestField, | ||
ProtocolCommandFlag, | ||
BypassSequenceControlFlag, | ||
) | ||
from spacepackets.uslp.frame import ( | ||
TransferFrame, | ||
TransferFrameDataField, | ||
TfdzConstructionRules, | ||
UslpProtocolIdentifier, | ||
) | ||
from spacepackets.ccsds.spacepacket import SpacePacketHeader, PacketTypes, SequenceFlags | ||
|
||
SPACECRAFT_ID = 0x73 | ||
|
||
|
||
def main(): | ||
print("-- USLP frame example --") | ||
frame_header = PrimaryHeader( | ||
scid=SPACECRAFT_ID, | ||
map_id=0, | ||
vcid=1, | ||
src_dest=SourceOrDestField.SOURCE, | ||
frame_len=0, | ||
vcf_count_len=0, | ||
op_ctrl_flag=False, | ||
prot_ctrl_cmd_flag=ProtocolCommandFlag.USER_DATA, | ||
bypass_seq_ctrl_flag=BypassSequenceControlFlag.SEQ_CTRLD_QOS, | ||
) | ||
data = bytearray([1, 2, 3, 4]) | ||
# Wrap the data into a space packet | ||
space_packet_wrapper = SpacePacketHeader( | ||
packet_type=PacketTypes.TC, | ||
sequence_flags=SequenceFlags.UNSEGMENTED, | ||
apid=SPACECRAFT_ID, | ||
data_length=len(data) - 1, | ||
source_sequence_count=0, | ||
) | ||
tfdz = space_packet_wrapper.pack() + data | ||
tfdf = TransferFrameDataField( | ||
tfdz_cnstr_rules=TfdzConstructionRules.VpNoSegmentation, | ||
uslp_ident=UslpProtocolIdentifier.SPACE_PACKETS_ENCAPSULATION_PACKETS, | ||
tfdz=tfdz, | ||
) | ||
var_frame = TransferFrame(header=frame_header, tfdf=tfdf) | ||
var_frame_packed = var_frame.pack() | ||
print( | ||
f"USLP variable length frame without FECF, and Operation Control Field containing a " | ||
f"simple space packet: {var_frame_packed.hex(sep=',')}" | ||
) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters