#include <DC_BasicPUSTcLoader.h>
Inheritance diagram for DC_BasicPUSTcLoader:

This telecommand loader can handle one or more raw telecommand packets. At the time it is activated, it assumes the packets to be placed in a dedicated memory area (the telecommand load area) and assumes their layout to comply with the layout for telecommand packets stipulated by the PUS. The packets are assumed to be placed in the telecommand area in sequence, one after the other. The layout of the telecommand load area is therefore assumed to be as follows. The first byte represents the number of telecommand packets. Successive bytes represent the telecommand packets stored in sequence and without gaps in between successive packets.
When the telecommand loader is activated, it accesses the telecommand load area and processes the telecommand packets one by one. For each packet, it retrieves the telecommand type and subtype. It then asks the telecommand factory for a telecommand component of matching type, it configures it with the data in the telecommand load area, and finally loads the newly configured component in the telecommand manager.
In a typical usage scenario, this component would be activated periodically to process any telecommand packets that have been received in the previous period. In an alternative scenario, the component is activated by an interrupt handler when reception of a new telecommand packet has been detected. Note however that the processing of a telecommand packet by this component can be time-consuming and hence this alternative scenario only is feasible if the time between successive telecommand interrupts is sufficiently long.
This telecommand loader is configured with the starting address of the telecommand load area (method setTcLoadAreaStart), with the maximum length of a telecommand packet (method setMaxTcLength), and with the maximum number of telecommand packets that can be placed in the telecommand load area (method setMaxNumberOfTc). All configuration parameters can be changed dynamically.
This telecommand loader does not perform any consistency or validity checks on the raw telecommand data other than verifying that the length of the telecommand packet is less than the maximum value set with method setMaxTcLength and that the number of telecommands is less than the maximum set with method setMaxNumberOfTc.
Definition at line 69 of file DC_BasicPUSTcLoader.h.
Public Member Functions | |
| DC_BasicPUSTcLoader (void) | |
| Instantiate a basic PUS telecommand loader. | |
| virtual void | activate (void) |
| Retrieve the raw telecommand packet data, create and configure a telecommand component for each telecommand packet, and load them in the telecommand manager. | |
| virtual void | release (Telecommand *pTelecommand) |
| Change the status of the telecommand to "not in use". | |
| void | setTcLoadAreaStart (unsigned char *startAddress) |
| Set the start address of the telecommand load area. | |
| void | setMaxTcLength (unsigned int maxTcLength) |
| Set the maximum length of a telecommand packet in number of bytes. | |
| unsigned int | getMaxTcLength (void) const |
| Getter method for the maximum length of the a telecommand packet. | |
| void | setMaxNumberOfTc (unsigned int max) |
| Set the maximum number of telecommand packets that can be handled by this component in an activation cycle. | |
| unsigned int | getMaxNumberOfTc (void) const |
| Getter method for the maximum number of telecommand packets that can be handled by this component in an activation cycle. | |
| virtual bool | isObjectConfigured (void) |
| Perform a class-specific configuration check on the telecommand loader: verify that the start address of the telecommand load area, the maximum length of the telecommand packet have been set, and the maximum number of telecommand packets have been set. | |
|
|
Instantiate a basic PUS telecommand loader. The class identifier is set. The start address of the telecommand area, the maximum length of the telecommand packets, and the maximum number of telecommand packets are initialized to illegal values to signify that the component is not yet configured. Definition at line 23 of file DC_BasicPUSTcLoader.cpp. |
|
|
Retrieve the raw telecommand packet data, create and configure a telecommand component for each telecommand packet, and load them in the telecommand manager. The raw telecommand packet data are assumed to consist of an array of bytes stored in the telecommand load area. Their layout is assumed to conform with the PUS telecommand packet layout. A pseudo-code implementation for this method is as follows:
pTcFct = ... // retrieve telecommand factory
for each tc packet in the tc load area {
if (APID of TC telecommand does not match APID of this application)
continue;
tcType = ... // read telecommand type from data in telecommand area
tcSubType = ... // read telecommand subtype from data in telecommand area
if (tcType=TYPE_1 and tcSubType=SUBTYPE_a) {
... // retrieve TC component of matching type and subtype from pTcFct
... // configure the TC component
... // load TC packet data into TC component
getTelecommandManager()->load(...); // load telecommand component
}
if (tcType=TYPE_2 and tcSubType=SUBTYPE_b) {
... // retrieve TC component of matching type and subtype from pTcFct
... // configure the TC component
... // load TC packet data into TC component
getTelecommandManager()->load(...); // load telecommand component
}
...
} The loading of telecommand packet data into the TC component is done using the raw data load service. Depending on the telecommand type, either the fast or the safe version of the service is used. The check on APID is performed by comparing the packet ID field in the telecommand packet with the packet ID of the telecommand components as returned by method getPacketId. If the two values do not match, it is assumed that the telecommand packet is intended for some other application and it is simply ignored. For simplicity, the pseudo-code above does not consider error cases. Error cases result in the generation of an error report and in the immediate return of the method. The following error cases are handled:
sizeof(TD_TelecommandSource) the packet error control field is assumed to be 2-byte wide but is ignored. Error checking is assumed to have already been performed upstream
Implements TelecommandLoader. Definition at line 30 of file DC_BasicPUSTcLoader.cpp. |
|
|
Getter method for the maximum number of telecommand packets that can be handled by this component in an activation cycle.
Definition at line 145 of file DC_BasicPUSTcLoader.cpp. |
|
|
Getter method for the maximum length of the a telecommand packet.
Definition at line 136 of file DC_BasicPUSTcLoader.cpp. |
|
|
Perform a class-specific configuration check on the telecommand loader: verify that the start address of the telecommand load area, the maximum length of the telecommand packet have been set, and the maximum number of telecommand packets have been set.
Reimplemented from TelecommandLoader. Definition at line 149 of file DC_BasicPUSTcLoader.cpp. |
|
|
Change the status of the telecommand to "not in use". A pseudo-code implementation for this method is as follows:
pTelecommand->setInUse(NOT_IN_USE);
Implements TelecommandLoader. Definition at line 118 of file DC_BasicPUSTcLoader.cpp. |
|
|
Set the maximum number of telecommand packets that can be handled by this component in an activation cycle.
Definition at line 140 of file DC_BasicPUSTcLoader.cpp. |
|
|
Set the maximum length of a telecommand packet in number of bytes. The value set here is the total length of the packet including its header. Only values greater than 6 are legal (a PUS header is 6 bytes long).
Definition at line 131 of file DC_BasicPUSTcLoader.cpp. |
|
|
Set the start address of the telecommand load area.
Definition at line 126 of file DC_BasicPUSTcLoader.cpp. |