#include <CriticalTelecommand.h>
Inheritance diagram for CriticalTelecommand:
This is an abstract class. Concrete telecommands are obtained by deriving this class.
This class adds to the basic functionalities defined by its base class the possibility of marking a telecommand as critical. Telecommands that are marked critical are executed according to an "arm-fire" protocol. The basic idea is that the first time the telecommand receives an execute request, it does not take any action but it sets an internal status to "armed". The actual execution of the telecommand only occurs when the second execute request is received. The two execution requests must not occur too far from each other in time and they must be made with exactly the same set of parameters. The precise implementation of the "arm-fire" mechanism is described below.
The telecommand can be in one of two states:
canExecute
). The telecommand maintains a maximum armed duration. Its value represents the maximum time that can elapse between the time when the "arm" command was received and the time when the "fire" command is received. If the "fire" command is received after this interval as elapsed, then an event report is created to record the fact.
The telecommand defines an image store service and an image validity check. Their purpose is to allow to verify that telecommand parameters at the time the "arm" command is received are the same as when the "fire" command is received. The image store service allows the current values of the telecommand parameters to be stored in some internal data structure. The image validity check allows the current values of the telecomand parameters to be compared with the values that were stored in the last call to the image store service.
The criticality level of the telecommand can be set by the user. The criticality level can have two values: not critical and critical. If the telecommand is marked not critical, then it behaves exactly as an instance of its super class.
This implementation of the "arm-fire" mechanism stores the information about the arm status and about the telecommand parameters into the telecommand component itself. Note in particular that the standard telecommand manager provided by the OBS Framework (CC_TelecommandManager
), is not aware of whether a given telecommand is critical or not. It is therefore the responsibility of the user to ensure that the same component is loaded into the telecommand manager when the telecommand is received the first time ("arm command") and when it is received the second time ("fire command").
Roberto Totaro
Definition at line 80 of file CriticalTelecommand.h.
Public Member Functions | |
CriticalTelecommand (void) | |
Instantiate a critical telecommand. | |
void | reset (void) |
Reverts the telecommand to its original state (i.e. | |
bool | isCritical (void) |
Return the criticality level of the telecommand. | |
void | setCriticalityLevel (bool isCritical) |
Set the criticality level. | |
bool | isArmed (void) |
Return the arm status of the telecommand. | |
virtual bool | isImageValid (void) |
Execute the image validity check. | |
virtual void | storeImage (void) |
Implement the image store service. | |
void | setMaxArmedDuration (TD_ObsTime t) |
Set the maximum armed duration. | |
TD_ObsTime | getMaxArmedDuration (void) |
Get the maximum armed duration. | |
TD_ObsTime | getTimeWhenArmed (void) |
Get the value of the on-board time when the telecommand was last armed. | |
void | setObsClock (ObsClock *pObsClock) |
Load the OBS Clock component. | |
ObsClock * | getObsClock (void) const |
Return the OBS Clock component. | |
virtual bool | canExecute (void) |
Perform the execution check on the telecommand. | |
virtual bool | isObjectConfigured (void) |
Perform a class-specific configuration check on the telecommand: verify that the maximum armed duration has a legal value and that the on-board clock component has been loaded. | |
Protected Member Functions | |
virtual TD_ActionOutcome | doAction (void) |
Encapsulate the implementation of the action associated with this critical telecommand. | |
virtual TD_ActionOutcome | doCriticalAction (void)=0 |
A derived class shall provide a concrete implementation of this method, which performs the actual critical telecommand action. |
|
Instantiate a critical telecommand. The arm status is set to "not armed". The maximum armed duration is set to an illegal value to signify that the component is not yet configured. The criticality level is set to "not critical". Definition at line 17 of file CriticalTelecommand.cpp. |
|
Perform the execution check on the telecommand. A pseudo-code implementation of this method is as follows: if (TC is critical and armed) { if (TC has timed-out) { Add an EVT_CRIT_TC_TIMEOUT event to the log return false; }
if (TC image is not valid) { Add an EVT_CRIT_TC_IMG_INV event to the log return false; } }
return true;
Reimplemented from Telecommand. Definition at line 72 of file CriticalTelecommand.cpp. |
|
Encapsulate the implementation of the action associated with this critical telecommand.
This method verifies if the telecommand is armed and, if so, calls if (TC is armed or it is not critical) { Disarm the TC Set the "time when armed" to an invalid value return doCriticalAction(); } else { Arm the TC Save the current OBS time as "time when armed" Add an EVT_CRIT_TC_ARMED event to the log return ACTION_SUCCESS; }
This method is called by
Implements PunctualAction. Definition at line 90 of file CriticalTelecommand.cpp. |
|
A derived class shall provide a concrete implementation of this method, which performs the actual critical telecommand action.
This method is called by
Implemented in DC_DummyCriticalTelecommand. |
|
Get the maximum armed duration.
Definition at line 54 of file CriticalTelecommand.cpp. |
|
Return the OBS Clock component.
Definition at line 62 of file CriticalTelecommand.cpp. |
|
Get the value of the on-board time when the telecommand was last armed. If the telecommand was never armed, a value of zero is returned.
Definition at line 58 of file CriticalTelecommand.cpp. |
|
Return the arm status of the telecommand. If the criticality level of the telecommand is "not critical", this method always returns "not armed".
Definition at line 37 of file CriticalTelecommand.cpp. |
|
Return the criticality level of the telecommand.
Definition at line 29 of file CriticalTelecommand.cpp. |
|
Execute the image validity check. This class provides a default implementation that returns "image is valid".
Reimplemented in DC_DummyCriticalTelecommand. Definition at line 41 of file CriticalTelecommand.cpp. |
|
Perform a class-specific configuration check on the telecommand: verify that the maximum armed duration has a legal value and that the on-board clock component has been loaded.
Reimplemented from Telecommand. Definition at line 109 of file CriticalTelecommand.cpp. |
|
Reverts the telecommand to its original state (i.e. isTcCritical=CRITICAL, isTcArmed=NOT_ARMED, timeWhenArmed=-1, maxArmedDuration=-1, pObsClock=pNULL). Definition at line 21 of file CriticalTelecommand.cpp. |
|
Set the criticality level. This method would normally be called during the component initialization phase (probably by the constructor of the concrete telecommand class).
Definition at line 33 of file CriticalTelecommand.cpp. |
|
Set the maximum armed duration.
Definition at line 49 of file CriticalTelecommand.cpp. |
|
Load the OBS Clock component. Critical telecommands need access to the on-board clock to time-stamp the reception of an "arm" command.
Definition at line 67 of file CriticalTelecommand.cpp. |
|
Implement the image store service. This class provides a default implementation that returns without doing anything.
Definition at line 45 of file CriticalTelecommand.cpp. |