this should do the job
Some checks are pending
EIVE/eive-obsw/pipeline/head Build queued...
EIVE/eive-obsw/pipeline/pr-main This commit looks good

This commit is contained in:
2023-11-15 15:21:00 +01:00
parent 49a87224e7
commit f0536a9d77
6 changed files with 80 additions and 34 deletions

View File

@ -16,8 +16,8 @@ Service15TmStorage::Service15TmStorage(object_id_t objectId, uint16_t apid,
ReturnValue_t Service15TmStorage::isValidSubservice(uint8_t subservice) {
switch (subservice) {
case (Subservices::DELETE_UP_TO):
case (Subservices::START_BY_TIME_RANGE_RETRIEVAL): {
case (Subservice::DELETE_UP_TO):
case (Subservice::START_BY_TIME_RANGE_RETRIEVAL): {
return OK;
}
default: {
@ -45,34 +45,55 @@ ReturnValue_t Service15TmStorage::getMessageQueueAndObject(uint8_t subservice,
ReturnValue_t Service15TmStorage::prepareCommand(CommandMessage *message, uint8_t subservice,
const uint8_t *tcData, size_t tcDataLen,
uint32_t *state, object_id_t objectId) {
if (subservice == Subservices::START_BY_TIME_RANGE_RETRIEVAL) {
// TODO: Hardcoded to UNIX timestamps.. Should allow arbitrary timestamp and let receiver
// to time reading and reply handling
if (tcDataLen != 12) {
return INVALID_TC;
switch (subservice) {
case (Subservice::START_BY_TIME_RANGE_RETRIEVAL): {
// TODO: Hardcoded to UNIX timestamps.. Should allow arbitrary timestamp and let receiver
// to time reading and reply handling
if (tcDataLen != 12) {
return INVALID_TC;
}
store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, tcData + 4, tcDataLen - 4);
if (result != OK) {
return result;
}
// Store timestamps
TmStoreMessage::setDownlinkContentTimeMessage(message, storeId);
return CommandingServiceBase::EXECUTION_COMPLETE;
}
store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, tcData + 4, tcDataLen - 4);
if (result != OK) {
return result;
case (Subservice::DELETE_UP_TO): {
// TODO: Hardcoded to UNIX timestamps.. Should allow arbitrary timestamp and let receiver
// to time reading and reply handling
if (tcDataLen != 8) {
return INVALID_TC;
}
store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, tcData + 4, tcDataLen - 4);
if (result != OK) {
return result;
}
// Store timestamps
TmStoreMessage::setDeleteContentTimeMessage(message, storeId);
return CommandingServiceBase::EXECUTION_COMPLETE;
}
// Store timestamps
TmStoreMessage::setDownlinkContentTimeMessage(message, storeId);
return CommandingServiceBase::EXECUTION_COMPLETE;
} else if (subservice == Subservices::DELETE_UP_TO) {
// TODO: Hardcoded to UNIX timestamps.. Should allow arbitrary timestamp and let receiver
// to time reading and reply handling
if (tcDataLen != 8) {
return INVALID_TC;
case (Subservice::DELETE_BY_TIME_RANGE): {
// TODO: Hardcoded two UNIX timestamps.. Should allow arbitrary timestamp and let receiver
// to time reading and reply handling
if (tcDataLen != 12) {
return INVALID_TC;
}
store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, tcData + 4, tcDataLen - 4);
if (result != OK) {
return result;
}
// Store timestamps
TmStoreMessage::setDeleteContentTimeMessage(message, storeId);
return CommandingServiceBase::EXECUTION_COMPLETE;
}
store_address_t storeId;
ReturnValue_t result = ipcStore->addData(&storeId, tcData + 4, tcDataLen - 4);
if (result != OK) {
return result;
default: {
return CommandingServiceBase::INVALID_SUBSERVICE;
}
// Store timestamps
TmStoreMessage::setDeleteContentTimeMessage(message, storeId);
return CommandingServiceBase::EXECUTION_COMPLETE;
}
return OK;
}