F´ Flight Software - C/C++ Documentation
devel
A framework for building embedded system applications to NASA flight quality standards.
|
Svc::DpWriter
is an active component for writing data products to disk. It does the following:
DpWriter
.Requirement | Description | Rationale | Verification Method |
---|---|---|---|
SVC-DPWRITER-001 | Svc::DpWriter shall provide a port for receiving Fw::Buffer objects pointing to filled data product containers. | The purpose of DpWriter is to write the data products to disk. | Unit Test |
SVC-DPWRITER-002 | Svc::DpWriter shall provide an array of ports for sending Fw::Buffer objects for processing. | This requirement supports downstream processing of the data in the buffer. | Unit Test |
SVC-DPWRITER-003 | On receiving a data product container C, Svc::DpWriter shall use the processing type field of the header of C to select zero or more processing ports to invoke, in port order. | The processing type field is a bit mask. A one in bit 2^n in the bit mask selects port index n . | Unit Test |
SVC-DPWRITER-004 | On receiving an Fw::Buffer B, and after performing any requested processing on B, Svc::DpWriter shall write B to disk. | The purpose of DpWriter is to write data products to the disk. | Unit Test |
SVC-DPWRITER-005 | Svc::DpWriter shall provide a port for notifying other components that data products have been written. | This requirement allows Svc::DpCatalog or a similar component to update its catalog in real time. | Unit Test |
SVC-DPWRITER-006 | Svc::DpManager shall provide telemetry that reports the number of buffers received, the number of data products written, the number of bytes written, the number of failed writes, and the number of errors. | This requirement establishes the telemetry interface for the component. | Unit test |
The diagram below shows the DpWriter
component.
DpWriter
has the following ports:
Kind | Name | Port Type | Usage |
---|---|---|---|
async input | schedIn | Svc.Sched | Schedule in port |
async input | bufferSendIn | Fw.BufferSend | Port for receiving data products to write to disk |
output | procBufferSendOut | [DpWriterNumProcPorts] Fw.BufferSend | Port for processing data products |
output | dpWrittenOut | DpWritten | Port for sending DpWritten notifications |
output | deallocBufferSendOut | Fw.BufferSend | Port for deallocating data product buffers |
time get | timeGetOut | Fw.Time | Time get port |
telemetry | tlmOut | Fw.Tlm | Telemetry port |
event | eventOut | Fw.Log | Event port |
text event | textEventOut | Fw.LogText | Text event port |
DpWriter
maintains the following state:
numDataProducts (U32)
: The number of data products written.numBytes (U64)
: The number of bytes written.DpWriterNumProcPorts
specifies the number of ports for connecting components that perform processing.DP_FILENAME_FORMAT
specifies the file name format.You can call the configure
function to supply the DP file name prefix. This is the prefix used when constructing names of files to write. For more information about the file name format, see the File Format section.
If you do not call the configure
function, then the default DP file name prefix is the empty string.
This handler sends out the state variables as telemetry.
This handler receives a mutable reference to a buffer B
. It does the following:
B
is valid. If not, emit a warning event.B
is large enough to hold a data product container packet. If not, emit a warning event.B
can be successfully deserialized. If not, emit a warning event.B
is valid. If not, emit a warning event.ProcType
field out of the container header stored in the memory pointed to by B
. Let the resulting bit mask be M
.procBufferSendOut
in order. For each port number N
, if N
is set in M
, then invoke procBufferSendOut
at port number N
, passing in B
. This step updates the memory pointed to by B
in place.B
to a file, using the format described in the File Format section. For the time stamp, use the time provided by timeGetOut
.dpWrittenOut
is connected, then send the file name, priority, and file size out on dpWrittenOut
.B
is valid, then send B
on deallocBufferSendOut
.Each file stores a serialized data product record, with the format described in the data products documentation.
The name of each file is formatted with the configurable format string DP_FILENAME_FORMAT
. The format string must contain format specifications for the following arguments, in order.
Format Specifier | Type |
---|---|
The DP file name prefix | s |
Container ID | PRI_FwDpIdType |
Time seconds | PRI_u32 |
Time microseconds | PRI_u32 |
The exact meaning of the DP file name prefix depends on the format string. Typically it is a directory path prefix.
Kind | Name | Description |
---|---|---|
async | CLEAR_EVENT_THROTTLE | Clear event throttling |
Name | Type | Description |
---|---|---|
NumDataProducts | U32 | The number of data products handled |
NumBytes | U64 | The number of bytes handled |
Name | Severity | Description |
---|---|---|
BufferInvalid | warning high | Incoming buffer is invalid |
BufferTooSmall | warning high | Incoming buffer is too small to hold a data product container |
InvalidPacketDescriptor | warning high | Incoming buffer has an invalid packet descriptor |
FileOpenError | warning high | An error occurred when opening a file |
FileWriteError | warning high | An error occurred when writing to a file |
The following topology diagram shows how to connect Svc::DpWriter
to a DpManager
component and a processor component. The diagrams use the following instances:
dpManager
: An instance of `Svc::DpManager`.dpProcessor
: A component that processes data product containers.dpWriter
: An instance of Svc::DpWriter
.producer
: A component that produces data products.The following diagram shows what happens when a buffer is sent to DpWriter
, is processed, and is written to disk.