diff --git a/container/FixedMap.h b/container/FixedMap.h index d664a086..55a43533 100644 --- a/container/FixedMap.h +++ b/container/FixedMap.h @@ -164,6 +164,15 @@ public: return theMap.maxSize(); } + bool full() { + if(_size == theMap.maxSize()) { + return true; + } + else { + return false; + } + } + virtual ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, const uint32_t max_size, bool bigEndian) const { ReturnValue_t result = SerializeAdapter::serialize(&this->_size, diff --git a/container/SimpleRingBuffer.h b/container/SimpleRingBuffer.h index 45cb0927..4552a1c0 100644 --- a/container/SimpleRingBuffer.h +++ b/container/SimpleRingBuffer.h @@ -5,8 +5,9 @@ #include /** - * Circular buffer implementation, useful for buffering into data streams. - * Note that the deleteData() has to be called to increment the read pointer + * @brief Circular buffer implementation, useful for buffering into data streams. + * @details Note that the deleteData() has to be called to increment the read pointer + * @ingroup containers */ class SimpleRingBuffer: public RingBufferBase<> { public: diff --git a/datapool/DataSet.h b/datapool/DataSet.h index deee8ca6..e8e1a597 100644 --- a/datapool/DataSet.h +++ b/datapool/DataSet.h @@ -37,44 +37,11 @@ * \ingroup data_pool */ class DataSet: public DataSetIF, public HasReturnvaluesIF, public SerializeIF { -private: + +public: //SHOULDDO we could use a linked list of datapool variables static const uint8_t DATA_SET_MAX_SIZE = 63; //!< This definition sets the maximum number of variables to register in one DataSet. - /** - * \brief This array represents all pool variables registered in this set. - * \details It has a maximum size of DATA_SET_MAX_SIZE. - */ - PoolVariableIF* registeredVariables[DATA_SET_MAX_SIZE]; - /** - * \brief The fill_count attribute ensures that the variables register in the correct array - * position and that the maximum number of variables is not exceeded. - */ - uint16_t fill_count; - /** - * States of the seet. - */ - enum States { - DATA_SET_UNINITIALISED, //!< DATA_SET_UNINITIALISED - DATA_SET_WAS_READ //!< DATA_SET_WAS_READ - }; - /** - * \brief state manages the internal state of the data set, which is important e.g. for the - * behavior on destruction. - */ - States state; - /** - * \brief This is a small helper function to facilitate locking the global data pool. - * \details It makes use of the lockDataPool method offered by the DataPool class. - */ - uint8_t lockDataPool(); - /** - * \brief This is a small helper function to facilitate unlocking the global data pool. - * \details It makes use of the freeDataPoolLock method offered by the DataPool class. - */ - uint8_t freeDataPoolLock(); - -public: static const uint8_t INTERFACE_ID = CLASS_ID::DATA_SET_CLASS; static const ReturnValue_t INVALID_PARAMETER_DEFINITION = MAKE_RETURN_CODE( 0x01 ); @@ -165,6 +132,40 @@ public: ReturnValue_t serializeRawFromIdBuffer(uint8_t ** buffer, uint32_t * size, const uint32_t max_size, bool bigEndian, uint32_t * poolIdBuffer, uint32_t poolIdSize); +private: + /** + * \brief This array represents all pool variables registered in this set. + * \details It has a maximum size of DATA_SET_MAX_SIZE. + */ + PoolVariableIF* registeredVariables[DATA_SET_MAX_SIZE]; + /** + * \brief The fill_count attribute ensures that the variables register in the correct array + * position and that the maximum number of variables is not exceeded. + */ + uint16_t fill_count; + /** + * States of the seet. + */ + enum States { + DATA_SET_UNINITIALISED, //!< DATA_SET_UNINITIALISED + DATA_SET_WAS_READ //!< DATA_SET_WAS_READ + }; + /** + * \brief state manages the internal state of the data set, which is important e.g. for the + * behavior on destruction. + */ + States state; + /** + * \brief This is a small helper function to facilitate locking the global data pool. + * \details It makes use of the lockDataPool method offered by the DataPool class. + */ + uint8_t lockDataPool(); + /** + * \brief This is a small helper function to facilitate unlocking the global data pool. + * \details It makes use of the freeDataPoolLock method offered by the DataPool class. + */ + uint8_t freeDataPoolLock(); + }; #endif /* DATASET_H_ */ diff --git a/datapool/PoolRawAccess.cpp b/datapool/PoolRawAccess.cpp index 7cc61852..66ba6218 100644 --- a/datapool/PoolRawAccess.cpp +++ b/datapool/PoolRawAccess.cpp @@ -5,8 +5,7 @@ #include PoolRawAccess::PoolRawAccess(uint32_t set_id, uint8_t setArrayEntry, - DataSetIF* data_set, ReadWriteMode_t setReadWriteMode, - bool registerVectors) : + DataSetIF* data_set, ReadWriteMode_t setReadWriteMode) : dataPoolId(set_id), arrayEntry(setArrayEntry), valid(false), type(Type::UNKNOWN_TYPE), typeSize( 0), arraySize(0), sizeTillEnd(0), readWriteMode(setReadWriteMode) { memset(value, 0, sizeof(value)); @@ -20,6 +19,7 @@ PoolRawAccess::~PoolRawAccess() { } ReturnValue_t PoolRawAccess::read() { + ReturnValue_t result = RETURN_FAILED; PoolEntryIF* read_out = ::dataPool.getRawData(dataPoolId); if (read_out != NULL) { valid = read_out->getValid(); @@ -35,21 +35,31 @@ ReturnValue_t PoolRawAccess::read() { memcpy(value, ptr, typeSize); return HasReturnvaluesIF::RETURN_OK; } else { - //Error value type too large. + result = READ_TYPE_TOO_LARGE; } } else { - //Error index requested too large + info << "PoolRawAccess: Size: " << (int)read_out->getSize() << std::endl; + result = READ_INDEX_TOO_LARGE; } } else { - //Error entry does not exist. + result = READ_ENTRY_NON_EXISTENT; } error << "PoolRawAccess: read of DP Variable 0x" << std::hex << dataPoolId - << std::dec << " failed." << std::endl; + << std::dec << " failed, "; + if(result == READ_TYPE_TOO_LARGE) { + error << "type too large." << std::endl; + } + else if(result == READ_INDEX_TOO_LARGE) { + error << "index too large." << std::endl; + } + else { + error << "entry does not exist." << std::endl; + } valid = INVALID; typeSize = 0; sizeTillEnd = 0; memset(value, 0, sizeof(value)); - return HasReturnvaluesIF::RETURN_FAILED; + return result; } ReturnValue_t PoolRawAccess::commit() { @@ -90,6 +100,32 @@ ReturnValue_t PoolRawAccess::getEntryEndianSafe(uint8_t* buffer, return HasReturnvaluesIF::RETURN_OK; } + +ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size, + const uint32_t max_size, bool bigEndian) const { + if (typeSize + *size <= max_size) { + if (bigEndian) { +#ifndef BYTE_ORDER_SYSTEM +#error BYTE_ORDER_SYSTEM not defined +#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN + for (uint8_t count = 0; count < typeSize; count++) { + (*buffer)[count] = value[typeSize - count - 1]; + } +#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN + memcpy(*buffer, value, typeSize); +#endif + } else { + memcpy(*buffer, value, typeSize); + } + *size += typeSize; + (*buffer) += typeSize; + return HasReturnvaluesIF::RETURN_OK; + } else { + return SerializeIF::BUFFER_TOO_SHORT; + } +} + + Type PoolRawAccess::getType() { return type; } @@ -146,29 +182,6 @@ uint16_t PoolRawAccess::getSizeTillEnd() const { return sizeTillEnd; } -ReturnValue_t PoolRawAccess::serialize(uint8_t** buffer, uint32_t* size, - const uint32_t max_size, bool bigEndian) const { - if (typeSize + *size <= max_size) { - if (bigEndian) { -#ifndef BYTE_ORDER_SYSTEM -#error BYTE_ORDER_SYSTEM not defined -#elif BYTE_ORDER_SYSTEM == LITTLE_ENDIAN - for (uint8_t count = 0; count < typeSize; count++) { - (*buffer)[count] = value[typeSize - count - 1]; - } -#elif BYTE_ORDER_SYSTEM == BIG_ENDIAN - memcpy(*buffer, value, typeSize); -#endif - } else { - memcpy(*buffer, value, typeSize); - } - *size += typeSize; - (*buffer) += typeSize; - return HasReturnvaluesIF::RETURN_OK; - } else { - return SerializeIF::BUFFER_TOO_SHORT; - } -} uint32_t PoolRawAccess::getSerializedSize() const { return typeSize; diff --git a/datapool/PoolRawAccess.h b/datapool/PoolRawAccess.h index 603bae23..432d9ad9 100644 --- a/datapool/PoolRawAccess.h +++ b/datapool/PoolRawAccess.h @@ -15,70 +15,17 @@ * data pool access. * @ingroup data_pool */ -class PoolRawAccess: public PoolVariableIF { -private: - /** - * \brief To access the correct data pool entry on read and commit calls, the data pool id - * is stored. - */ - uint32_t dataPoolId; - /** - * \brief The array entry that is fetched from the data pool. - */ - uint8_t arrayEntry; - /** - * \brief The valid information as it was stored in the data pool is copied to this attribute. - */ - uint8_t valid; - /** - * \brief This value contains the type of the data pool entry. - */ - Type type; - /** - * \brief This value contains the size of the data pool entry type in bytes. - */ - uint8_t typeSize; - /** - * The size of the DP array (single values return 1) - */ - uint8_t arraySize; - /** - * The size (in bytes) from the selected entry till the end of this DataPool variable. - */ - uint16_t sizeTillEnd; - /** - * \brief The information whether the class is read-write or read-only is stored here. - */ - ReadWriteMode_t readWriteMode; - static const uint8_t RAW_MAX_SIZE = sizeof(double); -protected: - /** - * \brief This is a call to read the value from the global data pool. - * \details When executed, this operation tries to fetch the pool entry with matching - * data pool id from the global data pool and copies the value and the valid - * information to its local attributes. In case of a failure (wrong type or - * pool id not found), the variable is set to zero and invalid. - * The operation does NOT provide any mutual exclusive protection by itself ! - * If reading from the data pool without information about the type is desired, - * initialize the raw pool access by supplying a data set and using the data set - * read function, which calls this read function. - */ - ReturnValue_t read(); - /** - * \brief The commit call writes back the variable's value to the data pool. - * \details It checks type and size, as well as if the variable is writable. If so, - * the value is copied and the valid flag is automatically set to "valid". - * The operation does NOT provide any mutual exclusive protection by itself. - * - */ - ReturnValue_t commit(); +class PoolRawAccess: public PoolVariableIF, HasReturnvaluesIF { public: - static const uint8_t INTERFACE_ID = CLASS_ID::POOL_RAW_ACCESS_CLASS; static const ReturnValue_t INCORRECT_SIZE = MAKE_RETURN_CODE(0x01); static const ReturnValue_t DATA_POOL_ACCESS_FAILED = MAKE_RETURN_CODE(0x02); + static const ReturnValue_t READ_TYPE_TOO_LARGE = MAKE_RETURN_CODE(0x03); + static const ReturnValue_t READ_INDEX_TOO_LARGE = MAKE_RETURN_CODE(0x04); + static const ReturnValue_t READ_ENTRY_NON_EXISTENT = MAKE_RETURN_CODE(0x05); + static const uint8_t RAW_MAX_SIZE = sizeof(double); uint8_t value[RAW_MAX_SIZE]; - //PoolRawAccess(); + /** * This constructor is used to access a data pool entry with a * given ID if the target type is not known. A DataSet object is supplied @@ -96,25 +43,13 @@ public: */ PoolRawAccess(uint32_t data_pool_id, uint8_t arrayEntry, DataSetIF* data_set, ReadWriteMode_t setReadWriteMode = - PoolVariableIF::VAR_READ,bool registerVectors = false); + PoolVariableIF::VAR_READ); /** * \brief The classes destructor is empty. If commit() was not called, the local value is * discarded and not written back to the data pool. */ ~PoolRawAccess(); - /** - * @brief Serialize raw pool entry into provided buffer directly - * @param buffer Provided buffer. Raw pool data will be copied here - * @param size [out] Increment provided size value by serialized size - * @param max_size Maximum allowed serialization size - * @param bigEndian Specify endianess - * @return - @c RETURN_OK if serialization was successfull - * - @c SerializeIF::BUFFER_TOO_SHORT if range check failed - */ - ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, - const uint32_t max_size, bool bigEndian) const; - /** * \brief This operation returns a pointer to the entry fetched. * \details Return pointer to the buffer containing the raw data @@ -136,6 +71,19 @@ public: */ ReturnValue_t getEntryEndianSafe(uint8_t* buffer, uint32_t* size, uint32_t max_size); + + /** + * @brief Serialize raw pool entry into provided buffer directly + * @param buffer Provided buffer. Raw pool data will be copied here + * @param size [out] Increment provided size value by serialized size + * @param max_size Maximum allowed serialization size + * @param bigEndian Specify endianess + * @return - @c RETURN_OK if serialization was successfull + * - @c SerializeIF::BUFFER_TOO_SHORT if range check failed + */ + ReturnValue_t serialize(uint8_t** buffer, uint32_t* size, + const uint32_t max_size, bool bigEndian) const; + /** * With this method, the content can be set from a big endian buffer safely. * @param buffer Pointer to the data to set @@ -181,6 +129,67 @@ public: ReturnValue_t deSerialize(const uint8_t** buffer, int32_t* size, bool bigEndian); + +protected: + /** + * \brief This is a call to read the value from the global data pool. + * \details When executed, this operation tries to fetch the pool entry with matching + * data pool id from the global data pool and copies the value and the valid + * information to its local attributes. In case of a failure (wrong type or + * pool id not found), the variable is set to zero and invalid. + * The operation does NOT provide any mutual exclusive protection by itself ! + * If reading from the data pool without information about the type is desired, + * initialize the raw pool access by supplying a data set and using the data set + * read function, which calls this read function. + * @return -@c RETURN_OK Read successfull + * -@c READ_TYPE_TOO_LARGE + * -@c READ_INDEX_TOO_LARGE + * -@c READ_ENTRY_NON_EXISTENT + */ + ReturnValue_t read(); + /** + * \brief The commit call writes back the variable's value to the data pool. + * \details It checks type and size, as well as if the variable is writable. If so, + * the value is copied and the valid flag is automatically set to "valid". + * The operation does NOT provide any mutual exclusive protection by itself. + * + */ + ReturnValue_t commit(); + +private: + /** + * \brief To access the correct data pool entry on read and commit calls, the data pool id + * is stored. + */ + uint32_t dataPoolId; + /** + * \brief The array entry that is fetched from the data pool. + */ + uint8_t arrayEntry; + /** + * \brief The valid information as it was stored in the data pool is copied to this attribute. + */ + uint8_t valid; + /** + * \brief This value contains the type of the data pool entry. + */ + Type type; + /** + * \brief This value contains the size of the data pool entry type in bytes. + */ + uint8_t typeSize; + /** + * The size of the DP array (single values return 1) + */ + uint8_t arraySize; + /** + * The size (in bytes) from the selected entry till the end of this DataPool variable. + */ + uint16_t sizeTillEnd; + /** + * \brief The information whether the class is read-write or read-only is stored here. + */ + ReadWriteMode_t readWriteMode; }; #endif /* POOLRAWACCESS_H_ */ diff --git a/datapool/PoolRawAccessHelper.cpp b/datapool/PoolRawAccessHelper.cpp index e1ae56bf..646ffbb1 100644 --- a/datapool/PoolRawAccessHelper.cpp +++ b/datapool/PoolRawAccessHelper.cpp @@ -78,45 +78,71 @@ ReturnValue_t PoolRawAccessHelper::serializeCurrentPoolEntryIntoBuffer(Serializa ReturnValue_t PoolRawAccessHelper::handlePoolEntrySerialization(uint32_t currentPoolId,SerializationArgs argStruct, bool withValidMask, uint8_t * validityMask) { - ReturnValue_t result; + ReturnValue_t result = RETURN_FAILED; uint8_t arrayPosition = 0; + uint8_t counter = 0; bool poolEntrySerialized = false; - //info << "Pool Raw Access Helper: Handling Pool ID: " << std::hex << currentPoolId << std::endl; + //debug << "Pool Raw Access Helper: Handling Pool ID: " << std::hex << currentPoolId << std::endl; while(not poolEntrySerialized) { + + if(counter > DataSet::DATA_SET_MAX_SIZE) { + error << "Pool Raw Access Helper: Config error, max. number of possible data set variables exceeded" << std::endl; + return result; + } + counter ++; + DataSet currentDataSet = DataSet(); + //debug << "Current array position: " << (int)arrayPosition << std::endl; PoolRawAccess currentPoolRawAccess(currentPoolId,arrayPosition,¤tDataSet,PoolVariableIF::VAR_READ); + result = currentDataSet.read(); if (result != RETURN_OK) { - debug << std::hex << "Pool Raw Access Helper: Error reading raw dataset" << std::dec << std::endl; + debug << std::hex << "Pool Raw Access Helper: Error reading raw dataset with returncode 0x" + << result << std::dec << std::endl; return result; } - uint8_t remainingSize = currentPoolRawAccess.getSizeTillEnd() - currentPoolRawAccess.getSizeOfType(); - if(remainingSize == 0) { - poolEntrySerialized = true; - } - else if(remainingSize > 0) { - arrayPosition += currentPoolRawAccess.getSizeOfType() / 8; - } - else { - error << "Pool Raw Access Helper: Configuration Error. Size till end smaller than 0" << std::endl; + + result = checkRemainingSize(¤tPoolRawAccess, &poolEntrySerialized, &arrayPosition); + if(result != RETURN_OK) { + error << "Pool Raw Access Helper: Configuration Error at pool ID " << std::hex << currentPoolId + << ". Size till end smaller than 0" << std::dec << std::endl; return result; } + // set valid mask bit if necessary if(withValidMask) { if(currentPoolRawAccess.isValid()) { handleMaskModification(validityMask); } } + result = currentDataSet.serialize(argStruct.buffer, argStruct.size, argStruct.max_size, argStruct.bigEndian); if (result != RETURN_OK) { - debug << "Pool Raw Access Helper: Error serializing pool data into send buffer" << std::endl; + debug << "Pool Raw Access Helper: Error serializing pool data with ID 0x" << std::hex << + currentPoolId << " into send buffer with return code " << result << std::dec << std::endl; return result; } + } return result; } +ReturnValue_t PoolRawAccessHelper::checkRemainingSize(PoolRawAccess * currentPoolRawAccess, + bool * isSerialized, uint8_t * arrayPosition) { + int8_t remainingSize = currentPoolRawAccess->getSizeTillEnd() - currentPoolRawAccess->getSizeOfType(); + if(remainingSize == 0) { + *isSerialized = true; + } + else if(remainingSize > 0) { + *arrayPosition += 1; + } + else { + return RETURN_FAILED; + } + return RETURN_OK; +} + void PoolRawAccessHelper::handleMaskModification(uint8_t * validityMask) { validityMask[validBufferIndex] = bitSetter(validityMask[validBufferIndex], validBufferIndexBit, true); diff --git a/datapool/PoolRawAccessHelper.h b/datapool/PoolRawAccessHelper.h index e9e9c8ec..72f2324c 100644 --- a/datapool/PoolRawAccessHelper.h +++ b/datapool/PoolRawAccessHelper.h @@ -90,6 +90,8 @@ private: ReturnValue_t handlePoolEntrySerialization(uint32_t currentPoolId,SerializationArgs argStruct, bool withValidMask = false, uint8_t * validityMask = NULL); + ReturnValue_t checkRemainingSize(PoolRawAccess * currentPoolRawAccess, + bool * isSerialized, uint8_t * arrayPosition); void handleMaskModification(uint8_t * validityMask); /** * Sets specific bit of a byte diff --git a/osal/FreeRTOS/MessageQueue.cpp b/osal/FreeRTOS/MessageQueue.cpp index 1f514cf3..887df392 100644 --- a/osal/FreeRTOS/MessageQueue.cpp +++ b/osal/FreeRTOS/MessageQueue.cpp @@ -38,7 +38,9 @@ ReturnValue_t MessageQueue::reply(MessageQueueMessage* message) { ReturnValue_t MessageQueue::receiveMessage(MessageQueueMessage* message, MessageQueueId_t* receivedFrom) { ReturnValue_t status = this->receiveMessage(message); - *receivedFrom = this->lastPartner; + if(status == HasReturnvaluesIF::RETURN_OK) { + *receivedFrom = this->lastPartner; + } return status; } diff --git a/serialize/SerialBufferAdapter.cpp b/serialize/SerialBufferAdapter.cpp index a365cc99..a045d37a 100644 --- a/serialize/SerialBufferAdapter.cpp +++ b/serialize/SerialBufferAdapter.cpp @@ -1,24 +1,27 @@ #include #include +#include template SerialBufferAdapter::SerialBufferAdapter(const uint8_t* buffer, T bufferLength, bool serializeLength) : - serializeLength(serializeLength), constBuffer(buffer), buffer(NULL), bufferLength( - bufferLength) { + currentBufferType(bufferType::CONST), serializeLength(serializeLength), + constBuffer(buffer), buffer(NULL), bufferLength(bufferLength) { + } template SerialBufferAdapter::SerialBufferAdapter(uint8_t* buffer, T bufferLength, bool serializeLength) : - serializeLength(serializeLength), constBuffer(NULL), buffer(buffer), bufferLength( - bufferLength) { + currentBufferType(bufferType::NORMAL),serializeLength(serializeLength), constBuffer(NULL), buffer(buffer), + bufferLength(bufferLength) { } template SerialBufferAdapter::SerialBufferAdapter(uint32_t* buffer, T bufferLength, bool serializeLength) : - serializeLength(serializeLength), constBuffer(NULL), buffer(reinterpret_cast(buffer)), + currentBufferType(bufferType::NORMAL),serializeLength(serializeLength), + constBuffer(NULL), buffer(reinterpret_cast(buffer)), bufferLength(bufferLength*4) { } @@ -93,14 +96,28 @@ ReturnValue_t SerialBufferAdapter::deSerialize(const uint8_t** buffer, template uint8_t * SerialBufferAdapter::getBuffer() { + if(currentBufferType != NORMAL) { + warning << "Wrong access function for stored type ! Use getConstBuffer()" << std::endl; + return 0; + } return buffer; } +template +const uint8_t * SerialBufferAdapter::getConstBuffer() { + if(currentBufferType != CONST) { + warning << "Wrong access function for stored type ! Use getBuffer()" << std::endl; + return 0; + } + return constBuffer; +} + template void SerialBufferAdapter::setBuffer(uint8_t * buffer_) { buffer = buffer_; } + //forward Template declaration for linker template class SerialBufferAdapter; template class SerialBufferAdapter; diff --git a/serialize/SerialBufferAdapter.h b/serialize/SerialBufferAdapter.h index cee2cb26..6623beb3 100644 --- a/serialize/SerialBufferAdapter.h +++ b/serialize/SerialBufferAdapter.h @@ -28,7 +28,7 @@ public: SerialBufferAdapter(const uint8_t * buffer, T bufferLength, bool serializeLength = false); /** - * Constructoor for non-constant uint8_t buffer. Length field can be serialized optionally. + * Constructor for non-constant uint8_t buffer. Length field can be serialized optionally. * Type of length can be supplied as template type. * @param buffer * @param bufferLength @@ -56,8 +56,16 @@ public: bool bigEndian); uint8_t * getBuffer(); + const uint8_t * getConstBuffer(); void setBuffer(uint8_t * buffer_); private: + + enum bufferType { + NORMAL, + CONST + }; + bufferType currentBufferType; + bool serializeLength; const uint8_t *constBuffer; uint8_t *buffer; diff --git a/storagemanager/LocalPool.h b/storagemanager/LocalPool.h index 80e6a495..f8b2b730 100644 --- a/storagemanager/LocalPool.h +++ b/storagemanager/LocalPool.h @@ -294,8 +294,8 @@ inline ReturnValue_t LocalPool::reserveSpace( if (!ignoreFault) { internalErrorReporter->storeFull(); } -// error << "LocalPool( " << std::hex << getObjectId() << std::dec -// << " )::reserveSpace: Packet store is full." << std::endl; + error << "LocalPool( " << std::hex << getObjectId() << std::dec + << " )::reserveSpace: Packet store is full." << std::endl; } return status; } diff --git a/tcdistribution/PUSDistributor.cpp b/tcdistribution/PUSDistributor.cpp index a209620f..7b413eab 100644 --- a/tcdistribution/PUSDistributor.cpp +++ b/tcdistribution/PUSDistributor.cpp @@ -31,7 +31,7 @@ iterator_t PUSDistributor::selectDestination() { } if (tcStatus != RETURN_OK) { - debug << "PUSDistributor::handlePacket: error with " << (int) tcStatus + debug << "PUSDistributor::handlePacket: error with 0x" << std::hex << (int) tcStatus << std::endl; return this->queueMap.end(); } else { @@ -48,6 +48,7 @@ ReturnValue_t PUSDistributor::registerService(AcceptsTelecommandsIF* service) { ReturnValue_t returnValue = RETURN_OK; bool errorCode = true; uint16_t serviceId = service->getIdentifier(); + //info << "Service ID: " << (int)serviceId << std::endl; MessageQueueId_t queue = service->getRequestQueue(); errorCode = this->queueMap.insert( std::pair(serviceId, queue)).second; diff --git a/tmtcservices/CommandingServiceBase.h b/tmtcservices/CommandingServiceBase.h index 8ce25f00..279f9ab4 100644 --- a/tmtcservices/CommandingServiceBase.h +++ b/tmtcservices/CommandingServiceBase.h @@ -195,7 +195,7 @@ protected: * @param tcData Application Data of TC Packet * @param tcDataLen * @param id MessageQueue ID is stored here - * @param objectId + * @param objectId Object ID is extracted and stored here * @return - @c RETURN_OK on success * - @c RETURN_FAILED * - @c CSB or implementation specific return codes @@ -206,15 +206,15 @@ protected: /** * After the Message Queue and Object ID are determined, - * the command is prepared by using an implementation specific CommandMessage type which is sent to - * the target device. It contains all necessary information for the device to - * execute telecommands. + * the command is prepared by using an implementation specific CommandMessage type + * which is sent to the target object. + * It contains all necessary information for the device to execute telecommands. * @param message * @param subservice * @param tcData * @param tcDataLen * @param state - * @param objectId + * @param objectId Target object ID * @return */ virtual ReturnValue_t prepareCommand(CommandMessage *message, @@ -226,11 +226,11 @@ protected: * and the respective PUS Commanding Service once the execution has started. * The PUS Commanding Service receives replies from the target device and forwards them by calling this function. * There are different translations of these replies to specify how the Command Service proceeds. - * @param reply Command Message which contains information about the command - * @param previousCommand + * @param reply[out] Command Message which contains information about the command + * @param previousCommand [out] * @param state * @param optionalNextCommand - * @param objectId + * @param objectId Source object ID * @param isStep Flag value to mark steps of command execution * @return - @c RETURN_OK, @c EXECUTION_COMPLETE or @c NO_STEP_MESSAGE to generate TC verification success * - @c INVALID_REPLY can handle unrequested replies