cancel events
All checks were successful
EIVE/eive-obsw/pipeline/pr-develop This commit looks good

This commit is contained in:
Robin Müller 2023-03-28 15:15:38 +02:00
parent 0adfb0cd3c
commit 33babebb6f
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
7 changed files with 25 additions and 16 deletions

View File

@ -808,14 +808,14 @@ ReturnValue_t ObjectFactory::createCcsdsComponents(CcsdsComponentArgs& args) {
// Core task which handles the HK store and takes care of dumping it as TM using a VC directly // Core task which handles the HK store and takes care of dumping it as TM using a VC directly
new PersistentSingleTmStoreTask(objects::HK_STORE_AND_TM_TASK, args.ipcStore, new PersistentSingleTmStoreTask(objects::HK_STORE_AND_TM_TASK, args.ipcStore,
*args.stores.hkStore, *vc, persTmStore::DUMP_HK_STORE_DONE, *args.stores.hkStore, *vc, persTmStore::DUMP_HK_STORE_DONE,
*SdCardManager::instance()); persTmStore::DUMP_HK_STORE_DONE, *SdCardManager::instance());
vc = new VirtualChannel(objects::PTME_VC3_CFDP_TM, ccsds::VC3, "PTME VC3 CFDP TM", *ptme, vc = new VirtualChannel(objects::PTME_VC3_CFDP_TM, ccsds::VC3, "PTME VC3 CFDP TM", *ptme,
LINK_STATE); LINK_STATE);
// Core task which handles the CFDP store and takes care of dumping it as TM using a VC directly // Core task which handles the CFDP store and takes care of dumping it as TM using a VC directly
new PersistentSingleTmStoreTask(objects::CFDP_STORE_AND_TM_TASK, args.ipcStore, new PersistentSingleTmStoreTask(objects::CFDP_STORE_AND_TM_TASK, args.ipcStore,
*args.stores.cfdpStore, *vc, persTmStore::DUMP_CFDP_STORE_DONE, *args.stores.cfdpStore, *vc, persTmStore::DUMP_CFDP_STORE_DONE,
*SdCardManager::instance()); persTmStore::DUMP_CFDP_CANCELLED, *SdCardManager::instance());
ReturnValue_t result = (*args.ipCoreHandler)->connectModeTreeParent(satsystem::com::SUBSYSTEM); ReturnValue_t result = (*args.ipCoreHandler)->connectModeTreeParent(satsystem::com::SUBSYSTEM);
if (result != returnvalue::OK) { if (result != returnvalue::OK) {

View File

@ -25,8 +25,6 @@ static constexpr Event POSSIBLE_FILE_CORRUPTION = event::makeEvent(SUBSYSTEM_ID,
//! P2: Allowed file size //! P2: Allowed file size
static constexpr Event FILE_TOO_LARGE = event::makeEvent(SUBSYSTEM_ID, 1, severity::LOW); static constexpr Event FILE_TOO_LARGE = event::makeEvent(SUBSYSTEM_ID, 1, severity::LOW);
static constexpr Event BUSY_DUMPING_EVENT = event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO); static constexpr Event BUSY_DUMPING_EVENT = event::makeEvent(SUBSYSTEM_ID, 2, severity::INFO);
//! [EXPORT] : [COMMENT] Dump was cancelled. P1: Object ID of store.
static constexpr Event DUMP_WAS_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 3, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes. //! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_OK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 5, severity::INFO); static constexpr Event DUMP_OK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 5, severity::INFO);
@ -38,6 +36,17 @@ static constexpr Event DUMP_MISC_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 7,
static constexpr Event DUMP_HK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 8, severity::INFO); static constexpr Event DUMP_HK_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 8, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes. //! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_CFDP_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 9, severity::INFO); static constexpr Event DUMP_CFDP_STORE_DONE = event::makeEvent(SUBSYSTEM_ID, 9, severity::INFO);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_OK_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 10, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_NOK_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 11, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_MISC_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 12, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_HK_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 13, severity::LOW);
//! [EXPORT] : [COMMENT] P1: Number of dumped packets. P2: Total dumped bytes.
static constexpr Event DUMP_CFDP_CANCELLED = event::makeEvent(SUBSYSTEM_ID, 14, severity::LOW);
}; // namespace persTmStore }; // namespace persTmStore
#endif /* MISSION_PERSISTENTTMSTOREDEFS_H_ */ #endif /* MISSION_PERSISTENTTMSTOREDEFS_H_ */

View File

@ -8,9 +8,9 @@ PersistentLogTmStoreTask::PersistentLogTmStoreTask(object_id_t objectId, Storage
SdCardMountedIF& sdcMan) SdCardMountedIF& sdcMan)
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan), : TmStoreTaskBase(objectId, ipcStore, channel, sdcMan),
stores(stores), stores(stores),
okStoreContext(persTmStore::DUMP_OK_STORE_DONE), okStoreContext(persTmStore::DUMP_OK_STORE_DONE, persTmStore::DUMP_OK_CANCELLED),
notOkStoreContext(persTmStore::DUMP_NOK_STORE_DONE), notOkStoreContext(persTmStore::DUMP_NOK_STORE_DONE, persTmStore::DUMP_NOK_CANCELLED),
miscStoreContext(persTmStore::DUMP_MISC_STORE_DONE) {} miscStoreContext(persTmStore::DUMP_MISC_STORE_DONE, persTmStore::DUMP_MISC_CANCELLED) {}
ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) { ReturnValue_t PersistentLogTmStoreTask::performOperation(uint8_t opCode) {
bool someonesBusy = false; bool someonesBusy = false;

View File

@ -5,10 +5,10 @@
PersistentSingleTmStoreTask::PersistentSingleTmStoreTask( PersistentSingleTmStoreTask::PersistentSingleTmStoreTask(
object_id_t objectId, StorageManagerIF& ipcStore, PersistentTmStoreWithTmQueue& tmStore, object_id_t objectId, StorageManagerIF& ipcStore, PersistentTmStoreWithTmQueue& tmStore,
VirtualChannel& channel, Event eventIfDumpDone, SdCardMountedIF& sdcMan) VirtualChannel& channel, Event eventIfDumpDone, Event eventIfCancelled, SdCardMountedIF& sdcMan)
: TmStoreTaskBase(objectId, ipcStore, channel, sdcMan), : TmStoreTaskBase(objectId, ipcStore, channel, sdcMan),
storeWithQueue(tmStore), storeWithQueue(tmStore),
dumpContext(eventIfDumpDone) {} dumpContext(eventIfDumpDone, eventIfCancelled) {}
ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) { ReturnValue_t PersistentSingleTmStoreTask::performOperation(uint8_t opCode) {
ReturnValue_t result = returnvalue::OK; ReturnValue_t result = returnvalue::OK;

View File

@ -11,7 +11,8 @@ class PersistentSingleTmStoreTask : public TmStoreTaskBase, public ExecutableObj
public: public:
PersistentSingleTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore, PersistentSingleTmStoreTask(object_id_t objectId, StorageManagerIF& ipcStore,
PersistentTmStoreWithTmQueue& storeWithQueue, VirtualChannel& channel, PersistentTmStoreWithTmQueue& storeWithQueue, VirtualChannel& channel,
Event eventIfDumpDone, SdCardMountedIF& sdcMan); Event eventIfDumpDone, Event eventIfCancelled,
SdCardMountedIF& sdcMan);
ReturnValue_t performOperation(uint8_t opCode) override; ReturnValue_t performOperation(uint8_t opCode) override;

View File

@ -70,6 +70,7 @@ bool TmStoreTaskBase::cyclicStoreCheck() {
} }
void TmStoreTaskBase::cancelDump(DumpContext& ctx, PersistentTmStore& store, bool isTxOn) { void TmStoreTaskBase::cancelDump(DumpContext& ctx, PersistentTmStore& store, bool isTxOn) {
triggerEvent(ctx.eventIfCancelled, ctx.numberOfDumpedPackets, ctx.dumpedBytes);
ctx.reset(); ctx.reset();
store.cancelDump(); store.cancelDump();
if (isTxOn) { if (isTxOn) {
@ -119,14 +120,11 @@ ReturnValue_t TmStoreTaskBase::handleOneDump(PersistentTmStoreWithTmQueue& store
dumpContext.ptmeBusyCounter++; dumpContext.ptmeBusyCounter++;
if (dumpContext.ptmeBusyCounter == 100) { if (dumpContext.ptmeBusyCounter == 100) {
// If this happens, something is probably wrong. // If this happens, something is probably wrong.
sif::warning << "PTME busy for longer period. Dumped length so far: " sif::warning << "PTME busy for longer period. Cancelling dump" << std::endl;
<< dumpContext.dumpedBytes << std::endl;
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
cancelDump(dumpContext, store, channel.isTxOn()); cancelDump(dumpContext, store, channel.isTxOn());
} }
} }
if (cancelDumpCd.hasTimedOut() or tmSinkBusyCd.hasTimedOut()) { if (cancelDumpCd.hasTimedOut() or tmSinkBusyCd.hasTimedOut()) {
triggerEvent(persTmStore::DUMP_WAS_CANCELLED, store.getObjectId());
cancelDump(dumpContext, store, channel.isTxOn()); cancelDump(dumpContext, store, channel.isTxOn());
} }
return result; return result;

View File

@ -12,7 +12,8 @@
class TmStoreTaskBase : public SystemObject { class TmStoreTaskBase : public SystemObject {
public: public:
struct DumpContext { struct DumpContext {
DumpContext(Event eventIfDone) : eventIfDone(eventIfDone) {} DumpContext(Event eventIfDone, Event eventIfCancelled)
: eventIfDone(eventIfDone), eventIfCancelled(eventIfCancelled) {}
void reset() { void reset() {
numberOfDumpedPackets = 0; numberOfDumpedPackets = 0;
dumpedBytes = 0; dumpedBytes = 0;
@ -22,6 +23,7 @@ class TmStoreTaskBase : public SystemObject {
ptmeBusyCounter = 0; ptmeBusyCounter = 0;
} }
const Event eventIfDone; const Event eventIfDone;
const Event eventIfCancelled;
size_t numberOfDumpedPackets = 0; size_t numberOfDumpedPackets = 0;
size_t bytesDumpedAtLastDelay = 0; size_t bytesDumpedAtLastDelay = 0;
size_t dumpedBytes = 0; size_t dumpedBytes = 0;
@ -65,7 +67,6 @@ class TmStoreTaskBase : public SystemObject {
bool cyclicStoreCheck(); bool cyclicStoreCheck();
virtual bool initStoresIfPossible() = 0; virtual bool initStoresIfPossible() = 0;
}; };
#endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */ #endif /* MISSION_TMTC_TMSTORETASKBASE_H_ */