Commit e342941f authored by Robin Mueller's avatar Robin Mueller
Browse files

added int enums

parent 63f3bec2
import enum
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand, TcQueueT
class Srv17Subservices(enum.IntEnum):
PING_CMD = 1,
GEN_EVENT = 128
def pack_service17_ping_command(ssc: int) -> PusTelecommand:
return PusTelecommand(service=17, subservice=1, ssc=ssc)
return PusTelecommand(service=17, subservice=Srv17Subservices.PING_CMD, ssc=ssc)
def pack_generic_service17_test(init_ssc: int, tc_queue: TcQueueT) -> int:
......@@ -20,7 +27,7 @@ def pack_generic_service17_test(init_ssc: int, tc_queue: TcQueueT) -> int:
new_ssc += 1
# test event
tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 17: Trigger event"))
command = PusTelecommand(service=17, subservice=128, ssc=new_ssc)
command = PusTelecommand(service=17, subservice=Srv17Subservices.GEN_EVENT, ssc=new_ssc)
tc_queue.appendleft(command.pack_command_tuple())
new_ssc += 1
# invalid subservice
......
......@@ -4,7 +4,7 @@ import struct
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
class Srv3Subservice(enum.Enum):
class Srv3Subservice(enum.IntEnum):
ENABLE_PERIODIC_HK_GEN = 5,
DISABLE_PERIODIC_HK_GEN = 6,
ENABLE_PERIODIC_DIAGNOSTICS_GEN = 7,
......
import enum
from tmtc_core.core.tmtc_core_definitions import QueueCommands
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand, TcQueueT
class Srv5Subservices(enum.IntEnum):
ENABLE_EVENT_REPORTING = 5,
DISABLE_EVENT_REPORTING = 128
def pack_enable_event_reporting_command(ssc: int):
return PusTelecommand(service=5, subservice=5, ssc=ssc)
return PusTelecommand(service=5, subservice=Srv5Subservices.ENABLE_EVENT_REPORTING, ssc=ssc)
def pack_disable_event_reporting_command(ssc: int):
return PusTelecommand(service=5, subservice=6, ssc=ssc)
return PusTelecommand(service=5, subservice=Srv5Subservices.DISABLE_EVENT_REPORTING, ssc=ssc)
def pack_generic_service5_test_into(tc_queue: TcQueueT):
......
import enum
import struct
from tmtc_core.pus_tc.tmtcc_pus_tc_base import PusTelecommand
class Srv8Subservices(enum.IntEnum):
FUNC_CMD = 128,
DATA_REPLY = 130
def generate_action_command(object_id: bytearray, action_id: int, data: bytearray = bytearray([]),
ssc: int = 0) -> PusTelecommand:
data_to_pack = bytearray(object_id)
data_to_pack += make_action_id(action_id) + data
return PusTelecommand(service=8, subservice=128, ssc=ssc, app_data=data_to_pack)
return PusTelecommand(
service=8, subservice=Srv8Subservices.FUNC_CMD, ssc=ssc, app_data=data_to_pack
)
def make_action_id(action_id: int) -> bytearray:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment