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