Compare commits

...

6 Commits

Author SHA1 Message Date
07601b734e moved event handler to separate funtion 2022-03-03 19:57:22 +01:00
9a487c7407 tmtccmd update 2022-03-03 19:34:13 +01:00
9a10a12f93 bump tmtccmd requirements 2022-03-03 19:07:35 +01:00
e2e503bb5d added pl pcdu off command 2022-03-03 18:55:11 +01:00
d2356ac1fa use new helper function 2022-03-03 18:32:08 +01:00
2ef8f5a32e additional pl pcdu commands 2022-03-03 18:24:17 +01:00
6 changed files with 68 additions and 27 deletions

View File

@@ -1,6 +1,7 @@
from tmtccmd.config import (
add_op_code_entry,
add_service_op_code_entry,
generate_op_code_options,
ServiceOpCodeDictT,
OpCodeDictKeys,
)
@@ -92,17 +93,27 @@ def add_core_controller_definitions(cmd_dict: ServiceOpCodeDictT):
def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
from pus_tc.plpcdu import OpCodes
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.SWITCH_ADC_ON,
info="Switch PL PCDU ADC on",
keys=OpCodes.SWITCH_ON,
info="Switch PL PCDU on"
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.SWITCH_ALL_ON,
info="Switch all PL PCDU modules on",
keys=OpCodes.SWITCH_ADC_NORMAL,
info="Switch PL PCDU ADC normal, submode ADC ON"
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.SWITCH_OFF,
info="Switch PL PCDU off"
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=OpCodes.SWITCH_ALL_NORMAL,
info="Switch all PL PCDU modules normal, submode ALL ON",
options=generate_op_code_options(enter_listener_mode=True)
)
add_op_code_entry(
op_code_dict=op_code_dict,

7
config/event_handler.py Normal file
View File

@@ -0,0 +1,7 @@
import config.object_ids as obj_ids
def handle_event_packet(
object_id: bytes, event_id: int, param_1: int, param_2: int
) -> str:
return ""

View File

@@ -103,10 +103,13 @@ class EiveHookObject(TmTcHookBase):
def handle_service_5_event(
object_id: bytes, event_id: int, param_1: int, param_2: int
) -> str:
if object_id == RW1_ID:
if event_id == 1:
return ""
return ""
from config.event_handler import handle_event_packet
return handle_event_packet(
object_id=object_id,
event_id=event_id,
param_1=param_1,
param_2=param_2
)
def get_eive_service_op_code_dict(service_op_code_dict: ServiceOpCodeDictT):

View File

@@ -17,19 +17,21 @@ LOGGER = get_console_logger()
class OpCodes:
SWITCH_ADC_ON = ["0", "switch-adc-on"]
SWITCH_ALL_ON = ["1", "switch-all-on"]
UPDATE_DRO_TO_X8_WAIT = ["2", "dro-to-x8-wait"]
UPDATE_X8_TO_TX_WAIT_TIME = ["3", "x8-to-tx-wait"]
UPDATE_TX_TO_MPA_WAIT_TIME = ["4", "tx-to-mpa-wait"]
UPDATE_MPA_TO_HPA_WAIT_TIME = ["5", "mpa-to-hpa-wait"]
SWITCH_ON = ["0", "on"]
SWITCH_ADC_NORMAL = ["1", "adc-normal"]
SWITCH_ALL_NORMAL = ["2", "all-normal"]
SWITCH_OFF = ["3", "off"]
UPDATE_DRO_TO_X8_WAIT = ["6", "dro-to-x8-wait"]
UPDATE_X8_TO_TX_WAIT_TIME = ["7", "x8-to-tx-wait"]
UPDATE_TX_TO_MPA_WAIT_TIME = ["8", "tx-to-mpa-wait"]
UPDATE_MPA_TO_HPA_WAIT_TIME = ["9", "mpa-to-hpa-wait"]
INJECT_SSR_TO_DRO_FAILURE = ["6", "inject-ssr-dro-fault"]
INJECT_DRO_TO_X8_FAILURE = ["7", "inject-dro-x8-fault"]
INJECT_X8_TO_TX_FAILURE = ["8", "inject-x8-tx-fault"]
INJECT_TX_TO_MPA_FAILURE = ["9", "inject-tx-mpa-fault"]
INJECT_MPA_TO_HPA_FAILURE = ["10", "inject-mpa-hpa-fault"]
INJECT_ALL_ON_FAILURE = ["11", "inject-all-on-fault"]
INJECT_SSR_TO_DRO_FAILURE = ["10", "inject-ssr-dro-fault"]
INJECT_DRO_TO_X8_FAILURE = ["11", "inject-dro-x8-fault"]
INJECT_X8_TO_TX_FAILURE = ["12", "inject-x8-tx-fault"]
INJECT_TX_TO_MPA_FAILURE = ["13", "inject-tx-mpa-fault"]
INJECT_MPA_TO_HPA_FAILURE = ["14", "inject-mpa-hpa-fault"]
INJECT_ALL_ON_FAILURE = ["15", "inject-all-on-fault"]
class Submodes(enum.IntEnum):
@@ -76,8 +78,26 @@ class ParamIds(enum.IntEnum):
def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.SWITCH_ADC_ON:
tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU ADC module on"))
if op_code in OpCodes.SWITCH_ON:
tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU on"))
mode_data = pack_mode_data(
object_id=PL_PCDU_ID, mode=Modes.ON, submode=0
)
mode_cmd = PusTelecommand(
service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data
)
tc_queue.appendleft(mode_cmd.pack_command_tuple())
if op_code in OpCodes.SWITCH_OFF:
tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU off"))
mode_data = pack_mode_data(
object_id=PL_PCDU_ID, mode=Modes.OFF, submode=0
)
mode_cmd = PusTelecommand(
service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data
)
tc_queue.appendleft(mode_cmd.pack_command_tuple())
if op_code in OpCodes.SWITCH_ADC_NORMAL:
tc_queue.appendleft((QueueCommands.PRINT, "Switching PL PCDU ADC module normal, submode ADC ON"))
mode_data = pack_mode_data(
object_id=PL_PCDU_ID, mode=Modes.NORMAL, submode=Submodes.ADC_ON
)
@@ -85,8 +105,8 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str):
service=200, subservice=Subservices.SWITCH_MODE, app_data=mode_data
)
tc_queue.appendleft(mode_cmd.pack_command_tuple())
if op_code in OpCodes.SWITCH_ALL_ON:
tc_queue.appendleft((QueueCommands.PRINT, "Switching all PL PCDU modules on"))
if op_code in OpCodes.SWITCH_ALL_NORMAL:
tc_queue.appendleft((QueueCommands.PRINT, "Switching all PL PCDU modules normal, submode ALL ON"))
mode_data = pack_mode_data(
object_id=PL_PCDU_ID, mode=Modes.NORMAL, submode=Submodes.ALL_ON
)

View File

@@ -1 +1 @@
tmtccmd>=1.12.0
tmtccmd>=1.13.0

Submodule tmtccmd updated: 81a88435a5...c315efe165