2020-12-17 17:50:00 +01:00
|
|
|
"""
|
|
|
|
@brief This file transfers control of TC packing to the user
|
|
|
|
@details Template configuration file. Copy this folder to the TMTC commander root and adapt
|
|
|
|
it to your needs.
|
|
|
|
"""
|
|
|
|
|
|
|
|
import os
|
|
|
|
from collections import deque
|
2021-03-19 17:39:52 +01:00
|
|
|
from typing import Union
|
|
|
|
|
2021-05-17 17:42:04 +02:00
|
|
|
from tmtccmd.config.definitions import CoreServiceList
|
2021-06-28 19:06:09 +02:00
|
|
|
from tmtccmd.utility.logger import get_console_logger
|
2021-07-24 14:58:47 +02:00
|
|
|
from tmtccmd.tc.definitions import TcQueueT
|
|
|
|
from tmtccmd.tc.service_5_event import pack_generic_service5_test_into
|
|
|
|
from tmtccmd.tc.service_17_test import pack_service17_ping_command
|
2021-03-19 17:39:52 +01:00
|
|
|
|
2021-07-26 14:13:58 +02:00
|
|
|
from pus_tc.service_200_mode import pack_service200_test_into
|
2021-03-19 17:39:52 +01:00
|
|
|
from pus_tc.p60dock import pack_p60dock_test_into
|
|
|
|
from pus_tc.pdu2 import pack_pdu2_test_into
|
|
|
|
from pus_tc.pdu1 import pack_pdu1_test_into
|
|
|
|
from pus_tc.acu import pack_acu_test_into
|
2021-03-26 13:56:02 +01:00
|
|
|
from pus_tc.imtq import pack_imtq_test_into
|
2021-03-19 17:39:52 +01:00
|
|
|
from pus_tc.tmp1075 import pack_tmp1075_test_into
|
2021-07-11 14:29:11 +02:00
|
|
|
from pus_tc.ploc_mpsoc import pack_ploc_mpsoc_test_into
|
|
|
|
from pus_tc.ploc_supervisor import pack_ploc_supv_test_into
|
2021-03-19 17:39:52 +01:00
|
|
|
from pus_tc.heater import pack_heater_test_into
|
2021-06-25 15:25:22 +02:00
|
|
|
from pus_tc.reaction_wheels import pack_single_rw_test_into
|
2021-07-01 11:52:25 +02:00
|
|
|
from pus_tc.rad_sensor import pack_rad_sensor_test_into
|
2021-08-07 14:34:26 +02:00
|
|
|
from pus_tc.ploc_upater import pack_ploc_updater_test_into
|
2021-08-03 15:28:28 +02:00
|
|
|
from pus_tc.core import pack_core_commands
|
2021-03-19 17:39:52 +01:00
|
|
|
from config.definitions import CustomServiceList
|
2021-05-17 17:42:04 +02:00
|
|
|
from config.object_ids import P60_DOCK_HANDLER, PDU_1_HANDLER_ID, PDU_2_HANDLER_ID, ACU_HANDLER_ID, \
|
2021-07-11 14:29:11 +02:00
|
|
|
TMP_1075_1_HANDLER_ID, TMP_1075_2_HANDLER_ID, HEATER_ID, IMTQ_HANDLER_ID, PLOC_MPSOC_ID, RW1_ID, RW2_ID, RW3_ID, RW4_ID, \
|
2021-08-07 14:34:26 +02:00
|
|
|
RAD_SENSOR_ID, PLOC_SUPV_ID, PLOC_UPDATER_ID
|
2020-12-17 17:50:00 +01:00
|
|
|
|
|
|
|
|
2021-06-28 19:06:09 +02:00
|
|
|
LOGGER = get_console_logger()
|
2020-12-17 17:50:00 +01:00
|
|
|
|
|
|
|
|
2021-03-19 17:39:52 +01:00
|
|
|
def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT):
|
2021-05-17 17:42:04 +02:00
|
|
|
if service == CoreServiceList.SERVICE_5.value:
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_generic_service5_test_into(tc_queue=service_queue)
|
2021-05-17 17:42:04 +02:00
|
|
|
if service == CoreServiceList.SERVICE_17.value:
|
2020-12-17 17:50:00 +01:00
|
|
|
return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
|
2021-07-26 14:13:58 +02:00
|
|
|
if service == CoreServiceList.SERVICE_200.value:
|
|
|
|
return pack_service200_test_into(tc_queue=service_queue)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.P60DOCK.value:
|
2021-05-17 17:42:04 +02:00
|
|
|
object_id = P60_DOCK_HANDLER
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.PDU1.value:
|
2021-08-11 16:49:32 +02:00
|
|
|
object_id = PDU_1_HANDLER_ID
|
|
|
|
return pack_pdu1_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.PDU2.value:
|
2021-05-17 17:42:04 +02:00
|
|
|
pdu2_object_id = PDU_2_HANDLER_ID
|
|
|
|
p60dock_object_id = P60_DOCK_HANDLER
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_pdu2_test_into(
|
|
|
|
pdu2_object_id=pdu2_object_id, p60dock_object_id=p60dock_object_id, tc_queue=service_queue
|
|
|
|
)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.ACU.value:
|
2021-05-17 17:42:04 +02:00
|
|
|
object_id = ACU_HANDLER_ID
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_acu_test_into(object_id=object_id, tc_queue=service_queue)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.TMP1075_1.value:
|
2021-05-17 17:42:04 +02:00
|
|
|
object_id = TMP_1075_1_HANDLER_ID
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.TMP1075_2.value:
|
2021-05-17 17:42:04 +02:00
|
|
|
object_id = TMP_1075_2_HANDLER_ID
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-03-19 17:39:52 +01:00
|
|
|
if service == CustomServiceList.HEATER.value:
|
2021-05-17 17:42:04 +02:00
|
|
|
object_id = HEATER_ID
|
2021-05-17 17:48:02 +02:00
|
|
|
return pack_heater_test_into(object_id=object_id, tc_queue=service_queue)
|
2021-03-26 13:56:02 +01:00
|
|
|
if service == CustomServiceList.IMTQ.value:
|
2021-06-11 13:51:56 +02:00
|
|
|
object_id = IMTQ_HANDLER_ID
|
2021-06-12 13:49:25 +02:00
|
|
|
return pack_imtq_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-04-11 11:08:52 +02:00
|
|
|
if service == CustomServiceList.PLOC.value:
|
2021-07-09 12:57:39 +02:00
|
|
|
object_id = PLOC_MPSOC_ID
|
2021-07-23 13:40:27 +02:00
|
|
|
return pack_ploc_mpsoc_test_into(object_id=object_id, tc_queue=service_queue)
|
2021-06-29 09:51:54 +02:00
|
|
|
if service == CustomServiceList.REACTION_WHEEL_1.value:
|
2021-06-25 12:16:35 +02:00
|
|
|
object_id = RW1_ID
|
2021-06-25 15:25:22 +02:00
|
|
|
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-06-29 09:51:54 +02:00
|
|
|
if service == CustomServiceList.REACTION_WHEEL_2.value:
|
|
|
|
object_id = RW2_ID
|
|
|
|
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
|
|
|
if service == CustomServiceList.REACTION_WHEEL_3.value:
|
|
|
|
object_id = RW3_ID
|
|
|
|
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
|
|
|
if service == CustomServiceList.REACTION_WHEEL_4.value:
|
|
|
|
object_id = RW4_ID
|
|
|
|
return pack_single_rw_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-07-01 11:52:25 +02:00
|
|
|
if service == CustomServiceList.RAD_SENSOR.value:
|
|
|
|
object_id = RAD_SENSOR_ID
|
|
|
|
return pack_rad_sensor_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-07-11 14:29:11 +02:00
|
|
|
if service == CustomServiceList.PLOC_SUPV.value:
|
|
|
|
object_id = PLOC_SUPV_ID
|
|
|
|
return pack_ploc_supv_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-08-07 14:34:26 +02:00
|
|
|
if service == CustomServiceList.PLOC_UPDATER.value:
|
|
|
|
object_id = PLOC_UPDATER_ID
|
|
|
|
return pack_ploc_updater_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
|
2021-08-03 15:28:28 +02:00
|
|
|
if service == CustomServiceList.CORE.value:
|
|
|
|
return pack_core_commands(tc_queue=service_queue, op_code=op_code)
|
2020-12-17 17:50:00 +01:00
|
|
|
LOGGER.warning("Invalid Service !")
|
|
|
|
|
|
|
|
|
|
|
|
def create_total_tc_queue_user() -> TcQueueT:
|
|
|
|
if not os.path.exists("log"):
|
|
|
|
os.mkdir("log")
|
|
|
|
tc_queue = deque()
|
2021-02-03 14:14:54 +01:00
|
|
|
pack_generic_service5_test_into(tc_queue)
|
2020-12-17 17:50:00 +01:00
|
|
|
tc_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
|
|
|
|
return tc_queue
|