|
LRAUV
revA
|
MissionManager is the computation cycle component that contains the main mission stack and manages its execution. More...
#include <MissionManager.h>


Public Member Functions | |
| MissionManager () | |
| Private constructor for use only by Aggregate. More... | |
| virtual | ~MissionManager () |
| Destructor. More... | |
| MissionItem * | loadFromFile (const char *filename) |
| Loads a mission from a file. More... | |
| bool | runLoadedMission (bool quitAtEnd=false) |
| Loads a mission from a file. More... | |
| bool | resumeLoadedMission () |
| Resumes the contained mission stack. More... | |
| void | run () |
| Runs the contained mission stack. More... | |
| void | initialize () |
| Reads the configuration settings. More... | |
| void | uninitialize () |
| Uninitialize the mission stacks. More... | |
| void | logStack () |
| Display the currently running stack to Syslog. More... | |
| bool | isMissionRunning () |
| Returns true if a mission is running. More... | |
| MissionItem * | getRunningMission () |
| Returns the currently running mission, or NULL if none (or in startup) More... | |
| const Str & | getLoadedMissionFilename () |
| Returns the filename name of the most recent loaded mission. More... | |
Public Member Functions inherited from SyncComponent | |
| CycleOrder | getCycleOrder (void) |
| Getter function for controlThreadOrderPreference. More... | |
| void | setRepeating (bool repeating) |
| int | getDivisor () const |
| int | getModulo () const |
| bool | isRepeater () |
| bool | isRepeating () |
Public Member Functions inherited from Component | |
| virtual | ~Component () |
| Destructor cleans up readers_ and writers_. More... | |
| void | registerReader (DataReader *reader) |
| void | unregisterReader (DataReader *reader) |
| void | registerWriter (DataWriter *writer) |
| void | unregisterWriter (DataWriter *writer) |
| void | disableMetering (void) |
| FlexArray< DataReader * > & | getReaderList (void) |
| FlexArray< DataWriter * > & | getWriterList (void) |
| const Module * | getModule () |
| virtual void | configure () |
| Read (or re-read!) configuration settings. More... | |
| virtual void | execute (void) |
| bool | isActive () const |
| Indicates if the component is active. More... | |
| const CodedStr & | getName (void) const |
| Returns the name. More... | |
| const Timestamp & | getTimeOfLastRun (void) const |
| ComponentState | getState (void) |
| Return the component's current state. More... | |
| void | setState (ComponentState state) |
| RunState | getRunState (void) |
| Return the component's run state. More... | |
| bool | isUsingRunState () |
| Return true if using runState. More... | |
| void | requestData (bool requestingData) |
| Tell the component to start (or stop) sending data. More... | |
| void | requestStart () |
| Tell the component to start runnning. More... | |
| void | requestPause (const Timespan expectedPauseTime) |
| Tell the component to pause runnning. More... | |
| void | requestResume () |
| Tell the component resume from pause. More... | |
| void | requestStop () |
| Tell the component to stop runnning. More... | |
| virtual RunState | start () |
| Do what needs to be done to run Similar to initialize, in old init/run/uninit sequence. More... | |
| virtual RunState | starting () |
| Might follow a STOP...START sequence Subseqent. More... | |
| virtual RunState | runnable () |
| Should eventually follow a START request or RESETTING. More... | |
| virtual RunState | satisfied () |
| Possible return value of a Behavior. More... | |
| virtual RunState | pause () |
| Pause for a short period (indicated by pauseTime) More... | |
| virtual RunState | pausing () |
| Might follow a PAUSE request. More... | |
| virtual RunState | paused () |
| Should eventually follow a PAUSE request: should set continueTime. More... | |
| virtual RunState | resume () |
| Resume from PAUSE. More... | |
| virtual RunState | resuming () |
| Might follow a PAUSE...RESUME sequence. More... | |
| virtual RunState | resetting () |
| Might occur in case of Error. More... | |
| virtual RunState | stop () |
| Initial state – can be later followed by START. More... | |
| virtual RunState | stopping () |
| Might follow a STOP request. More... | |
| virtual RunState | stopped () |
| Should eventually follow a STOP request. More... | |
| void | setCriticalFailureReported (bool boolVal) |
| void | setRecoveringFromCritical (bool boolVal) |
| void | setFailureReported (bool boolVal) |
| bool | isFailureUninitialized () |
| void | setFailureUninitialized (bool boolVal) |
| void | setRetryTimeout (const Timespan &timeout) |
| virtual bool | isCompleted (void) |
| Query if this component is completed. More... | |
| void | setPeriod (const Timespan &period) |
| Set the period of this component... used if it is periodic. More... | |
| const Timespan & | getPeriod (void) |
| Returns the component's period (regardless of whether it is periodic) More... | |
| ComponentType | getComponentType () |
| Getter function for ComponentType. More... | |
| virtual bool | isFailed (void) const |
| virtual FailureMode::FailType | getFailureType (void) const |
| virtual bool | getCriticalFailureReported (void) const |
| virtual bool | getFailureReported (void) const |
| virtual Timespan | getRetryTimeout (void) const |
| virtual FailureMode::FailType | setFailure (FailureMode::FailType failureType) |
| virtual int | getFailCount (void) const |
| virtual bool | isFailureMissionCritical () |
| virtual int | getAllowableFailures (void) const |
| virtual void | setAllowableFailures (int fails) |
| Logger & | getLogger (void) |
| virtual int | incrementFailCount (void) |
| virtual void | resetFailCount (void) |
| virtual int | getSkippedRunsSinceFail (void) const |
| virtual int | incrementSkippedRunsSinceFail (void) |
| virtual void | logVoltage (float voltage, float averageVoltage) |
| virtual void | logCurrent (float current, float averageCurrent) |
| const Timestamp & | getWriteTimestamp (void) |
| void | setWriteTimestamp (const Timestamp &writeTimestamp) |
| BlobReader * | newBlobReader (const BlobURI &blobURI) |
| BlobReader * | newBlobReaderFromUniversal (const Str &componentName, const UniversalBlobURI &blobURI) |
| BlobWriter * | newBlobWriter (const BlobURI &blobURI, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| ConfigReader * | newConfigReader (const ConfigURI &configURI) |
| DataReader * | newDataReader (const DataURI &dataURI) |
| DataReader * | newDataReaderFromUniversal (const Str &componentName, const UniversalURI &universalURI) |
| DataWriter * | newDataWriter (const DataURI &dataURI, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| UniversalBlobReader * | newUniversalBlobReader (const UniversalBlobURI &universalURI) |
| UniversalBlobWriter * | newUniversalBlobWriter (const UniversalBlobURI &universalURI, const Unit &accuracyUnit=Units::NONE, const float accuracy=DataElement::NO_ACCURACY, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
| UniversalDataReader * | newUniversalReader (const UniversalURI &universalURI) |
| UniversalDataWriter * | newUniversalWriter (const UniversalURI &universalURI, const Unit &accuracyUnit=Units::NONE, const float accuracy=DataElement::NO_ACCURACY, Logger::TimePrecisionType timePrecision=Logger::TIME_PRECISION_MILLIS) |
Static Public Member Functions | |
| static MissionNode * | LoadRootNode (const char *filename, bool insert, Logger &logger) |
| Load a mission node from a file. More... | |
| static MissionNode * | FindTopNode (MissionNode *rootNode, Logger &logger) |
| Finds a mission node within a root node. More... | |
| static void | LogMission (const char *filename, Logger &logger) |
| Logs the mission to the syslog. More... | |
| static MissionManager * | GetInstance () |
Protected Member Functions | |
| MissionItem * | missionFromFile (const char *filename) |
| Loads a mission from a file. More... | |
Protected Member Functions inherited from SyncMissionComponent | |
| SyncMissionComponent (const Str &name, const Module *module) | |
Protected Member Functions inherited from SyncComponent | |
| void | setRepeater (bool repeater) |
Protected Member Functions inherited from Component | |
| virtual ConfigURI | getConfigURI (ConfigOption configOption) const |
| Should return [myNamespace]::SIMULATE_HARDWARE, or [myNamespace]::POWER, etc. More... | |
| virtual ConfigURI | getConfigURI (ConfigOption configOption, ElementURI forElement) const |
| Should return [myNamespace]::POWER_[forElement], [myNamespace]::LATENCY_[forElement], etc. More... | |
| virtual void | setDurationOfLastRun (const Timespan &span) |
| virtual void | setTimeOfRun (const Timestamp &time) |
| virtual void | setTimeOfLastRun (const Timestamp &time) |
| virtual void | setDt (const Timespan &dt) |
| virtual bool | setEnabled (bool enabled=true) |
| void | setRunState (const RunState runState) |
| const Timespan | getPauseTime () const |
| virtual void | setFailureMissionCritical (bool failureMissionCritical) |
| bool | simulateHardware () |
Protected Attributes | |
| MissionItem * | loadedMissionItem_ |
| Str | loadedMissionFilename_ |
| bool | okToRun_ |
| bool | quitAtEnd_ |
| MissionItem * | startupMissionItem_ |
| MissionItem * | defaultMissionItem_ |
| Mutex | stackModMutex_ |
Protected Attributes inherited from Component | |
| Logger | logger_ |
| Syslog::Severity | debugLevel_ |
| ComponentState | state_ |
| Keep track of whether the component has "completed" or should be run again. More... | |
| Timespan | desiredPeriod_ |
| CodedStr & | name_ |
| Store the component's name (used for logging purposes) More... | |
| Timestamp | timeOfRun_ |
| Timestamp | timeOfLastRun_ |
| Timespan | durationOfLastRun_ |
| Timespan | dt_ |
| Timespan | retryTimeout_ |
| bool | enabled_ |
| bool | failureReported_ |
| Indicates if the failure has been reported – cuts down on syslog. More... | |
| bool | criticalFailureReported_ |
| Indicates if a "Critical" failure has been reported – cuts down on syslog. More... | |
| bool | recoveringFromCritical_ |
| Indicates that a component had a previous critical failure that has been cleared temporarily awaiting final word from the component itself. More... | |
| bool | failureUninitialized_ |
| Indicates if the failure has resulted in an uninitialize call. More... | |
| int | failCount_ |
| Number of failures logged by PCaller. More... | |
| bool | failureMissionCritical_ |
| If true (default), complete failure ends mission. More... | |
| int | allowableFailures_ |
| Number of failures allowed to occur. More... | |
| int | skippedRunsSinceFail_ |
| Number of skipped runs since failureMode_ set by failCount_. More... | |
| FailureMode::FailType | failureType_ |
| Failed status. If failCount_ > 0, then this may be reset. More... | |
| Timestamp | timeOfFailure_ |
| Time of last failure. Relevant only if failed=true. More... | |
| Timestamp | writeTimestamp_ |
| Time of last write. More... | |
| FlexArray< DataReader * > | readers_ |
| FlexArray< DataWriter * > | writers_ |
| const Module * | module_ |
| Timespan | pauseTime_ |
| bool | meteringEnabled_ |
| If true, metering is enabled. More... | |
| DataWriter * | durationOfLastRunWriter_ |
| Writer for durationOfLastRun. More... | |
| DataWriter * | voltageWriter_ |
| DataWriter * | avgVoltageWriter_ |
| DataWriter * | currentWriter_ |
| DataWriter * | avgCurrentWriter_ |
| bool | persistentPause_ |
| True if data is persistent while component is paused. More... | |
Private Member Functions | |
| MissionManager (const MissionManager &old) | |
| void | uninitializeMission (MissionItem *missionItem) |
| Uninitialize a mission stack. More... | |
Private Attributes | |
| DataReader * | sBITRunningReader_ |
| DataReader * | iBITRunningReader_ |
| UniversalDataWriter * | missionStartedWriter_ |
Static Private Attributes | |
| static MissionManager * | Instance_ |
MissionManager is the computation cycle component that contains the main mission stack and manages its execution.
| MissionManager::MissionManager | ( | ) |
Private constructor for use only by Aggregate.
Constructor.
References Units::COUNT, iBITRunningReader_, Instance_, UniversalURI::MISSION_STARTED, missionStartedWriter_, Component::newDataReader(), Component::newUniversalWriter(), sBITRunningReader_, Component::setAllowableFailures(), and Component::setRetryTimeout().
|
virtual |
Destructor.
References Instance_.
|
private |
|
static |
Finds a mission node within a root node.
References Syslog::ERROR, MissionNode::getChild(), MissionNode::getName(), MissionNode::hasChildNodes(), and Logger::syslog().
Referenced by MissionItem::initializeFromScript(), and missionFromFile().
|
static |
References Instance_.
|
inline |
Returns the filename name of the most recent loaded mission.
References loadedMissionFilename_.
|
inline |
Returns the currently running mission, or NULL if none (or in startup)
References isMissionRunning(), and loadedMissionItem_.
|
virtual |
Reads the configuration settings.
Initialize the mission manager.
Reimplemented from Component.
References StrValue::asString(), Str::cStr(), defaultMissionItem_, Syslog::ERROR, Component::logger_, missionFromFile(), Slate::ReadOnce(), startupMissionItem_, and Logger::syslog().
|
inline |
Returns true if a mission is running.
References loadedMissionItem_, okToRun_, and startupMissionItem_.
Referenced by getRunningMission(), and Supervisor::IsMissionRunning().
| MissionItem * MissionManager::loadFromFile | ( | const char * | filename | ) |
Loads a mission from a file.
References MissionStateLogger::ClearStates(), loadedMissionFilename_, loadedMissionItem_, missionFromFile(), okToRun_, and uninitializeMission().
Referenced by Supervisor::loadMission(), resumeLoadedMission(), Supervisor::resumeMission(), and Supervisor::runMission().
|
static |
Load a mission node from a file.
Loads a mission from a file.
References Syslog::CRITICAL, Str::cStr(), Syslog::ERROR, MissionAPIRegistry::FindByExtension(), Syslog::INFO, MissionAPI::loadMissionFile(), Str::startsWith(), and Logger::syslog().
Referenced by MissionItem::initializeFromScript(), and missionFromFile().
|
static |
Logs the mission to the syslog.
References InStream::bytesRead(), Syslog::DEBUG, FileInStream::eof(), Str::length(), FileInStream::read(), FileInStream::seek(), and Logger::syslog().
Referenced by MissionItem::initializeFromScript(), and missionFromFile().
| void MissionManager::logStack | ( | ) |
Display the currently running stack to Syslog.
References defaultMissionItem_, MissionItem::getAggregate(), Syslog::IMPORTANT, loadedMissionItem_, Component::logger_, Aggregate::logStack(), okToRun_, stackModMutex_, startupMissionItem_, and Logger::syslog().
Referenced by Supervisor::showStack().
|
protected |
Loads a mission from a file.
References Component::BLOCK_NORMAL, FindTopNode(), MissionItem::Instance(), LoadRootNode(), Component::logger_, LogMission(), Component::setState(), and stackModMutex_.
Referenced by initialize(), and loadFromFile().
| bool MissionManager::resumeLoadedMission | ( | ) |
Resumes the contained mission stack.
Calls initialize on the mission stack if needed.
References Str::cStr(), Str::EMPTY_STR, Syslog::ERROR, MissionStateLogger::GetActive(), Aggregate::getChild(), MissionItem::getComponent(), Component::getName(), MissionItem::isAggregate(), loadedMissionFilename_, loadedMissionItem_, loadFromFile(), Component::logger_, MissionStateLogger::NewResume(), okToRun_, MissionItem::setRepeatIndex(), Aggregate::setResumeItem(), MissionStateLogger::ShowMissionState(), and Logger::syslog().
Referenced by Supervisor::resumeMission().
|
virtual |
Runs the contained mission stack.
Calls initialize on the mission stack if needed.
Reimplemented from Component.
References Units::COUNT, defaultMissionItem_, Syslog::ERROR, MissionItem::getAggregate(), MissionItem::getComponent(), Component::getName(), iBITRunningReader_, Syslog::IMPORTANT, MissionItem::initialize(), Behavior::isCompleted(), Component::isCompleted(), MissionItem::isInitialized(), loadedMissionItem_, Component::logger_, missionStartedWriter_, okToRun_, DataReader::read(), MissionItem::runIfUnsatisfied(), Component::satisfied(), sBITRunningReader_, stackModMutex_, startupMissionItem_, Logger::syslog(), Mutex::tryLock(), MissionItem::uninitialize(), uninitializeMission(), Mutex::unlock(), and DataWriter::write().
| bool MissionManager::runLoadedMission | ( | bool | quitAtEnd = false | ) |
Loads a mission from a file.
References loadedMissionFilename_, loadedMissionItem_, MissionStateLogger::NewRun(), okToRun_, and quitAtEnd_.
Referenced by Supervisor::runMission().
|
virtual |
Uninitialize the mission stacks.
Uninitialize all mission stacks.
Reimplemented from Component.
References defaultMissionItem_, loadedMissionItem_, startupMissionItem_, and uninitializeMission().
|
private |
Uninitialize a mission stack.
Uninitialize a running mission stack.
References Behavior::BEHAVIOR_INACTIVE, CommandLine::DoCommand(), MissionItem::getAggregate(), Behavior::getBehaviorState(), loadedMissionItem_, quitAtEnd_, stackModMutex_, startupMissionItem_, and MissionItem::uninitialize().
Referenced by loadFromFile(), run(), and uninitialize().
|
protected |
Referenced by initialize(), logStack(), run(), and uninitialize().
|
private |
Referenced by MissionManager(), and run().
|
staticprivate |
Referenced by GetInstance(), MissionManager(), and ~MissionManager().
|
protected |
Referenced by getLoadedMissionFilename(), loadFromFile(), resumeLoadedMission(), and runLoadedMission().
|
protected |
Referenced by getRunningMission(), isMissionRunning(), loadFromFile(), logStack(), resumeLoadedMission(), run(), runLoadedMission(), uninitialize(), and uninitializeMission().
|
private |
Referenced by MissionManager(), and run().
|
protected |
Referenced by isMissionRunning(), loadFromFile(), logStack(), resumeLoadedMission(), run(), and runLoadedMission().
|
protected |
Referenced by runLoadedMission(), and uninitializeMission().
|
private |
Referenced by MissionManager(), and run().
|
protected |
Referenced by logStack(), missionFromFile(), run(), and uninitializeMission().
|
protected |
Referenced by initialize(), isMissionRunning(), logStack(), run(), uninitialize(), and uninitializeMission().