1"""
2Example TReK Command Demonstration
3"""
4import trek
5
6
7def main() -> None:
8 """
9 Main Routine
10 """
11
12 try:
14
15
16
17
18 api.connect("POIC")
19
20
21
22
23 api.cleanse()
24
25
26
27
28
29
30 status_list = api.get_status_message_list()
31 print(f"There are {len(status_list)} status messages for this destination.\n")
32
33 for msg in status_list:
34 print(f"Status Message: {msg}\n")
36
37 _ = api.get_status_message(msg, pc)
38
39
40 param_list = pc.get_sorted_parameter_list(False)
41
42 for param_name in param_list:
43
44 param = pc.find_parameter(param_name)
45 print(f"{param_name}: {param.get_value_as_string()}\n")
46
47
48
49
50
51 resp_list = api.get_command_response_list()
52
53 response_dictionary = {}
54 for cr_name in resp_list:
56 try:
57 api.get_command_response(cr_name, response)
59 print(f"Error {err.code}: Could not retrieve response {cr_name}.\n")
60
61 continue
62 response_dictionary[cr_name] = response
63
64
65
66
67 token = api.initiate_command("ACCELERATE")
68
70 api.get_track(token, track_item)
71
72 for idx in range(track_item.get_number_of_responses()):
73 resp_item = track_item.get_response(idx)
74
75 if resp_item.name in response_dictionary:
77 resp_item.name
78 ]
79 resp_info = my_command_res.get_error_details(resp_item.value)
80 print(f"Response {resp_item.name}: {resp_info.info}.\n")
81
82
83
84
85
86
87 api.disconnect()
88
90
91 print(err.find_error_code())
92 print(err)
93
94
95if __name__ == "__main__":
96 main()
Provides access to command features of TReK.
Definition: trek.py:603
This class holds all the responses associated with a single command uplink.
Definition: trek.py:1363
This class describes a parameter collection.
Definition: trek.py:9144
This class holds all of the responses associated with a single command uplink.
Definition: trek.py:12479
The TReK C++ was designed to return error codes.
Definition: trek.py:12846