#include <StructuredTelemetryPacket.h>
Inheritance diagram for StructuredTelemetryPacket:
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.
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. |
|
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. |
|
Return the size of the internal telemetry buffer.
This is the number that was set with the first call to method
Implements TelemetryPacket. Definition at line 47 of file StructuredTelemetryPacket.cpp. |
|
Return the n-th element of the internal telemetry buffer. A pseudo-code implementation for this method is as follows:<PRE> return pByteBuffer[n];
Implements TelemetryPacket. Definition at line 51 of file StructuredTelemetryPacket.cpp. |
|
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
Definition at line 79 of file StructuredTelemetryPacket.cpp. |
|
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
Definition at line 72 of file StructuredTelemetryPacket.cpp. |
|
Perform a class-specific configuration check on a structured telemetry packet: verify that the telemetry buffers have been initialized and allocated.
Reimplemented from CC_RootObject. Reimplemented in DC_DataItem16TmWord. Definition at line 86 of file StructuredTelemetryPacket.cpp. |
|
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 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.
Definition at line 26 of file StructuredTelemetryPacket.cpp. |
|
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 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.
Definition at line 57 of file StructuredTelemetryPacket.cpp. |
|
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 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.
Definition at line 67 of file StructuredTelemetryPacket.cpp. |
|
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 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.
Definition at line 62 of file StructuredTelemetryPacket.cpp. |
|
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 Implements TelemetryPacket. Implemented in DC_DataItem16TmWord. |