Critical Link MityCam SoC Firmware  1.0
Critical Link MityCam SoC Firmware
tcCamParser Class Reference

#include <CamParser.h>

Inheritance diagram for tcCamParser:
Collaboration diagram for tcCamParser:

Public Member Functions

 tcCamParser (char *apMsgBuf, int len, bool CheckSumRequired=true)
 
virtual ~tcCamParser (void)
 
virtual bool ResetParser (char *apOutBuf=NULL, int anOutBufLen=0)
 
virtual int AddData (void *apData, int anLength)
 
virtual unsigned int ComputeChecksum (tsMsgHeader *apMessage, void *apPayload=NULL, int anPayloadLen=0)
 
virtual void PrepareOutput (tsMsgHeader *apMessage, void *apPayload=NULL, int anPayloadLen=0)
 
virtual void EnableChecksum (bool abEnable)
 
- Public Member Functions inherited from SocCamera::tcDspParserBase
 tcDspParserBase (char *apOutBuf=NULL, int anOutBufLen=4096)
 
virtual ~tcDspParserBase ()
 
virtual void RegisterCallback (tfParserCallback afCallback, void *apUser=NULL)
 

Protected Types

enum  teMsgState {
  eeSyncSearch, eeProcessHeader, eeProcessBody, eeMessageComplete,
  eeRecordBusted
}
 

Protected Attributes

teMsgState meState
 Current state of the parser. More...
 
unsigned int mnOutOffset
 Current offset in the output buffer. More...
 
unsigned int mnMaxPayload
 Maximum message payload length (bytes) More...
 
unsigned char mnSeqNum
 Output sequence number. More...
 
bool mbCheckSumRqd
 True if checksums should be used. More...
 
- Protected Attributes inherited from SocCamera::tcDspParserBase
tfParserCallback mfCallback
 Storage for parser callback. More...
 
C_SECT mhMutex
 Semaphore to serialize access. More...
 
bool mbStorageCreated
 Indicates whether out buf created. More...
 
char * mpOutBuf
 Pointer to output storage. More...
 
int mnOutBufLen
 Current bytes written to output. More...
 
unsigned int mnChecksum
 Storage to accumulate checksum. More...
 
char * maLineBuffer
 (or other entities) to parse. More...
 
int mnLineBufLen
 Length of line buffer. More...
 
int mnLinePos
 Working position in the line buffer. More...
 
void * mpUserParameter
 User-provided parameter to callback. More...
 

Additional Inherited Members

- Public Types inherited from SocCamera::tcDspParserBase
enum  teDspParseStatus {
  eeParseOK = 0, eeParseChecksumErr = -1, eeParseSyncErr = -2, eeParseBustedMsg = -3,
  eeParseTooBigErr = -4, eeBaseLast = -5
}
 possible return status' More...
 
typedef bool(* tfParserCallback) (int, void *, int, unsigned int, void *)
 
- Public Attributes inherited from SocCamera::tcDspParserBase
unsigned int mnBytesRead
 Bytes passed to parser. More...
 
unsigned int mnBytesWritten
 Bytes written to buffer. More...
 
unsigned int mnGoodMsgs
 Count of valid messages decoded. More...
 
unsigned int mnBadMsgs
 Count of bad messages. More...
 
unsigned int mnSyncErrs
 Number of synchronization errors. More...
 
unsigned int mnChecksumErrs
 Number of checksum errors. More...
 
- Protected Member Functions inherited from SocCamera::tcDspParserBase
int AssembleLine (void *apInput, int anLength, bool &arLineComplete)
 
char AsciiHexDigitVal (char anHexdigit)
 

Member Enumeration Documentation

◆ teMsgState

enum tcCamParser::teMsgState
protected
Enumerator
eeSyncSearch 
eeProcessHeader 
eeProcessBody 
eeMessageComplete 
eeRecordBusted 

Constructor & Destructor Documentation

◆ tcCamParser()

tcCamParser::tcCamParser ( char *  apMsgBuf,
int  len,
bool  CheckSumRequired = true 
)

◆ ~tcCamParser()

tcCamParser::~tcCamParser ( void  )
virtual

Member Function Documentation

◆ AddData()

int tcCamParser::AddData ( void *  apData,
int  anLength 
)
virtual

This routine is used to add data to the parser. In the base class, this is simply a "passthrough"... the input data is taken as a complete message and is passed to the callback. If the input fits in the output, the status is eeParseOK, otherwise eeParseTooBigErr.

Parameters
[in]apDataPointer to new data
[in]anLengthLength of new data
Returns
Integer number of messages completed this call.
See also
DspParserBase.h

Reimplemented from SocCamera::tcDspParserBase.

◆ ComputeChecksum()

unsigned int tcCamParser::ComputeChecksum ( tsMsgHeader apMessage,
void *  apPayload = NULL,
int  anPayloadLen = 0 
)
virtual

◆ EnableChecksum()

void tcCamParser::EnableChecksum ( bool  abEnable)
virtual

◆ PrepareOutput()

void tcCamParser::PrepareOutput ( tsMsgHeader apMessage,
void *  apPayload = NULL,
int  anPayloadLen = 0 
)
virtual

◆ ResetParser()

bool tcCamParser::ResetParser ( char *  apOutBuf = NULL,
int  anOutBufLen = 0 
)
virtual

This routine is used to reset a parser to an initialized state. A new output buffer may optionally be provided.

Parameters
[in]apOutBufAddress of new parser output buffer (default: NULL)
[in]anOutBufLenLength of new output buffer (default: 0)
Returns
True, if successful.
See also
DspParserBase.h

Reimplemented from SocCamera::tcDspParserBase.

Member Data Documentation

◆ mbCheckSumRqd

bool tcCamParser::mbCheckSumRqd
protected

True if checksums should be used.

◆ meState

teMsgState tcCamParser::meState
protected

Current state of the parser.

◆ mnMaxPayload

unsigned int tcCamParser::mnMaxPayload
protected

Maximum message payload length (bytes)

◆ mnOutOffset

unsigned int tcCamParser::mnOutOffset
protected

Current offset in the output buffer.

◆ mnSeqNum

unsigned char tcCamParser::mnSeqNum
protected

Output sequence number.


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