some renaming

This commit is contained in:
Robin Müller 2021-03-19 18:03:41 +01:00
parent 6e3bef7ac5
commit 4d737bfc12
5 changed files with 38 additions and 39 deletions

View File

@ -7,20 +7,20 @@
import enum import enum
from typing import Dict from typing import Dict
PUS_SERVICE_17 = bytearray([0x53, 0x00, 0x00, 0x17]) PUS_SERVICE_17_ID = bytearray([0x53, 0x00, 0x00, 0x17])
TEST_DEVICE = bytearray([0x44, 0x00, 0xAF, 0xFE]) TEST_DEVICE_ID = bytearray([0x44, 0x00, 0xAF, 0xFE])
P60_DOCK_HANDLER = bytearray([0x44, 0x00, 0x00, 0x1]) P60_DOCK_HANDLER = bytearray([0x44, 0x00, 0x00, 0x1])
PDU_1_HANDLER = bytearray([0x44, 0x00, 0x00, 0x2]) PDU_1_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x2])
PDU_2_HANDLER = bytearray([0x44, 0x00, 0x00, 0x3]) PDU_2_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x3])
ACU_HANDLER = bytearray([0x44, 0x00, 0x00, 0x4]) ACU_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x4])
TMP_1075_1_HANDLER = bytearray([0x44, 0x00, 0x00, 0x5]) TMP_1075_1_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x5])
TMP_1075_2_HANDLER = bytearray([0x44, 0x00, 0x00, 0x6]) TMP_1075_2_HANDLER_ID = bytearray([0x44, 0x00, 0x00, 0x6])
HEATER = bytearray([0x54, 0x00, 0x00, 0x1]) HEATER_ID = bytearray([0x54, 0x00, 0x00, 0x1])
PCDU_HANDLER = bytearray([0x44, 0x00, 0x10, 0x00]) PCDU_HANDLER_ID = bytearray([0x44, 0x00, 0x10, 0x00])
SOLAR_ARRAY_DEPLOYMENT = bytearray([0x44, 0x00, 0x10, 0x01]) SOLAR_ARRAY_DEPLOYMENT_ID = bytearray([0x44, 0x00, 0x10, 0x01])
class CustomObjectIds(enum.IntEnum): class ObjIdIds(enum.IntEnum):
PUS_SERVICE_17_ID = 0 PUS_SERVICE_17_ID = 0
TEST_DEVICE_ID = 1 TEST_DEVICE_ID = 1
P60DOCK_HANDLER_ID = 2 P60DOCK_HANDLER_ID = 2
@ -35,18 +35,17 @@ class CustomObjectIds(enum.IntEnum):
def set_object_ids() -> Dict[int, bytearray]: def set_object_ids() -> Dict[int, bytearray]:
o_ids = CustomObjectIds
object_id_dict = ({ object_id_dict = ({
o_ids.PUS_SERVICE_17_ID: PUS_SERVICE_17, ObjIdIds.PUS_SERVICE_17_ID: PUS_SERVICE_17_ID,
o_ids.TEST_DEVICE_ID: TEST_DEVICE, ObjIdIds.TEST_DEVICE_ID: TEST_DEVICE_ID,
o_ids.P60DOCK_HANDLER_ID: P60_DOCK_HANDLER, ObjIdIds.P60DOCK_HANDLER_ID: P60_DOCK_HANDLER,
o_ids.PDU1_HANDLER_ID: PDU_1_HANDLER, ObjIdIds.PDU1_HANDLER_ID: PDU_1_HANDLER_ID,
o_ids.PDU2_HANDLER_ID: PDU_2_HANDLER, ObjIdIds.PDU2_HANDLER_ID: PDU_2_HANDLER_ID,
o_ids.ACU_HANDLER_ID: ACU_HANDLER, ObjIdIds.ACU_HANDLER_ID: ACU_HANDLER_ID,
o_ids.TMP1075_1_HANDLER_ID: TMP_1075_1_HANDLER, ObjIdIds.TMP1075_1_HANDLER_ID: TMP_1075_1_HANDLER_ID,
o_ids.TMP1075_2_HANDLER_ID: TMP_1075_2_HANDLER, ObjIdIds.TMP1075_2_HANDLER_ID: TMP_1075_2_HANDLER_ID,
o_ids.HEATER_ID: HEATER, ObjIdIds.HEATER_ID: HEATER_ID,
o_ids.PCDU_HANDLER_ID: PCDU_HANDLER, ObjIdIds.PCDU_HANDLER_ID: PCDU_HANDLER_ID,
o_ids.SOLAR_ARRAY_DEPLOYMENT_ID: SOLAR_ARRAY_DEPLOYMENT, ObjIdIds.SOLAR_ARRAY_DEPLOYMENT_ID: SOLAR_ARRAY_DEPLOYMENT_ID,
}) })
return object_id_dict return object_id_dict

View File

@ -11,7 +11,7 @@ from tmtccmd.pus_tc.base import PusTelecommand
from tmtccmd.core.definitions import QueueCommands from tmtccmd.core.definitions import QueueCommands
from gomspace.gomspace_common import * from gomspace.gomspace_common import *
from pus_tc.p60dock import P60DockConfigTable from pus_tc.p60dock import P60DockConfigTable
from config.object_ids import CustomObjectIds from config.object_ids import ObjIdIds
from tmtccmd.core.object_id_manager import get_object_id from tmtccmd.core.object_id_manager import get_object_id
@ -57,7 +57,7 @@ def pack_acu_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU")) tc_queue.appendleft((QueueCommands.PRINT, "Testing ACU"))
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling ACU connected to X1 slot (channel 0)")) tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Enabling ACU connected to X1 slot (channel 0)"))
p60dock_object_id = get_object_id(CustomObjectIds.P60DOCK_HANDLER_ID) p60dock_object_id = get_object_id(ObjIdIds.P60DOCK_HANDLER_ID)
command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address, command = pack_set_param_command(p60dock_object_id, P60DockConfigTable.out_en_0.parameter_address,
P60DockConfigTable.out_en_0.parameter_size, Channel.on) P60DockConfigTable.out_en_0.parameter_size, Channel.on)
command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command) command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)

View File

@ -9,9 +9,9 @@ from tmtccmd.core.definitions import QueueCommands
from tmtccmd.pus_tc.base import PusTelecommand from tmtccmd.pus_tc.base import PusTelecommand
from tmtccmd.pus_tc.packer import TcQueueT from tmtccmd.pus_tc.packer import TcQueueT
from tmtccmd.pus_tc.service_200_mode import pack_mode_data from tmtccmd.pus_tc.service_200_mode import pack_mode_data
from config.object_ids import TEST_DEVICE from config.object_ids import TEST_DEVICE_ID
TEST_DEVICE_OBJ_ID = TEST_DEVICE TEST_DEVICE_OBJ_ID = TEST_DEVICE_ID
def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT: def pack_service200_test_into(tc_queue: TcQueueT) -> TcQueueT:

View File

@ -22,7 +22,7 @@ from pus_tc.acu import pack_acu_test_into
from pus_tc.tmp1075 import pack_tmp1075_test_into from pus_tc.tmp1075 import pack_tmp1075_test_into
from pus_tc.heater import pack_heater_test_into from pus_tc.heater import pack_heater_test_into
from config.definitions import CustomServiceList from config.definitions import CustomServiceList
from config.object_ids import CustomObjectIds from config.object_ids import ObjIdIds
LOGGER = get_logger() LOGGER = get_logger()
@ -34,27 +34,27 @@ def pack_service_queue_user(service: Union[str, int], op_code: str, service_queu
if service == CoreServiceList.SERVICE_17: if service == CoreServiceList.SERVICE_17:
return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple()) return service_queue.appendleft(pack_service17_ping_command(ssc=1700).pack_command_tuple())
if service == CustomServiceList.P60DOCK.value: if service == CustomServiceList.P60DOCK.value:
object_id = get_object_id(CustomObjectIds.P60DOCK_HANDLER_ID) object_id = get_object_id(ObjIdIds.P60DOCK_HANDLER_ID)
return pack_p60dock_test_into(object_id, service_queue) return pack_p60dock_test_into(object_id, service_queue)
if service == CustomServiceList.PDU1.value: if service == CustomServiceList.PDU1.value:
pdu1_object_id = get_object_id(CustomObjectIds.PDU1_HANDLER_ID) pdu1_object_id = get_object_id(ObjIdIds.PDU1_HANDLER_ID)
p60dock_object_id = get_object_id(CustomObjectIds.P60DOCK_HANDLER_ID) p60dock_object_id = get_object_id(ObjIdIds.P60DOCK_HANDLER_ID)
return pack_pdu1_test_into(pdu1_object_id, p60dock_object_id, service_queue) return pack_pdu1_test_into(pdu1_object_id, p60dock_object_id, service_queue)
if service == CustomServiceList.PDU2.value: if service == CustomServiceList.PDU2.value:
pdu2_object_id = get_object_id(CustomObjectIds.PDU2_HANDLER_ID) pdu2_object_id = get_object_id(ObjIdIds.PDU2_HANDLER_ID)
p60dock_object_id = get_object_id(CustomObjectIds.P60DOCK_HANDLER_ID) p60dock_object_id = get_object_id(ObjIdIds.P60DOCK_HANDLER_ID)
return pack_pdu2_test_into(pdu2_object_id, p60dock_object_id, service_queue) return pack_pdu2_test_into(pdu2_object_id, p60dock_object_id, service_queue)
if service == CustomServiceList.ACU.value: if service == CustomServiceList.ACU.value:
object_id = get_object_id(CustomObjectIds.ACU_HANDLER_ID) object_id = get_object_id(ObjIdIds.ACU_HANDLER_ID)
return pack_acu_test_into(object_id, service_queue) return pack_acu_test_into(object_id, service_queue)
if service == CustomServiceList.TMP1075_1.value: if service == CustomServiceList.TMP1075_1.value:
object_id = get_object_id(CustomObjectIds.TMP1075_1_HANDLER_ID) object_id = get_object_id(ObjIdIds.TMP1075_1_HANDLER_ID)
return pack_tmp1075_test_into(object_id, service_queue) return pack_tmp1075_test_into(object_id, service_queue)
if service == CustomServiceList.TMP1075_2.value: if service == CustomServiceList.TMP1075_2.value:
object_id = get_object_id(CustomObjectIds.TMP1075_2_HANDLER_ID) object_id = get_object_id(ObjIdIds.TMP1075_2_HANDLER_ID)
return pack_tmp1075_test_into(object_id, service_queue) return pack_tmp1075_test_into(object_id, service_queue)
if service == CustomServiceList.HEATER.value: if service == CustomServiceList.HEATER.value:
object_id = get_object_id(CustomObjectIds.HEATER) object_id = get_object_id(ObjIdIds.HEATER)
return pack_heater_test_into(object_id, service_queue) return pack_heater_test_into(object_id, service_queue)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")

View File

@ -1,5 +1,5 @@
from typing import Tuple from typing import Tuple
from config.object_ids import CustomObjectIds from config.object_ids import ObjIdIds
def user_analyze_service_8_data( def user_analyze_service_8_data(
@ -15,7 +15,7 @@ def user_analyze_service_8_data(
@param custom_data: @param custom_data:
@return: @return:
""" """
if object_id == CustomObjectIds.PDU2_HANDLER_ID.value: if object_id == ObjIdIds.PDU2_HANDLER_ID.value:
header_list = ['PDU2 Service 8 Reply'] header_list = ['PDU2 Service 8 Reply']
data_string = str() data_string = str()