00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 #ifndef NONIN_STREAM_PARSER_H_
00030 #define NONIN_STREAM_PARSER_H_
00031
00032
00033 #include <stdlib.h>
00034
00035
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039
00040
00041 #define PARSER_CODE_HRMSB 0x01
00042 #define PARSER_CODE_HRLSB 0x02
00043 #define PARSER_CODE_SPO2 0x03
00044 #define PARSER_CODE_SREV 0x04
00045 #define PARSER_CODE_RESERVED6 0x05
00046 #define PARSER_CODE_TMRMSB 0x06
00047 #define PARSER_CODE_TMRLSB 0x07
00048 #define PARSER_CODE_STAT2 0x08
00049 #define PARSER_CODE_SPO2D 0x09
00050 #define PARSER_CODE_SPO2FAST 0x10
00051 #define PARSER_CODE_SPO2BB 0x11
00052 #define PARSER_CODE_RESERVED12 0x12
00053 #define PARSER_CODE_RESERVED13 0x13
00054 #define PARSER_CODE_EHRMSB 0x14
00055 #define PARSER_CODE_EHRLSB 0x15
00056 #define PARSER_CODE_ESPO2 0x16
00057 #define PARSER_CODE_ESPO2D 0x17
00058 #define PARSER_CODE_RESERVED18 0x18
00059 #define PARSER_CODE_RESERVED19 0x19
00060 #define PARSER_CODE_HRDMSB 0x20
00061 #define PARSER_CODE_HRDLSB 0x21
00062 #define PARSER_CODE_EHRDMSB 0x22
00063 #define PARSER_CODE_EHRDLSB 0x23
00064 #define PARSER_CODE_RESERVED24 0x24
00065 #define PARSER_CODE_RESERVED25 0x25
00066
00067 #define PARSER_CODE_PLETHMSB 0x26
00068 #define PARSER_CODE_PLETHLSB 0x27
00069
00072 typedef struct _NoninStreamParser {
00073
00074 unsigned char state;
00075 unsigned char frame;
00076
00077 unsigned char sync;
00078 unsigned char dataByte;
00079 unsigned char plethMSBByte;
00080 unsigned char plethLSBByte;
00081
00082 unsigned char opcode;
00083 unsigned char datasize;
00084 unsigned char idcode;
00085
00086 unsigned char chksum;
00087
00088 int check;
00089
00090 void (*handleDataValue)(unsigned char frame,unsigned char plethMSB, unsigned char plethLSB, unsigned char data, void *customData );
00091 void *customData;
00092
00093 } NoninStreamParser;
00094
00111 int NONIN_initParser( NoninStreamParser *parser,
00112 void (*handleDataValueFunc)(unsigned char frame,unsigned char plethMSB, unsigned char plethLSB, unsigned char data, void *customData),
00113 void *customData );
00114
00115 int NONIN_parseByte( NoninStreamParser *parser, unsigned char byte );
00116
00117 int parseFrame( NoninStreamParser *parser );
00118
00119
00120 #ifdef __cplusplus
00121 }
00122 #endif
00123
00124 #endif