passing through op code

This commit is contained in:
Robin Müller 2021-05-17 17:48:02 +02:00
parent acb48916cf
commit e8f48480f5
No known key found for this signature in database
GPG Key ID: 71B58F8A3CDFA9AC
2 changed files with 13 additions and 9 deletions

View File

@ -30,32 +30,36 @@ LOGGER = get_logger()
def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT): def pack_service_queue_user(service: Union[str, int], op_code: str, service_queue: TcQueueT):
if service == CoreServiceList.SERVICE_5.value: if service == CoreServiceList.SERVICE_5.value:
return pack_generic_service5_test_into(service_queue) return pack_generic_service5_test_into(tc_queue=service_queue)
if service == CoreServiceList.SERVICE_17.value: if service == CoreServiceList.SERVICE_17.value:
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 = P60_DOCK_HANDLER object_id = P60_DOCK_HANDLER
return pack_p60dock_test_into(object_id, service_queue) return pack_p60dock_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.PDU1.value: if service == CustomServiceList.PDU1.value:
pdu1_object_id = PDU_1_HANDLER_ID pdu1_object_id = PDU_1_HANDLER_ID
p60dock_object_id = P60_DOCK_HANDLER p60dock_object_id = P60_DOCK_HANDLER
return pack_pdu1_test_into(pdu1_object_id, p60dock_object_id, service_queue) return pack_pdu1_test_into(
pdu1_object_id=pdu1_object_id, p60dock_object_id=p60dock_object_id, tc_queue=service_queue
)
if service == CustomServiceList.PDU2.value: if service == CustomServiceList.PDU2.value:
pdu2_object_id = PDU_2_HANDLER_ID pdu2_object_id = PDU_2_HANDLER_ID
p60dock_object_id = P60_DOCK_HANDLER p60dock_object_id = P60_DOCK_HANDLER
return pack_pdu2_test_into(pdu2_object_id, p60dock_object_id, service_queue) return pack_pdu2_test_into(
pdu2_object_id=pdu2_object_id, p60dock_object_id=p60dock_object_id, tc_queue=service_queue
)
if service == CustomServiceList.ACU.value: if service == CustomServiceList.ACU.value:
object_id = ACU_HANDLER_ID object_id = ACU_HANDLER_ID
return pack_acu_test_into(object_id, service_queue) return pack_acu_test_into(object_id=object_id, tc_queue=service_queue)
if service == CustomServiceList.TMP1075_1.value: if service == CustomServiceList.TMP1075_1.value:
object_id = TMP_1075_1_HANDLER_ID object_id = TMP_1075_1_HANDLER_ID
return pack_tmp1075_test_into(object_id, service_queue) return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.TMP1075_2.value: if service == CustomServiceList.TMP1075_2.value:
object_id = TMP_1075_2_HANDLER_ID object_id = TMP_1075_2_HANDLER_ID
return pack_tmp1075_test_into(object_id, service_queue) return pack_tmp1075_test_into(object_id=object_id, tc_queue=service_queue, op_code=op_code)
if service == CustomServiceList.HEATER.value: if service == CustomServiceList.HEATER.value:
object_id = HEATER_ID object_id = HEATER_ID
return pack_heater_test_into(object_id, service_queue) return pack_heater_test_into(object_id=object_id, tc_queue=service_queue)
LOGGER.warning("Invalid Service !") LOGGER.warning("Invalid Service !")

View File

@ -30,7 +30,7 @@ class Tmp1075ActionIds:
start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02]) start_adc_conversion = bytearray([0x0, 0x0, 0x0, 0x02])
def pack_tmp1075_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT: def pack_tmp1075_test_into(object_id: bytearray, op_code: str, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft( tc_queue.appendleft(
(QueueCommands.PRINT, (QueueCommands.PRINT,
"Testing Tmp1075 Temperature Sensor Handler with object id: 0x" + object_id.hex()) "Testing Tmp1075 Temperature Sensor Handler with object id: 0x" + object_id.hex())