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

DC_PUSClearDataReporting Class Reference

#include <DC_PUSClearDataReporting.h>

Inheritance diagram for DC_PUSClearDataReporting:

PUSTelecommand Telecommand PunctualAction CC_RootObject List of all members.

Detailed Description

PUS telecommand to clear one or more housekeeping and diagnostic data reporting telemetry packets.

This class encapsulates the following subtypes of PUS service number 3:

A parameter report definition is cleared by performing the following actions:<ul> The telemetry packet that encapsulates the parameter report is marked "not in use". The telemetry packet is unloaded from the PUS telemetry mode manager. This class is configured at initialization time by performing the following actions: During normal operation, configuration is performed using the raw data load service.

This telecommand implements a validity check that returns "telecommand not valid" in case an attempt is made to load more application data than fit into the telecommand component or in case the application data are internally inconsistent.

Execution of this telecommand can have two outcomes. The telecommand can either have a successful outcome (the return value of doAction is ACTION_SUCCESS) or it can fail (the return value of doAction is ACTION_FAILURE). A failure is declared if any of the SIDs provided to the telecommand do not correspond to a data reporting packet that is currently in use.

The PUS specifies that the first item in the application data of this telecommand is the NSID field. The type of this field is not mandated by the standard. This class assumes it to be of type unsigned char. The standard also allows this field to be omitted. This class however requires this field to be always present.

Todo:
This class can only take one telemetry mode manager as configuration parameters. If we assume that the same applications can have several telemetry managers (maybe to manage telemetry packets with different levels of RT priority), then it would be necessary to modify this class to accept several telemetry mode managers.
Author:
Alessandro Pasetti (P&P Software GmbH)
Version:
1.0

Definition at line 66 of file DC_PUSClearDataReporting.h.

Public Member Functions

 DC_PUSClearDataReporting (void)
 Instantiate a clear data reporting PUS telecommand.

void setMaxNumberSID (unsigned char max)
 Set the maximum number of SIDs that can be processed by this telecommand.

virtual void setRawData (unsigned int i, unsigned char d)
 Implementation of the raw data load service.

virtual unsigned int getNumberOfRawData (void) const
 Return the number of raw data bytes that can be loaded with the raw telecommand data load service.

void setPUSTelemetryModeManager (DC_PUSTelemetryModeManager *pTmModeManager)
 Load the PUS telemetry mode manager.

DC_PUSTelemetryModeManagergetPUSTelemetryModeManager () const
 Getter method for the PUS telemetry mode manager.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on the telecommand: check that the maximum number of SIDs that can be processed by the telecommand has been set and that the telemetry manager and telemetry mode manager have been loaded.


Protected Member Functions

virtual TD_ActionOutcome doAction (void)
 Clear the data reporting packets.


Constructor & Destructor Documentation

DC_PUSClearDataReporting::DC_PUSClearDataReporting void   ) 
 

Instantiate a clear data reporting PUS telecommand.

The class identifier is set. The values of the internal data structure that is used to hold the telecommand application data is initialized to illegal values to signify that the telecommand is not yet configured. The telecommand type is set to PUS_TYPE_DATA_REP.

Definition at line 19 of file DC_PUSClearDataReporting.cpp.


Member Function Documentation

TD_ActionOutcome DC_PUSClearDataReporting::doAction void   )  [protected, virtual]
 

Clear the data reporting packets.

A data reporting packet is cleared by setting its "in use" status to "packet not in use" and by unloading it from the PUS telemetry mode manager (if it is loaded). This deactivates the telemetry packet and allows the telemetry packet factory to reclaim it and make it available to other clients. A pseudo-code implementation for this method is as follows:<PRE> for (all SIDs stored in the telecommand) { retrieve data reporting packet from telemetry packet factory; if (no packet is returned by the factory ) outcome=FAIL; set status of packet to "not in use" if (packet is loaded in PUS telemetry mode manager) unload packet from PUS telemetry mode manager } if (outcome==FAIL) return ACTION_FAILURE; else return ACTION_SUCCESS; The telecommand is configured with a list of SIDs. The data reporting packets are retrieved from the telemetry packet factory (instance of class CC_TelemetryPacketFactory) using their SID. The "in use" status of the packets is controlled through their setInUse method.

See also:
TelemetryPacket::setInUse

CC_TelemetryPacketFactory

DC_PUSTelemetryModeManager

PunctualAction::execute

Returns:
always returns a "telecommand successfully executed" code

Implements PunctualAction.

Definition at line 77 of file DC_PUSClearDataReporting.cpp.

unsigned int DC_PUSClearDataReporting::getNumberOfRawData void   )  const [virtual]
 

Return the number of raw data bytes that can be loaded with the raw telecommand data load service.

The value returned by this class is equal to: M*sizeof(TD_SID)+1 where M is the maximum number of SIDs defined by method setMaxNumberSID.

See also:
setRawData
Returns:
the number of raw data bytes to be loaded with the raw data load service

Reimplemented from Telecommand.

Definition at line 73 of file DC_PUSClearDataReporting.cpp.

DC_PUSTelemetryModeManager * DC_PUSClearDataReporting::getPUSTelemetryModeManager  )  const
 

Getter method for the PUS telemetry mode manager.

See also:
setPUSTelemetryModeManager
Returns:
the PUS telemetry mode manager

Definition at line 104 of file DC_PUSClearDataReporting.cpp.

bool DC_PUSClearDataReporting::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on the telecommand: check that the maximum number of SIDs that can be processed by the telecommand has been set and that the telemetry manager and telemetry mode manager have been loaded.

Returns:
true if the telecommand is configured, false otherwise

Reimplemented from PUSTelecommand.

Definition at line 108 of file DC_PUSClearDataReporting.cpp.

void DC_PUSClearDataReporting::setMaxNumberSID unsigned char  max  ) 
 

Set the maximum number of SIDs that can be processed by this telecommand.

This is an initialization method that should only be called once. A call to this method causes the internal data structures where the SIDs are held to be allocated and initialized. Only positive values of the method argument are legal.

Parameters:
max the maximum number of SIDs

Definition at line 31 of file DC_PUSClearDataReporting.cpp.

void DC_PUSClearDataReporting::setPUSTelemetryModeManager DC_PUSTelemetryModeManager pTmModeManager  ) 
 

Load the PUS telemetry mode manager.

See also:
doAction
Parameters:
pTmModeManager the PUS telemetry mode manager

Definition at line 98 of file DC_PUSClearDataReporting.cpp.

void DC_PUSClearDataReporting::setRawData unsigned int  i,
unsigned char  d
[virtual]
 

Implementation of the raw data load service.

This method would normally be called by a telecommand loader to load the application data into the the telecommand component. This method interprets the raw data as they are loaded and uses them to construct the sequence of SIDs of the data reporting packets that have to be cleared. This method assumes that the raw data are loaded in sequence starting from the first one (i.e. the value of i in the first call is zero and succesive calls use values of i that are incremented by one at each call). The value of i is also constrained to lie in the range [0,N] where N is computed as follows:

      N = M*sizeof(TD_SID)  
where M is the maximum number of SIDs defined by method setMaxNumberSID. If the number of SIDs in the telecommand packet exceeds the maximum defined with method setMaxNumberSID, the telecommand is declared to be invalid with validity check code equal to VC_TOO_MANY_SIDS. If an attempt is made to load a greater number of raw data, the telecommand is declared to be invalid with validity check code equal to VC_TOO_MANY_RAW_DATA. Finally, the total number of loaded raw data T must be consistent with the number of SIDs (the first byte in the telecommand packet). If this is not the case, then the telecommand is declared invalid with validity check code equal to VC_INCONSISTENT_RAW_DATA.
See also:
getNumberOfRawData
Parameters:
i the index of the raw telecommand data
d the raw data

Reimplemented from Telecommand.

Definition at line 42 of file DC_PUSClearDataReporting.cpp.


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