Subversion Repositories Projects

Rev

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