new f unctions for read error reporting, bugfix
This commit is contained in:
parent
8aaf45049f
commit
007526c050
@ -25,6 +25,7 @@ class PoolVariableIF : public SerializeIF,
|
|||||||
public:
|
public:
|
||||||
static constexpr uint8_t INTERFACE_ID = CLASS_ID::POOL_VARIABLE_IF;
|
static constexpr uint8_t INTERFACE_ID = CLASS_ID::POOL_VARIABLE_IF;
|
||||||
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
|
static constexpr ReturnValue_t INVALID_READ_WRITE_MODE = MAKE_RETURN_CODE(0xA0);
|
||||||
|
static constexpr ReturnValue_t INVALID_POOL_ENTRY = MAKE_RETURN_CODE(0xA1);
|
||||||
|
|
||||||
static constexpr bool VALID = 1;
|
static constexpr bool VALID = 1;
|
||||||
static constexpr bool INVALID = 0;
|
static constexpr bool INVALID = 0;
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include "HasLocalDataPoolIF.h"
|
#include "HasLocalDataPoolIF.h"
|
||||||
|
|
||||||
|
#include "../serviceinterface/ServiceInterface.h"
|
||||||
#include "../housekeeping/HousekeepingPacketDownlink.h"
|
#include "../housekeeping/HousekeepingPacketDownlink.h"
|
||||||
#include "../housekeeping/HousekeepingMessage.h"
|
#include "../housekeeping/HousekeepingMessage.h"
|
||||||
#include "../housekeeping/PeriodicHousekeepingHelper.h"
|
#include "../housekeeping/PeriodicHousekeepingHelper.h"
|
||||||
@ -378,6 +379,9 @@ ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
|
|||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::warning << "HousekeepingManager::fechPoolEntry: Pool entry "
|
sif::warning << "HousekeepingManager::fechPoolEntry: Pool entry "
|
||||||
"not found." << std::endl;
|
"not found." << std::endl;
|
||||||
|
#else
|
||||||
|
fsfw::printWarning("HousekeepingManager::fechPoolEntry: Pool entry "
|
||||||
|
"not found.");
|
||||||
#endif
|
#endif
|
||||||
return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
|
return HasLocalDataPoolIF::POOL_ENTRY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
@ -385,8 +389,11 @@ ReturnValue_t LocalDataPoolManager::fetchPoolEntry(lp_id_t localPoolId,
|
|||||||
*poolEntry = dynamic_cast< PoolEntry<T>* >(poolIter->second);
|
*poolEntry = dynamic_cast< PoolEntry<T>* >(poolIter->second);
|
||||||
if(*poolEntry == nullptr) {
|
if(*poolEntry == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
sif::debug << "HousekeepingManager::fetchPoolEntry:"
|
sif::warning << "HousekeepingManager::fetchPoolEntry:"
|
||||||
" Pool entry not found." << std::endl;
|
" Pool entry type conflict." << std::endl;
|
||||||
|
#else
|
||||||
|
fsfw::printWarning("HousekeepingManager::fetchPoolEntry:"
|
||||||
|
" Pool entry type conflict.");
|
||||||
#endif
|
#endif
|
||||||
return HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT;
|
return HasLocalDataPoolIF::POOL_ENTRY_TYPE_CONFLICT;
|
||||||
}
|
}
|
||||||
|
@ -181,6 +181,7 @@ protected:
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void reportReadCommitError(bool read, object_id_t objectId, lp_id_t lpId);
|
||||||
};
|
};
|
||||||
|
|
||||||
#include "LocalPoolVariable.tpp"
|
#include "LocalPoolVariable.tpp"
|
||||||
|
@ -46,18 +46,17 @@ inline ReturnValue_t LocalPoolVariable<T>::readWithoutLock() {
|
|||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||||
if(result != RETURN_OK or poolEntry == nullptr) {
|
if(result != RETURN_OK or poolEntry == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
object_id_t ownerObjectId = hkManager->getOwner()->getObjectId();
|
||||||
sif::error << "PoolPoolVariable: Read of local pool variable of object "
|
reportReadCommitError(true, ownerObjectId, localPoolId);
|
||||||
<< std::hex << std::setw(8) << std::setfill('0')
|
|
||||||
<< hkManager->getOwner() << " and lp ID 0x" << localPoolId
|
|
||||||
<< std::dec << " failed." << std::setfill(' ') << std::endl;
|
|
||||||
#else
|
|
||||||
fsfw::printError("LocalPoolVariable: Read of local pool variable of "
|
|
||||||
"object 0x%08x and lp ID 0x%08x failed.\n\r",
|
|
||||||
hkManager->getOwner(), localPoolId);
|
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(poolEntry->address == nullptr) {
|
||||||
|
object_id_t ownerObjectId = hkManager->getOwner()->getObjectId();
|
||||||
|
reportReadCommitError(true, ownerObjectId, localPoolId);
|
||||||
|
return PoolVariableIF::INVALID_POOL_ENTRY;
|
||||||
|
}
|
||||||
|
|
||||||
this->value = *(poolEntry->address);
|
this->value = *(poolEntry->address);
|
||||||
this->valid = poolEntry->valid;
|
this->valid = poolEntry->valid;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
@ -91,19 +90,12 @@ inline ReturnValue_t LocalPoolVariable<T>::commitWithoutLock() {
|
|||||||
}
|
}
|
||||||
PoolEntry<T>* poolEntry = nullptr;
|
PoolEntry<T>* poolEntry = nullptr;
|
||||||
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
ReturnValue_t result = hkManager->fetchPoolEntry(localPoolId, &poolEntry);
|
||||||
if(result != RETURN_OK) {
|
if(result != RETURN_OK or poolEntry == nullptr) {
|
||||||
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
object_id_t ownerObjectId = hkManager->getOwner()->getObjectId();
|
||||||
sif::error << "PoolPoolVariable: Read of local pool variable of "
|
reportReadCommitError(false, ownerObjectId, localPoolId);
|
||||||
<< "object " << std::hex << std::setw(8) << std::setfill('0')
|
|
||||||
<< hkManager->getOwner() << " and lp ID 0x" << localPoolId
|
|
||||||
<< std::dec << " failed." << std::endl;
|
|
||||||
#else
|
|
||||||
fsfw::printError("LocalPoolVariable: Read of local pool variable of "
|
|
||||||
"object 0x%08x and lp ID 0x%08x failed.\n\r",
|
|
||||||
hkManager->getOwner(), localPoolId);
|
|
||||||
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
*(poolEntry->address) = this->value;
|
*(poolEntry->address) = this->value;
|
||||||
poolEntry->valid = this->valid;
|
poolEntry->valid = this->valid;
|
||||||
return RETURN_OK;
|
return RETURN_OK;
|
||||||
@ -203,4 +195,28 @@ inline bool LocalPoolVariable<T>::operator >(const T &other) const {
|
|||||||
return not (*this < other);
|
return not (*this < other);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline void LocalPoolVariable<T>::reportReadCommitError(bool read,
|
||||||
|
object_id_t objectId, lp_id_t lpId) {
|
||||||
|
const char* type = nullptr;
|
||||||
|
if(read) {
|
||||||
|
type = "read";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
type = "commit";
|
||||||
|
}
|
||||||
|
|
||||||
|
#if FSFW_CPP_OSTREAM_ENABLED == 1
|
||||||
|
sif::warning << "PoolPoolVariable: " << type << " of local pool "
|
||||||
|
<<"variable of object " << std::hex << std::setw(8)
|
||||||
|
<< std::setfill('0') << objectId << " and lp ID 0x" << lpId
|
||||||
|
<< std::dec << " failed." << std::endl;
|
||||||
|
#else
|
||||||
|
fsfw::printWarning("LocalPoolVariable: %s of local pool variable of "
|
||||||
|
"object 0x%08x and lp ID 0x%08x failed.\n\r",
|
||||||
|
type, objectId, lpId);
|
||||||
|
#endif /* FSFW_CPP_OSTREAM_ENABLED == 1 */
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_TPP_ */
|
#endif /* FSFW_DATAPOOLLOCAL_LOCALPOOLVARIABLE_TPP_ */
|
||||||
|
Loading…
Reference in New Issue
Block a user