diff --git a/tc/OBSW_TcPacker.py b/tc/OBSW_TcPacker.py index 5270ff66a934af07dbe9bab0ab12e7927fb17588..fbab63c29f8ec46d0056042edc64955b63cf1eff 100644 --- a/tc/OBSW_TcPacker.py +++ b/tc/OBSW_TcPacker.py @@ -57,30 +57,30 @@ def serviceTestSelect(service: Union[int, str], serviceQueue: tcQueueT) -> tcQue def packService5TestInto(tcQueue: tcQueueT) -> tcQueueT: - tcQueue.append(("print", "Testing Service 5")) + tcQueue.appendleft(("print", "Testing Service 5")) # disable events - tcQueue.append(("print", "\r\nTesting Service 5: Disable event")) + tcQueue.appendleft(("print", "\r\nTesting Service 5: Disable event")) command = PUSTelecommand(service=5, subservice=6, SSC=500) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # trigger event - tcQueue.append(("print", "\r\nTesting Service 5: Trigger event")) + tcQueue.appendleft(("print", "\r\nTesting Service 5: Trigger event")) command = PUSTelecommand(service=17, subservice=128, SSC=510) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # enable event - tcQueue.append(("print", "\r\nTesting Service 5: Enable event")) + tcQueue.appendleft(("print", "\r\nTesting Service 5: Enable event")) command = PUSTelecommand(service=5, subservice=5, SSC=520) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # trigger event - tcQueue.append(("print", "\r\nTesting Service 5: Trigger another event")) + tcQueue.appendleft(("print", "\r\nTesting Service 5: Trigger another event")) command = PUSTelecommand(service=17, subservice=128, SSC=530) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("print", "\r")) - tcQueue.append(("export", "log/tmtc_log_service5.txt")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("print", "\r")) + tcQueue.appendleft(("export", "log/tmtc_log_service5.txt")) return tcQueue def packService9TestInto(tcQueue: tcQueueT) -> tcQueueT: - tcQueue.append(("print", "Testing Service 9")) + tcQueue.appendleft(("print", "Testing Service 9")) timeTestASCIICodeA = '2019-08-30T20:50:33.892429Z' + '\0' timeTestASCIICodeB = '2019-270T05:50:33.002000Z' + '\0' timeTestCurrentTime = datetime.now().isoformat() + "Z" + '\0' @@ -91,57 +91,57 @@ def packService9TestInto(tcQueue: tcQueueT) -> tcQueueT: print("Time Code 2 :" + str(timeTest2)) print("Time Code 3 :" + str(timeTest3) + "\r") # time setting - tcQueue.append(("print", "\r\nTesting Service 9: Testing timecode A")) + tcQueue.appendleft(("print", "\r\nTesting Service 9: Testing timecode A")) command = PUSTelecommand(service=9, subservice=128, SSC=900, data=timeTest1) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("print", "\r\nTesting Service 9: Testing timecode B")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("print", "\r\nTesting Service 9: Testing timecode B")) command = PUSTelecommand(service=9, subservice=128, SSC=910, data=timeTest2) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("print", "\r\nTesting Service 9: Testing timecode Current Time")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("print", "\r\nTesting Service 9: Testing timecode Current Time")) command = PUSTelecommand(service=9, subservice=128, SSC=920, data=timeTest3) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # TODO: Add other time formats here - tcQueue.append(("print", "\r")) - tcQueue.append(("export", "log/tmtc_log_service9.txt")) + tcQueue.appendleft(("print", "\r")) + tcQueue.appendleft(("export", "log/tmtc_log_service9.txt")) return tcQueue def packService17TestInto(tcQueue: tcQueueT) -> tcQueueT: - tcQueue.append(("print", "Testing Service 17")) + tcQueue.appendleft(("print", "Testing Service 17")) # ping test - tcQueue.append(("print", "\n\rTesting Service 17: Ping Test")) + tcQueue.appendleft(("print", "\n\rTesting Service 17: Ping Test")) command = PUSTelecommand(service=17, subservice=1, SSC=1700) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # enable event - tcQueue.append(("print", "\n\rTesting Service 17: Enable Event")) + tcQueue.appendleft(("print", "\n\rTesting Service 17: Enable Event")) command = PUSTelecommand(service=5, subservice=5, SSC=52) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # test event - tcQueue.append(("print", "\n\rTesting Service 17: Trigger event")) + tcQueue.appendleft(("print", "\n\rTesting Service 17: Trigger event")) command = PUSTelecommand(service=17, subservice=128, SSC=1701) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("print", "\r")) - tcQueue.append(("export", "log/tmtc_log_service17.txt")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("print", "\r")) + tcQueue.appendleft(("export", "log/tmtc_log_service17.txt")) return tcQueue def packDummyDeviceTestInto(tcQueue: tcQueueT) -> tcQueueT: - tcQueue.append(("print", "Testing Dummy Device")) + tcQueue.appendleft(("print", "Testing Dummy Device")) # Object ID: Dummy Device objectId = bytearray([0x44, 0x00, 0xAF, 0xFE]) # Set On Mode - tcQueue.append(("print", "\n\rTesting Service Dummy: Set On")) + tcQueue.appendleft(("print", "\n\rTesting Service Dummy: Set On")) modeData = packModeData(objectId, 1, 0) command = PUSTelecommand(service=200, subservice=1, SSC=1, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Test Service 2 commands - tcQueue.append(("print", "\n\rTesting Service Dummy: Service 2")) + tcQueue.appendleft(("print", "\n\rTesting Service Dummy: Service 2")) packService2TestInto(tcQueue, True) # Test Service 8 - tcQueue.append(("print", "\n\rTesting Service Dummy: Service 8")) + tcQueue.appendleft(("print", "\n\rTesting Service Dummy: Service 8")) packService8TestInto(tcQueue, True) - tcQueue.append(("print", "\r")) - tcQueue.append(("export", "log/tmtc_log_service_dummy.txt")) + tcQueue.appendleft(("print", "\r")) + tcQueue.appendleft(("export", "log/tmtc_log_service_dummy.txt")) return tcQueue @@ -152,52 +152,52 @@ def packGpsTestInto(objectId: bytearray, tcQueue: tcQueueT) -> tcQueueT: gpsString = "GPS1" else: gpsString = "unknown" - tcQueue.append(("print", "Testing " + gpsString + " Device")) + tcQueue.appendleft(("print", "Testing " + gpsString + " Device")) # Set Mode Off - tcQueue.append(("print", "\n\rTesting " + gpsString + ": Set Off")) + tcQueue.appendleft(("print", "\n\rTesting " + gpsString + ": Set Off")) modeData = packModeData(objectId, 0, 0) command = PUSTelecommand(service=200, subservice=1, SSC=11, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Set Mode On - tcQueue.append(("print", "\n\rTesting " + gpsString + ": Set On")) + tcQueue.appendleft(("print", "\n\rTesting " + gpsString + ": Set On")) modeData = packModeData(objectId, 1, 0) command = PUSTelecommand(service=200, subservice=1, SSC=12, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Enable HK report sidGps = 0 if objectId == g.GPS0_ObjectId: sidGps = g.GPS0_SID - tcQueue.append(("print", "\r\nTesting " + gpsString + ": Enable HK Reporting")) + tcQueue.appendleft(("print", "\r\nTesting " + gpsString + ": Enable HK Reporting")) command = PUSTelecommand(service=3, subservice=5, SSC=13, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) elif objectId == g.GPS1_ObjectId: sidGps = g.GPS1_SID - tcQueue.append(("print", "\r\nTesting " + gpsString + ": Enable HK Reporting")) + tcQueue.appendleft(("print", "\r\nTesting " + gpsString + ": Enable HK Reporting")) command = PUSTelecommand(service=3, subservice=5, SSC=14, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # pack wait interval until mode is on and a few gps replies have been received - tcQueue.append(("wait", 5)) + tcQueue.appendleft(("wait", 5)) # Disable HK reporting - tcQueue.append(("print", "\r\nTesting Service 3: Disable " + gpsString + " definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Disable " + gpsString + " definition")) command = PUSTelecommand(service=3, subservice=6, SSC=15, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Set Mode Off - tcQueue.append(("print", "\n\rTesting " + gpsString + ": Set Off")) + tcQueue.appendleft(("print", "\n\rTesting " + gpsString + ": Set Off")) modeData = packModeData(objectId, 0, 0) command = PUSTelecommand(service=200, subservice=1, SSC=13, data=modeData) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("print", "\r")) - tcQueue.append(("export", "log/tmtc_log_service_" + gpsString + ".txt")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("print", "\r")) + tcQueue.appendleft(("export", "log/tmtc_log_service_" + gpsString + ".txt")) return tcQueue def packErrorTestingInto(tcQueue: tcQueueT) -> tcQueueT: # a lot of events command = PUSTelecommand(service=17, subservice=129, SSC=2010) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # a lot of ping testing command = PUSTelecommand(service=17, subservice=130, SSC=2020) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) return tcQueue diff --git a/tc/OBSW_TcService2.py b/tc/OBSW_TcService2.py index 84be166447cbdcccd3ae36a13811569d53b887a9..73edd70dd1bf537133d1a14d34843e114c7f37a3 100644 --- a/tc/OBSW_TcService2.py +++ b/tc/OBSW_TcService2.py @@ -15,37 +15,37 @@ from tc.OBSW_TcService200 import packModeData def packService2TestInto(tcQueue: Deque, calledExternally: bool = False) -> Deque: if calledExternally is False: - tcQueue.append(("print", "Testing Service 2")) + tcQueue.appendleft(("print", "Testing Service 2")) objectId = bytearray([0x44, 0x00, 0xAF, 0xFE]) # dummy device # don't forget to set object mode raw (service 200) before calling this ! # Set Raw Mode - tcQueue.append(("print", "\r\nTesting Service 2: Setting Raw Mode")) + tcQueue.appendleft(("print", "\r\nTesting Service 2: Setting Raw Mode")) modeData = packModeData(objectId, 3, 0) command = PUSTelecommand(service=200, subservice=1, SSC=2020, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # toggle wiretapping raw - tcQueue.append(("print", "\r\nTesting Service 2: Toggling Wiretapping Raw")) + tcQueue.appendleft(("print", "\r\nTesting Service 2: Toggling Wiretapping Raw")) wiretappingToggleData = packWiretappingMode(objectId, 1) toggleWiretappingOnCommand = PUSTelecommand(service=2, subservice=129, SSC=200, data=wiretappingToggleData) - tcQueue.append(toggleWiretappingOnCommand.packCommandTuple()) + tcQueue.appendleft(toggleWiretappingOnCommand.packCommandTuple()) # send raw command, data should be returned via TM[2,130] and TC[2,131] - tcQueue.append(("print", "\r\nTesting Service 2: Sending Raw Command")) + tcQueue.appendleft(("print", "\r\nTesting Service 2: Sending Raw Command")) rawCommand = struct.pack(">I", 666) rawData = objectId + rawCommand rawCommand = PUSTelecommand(service=2, subservice=128, SSC=201, data=rawData) - tcQueue.append(rawCommand.packCommandTuple()) + tcQueue.appendleft(rawCommand.packCommandTuple()) # toggle wiretapping off - tcQueue.append(("print", "\r\nTesting Service 2: Toggle Wiretapping Off")) + tcQueue.appendleft(("print", "\r\nTesting Service 2: Toggle Wiretapping Off")) wiretappingToggleData = packWiretappingMode(objectId, 0) toggleWiretappingOffCommand = PUSTelecommand(service=2, subservice=129, SSC=204, data=wiretappingToggleData) - tcQueue.append(toggleWiretappingOffCommand.packCommandTuple()) + tcQueue.appendleft(toggleWiretappingOffCommand.packCommandTuple()) # send raw command which should be returned via TM[2,130] - tcQueue.append(("print", "\r\nTesting Service 2: Send second raw command")) + tcQueue.appendleft(("print", "\r\nTesting Service 2: Send second raw command")) command = PUSTelecommand(service=2, subservice=128, SSC=205, data=rawData) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("print", "\r")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("print", "\r")) if calledExternally is False: - tcQueue.append(("export", "log/tmtc_log_service2.txt")) + tcQueue.appendleft(("export", "log/tmtc_log_service2.txt")) return tcQueue diff --git a/tc/OBSW_TcService200.py b/tc/OBSW_TcService200.py index ee4d20c1f047c67653cdceeef3028628a8e9e4c7..3abc8e9634485e1df489c6ef34616409594b6194 100644 --- a/tc/OBSW_TcService200.py +++ b/tc/OBSW_TcService200.py @@ -17,30 +17,30 @@ import struct def packService200TestInto(tcQueue: tcQueueT) -> tcQueueT: - tcQueue.append(("print", "Testing Service 200")) + tcQueue.appendleft(("print", "Testing Service 200")) # Object ID: Dummy Device objectId = bytearray([0x44, 0x00, 0xAF, 0xFE]) # Set On Mode - tcQueue.append(("print", "\r\nTesting Service 200: Set Mode On")) + tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode On")) modeData = packModeData(objectId, 1, 0) command = PUSTelecommand(service=200, subservice=1, SSC=2000, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Set Normal mode - tcQueue.append(("print", "\r\nTesting Service 200: Set Mode Normal")) + tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode Normal")) modeData = packModeData(objectId, 2, 0) command = PUSTelecommand(service=200, subservice=1, SSC=2010, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Set Raw Mode - tcQueue.append(("print", "\r\nTesting Service 200: Set Mode Raw")) + tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode Raw")) modeData = packModeData(objectId, 3, 0) command = PUSTelecommand(service=200, subservice=1, SSC=2020, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Set Off Mode - tcQueue.append(("print", "\r\nTesting Service 200: Set Mode Off")) + tcQueue.appendleft(("print", "\r\nTesting Service 200: Set Mode Off")) modeData = packModeData(objectId, 0, 0) command = PUSTelecommand(service=200, subservice=1, SSC=2030, data=modeData) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("export", "log/tmtc_log_service200.txt")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("export", "log/tmtc_log_service200.txt")) return tcQueue diff --git a/tc/OBSW_TcService3.py b/tc/OBSW_TcService3.py index 5504f493f9f8b4c288f61c8330797587fd0a82be..15aacab299c6df2037898f1c4807fc5cea0411f9 100644 --- a/tc/OBSW_TcService3.py +++ b/tc/OBSW_TcService3.py @@ -12,7 +12,7 @@ from tc.OBSW_TcPacket import PUSTelecommand def packService3TestInto(tcQueue: Deque) -> Deque: - tcQueue.append(("print", "Testing Service 3")) + tcQueue.appendleft(("print", "Testing Service 3")) # adding custom defintion to hk using test pool variables sid1 = bytearray([0x00, 0x00, 0x43, 0x00]) sid2 = bytearray([0x00, 0x00, 0x44, 0x00]) @@ -29,96 +29,96 @@ def packService3TestInto(tcQueue: Deque) -> Deque: hkDefinition2 = sid2 + collectionInterval + numberOfParameters + p1 + p2 + p3 + p4 + p5 # deleting pre-defined test entry - tcQueue.append(("print", "\r\nTesting Service 3: Deleting pre-defined HK definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Deleting pre-defined HK definition")) command = PUSTelecommand(service=3, subservice=3, SSC=3000, data=sid1) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # adding pre-defined definition to hk using test pool variables - tcQueue.append(("print", "\r\nTesting Service 3: Adding pre-defined HK definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Adding pre-defined HK definition")) command = PUSTelecommand(service=3, subservice=1, SSC=3010, data=hkDefinition1) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # adding custom definition to diagnostics using test pool variables - tcQueue.append(("print", "\r\nTesting Service 3: Adding custom diganostics definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Adding custom diganostics definition")) command = PUSTelecommand(service=3, subservice=2, SSC=3020, data=hkDefinition2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # enable custom hk definition - tcQueue.append(("print", "\r\nTesting Service 3: Enable custom definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Enable custom definition")) command = PUSTelecommand(service=3, subservice=5, SSC=3030, data=sid1) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # enable custom diag definition - tcQueue.append(("print", "\r\nTesting Service 3: Enable custom diagnostics definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Enable custom diagnostics definition")) command = PUSTelecommand(service=3, subservice=7, SSC=3040, data=sid2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # enable gps0 - tcQueue.append(("print", "\r\nTesting Service 3: Enable GPS definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Enable GPS definition")) command = PUSTelecommand(service=3, subservice=5, SSC=3050, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # maybe wait a bit to receive at least 2 packets.. - tcQueue.append(("wait", 3)) + tcQueue.appendleft(("wait", 3)) # Disable custom hk definition - tcQueue.append(("print", "\r\nTesting Service 3: Disable custom definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Disable custom definition")) command = PUSTelecommand(service=3, subservice=6, SSC=3060, data=sid1) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Disable custom diag definition - tcQueue.append(("print", "\r\nTesting Service 3: Disable custom diagnostics definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Disable custom diagnostics definition")) command = PUSTelecommand(service=3, subservice=8, SSC=3070, data=sid2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # disable gps0 - tcQueue.append(("print", "\r\nTesting Service 3: Disable GPS definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Disable GPS definition")) command = PUSTelecommand(service=3, subservice=6, SSC=3080, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # report custom Diag definition - tcQueue.append(("print", "\r\nTesting Service 3: Reporting diag definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Reporting diag definition")) command = PUSTelecommand(service=3, subservice=11, SSC=3100, data=sid2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # report gps definition - tcQueue.append(("print", "\r\nTesting Service 3: Reporting GPS definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Reporting GPS definition")) command = PUSTelecommand(service=3, subservice=9, SSC=3110, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # generate one custom hk definition - tcQueue.append(("print", "\r\nTesting Service 3: Generate one custom hk definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Generate one custom hk definition")) command = PUSTelecommand(service=3, subservice=27, SSC=3120, data=sid1) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # generate one custom diag definition - tcQueue.append(("print", "\r\nTesting Service 3: Generate one custom diagnostics definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Generate one custom diagnostics definition")) command = PUSTelecommand(service=3, subservice=28, SSC=3120, data=sid2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # generate one gps 0 definition - tcQueue.append(("print", "\r\nTesting Service 3: Generate one gps 0 defintion")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Generate one gps 0 defintion")) command = PUSTelecommand(service=3, subservice=27, SSC=3120, data=sidGps) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # modify custom hk definition interval newInterval = struct.pack('>f', 10.0) newIntervalCommand = sid1 + newInterval - tcQueue.append(("print", "\r\nTesting Service 3: Changing pre-defined HK definition interval")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Changing pre-defined HK definition interval")) command = PUSTelecommand(service=3, subservice=31, SSC=3090, data=newIntervalCommand) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # report custom HK definition - tcQueue.append(("print", "\r\nTesting Service 3: Reporting pre-defined HK definition with changed interval")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Reporting pre-defined HK definition with changed interval")) command = PUSTelecommand(service=3, subservice=9, SSC=3090, data=sid1) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # modify custom diag definition interval newIntervalCommand = sid2 + newInterval - tcQueue.append(("print", "\r\nTesting Service 3: Changing custom diag HK definition interval")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Changing custom diag HK definition interval")) command = PUSTelecommand(service=3, subservice=32, SSC=3090, data=newIntervalCommand) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # report custom diag definition - tcQueue.append(("print", "\r\nTesting Service 3: Reporting diag definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Reporting diag definition")) command = PUSTelecommand(service=3, subservice=11, SSC=3100, data=sid2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # append parameter to custom hk definiton # append parameter to custom diag definition # delete custom diag definition - tcQueue.append(("print", "\r\nTesting Service 3: Deleting custom diagnostics definition")) + tcQueue.appendleft(("print", "\r\nTesting Service 3: Deleting custom diagnostics definition")) command = PUSTelecommand(service=3, subservice=4, SSC=3120, data=sid2) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # do some basic testing on predefined structs too # e.g. add one variable, change interval, report them.... - tcQueue.append(("export", "log/tmtc_log_service3.txt")) + tcQueue.appendleft(("export", "log/tmtc_log_service3.txt")) return tcQueue diff --git a/tc/OBSW_TcService8.py b/tc/OBSW_TcService8.py index 2395d45b54711ded51b232ea024e4c869e89ba93..37be84832c760e47ec4bc389838e88580c7bcf61 100644 --- a/tc/OBSW_TcService8.py +++ b/tc/OBSW_TcService8.py @@ -15,42 +15,42 @@ from tc.OBSW_TcService200 import packModeData def packService8TestInto(tcQueue: Deque, calledExternally: bool = False) -> Deque: if calledExternally is False: - tcQueue.append(("print", "Testing Service 8")) + tcQueue.appendleft(("print", "Testing Service 8")) objectId = bytearray([0x44, 0x00, 0xAF, 0xFE]) # set mode on - tcQueue.append(("print", "\r\nTesting Service 8: Set Normal Mode")) + tcQueue.appendleft(("print", "\r\nTesting Service 8: Set Normal Mode")) modeData = packModeData(objectId, 1, 0) command = PUSTelecommand(service=200, subservice=1, SSC=800, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # set mode normal - tcQueue.append(("print", "\r\nTesting Service 8: Set Normal Mode")) + tcQueue.appendleft(("print", "\r\nTesting Service 8: Set Normal Mode")) modeData = packModeData(objectId, 2, 0) command = PUSTelecommand(service=200, subservice=1, SSC=810, data=modeData) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Direct command which triggers completion reply - tcQueue.append(("print", "\r\nTesting Service 8: Trigger Completion Reply")) + tcQueue.appendleft(("print", "\r\nTesting Service 8: Trigger Completion Reply")) actionId = struct.pack(">I", 666) directCommand = objectId + actionId command = PUSTelecommand(service=8, subservice=128, SSC=820, data=directCommand) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Direct command which triggers data reply - tcQueue.append(("print", "\r\nTesting Service 8: Trigger Data Reply")) + tcQueue.appendleft(("print", "\r\nTesting Service 8: Trigger Data Reply")) actionId = bytearray([0xC0, 0xC0, 0xBA, 0xBE]) commandParam1 = bytearray([0xBA, 0xB0]) commandParam2 = bytearray([0x00, 0x00, 0x00, 0x52, 0x4F, 0x42, 0x49, 0x4E]) directCommand = objectId + actionId + commandParam1 + commandParam2 command = PUSTelecommand(service=8, subservice=128, SSC=830, data=directCommand) - tcQueue.append(command.packCommandTuple()) + tcQueue.appendleft(command.packCommandTuple()) # Direct command which triggers an additional step reply and one completion reply - tcQueue.append(("print", "\r\nTesting Service 8: Trigger Step and Completion Reply")) + tcQueue.appendleft(("print", "\r\nTesting Service 8: Trigger Step and Completion Reply")) actionId = bytearray([0xBA, 0xDE, 0xAF, 0xFE]) directCommand = objectId + actionId command = PUSTelecommand(service=8, subservice=128, SSC=840, data=directCommand) - tcQueue.append(command.packCommandTuple()) - tcQueue.append(("wait", 2)) - tcQueue.append(("print", "\r")) + tcQueue.appendleft(command.packCommandTuple()) + tcQueue.appendleft(("wait", 2)) + tcQueue.appendleft(("print", "\r")) if calledExternally is False: - tcQueue.append(("export", "log/tmtc_log_service8.txt")) + tcQueue.appendleft(("export", "log/tmtc_log_service8.txt")) return tcQueue diff --git a/utility/OBSW_TmTcPrinter.py b/utility/OBSW_TmTcPrinter.py index 19b081296ddc48369a598892fa13914374087c82..cc9b1e50244b2b22105fd439f6da1928274e2388 100644 --- a/utility/OBSW_TmTcPrinter.py +++ b/utility/OBSW_TmTcPrinter.py @@ -151,7 +151,7 @@ class TmTcPrinter: if self.doPrintToFile: self.fileBuffer = self.fileBuffer + self.printBuffer + "\n" - def printToFile(self, logName="log/tmtc_log.txt", clearFileBuffer=False): + def printToFile(self, logName: str = "log/tmtc_log.txt", clearFileBuffer: bool = False): try: file = open(logName, 'w') except FileNotFoundError: