From 8fac0d286d026d574ace1b500f4c05d1b6587ede Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Sun, 1 Nov 2020 01:27:53 +0100
Subject: [PATCH] user code added

---
 config/obsw_user_code.py | 45 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100644 config/obsw_user_code.py

diff --git a/config/obsw_user_code.py b/config/obsw_user_code.py
new file mode 100644
index 0000000..4cfc48e
--- /dev/null
+++ b/config/obsw_user_code.py
@@ -0,0 +1,45 @@
+"""
+User defined code can be added here.
+"""
+from typing import Union, Tuple
+from tmtc_core.tc.obsw_pus_tc_base import PusTcInfo
+from enum import Enum
+
+
+# Yeah, I did not have a better idea yet..
+class Developer(Enum):
+    Robin = 0
+
+
+Developer = Developer.Robin
+
+
+def command_preparation_hook() -> Tuple[bytearray, Union[None, PusTcInfo]]:
+    """
+    Can be used to pack user-defined commands.
+    """
+    if Developer == Developer.Robin:
+        return prepare_robins_commands()
+
+
+def global_setup_hook():
+    """
+    Can be used to alter the global variables in a custom defined way.
+    For example, device specific com ports or ethernet ports can be set here.
+    The global variables in the config.obsw_config file can be edited here
+    by using the handle.
+    For example: config.obsw_config.G_ETHERNET_SEND_ADDRESS = new_send_address
+    """
+    if Developer == Developer.Robin:
+        global_setup_hook_robin()
+
+
+def prepare_robins_commands():
+    from tmtc_core.tc.obsw_pus_tc_base import PusTelecommand
+    command = PusTelecommand(service=17, subservice=1, ssc=20)
+    return command.pack_command_tuple()
+
+
+def global_setup_hook_robin():
+    import config.obsw_config
+    pass
-- 
GitLab