1"""
2Example TReK Command Sequence Demonstration
3
4Binary Command Sequences are created using the TReK Command Sequence Editor.
5"""
6import time
7import trek
8
9
10completed_count = 0
11
12def command_callback(token, status, command, count, ret_code, command_token):
13
14 if ret_code == 0:
15 print(f"Command #{count}, '{command}' executed with status {status}.")
16 else:
17 print(f"Error command #{count}, '{command}', code={ret_code}.")
18
19
20def stop_callback(token, status, count, ret_code):
21
22 if ret_code == 0:
23 print(f"Command Sequence {token}, completed.")
24 else:
25 print(f"Command Sequence {token} errored.")
26
27 completed_count = completed_count + 1
28
29
30def main() -> None:
31 """
32 Main Routine
33 """
34
35 try:
37
38
39
40
41 api.connect("POIC")
42
43
44
45
46 api.cleanse()
47
48
49
50
51
52
53
54 api.register_sequence_command_callback(command_callback)
55 api.register_sequence_stop_callback(stop_callback)
56
57
58 sequences_sent = sequences_sent + 1
59 api.start_sequence('SequenceBinaryFile')
60
61
62
63
64
65
66
67
68
69 while completed_count < sequences_sent:
70 time.sleep(1)
71
72
73
74
75
76
77 api.disconnect()
78
80
81 print(err.find_error_code())
82 print(err)
83
84
85if __name__ == "__main__":
86 main()
Provides access to command features of TReK.
Definition: trek.py:850
The TReK C++ was designed to return error codes.
Definition: trek.py:15453