Subversion Repositories Projects

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1702 - 1
#ifndef __EOSEVENTPARSER_H__
2
#define __EOSEVENTPARSER_H__
3
 
4
#include <inttypes.h>
5
#include <avr/pgmspace.h>
6
#include <ptpcallback.h>
7
#include <canoneos.h>
8
 
9
 
10
struct EOSParamValues
11
{
12
        uint8_t         upperValue;
13
        uint8_t         currentValue;
14
        uint8_t         lowerValue;
15
};
16
 
17
#define MAX_OBJ_IN_LIST         8
18
 
19
class EOSEventParser : public PTPReadParser
20
{
21
        const uint16_t          constInitialEventCode;
22
 
23
        uint8_t                         paramsChanged;
24
 
25
        struct EOSEvent
26
        {
27
                uint16_t        eventCode;
28
                uint16_t        propCode;
29
                uint32_t        propValue;
30
        };
31
 
32
        uint8_t                                 nStage;
33
        uint8_t                                 nRecStage;
34
        uint16_t                                nRecSize;
35
        MultiValueBuffer                        theBuffer;
36
        uint32_t                                varBuffer;
37
        EOSEvent                                eosEvent;
38
        uint16_t                                paramCountdown;
39
        uint16_t                                paramCount;
40
 
41
        MultiByteValueParser                    valueParser;
42
        ByteSkipper                             byteSkipper;
43
 
44
        bool EventRecordParse(uint8_t **pp, uint16_t *pcntdn);
45
        bool IsLastEventRecord() { return (eosEvent.eventCode == 0); };
46
        void InitEOSEventStruct();
47
 
48
public:
49
        EOSEventParser() :
50
                constInitialEventCode(0xFFFF),
51
                nStage(0),
52
                nRecStage(0),
53
                nRecSize(0),
54
                varBuffer(0),
55
                paramCountdown(0),
56
                paramsChanged(0)
57
                {
58
                        theBuffer.pValue = &varBuffer;
59
                };
60
 
61
        void Reset()
62
        {
63
                nStage                  = 0;
64
                nRecStage               = 0;
65
                nRecSize                = 0;
66
                varBuffer               = 0;
67
                paramCountdown  = 0;
68
                paramsChanged   = 0;
69
        };
70
 
71
        virtual void Parse(const uint16_t len, const uint8_t *pbuf, const uint32_t &offset);
72
};
73
 
74
#endif // __EOSEVENTPARSER_H__