2020-12-22 15:58:52 +01:00
|
|
|
#include "TmStoreMessage.h"
|
2020-08-13 20:53:35 +02:00
|
|
|
#include "../objectmanager/ObjectManagerIF.h"
|
2016-06-15 23:48:41 +02:00
|
|
|
|
|
|
|
TmStoreMessage::~TmStoreMessage() {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
TmStoreMessage::TmStoreMessage() {
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TmStoreMessage::setEnableStoringMessage(CommandMessage* cmd,
|
|
|
|
bool setEnabled) {
|
|
|
|
cmd->setCommand(ENABLE_STORING);
|
|
|
|
cmd->setParameter(setEnabled);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TmStoreMessage::setDeleteContentMessage(CommandMessage* cmd,
|
2018-07-12 16:29:32 +02:00
|
|
|
ApidSsc upTo) {
|
2016-06-15 23:48:41 +02:00
|
|
|
cmd->setCommand(DELETE_STORE_CONTENT);
|
|
|
|
cmd->setParameter((upTo.apid<<16) + upTo.ssc);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TmStoreMessage::setDownlinkContentMessage(CommandMessage* cmd,
|
2018-07-12 16:29:32 +02:00
|
|
|
ApidSsc fromPacket,
|
|
|
|
ApidSsc toPacket) {
|
2016-06-15 23:48:41 +02:00
|
|
|
cmd->setCommand(DOWNLINK_STORE_CONTENT);
|
|
|
|
cmd->setParameter((fromPacket.apid<<16) + fromPacket.ssc);
|
|
|
|
cmd->setParameter2((toPacket.apid<<16) + toPacket.ssc);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
ApidSsc TmStoreMessage::getPacketId1(CommandMessage* cmd) {
|
|
|
|
ApidSsc temp;
|
2016-06-15 23:48:41 +02:00
|
|
|
temp.apid = (cmd->getParameter() >> 16) & 0xFFFF;
|
|
|
|
temp.ssc = cmd->getParameter() & 0xFFFF;
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
ApidSsc TmStoreMessage::getPacketId2(CommandMessage* cmd) {
|
|
|
|
ApidSsc temp;
|
2016-06-15 23:48:41 +02:00
|
|
|
temp.apid = (cmd->getParameter2() >> 16) & 0xFFFF;
|
|
|
|
temp.ssc = cmd->getParameter2() & 0xFFFF;
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TmStoreMessage::getEnableStoring(CommandMessage* cmd) {
|
|
|
|
return (bool)cmd->getParameter();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TmStoreMessage::setChangeSelectionDefinitionMessage(
|
|
|
|
CommandMessage* cmd, bool addDefinition, store_address_t store_id) {
|
|
|
|
cmd->setCommand(CHANGE_SELECTION_DEFINITION);
|
|
|
|
cmd->setParameter(addDefinition);
|
|
|
|
cmd->setParameter2(store_id.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TmStoreMessage::clear(CommandMessage* cmd) {
|
|
|
|
switch(cmd->getCommand()) {
|
|
|
|
case SELECTION_DEFINITION_REPORT:
|
|
|
|
case STORE_CATALOGUE_REPORT:
|
2018-07-12 16:29:32 +02:00
|
|
|
case CHANGE_SELECTION_DEFINITION:
|
|
|
|
case INDEX_REPORT:
|
|
|
|
case DELETE_STORE_CONTENT_TIME:
|
|
|
|
case DOWNLINK_STORE_CONTENT_TIME: {
|
2016-06-15 23:48:41 +02:00
|
|
|
StorageManagerIF *ipcStore = objectManager->get<StorageManagerIF>(
|
|
|
|
objects::IPC_STORE);
|
|
|
|
if (ipcStore != NULL) {
|
|
|
|
ipcStore->deleteData(getStoreId(cmd));
|
|
|
|
}
|
|
|
|
}
|
2018-07-12 16:29:32 +02:00
|
|
|
/* NO BREAK falls through*/
|
|
|
|
case DELETE_STORE_CONTENT_BLOCKS:
|
|
|
|
case DOWNLINK_STORE_CONTENT_BLOCKS:
|
|
|
|
case REPORT_INDEX_REQUEST:
|
2020-12-22 15:57:43 +01:00
|
|
|
cmd->setCommand(CommandMessage::UNKNOWN_COMMAND);
|
2018-07-12 16:29:32 +02:00
|
|
|
cmd->setParameter(0);
|
|
|
|
cmd->setParameter2(0);
|
2016-06-15 23:48:41 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
store_address_t TmStoreMessage::getStoreId(const CommandMessage* cmd) {
|
|
|
|
store_address_t temp;
|
|
|
|
temp.raw = cmd->getParameter2();
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool TmStoreMessage::getAddToSelection(CommandMessage* cmd) {
|
|
|
|
return (bool)cmd->getParameter();
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TmStoreMessage::setReportSelectionDefinitionMessage(
|
|
|
|
CommandMessage* cmd) {
|
|
|
|
cmd->setCommand(REPORT_SELECTION_DEFINITION);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
void TmStoreMessage::setSelectionDefinitionReportMessage(
|
|
|
|
CommandMessage* cmd, store_address_t storeId) {
|
|
|
|
cmd->setCommand(SELECTION_DEFINITION_REPORT);
|
|
|
|
cmd->setParameter2(storeId.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TmStoreMessage::setReportStoreCatalogueMessage(
|
|
|
|
CommandMessage* cmd) {
|
|
|
|
cmd->setCommand(REPORT_STORE_CATALOGUE);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
2018-07-12 16:29:32 +02:00
|
|
|
void TmStoreMessage::setStoreCatalogueReportMessage(CommandMessage* cmd, object_id_t objectId,
|
2016-06-15 23:48:41 +02:00
|
|
|
store_address_t storeId) {
|
|
|
|
cmd->setCommand(STORE_CATALOGUE_REPORT);
|
2018-07-12 16:29:32 +02:00
|
|
|
cmd->setParameter(objectId);
|
|
|
|
cmd->setParameter2(storeId.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
object_id_t TmStoreMessage::getObjectId(CommandMessage* cmd) {
|
|
|
|
return cmd->getParameter();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TmStoreMessage::setDownlinkContentTimeMessage(CommandMessage* cmd,
|
|
|
|
store_address_t storeId) {
|
|
|
|
cmd->setCommand(DOWNLINK_STORE_CONTENT_TIME);
|
|
|
|
cmd->setParameter2(storeId.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t TmStoreMessage::getAddressLow(CommandMessage* cmd){
|
|
|
|
return cmd->getParameter();
|
|
|
|
}
|
|
|
|
uint32_t TmStoreMessage::getAddressHigh(CommandMessage* cmd){
|
|
|
|
return cmd->getParameter2();
|
|
|
|
}
|
|
|
|
|
|
|
|
void TmStoreMessage::setDeleteContentTimeMessage(CommandMessage* cmd,
|
|
|
|
store_address_t storeId) {
|
|
|
|
cmd->setCommand(DELETE_STORE_CONTENT_TIME);
|
|
|
|
cmd->setParameter2(storeId.raw);
|
|
|
|
}
|
|
|
|
|
|
|
|
ReturnValue_t TmStoreMessage::setDeleteBlocksMessage(CommandMessage* cmd, uint32_t addressLow, uint32_t addressHigh){
|
|
|
|
cmd->setCommand(DELETE_STORE_CONTENT_BLOCKS);
|
|
|
|
cmd->setParameter(addressLow);
|
|
|
|
cmd->setParameter2(addressHigh);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
ReturnValue_t TmStoreMessage::setDownlinkBlocksMessage(CommandMessage* cmd, uint32_t addressLow, uint32_t addressHigh){
|
|
|
|
cmd->setCommand(DOWNLINK_STORE_CONTENT_BLOCKS);
|
|
|
|
cmd->setParameter(addressLow);
|
|
|
|
cmd->setParameter2(addressHigh);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
ReturnValue_t TmStoreMessage::setIndexRequestMessage(CommandMessage* cmd){
|
|
|
|
cmd->setCommand(REPORT_INDEX_REQUEST);
|
|
|
|
return HasReturnvaluesIF::RETURN_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void TmStoreMessage::setIndexReportMessage(CommandMessage* cmd, store_address_t storeId){
|
|
|
|
cmd->setCommand(INDEX_REPORT);
|
2016-06-15 23:48:41 +02:00
|
|
|
cmd->setParameter2(storeId.raw);
|
|
|
|
}
|