#include <CC_TelecommandManager.h>
Inheritance diagram for CC_TelecommandManager:
The telecommand manager is the component that is responsible for controlling execution of telecommands. Telecommands are loaded into the telecommand manager (normally by the telecommand loader) and from that moment onward their execution remains under the control of the telecommand manager. The telecomand manager sees telecommands as objects of type Telecommand
.
The telecommand manager maintains a list of pending telecommand objects. This is called the pending telecommand list. The pending telecommands are the telecommand objects that are currently loaded into the telecommand manager and that are due for execution. Execution can be immediate or it can be deferred to a certain time (time-tagged telecommands). Before a telecommand is executed, the execution check is performed upon it. In this way, the telecommand has a way of checking whether the conditions for its execution are fulfilled. If the execution check fails, the telecommand is aborted.
When a telecommand is loaded into the telecommand manager, the telecommand manager performs a validity check upon it. If the validity check fails, the telecommand is immediately aborted.
After being executed, or after being aborted, a telecommand is unloaded. This means that the telecommand is removed from the list of pending telecommands and that the telecommand loader is notified that the telecommand is no longer in use. This allows the telecommand loader to release any resources that it had allocated to the telecommand and to perform any other clean-up actions.
Telecommands can be aborted. An abort operation consists in the unloading of a telecommand that has not yet been executed.
The telecommand manager creates event reports to record the following occurrences: a telecommand has been loaded; a telecommand has been unloaded; a telecommand has been aborted; a telecommand could not be loaded because it failed its validity check; a telecommand could not be loaded because the list of telecommands was full; a telecommand could not be executed because its execution check failed. Note that execution of the telecommand is not recorded because telecommands are punctual actions and therefore their execution is automatically recorded as an event by the services provided by the PunctualAction
class.
The configuration procedure for a newly instantiated telecommand manager is as follows:
setObsClock
. setTelecommandLoader
. setPendingTelecommandListSize
).
The telecommand manager is intended to be used "as is" and without changes. However, the load
, abort
and activate
methods are marked virtual to allow users to customize their logic.
the name of method setPendingTelecommandListSize is not consistent with the name of the equivalent method in class ManoeuvreManager (which is simply called setPendingListSize. The two names should perhaps be harmonized.
Definition at line 100 of file CC_TelecommandManager.h.
Public Member Functions | |
CC_TelecommandManager (void) | |
Instantiate a telecommand manager. | |
void | reset (void) |
Abort all pending telecommands. | |
void | setPendingTelecommandListSize (unsigned int listSize) |
Set the size of the pending telecommand list representing the maximum number of pending telecommands that can be managed by the telecommand manager. | |
unsigned int | getPendingTelecommandListSize (void) |
Get the size of the pending telecommand list. | |
unsigned int | getPendingTelecommands (void) |
Get the number of currently pending telecommands. | |
Telecommand * | getPendingTelecommand (unsigned int i) |
Get the i-th pending telecommand (only provided for testing purposes). | |
virtual void | load (Telecommand *pTelecommand) |
Load a telecommand. | |
virtual void | abort (Telecommand *pTelecommand) |
Abort a telecommand. | |
void | abort (TD_TelecommandId telecommandId) |
Abort a telecommand. | |
void | setTelecommandLoader (TelecommandLoader *pTcLoader) |
Load the telecommand loader as a plug-in component. | |
TelecommandLoader * | getTelecommandLoader (void) |
Getter method for the telecommand loader plug-in component. | |
void | setObsClock (ObsClock *pObsClock) |
Load the OBS clock as a plug-in component. | |
ObsClock * | getObsClock (void) |
Getter method for the OBS clock plug-in component. | |
virtual void | activate (void) |
Go through the list of pending telecommands and execute those that are due for execution. | |
virtual bool | isObjectConfigured (void) |
Perform a class-specific configuration check on the telecommand manager: verify that the pending telecommand list size has been set, that the OBS clock has been loaded, and that the telecommand loader has been loaded. |
|
Instantiate a telecommand manager. The size of the pending telecommand list is initialized to an illegal value to signify that the telecommand manager is not yet configured. The class identifier is set. Definition at line 21 of file CC_TelecommandManager.cpp. |
|
Abort a telecommand. This method has the same semantics as the abort method that takes a telecommand pointer as argument but it designates the telecommand to be aborted by its identifier rather than through a pointer to the object that encapsulates it. See the documentation of that method for more information. However, note that in this case, if a telecommand with a given id appears more than once in the pending telecommand list (e.g. with two different time tags), then all its instances will be aborted.
Definition at line 117 of file CC_TelecommandManager.cpp. |
|
Abort a telecommand. The telecomand is unloaded without being executed. The telecommand loader is notified that the telecommand has been unloaded. If the argument telecommand is not currently loaded, no action is taken. An event report is created whenever a telecommand is aborted. A pseudo-code implementation for this method is as follows: for (all telecommands tc in pending telecommand list) if (tc eq pTelecommand) { . . . // delete tc from list of pending TC pTcLoader->release(tc); createEventReport(EVT_TC_ABORTED); } return;The telecommand that is being aborted is passed as the event originator to the event reporting method.
Definition at line 103 of file CC_TelecommandManager.cpp. |
|
Go through the list of pending telecommands and execute those that are due for execution. This method would typically be called by an external scheduler. A pseudo-code implementation for this method is as follows: for (all telecommands tc in the list of pending telecommands) if ( ( tc->getTimeTag() le currentTime ) OR ( tc->getTimeTag() eq 0 ) ) { if ( tc->canExecute() ) { tcOutcome = tc->execute(); if (tcOutcome!=ACTION_SUCCESS) createEventReport(EVT_TC_EXEC_FAIL); else createEventReport(EVT_TC_EXEC_SUCC); } else createEventReport(EVT_TC_EXEC_CHECK_FAIL);
tcLoader->release(tc); . . . // delete tc from list of pending telecommands }The telecommand that is being processed is passed as the event originator to the event reporting method. Definition at line 154 of file CC_TelecommandManager.cpp. |
|
Getter method for the OBS clock plug-in component.
Definition at line 148 of file CC_TelecommandManager.cpp. |
|
Get the i-th pending telecommand (only provided for testing purposes). This method returns the i-th entry in the list of pending telecommands. The index i should be in the range [0,N-1] where N is the size of the telecommand lending list. A null pointer is returned if no telecommand is currently loaded at the i-th position of the list. This method is only intended to be used for testing purposes. It should not be used during normal operation.
Definition at line 96 of file CC_TelecommandManager.cpp. |
|
Get the size of the pending telecommand list.
Definition at line 54 of file CC_TelecommandManager.cpp. |
|
Get the number of currently pending telecommands.
Definition at line 90 of file CC_TelecommandManager.cpp. |
|
Getter method for the telecommand loader plug-in component.
Definition at line 136 of file CC_TelecommandManager.cpp. |
|
Perform a class-specific configuration check on the telecommand manager: verify that the pending telecommand list size has been set, that the OBS clock has been loaded, and that the telecommand loader has been loaded.
Reimplemented from CC_RootObject. Definition at line 176 of file CC_TelecommandManager.cpp. |
|
Load a telecommand. When a telecommand is loaded, it is inserted in the list of pending telecommands and will then be considered for execution. Immediately after being loaded, a validity check is performed on the telecommand. If the validity check fails, an event is created to record the fact and the telecommand is aborted. The telecommand remains loaded until it has terminated execution or is aborted. The telecommand manager creates an event whenever a new telecommand is loaded. If the list of pending telecommands is already full, an event report is created to record the attempted telecommand load and the telecommand is aborted. A pseudo-code implementation for this method is as follows: if (telecommand is not valid) { createEventReport(EVT_TC_NOT_VALID); pTcLoader->release(telecommand); // notify telecommand loader return; } if (list of pending telecommand is full) { createEventReport(EVT_TC_LIST_FULL); pTcLoader->release(telecommand); // notify telecommand loader return; } createEventReport(EVT_TC_LOADED); . . . // insert telecommand in list of pending telecommands return;The telecommand that is being loaded is passed as the event originator to the event reporting method.
Definition at line 60 of file CC_TelecommandManager.cpp. |
|
Abort all pending telecommands. A reset bring the telecommand manager to the state where it was immediately after having being configured. Definition at line 29 of file CC_TelecommandManager.cpp. |
|
Load the OBS clock as a plug-in component. The telecommand manager needs access to the on-board time because it needs to check the telecommand time tag with the current time.
Definition at line 142 of file CC_TelecommandManager.cpp. |
|
Set the size of the pending telecommand list representing the maximum number of pending telecommands that can be managed by the telecommand manager. This method causes memory for the pending telecommand list data structure to be allocated and the data structure to be initialized. Only positive telecommand list sizes are legal. This is an initialization method. It should be called before the telecommand manager is used the first time and it should not be called more than once.
Definition at line 43 of file CC_TelecommandManager.cpp. |
|
Load the telecommand loader as a plug-in component. The telecommand manager needs access to the telecommand loader because it must notify it when a telecommand is unloaded.
Definition at line 130 of file CC_TelecommandManager.cpp. |