import enum from config.definitions import CustomServiceList from tmtccmd.tc.pus_8_funccmd import generate_action_command from tmtccmd.config import QueueCommands, ServiceOpCodeDictT, add_op_code_entry, add_service_op_code_entry from tmtccmd.tc.definitions import TcQueueT from config.object_ids import SCEX_HANDLER_ID class OpCodes: PING = ["0", "ping"] class ActionIds(enum.IntEnum): PING = 7 ION_CMD = 4 class Info: PING = "Send Ping command" def add_scex_cmds(cmd_dict: ServiceOpCodeDictT): op_code_dict = dict() add_op_code_entry( op_code_dict=op_code_dict, keys=OpCodes.PING, info=Info.PING ) # ion op_code_dict = dict() add_op_code_entry( op_code_dict=op_code_dict, keys=OpCodes.ION, info=Info.ION ) add_service_op_code_entry( srv_op_code_dict=cmd_dict, name=CustomServiceList.SCEX.value, info="SCEX Device", op_code_entry=op_code_dict ) """ #in app_data app_data.extend(struct.pack("!H", first_dac)) append_16_bit_val(packet=packet, val=CFG.exp_cfg.first_dac[cn]) append_16_bit_val(packet=packet, val=CFG.exp_cfg.last_dac[cn]) append_16_bit_val(packet=packet, val=CFG.exp_cfg.res_switch1[cn]) append_16_bit_val(packet=packet, val=CFG.exp_cfg.res_switch2[cn]) packet.append(CFG.exp_cfg.dac_weight1[cn]) packet.append(CFG.exp_cfg.dac_weight2[cn]) packet.append(CFG.exp_cfg.dac_weight3[cn]) """ def pack_scex_cmds(tc_queue: TcQueueT, op_code: str): if op_code in OpCodes.PING: tc_queue.appendleft((QueueCommands.PRINT, Info.PING)) app_data = bytes([0]) command = generate_action_command(SCEX_HANDLER_ID, ActionIds.PING, app_data) tc_queue.appendleft(command.pack_command_tuple()) if op_code in OpCodes.ION: tc_queue.appendleft((QueueCommands.PRINT, Info.ION)) app_data = bytes([0]) command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ION, app_data) tc_queue.appendleft(command.pack_command_tuple()) # one cell if op_code in OpCodes.ION: tc_queue.appendleft((QueueCommands.PRINT, Info.ION)) app_data = bytearray([0]) #todo cell number app_data.extend(struct.pack("!H", first_dac)) #aus json holen command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ION, app_data) tc_queue.appendleft(command.pack_command_tuple())