#include <DC_PUSDataReportingPacket.h>
Inheritance diagram for DC_PUSDataReportingPacket:
A PUS data reporting packet is used to hold the data associated to a housekeeping and diagnostic data reporting definition (PUS service type 3). This class assumes that no filtering is performed on the reported data. The following types of service reports of the housekeeping and diagnostic data reporting service are modelled:<ul> The housekeeping parameter report (PUS service subtype 25) The diagnostic parameter report (PUS service subtype 26) A data reporting packet is characterized by the following attributes:
The collection interval defines the interval between successive dispatches of the packet content to the telemetry stream. The collection interval is expressed as a positive integer representing a number of activations of the data update service (see method update
in the base class TelemetryPacket
). Thus, for instance, a collection interval of 3 indicates that the data in the reporting packets are made available for dispatch to the telemetry stream every third activation of the data update service.
The parameter identifiers identify the parameters whose values have to be included in the reporting packet. Only parameters in the system data pool can be included in a data reporting packet. As parameter identifier, the data pool item identifier must be used (see class DataPool
).
A fixed length array identifies a set of parameters that must be sampled with the frequency. The fixed length array specifies the sampling frequency through the the repetition count, namely the number of times that the parameters must be sampled in a collection interval. If C is the collection interval for the data reporting packet and NREP is the repetition count, then C must be a multiple of NREP. The value of the parameters is acquired every C/NREP activations of the data update service.
The mode flag determines whether the "mode" field should be included in the generated packet. If it is to be included, its value is always zero. The mode flag is a static attribute that is defined as a constant PUS_DATA_REP_MODE in file Constants.h
.
The enabled flag determines whether the data reporting packet is enabled or disabled. If a data reporting packet is disabled, then its update service takes no action and its data acquisition service reports: "no telemetry data to be acquired".
An instance of this class is first configured after being created by performing the following operations:
setDefinitionBufferSize
). setValueBufferSize
). setMaxNumberFA
).
Instances of this class will normally undergo a second configuration process at run time when the housekeeping or diagnostic report definition is loaded. This configuration procedure is performed by loading the packet definition buffer byte by byte using method setDefinitionBuffer
.
The PUS specifies that the SID, the collection interval, the number of parameters, the number of repetitions, and the number of fixed-length arrays, should be of "unsigned integer" type but it does not specify the implementation of this type. This class uses typedef
type definitions for the SID, the collection interval, and the number of parameters and it implements the number of repetitions and the number of fixed length arrays as "unsigned char". Similarly, the PUS specifies that the mode of packet generation should be of "enumerated" type but it does not elaborate on the exact nature of this type. This class implements the mode indicator as an "unsigned char".
This class retrieves the data to be stored in the PUS reporting packet from the system data pool. In order to copy them to the packet, information about the type of the data is required. This information is retrieved by using the type checking service of the data pool (see methods isFloat
and isInteger
in class DataPool
). This class therefore assumes that the type checking service is fully implemented by the system data pool.
This class implements the fast version of the data acquisition service. This is useful when the amount of telemetry data is very large.
Description of Internal Data Structures The internal data structures of this class do not differentiate between the paramaters that are sampled only once per collection interval and the fixed-length arrays that describe oversampled paramaters. To the parameters that are sampled only once per collection interval, a fictitious fixed-length array is associated with a repetition count of 1.
The internal array F holds the descriptors of the fixed length arrays. Element F[0] describes the parameters that are to be sampled only once per collection interval. Element F[i] with i>0 describes the i-th fixed length array.
The definition of the PUS packet is kept in the packet definition buffer that is a byte-by-byte copy of the application data in the PUS telecommand defining the housekeeping or diagnostic parameter report. This buffer is loaded byte by byte and it is interpreted as it is loaded. The objective of the interpretation is to set up a "map" of the buffer. This map consists of variables that point to locations in the buffer where certain information is held. Thus, for instance, internal variable indNFA
points to the location in the buffer where the NFA field is stored. The most important mapping variable is the array indFA
. Element indFA[i]
with i>0 holds the location of the NREP value of the i-th fixed-length array.
The packet value buffer is organized as an array of unsigned char. Its first locations hold the SID and, depending on the value of flag PUS_DATA_REP_MODE, the reporting mode. Successive locations hold the collected parameter values stored in consecutive locations.
Definition at line 137 of file DC_PUSDataReportingPacket.h.
Public Member Functions | |
DC_PUSDataReportingPacket (void) | |
Instantiate a PUS data report packet. | |
void | setEnabled (bool enabledStatus) |
Set the enable status of the data reporting packet. | |
bool | isEnabled () const |
Return the enable status of the data reporting packet. | |
TD_PUSCollectionInterval | getCollectionInterval () |
Getter method for the collection interval. | |
TD_PUSNumberOfParameters | getNPAR1 () |
Getter method for the number of parameters to be sampled once per collection interval. | |
unsigned char | getNFA () |
Getter method for the number of fixed-length arrays. | |
TD_SID | getSID () |
Getter method for the structure identifier (SID) of the data reporting packet. | |
void | setDefinitionBuffer (unsigned int i, unsigned char val) |
Load the i-the byte of the packet definition buffer. | |
unsigned char | getDefinitionBuffer (unsigned int i) |
Return the i-th byte of the packet definition buffer. | |
unsigned int | getDefinitionBufferLength (void) |
Return the number of bytes in the packet definition buffer that were loaded with the last set of consecutive calls to method setDefinitionBuffer . | |
virtual void | update () |
Implement the data update service. | |
void | reset () |
Reset the internal state of the data reporting packet. | |
virtual unsigned int | getNumberOfBytes (void) |
Return the number of bytes that this data reporting packet will provide at the next call of the data acquisition service. | |
virtual unsigned char | getUnsignedByte (unsigned int n) |
Return the n-th byte of this data reporting packet. | |
virtual unsigned char * | getStartAddress (void) |
Return a pointer to start address of the packet value buffer. | |
virtual bool | isFastAcquisitionImplemented (void) |
Return true to signify that the fast version of the data acquisition service is implemented. | |
void | setDefinitionBufferSize (unsigned int size) |
Set the maximum size of the packet definition buffer. | |
unsigned int | getDefinitionBufferSize () |
Get the maximum size of the packet definition buffer. | |
void | setMaxNumberFA (unsigned int n) |
Set the maximum number of fixed-length arrays that are allowed in a data reporting packet. | |
unsigned int | getMaxNumberFA (void) |
Return the maximum number of fixed-length arrays that are allowed in a data reporting packet. | |
void | setValueBufferSize (unsigned int size) |
Set the maximum size of the packet value buffer. | |
unsigned int | getValueBufferSize (void) |
Return the maximum size of the packet value buffer. | |
virtual bool | isObjectConfigured (void) |
Perform a class-specific configuration check on the telemetry packet: verify that:. | |
Protected Member Functions | |
TD_DataPoolId | getParameterId (unsigned int faIndex, unsigned int parPos) |
Get the parameter id of the parPos-th parameter in the faIndex-th fixed length array. |
|
Instantiate a PUS data report packet. The size of the internal buffers are set to illegal values to signify that the data report packet is not yet configured. The class identifier is set. The packet type is set to: PUS_TYPE_DATA_REP. The enable status is set to "disabled". The "in use" status is set to: "packet not in use".
Definition at line 21 of file DC_PUSDataReportingPacket.cpp. |
|
Getter method for the collection interval.
Definition at line 44 of file DC_PUSDataReportingPacket.cpp. |
|
Return the i-th byte of the packet definition buffer.
The values that are returned are those that were set with the last set of consecutive calls to method
Definition at line 197 of file DC_PUSDataReportingPacket.cpp. |
|
Return the number of bytes in the packet definition buffer that were loaded with the last set of consecutive calls to method
Definition at line 192 of file DC_PUSDataReportingPacket.cpp. |
|
Get the maximum size of the packet definition buffer.
Definition at line 314 of file DC_PUSDataReportingPacket.cpp. |
|
Return the maximum number of fixed-length arrays that are allowed in a data reporting packet.
Definition at line 349 of file DC_PUSDataReportingPacket.cpp. |
|
Getter method for the number of fixed-length arrays.
Definition at line 58 of file DC_PUSDataReportingPacket.cpp. |
|
Getter method for the number of parameters to be sampled once per collection interval.
Definition at line 51 of file DC_PUSDataReportingPacket.cpp. |
|
Return the number of bytes that this data reporting packet will provide at the next call of the data acquisition service.
If this method is called at a time other than the end of a collection interval, then its return value is zero. The end of a collection interval is detected by looking at the value of the main counter defined in method
If this method is called at the end of a collection interval (i.e. at a time when the main counter defined in method n1 = sizeof(TD_SID); if (PUS_DATA_REP_MODE) n2 = 1; else n2 = 0; n3 = 0; for (all parameters p in the packet) if (p is of type TD_Float) n3 += (repetition count of p) * sizeof(TD_Float); else n3 += (repetition count of p) * sizeof(TD_Integer); return (n1+n2+n3);The "repetition count" of a parameter is 1 for parameters that are collected only once per cycle and it is as specified by the relevant fixed-length array for over-sampled parameters. If the packet is disabled, then this method returns zero to signify that a disabled packet should not provide any telemetry data.
Implements TelemetryPacket. Definition at line 271 of file DC_PUSDataReportingPacket.cpp. |
|
Get the parameter id of the parPos-th parameter in the faIndex-th fixed length array.
The parameter id is read from the packet definition buffer. The value of
Definition at line 202 of file DC_PUSDataReportingPacket.cpp. |
|
Getter method for the structure identifier (SID) of the data reporting packet.
Definition at line 63 of file DC_PUSDataReportingPacket.cpp. |
|
Return a pointer to start address of the packet value buffer. This method implements the fast version of the data acquisition service. This may be useful (if potentially unsafe) in the case of large packets.
Reimplemented from TelemetryPacket. Definition at line 295 of file DC_PUSDataReportingPacket.cpp. |
|
Return the n-th byte of this data reporting packet. The image of this packet is stored in the packet value buffer. This method therefore simply returns the value of the n-th element of the packet value buffer. Note that this method is independent of whether or not the packet is enabled.
Implements TelemetryPacket. Definition at line 286 of file DC_PUSDataReportingPacket.cpp. |
|
Return the maximum size of the packet value buffer.
Definition at line 328 of file DC_PUSDataReportingPacket.cpp. |
|
Return the enable status of the data reporting packet.
Definition at line 74 of file DC_PUSDataReportingPacket.cpp. |
|
Return
Reimplemented from TelemetryPacket. Definition at line 300 of file DC_PUSDataReportingPacket.cpp. |
|
Perform a class-specific configuration check on the telemetry packet: verify that:.
Reimplemented from PUSTelemetryPacket. Definition at line 354 of file DC_PUSDataReportingPacket.cpp. |
|
Reset the internal state of the data reporting packet. The main counter is initialized to the value of the collection interval. The FA counters are initialized to the value of the repetition counter of their fixed-length array. The component is disabled.
Definition at line 78 of file DC_PUSDataReportingPacket.cpp. |
|
Load the i-the byte of the packet definition buffer. As the packet bytes are loaded, they are interpreted and the internal map of the packet is constructed. This method assumes that the bytes are loaded in sequence starting from the most significant byte of the SID and ending with the least significant byte of the last parameter identifier in the last fixed-length array of the packet. The index i must lie in the interval [0,N-1] where N is the size of the packet definition buffer. If this is not the case, then the method generates an event report EVT_ILLEGAL_PUS_REP_PACKET and returns without taking any further action.
This method, among other things, maintains a counter that keeps track of the number of fixed length arrays that have been loaded. If the number of fixed length arrays exceeds the maximum value set with method
Definition at line 90 of file DC_PUSDataReportingPacket.cpp. |
|
Set the maximum size of the packet definition buffer. This is an initialization method. It should be called only once as part of the component configuration during the application initialization phase. The maximum size should be smaller than 0xFF.
Definition at line 304 of file DC_PUSDataReportingPacket.cpp. |
|
Set the enable status of the data reporting packet.
Definition at line 70 of file DC_PUSDataReportingPacket.cpp. |
|
Set the maximum number of fixed-length arrays that are allowed in a data reporting packet. This is an initialization method. It should be called only once as part of the component configuration during the application initialization phase.
Definition at line 332 of file DC_PUSDataReportingPacket.cpp. |
|
Set the maximum size of the packet value buffer. This is an initialization method. It should be called only once as part of the component configuration during the application initialization phase.
Definition at line 318 of file DC_PUSDataReportingPacket.cpp. |
|
Implement the data update service.
This class maintains a main counter and a a set of FA counters, one for each fixed-length array. After a reset (call to method
Implements TelemetryPacket. Definition at line 212 of file DC_PUSDataReportingPacket.cpp. |