F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Svc::FrameDetector Class Referenceabstract

interface class used to codify what must be supported to allow frame detection More...

#include <Svc/FrameAccumulator/FrameDetector.hpp>

Inheritance diagram for Svc::FrameDetector:
Svc::FrameDetectors::CcsdsTcFrameDetector Svc::FrameDetectors::FprimeFrameDetector

Public Types

enum  Status { FRAME_DETECTED, NO_FRAME_DETECTED, MORE_DATA_NEEDED }
 status returned from the detection step More...
 

Public Member Functions

virtual ~FrameDetector ()=default
 virtual destructor More...
 
virtual Status detect (const Types::CircularBuffer &data, FwSizeType &size_out) const =0
 detect if a frame is available within the circular buffer More...
 

Detailed Description

interface class used to codify what must be supported to allow frame detection

Definition at line 14 of file FrameDetector.hpp.

Member Enumeration Documentation

◆ Status

status returned from the detection step

Enumerator
FRAME_DETECTED 

Frame detected. Extract frame and return with new data.

NO_FRAME_DETECTED 

No frame detected. Discard data and return with new data.

MORE_DATA_NEEDED 

More data is needed to detect a frame. Keep current data and return with more.

Definition at line 17 of file FrameDetector.hpp.

Constructor & Destructor Documentation

◆ ~FrameDetector()

virtual Svc::FrameDetector::~FrameDetector ( )
virtualdefault

virtual destructor

Member Function Documentation

◆ detect()

virtual Status Svc::FrameDetector::detect ( const Types::CircularBuffer data,
FwSizeType size_out 
) const
pure virtual

detect if a frame is available within the circular buffer

Function implemented by sub classes used to determine if a frame is available at the current position of the circular buffer. Implementors should detect if a frame is available, set size_out, and return a status while following these expectations:

  1. FRAME_DETECTED status implies a frame is available at the current offset of the circular buffer. size_out must be set to the size of the frame from that location.
  2. NO_FRAME_DETECTED status implies no frame is possible at the current offset of the circular buffer. e.g. no start word is found at the current offset. size_out is ignored.
  3. MORE_DATA_NEEDED status implies that a frame might be possible but more data is needed before a determination is possible. size_out must be set to the total amount of data needed.

    For example, if a frame start word is 4 bytes, and 3 bytes are available in the circular buffer then the return status would be NO_FRAME_DETECTED and size_out must be set to 4 to ensure that at least the start word is available.

Parameters
datacircular buffer with read-only access
size_outset as output to caller indicating size when appropriate
Returns
status of the detection to be paired with size_out

Implemented in Svc::FrameDetectors::FprimeFrameDetector, and Svc::FrameDetectors::CcsdsTcFrameDetector.


The documentation for this class was generated from the following file: