From b3fe9385cdf9f94b36c94c40dd444ac128d6c5ca Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" <robin.mueller.m@gmail.com> Date: Sat, 18 Jan 2020 16:49:56 +0100 Subject: [PATCH] Service 3 testing continued --- tc/OBSW_TcService3.py | 60 ++++++++++++++++++++----------------- tm/OBSW_TmService3.py | 5 ++-- utility/OBSW_TmTcPrinter.py | 3 +- 3 files changed, 37 insertions(+), 31 deletions(-) diff --git a/tc/OBSW_TcService3.py b/tc/OBSW_TcService3.py index 19d18e3..b6144bb 100644 --- a/tc/OBSW_TcService3.py +++ b/tc/OBSW_TcService3.py @@ -24,11 +24,19 @@ def packService3TestInto(tcQueue): p4 = bytearray([0x04, 0x04, 0x04, 0x04]) p5 = bytearray([0x05, 0x05, 0x05, 0x05]) hkDefinition1 = sid1 + collectionInterval + numberOfParameters + p1 + p2 + p3 + p4 + p5 + collectionInterval = struct.pack('>f', 6) hkDefinition2 = sid2 + collectionInterval + numberOfParameters + p1 + p2 + p3 + p4 + p5 - # adding custom definition to hk pool using test pool variables - tcQueue.put(("print", "\r\nTesting Service 3: Adding custom HK definition")) + + # deleting pre-defined test entry + tcQueue.put(("print", "\r\nTesting Service 3: Deleting pre-defined HK definition")) + command = PUSTelecommand(service=3, subservice=3, SSC=3000, data=sid1) + tcQueue.put(command.packCommandTuple()) + + # adding pre-defined definition to hk using test pool variables + tcQueue.put(("print", "\r\nTesting Service 3: Adding pre-defined HK definition")) command = PUSTelecommand(service=3, subservice=1, SSC=3010, data=hkDefinition1) tcQueue.put(command.packCommandTuple()) + # adding custom definition to diagnostics using test pool variables tcQueue.put(("print", "\r\nTesting Service 3: Adding custom diganostics definition")) command = PUSTelecommand(service=3, subservice=2, SSC=3020, data=hkDefinition2) @@ -38,30 +46,30 @@ def packService3TestInto(tcQueue): tcQueue.put(("print", "\r\nTesting Service 3: Enable custom definition")) command = PUSTelecommand(service=3, subservice=5, SSC=3030, data=sid1) tcQueue.put(command.packCommandTuple()) - # # enable custom diag definition - # tcQueue.put(("print", "\r\nTesting Service 3: Enable custom diagnostics definition")) - # command = PUSTelecommand(service=3, subservice=7, SSC=3030, data=sid1) - # tcQueue.put(command.packCommandTuple()) - # # enable gps0 - # tcQueue.put(("print", "\r\nTesting Service 3: Enable GPS definition")) - # command = PUSTelecommand(service=3, subservice=5, SSC=3030, data=sidGps) - # tcQueue.put(command.packCommandTuple()) + # enable custom diag definition + tcQueue.put(("print", "\r\nTesting Service 3: Enable custom diagnostics definition")) + command = PUSTelecommand(service=3, subservice=7, SSC=3040, data=sid2) + tcQueue.put(command.packCommandTuple()) + # enable gps0 + tcQueue.put(("print", "\r\nTesting Service 3: Enable GPS definition")) + command = PUSTelecommand(service=3, subservice=5, SSC=3050, data=sidGps) + tcQueue.put(command.packCommandTuple()) # maybe wait a bit to receive at least 2 packets.. - tcQueue.put(("wait", 8)) + tcQueue.put(("wait", 3)) # Disable custom hk definition - # tcQueue.put(("print", "\r\nTesting Service 3: Disable custom definition")) - # command = PUSTelecommand(service=3, subservice=6, SSC=3030, data=sid1) - # tcQueue.put(command.packCommandTuple()) + tcQueue.put(("print", "\r\nTesting Service 3: Disable custom definition")) + command = PUSTelecommand(service=3, subservice=6, SSC=3060, data=sid1) + tcQueue.put(command.packCommandTuple()) # Disable custom diag definition - # tcQueue.put(("print", "\r\nTesting Service 3: Disable custom diagnostics definition")) - # command = PUSTelecommand(service=3, subservice=8, SSC=3030, data=sid1) - # tcQueue.put(command.packCommandTuple()) - # # disable gps0 - # tcQueue.put(("print", "\r\nTesting Service 3: Disable GPS definition")) - # command = PUSTelecommand(service=3, subservice=6, SSC=3030, data=sidGps) - # tcQueue.put(command.packCommandTuple()) + tcQueue.put(("print", "\r\nTesting Service 3: Disable custom diagnostics definition")) + command = PUSTelecommand(service=3, subservice=8, SSC=3070, data=sid2) + tcQueue.put(command.packCommandTuple()) + # disable gps0 + tcQueue.put(("print", "\r\nTesting Service 3: Disable GPS definition")) + command = PUSTelecommand(service=3, subservice=6, SSC=3080, data=sidGps) + tcQueue.put(command.packCommandTuple()) # report custom hk definition # report custom diag definition @@ -79,15 +87,11 @@ def packService3TestInto(tcQueue): # report custom hk definition # report custom diag definition # delete custom hk definition - # delete custom diag definition - # tcQueue.put(("print", "\r\nTesting Service 3: Deleting custom HK definition")) - # command = PUSTelecommand(service=3, subservice=3, SSC=3080, data=sid1) - # tcQueue.put(command.packCommandTuple()) # delete custom diag definition - # tcQueue.put(("print", "\r\nTesting Service 3: Deleting custom diagnostics definition")) - # command = PUSTelecommand(service=3, subservice=4, SSC=3090, data=sid2) - # tcQueue.put(command.packCommandTuple()) + tcQueue.put(("print", "\r\nTesting Service 3: Deleting custom diagnostics definition")) + command = PUSTelecommand(service=3, subservice=4, SSC=3120, data=sid2) + tcQueue.put(command.packCommandTuple()) # do some basic testing on predefined structs too # e.g. add one variable, change interval, report them.... diff --git a/tm/OBSW_TmService3.py b/tm/OBSW_TmService3.py index 4a693cd..762a496 100644 --- a/tm/OBSW_TmService3.py +++ b/tm/OBSW_TmService3.py @@ -17,7 +17,8 @@ class Service3TM(PUSTelemetry): self.hkHeader = [] self.hkContent = [] self.printPacketInfo("Housekeeping Packet") - if self.getSubservice() == 25: + self.paramLength = 0 + if self.getSubservice() == 25 or self.getSubservice() == 26: self.paramLength = len(self.byteArrayData) - 4 # TODO: This can be automated by using the MIB parser pool names and pool datatypes if self.sid == 0x1f00 or self.sid == 0x2f00: @@ -50,7 +51,7 @@ class Service3TM(PUSTelemetry): self.hkContent.append(self.vx) self.hkContent.append(self.vy) self.hkContent.append(self.vz) - elif self.sid == 0x4300: + elif self.sid == 0x4300 or self.sid == 0x4400: self.hkHeader = ["Bool", "UINT8", "UINT16", "UINT32", "FLOAT1", "FLOAT2"] self.testBool = self.byteArrayData[4] self.hkContent.append(self.testBool) diff --git a/utility/OBSW_TmTcPrinter.py b/utility/OBSW_TmTcPrinter.py index 90132b8..c795d4a 100644 --- a/utility/OBSW_TmTcPrinter.py +++ b/utility/OBSW_TmTcPrinter.py @@ -64,7 +64,8 @@ class TmtcPrinter: def handleHkPrint(self, packet): if g.printHkData: - self.printBuffer = "HK Data:" + self.printBuffer = "HK Data from SID " + self.printBuffer = self.printBuffer + str(hex(packet.sid)) + " :" print(self.printBuffer) self.addPrintBufferToFileBuffer() self.printBuffer = str(packet.hkHeader) -- GitLab