From fbfd477657870ca2a39feec2676d0ff117447346 Mon Sep 17 00:00:00 2001
From: "Robin.Mueller" <robin.mueller.m@gmail.com>
Date: Sun, 12 Jan 2020 15:55:23 +0100
Subject: [PATCH] printData for tm receive adapted

---
 OBSW_TmTcClient.py    | 9 +++++----
 tm/OBSW_PusPacket.py  | 7 +++++--
 tm/OBSW_TmService1.py | 1 +
 3 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/OBSW_TmTcClient.py b/OBSW_TmTcClient.py
index 8c7c62b..8994970 100644
--- a/OBSW_TmTcClient.py
+++ b/OBSW_TmTcClient.py
@@ -120,10 +120,11 @@ def main():
 # Prepare command for single command testing
 def commandPreparation():
     # Direct command which triggers an additional step reply and one completion reply
-    objectId = bytearray([0x44, 0x00, 0xAF, 0xFE])
-    actionId = bytearray([0xBA, 0xDE, 0xAF, 0xFE])
-    directCommand = objectId + actionId
-    command = PUSTelecommand(service=8, subservice=128, SSC=840, data=directCommand)
+    # Single Command Testing
+    # command = PUSTelecommand(service=17, subservice=1, SSC=21)
+    file = bytearray([1, 2, 3, 4, 5])
+    command = PUSTelecommand(service=23, subservice=1, SSC=21, data=file)
+    command.packCommandTuple()
     return command.packCommandTuple()
 
 
diff --git a/tm/OBSW_PusPacket.py b/tm/OBSW_PusPacket.py
index 55d2fe3..000e8cc 100644
--- a/tm/OBSW_PusPacket.py
+++ b/tm/OBSW_PusPacket.py
@@ -135,11 +135,14 @@ class OBSWPusPacket:
         return self.PUSHeader.sourceSequenceCount
 
     def printData(self):
+        print(self.returnDataString())
+
+    def returnDataString(self):
         strToPrint = "["
         for byte in self.data:
             strToPrint += str(hex(byte)) + " , "
-            strToPrint = strToPrint.rstrip(' , ')
-            strToPrint += ']'
+        strToPrint = strToPrint.rstrip(' , ')
+        strToPrint += ']'
         return strToPrint
 
 # Structure of a PUS Packet :
diff --git a/tm/OBSW_TmService1.py b/tm/OBSW_TmService1.py
index bee2f6f..88119e3 100644
--- a/tm/OBSW_TmService1.py
+++ b/tm/OBSW_TmService1.py
@@ -30,6 +30,7 @@ class Service1TM(PUSTelemetry):
                 self.errorParam1 = struct.unpack('>I', self.byteArrayData[7:11])[0]
                 self.errorParam2 = struct.unpack('>I', self.byteArrayData[11:15])[0]
             else:
+                # self.printData()
                 self.ErrCode = struct.unpack('>H', self.byteArrayData[4:6])[0]
                 self.errorParam1 = struct.unpack('>I', self.byteArrayData[6:10])[0]
                 self.errorParam2 = struct.unpack('>I', self.byteArrayData[10:14])[0]
-- 
GitLab