29 lines
891 B
Python
29 lines
891 B
Python
|
from datetime import datetime
|
||
|
|
||
|
from spacepackets.ecss import PusTelecommand
|
||
|
from tmtccmd.config import QueueCommands
|
||
|
from tmtccmd.tc.definitions import TcQueueT
|
||
|
|
||
|
from tmtccmd.logging import get_console_logger
|
||
|
|
||
|
LOGGER = get_console_logger()
|
||
|
|
||
|
|
||
|
class OpCodes:
|
||
|
SET_CURRENT_TIME = ["0", "set-curr-time"]
|
||
|
|
||
|
|
||
|
class Info:
|
||
|
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
||
|
|
||
|
|
||
|
def pack_set_current_time_ascii_command(tc_queue: TcQueueT, ssc: int):
|
||
|
time_test_current_time = datetime.utcnow().isoformat() + "Z" + "\0"
|
||
|
current_time_ascii = time_test_current_time.encode("ascii")
|
||
|
LOGGER.info(f"Current time in ASCII format: {current_time_ascii}")
|
||
|
tc_queue.appendleft((QueueCommands.PRINT, Info.SET_CURRENT_TIME))
|
||
|
command = PusTelecommand(
|
||
|
service=9, subservice=128, ssc=ssc, app_data=current_time_ascii
|
||
|
)
|
||
|
tc_queue.appendleft(command.pack_command_tuple())
|