From 827f185e20788b0b72eaf4cd5d322e78fb7cadd6 Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sat, 4 Jan 2020 16:37:08 +0100 Subject: [PATCH 1/2] Some bugfixes(?) for PusServiceBase. Getter Function for Serial Buffer Adapter. --- container/FixedMap.h | 8 ++++---- container/FixedOrderedMultimap.h | 2 +- returnvalues/FwClassIds.h | 1 + serialize/SerialBufferAdapter.cpp | 8 ++++---- serialize/SerialBufferAdapter.h | 2 +- tmtcservices/PusServiceBase.h | 18 +++++++++++++----- 6 files changed, 24 insertions(+), 15 deletions(-) diff --git a/container/FixedMap.h b/container/FixedMap.h index 5e8ca9c35..d664a0861 100644 --- a/container/FixedMap.h +++ b/container/FixedMap.h @@ -16,8 +16,8 @@ template class FixedMap: public SerializeIF { public: static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP; - static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01); - static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x02); + static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01); //!< P1: SID for HK packets + static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x02); //!< P1: SID for HK packets static const ReturnValue_t KEY_DOES_NOT_EXIST = MAKE_RETURN_CODE(0x03); private: @@ -88,10 +88,10 @@ public: ReturnValue_t insert(key_t key, T value, Iterator *storedValue = NULL) { if (exists(key) == HasReturnvaluesIF::RETURN_OK) { - return KEY_ALREADY_EXISTS; + return FixedMap::KEY_ALREADY_EXISTS; } if (_size == theMap.maxSize()) { - return MAP_FULL; + return FixedMap::MAP_FULL; } theMap[_size].first = key; theMap[_size].second = value; diff --git a/container/FixedOrderedMultimap.h b/container/FixedOrderedMultimap.h index 21629664b..3dd20a749 100644 --- a/container/FixedOrderedMultimap.h +++ b/container/FixedOrderedMultimap.h @@ -10,7 +10,7 @@ template> class FixedOrderedMultimap { public: - static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MAP; + static const uint8_t INTERFACE_ID = CLASS_ID::FIXED_MULTIMAP; static const ReturnValue_t KEY_ALREADY_EXISTS = MAKE_RETURN_CODE(0x01); static const ReturnValue_t MAP_FULL = MAKE_RETURN_CODE(0x02); static const ReturnValue_t KEY_DOES_NOT_EXIST = MAKE_RETURN_CODE(0x03); diff --git a/returnvalues/FwClassIds.h b/returnvalues/FwClassIds.h index d21861c08..beef04754 100644 --- a/returnvalues/FwClassIds.h +++ b/returnvalues/FwClassIds.h @@ -24,6 +24,7 @@ enum { MEMORY_HELPER, //MH SERIALIZE_IF, //SE FIXED_MAP, //FM + FIXED_MULTIMAP, //FMM HAS_HEALTH_IF, //HHI FIFO_CLASS, //FF MESSAGE_PROXY, //MQP diff --git a/serialize/SerialBufferAdapter.cpp b/serialize/SerialBufferAdapter.cpp index d7ab0d880..a365cc993 100644 --- a/serialize/SerialBufferAdapter.cpp +++ b/serialize/SerialBufferAdapter.cpp @@ -96,10 +96,10 @@ uint8_t * SerialBufferAdapter::getBuffer() { return buffer; } -//template -//void SerialBufferAdapter::setBuffer(uint8_t * buffer_) { -// buffer = buffer_; -//} +template +void SerialBufferAdapter::setBuffer(uint8_t * buffer_) { + buffer = buffer_; +} //forward Template declaration for linker template class SerialBufferAdapter; diff --git a/serialize/SerialBufferAdapter.h b/serialize/SerialBufferAdapter.h index 0438f8841..cee2cb263 100644 --- a/serialize/SerialBufferAdapter.h +++ b/serialize/SerialBufferAdapter.h @@ -56,7 +56,7 @@ public: bool bigEndian); uint8_t * getBuffer(); - //void setBuffer(uint8_t * buffer_); + void setBuffer(uint8_t * buffer_); private: bool serializeLength; const uint8_t *constBuffer; diff --git a/tmtcservices/PusServiceBase.h b/tmtcservices/PusServiceBase.h index 2b5e8b67c..6c8c5f617 100644 --- a/tmtcservices/PusServiceBase.h +++ b/tmtcservices/PusServiceBase.h @@ -46,13 +46,20 @@ public: */ virtual ~PusServiceBase(); /** - * The handleRequest method shall handle any kind of Telecommand Request immediately. + * @brief The handleRequest method shall handle any kind of Telecommand Request immediately. + * @details * Implemetations can take the Telecommand in currentPacket and perform any kind of operation. * They may send additional "Start Success (1,3)" messages with the verifyReporter, but Completion * Success or Failure Reports are generated automatically after execution of this method. - * If a Telecommand can not be executed within one call cycle, this Base class is not the right parent. - * The child class may add additional error information in #errorParameters which are attached to the generated - * verification message. Subservice checking should be implemented in this method. + * + * If a Telecommand can not be executed within one call cycle, + * this Base class is not the right parent. + * + * The child class may add additional error information by setting #errorParameters which are + * attached to the generated verification message. + * + * Subservice checking should be implemented in this method. + * * @return The returned status_code is directly taken as main error code in the Verification Report. * On success, RETURN_OK shall be returned. */ @@ -91,7 +98,8 @@ protected: /** * One of two error parameters for additional error information. */ - uint8_t errorParameter2; + // shouldn't this be uint32_t ? The PUS Verification Message structure param2 has the size 4 + uint32_t errorParameter2; /** * This is a complete instance of the Telecommand reception queue of the class. * It is initialized on construction of the class. From 2ec486a8806f9c0bdf287ef81b04c6b494c592ef Mon Sep 17 00:00:00 2001 From: "Robin.Mueller" Date: Sun, 5 Jan 2020 18:20:57 +0100 Subject: [PATCH 2/2] max number of stored packets lowered --- tmtcservices/TmTcBridge.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmtcservices/TmTcBridge.h b/tmtcservices/TmTcBridge.h index 7870e79b7..8e4124e08 100644 --- a/tmtcservices/TmTcBridge.h +++ b/tmtcservices/TmTcBridge.h @@ -115,7 +115,7 @@ protected: private: static const uint8_t TMTC_RECEPTION_QUEUE_DEPTH = 20; static const uint8_t MAX_STORED_DATA_SENT_PER_CYCLE = 10; - static const uint8_t MAX_DOWNLINK_PACKETS_STORED = 20; + static const uint8_t MAX_DOWNLINK_PACKETS_STORED = 15; FIFO fifo; uint8_t * recvBuffer;