eive-tmtc/pus_tc/bpx_batt.py

43 lines
1.6 KiB
Python
Raw Normal View History

from tmtccmd.tc.definitions import TcQueueT, QueueCommands
from config.object_ids import BPX_HANDLER_ID
from tmtccmd.tc.service_8_functional_cmd import generate_action_command
from tmtccmd.tc.service_3_housekeeping import generate_one_hk_command, make_sid
class BpxSetIds:
GET_HK_SET = 0
GET_CFG_SET = 5
class BpxActionIds:
REBOOT = 2
RESET_COUNTERS = 3
SET_CFG = 4
GET_CFG = 5
def pack_bpx_commands(tc_queue: TcQueueT, op_code: str):
if op_code in ["0", "hk"]:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting BPX battery HK set"))
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_HK_SET)
cmd = generate_one_hk_command(sid=sid, ssc=0)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in ["1", "rst_boot_cnt"]:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counters"))
cmd = generate_action_command(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.RESET_COUNTERS
)
tc_queue.appendleft(cmd.pack_command_tuple())
2022-02-03 15:30:58 +01:00
if op_code in ["2", "cfg"]:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting reboot counters"))
cmd = generate_action_command(
object_id=BPX_HANDLER_ID, action_id=BpxActionIds.GET_CFG
)
tc_queue.appendleft(cmd.pack_command_tuple())
if op_code in ["3", "cfg_hk"]:
tc_queue.appendleft((QueueCommands.PRINT, "Requesting BPX Configuration Struct"))
sid = make_sid(object_id=BPX_HANDLER_ID, set_id=BpxSetIds.GET_CFG_SET)
cmd = generate_one_hk_command(sid=sid, ssc=0)
tc_queue.appendleft(cmd.pack_command_tuple())
pass