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

DC_BasicPUSTcLoader Class Reference

#include <DC_BasicPUSTcLoader.h>

Inheritance diagram for DC_BasicPUSTcLoader:

TelecommandLoader CC_RootObject List of all members.

Detailed Description

Telecommand loader for PUS telecommands that implements only basic functionalities and checks.

This telecommand loader can handle one or more raw telecommand packets. At the time it is activated, it assumes the packets to be placed in a dedicated memory area (the telecommand load area) and assumes their layout to comply with the layout for telecommand packets stipulated by the PUS. The packets are assumed to be placed in the telecommand area in sequence, one after the other. The layout of the telecommand load area is therefore assumed to be as follows. The first byte represents the number of telecommand packets. Successive bytes represent the telecommand packets stored in sequence and without gaps in between successive packets.

When the telecommand loader is activated, it accesses the telecommand load area and processes the telecommand packets one by one. For each packet, it retrieves the telecommand type and subtype. It then asks the telecommand factory for a telecommand component of matching type, it configures it with the data in the telecommand load area, and finally loads the newly configured component in the telecommand manager.

In a typical usage scenario, this component would be activated periodically to process any telecommand packets that have been received in the previous period. In an alternative scenario, the component is activated by an interrupt handler when reception of a new telecommand packet has been detected. Note however that the processing of a telecommand packet by this component can be time-consuming and hence this alternative scenario only is feasible if the time between successive telecommand interrupts is sufficiently long.

This telecommand loader is configured with the starting address of the telecommand load area (method setTcLoadAreaStart), with the maximum length of a telecommand packet (method setMaxTcLength), and with the maximum number of telecommand packets that can be placed in the telecommand load area (method setMaxNumberOfTc). All configuration parameters can be changed dynamically.

This telecommand loader does not perform any consistency or validity checks on the raw telecommand data other than verifying that the length of the telecommand packet is less than the maximum value set with method setMaxTcLength and that the number of telecommands is less than the maximum set with method setMaxNumberOfTc.

Todo:
The implementation of method "activate" must be updated every time a new PUS telecommand class is added to the framework
See also:
PUSTelecommand

CC_TelecommandManager

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

Definition at line 69 of file DC_BasicPUSTcLoader.h.

Public Member Functions

 DC_BasicPUSTcLoader (void)
 Instantiate a basic PUS telecommand loader.

virtual void activate (void)
 Retrieve the raw telecommand packet data, create and configure a telecommand component for each telecommand packet, and load them in the telecommand manager.

virtual void release (Telecommand *pTelecommand)
 Change the status of the telecommand to "not in use".

void setTcLoadAreaStart (unsigned char *startAddress)
 Set the start address of the telecommand load area.

void setMaxTcLength (unsigned int maxTcLength)
 Set the maximum length of a telecommand packet in number of bytes.

unsigned int getMaxTcLength (void) const
 Getter method for the maximum length of the a telecommand packet.

void setMaxNumberOfTc (unsigned int max)
 Set the maximum number of telecommand packets that can be handled by this component in an activation cycle.

unsigned int getMaxNumberOfTc (void) const
 Getter method for the maximum number of telecommand packets that can be handled by this component in an activation cycle.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on the telecommand loader: verify that the start address of the telecommand load area, the maximum length of the telecommand packet have been set, and the maximum number of telecommand packets have been set.


Constructor & Destructor Documentation

DC_BasicPUSTcLoader::DC_BasicPUSTcLoader void   ) 
 

Instantiate a basic PUS telecommand loader.

The class identifier is set. The start address of the telecommand area, the maximum length of the telecommand packets, and the maximum number of telecommand packets are initialized to illegal values to signify that the component is not yet configured.

Definition at line 23 of file DC_BasicPUSTcLoader.cpp.


Member Function Documentation

void DC_BasicPUSTcLoader::activate void   )  [virtual]
 

Retrieve the raw telecommand packet data, create and configure a telecommand component for each telecommand packet, and load them in the telecommand manager.

The raw telecommand packet data are assumed to consist of an array of bytes stored in the telecommand load area. Their layout is assumed to conform with the PUS telecommand packet layout. A pseudo-code implementation for this method is as follows:

      pTcFct = ...    // retrieve telecommand factory
      for each tc packet in the tc load area {
          if (APID of TC telecommand does not match APID of this application)
              continue;
          tcType = ...    // read telecommand type from data in telecommand area
          tcSubType = ... // read telecommand subtype from data in telecommand area
          if (tcType=TYPE_1 and tcSubType=SUBTYPE_a) {
            ... // retrieve TC component of matching type and subtype from pTcFct
            ... // configure the TC component
            ... // load TC packet data into TC component
            getTelecommandManager()->load(...);  // load telecommand component
          }
          if (tcType=TYPE_2 and tcSubType=SUBTYPE_b) {
            ... // retrieve TC component of matching type and subtype from pTcFct
            ... // configure the TC component
            ... // load TC packet data into TC component
            getTelecommandManager()->load(...);  // load telecommand component
           }
           ...
       }    
The loading of telecommand packet data into the TC component is done using the raw data load service. Depending on the telecommand type, either the fast or the safe version of the service is used. The check on APID is performed by comparing the packet ID field in the telecommand packet with the packet ID of the telecommand components as returned by method getPacketId. If the two values do not match, it is assumed that the telecommand packet is intended for some other application and it is simply ignored.

For simplicity, the pseudo-code above does not consider error cases. Error cases result in the generation of an error report and in the immediate return of the method. The following error cases are handled:

  • The number of telecommand packets in the telecommand load area is greater than the maximum value set when the telecommand loader is configured (event report EVT_TOO_MANY_TC_PCKT)
  • The telecommand factory does not return any telecommand component (event report EVT_NO_TC_AVAIL)
  • The telecommand type has an unexpected type (event report EVT_UNKNOWN_TC_TYPE)
  • The telecommand length exceeds the maximum value set when the telecommand loader is configured (event report EVT_TC_TOO_LONG)
The current implementation can handle the following telecommands: In accordance with the PUS, this method assumes what follows:<ul> the packet ID is located at offset: (startAddress+0) the packet sequence control is located at offset: (startAddress+2) the telecommand type field is located in a telecommand packet at offset: (startAddress+7) the acknowledge bits are located in the least significant four bits of the byte at offset: (startAddress+6) the telecommand subtype is located at offset: (startAddress+8) the packet length field is assumed to be located at offset: (startAddress+4) the packet source ID has a length of sizeof(TD_TelecommandSource) the packet error control field is assumed to be 2-byte wide but is ignored. Error checking is assumed to have already been performed upstream

Implements TelecommandLoader.

Definition at line 30 of file DC_BasicPUSTcLoader.cpp.

unsigned int DC_BasicPUSTcLoader::getMaxNumberOfTc void   )  const
 

Getter method for the maximum number of telecommand packets that can be handled by this component in an activation cycle.

Returns:
the maximum number of telecommands

Definition at line 145 of file DC_BasicPUSTcLoader.cpp.

unsigned int DC_BasicPUSTcLoader::getMaxTcLength void   )  const
 

Getter method for the maximum length of the a telecommand packet.

Returns:
the maximum length of a telecommand packet

Definition at line 136 of file DC_BasicPUSTcLoader.cpp.

bool DC_BasicPUSTcLoader::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on the telecommand loader: verify that the start address of the telecommand load area, the maximum length of the telecommand packet have been set, and the maximum number of telecommand packets have been set.

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

Reimplemented from TelecommandLoader.

Definition at line 149 of file DC_BasicPUSTcLoader.cpp.

void DC_BasicPUSTcLoader::release Telecommand pTelecommand  )  [virtual]
 

Change the status of the telecommand to "not in use".

A pseudo-code implementation for this method is as follows:

      pTelecommand->setInUse(NOT_IN_USE); 
Parameters:
pTelecommand the telecommand whose resources must be released

Implements TelecommandLoader.

Definition at line 118 of file DC_BasicPUSTcLoader.cpp.

void DC_BasicPUSTcLoader::setMaxNumberOfTc unsigned int  max  ) 
 

Set the maximum number of telecommand packets that can be handled by this component in an activation cycle.

Parameters:
max the maximum number of telecommands

Definition at line 140 of file DC_BasicPUSTcLoader.cpp.

void DC_BasicPUSTcLoader::setMaxTcLength unsigned int  maxTcLength  ) 
 

Set the maximum length of a telecommand packet in number of bytes.

The value set here is the total length of the packet including its header. Only values greater than 6 are legal (a PUS header is 6 bytes long).

Parameters:
maxTcLength the maximum length of a telecommand packet

Definition at line 131 of file DC_BasicPUSTcLoader.cpp.

void DC_BasicPUSTcLoader::setTcLoadAreaStart unsigned char *  startAddress  ) 
 

Set the start address of the telecommand load area.

Parameters:
startAddress the start address

Definition at line 126 of file DC_BasicPUSTcLoader.cpp.


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