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

DC_CycleDataItem16TmStream Class Reference

#include <DC_CycleDataItem16TmStream.h>

Inheritance diagram for DC_CycleDataItem16TmStream:

TelemetryStream CC_RootObject List of all members.

Detailed Description

Telemetry stream that writes the content of a telemetry packet to a set of 16-bit words encapsulated in data items.

The data items will normally encapsulate hardware registers representing the telemetry interface. The data items are implemented as instances of class DC_RawDataItem.

This class maintains a write counter. The write counter has a value between 0 and N-1 where N is the number of data items managed by the telemetry stream. The counter is reset to 0 by a call to operation reset or flush. It is incremented by 1 every time a new 16-bit word is written to a data item. When the write counter reaches the value of N, no further items can be written and write requests remain without effect until a reset or flush is performed.

The number of data items is a user-defined parameter. It must be set as part of the component configuration.

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

Definition at line 42 of file DC_CycleDataItem16TmStream.h.

Public Member Functions

 DC_CycleDataItem16TmStream (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 number of data items managed by this telemetry stream.

void setNumberOfDataItems (unsigned int n)
 Set the number of data items managed by this telemetry stream.

void setDataItem (unsigned int n, DC_RawDataItem *pDataItem)
 Set the n-th data item.

virtual bool doesPacketFit (TelemetryPacket *pPacket)
 Return true if it is possible to write the entire content of the argument telemetry packet to the data item.

virtual void write (TelemetryPacket *pItem)
 Write the telemetry packet content to the data items.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on the telemetry stream: verify that the number of data items has been set and that all data items have been loaded.


Constructor & Destructor Documentation

DC_CycleDataItem16TmStream::DC_CycleDataItem16TmStream void   ) 
 

Instantiate the component.

The class identifier is set. The number of data items is set to an illegal value to signify that the component is not yet configured.

Definition at line 23 of file DC_CycleDataItem16TmStream.cpp.


Member Function Documentation

bool DC_CycleDataItem16TmStream::doesPacketFit TelemetryPacket pPacket  )  [virtual]
 

Return true if it is possible to write the entire content of the argument telemetry packet to the data item.

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

	    if ( pItem->getNumberOfBytes() greater than 2*(N-writeCounter) )
	        return false;
	    else
		    return true; 
where N is the number of data items in the telemetry stream and writeCounter is the value of the write counter.

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 n bytes, false otherwise

Reimplemented from TelemetryStream.

Definition at line 62 of file DC_CycleDataItem16TmStream.cpp.

void DC_CycleDataItem16TmStream::flush void   )  [virtual]
 

The flush operation is equivalent to a reset operation.

See also:
reset

Reimplemented from TelemetryStream.

Definition at line 34 of file DC_CycleDataItem16TmStream.cpp.

unsigned int DC_CycleDataItem16TmStream::getCapacity void   )  [virtual]
 

Return the number of data items managed by this telemetry stream.

The number of data items is set with method setNumberOfDataItems

See also:
setNumberOfDataItems
Returns:
the size of the telemetry stream (the number of data items)

Reimplemented from TelemetryStream.

Definition at line 38 of file DC_CycleDataItem16TmStream.cpp.

bool DC_CycleDataItem16TmStream::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on the telemetry stream: verify that the number of data items has been set and that all data items have been loaded.

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

Reimplemented from CC_RootObject.

Definition at line 83 of file DC_CycleDataItem16TmStream.cpp.

void DC_CycleDataItem16TmStream::reset void   )  [virtual]
 

Reset the telemetry stream.

The write counter is reset to 0.

Reimplemented from TelemetryStream.

Definition at line 29 of file DC_CycleDataItem16TmStream.cpp.

void DC_CycleDataItem16TmStream::setDataItem unsigned int  n,
DC_RawDataItem pDataItem
 

Set the n-th data item.

The data item are the locations to which the bytes written from the telemetry packet are written. The index n must lie in the interval [0,N-1] where N is the number of data items managed by this telemetry stream (the return value of method getSize). Use of an out-of-range index has no effect.

See also:
setNumberOfDataItems
Parameters:
n the index of the data item to be set
pDataItem the data item to be associated to the index-th location of the telemetry stream

Definition at line 56 of file DC_CycleDataItem16TmStream.cpp.

void DC_CycleDataItem16TmStream::setNumberOfDataItems unsigned int  n  ) 
 

Set the number of data items managed by this telemetry stream.

This method causes the memory for the data structure holding the data items to be allocated. After the successful allocation of the memory, the telemetry stream is reset.

This is an initialization method. It should be called before the telemetry stream is used the first time and it should not be called more than once. The number of data items should be greater than 0.

See also:
#getSize
Parameters:
n the number of data items

Definition at line 43 of file DC_CycleDataItem16TmStream.cpp.

void DC_CycleDataItem16TmStream::write TelemetryPacket pItem  )  [virtual]
 

Write the telemetry packet content to the data items.

Only the telemetry bytes in the telemetry packet are written (the header information - the telemetry packet time tag, destination, type and subtype - are not written). A pseudo-code implementation for this method is as follows:

      for (i=0; i<(pItem->getNumberOfBytes()-1); i=i+2)
          collect the i-th and (i+1)-bytes from pItem
          if ( writeCounter smaller than N-1 )
	            combine the i-th and (i+1)-bytes in one 16-bit word;
              write the 16-bit word to writeCounter-th data item;
              writeCounter++;
          else
              return; 
where N is the number of data items in the telemetry stream. The merge of two successive telemetry bytes from the telemetry packet into one single 16-bit word is done by overlaying the i-th byte with the least significant byte of the data item word and the (i+1)-th byte with the most significant byte.
Parameters:
pItem the telemetry packet to be written to the telemetry stream.

Implements TelemetryStream.

Definition at line 67 of file DC_CycleDataItem16TmStream.cpp.


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