eive-tmtc/pus_tc/devs/scex.py
2022-06-21 16:49:11 +02:00

43 lines
1.1 KiB
Python

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