eive-tmtc/pus_tc/devs/gps.py
2022-03-04 10:41:05 +01:00

23 lines
809 B
Python

import enum
from tmtccmd.config.definitions import QueueCommands
from tmtccmd.tc.definitions import TcQueueT
from tmtccmd.tc.service_8_functional_cmd import generate_action_command
from config.object_ids import GPS_HANDLER_1_ID, GPS_HANDLER_0_ID
class GpsOpCodes(enum.Enum):
RESET_GNSS = "5"
def pack_gps_command(object_id: bytes, tc_queue: TcQueueT, op_code: str):
if op_code == GpsOpCodes.RESET_GNSS.value:
if object_id == GPS_HANDLER_0_ID:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting GPS device 0"))
elif object_id == GPS_HANDLER_1_ID:
tc_queue.appendleft((QueueCommands.PRINT, "Resetting GPS device 1"))
cmd = generate_action_command(object_id=object_id, action_id=int(op_code))
tc_queue.appendleft(cmd.pack_command_tuple())