IT IS DONE
This commit is contained in:
parent
e9aecdac26
commit
65aecc3565
@ -211,30 +211,24 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
||||
}
|
||||
|
||||
// prepare and send update snapshot.
|
||||
CommandMessage notification;
|
||||
timeval now;
|
||||
Clock::getClock_timeval(&now);
|
||||
CCSDSTime::CDS_short cds;
|
||||
CCSDSTime::convertToCcsds(&cds, &now);
|
||||
HousekeepingPacketUpdate updatePacket(reinterpret_cast<uint8_t*>(&cds),
|
||||
sizeof(cds), owner->getDataSetHandle(receiver.dataId.sid));
|
||||
sizeof(cds), owner->getPoolObjectHandle(
|
||||
receiver.dataId.localPoolId));
|
||||
size_t updatePacketSize = updatePacket.getSerializedSize();
|
||||
|
||||
store_address_t storeId;
|
||||
uint8_t *storePtr = nullptr;
|
||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId,
|
||||
updatePacket.getSerializedSize(), &storePtr);
|
||||
ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
size_t serializedSize = 0;
|
||||
result = updatePacket.serialize(&storePtr, &serializedSize,
|
||||
updatePacketSize, SerializeIF::Endianness::MACHINE);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
HousekeepingMessage::setUpdateSnapshotSetCommand(¬ification,
|
||||
receiver.dataId.sid, storeId);
|
||||
|
||||
CommandMessage notification;
|
||||
HousekeepingMessage::setUpdateSnapshotVariableCommand(¬ification,
|
||||
receiver.dataId.localPoolId, storeId);
|
||||
result = hkQueue->sendMessage(receiver.destinationQueue,
|
||||
¬ification);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
@ -254,13 +248,23 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
||||
}
|
||||
|
||||
// prepare and send update snapshot.
|
||||
CommandMessage notification;
|
||||
// todo: serialize into store with timestamp.
|
||||
timeval now;
|
||||
Clock::getClock_timeval(&now);
|
||||
CCSDSTime::CDS_short cds;
|
||||
CCSDSTime::convertToCcsds(&cds, &now);
|
||||
HousekeepingPacketUpdate updatePacket(reinterpret_cast<uint8_t*>(&cds),
|
||||
sizeof(cds), owner->getDataSetHandle(receiver.dataId.sid));
|
||||
|
||||
store_address_t storeId;
|
||||
HousekeepingMessage::setUpdateSnapshotVariableCommand(
|
||||
¬ification, receiver.dataId.localPoolId, storeId);
|
||||
ReturnValue_t result = hkQueue->sendMessage(
|
||||
receiver.destinationQueue, ¬ification);
|
||||
ReturnValue_t result = addUpdateToStore(updatePacket, storeId);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
|
||||
CommandMessage notification;
|
||||
HousekeepingMessage::setUpdateSnapshotSetCommand(
|
||||
¬ification, receiver.dataId.sid, storeId);
|
||||
result = hkQueue->sendMessage(receiver.destinationQueue, ¬ification);
|
||||
if(result != HasReturnvaluesIF::RETURN_OK) {
|
||||
status = result;
|
||||
}
|
||||
@ -274,6 +278,21 @@ ReturnValue_t LocalDataPoolManager::handleNotificationSnapshot(
|
||||
return HasReturnvaluesIF::RETURN_OK;
|
||||
}
|
||||
|
||||
ReturnValue_t LocalDataPoolManager::addUpdateToStore(
|
||||
HousekeepingPacketUpdate& updatePacket, store_address_t& storeId) {
|
||||
size_t updatePacketSize = updatePacket.getSerializedSize();
|
||||
uint8_t *storePtr = nullptr;
|
||||
ReturnValue_t result = ipcStore->getFreeElement(&storeId,
|
||||
updatePacket.getSerializedSize(), &storePtr);
|
||||
if (result != HasReturnvaluesIF::RETURN_OK) {
|
||||
return result;
|
||||
}
|
||||
size_t serializedSize = 0;
|
||||
result = updatePacket.serialize(&storePtr, &serializedSize,
|
||||
updatePacketSize, SerializeIF::Endianness::MACHINE);
|
||||
return result;;
|
||||
}
|
||||
|
||||
void LocalDataPoolManager::handleChangeResetLogic(
|
||||
DataType type, DataId dataId, MarkChangedIF* toReset) {
|
||||
if(hkUpdateResetList == nullptr) {
|
||||
|
@ -21,7 +21,7 @@ void setStaticFrameworkObjectIds();
|
||||
}
|
||||
|
||||
class LocalDataSetBase;
|
||||
|
||||
class HousekeepingPacketUpdate;
|
||||
|
||||
/**
|
||||
* @brief This class is the managing instance for the local data pool.
|
||||
@ -357,6 +357,8 @@ private:
|
||||
ReturnValue_t& status);
|
||||
ReturnValue_t handleNotificationSnapshot(HkReceiver& hkReceiver,
|
||||
ReturnValue_t& status);
|
||||
ReturnValue_t addUpdateToStore(HousekeepingPacketUpdate& updatePacket,
|
||||
store_address_t& storeId);
|
||||
};
|
||||
|
||||
|
||||
|
@ -12,6 +12,7 @@
|
||||
class HousekeepingPacketUpdate: public SerializeIF {
|
||||
public:
|
||||
/**
|
||||
* Update packet constructor for datasets
|
||||
* @param timeStamp
|
||||
* @param timeStampSize
|
||||
* @param hkData
|
||||
@ -20,7 +21,18 @@ public:
|
||||
HousekeepingPacketUpdate(uint8_t* timeStamp, size_t timeStampSize,
|
||||
LocalPoolDataSetBase* dataSetPtr):
|
||||
timeStamp(timeStamp), timeStampSize(timeStampSize),
|
||||
dataSetPtr(dataSetPtr) {};
|
||||
updateData(dataSetPtr) {};
|
||||
|
||||
/**
|
||||
* Update packet constructor for pool variables.
|
||||
* @param timeStamp
|
||||
* @param timeStampSize
|
||||
* @param dataSetPtr
|
||||
*/
|
||||
HousekeepingPacketUpdate(uint8_t* timeStamp, size_t timeStampSize,
|
||||
LocalPoolObjectBase* dataSetPtr):
|
||||
timeStamp(timeStamp), timeStampSize(timeStampSize),
|
||||
updateData(dataSetPtr) {};
|
||||
|
||||
virtual ReturnValue_t serialize(uint8_t **buffer, size_t *size,
|
||||
size_t maxSize, Endianness streamEndianness) const {
|
||||
@ -31,18 +43,18 @@ public:
|
||||
*size += timeStampSize;
|
||||
*buffer += timeStampSize;
|
||||
}
|
||||
if(dataSetPtr == nullptr) {
|
||||
if(updateData == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
|
||||
return dataSetPtr->serialize(buffer, size, maxSize, streamEndianness);
|
||||
return updateData->serialize(buffer, size, maxSize, streamEndianness);
|
||||
}
|
||||
|
||||
virtual size_t getSerializedSize() const {
|
||||
if(dataSetPtr == nullptr) {
|
||||
if(updateData == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
return timeStampSize + dataSetPtr->getSerializedSize();
|
||||
return timeStampSize + updateData->getSerializedSize();
|
||||
}
|
||||
|
||||
virtual ReturnValue_t deSerialize(const uint8_t** buffer, size_t* size,
|
||||
@ -55,19 +67,18 @@ public:
|
||||
*buffer += timeStampSize;
|
||||
}
|
||||
|
||||
if(dataSetPtr == nullptr) {
|
||||
if(updateData == nullptr) {
|
||||
return HasReturnvaluesIF::RETURN_FAILED;
|
||||
}
|
||||
return dataSetPtr->deSerialize(buffer, size, streamEndianness);
|
||||
return updateData->deSerialize(buffer, size, streamEndianness);
|
||||
}
|
||||
|
||||
private:
|
||||
uint8_t* timeStamp;
|
||||
size_t timeStampSize;
|
||||
uint8_t* timeStamp = nullptr;
|
||||
size_t timeStampSize = 0;
|
||||
|
||||
LocalPoolDataSetBase* dataSetPtr = nullptr;
|
||||
SerializeIF* updateData = nullptr;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* FSFW_HOUSEKEEPING_HOUSEKEEPINGPACKETUPDATE_H_ */
|
||||
|
Loading…
Reference in New Issue
Block a user