-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy path__init__.py
87 lines (64 loc) · 1.94 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python3
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
# -*- coding: latin-1 -*-
"""
__init__.py
"""
# Copyright 2021 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU Lesser General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt
import logging
from ballcosmos.connection import *
from ballcosmos.environment import *
logging.basicConfig(
format="%(asctime)s %(levelname)s %(name)s %(message)s",
level=logging.getLevelName(LOG_LEVEL),
)
###################################
CTS = None # Stands for command telemetry server
RMF = False
###################################
def initialize_module(hostname: str = None, port: int = None):
global CTS
global RMF
if CTS:
CTS.shutdown()
if hostname and port:
CTS = Connection(hostname, port)
elif RMF:
CTS = Connection(DEFAULT_REPLAY_API_HOST, DEFAULT_REPLAY_API_PORT)
else:
CTS = Connection(DEFAULT_CTS_API_HOST, DEFAULT_CTS_API_PORT)
def shutdown():
"""shutdown the connection"""
global CTS
CTS.shutdown()
def disconnect():
"""disconnect from the server"""
global CTS
CTS.disconnect()
def set_replay_mode(replay_mode: bool):
"""Set replay mode to True or False"""
global RMF
if replay_mode is not RMF:
RMF = replay_mode
initialize_module()
def get_replay_mode():
"""Get RMF, True or False"""
global RMF
return RMF
initialize_module()
from ballcosmos.api_shared import *
from ballcosmos.cmd_tlm_server import *
from ballcosmos.commands import *
from ballcosmos.exceptions import *
from ballcosmos.extract import *
from ballcosmos.limits import *
from ballcosmos.replay import *
from ballcosmos.scripting import *
from ballcosmos.telemetry import *
from ballcosmos.tools import *