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
|
|
|
|
|
|
|
|
from config.tmtcc_definitions import ServiceList
|
|
|
|
from tmtc_core.utility.tmtcc_logger import get_logger
|
|
|
|
from tmtc_core.pus_tc.tmtcc_pus_tc_base import TcQueueT
|
2021-02-03 14:14:54 +01:00
|
|
|
from tmtc_core.pus_tc.tmtcc_tc_service_5_event import pack_generic_service5_test_into
|
|
|
|
from tmtc_core.pus_tc.tmtcc_tc_service_17_test import pack_service17_ping_command
|
2020-12-29 11:29:03 +01:00
|
|
|
from pus_tc.tmtcc_tc_p60dock import pack_p60dock_test_into
|
|
|
|
from pus_tc.tmtcc_tc_pdu2 import pack_pdu2_test_into
|
|
|
|
from pus_tc.tmtcc_tc_pdu1 import pack_pdu1_test_into
|
|
|
|
from pus_tc.tmtcc_tc_acu import pack_acu_test_into
|
|
|
|
from tmtc_core.core.tmtcc_object_id_manager import get_object_id
|
|
|
|
from config.tmtcc_object_ids import ObjectIds
|
2021-01-10 11:42:06 +01:00
|
|
|
from pus_tc.tmtcc_tc_tmp1075 import pack_tmp1075_test_into
|
2021-02-06 16:35:53 +01:00
|
|
|
from pus_tc.tmtcc_tc_heater import pack_heater_test_into
|
2021-02-16 15:33:26 +01:00
|
|
|
from pus_tc.tmtcc_tc_solar_array_deployment import pack_solar_array_deployment_test_into
|
2020-12-17 17:50:00 +01:00
|
|
|
|
|
|
|
LOGGER = get_logger()
|
|
|
|
|
|
|
|
|
2021-02-03 14:14:54 +01:00
|
|
|
def pack_service_queue_user(service: ServiceList, op_code: str, service_queue: TcQueueT):
|
2020-12-17 17:50:00 +01:00
|
|
|
if service == ServiceList.SERVICE_5:
|
2021-02-03 14:14:54 +01:00
|
|
|
return pack_generic_service5_test_into(service_queue)
|
2020-12-17 17:50:00 +01:00
|
|
|
if service == ServiceList.SERVICE_17:
|
|
|
|
return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
|
2020-12-29 11:29:03 +01:00
|
|
|
if service == ServiceList.P60DOCK:
|
|
|
|
object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
|
|
|
|
return pack_p60dock_test_into(object_id, service_queue)
|
|
|
|
if service == ServiceList.PDU1:
|
2021-02-06 16:35:53 +01:00
|
|
|
pdu1_object_id = get_object_id(ObjectIds.PDU1_HANDLER_ID)
|
|
|
|
p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
|
|
|
|
return pack_pdu1_test_into(pdu1_object_id, p60dock_object_id, service_queue)
|
2020-12-29 11:29:03 +01:00
|
|
|
if service == ServiceList.PDU2:
|
2021-02-06 16:35:53 +01:00
|
|
|
pdu2_object_id = get_object_id(ObjectIds.PDU2_HANDLER_ID)
|
|
|
|
p60dock_object_id = get_object_id(ObjectIds.P60DOCK_HANDLER_ID)
|
|
|
|
return pack_pdu2_test_into(pdu2_object_id, p60dock_object_id, service_queue)
|
2020-12-29 11:29:03 +01:00
|
|
|
if service == ServiceList.ACU:
|
|
|
|
object_id = get_object_id(ObjectIds.ACU_HANDLER_ID)
|
|
|
|
return pack_acu_test_into(object_id, service_queue)
|
2021-01-30 11:20:34 +01:00
|
|
|
if service == ServiceList.TMP1075_1:
|
2021-01-10 11:42:06 +01:00
|
|
|
object_id = get_object_id(ObjectIds.TMP1075_1_HANDLER_ID)
|
|
|
|
return pack_tmp1075_test_into(object_id, service_queue)
|
2021-01-30 11:20:34 +01:00
|
|
|
if service == ServiceList.TMP1075_2:
|
|
|
|
object_id = get_object_id(ObjectIds.TMP1075_2_HANDLER_ID)
|
|
|
|
return pack_tmp1075_test_into(object_id, service_queue)
|
2021-02-06 16:35:53 +01:00
|
|
|
if service == ServiceList.HEATER:
|
|
|
|
object_id = get_object_id(ObjectIds.HEATER)
|
|
|
|
return pack_heater_test_into(object_id, service_queue)
|
2021-02-16 15:33:26 +01:00
|
|
|
if service == ServiceList.SA_DEPL:
|
|
|
|
object_id = get_object_id(ObjectIds.SOLAR_ARRAY_DEPLOYMENT_HANDLER)
|
|
|
|
return pack_solar_array_deployment_test_into(object_id, service_queue)
|
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
|