1"""
2Example using get_newest_packet().
3"""
4import trek
5
6
7
8
11packet_buffer = bytearray(4096)
12
13
14def main() -> None:
15 """
16 Main Routine
17 """
18
19 try:
20 pkt_key_list: list[str]
21
22
23 tlm_api.connect("DefaultDataStore")
24
25
26
27
28 tlm_api.cleanse()
29
30
31
32 pkt_key_list = tlm_api.get_source_list()
33
34 for idx, key in enumerate(pkt_key_list):
35 print(f"Packet key {idx+1}: {key}")
36
37
38
39 tlm_api.get_packet_definition("PdssPayload.RT.PL.7", pkt)
40
41
42 tlm_api.get_newest_packet("PdssPayload.RT.PL.7", packet_buffer)
43
44
45 _ = pkt.extract(packet_buffer, len(packet_buffer))
46
47
48
49 param = pkt.find_parameter("MSID016")
50
51 param_value = param.get_value()
52
53 print(f"Value is: {param_value}")
54
55
56
57
58 tlm_api.disconnect()
59
61
62 print(err.find_error_code())
63 print(err)
64
65
66if __name__ == "__main__":
67 main()
This class describes a packet composed of one or more parameters.
Definition: trek.py:5009
Provides access to telemetry features of TReK.
Definition: trek.py:12090
The TReK C++ was designed to return error codes.
Definition: trek.py:12835