tmtcc_tc_service_5_event.py 1.82 KB
Newer Older
Robin Mueller's avatar
Robin Mueller committed
1
2
import enum

Robin Mueller's avatar
Robin Mueller committed
3
4
from tmtccmd.core.definitions import QueueCommands
from tmtccmd.pus_tc.tmtcc_pus_tc_base import PusTelecommand, TcQueueT
5
6


Robin Mueller's avatar
Robin Mueller committed
7
8
9
10
11
class Srv5Subservices(enum.IntEnum):
    ENABLE_EVENT_REPORTING = 5,
    DISABLE_EVENT_REPORTING = 128


12
def pack_enable_event_reporting_command(ssc: int):
Robin Mueller's avatar
Robin Mueller committed
13
    return PusTelecommand(service=5, subservice=Srv5Subservices.ENABLE_EVENT_REPORTING, ssc=ssc)
14

Robin Mueller's avatar
Robin Mueller committed
15

16
def pack_disable_event_reporting_command(ssc: int):
Robin Mueller's avatar
Robin Mueller committed
17
    return PusTelecommand(service=5, subservice=Srv5Subservices.DISABLE_EVENT_REPORTING, ssc=ssc)
18

Robin Mueller's avatar
Robin Mueller committed
19

Robin Mueller's avatar
Robin Mueller committed
20
def pack_generic_service5_test_into(tc_queue: TcQueueT):
Robin Mueller's avatar
Robin Mueller committed
21
    tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 5"))
22
    # invalid subservice
Robin Mueller's avatar
Robin Mueller committed
23
    tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 5: Invalid subservice"))
24
25
26
    command = PusTelecommand(service=5, subservice=1, ssc=500)
    tc_queue.appendleft(command.pack_command_tuple())
    # disable events
Robin Mueller's avatar
Robin Mueller committed
27
    tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 5: Disable event"))
28
29
30
    command = pack_disable_event_reporting_command(ssc=501)
    tc_queue.appendleft(command.pack_command_tuple())
    # trigger event
Robin Mueller's avatar
Robin Mueller committed
31
    tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 5: Trigger event"))
32
33
34
    command = PusTelecommand(service=17, subservice=128, ssc=510)
    tc_queue.appendleft(command.pack_command_tuple())
    # enable event
Robin Mueller's avatar
Robin Mueller committed
35
    tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 5: Enable event"))
36
37
38
    command = pack_enable_event_reporting_command(ssc=520)
    tc_queue.appendleft(command.pack_command_tuple())
    # trigger event
Robin Mueller's avatar
Robin Mueller committed
39
    tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 5: Trigger another event"))
40
41
    command = PusTelecommand(service=17, subservice=128, ssc=530)
    tc_queue.appendleft(command.pack_command_tuple())
Robin Mueller's avatar
Robin Mueller committed
42
43
    tc_queue.appendleft((QueueCommands.EXPORT_LOG, "log/tmtc_log_service5.txt"))