scex command init

This commit is contained in:
Irini Kosmidou 2022-06-21 16:49:11 +02:00
parent 7012a6c41f
commit 67500e88ed
8 changed files with 78 additions and 7 deletions

View File

@ -1,5 +1,5 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Ping Command" type="PythonConfigurationType" factoryName="Python" folderName="PUS">
<configuration default="false" name="Ping Command" type="PythonConfigurationType" factoryName="Python">
<module name="tmtc" />
<option name="INTERPRETER_OPTIONS" value="" />
<option name="PARENT_ENVS" value="true" />
@ -13,7 +13,7 @@
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s 17 -o 0 -t 3" />
<option name="PARAMETERS" value="-s 17 -o ping -t 3" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />

24
.run/SCEX Ping.run.xml Normal file
View File

@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="SCEX Ping" type="PythonConfigurationType" factoryName="Python" folderName="Devices">
<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" />
<option name="ADD_CONTENT_ROOTS" value="true" />
<option name="ADD_SOURCE_ROOTS" value="true" />
<EXTENSION ID="PythonCoverageRunConfigurationExtension" runner="coverage.py" />
<option name="SCRIPT_NAME" value="$PROJECT_DIR$/tmtccli.py" />
<option name="PARAMETERS" value="-s scex -o ping" />
<option name="SHOW_COMMAND_LINE" value="false" />
<option name="EMULATE_TERMINAL" value="true" />
<option name="MODULE_MODE" value="false" />
<option name="REDIRECT_INPUT" value="false" />
<option name="INPUT_FILE" value="" />
<method v="2" />
</configuration>
</component>

View File

@ -25,6 +25,7 @@ PDU_1_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x01])
PDU_2_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x02])
ACU_HANDLER_ID = bytes([0x44, 0x25, 0x00, 0x03])
BPX_HANDLER_ID = bytes([0x44, 0x26, 0x00, 0x00])
SCEX_HANDLER_ID = bytes([0x44, 0x33, 0x00, 0x32])
# Thermal Object IDs
THERMAL_CONTROLLER_ID = bytes([0x43, 0x40, 0x00, 0x01])

View File

@ -1,3 +1,4 @@
from pus_tc.devs.scex import add_scex_cmds
from pus_tc.system.proc import add_proc_cmds
from tmtccmd.config import (
add_op_code_entry,
@ -42,6 +43,7 @@ def get_eive_service_op_code_dict() -> ServiceOpCodeDictT:
add_pdec_cmds(cmd_dict=service_op_code_dict)
add_heater_cmds(cmd_dict=service_op_code_dict)
add_tmp_sens_cmds(cmd_dict=service_op_code_dict)
add_scex_cmds(service_op_code_dict)
add_proc_cmds(cmd_dict=service_op_code_dict)
return service_op_code_dict

View File

@ -0,0 +1,42 @@
import enum
from config.definitions import CustomServiceList
from tmtccmd.tc.pus_8_funccmd import generate_action_command
from tmtccmd.config import QueueCommands, ServiceOpCodeDictT, add_op_code_entry, add_service_op_code_entry
from tmtccmd.tc.definitions import TcQueueT
from config.object_ids import SCEX_HANDLER_ID
class OpCodes:
PING = ["0", "ping"]
class ActionIds(enum.IntEnum):
PING = 7
class Info:
PING = "Send Ping command"
def add_scex_cmds(cmd_dict: ServiceOpCodeDictT):
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.PING, info=Info.PING
)
add_service_op_code_entry(
srv_op_code_dict=cmd_dict,
name=CustomServiceList.SCEX.value,
info="SCEX Device",
op_code_entry=op_code_dict
)
def pack_scex_cmds(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.PING:
tc_queue.appendleft((QueueCommands.PRINT, Info.PING))
app_data = bytes([0])
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.PING, app_data)
tc_queue.appendleft(command.pack_command_tuple())
pass

View File

@ -7,6 +7,8 @@ from typing import Union
from pus_tc.devs.rtd import pack_rtd_commands
from spacepackets.ecss import PusTelecommand
from pus_tc.devs.scex import pack_scex_cmds
from tmtccmd.com_if.com_interface_base import CommunicationInterface
from tmtccmd.config.definitions import CoreServiceList, QueueCommands
from tmtccmd.logging import get_console_logger
@ -42,7 +44,7 @@ from pus_tc.devs.plpcdu import pack_pl_pcdu_commands
from pus_tc.devs.str_img_helper import pack_str_img_helper_command
from pus_tc.system.tcs import pack_tcs_sys_commands
from pus_tc.system.proc import pack_proc_commands
from pus_tc.system.controllers import pack_cmd_ctrl_to_prompted_mode
from pus_tc.system.controllers import pack_cmd_ctrl_to_prompted_mode, get_object_from_op_code
from config.definitions import CustomServiceList
from config.object_ids import (
get_object_ids,
@ -242,9 +244,9 @@ def pack_service_queue_user(
tc_queue=service_queue, object_id=RW_ASSEMBLY, op_code=op_code
)
if service == CustomServiceList.CONTROLLERS.value:
return pack_cmd_ctrl_to_prompted_mode(tc_queue=service_queue)
return pack_cmd_ctrl_to_prompted_mode(tc_queue=service_queue, object_id=get_object_from_op_code(op_code))
if service == CustomServiceList.SCEX.value:
pass
return pack_scex_cmds(tc_queue=service_queue, op_code=op_code)
LOGGER.warning("Invalid Service !")

View File

@ -80,5 +80,5 @@ def pus_factory_hook(raw_tm_packet: bytes):
packet=raw_tm_packet, srv_subservice=(service_type, subservice_type)
)
except ValueError:
LOGGER.warning("Invalid packet format detected")
LOGGER.exception("Invalid packet format detected")
log_raw_unknown_packet(packet=raw_tm_packet, packet_type=PacketTypes.TM)

@ -1 +1 @@
Subproject commit 8f69fa22c7557369569372ee22058f29d4fe6b56
Subproject commit b8e86ddd7cdecf1348f60d9fff08964493a93356