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

StructuredTelemetryPacket Class Reference
[Telemetry Management]

#include <StructuredTelemetryPacket.h>

Inheritance diagram for StructuredTelemetryPacket:

TelemetryPacket CC_RootObject DC_DataItem16TmWord List of all members.

Detailed Description

Specialization of the TelemetryPacket abstract class that defines a default data structure where the telemetry data can be held.

This is still an abstract class because no implementation can be given for the data update service and the data acquisition service.

This class defines an array data structure to hold the telemetry bytes. This data structure is called the internal telemetry buffer. This class is responsible for declaring and initializing this data structure. Instances of this class can only be used after this data structure has been initialized by calling method setNumberOfBytes. This class is especially well suited to modelling telemetry packets with a fixed size.

By default, the telemetry data generated by a TelemetryPacket are seen as a sequence of bytes. This class allows them to be seen also as a sequence of 2-bytes words, or as a sequence of 4-bytes longwords. This is done by providing two additional implementations of the data acquisition service. The default implementation getUnsignedByte declared by the TelemetryPacket superclass is complemented by two additional implementations getUnsignedShort and getUnsignedInt that return, respectively, sequences of 2-byte words and of 4-byte longwords.

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

Definition at line 48 of file StructuredTelemetryPacket.h.

Public Member Functions

 StructuredTelemetryPacket (void)
 Instantiate a telemetry packet component.

void setNumberOfBytes (unsigned int n)
 Set the size of the internal telemetry buffer and initialize the corresponding internal data structures.

virtual unsigned int getNumberOfBytes (void)
 Return the size of the internal telemetry buffer.

virtual unsigned char getUnsignedByte (unsigned int n)
 Return the n-th element of the internal telemetry buffer.

virtual void update (void)=0
 Implement the data update service.

unsigned short getUnsignedShort (unsigned int n)
 Implement the data acquisition service for the word-oriented case.

unsigned int getUnsignedInt (unsigned int n)
 Implement the data acquisition service for the longword-oriented case.

virtual bool isObjectConfigured (void)
 Perform a class-specific configuration check on a structured telemetry packet: verify that the telemetry buffers have been initialized and allocated.


Protected Member Functions

void setUnsignedByte (unsigned int index, unsigned char d)
 Method to load one byte item in the internal telemetry buffer.

void setUnsignedShort (unsigned int index, unsigned short d)
 Method to load one 2-byte word item in the internal telemetry buffer.

void setUnsignedInt (unsigned int index, unsigned int d)
 Method to load one 4-byte longword item in the internal telemetry buffer.


Constructor & Destructor Documentation

StructuredTelemetryPacket::StructuredTelemetryPacket void   ) 
 

Instantiate a telemetry packet component.

This constructor initializes the size of the internal telemetry buffer size to 0.

Definition at line 19 of file StructuredTelemetryPacket.cpp.


Member Function Documentation

unsigned int StructuredTelemetryPacket::getNumberOfBytes void   )  [virtual]
 

Return the size of the internal telemetry buffer.

This is the number that was set with the first call to method setNumberOfBytes.

See also:
setNumberOfBytes
Returns:
number of bytes in this telemetry packet

Implements TelemetryPacket.

Definition at line 47 of file StructuredTelemetryPacket.cpp.

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

Return the n-th element of the internal telemetry buffer.

A pseudo-code implementation for this method is as follows:<PRE> return pByteBuffer[n];

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

Implements TelemetryPacket.

Definition at line 51 of file StructuredTelemetryPacket.cpp.

unsigned int StructuredTelemetryPacket::getUnsignedInt unsigned int  n  ) 
 

Implement the data acquisition service for the longword-oriented case.

The telemetry data provided by this class are treated as a sequence of 4-byte longwords. The method returns the n-th telemetry longword. The parameter n must lie in the interval [0, N/4-1] where N is the number of telemetry bytes (the return value of method getNumberOfBytes).

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

Definition at line 79 of file StructuredTelemetryPacket.cpp.

unsigned short StructuredTelemetryPacket::getUnsignedShort unsigned int  n  ) 
 

Implement the data acquisition service for the word-oriented case.

The telemetry data provided by this class are treated as a sequence of 2-byte words. The method returns the n-th telemetry packet. The parameter n must lie in the interval [0, N/2-1] where N is the number of telemetry bytes (the return value of method getNumberOfBytes).

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

Definition at line 72 of file StructuredTelemetryPacket.cpp.

bool StructuredTelemetryPacket::isObjectConfigured void   )  [virtual]
 

Perform a class-specific configuration check on a structured telemetry packet: verify that the telemetry buffers have been initialized and allocated.

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

Reimplemented from CC_RootObject.

Reimplemented in DC_DataItem16TmWord.

Definition at line 86 of file StructuredTelemetryPacket.cpp.

void StructuredTelemetryPacket::setNumberOfBytes unsigned int  n  ) 
 

Set the size of the internal telemetry buffer and initialize the corresponding internal data structures.

The buffer data structures are declared as:

      unsigned char* pByteBuffer;
      unsigned short* pShortBuffer;
      unsigned int* pIntBuffer; 
A pseudo-code implementation for this method is as follows:<PRE> pByteBuffer = new unsigned char[n]; pShortBuffer = (unsigned short*)pByteBuffer; pIntBuffer = (unsigned int*)pByteBuffer; The three buffers are thus overlaid. Precautions are taken to ensure that the type casts will always succeed, even on platforms where alignment constraints apply.

It is up to subclasses to decide whether they prefer to treat their telemetry data as a sequence of bytes, as a sequence of 2-byte words, or as a sequence of 4-bytes longwords. Derived classes load the telemetry buffers by using methods setUnsignedByte, setUnsignedShort and setUnsignedInt.

This is an initialization method. It should be called before the structure telemetry packet is used the first time and it should not be called more than once. Successive calls have no effect.

Note that the number of bytes should be greater than 0.

This method deviates from the project-specific coding rule PR3.1. Use of pointers to variables of primitive type is necessary to allow efficient implementation of the telemetry getter methods.

Parameters:
n number of bytes in this telemetry packet (size of the internal telemetry buffer)

Definition at line 26 of file StructuredTelemetryPacket.cpp.

void StructuredTelemetryPacket::setUnsignedByte unsigned int  index,
unsigned char  d
[protected]
 

Method to load one byte item in the internal telemetry buffer.

This method is normally called by derived classes as part of their implementation for method update. A pseudo-code implementation for this method is as follows:

		pByteBuffer[index] = d; 
Note that there is no check on the index being within bounds. This is avoided for reasons of efficiency and because this is an "internal method" that should be used by a trusted entity.
See also:
TelemetryPacket::getUnsignedByte

setNumberOfBytes

Parameters:
index the index of the telemetry array where the telemetry packet is loaded
d the value of the telemetry packet

Definition at line 57 of file StructuredTelemetryPacket.cpp.

void StructuredTelemetryPacket::setUnsignedInt unsigned int  index,
unsigned int  d
[protected]
 

Method to load one 4-byte longword item in the internal telemetry buffer.

This method is normally called by subclasses as part of their implementation for method update. A pseudo-code implementation for this method is as follows:

		pIntBuffer[index] = d; 
Note that there is no check on the index being within bounds. This is avoided for reasons of efficiency and because this is an "internal method" that should be used by a trusted entity.
See also:
getUnsignedInt

setNumberOfBytes

Parameters:
index the index of the telemetry array where the telemetry packet is loaded
d the value of the telemetry packet

Definition at line 67 of file StructuredTelemetryPacket.cpp.

void StructuredTelemetryPacket::setUnsignedShort unsigned int  index,
unsigned short  d
[protected]
 

Method to load one 2-byte word item in the internal telemetry buffer.

This method is normally called by subclasses as part of their implementation for method update. A pseudo-code implementation for this method is as follows:

		pShortBuffer[index] = d; 
Note that there is no check on the index being within bounds. This is avoided for reasons of efficiency and because this is an "internal method" that should be used by a trusted entity.
See also:
getUnsignedShort

setNumberOfBytes

Parameters:
index the index of the telemetry array where the telemetry packet is loaded
d the value of the telemetry packet

Definition at line 62 of file StructuredTelemetryPacket.cpp.

virtual void StructuredTelemetryPacket::update void   )  [pure virtual]
 

Implement the data update service.

This method should be implemented to load the telemetry buffers using the setter methods defined in this class. A call to this method should normally be followed by a call to method isValid to verify the validity of the newly updated data.

Implements TelemetryPacket.

Implemented in DC_DataItem16TmWord.


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