Main Page | Modules | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

CC_TelecommandManager Class Reference
[Functionality ManagersTelecommand Management]

#include <CC_TelecommandManager.h>

Inheritance diagram for CC_TelecommandManager:

CC_RootObject List of all members.

Detailed Description

This class encapsulates a telecommand manager.

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:

  1. Load an OBS clock in the telecommand manager (method setObsClock.
  2. Load a telecommand loader in the telecommand manager (method setTelecommandLoader.
  3. Set the size of the pending telecommand list (method setPendingTelecommandListSize).
The above operations can be execute in any order.

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.

Todo:
extend the test case for the telecommand manager to check the generation of an event in case the telecommand execution is not successful

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.

See also:
Telecommand

TelecommandLoader

PunctualAction

Author:
Alessandro Pasetti (P&P Software GmbH)
Version:
1.0

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.

TelecommandgetPendingTelecommand (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.

TelecommandLoadergetTelecommandLoader (void)
 Getter method for the telecommand loader plug-in component.

void setObsClock (ObsClock *pObsClock)
 Load the OBS clock as a plug-in component.

ObsClockgetObsClock (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.


Constructor & Destructor Documentation

CC_TelecommandManager::CC_TelecommandManager void   ) 
 

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.


Member Function Documentation

void CC_TelecommandManager::abort TD_TelecommandId  telecommandId  ) 
 

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.

See also:
abort

TelecommandLoader::release

Parameters:
telecommandId the telecommand to be aborted

Definition at line 117 of file CC_TelecommandManager.cpp.

void CC_TelecommandManager::abort Telecommand pTelecommand  )  [virtual]
 

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.
See also:
TelecommandLoader::release
Parameters:
pTelecommand the telecommand to be aborted

Definition at line 103 of file CC_TelecommandManager.cpp.

void CC_TelecommandManager::activate void   )  [virtual]
 

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.

ObsClock * CC_TelecommandManager::getObsClock void   ) 
 

Getter method for the OBS clock plug-in component.

See also:
setObsClock
Returns:
the on-board clock

Definition at line 148 of file CC_TelecommandManager.cpp.

Telecommand * CC_TelecommandManager::getPendingTelecommand unsigned int  i  ) 
 

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.

See also:
setPendingTelecommandListSize
Returns:
the i-th pending telecommand or null if the i-the entry in the list is empty

Definition at line 96 of file CC_TelecommandManager.cpp.

unsigned int CC_TelecommandManager::getPendingTelecommandListSize void   ) 
 

Get the size of the pending telecommand list.

See also:
setPendingTelecommandListSize
Returns:
the maximum number of pending telecommands that can be managed by the Telecommand Manager

Definition at line 54 of file CC_TelecommandManager.cpp.

unsigned int CC_TelecommandManager::getPendingTelecommands void   ) 
 

Get the number of currently pending telecommands.

See also:
setPendingTelecommandListSize
Returns:
the number of currently pending telecommands

Definition at line 90 of file CC_TelecommandManager.cpp.

TelecommandLoader * CC_TelecommandManager::getTelecommandLoader void   ) 
 

Getter method for the telecommand loader plug-in component.

See also:
setTelecommandLoader
Returns:
the telecommand loader

Definition at line 136 of file CC_TelecommandManager.cpp.

bool CC_TelecommandManager::isObjectConfigured void   )  [virtual]
 

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.

Returns:
true if the telecommand manager is configured, false otherwise.

Reimplemented from CC_RootObject.

Definition at line 176 of file CC_TelecommandManager.cpp.

void CC_TelecommandManager::load Telecommand pTelecommand  )  [virtual]
 

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.
Parameters:
pTelecommand the telecommand that is loaded

Definition at line 60 of file CC_TelecommandManager.cpp.

void CC_TelecommandManager::reset void   ) 
 

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.

void CC_TelecommandManager::setObsClock ObsClock pObsClock  ) 
 

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.

See also:
activate
Parameters:
pObsClock the on-board clock

Definition at line 142 of file CC_TelecommandManager.cpp.

void CC_TelecommandManager::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.

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.

Parameters:
listSize the maximum number of pending telecommands that can be managed by the Telecommand Manager. This should be a positive number.

Definition at line 43 of file CC_TelecommandManager.cpp.

void CC_TelecommandManager::setTelecommandLoader TelecommandLoader pTcLoader  ) 
 

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.

See also:
activate

abort

Parameters:
pTcLoader the telecommand loader

Definition at line 130 of file CC_TelecommandManager.cpp.


The documentation for this class was generated from the following files:
Copyright 2003 P&P Software GmbH - All Rights Reserved