1
0
forked from fsfw/fsfw

evil hidden bug found.

CSB uses CommandMessageIF now
This commit is contained in:
2020-06-13 17:37:48 +02:00
parent 7b538e9750
commit 6b67f46c80
17 changed files with 214 additions and 92 deletions

View File

@ -1,7 +1,46 @@
#include <framework/housekeeping/HousekeepingMessage.h>
#include <cstring>
HousekeepingMessage::HousekeepingMessage(MessageQueueMessage *message):
CommandMessageBase (message) {}
HousekeepingMessage::HousekeepingMessage(MessageQueueMessageIF* message):
CommandMessageBase(message) {
}
HousekeepingMessage::~HousekeepingMessage() {}
HousekeepingMessage::~HousekeepingMessage() {
}
void HousekeepingMessage::setHkReportMessage(sid_t sid,
store_address_t storeId) {
CommandMessageBase::setCommand(HK_REPORT);
setSid(sid);
setParameter(storeId.raw);
}
size_t HousekeepingMessage::getMinimumMessageSize() const {
return HK_MESSAGE_SIZE;
}
size_t HousekeepingMessage::getMaximumMessageSize() const {
return MessageQueueMessage::MAX_MESSAGE_SIZE;
}
void HousekeepingMessage::clear() {
// clear IPC store where it is needed.
}
sid_t HousekeepingMessage::getSid() const {
sid_t sid;
std::memcpy(&sid.raw, CommandMessageBase::getData(), sizeof(sid.raw));
return sid;
}
uint8_t* HousekeepingMessage::getData() {
return internalMessage->getBuffer() + sizeof(sid_t);
}
void HousekeepingMessage::setParameter(uint32_t parameter) {
memcpy(getData(), &parameter, sizeof(parameter));
}
void HousekeepingMessage::setSid(sid_t sid) {
std::memcpy(CommandMessageBase::getData(), &sid.raw, sizeof(sid.raw));
}