2022-04-09 18:44:04 +02:00
|
|
|
from datetime import datetime
|
|
|
|
|
|
|
|
from spacepackets.ecss import PusTelecommand
|
|
|
|
|
|
|
|
from tmtccmd.logging import get_console_logger
|
2022-07-04 17:59:09 +02:00
|
|
|
from tmtccmd.tc import QueueHelper
|
2022-04-09 18:44:04 +02:00
|
|
|
|
|
|
|
LOGGER = get_console_logger()
|
|
|
|
|
|
|
|
|
|
|
|
class OpCodes:
|
|
|
|
SET_CURRENT_TIME = ["0", "set-curr-time"]
|
|
|
|
|
|
|
|
|
|
|
|
class Info:
|
|
|
|
SET_CURRENT_TIME = "Setting current time in ASCII format"
|
|
|
|
|
|
|
|
|
2022-07-04 17:59:09 +02:00
|
|
|
def pack_set_current_time_ascii_command(q: QueueHelper):
|
2022-04-09 18:44:04 +02:00
|
|
|
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}")
|
2022-07-04 17:59:09 +02:00
|
|
|
q.add_log_cmd(Info.SET_CURRENT_TIME)
|
|
|
|
q.add_pus_tc(PusTelecommand(service=9, subservice=128, app_data=current_time_ascii))
|