make TCP TM server obj singletons

This commit is contained in:
Robin Müller 2022-08-08 16:47:41 +02:00
parent 76da5753f6
commit e08b927643
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
7 changed files with 18 additions and 11 deletions

View File

@ -3,9 +3,6 @@
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
<envs>
<env name="PYTHONUNBUFFERED" value="1" />
</envs>
<option name="SDK_HOME" value="" />
<option name="WORKING_DIRECTORY" value="$PROJECT_DIR$" />
<option name="IS_MODULE_SDK" value="true" />
@ -15,7 +12,7 @@
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtcc.py" />
<option name="PARAMETERS" value="" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="EMULATE_TERMINAL" value="false" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />

2
deps/tmtccmd vendored

@ -1 +1 @@
Subproject commit a8dda1113cd1f70e984915cff920a261de942adf
Subproject commit ce826596e829773336838cce803159a8173614e5

View File

@ -167,7 +167,7 @@ def add_bpx_cmd_definitions(defs: TmTcDefWrapper):
)
oce.add(keys=BpxOpCodes.REBOOT, info="Reboot Command")
defs.add_service(
name=CustomServiceList.BPX_BATTERY,
name=CustomServiceList.BPX_BATTERY.value,
info="BPX Battery Handler",
op_code_entry=oce,
)

View File

@ -146,7 +146,7 @@ def add_pl_pcdu_cmds(defs: TmTcDefWrapper):
info="Inject failure in MPA to HPA transition",
)
oce.add(keys=OpCodes.INJECT_ALL_ON_FAILURE, info="Inject failure in all on mode")
defs.add_service(CustomServiceList.PL_PCDU, "PL PCDU", oce)
defs.add_service(CustomServiceList.PL_PCDU.value, "PL PCDU", oce)
def pack_pl_pcdu_commands(q: DefaultPusQueueHelper, op_code: str):

View File

@ -109,7 +109,7 @@ def add_core_controller_definitions(defs: TmTcDefWrapper):
keys=OpCodes.RESET_REBOOT_COUNTER_11,
info="Reset reboot counter 1 1",
)
defs.add_service(CustomServiceList.CORE, "Core Controller", oce)
defs.add_service(CustomServiceList.CORE.value, "Core Controller", oce)
def pack_core_commands(q: DefaultPusQueueHelper, op_code: str):

View File

@ -2,7 +2,11 @@ import enum
import struct
from pus_tm.defs import PrintWrapper
from pus_tm.tcp_server_objects import *
from pus_tm.tcp_server_objects import (
tcp_server_sensor_temperatures,
tcp_server_device_temperatures,
)
from pus_tm.tm_tcp_server import TmTcpServer
from tmtccmd.util import ObjectIdU32
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
@ -16,6 +20,10 @@ class SetIds(enum.IntEnum):
def handle_thermal_controller_hk_data(
object_id: ObjectIdU32, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if tcp_server_sensor_temperatures is None:
tcp_server_sensor_temperatures = TmTcpServer("localhost", 7305)
if tcp_server_device_temperatures is None:
tcp_server_device_temperatures = TmTcpServer("localhost", 7306)
if set_id == SetIds.SENSOR_TEMPERATURE_SET:
pw = PrintWrapper(printer)
pw.dlog("Received sensor temperature data")

View File

@ -1,4 +1,6 @@
from typing import Optional
from pus_tm.tm_tcp_server import TmTcpServer
tcp_server_sensor_temperatures = TmTcpServer("localhost", 7305)
tcp_server_device_temperatures = TmTcpServer("localhost", 7306)
tcp_server_sensor_temperatures: Optional[TmTcpServer] = None
tcp_server_device_temperatures: Optional[TmTcpServer] = None