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

PUSMemoryDump Class Reference

#include <PUSMemoryDump.h>

Inheritance diagram for PUSMemoryDump:

PUSTelemetryPacket TelemetryPacket CC_RootObject DC_PUSMemoryDumpAbsolute DC_PUSMemoryDumpOffset List of all members.

Detailed Description

Base class from which the classes implementing the memory dump telemetry packets (PUS service type 6, subtypes 4 and 6) can be derived.

This class defines an internal memory structure where the characteristics of the memory blocks to be dumped (start address, length, and checksum) are stored. Additionally, it defines dump buffer to be used to store the telemetry packet image. The data acqusition service (defined by the super class TelemetryPacket) is implemented to flush this buffer. Since the amount of data in a memory packet may be large, this class implements both the safe and fast versions of the data acquisition service. Finally, this class defines a checksum flag) that can be set to indicate whether checksum should be computed and included in the telemetry packet data. the checksum flag is defined as a static variable and is initialized to false. The data update service depends on the data subtype and must therefore be defined by the subclasses. All the internal data structures defined by this class are declared protected to allow easy access to them by the subclasses that implement the two forms of the memory dump service.

The initial configuration of this class is performed as follows:<ul> Method setMaxNumberOfBlocks must be called to set the maximum number of memory blocks that can be managed by this telemetry packet Method setDumpBufferSize must be called to set the maximum size of the dump buffer. The checksum flag is set with method setChecksumFlag. Note that this is a static method and that the checksum flag applies globally to all memory dump telemetry blocks. The dynamic configuration of the telemetry packet is performed as follows:<ul> The number of blocks to be dumped is set with method setNumberOfBlocks The blocks are defined with a sequence of calls to method defineBlock The PUS leaves some leeway in the definition of the structure of the application data for memory load telecommands. This implementation makes the following assumptions:

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

Definition at line 65 of file PUSMemoryDump.h.

Public Member Functions

 PUSMemoryDump (void)
 Instantiate a PUS memory dump telemetry packet.

void setMaxNumberBlocks (TD_PUSNumberMemBlocks max)
 Set the maximum number of memory blocks that can be managed by this telemetry packet.

TD_PUSNumberMemBlocks getMaxNumberBlocks () const
 Get the maximum number of memory blocks that can be managed by this telemetry packet.

void setNumberBlocks (TD_PUSNumberMemBlocks max)
 Set the number of memory blocks that must be managed by this telemetry packet.

TD_PUSNumberMemBlocks getNumberBlocks () const
 Get the number of memory blocks that are managed by this telemetry packet.

void setDumpBufferSize (unsigned int max)
 Set the size (in number of bytes) of the dump buffer.

unsigned int getDumpBufferSize () const
 Get the size (in number of bytes) of the dump buffer.

void defineBlock (TD_PUSNumberMemBlocks i, TD_PUSMemData *start, TD_PUSMemLength length)
 Define the characteristics of the i-th memory block to be dumped.

virtual unsigned int getNumberOfBytes (void)
 Return the number of bytes in this telemetry packet.

virtual unsigned char getUnsignedByte (unsigned int n)
 Implement the data acquisition service for the PUS telemetry memory dump packet.

virtual unsigned char * getStartAddress (void)
 Implement the fast version of the data acquisition service.

virtual bool isFastAcquisitionImplemented (void)
 Return true to signify that the the fast version of the data acquisition service is implemented.

TD_PUSMemDatagetStartAddress (TD_PUSNumberMemBlocks i) const
 Get the start address of the i-th currently loaded block.

TD_PUSMemLength getLength (TD_PUSNumberMemBlocks i) const
 Get the length of the i-th currently loaded block.

unsigned short getChecksum (TD_PUSNumberMemBlocks i) const
 Get the value of the checksum field for the i-th currently loaded block.

void setMemoryId (TD_PUSMemId memId)
 Set the memory block identifier for the dump packet.

TD_PUSMemId getMemoryId ()
 Get the memory block identifier for the dump packet.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on the telecommand: check that the maximum number of blocks and the maximum number of data have been defind.


Static Public Member Functions

void setChecksumFlag (bool checksumFlag)
 Set the checksum flag.

bool isChecksumFlagSet ()
 Return the value of the checksum flag.


Protected Attributes

MemBlockTypeblock
 The i-th item of this array holds the descriptor for the i-th memory block to be dumped.

TD_PUSNumberMemBlocks maxNumberBlocks
 The maximum number of memory dump blocks.

TD_PUSNumberMemBlocks numberBlocks
 The number of memory dump blocks that must be dumped by this telemetry packet.

unsigned char * data
 Dump buffer.

unsigned int tmPacketSize
 The size of the telemetry packet in number of bytes.

unsigned int maxNumberData
 The size of the dump buffer.

TD_PUSMemId memId
 Identifier of the memory block.


Static Protected Attributes

bool isChecksumRequired = false
 Flag indicating whether checksum data are required.


Constructor & Destructor Documentation

PUSMemoryDump::PUSMemoryDump void   ) 
 

Instantiate a PUS memory dump telemetry packet.

The values of the internal data structures that are used to hold the telecommand application data are initialized to illegal values to signify that the telecommand is not yet configured. The checksum flag is set to false (no checksum data required). The memory identifier is initialized to zero.

Definition at line 20 of file PUSMemoryDump.cpp.


Member Function Documentation

void PUSMemoryDump::defineBlock TD_PUSNumberMemBlocks  i,
TD_PUSMemData start,
TD_PUSMemLength  length
 

Define the characteristics of the i-th memory block to be dumped.

This method would normally be called as part of the dynamic telemetry packet configuration. The index i must lie in the range [0,N-1] where N is the number of blocks set with method setNumberBlocks). If this is not the case, the method generates event report EVT_PUS_ILLEGAL_BLOCK_INDEX and returns immediately. The checksum value of the i-th block is initialized to zero.

Parameters:
i the memory dump index
start the start address of the i-th memory dump block
length the length of the i-th memory dump block

Definition at line 102 of file PUSMemoryDump.cpp.

unsigned short PUSMemoryDump::getChecksum TD_PUSNumberMemBlocks  i  )  const
 

Get the value of the checksum field for the i-th currently loaded block.

The block index i must lie in the interval [0,N-1] where N is the number of currently loaded blocks (the value returned by method getNumberBlocks). If this condition is not satisfied, the return value is unpredictable.

Parameters:
i the block index
Returns:
the length of the i-th currently loaded block

unsigned int PUSMemoryDump::getDumpBufferSize  )  const
 

Get the size (in number of bytes) of the dump buffer.

See also:
setDumpBufferSize
Returns:
the size (in number of bytes) of the dump buffer.

Definition at line 77 of file PUSMemoryDump.cpp.

TD_PUSMemLength PUSMemoryDump::getLength TD_PUSNumberMemBlocks  i  )  const
 

Get the length of the i-th currently loaded block.

The block index i must lie in the interval [0,N-1] where N is the number of currently loaded blocks (the value returned by method getNumberBlocks). If this condition is not satisfied, the return value is unpredictable.

Parameters:
i the block index
Returns:
the length of the i-th currently loaded block

Definition at line 88 of file PUSMemoryDump.cpp.

TD_PUSNumberMemBlocks PUSMemoryDump::getMaxNumberBlocks  )  const
 

Get the maximum number of memory blocks that can be managed by this telemetry packet.

See also:
setMaxNumberBlocks
Returns:
the maximum number of blocks

Definition at line 46 of file PUSMemoryDump.cpp.

TD_PUSMemId PUSMemoryDump::getMemoryId  ) 
 

Get the memory block identifier for the dump packet.

See also:
#setMemId
Returns:
the memory block identifier

Definition at line 143 of file PUSMemoryDump.cpp.

TD_PUSNumberMemBlocks PUSMemoryDump::getNumberBlocks  )  const
 

Get the number of memory blocks that are managed by this telemetry packet.

See also:
setNumberBlocks
Returns:
the number of blocks

Definition at line 51 of file PUSMemoryDump.cpp.

unsigned int PUSMemoryDump::getNumberOfBytes void   )  [virtual]
 

Return the number of bytes in this telemetry packet.

This is the number of bytes of the application data part of the telemetry packet holding the memory dump data. The number of bytes in the telemetry packet is computed as part of the data update service. This method will only return a valid value after method update has been called.

Returns:
number of bytes in this telemetry packet

Implements TelemetryPacket.

Definition at line 115 of file PUSMemoryDump.cpp.

TD_PUSMemData * PUSMemoryDump::getStartAddress TD_PUSNumberMemBlocks  i  )  const
 

Get the start address of the i-th currently loaded block.

The block index i must lie in the interval [0,N-1] where N is the number of currently loaded blocks (the value returned by method getNumberBlocks). If this condition is not satisfied, the return value is unpredictable. This method is unsafe because it returns a pointer. It is intended to be used only for testing purposes.

Parameters:
i the block index
Returns:
the start address of the i-th currently loaded block

Definition at line 82 of file PUSMemoryDump.cpp.

unsigned char * PUSMemoryDump::getStartAddress void   )  [virtual]
 

Implement the fast version of the data acquisition service.

This method returns the address of the first location of the dump buffer.

Returns:
the address of the first location of the dump buffer

Reimplemented from TelemetryPacket.

Definition at line 130 of file PUSMemoryDump.cpp.

unsigned char PUSMemoryDump::getUnsignedByte unsigned int  n  )  [virtual]
 

Implement the data acquisition service for the PUS telemetry memory dump packet.

This method assumes the telemetry packet data to be already loaded in the dump buffer. A pseudo-code implementation for this method is as follows:<PRE> return data[n]; where data is the dump buffer (recall that its first element holds the length of the telemetry packet). The argument n must lie in the range [0,N-1] where N is the length of the telemetry packet (the return value of method getNumberOfBytes) If this is not the case, the return value of this method is undefined. The dump buffer is loaded by method update.

Returns:
value of n-th telemetry byte
Parameters:
n the telemetry byte to be returned (starting with byte 0)

Implements TelemetryPacket.

Definition at line 122 of file PUSMemoryDump.cpp.

bool PUSMemoryDump::isChecksumFlagSet  )  [static]
 

Return the value of the checksum flag.

Returns:
the value of the checksum flag

Definition at line 98 of file PUSMemoryDump.cpp.

bool PUSMemoryDump::isFastAcquisitionImplemented void   )  [virtual]
 

Return true to signify that the the fast version of the data acquisition service is implemented.

See also:
getStartAddress
Returns:
always return true

Reimplemented from TelemetryPacket.

Definition at line 134 of file PUSMemoryDump.cpp.

bool PUSMemoryDump::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on the telecommand: check that the maximum number of blocks and the maximum number of data have been defind.

Returns:
true if the telecommand is configured, false otherwise

Reimplemented from PUSTelemetryPacket.

Definition at line 147 of file PUSMemoryDump.cpp.

void PUSMemoryDump::setChecksumFlag bool  checksumFlag  )  [static]
 

Set the checksum flag.

If this flag is set to true, then the checksum is computed for each memory block to be dumped. Otherwise, the checksum field is set to zero. Note that the checksum field is always included in the telemetry packet.

Parameters:
checksumFlag the value of the checksum flag

Definition at line 94 of file PUSMemoryDump.cpp.

void PUSMemoryDump::setDumpBufferSize unsigned int  max  ) 
 

Set the size (in number of bytes) of the dump buffer.

This is an initialization method that should only be called once. A call to this method causes the memory for the dump buffer to be allocated and initialized. Only positive values of the method argument are legal.

Parameters:
max the size of the dump buffer

Definition at line 66 of file PUSMemoryDump.cpp.

void PUSMemoryDump::setMaxNumberBlocks TD_PUSNumberMemBlocks  max  ) 
 

Set the maximum number of memory blocks that can be managed by this telemetry packet.

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

Parameters:
max the maximum number of blocks

Definition at line 33 of file PUSMemoryDump.cpp.

void PUSMemoryDump::setMemoryId TD_PUSMemId  memId  ) 
 

Set the memory block identifier for the dump packet.

Only values greater than zero are legal.

See also:
update
Parameters:
memId the memory block identifier

Definition at line 138 of file PUSMemoryDump.cpp.

void PUSMemoryDump::setNumberBlocks TD_PUSNumberMemBlocks  max  ) 
 

Set the number of memory blocks that must be managed by this telemetry packet.

This method is normally called when the telemetry packet is dynamically configured. The value of the argument N must lie in the range [1,N] where N is the maximum number of blocks set with method setmaxNumberBlocks. If this is not the case, the number of blocks is set to N and event report EVT_PUS_TOO_MANY_DUMP_BLOCKS. Only positive values are legal for the number of blocks.

Parameters:
max the maximum number of blocks

Definition at line 56 of file PUSMemoryDump.cpp.


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