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

DC_BasicPUSTmStream Class Reference

#include <DC_BasicPUSTmStream.h>

Inheritance diagram for DC_BasicPUSTmStream:

TelemetryStream CC_RootObject List of all members.

Detailed Description

Telemetry stream that packetizes the telemetry data according to the PUS and writes them to a telemetry write area.

This component can write several packets to the telemetry write area in sequence, up to the point where there is no space left in the telemetry write area. The telemetry write area is characterized by a starting address and by a size. The starting address and the size are settable configuration parameters. They can be changed dynamically. The first byte of the telemetry write area holds the number of packets that have been written to it since the last time the stream was reset. Following bytes hold the images of the the telemetry packets in the order in which they are written.

This component maintains a write counter and a packet counter. Both counters are reset to 0 by a call to operation reset or flush. The write counter is incremented every time a byte is written to the telemetry write array. If its value is smaller than the size of the telemetry write area, then the write counter points to the location in the write area where the next telemetry data byte will be written. The packet counter is equal to the number of packets that have been written to the telemetry write area since the stream was last reset. The value of the packet counter is the same as the value of the first byte of the telemetry write area.

Write requests that cannot be processed because there is not enough space in the telemetry write area have no effect other than the generation of event EVT_TM_STREAM_END. It is the responsibility of the user to perform reset or flush operations when the byte array has been completely filled.

This telemetry stream adds the header data to the packet data that it retrieves from the packet itself. The format of the packet header is in accordance with the PUS with the following qualifications:

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

Definition at line 69 of file DC_BasicPUSTmStream.h.

Public Member Functions

 DC_BasicPUSTmStream (void)
 Instantiate the component.

virtual void reset (void)
 Reset the telemetry stream.

virtual void flush (void)
 The flush operation is equivalent to a reset operation.

virtual unsigned int getCapacity (void)
 Return the capacity of the telemetry stream.

void setCapacity (unsigned int n)
 Set the capacity of the telemetry stream.

void setStartAddress (unsigned char *pAddress)
 Set the starting address of the telemetry write area.

unsigned char * getStartAddress (void) const
 Get the starting address of the telemetry write area.

unsigned int getPacketCounter (void) const
 Get the current value of the packet counter.

unsigned int getWriteCounter (void) const
 Get the current value of the write counter.

unsigned int getSequenceCounter (void) const
 Get the value of the packet sequence count.

virtual bool doesPacketFit (TelemetryPacket *pPacket)
 Return true if there is enough space in the telemetry write area to write the argument telemetry packet.

virtual void write (TelemetryPacket *pItem)
 Write one telemetry packet to the telemetry write area.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on the telemetry stream: verify that the size and starting address of the telemetry write area have been loaded.


Constructor & Destructor Documentation

DC_BasicPUSTmStream::DC_BasicPUSTmStream void   ) 
 

Instantiate the component.

The class identifier is set. The size and starting address of the byte array are set to illegal values to signify that the component is not yet configured. The write counter is set to zero.

Definition at line 23 of file DC_BasicPUSTmStream.cpp.


Member Function Documentation

bool DC_BasicPUSTmStream::doesPacketFit TelemetryPacket pPacket  )  [virtual]
 

Return true if there is enough space in the telemetry write area to write the argument telemetry packet.

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

      if ( pItem->getNumberOfBytes()==0 )
          return true;
	    if ( (pItem->getNumberOfBytes()+headerSize) greater than (N-writeCounter) )
	        return false;
	    else
          return true; 
where N is the size of the telemetry write area, writeCounter is the value of the write counter, and headerSize is the size of the PUS header that method write adds to the application data returned by the packet.

Parameters:
pPacket the telemetry packet to be written to the telemetry stream
Returns:
true if there is enough space in the telemetry stream to write the telemetry packet, false otherwise

Reimplemented from TelemetryStream.

Definition at line 76 of file DC_BasicPUSTmStream.cpp.

void DC_BasicPUSTmStream::flush void   )  [virtual]
 

The flush operation is equivalent to a reset operation.

See also:
reset

Reimplemented from TelemetryStream.

Definition at line 38 of file DC_BasicPUSTmStream.cpp.

unsigned int DC_BasicPUSTmStream::getCapacity void   )  [virtual]
 

Return the capacity of the telemetry stream.

The capacity of this telemetry stream is equal to the size in bytes of the telemetry write area.

Returns:
the size of the byte array in number of bytes

Reimplemented from TelemetryStream.

Definition at line 42 of file DC_BasicPUSTmStream.cpp.

unsigned int DC_BasicPUSTmStream::getPacketCounter void   )  const
 

Get the current value of the packet counter.

Returns:
the packet counter

Definition at line 63 of file DC_BasicPUSTmStream.cpp.

unsigned int DC_BasicPUSTmStream::getSequenceCounter void   )  const
 

Get the value of the packet sequence count.

This is equal to the number of packets for which write requests have been made since the telemetry stream component was instantiated.

Returns:
the packet sequence count

Definition at line 72 of file DC_BasicPUSTmStream.cpp.

unsigned char * DC_BasicPUSTmStream::getStartAddress void   )  const
 

Get the starting address of the telemetry write area.

See also:
#setStartingAddress
Returns:
the pointer to the first location of the telemetry write area

Definition at line 58 of file DC_BasicPUSTmStream.cpp.

unsigned int DC_BasicPUSTmStream::getWriteCounter void   )  const
 

Get the current value of the write counter.

Returns:
the write counter

Definition at line 68 of file DC_BasicPUSTmStream.cpp.

bool DC_BasicPUSTmStream::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on the telemetry stream: verify that the size and starting address of the telemetry write area have been loaded.

Returns:
true if the telemetry stream is configured, false otherwise.

Reimplemented from CC_RootObject.

Definition at line 143 of file DC_BasicPUSTmStream.cpp.

void DC_BasicPUSTmStream::reset void   )  [virtual]
 

Reset the telemetry stream.

The write counter is set to 1 and the packet counter is set to 0. The next packet will be written at the beginning of the telemetry write area (starting at location 1, location 0 is reserved for the packet counter).

Reimplemented from TelemetryStream.

Definition at line 32 of file DC_BasicPUSTmStream.cpp.

void DC_BasicPUSTmStream::setCapacity unsigned int  n  ) 
 

Set the capacity of the telemetry stream.

The capacity of this telemetry stream is equal to the size in bytes of the telemetry write area. If s is the staring address of the telemetry write area (loaded with method setStartingAddress) and if L is the value loaded with with this method, then the i-th location of the telemetry write area is internally accessed as s[i] where i must be in the range [0,L-1]. It is the responsibility of the user to ensure that the locations thus accessed are free for use by this telemetry stream component. Only positive values for the argument of this method are legal.

See also:
#setStartingAddress
Parameters:
n the size of the telemetry write area in number of bytes

Definition at line 47 of file DC_BasicPUSTmStream.cpp.

void DC_BasicPUSTmStream::setStartAddress unsigned char *  pAddress  ) 
 

Set the starting address of the telemetry write area.

This component does not perform any memory allocation operation. It assumes that the memory for the telemetry write area has already been allocated by the caller. The telemetry stream is reset when a new start address is loaded.

Parameters:
pAddress pointer to the first location of the byte array

Definition at line 52 of file DC_BasicPUSTmStream.cpp.

void DC_BasicPUSTmStream::write TelemetryPacket pItem  )  [virtual]
 

Write one telemetry packet to the telemetry write area.

First the PUS header is written to the telemetry write area. Then the telemetry bytes read from the telemetry packet are written in sequence. The write operation begins at location wc in the telemetry write area where wc is the value of the write counter. Before beginning to write the packet data, a check is made to verify that there is enough space in the telemetry write area. If this is not the case, then an event of type EVT_TM_STREAM_END is generated and the method returns. After successful completion of a write operation, the packet counter is incremented by 1. The sequence count is incremented by one for each write request regardless of whether or not it was successful

There is no check on an overflow of either the write or packet counter.

The telemetry packet data are extracted from the telemetry packet component through its data acquisition service. If the packet provides it, then the fast version of the service is used. Otherwise the safe version is used. Method isFastAcquisitionImplemented is used to determine whether the fast version is provided.

Parameters:
pItem the telemetry packet to be written to the telemetry stream

Implements TelemetryStream.

Definition at line 85 of file DC_BasicPUSTmStream.cpp.


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