send time stampers properly now

This commit is contained in:
Robin Müller 2022-07-27 17:48:59 +02:00
parent f591b9793c
commit 234ccdf764
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
4 changed files with 19 additions and 8 deletions

View File

@ -10,7 +10,8 @@
Service1TelecommandVerification::Service1TelecommandVerification(object_id_t objectId, Service1TelecommandVerification::Service1TelecommandVerification(object_id_t objectId,
uint16_t apid, uint8_t serviceId, uint16_t apid, uint8_t serviceId,
object_id_t targetDestination, object_id_t targetDestination,
uint16_t messageQueueDepth) uint16_t messageQueueDepth,
TimeStamperIF* timeStamper)
: SystemObject(objectId), : SystemObject(objectId),
apid(apid), apid(apid),
serviceId(serviceId), serviceId(serviceId),
@ -119,6 +120,14 @@ ReturnValue_t Service1TelecommandVerification::initialize() {
} }
storeHelper.setTmStore(*tmStore); storeHelper.setTmStore(*tmStore);
} }
if(timeStamper == nullptr) {
timeStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER);
if(timeStamper == nullptr) {
return ObjectManagerIF::CHILD_INIT_FAILED;
}
} else {
}
storeHelper.setTimeStamper(*timeStamper);
sendHelper.setMsgQueue(*tmQueue); sendHelper.setMsgQueue(*tmQueue);
if (errReporter == nullptr) { if (errReporter == nullptr) {

View File

@ -47,7 +47,8 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_1; static const uint8_t SUBSYSTEM_ID = SUBSYSTEM_ID::PUS_SERVICE_1;
Service1TelecommandVerification(object_id_t objectId, uint16_t apid, uint8_t serviceId, Service1TelecommandVerification(object_id_t objectId, uint16_t apid, uint8_t serviceId,
object_id_t targetDestination, uint16_t messageQueueDepth); object_id_t targetDestination, uint16_t messageQueueDepth,
TimeStamperIF* timeStamper = nullptr);
~Service1TelecommandVerification() override; ~Service1TelecommandVerification() override;
/** /**
@ -87,6 +88,7 @@ class Service1TelecommandVerification : public AcceptsVerifyMessageIF,
TmStoreHelper storeHelper; TmStoreHelper storeHelper;
TmStoreAndSendWrapper tmHelper; TmStoreAndSendWrapper tmHelper;
InternalErrorReporterIF* errReporter = nullptr; InternalErrorReporterIF* errReporter = nullptr;
TimeStamperIF* timeStamper = nullptr;
StorageManagerIF* tmStore = nullptr; StorageManagerIF* tmStore = nullptr;
MessageQueueIF* tmQueue = nullptr; MessageQueueIF* tmQueue = nullptr;

View File

@ -60,9 +60,8 @@ ReturnValue_t PusTmReader::parseData(bool crcCheck) {
size_t currentOffset = SpacePacketReader::getHeaderLen(); size_t currentOffset = SpacePacketReader::getHeaderLen();
pointers.secHeaderStart = pointers.spHeaderStart + currentOffset; pointers.secHeaderStart = pointers.spHeaderStart + currentOffset;
currentOffset += PusTmIF::MIN_SEC_HEADER_LEN; currentOffset += PusTmIF::MIN_SEC_HEADER_LEN;
size_t minTimestampLen = spReader.getBufSize() - currentOffset; size_t minTimestampLen = spReader.getFullPacketLen() - currentOffset;
result = timeReader->readTimeStamp(pointers.secHeaderStart + PusTmIF::MIN_SEC_HEADER_LEN, result = timeReader->readTimeStamp(pointers.spHeaderStart + currentOffset, minTimestampLen);
minTimestampLen);
if (result != HasReturnvaluesIF::RETURN_OK) { if (result != HasReturnvaluesIF::RETURN_OK) {
return result; return result;
} }

View File

@ -104,11 +104,12 @@ ReturnValue_t CommandingServiceBase::initialize() {
// This avoids duplicate calculation of the CRC16 // This avoids duplicate calculation of the CRC16
tmStoreHelper.disableCrcCalculation(); tmStoreHelper.disableCrcCalculation();
if (tmTimeStamper == nullptr) { if (tmTimeStamper == nullptr) {
auto timerStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER); tmTimeStamper = ObjectManager::instance()->get<TimeStamperIF>(objects::TIME_STAMPER);
if (timerStamper != nullptr) { if (tmTimeStamper == nullptr) {
tmStoreHelper.setTimeStamper(*timerStamper); return ObjectManagerIF::CHILD_INIT_FAILED;
} }
} }
tmStoreHelper.setTimeStamper(*tmTimeStamper);
if (errReporter == nullptr) { if (errReporter == nullptr) {
errReporter = errReporter =