several simplifications

This commit is contained in:
Robin Müller 2020-08-10 18:33:28 +02:00
parent 87eb31b65a
commit f39b8bdb41
5 changed files with 7 additions and 22 deletions

View File

@ -131,11 +131,6 @@ ReturnValue_t LocalDataPoolManager::generateHousekeepingPacket(sid_t sid,
return HasReturnvaluesIF::RETURN_FAILED; return HasReturnvaluesIF::RETURN_FAILED;
} }
// do we generate hk packets for invalid datasets?
// if(not dataSetToSerialize->isValid()) {
// return HasReturnvaluesIF::RETURN_OK;
// }
store_address_t storeId; store_address_t storeId;
HousekeepingPacketDownlink hkPacket(sid, collectionInterval, HousekeepingPacketDownlink hkPacket(sid, collectionInterval,
dataSetToSerialize->getFillCount(), dataSetToSerialize); dataSetToSerialize->getFillCount(), dataSetToSerialize);
@ -249,7 +244,7 @@ ReturnValue_t LocalDataPoolManager::performHkOperation() {
void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver* receiver) { void LocalDataPoolManager::performPeriodicHkGeneration(HkReceiver* receiver) {
if(receiver->intervalCounter >= intervalSecondsToInterval( if(receiver->intervalCounter >= intervalSecondsToInterval(
receiver->isDiagnostics, receiver->isDiagnostics,
receiver->hkParameter.collectionInterval)) { receiver->hkParameter.collectionIntervalSeconds)) {
ReturnValue_t result = generateHousekeepingPacket( ReturnValue_t result = generateHousekeepingPacket(
receiver->dataId.dataSetSid, receiver->destinationQueue); receiver->dataId.dataSetSid, receiver->destinationQueue);
if(result != HasReturnvaluesIF::RETURN_OK) { if(result != HasReturnvaluesIF::RETURN_OK) {

View File

@ -176,7 +176,7 @@ private:
type */ type */
union HkParameter { union HkParameter {
/** This parameter will be used for the PERIODIC type */ /** This parameter will be used for the PERIODIC type */
dur_seconds_t collectionInterval = 0; float collectionIntervalSeconds = 0;
/** This parameter will be used for the ON_UPDATE type */ /** This parameter will be used for the ON_UPDATE type */
bool hkDataChanged; bool hkDataChanged;
}; };

View File

@ -8,7 +8,7 @@ void HousekeepingMessage::setHkReportMessage(CommandMessage* message, sid_t sid,
message->setCommand(HK_REPORT); message->setCommand(HK_REPORT);
message->setMessageSize(HK_MESSAGE_SIZE); message->setMessageSize(HK_MESSAGE_SIZE);
setSid(message, sid); setSid(message, sid);
setParameter(message, storeId.raw); message->setParameter3(storeId.raw);
} }
void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message, void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message,
@ -16,13 +16,13 @@ void HousekeepingMessage::setHkDiagnosticsMessage(CommandMessage* message,
message->setCommand(DIAGNOSTICS_REPORT); message->setCommand(DIAGNOSTICS_REPORT);
message->setMessageSize(HK_MESSAGE_SIZE); message->setMessageSize(HK_MESSAGE_SIZE);
setSid(message, sid); setSid(message, sid);
setParameter(message, storeId.raw); message->setParameter3(storeId.raw);
} }
sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message, sid_t HousekeepingMessage::getHkReportMessage(const CommandMessage *message,
store_address_t *storeIdToSet) { store_address_t *storeIdToSet) {
if(storeIdToSet != nullptr) { if(storeIdToSet != nullptr) {
*storeIdToSet = getParameter(message); *storeIdToSet = message->getParameter3();
} }
return getSid(message); return getSid(message);
} }
@ -37,12 +37,3 @@ void HousekeepingMessage::setSid(CommandMessage *message, sid_t sid) {
std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw)); std::memcpy(message->getData(), &sid.raw, sizeof(sid.raw));
} }
void HousekeepingMessage::setParameter(CommandMessage *message,
uint32_t parameter) {
message->setParameter3(parameter);
}
uint32_t HousekeepingMessage::getParameter(const CommandMessage *message) {
return message->getParameter3();
}

View File

@ -112,8 +112,6 @@ public:
private: private:
static void setSid(CommandMessage* message, sid_t sid); static void setSid(CommandMessage* message, sid_t sid);
static void setParameter(CommandMessage* message, uint32_t parameter);
static uint32_t getParameter(const CommandMessage* message);
}; };

View File

@ -132,6 +132,7 @@ ReturnValue_t MessageQueue::sendMessageFromMessageQueue(MessageQueueId_t sendTo,
else { else {
destination = reinterpret_cast<QueueHandle_t>(sendTo); destination = reinterpret_cast<QueueHandle_t>(sendTo);
} }
message->setSender(sentFrom); message->setSender(sentFrom);