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