68 lines
1.6 KiB
C++
68 lines
1.6 KiB
C++
#include <framework/housekeeping/HousekeepingMessage.h>
|
|
#include <cstring>
|
|
|
|
HousekeepingMessage::HousekeepingMessage(): CommandMessage() {
|
|
}
|
|
|
|
HousekeepingMessage::~HousekeepingMessage() {}
|
|
|
|
void HousekeepingMessage::setParameter(uint32_t parameter) {
|
|
std::memcpy(getData(), ¶meter, sizeof(parameter));
|
|
}
|
|
|
|
uint32_t HousekeepingMessage::getParameter() const {
|
|
uint32_t parameter;
|
|
std::memcpy(¶meter, getData(), sizeof(parameter));
|
|
return parameter;
|
|
}
|
|
|
|
void HousekeepingMessage::setHkReportMessage(sid_t sid,
|
|
store_address_t storeId) {
|
|
CommandMessage::setCommand(HK_REPORT);
|
|
setSid(sid);
|
|
setParameter(storeId.raw);
|
|
}
|
|
|
|
void HousekeepingMessage::setHkDiagnosticsMessage(sid_t sid,
|
|
store_address_t storeId) {
|
|
CommandMessage::setCommand(DIAGNOSTICS_REPORT);
|
|
setSid(sid);
|
|
setParameter(storeId.raw);
|
|
}
|
|
|
|
//size_t HousekeepingMessage::getMinimumMessageSize() const {
|
|
// return HK_MESSAGE_SIZE;
|
|
//}
|
|
|
|
sid_t HousekeepingMessage::getSid() const {
|
|
sid_t sid;
|
|
std::memcpy(&sid.raw, CommandMessage::getData(), sizeof(sid.raw));
|
|
return sid;
|
|
}
|
|
|
|
|
|
sid_t HousekeepingMessage::getHkReportMessage(
|
|
store_address_t *storeIdToSet) const {
|
|
if(storeIdToSet != nullptr) {
|
|
*storeIdToSet = getParameter();
|
|
}
|
|
return getSid();
|
|
}
|
|
|
|
void HousekeepingMessage::setSid(sid_t sid) {
|
|
std::memcpy(CommandMessage::getData(), &sid.raw, sizeof(sid.raw));
|
|
}
|
|
|
|
|
|
uint8_t* HousekeepingMessage::getData() {
|
|
return CommandMessage::getData() + sizeof(sid_t);
|
|
}
|
|
|
|
const uint8_t* HousekeepingMessage::getData() const {
|
|
return CommandMessage::getData() + sizeof(sid_t);
|
|
}
|
|
|
|
void HousekeepingMessage::clear() {
|
|
// clear IPC store where it is needed.
|
|
}
|