nonin/src/NoninStreamParser.c File Reference

#include "NoninStreamParser.h"
#include <stdio.h>

Go to the source code of this file.

Defines

#define PARSER_STATE_NULL   0x00
#define PARSER_STATE_SYNC   0x01
#define PARSER_STATE_SYNC_CHECK   0x02
#define PARSER_STATE_PLETHMSB   0x03
#define PARSER_STATE_PLETHLSB   0x04
#define PARSER_STATE_DATA   0x05
#define PARSER_STATE_CHKSUM   0x06

Functions

int NONIN_initParser (NoninStreamParser *parser, void(*handleDataValueFunc)(unsigned char frame, unsigned char plethMSB, unsigned char plethLSB, unsigned char data, void *customData), void *customData)
int NONIN_parseByte (NoninStreamParser *parser, unsigned char byte)
int parseFrame (NoninStreamParser *parser)

Define Documentation

#define PARSER_STATE_CHKSUM   0x06

Definition at line 42 of file NoninStreamParser.c.

#define PARSER_STATE_DATA   0x05

Definition at line 41 of file NoninStreamParser.c.

#define PARSER_STATE_NULL   0x00

Definition at line 36 of file NoninStreamParser.c.

#define PARSER_STATE_PLETHLSB   0x04

Definition at line 40 of file NoninStreamParser.c.

#define PARSER_STATE_PLETHMSB   0x03

Definition at line 39 of file NoninStreamParser.c.

#define PARSER_STATE_SYNC   0x01

Definition at line 37 of file NoninStreamParser.c.

#define PARSER_STATE_SYNC_CHECK   0x02

Definition at line 38 of file NoninStreamParser.c.


Function Documentation

int NONIN_initParser ( NoninStreamParser parser,
void(*)(unsigned char frame, unsigned char plethMSB, unsigned char plethLSB, unsigned char data, void *customData)  handleDataValueFunc,
void *  customData 
)
Parameters:
parser Pointer to a NoninStreamParser object.
parserType One of the PARSER_TYPE_* constants defined above: PARSER_TYPE_PACKETS or PARSER_TYPE_2BYTERAW.
handleDataValueFunc A user-defined callback function that will be called whenever a data value is parsed from a Packet.
customData A pointer to any arbitrary data that will also be passed to the handleDataValueFunc whenever a data value is parsed from a Packet.
Returns:
-1 if parser is NULL.
-2 if parserType is invalid.
0 on success.

Definition at line 48 of file NoninStreamParser.c.

int NONIN_parseByte ( NoninStreamParser parser,
unsigned char  byte 
)

Definition at line 69 of file NoninStreamParser.c.

int parseFrame ( NoninStreamParser parser  ) 

Parses each row of data from the packet's Data[] block, updating the fields of data as appropriate.

Definition at line 142 of file NoninStreamParser.c.

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Generated on Fri Oct 15 10:23:38 2010 for Nonin by  doxygen 1.6.3