#include "ThinkGearStreamParser.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_PAYLOAD_LENGTH 0x03 |
| #define | PARSER_STATE_PAYLOAD 0x04 |
| #define | PARSER_STATE_CHKSUM 0x05 |
| #define | PARSER_STATE_WAIT_HIGH 0x06 |
| #define | PARSER_STATE_WAIT_LOW 0x07 |
| #define | PARSER_SYNC_BYTE 0xAA |
| #define | PARSER_EXCODE_BYTE 0x55 |
Functions | |
| int | parsePacketPayload (ThinkGearStreamParser *parser) |
| int | parseDataRow (ThinkGearStreamParser *parser, unsigned char *rowPtr) |
| int | THINKGEAR_initParser (ThinkGearStreamParser *parser, unsigned char parserType, void(*handleDataValueFunc)(unsigned char extendedCodeLevel, unsigned char code, unsigned char numBytes, const unsigned char *value, void *customData), void *customData) |
| int | THINKGEAR_parseByte (ThinkGearStreamParser *parser, unsigned char byte) |
Definition in file ThinkGearStreamParser.c.
| #define PARSER_EXCODE_BYTE 0x55 |
Definition at line 42 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_CHKSUM 0x05 |
Definition at line 34 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_NULL 0x00 |
Definition at line 29 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_PAYLOAD 0x04 |
Definition at line 33 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_PAYLOAD_LENGTH 0x03 |
Definition at line 32 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_SYNC 0x01 |
Definition at line 30 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_SYNC_CHECK 0x02 |
Definition at line 31 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_WAIT_HIGH 0x06 |
Definition at line 37 of file ThinkGearStreamParser.c.
| #define PARSER_STATE_WAIT_LOW 0x07 |
Definition at line 38 of file ThinkGearStreamParser.c.
| #define PARSER_SYNC_BYTE 0xAA |
Definition at line 41 of file ThinkGearStreamParser.c.
| int parseDataRow | ( | ThinkGearStreamParser * | parser, | |
| unsigned char * | rowPtr | |||
| ) |
| int parsePacketPayload | ( | ThinkGearStreamParser * | parser | ) |
Parses each row of data from the packet's Data[] block, updating the fields of data as appropriate.
Definition at line 203 of file ThinkGearStreamParser.c.
| int THINKGEAR_initParser | ( | ThinkGearStreamParser * | parser, | |
| unsigned char | parserType, | |||
| void(*)(unsigned char extendedCodeLevel, unsigned char code, unsigned char numBytes, const unsigned char *value, void *customData) | handleDataValueFunc, | |||
| void * | customData | |||
| ) |
| parser | Pointer to a ThinkGearStreamParser 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. |
parser is NULL. parserType is invalid. Definition at line 54 of file ThinkGearStreamParser.c.
| int THINKGEAR_parseByte | ( | ThinkGearStreamParser * | parser, | |
| unsigned char | byte | |||
| ) |
Feeds the byte into the parser. If the byte completes a complete, valid parser, then the parser's handleDataValue() function is automatically called on each DataRow in the Packet. The return value provides an indication of the state of the parser after parsing the byte.
| parser | Pointer to an initialized ThinkGearDataParser object. | |
| byte | The next byte of the data stream. |
parser is NULL. parser is somehow in an unrecognized state. byte did not yet complete a Packet. Definition at line 89 of file ThinkGearStreamParser.c.
1.6.3