From 106bdbf233e1b3bd5b2c47142cd408e37e206495 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Apr 2021 15:58:00 +0200 Subject: [PATCH 1/4] added updates manually --- .gitmodules | 3 + bsp_hosted/core/InitMission.cpp | 49 ++++- bsp_hosted/core/ObjectFactory.cpp | 3 +- bsp_linux/core/InitMission.cpp | 25 +-- common/config/commonConfig.h | 2 +- doc/README-stm32-rtems.md | 4 +- generators/verificationMessageExtractor.py | 197 ------------------ mission/assemblies/TestAssembly.cpp | 66 +++--- mission/assemblies/TestAssembly.h | 7 - mission/core/GenericFactory.cpp | 5 +- mission/devices/TestCookie.cpp | 8 +- mission/devices/TestCookie.h | 6 +- mission/devices/TestDeviceHandler.cpp | 1 + mission/devices/TestDeviceHandler.h | 2 +- mission/devices/TestEchoComIF.cpp | 46 ++-- mission/devices/TestEchoComIF.h | 5 +- .../devicedefinitions/testDeviceDefinitions.h | 4 +- mission/utility/TmFunnel.cpp | 4 +- tmtc/config/custom_mode_op.py | 2 + tmtc/config/hook_base.py | 11 +- tmtc/config/object_ids.py | 17 +- tmtc/pus_tc/service_200_mode.py | 12 +- tmtc/pus_tc/service_20_parameters.py | 11 +- tmtc/pus_tc/service_2_raw_cmd.py | 12 +- tmtc/pus_tc/service_3_housekeeping.py | 13 +- tmtc/pus_tc/service_8_func_cmd.py | 16 +- tmtc/pus_tm/service_3_hk_handling.py | 29 ++- tmtc/pus_tm/service_8_handling.py | 8 + tmtc/tmtc_client_cli.py | 0 tmtc/tmtc_client_gui.py | 0 30 files changed, 203 insertions(+), 365 deletions(-) delete mode 100644 generators/verificationMessageExtractor.py mode change 100755 => 100644 tmtc/tmtc_client_cli.py mode change 100755 => 100644 tmtc/tmtc_client_gui.py diff --git a/.gitmodules b/.gitmodules index fd2f348..4e83113 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ [submodule "fsfw_hal"] path = fsfw_hal url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw_hal.git +[submodule "generators/modgen"] + path = generators/modgen + url = https://git.ksat-stuttgart.de/source/modgen.git diff --git a/bsp_hosted/core/InitMission.cpp b/bsp_hosted/core/InitMission.cpp index 3fcc45e..0bd858e 100644 --- a/bsp_hosted/core/InitMission.cpp +++ b/bsp_hosted/core/InitMission.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include @@ -11,6 +12,7 @@ #include #include #include +#include #ifdef _WIN32 #include @@ -185,10 +187,13 @@ void InitMission::createTasks() { #if OBSW_ADD_DEVICE_HANDLER_DEMO == 1 #ifdef __unix__ - currPrio = 40; + currPrio = 60; +#elif _WIN32 + currPrio = tasks::makeWinPriority(tasks::PriorityClass::CLASS_HIGH, + tasks::PriorityNumber::HIGHEST); #endif FixedTimeslotTaskIF* testDevicesTimeslotTask = taskFactory->createFixedTimeslotTask( - "PST_TEST_TASK", currPrio, PeriodicTaskIF::MINIMUM_STACK_SIZE, 1.0, deadlineMissedFunc); + "PST_TEST_TASK", currPrio, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, deadlineMissedFunc); result = pst::pollingSequenceDevices(testDevicesTimeslotTask); if(result != HasReturnvaluesIF::RETURN_OK) { #if FSFW_CPP_OSTREAM_ENABLED == 1 @@ -196,6 +201,21 @@ void InitMission::createTasks() { #else sif::printError("InitMission::createTasks: Test PST initialization failed!\n"); #endif + + } + +#if _WIN32 + currPrio = tasks::makeWinPriority(); +#endif + + PeriodicTaskIF* assemblyTask = taskFactory->createPeriodicTask("ASS_TASK", currPrio, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr); + if(assemblyTask == nullptr){ + task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY); + } + result = assemblyTask->addComponent(objects::TEST_ASSEMBLY); + if(result != HasReturnvaluesIF::RETURN_OK) { + task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY); } #endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */ @@ -247,6 +267,7 @@ void InitMission::createTasks() { #if OBSW_ADD_DEVICE_HANDLER_DEMO == 1 testDevicesTimeslotTask->startTask(); + assemblyTask->startTask(); #endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */ #if OBSW_ADD_CONTROLLER_DEMO == 1 @@ -260,6 +281,30 @@ void InitMission::createTasks() { #else sif::printInfo("Tasks started..\n"); #endif + +#if OBSW_ADD_DEVICE_HANDLER_DEMO + HasModesIF* assembly = objectManager->get(objects::TEST_ASSEMBLY); + if (assembly == nullptr){ + return; + } +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Waiting 5 Seconds and then command Test Assembly to Normal, Dual" << std::endl; +#else + sif::printInfo("Waiting 5 Seconds and then command Test Assembly to Normal, Dual \n"); +#endif + + TaskFactory::delayTask(5000); + CommandMessage modeMessage; + ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND, + DeviceHandlerIF::MODE_NORMAL, TestAssembly::submodes::DUAL); +#if FSFW_CPP_OSTREAM_ENABLED == 1 + sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl; +#else + sif::printInfo("Commanding Test Assembly to Normal, Dual \n"); +#endif + MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage, + MessageQueueIF::NO_QUEUE); +#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO */ } diff --git a/bsp_hosted/core/ObjectFactory.cpp b/bsp_hosted/core/ObjectFactory.cpp index 9401812..573eb39 100644 --- a/bsp_hosted/core/ObjectFactory.cpp +++ b/bsp_hosted/core/ObjectFactory.cpp @@ -47,8 +47,9 @@ void ObjectFactory::produce(){ } /* TMTC Reception via UDP socket */ - new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR, + auto tmtcBridge = new UdpTmTcBridge(objects::UDP_BRIDGE, objects::CCSDS_DISTRIBUTOR, objects::TM_STORE, objects::TC_STORE); + tmtcBridge->setMaxNumberOfPacketsStored(20); new UdpTcPollingTask(objects::UDP_POLLING_TASK, objects::UDP_BRIDGE); #endif /* OBSW_ADD_CORE_COMPONENTS == 1 */ diff --git a/bsp_linux/core/InitMission.cpp b/bsp_linux/core/InitMission.cpp index f9d3346..81ca23a 100644 --- a/bsp_linux/core/InitMission.cpp +++ b/bsp_linux/core/InitMission.cpp @@ -145,23 +145,14 @@ void InitMission::createTasks() { sif::printError("InitMission::createTasks: Test PST initialization failed!\n\r"); #endif } - PeriodicTaskIF* assemblyTask = taskFactory->createPeriodicTask("ASS_TASK", 30, PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr); + PeriodicTaskIF* assemblyTask = taskFactory->createPeriodicTask("ASS_TASK", 30, + PeriodicTaskIF::MINIMUM_STACK_SIZE, 2.0, nullptr); if(assemblyTask == nullptr){ - #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "InitMission::createTasks: Test Assembly Task creation failed!" << std::endl; - #else - sif::printError("InitMission::createTasks: Test Assembly Task creation failed!\n\r"); - #endif + task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY); } result = assemblyTask->addComponent(objects::TEST_ASSEMBLY); if(result != HasReturnvaluesIF::RETURN_OK) { - if(assemblyTask == nullptr){ - #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::error << "InitMission::createTasks: Test Assembly Task adding failed!" << std::endl; - #else - sif::printError("InitMission::createTasks: Test Assembly Task adding failed!\n\r"); - #endif - } + task::printInitError("ASS_TASK", objects::TEST_ASSEMBLY); } #endif /* OBSW_ADD_DEVICE_HANDLER_DEMO == 1 */ @@ -237,12 +228,14 @@ void InitMission::createTasks() { TaskFactory::delayTask(5000); CommandMessage modeMessage; - ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND, DeviceHandlerIF::MODE_NORMAL, TestAssembly::submodes::DUAL); + ModeMessage::setModeMessage(&modeMessage, ModeMessage::CMD_MODE_COMMAND, + DeviceHandlerIF::MODE_NORMAL, TestAssembly::submodes::DUAL); #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::info << "Commanding Test Assembly to Normal, Dual" << std::endl; #else sif::printInfo("Commanding Test Assembly to Normal, Dual \n"); #endif - MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage, MessageQueueIF::NO_QUEUE); -#endif + MessageQueueSenderIF::sendMessage(assembly->getCommandQueue(), &modeMessage, + MessageQueueIF::NO_QUEUE); +#endif /* OBSW_ADD_DEVICE_HANDLER_DEMO */ } diff --git a/common/config/commonConfig.h b/common/config/commonConfig.h index 3d47961..dbcf175 100644 --- a/common/config/commonConfig.h +++ b/common/config/commonConfig.h @@ -9,7 +9,7 @@ //! Specify the debug output verbose level #define OBSW_VERBOSE_LEVEL 1 -#define OBSW_PRINT_MISSED_DEADLINES 1 +#define OBSW_PRINT_MISSED_DEADLINES 0 //! Add core components for the FSFW and for TMTC communication #define OBSW_ADD_CORE_COMPONENTS 1 diff --git a/doc/README-stm32-rtems.md b/doc/README-stm32-rtems.md index 01b7fbd..d561bbe 100644 --- a/doc/README-stm32-rtems.md +++ b/doc/README-stm32-rtems.md @@ -136,11 +136,11 @@ switching between FreeRTOS and RTEMS. You can try the following steps: the OpenOCD folder inside the `scripts/target` folder: ```sh - $_CHIPNAME.cpu configure -event gdb-attach { + $_CHIPNAME.cpu0 configure -event gdb-attach { halt } - $_CHIPNAME.cpu configure -event gdb-attach { + $_CHIPNAME.cpu0 configure -event gdb-attach { reset init } ``` diff --git a/generators/verificationMessageExtractor.py b/generators/verificationMessageExtractor.py deleted file mode 100644 index 047713e..0000000 --- a/generators/verificationMessageExtractor.py +++ /dev/null @@ -1,197 +0,0 @@ -#! /usr/bin/env python3 -import string -import sys -import datetime -import collections -import re -import os -import fileinput -import getpass -import MySQLdb - -def parseInterfaceDefinitionFile( fwFilename, missionFilename ): - file = open(fwFilename, "r") - interfaces = dict() - allLines = file.readlines() - count = 0 - for line in allLines: - match = re.search( '[\s]*([A-Z_0-9]*) = ([0-9]*)\,[\s]*//([A-Z]{1,3})', line) - if match: - count = int(match.group(2)); - print("Count is " + str(count)) - interfaces.update( {match.group(1): [1, match.group(3)]} ) - - for line in allLines: - match = re.search( '[\s]*([A-Z_0-9]*),[\s]*//([A-Z]{1,3})', line) - if match: - interfaces.update( {match.group(1): [count, match.group(2)]} ) - count += 1 - file = open(missionFilename, "r") - allLines = file.readlines() - for line in allLines: - match = re.search( '[\s]*([A-Z_0-9]*) = FW_CLASS_ID_COUNT\,[\s]*//([A-Z]{1,3})', line) - if match: - interfaces.update( {match.group(1): [count, match.group(2)]} ) - count += 1 - for line in allLines: - match = re.search( '^[\s]*([A-Z_0-9]*),[\s]*//([A-Z]{1,3})', line) - if match: - interfaces.update( {match.group(1): [count, match.group(2)]} ) - count += 1 - print("Found interfaces : " + str(count - 1)) - return interfaces - -def returnNumberFromString( aString ): - if aString.startswith('0x'): - return int( aString, 16) - elif aString.isdigit(): - return int( aString) - else: - print('Error: Illegeal number representation: ' + aString) - return 0 - -def convert(name): - singleStrings = name.split('_') - newString = '' - for oneString in singleStrings: - oneString = oneString.lower() - oneString = oneString.capitalize() - newString = newString + oneString - return newString - -def buildCheckedString( firstPart, secondPart ): - myStr = firstPart + convert(secondPart) - if len(myStr) > 14: - print( "Error: Entry: " + myStr + " too long. Will truncate.") - myStr = myStr[0:14] - else: - print( "Entry: " + myStr + " is all right.") - return myStr - -def cleanUpDescription( descrString ): - description = descrString.lstrip('!<- ') - if description == '': - description = ' ' - return description - -def parseHeaderFiles( interfaceList, fileList): - dictionnary = dict() - count = 0 - currentId = 0 - currentName = "" - #Add OK and UNSPECIFIED_FAILED - dictionnary.update( {0: ('OK', 'System-wide code for ok.', 'RETURN_OK', 'HasReturnvaluesIF.h', 'HasReturnvaluesIF')} ) - dictionnary.update( {1: ('Failed', 'Unspecified system-wide code for failed.', 'RETURN_FAILED', 'HasReturnvaluesIF.h', 'HasReturnvaluesIF')} ) - for fileName in fileList: - file = open(fileName, "r") - oldline = file.readline() - while True: - newline = file.readline() - if not newline: break #EOF - if not oldline == '\n': - twoLines = oldline + ' ' + newline.strip() - else: - twoLines = '' - match1 = re.search ( 'INTERFACE_ID[\s]*=[\s]*CLASS_ID::([a-zA-Z_0-9]*)', twoLines) - if match1: - currentId = interfaceList[match1.group(1)][0] - currentName = interfaceList[match1.group(1)][1] - currentFullName = match1.group(1) - #print( "Current ID: " + str(currentId) ) - myId = currentId - match = re.search( '^[\s]*static const ReturnValue_t[\s]*([a-zA-Z_0-9]*)[\s]*=[\s]*MAKE_RETURN_CODE[\s]*\([\s]*([x0-9a-fA-F]{1,4})[\s]*\);[\t ]*(\/\/){0,1}([^\n]*)', twoLines) - if match: -# valueTable.append([]) - description = cleanUpDescription(match.group(4)) - stringToAdd = buildCheckedString( currentName, match.group(1)) - fullId = (myId << 8) + returnNumberFromString(match.group(2)) - if fullId in dictionnary: - print('duplicate returncode ' + hex(fullId) + ' from ' + fileName + ' was already in ' + dictionnary[fullId][3]) - dictionnary.update( {fullId: (stringToAdd, description, match.group(1), fileName, currentFullName)} ) -# valueTable[count].append(fullId) -# valueTable[count].append(stringToAdd) - count = count+1 - else: - None - oldline = newline -# valueTable.pop() - return dictionnary - -def getHeaderFileList( base ): - #print ( "getHeaderFileList called with" + base ) - baseList = os.listdir( base ) - fileList = [] - for entry in baseList: - #Remove all hidden files: - if ( (os.path.isdir(base + entry) == True) and (entry[0] != ".") and (entry[0] != "_") ): - fileList = fileList + getHeaderFileList(base + entry + "/") - if re.match("[^\.]*\.h", entry) and os.path.isfile(base + entry): - fileList.append(base + entry) - return fileList - -def writeEntriesToDB( listOfEntries ): - print ("Connecting to database...") - user = getpass.getpass("User: ") - passwd = getpass.getpass() - conn = MySQLdb.connect(host = "127.0.0.1", user = user, passwd = passwd, db = "flpmib") - written = conn.cursor() - print ("done.") - #delete old entries - print ("Kill old entries.") - written.execute("DELETE FROM txp WHERE TXP_NUMBR = 'DSX00000'") - print("Insert new ones:") - for entry in listOfEntries.items(): - written.execute("INSERT INTO txp (txp_numbr, txp_from, txp_to, txp_altxt) VALUES ('DSX00000', %s, %s, %s)", [entry[0], entry[0], entry[1][0]]) - conn.commit() - print("Done. That was easy.") - -def writeEntriesToOtherDB( listOfEntries ): - print ("Connecting to other database...") - conn = MySQLdb.connect(host = "buggy.irs.uni-stuttgart.de", user = 'returncode', passwd = 'returncode', db = "returncode") - written = conn.cursor() - print ("connected.") - #delete old entries - print ("Kill old entries.") - written.execute("DELETE FROM returncodes WHERE true") - print("Insert new ones:") - for entry in listOfEntries.items(): - written.execute("INSERT INTO returncodes (code,name,interface,file,description) VALUES (%s, %s, %s, %s, %s)", [entry[0], entry[1][2], entry[1][4], entry[1][3], entry[1][1]]) - conn.commit() - print("Done. That was hard.") - -def exportToFile( filename, listOfEntries ): - print ('Exporting to file: ' + filename ) - file = open(filename, "w") - for entry in listOfEntries.items(): - file.write(hex(entry[0]) + '\t' + entry[1][0] + '\t' + entry[1][1] + '\t' + entry[1][2] + '\t' + entry[1][3] + '\t' + entry[1][4] + '\n' ) - file.close() - return - -def parseOBSW(): - idInterfaceDefinitions = parseInterfaceDefinitionFile( "../../framework/returnvalues/FwClassIds.h", "../../config/returnvalues/classIds.h") - #print ("Dictionary size is " + str(len(idInterfaceDefinitions)) ) - for entry in sorted(idInterfaceDefinitions): - print(entry) - myHeaderList = getHeaderFileList( "../../mission/" ) - myHeaderList = myHeaderList + getHeaderFileList( "../../framework/" ) - myHeaderList = myHeaderList + getHeaderFileList( "../../config/" ) - myHeaderList = myHeaderList + getHeaderFileList( "../../bsp_linux/" ) - mySecondList = parseHeaderFiles( idInterfaceDefinitions, myHeaderList) -# print(mySecondList[14081]) -# print (mySecondList.items()[0][1]) -# print( "Found entries:" ) - counter = 0 -# for entry in sorted(mySecondList): -# print(entry) - for entry in mySecondList.items(): - counter = counter + 1 -# print( entry[0], entry[1][0], entry[1][1] ) - print("Count: ", counter) - if (len(sys.argv) > 1): - exportToFile( str(sys.argv[1]), mySecondList ) - else: - print('No export to file requested.') - #writeEntriesToOtherDB( mySecondList ) - #writeEntriesToDB( mySecondList ) - -parseOBSW() diff --git a/mission/assemblies/TestAssembly.cpp b/mission/assemblies/TestAssembly.cpp index b139956..86dab25 100644 --- a/mission/assemblies/TestAssembly.cpp +++ b/mission/assemblies/TestAssembly.cpp @@ -1,16 +1,11 @@ -/* - * TestAssembly.cpp - * - * Created on: Apr 20, 2021 - * Author: steffen - */ - #include #include + #include -TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId):AssemblyBase(objectId, parentId) { +TestAssembly::TestAssembly(object_id_t objectId, object_id_t parentId): + AssemblyBase(objectId, parentId) { ModeListEntry newModeListEntry; newModeListEntry.setObject(objects::TEST_DEVICE_HANDLER_0); newModeListEntry.setMode(MODE_OFF); @@ -32,9 +27,10 @@ TestAssembly::~TestAssembly() { ReturnValue_t TestAssembly::commandChildren(Mode_t mode, Submode_t submode) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::info << "TestAssembly: Received command to go to mode " << mode << " submode " << (int) submode << std::endl; + sif::info << "TestAssembly: Received command to go to mode " << mode << + " submode " << (int) submode << std::endl; #else - sif::printInfo("TestAssembly: Received command to go to other mode \n"); + sif::printInfo("TestAssembly: Received command to go to mode %d submode %d\n", mode, submode); #endif ReturnValue_t result = RETURN_OK; if(mode == MODE_OFF){ @@ -42,52 +38,60 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, commandTable[0].setSubmode(SUBMODE_NONE); commandTable[1].setMode(MODE_OFF); commandTable[1].setSubmode(SUBMODE_NONE); - }else if(mode == DeviceHandlerIF::MODE_NORMAL){ + } + else if(mode == DeviceHandlerIF::MODE_NORMAL) { if(submode == submodes::SINGLE){ commandTable[0].setMode(MODE_OFF); commandTable[0].setSubmode(SUBMODE_NONE); commandTable[1].setMode(MODE_OFF); commandTable[1].setSubmode(SUBMODE_NONE); // We try to prefer 0 here but we try to switch to 1 even if it might fail - if(isDeviceAvailable(objects::TEST_DEVICE_HANDLER_0)){ - if (childrenMap[objects::TEST_DEVICE_HANDLER_0].mode == MODE_ON){ + if(isDeviceAvailable(objects::TEST_DEVICE_HANDLER_0)) { + if (childrenMap[objects::TEST_DEVICE_HANDLER_0].mode == MODE_ON) { commandTable[0].setMode(mode); commandTable[0].setSubmode(SUBMODE_NONE); - }else{ + } + else { commandTable[0].setMode(MODE_ON); commandTable[0].setSubmode(SUBMODE_NONE); result = NEED_SECOND_STEP; } - }else{ - if (childrenMap[objects::TEST_DEVICE_HANDLER_1].mode == MODE_ON){ + } + else { + if (childrenMap[objects::TEST_DEVICE_HANDLER_1].mode == MODE_ON) { commandTable[1].setMode(mode); commandTable[1].setSubmode(SUBMODE_NONE); - }else{ + } + else{ commandTable[1].setMode(MODE_ON); commandTable[1].setSubmode(SUBMODE_NONE); result = NEED_SECOND_STEP; } } - }else{ + } + else{ // Dual Mode Normal - if (childrenMap[objects::TEST_DEVICE_HANDLER_0].mode == MODE_ON){ + if (childrenMap[objects::TEST_DEVICE_HANDLER_0].mode == MODE_ON) { commandTable[0].setMode(mode); commandTable[0].setSubmode(SUBMODE_NONE); - }else{ + } + else{ commandTable[0].setMode(MODE_ON); commandTable[0].setSubmode(SUBMODE_NONE); result = NEED_SECOND_STEP; } - if (childrenMap[objects::TEST_DEVICE_HANDLER_1].mode == MODE_ON){ + if (childrenMap[objects::TEST_DEVICE_HANDLER_1].mode == MODE_ON) { commandTable[1].setMode(mode); commandTable[1].setSubmode(SUBMODE_NONE); - }else{ + } + else{ commandTable[1].setMode(MODE_ON); commandTable[1].setSubmode(SUBMODE_NONE); result = NEED_SECOND_STEP; } } - }else{ + } + else{ //Mode ON if(submode == submodes::SINGLE){ commandTable[0].setMode(MODE_OFF); @@ -98,11 +102,13 @@ ReturnValue_t TestAssembly::commandChildren(Mode_t mode, if(isDeviceAvailable(objects::TEST_DEVICE_HANDLER_0)){ commandTable[0].setMode(MODE_ON); commandTable[0].setSubmode(SUBMODE_NONE); - }else{ + } + else{ commandTable[1].setMode(MODE_ON); commandTable[1].setSubmode(SUBMODE_NONE); } - }else{ + } + else{ commandTable[0].setMode(MODE_ON); commandTable[0].setSubmode(SUBMODE_NONE); commandTable[1].setMode(MODE_ON); @@ -167,14 +173,15 @@ ReturnValue_t TestAssembly::initialize() { ReturnValue_t TestAssembly::checkChildrenStateOn( Mode_t wantedMode, Submode_t wantedSubmode) { if(submode == submodes::DUAL){ - for(const auto& info:childrenMap){ + for(const auto& info:childrenMap) { if(info.second.mode != wantedMode or info.second.mode != wantedSubmode){ return NOT_ENOUGH_CHILDREN_IN_CORRECT_STATE; } } return RETURN_OK; - }else if(submode == submodes::SINGLE){ - for(const auto& info:childrenMap){ + } + else if(submode == submodes::SINGLE) { + for(const auto& info:childrenMap) { if(info.second.mode == wantedMode and info.second.mode != wantedSubmode){ return RETURN_OK; } @@ -186,7 +193,8 @@ ReturnValue_t TestAssembly::checkChildrenStateOn( bool TestAssembly::isDeviceAvailable(object_id_t object) { if(healthHelper.healthTable->getHealth(object) == HasHealthIF::HEALTHY){ return true; - }else{ + } + else{ return false; } } diff --git a/mission/assemblies/TestAssembly.h b/mission/assemblies/TestAssembly.h index 2340b8b..32e1e23 100644 --- a/mission/assemblies/TestAssembly.h +++ b/mission/assemblies/TestAssembly.h @@ -1,10 +1,3 @@ -/* - * TestAssembly.h - * - * Created on: Apr 20, 2021 - * Author: steffen - */ - #ifndef MISSION_ASSEMBLIES_TESTASSEMBLY_H_ #define MISSION_ASSEMBLIES_TESTASSEMBLY_H_ diff --git a/mission/core/GenericFactory.cpp b/mission/core/GenericFactory.cpp index 94d0391..9343c69 100644 --- a/mission/core/GenericFactory.cpp +++ b/mission/core/GenericFactory.cpp @@ -95,10 +95,13 @@ void ObjectFactory::produceGenericObjects() { /* Demo device handler object */ size_t expectedMaxReplyLen = 64; - CookieIF* testCookie = new TestCookie(0, expectedMaxReplyLen); + CookieIF* testCookie = new DummyCookie( + static_cast(testdevice::DeviceIndex::DEVICE_0), expectedMaxReplyLen); new TestEchoComIF(objects::TEST_ECHO_COM_IF); new TestDevice(objects::TEST_DEVICE_HANDLER_0, objects::TEST_ECHO_COM_IF, testCookie, testdevice::DeviceIndex::DEVICE_0, enableInfoPrintout); + testCookie = new DummyCookie( + static_cast(testdevice::DeviceIndex::DEVICE_1), expectedMaxReplyLen); new TestDevice(objects::TEST_DEVICE_HANDLER_1, objects::TEST_ECHO_COM_IF, testCookie, testdevice::DeviceIndex::DEVICE_1, enableInfoPrintout); diff --git a/mission/devices/TestCookie.cpp b/mission/devices/TestCookie.cpp index 91098f8..aa76e68 100644 --- a/mission/devices/TestCookie.cpp +++ b/mission/devices/TestCookie.cpp @@ -1,14 +1,14 @@ #include "TestCookie.h" -TestCookie::TestCookie(address_t address, size_t replyMaxLen): +DummyCookie::DummyCookie(address_t address, size_t replyMaxLen): address(address), replyMaxLen(replyMaxLen) {} -TestCookie::~TestCookie() {} +DummyCookie::~DummyCookie() {} -address_t TestCookie::getAddress() const { +address_t DummyCookie::getAddress() const { return address; } -size_t TestCookie::getReplyMaxLen() const { +size_t DummyCookie::getReplyMaxLen() const { return replyMaxLen; } diff --git a/mission/devices/TestCookie.h b/mission/devices/TestCookie.h index 5dac3f2..b954df5 100644 --- a/mission/devices/TestCookie.h +++ b/mission/devices/TestCookie.h @@ -7,10 +7,10 @@ /** * @brief Really simple cookie which does not do a lot. */ -class TestCookie: public CookieIF { +class DummyCookie: public CookieIF { public: - TestCookie(address_t address, size_t maxReplyLen); - virtual ~TestCookie(); + DummyCookie(address_t address, size_t maxReplyLen); + virtual ~DummyCookie(); address_t getAddress() const; size_t getReplyMaxLen() const; diff --git a/mission/devices/TestDeviceHandler.cpp b/mission/devices/TestDeviceHandler.cpp index 71cff21..5403c57 100644 --- a/mission/devices/TestDeviceHandler.cpp +++ b/mission/devices/TestDeviceHandler.cpp @@ -338,6 +338,7 @@ ReturnValue_t TestDevice::scanForReply(const uint8_t *start, size_t len, } DeviceCommandId_t pendingCmd = this->getPendingCommand(); + switch(pendingCmd) { case(TEST_NORMAL_MODE_CMD): { diff --git a/mission/devices/TestDeviceHandler.h b/mission/devices/TestDeviceHandler.h index b5ad8df..96ac2fa 100644 --- a/mission/devices/TestDeviceHandler.h +++ b/mission/devices/TestDeviceHandler.h @@ -58,7 +58,7 @@ protected: testdevice::TestDataSet dataset; //! This is used to reset the dataset after a commanded change has been made. bool resetAfterChange = false; - bool commandSent = true; + bool commandSent = false; /** DeviceHandlerBase overrides (see DHB documentation) */ diff --git a/mission/devices/TestEchoComIF.cpp b/mission/devices/TestEchoComIF.cpp index 80b5b72..36d08bc 100644 --- a/mission/devices/TestEchoComIF.cpp +++ b/mission/devices/TestEchoComIF.cpp @@ -14,35 +14,44 @@ TestEchoComIF::TestEchoComIF(object_id_t objectId): TestEchoComIF::~TestEchoComIF() {} ReturnValue_t TestEchoComIF::initializeInterface(CookieIF * cookie) { - TestCookie* testCookie = dynamic_cast(cookie); - if(testCookie == nullptr) { + DummyCookie* dummyCookie = dynamic_cast(cookie); + if(dummyCookie == nullptr) { #if FSFW_CPP_OSTREAM_ENABLED == 1 sif::warning << "TestEchoComIF::initializeInterface: Invalid cookie!" << std::endl; #else sif::printWarning("TestEchoComIF::initializeInterface: Invalid cookie!\n"); #endif - return HasReturnvaluesIF::RETURN_FAILED; + return NULLPOINTER; + } + + auto resultPair = replyMap.emplace( + dummyCookie->getAddress(), ReplyBuffer(dummyCookie->getReplyMaxLen())); + if(not resultPair.second) { + return HasReturnvaluesIF::RETURN_FAILED; } - replyBuffer.reserve(testCookie->getReplyMaxLen()); - replyBuffer.resize(testCookie->getReplyMaxLen()); return RETURN_OK; } ReturnValue_t TestEchoComIF::sendMessage(CookieIF *cookie, const uint8_t * sendData, size_t sendLen) { - if(sendLen > replyBuffer.size()) { + DummyCookie* dummyCookie = dynamic_cast(cookie); + if(dummyCookie == nullptr) { + return NULLPOINTER; + } + + ReplyBuffer& replyBuffer = replyMap.find(dummyCookie->getAddress())->second; + if(sendLen > replyBuffer.capacity()) { #if FSFW_CPP_OSTREAM_ENABLED == 1 - sif::warning << "TestEchoComIF::sendMessage: Send length larger than current reply buffer " - "length. Allocating additional memory!" << std::endl; + sif::warning << "TestEchoComIF::sendMessage: Send length " << sendLen << " larger than " + "current reply buffer length!" << std::endl; #else - sif::printWarning("TestEchoComIF::sendMessage: Send length larger than current reply buffer " - "length. Allocating additional memory!\n"); + sif::printWarning("TestEchoComIF::sendMessage: Send length %d larger than current " + "reply buffer length!\n", sendLen); #endif - replyBuffer.reserve(sendLen); - replyBuffer.resize(sendLen); + return HasReturnvaluesIF::RETURN_FAILED; } - memcpy(replyBuffer.data(),sendData, sendLen); - dummyBufferSize = sendLen; + replyBuffer.resize(sendLen); + memcpy(replyBuffer.data(), sendData, sendLen); return RETURN_OK; } @@ -57,9 +66,14 @@ ReturnValue_t TestEchoComIF::requestReceiveMessage(CookieIF *cookie, ReturnValue_t TestEchoComIF::readReceivedMessage(CookieIF *cookie, uint8_t **buffer, size_t *size) { + DummyCookie* dummyCookie = dynamic_cast(cookie); + if(dummyCookie == nullptr) { + return NULLPOINTER; + } + + ReplyBuffer& replyBuffer = replyMap.find(dummyCookie->getAddress())->second; *buffer = replyBuffer.data(); - *size = dummyBufferSize; - this->dummyBufferSize = 0; + *size = replyBuffer.size(); dummyReplyCounter ++; if(dummyReplyCounter == 10) { diff --git a/mission/devices/TestEchoComIF.h b/mission/devices/TestEchoComIF.h index 383f582..38270cf 100644 --- a/mission/devices/TestEchoComIF.h +++ b/mission/devices/TestEchoComIF.h @@ -45,8 +45,9 @@ private: MessageQueueIF* tmQueue = nullptr; size_t replyMaxLen = 0; - std::vector replyBuffer; - uint32_t dummyBufferSize = 0; + using ReplyBuffer = std::vector; + std::map replyMap; + uint8_t dummyReplyCounter = 0; uint16_t packetSubCounter = 0; diff --git a/mission/devices/devicedefinitions/testDeviceDefinitions.h b/mission/devices/devicedefinitions/testDeviceDefinitions.h index 330497a..10668b9 100644 --- a/mission/devices/devicedefinitions/testDeviceDefinitions.h +++ b/mission/devices/devicedefinitions/testDeviceDefinitions.h @@ -55,10 +55,10 @@ static constexpr DeviceCommandId_t TEST_NOTIF_SNAPSHOT_SET = 4; * DEVICE_1: Sets the vector mean values below a treshold (mean less than -20) to trigger a * set snapshot */ -static constexpr DeviceCommandId_t TEST_SNAPSHOT = 4; +static constexpr DeviceCommandId_t TEST_SNAPSHOT = 5; //! Generates a random value for variable 1 of the dataset. -static constexpr DeviceCommandId_t GENERATE_SET_VAR_1_RNG_VALUE = 5; +static constexpr DeviceCommandId_t GENERATE_SET_VAR_1_RNG_VALUE = 6; /** diff --git a/mission/utility/TmFunnel.cpp b/mission/utility/TmFunnel.cpp index 5579d18..b98c9e9 100644 --- a/mission/utility/TmFunnel.cpp +++ b/mission/utility/TmFunnel.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT; @@ -50,7 +50,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { if(result != HasReturnvaluesIF::RETURN_OK){ return result; } - TmPacketBase packet(packetData); + TmPacketPusC packet(packetData); packet.setPacketSequenceCount(this->sourceSequenceCount); sourceSequenceCount++; sourceSequenceCount = sourceSequenceCount % diff --git a/tmtc/config/custom_mode_op.py b/tmtc/config/custom_mode_op.py index acd322c..d033ceb 100644 --- a/tmtc/config/custom_mode_op.py +++ b/tmtc/config/custom_mode_op.py @@ -15,5 +15,7 @@ def perform_mode_operation_user(tmtc_backend: TmTcHandler, mode: int): """ Custom modes can be implemented here """ + if tmtc_backend: + pass LOGGER.error(f"Unknown mode {mode}, Configuration error !") sys.exit() diff --git a/tmtc/config/hook_base.py b/tmtc/config/hook_base.py index e9c0f14..abd29c9 100644 --- a/tmtc/config/hook_base.py +++ b/tmtc/config/hook_base.py @@ -21,9 +21,9 @@ class FsfwHookBase(TmTcHookBase): from tmtccmd.defaults.globals_setup import set_default_globals_pre_args_parsing set_default_globals_pre_args_parsing(gui=gui, apid=0xef) - def add_globals_post_args_parsing(self, args: argparse.Namespace): + def add_globals_post_args_parsing(self, args: argparse.Namespace, json_cfg_path: str = ""): from tmtccmd.defaults.globals_setup import set_default_globals_post_args_parsing - set_default_globals_post_args_parsing(args=args) + set_default_globals_post_args_parsing(args=args, json_cfg_path=json_cfg_path) def assign_communication_interface(self, com_if: int, tmtc_printer: TmTcPrinter) -> \ Union[CommunicationInterface, None]: @@ -45,7 +45,7 @@ class FsfwHookBase(TmTcHookBase): from pus_tm.factory_hook import tm_user_factory_hook return tm_user_factory_hook(raw_tm_packet=raw_tm_packet) - def set_object_ids(self) -> Dict[int, bytearray]: + def set_object_ids(self) -> Dict[bytes, list]: from config.object_ids import set_object_ids return set_object_ids() @@ -60,7 +60,7 @@ class FsfwHookBase(TmTcHookBase): @staticmethod def handle_service_3_housekeeping( - object_id: int, set_id: int, hk_data: bytearray, service3_packet: Service3Base + object_id: bytearray, set_id: int, hk_data: bytearray, service3_packet: Service3Base ) -> Tuple[list, list, bytearray, int]: from pus_tm.service_3_hk_handling import service_3_hk_handling return service_3_hk_handling( @@ -70,5 +70,8 @@ class FsfwHookBase(TmTcHookBase): def command_preparation_hook(self) -> Union[None, PusTelecommand]: pass + def set_json_config_file_path(self) -> str: + return "config/tmtc_config.json" + diff --git a/tmtc/config/object_ids.py b/tmtc/config/object_ids.py index aca69ad..752f9a8 100644 --- a/tmtc/config/object_ids.py +++ b/tmtc/config/object_ids.py @@ -4,20 +4,17 @@ it to your needs. """ -import enum from typing import Dict - -class ObjectIds(enum.IntEnum): - PUS_SERVICE_17 = 1 - TEST_DEVICE_0 = 2 - TEST_DEVICE_1 = 3 +SERVICE_17_OBJ_ID = bytes([0x53, 0x00, 0x00, 0x17]) +TEST_DEVICE_0_OBJ_ID = bytes([0x44, 0x01, 0xAF, 0xFE]) +TEST_DEVICE_1_OBJ_ID = bytes([0x44, 0x02, 0xAF, 0xFE]) -def set_object_ids() -> Dict[int, bytearray]: +def set_object_ids() -> Dict[bytes, list]: object_id_dict = { - ObjectIds.PUS_SERVICE_17: bytearray([0x53, 0x00, 0x00, 0x17]), - ObjectIds.TEST_DEVICE_0: bytearray([0x44, 0x01, 0xAF, 0xFE]), - ObjectIds.TEST_DEVICE_1: bytearray([0x44, 0x02, 0xAF, 0xFE]), + SERVICE_17_OBJ_ID: ["Service 17"], + TEST_DEVICE_0_OBJ_ID: ["Test Device 0"], + TEST_DEVICE_1_OBJ_ID: ["Test Device 1"], } return object_id_dict diff --git a/tmtc/pus_tc/service_200_mode.py b/tmtc/pus_tc/service_200_mode.py index bcf1055..c83f692 100644 --- a/tmtc/pus_tc/service_200_mode.py +++ b/tmtc/pus_tc/service_200_mode.py @@ -5,22 +5,14 @@ @author R. Mueller @date 02.05.2020 """ -from config.object_ids import ObjectIds +from config.object_ids import TEST_DEVICE_0_OBJ_ID, TEST_DEVICE_1_OBJ_ID from tmtccmd.core.definitions import QueueCommands from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.pus_tc.packer import TcQueueT from tmtccmd.pus_tc.service_200_mode import pack_mode_data -TEST_DEVICE_0_ID = bytearray() -TEST_DEVICE_1_ID = bytearray() - def pack_service_200_commands_into(tc_queue: TcQueueT, op_code: str): - from tmtccmd.core.object_id_manager import get_object_id - global TEST_DEVICE_1_ID, TEST_DEVICE_0_ID - if TEST_DEVICE_0_ID == bytearray() or TEST_DEVICE_1_ID == bytearray: - TEST_DEVICE_0_ID = get_object_id(ObjectIds.TEST_DEVICE_0) - TEST_DEVICE_1_ID = get_object_id(ObjectIds.TEST_DEVICE_1) if op_code == "0": pack_service_200_test_into(tc_queue=tc_queue, init_ssc=2000) @@ -29,7 +21,7 @@ def pack_service_200_test_into(init_ssc: int, tc_queue: TcQueueT) -> int: new_ssc = init_ssc tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200")) # Object ID: DUMMY Device - object_id = TEST_DEVICE_0_ID + object_id = TEST_DEVICE_0_OBJ_ID # Set On Mode tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 200: Set Mode On")) mode_data = pack_mode_data(object_id, 1, 0) diff --git a/tmtc/pus_tc/service_20_parameters.py b/tmtc/pus_tc/service_20_parameters.py index 47d19eb..241b501 100644 --- a/tmtc/pus_tc/service_20_parameters.py +++ b/tmtc/pus_tc/service_20_parameters.py @@ -1,7 +1,6 @@ import struct from tmtccmd.core.definitions import QueueCommands -from tmtccmd.core.object_id_manager import get_object_id from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.pus_tc.definitions import TcQueueT from tmtccmd.pus_tc.service_20_parameter import pack_type_and_matrix_data, \ @@ -9,16 +8,14 @@ from tmtccmd.pus_tc.service_20_parameter import pack_type_and_matrix_data, \ from tmtccmd.pus_tc.service_200_mode import pack_mode_data from tmtccmd.utility.tmtcc_logger import get_logger -from config.object_ids import ObjectIds + +from config.object_ids import TEST_DEVICE_0_OBJ_ID LOGGER = get_logger() TEST_DEVICE_0_ID = bytearray() def pack_service20_commands_into(tc_queue: TcQueueT, op_code: str): - global TEST_DEVICE_0_ID - if TEST_DEVICE_0_ID == bytearray(): - TEST_DEVICE_0_ID = get_object_id(ObjectIds.TEST_DEVICE_0) if op_code == "0": pack_service20_test_into(tc_queue=tc_queue) @@ -26,7 +23,7 @@ def pack_service20_commands_into(tc_queue: TcQueueT, op_code: str): def pack_service20_test_into(tc_queue: TcQueueT, called_externally: bool = False): if called_externally is False: tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 20")) - object_id = TEST_DEVICE_0_ID + object_id = TEST_DEVICE_0_OBJ_ID # set mode normal tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 20: Set Normal Mode")) @@ -43,7 +40,7 @@ def pack_service20_test_into(tc_queue: TcQueueT, called_externally: bool = False def load_param_0_simple_test_commands(tc_queue: TcQueueT): - object_id = TEST_DEVICE_0_ID + object_id = TEST_DEVICE_0_OBJ_ID parameter_id_0 = pack_parameter_id(domain_id=0, unique_id=0, linear_index=0) # test checking Load for uint32_t tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 20: Load uint32_t")) diff --git a/tmtc/pus_tc/service_2_raw_cmd.py b/tmtc/pus_tc/service_2_raw_cmd.py index f3ec4ce..9fe2d1a 100644 --- a/tmtc/pus_tc/service_2_raw_cmd.py +++ b/tmtc/pus_tc/service_2_raw_cmd.py @@ -8,23 +8,15 @@ import struct from tmtccmd.core.definitions import QueueCommands -from tmtccmd.core.object_id_manager import get_object_id from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.pus_tc.definitions import TcQueueT from pus_tc.service_200_mode import pack_mode_data import pus_tc.command_data as cmd_data -from config.object_ids import ObjectIds - -TEST_DEVICE_0_ID = bytearray() -TEST_DEVICE_1_ID = bytearray() +from config.object_ids import TEST_DEVICE_0_OBJ_ID, TEST_DEVICE_1_OBJ_ID def pack_service_2_commands_into(tc_queue: TcQueueT, op_code: str): - global TEST_DEVICE_0_ID, TEST_DEVICE_1_ID - if TEST_DEVICE_0_ID == 0 or TEST_DEVICE_1_ID == 0: - TEST_DEVICE_0_ID = get_object_id(ObjectIds.TEST_DEVICE_0) - TEST_DEVICE_1_ID = get_object_id(ObjectIds.TEST_DEVICE_0) if op_code == "0": pack_generic_service_2_test_into(0, tc_queue) else: @@ -33,7 +25,7 @@ def pack_service_2_commands_into(tc_queue: TcQueueT, op_code: str): def pack_generic_service_2_test_into(init_ssc: int, tc_queue: TcQueueT) -> int: new_ssc = init_ssc - object_id = TEST_DEVICE_0_ID # dummy device + object_id = TEST_DEVICE_0_OBJ_ID # dummy device # Set Raw Mode tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 2: Setting Raw Mode")) mode_data = pack_mode_data(object_id, 3, 0) diff --git a/tmtc/pus_tc/service_3_housekeeping.py b/tmtc/pus_tc/service_3_housekeeping.py index 39603e8..3fa532b 100644 --- a/tmtc/pus_tc/service_3_housekeeping.py +++ b/tmtc/pus_tc/service_3_housekeeping.py @@ -8,11 +8,8 @@ from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.pus_tc.definitions import TcQueueT from tmtccmd.pus_tc.service_8_functional_cmd import generate_action_command -from config.object_ids import ObjectIds -# Object IDs -TEST_DEVICE_0_ID = bytearray() -TEST_DEVICE_1_ID = bytearray() +from config.object_ids import TEST_DEVICE_1_OBJ_ID, TEST_DEVICE_0_OBJ_ID # Set IDs TEST_SET_ID = 0 @@ -25,17 +22,13 @@ PARAM_ACTIVATE_CHANGING_DATASETS = 4 def pack_service_3_commands_into(tc_queue: TcQueueT, op_code: str): - global TEST_DEVICE_0_ID, TEST_DEVICE_1_ID - if TEST_DEVICE_0_ID == bytearray() or TEST_DEVICE_1_ID == bytearray(): - TEST_DEVICE_0_ID = get_object_id(ObjectIds.TEST_DEVICE_0) - TEST_DEVICE_1_ID = get_object_id(ObjectIds.TEST_DEVICE_1) current_ssc = 3000 # TODO: Import this from config instead device_idx = 0 if device_idx == 0: - object_id = TEST_DEVICE_0_ID + object_id = TEST_DEVICE_0_OBJ_ID else: - object_id = TEST_DEVICE_1_ID + object_id = TEST_DEVICE_1_OBJ_ID if op_code == "0": # This will pack all the tests diff --git a/tmtc/pus_tc/service_8_func_cmd.py b/tmtc/pus_tc/service_8_func_cmd.py index ab14ba9..24f3317 100644 --- a/tmtc/pus_tc/service_8_func_cmd.py +++ b/tmtc/pus_tc/service_8_func_cmd.py @@ -1,21 +1,13 @@ -from config.object_ids import ObjectIds -import pus_tc.command_data as cmd_data -from pus_tc.service_200_mode import pack_mode_data - from tmtccmd.core.definitions import QueueCommands -from tmtccmd.core.object_id_manager import get_object_id from tmtccmd.ecss.tc import PusTelecommand from tmtccmd.pus_tc.definitions import TcQueueT -TEST_DEVICE_0_ID = bytearray() -TEST_DEVICE_1_ID = bytearray() +import pus_tc.command_data as cmd_data +from pus_tc.service_200_mode import pack_mode_data +from config.object_ids import TEST_DEVICE_1_OBJ_ID, TEST_DEVICE_0_OBJ_ID def pack_service_8_commands_into(tc_queue: TcQueueT, op_code: str): - global TEST_DEVICE_0_ID, TEST_DEVICE_1_ID - if TEST_DEVICE_0_ID == bytearray() or TEST_DEVICE_1_ID == bytearray(): - TEST_DEVICE_0_ID = get_object_id(ObjectIds.TEST_DEVICE_0) - TEST_DEVICE_1_ID = get_object_id(ObjectIds.TEST_DEVICE_1) if op_code == "0": pack_generic_service_8_test_into(tc_queue=tc_queue) else: @@ -24,7 +16,7 @@ def pack_service_8_commands_into(tc_queue: TcQueueT, op_code: str): def pack_generic_service_8_test_into(tc_queue: TcQueueT): tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 8")) - object_id = TEST_DEVICE_0_ID + object_id = TEST_DEVICE_0_OBJ_ID # set mode on tc_queue.appendleft((QueueCommands.PRINT, "Testing Service 8: Set On Mode")) diff --git a/tmtc/pus_tm/service_3_hk_handling.py b/tmtc/pus_tm/service_3_hk_handling.py index 81ad9d8..33aa483 100644 --- a/tmtc/pus_tm/service_3_hk_handling.py +++ b/tmtc/pus_tm/service_3_hk_handling.py @@ -6,37 +6,34 @@ """ import struct from typing import Tuple -from config.object_ids import ObjectIds from tmtccmd.pus_tm.service_3_housekeeping import Service3Base from tmtccmd.utility.tmtcc_logger import get_logger +from config.object_ids import TEST_DEVICE_0_OBJ_ID, TEST_DEVICE_1_OBJ_ID LOGGER = get_logger() def service_3_hk_handling( - object_id: int, set_id: int, hk_data: bytearray, service3_packet: Service3Base + object_id: bytearray, set_id: int, hk_data: bytearray, service3_packet: Service3Base ) -> Tuple[list, list, bytearray, int]: """ This function is called when a Service 3 Housekeeping packet is received. - Please note that the object IDs should be compared by value because direct comparison of - enumerations does not work in Python. For example use: - - if object_id.value == ObjectIds.TEST_OBJECT.value - - to test equality based on the object ID list. - - @param object_id: - @param set_id: - @param hk_data: - @param service3_packet: - @return: Expects a tuple, consisting of two lists, a bytearray and an integer + :param object_id: + :param set_id: + :param hk_data: + :param service3_packet: + :return: Expects a tuple, consisting of two lists, a bytearray and an integer The first list contains the header columns, the second list the list with the corresponding values. The bytearray is the validity buffer, which is usually appended at the end of the housekeeping packet. The last value is the number of parameters. """ - if object_id == ObjectIds.TEST_DEVICE_0.value or \ - object_id == ObjectIds.TEST_DEVICE_1.value: + if set_id: + pass + if service3_packet: + pass + if object_id == TEST_DEVICE_0_OBJ_ID or \ + object_id == TEST_DEVICE_1_OBJ_ID: return handle_test_set_deserialization(hk_data=hk_data) else: LOGGER.info("Service3TM: Parsing for this SID has not been implemented.") diff --git a/tmtc/pus_tm/service_8_handling.py b/tmtc/pus_tm/service_8_handling.py index 259e7e4..cfe04cb 100644 --- a/tmtc/pus_tm/service_8_handling.py +++ b/tmtc/pus_tm/service_8_handling.py @@ -14,6 +14,14 @@ def custom_service_8_handling( @param custom_data: @return: """ + if object_id: + pass + + if action_id: + pass + + if custom_data: + pass header_list = [] content_list = [] return header_list, content_list diff --git a/tmtc/tmtc_client_cli.py b/tmtc/tmtc_client_cli.py old mode 100755 new mode 100644 diff --git a/tmtc/tmtc_client_gui.py b/tmtc/tmtc_client_gui.py old mode 100755 new mode 100644 -- 2.43.0 From 05260c590a3fa7e3b1385047da38a443284dc396 Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Apr 2021 16:02:44 +0200 Subject: [PATCH 2/4] readded all submodules --- .gitmodules | 6 +++--- cmake/rtems-cmake | 1 + fsfw | 1 + fsfw_hal | 1 + generators/modgen | 1 + tmtc/tmtccmd | 1 + 6 files changed, 8 insertions(+), 3 deletions(-) create mode 160000 cmake/rtems-cmake create mode 160000 fsfw create mode 160000 fsfw_hal create mode 160000 generators/modgen create mode 160000 tmtc/tmtccmd diff --git a/.gitmodules b/.gitmodules index 4e83113..0aaa6a6 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "framework"] - path = fsfw - url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git [submodule "cmake/rtems-cmake"] path = cmake/rtems-cmake url = https://github.com/rmspacefish/rtems-cmake.git @@ -13,3 +10,6 @@ [submodule "generators/modgen"] path = generators/modgen url = https://git.ksat-stuttgart.de/source/modgen.git +[submodule "fsfw"] + path = fsfw + url = https://egit.irs.uni-stuttgart.de/fsfw/fsfw.git diff --git a/cmake/rtems-cmake b/cmake/rtems-cmake new file mode 160000 index 0000000..365c84c --- /dev/null +++ b/cmake/rtems-cmake @@ -0,0 +1 @@ +Subproject commit 365c84c4f2be44cb14cb990c9d04769b1e69fbc2 diff --git a/fsfw b/fsfw new file mode 160000 index 0000000..2f51152 --- /dev/null +++ b/fsfw @@ -0,0 +1 @@ +Subproject commit 2f511523cb71e00b4669db002b171d626a63fddf diff --git a/fsfw_hal b/fsfw_hal new file mode 160000 index 0000000..a85c014 --- /dev/null +++ b/fsfw_hal @@ -0,0 +1 @@ +Subproject commit a85c01465bc8687773676f05c5e7eb8af54b25ff diff --git a/generators/modgen b/generators/modgen new file mode 160000 index 0000000..2dd83db --- /dev/null +++ b/generators/modgen @@ -0,0 +1 @@ +Subproject commit 2dd83dbb458e19beec71877b969f287b03387af1 diff --git a/tmtc/tmtccmd b/tmtc/tmtccmd new file mode 160000 index 0000000..0d2450d --- /dev/null +++ b/tmtc/tmtccmd @@ -0,0 +1 @@ +Subproject commit 0d2450dfd2f34fdd5eb0b0ff55d1fbc0684f852d -- 2.43.0 From 16c226ed8c557409fdfe6644d11022a155d0408d Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Apr 2021 19:27:58 +0200 Subject: [PATCH 3/4] fsfw update --- fsfw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fsfw b/fsfw index 2f51152..9f83739 160000 --- a/fsfw +++ b/fsfw @@ -1 +1 @@ -Subproject commit 2f511523cb71e00b4669db002b171d626a63fddf +Subproject commit 9f8373977179b79fabd5d56bc999d8cac2078d8c -- 2.43.0 From 244cc972a5e6b5a73fa20eb8f3dfa0ad5c99084f Mon Sep 17 00:00:00 2001 From: Robin Mueller Date: Thu, 29 Apr 2021 19:30:36 +0200 Subject: [PATCH 4/4] reverted pus c changes --- mission/utility/TmFunnel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mission/utility/TmFunnel.cpp b/mission/utility/TmFunnel.cpp index b98c9e9..5579d18 100644 --- a/mission/utility/TmFunnel.cpp +++ b/mission/utility/TmFunnel.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include object_id_t TmFunnel::downlinkDestination = objects::NO_OBJECT; @@ -50,7 +50,7 @@ ReturnValue_t TmFunnel::handlePacket(TmTcMessage* message) { if(result != HasReturnvaluesIF::RETURN_OK){ return result; } - TmPacketPusC packet(packetData); + TmPacketBase packet(packetData); packet.setPacketSequenceCount(this->sourceSequenceCount); sourceSequenceCount++; sourceSequenceCount = sourceSequenceCount % -- 2.43.0