-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadP1.ino
More file actions
43 lines (38 loc) · 731 Bytes
/
ReadP1.ino
File metadata and controls
43 lines (38 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include "TelegramReader.h"
#include "IHandleValue.h"
#include "MeterDataDescriptor.h"
TelegramContainer telegram;
class BlockPointer:public IBlock
{
public:
BlockPointer(char *start,char *end)
{
_start=start;
_end=end;
}
virtual char *StartOfBlock()const
{
return _start;
}
virtual const char *EndOfBlock()
{
return _end;
}
private:
char *_start;
char *_end;
};
bool readTelegram()
{
TelegramReader reader(&telegram);
if(reader.ReadTelegram())
{
for (auto i=0;i<reader.BlockCount()-1;i++)
{
BlockPointer bp(telegram.GetBlock(i),telegram.GetBlock(i+1)-1);
HandleBlock(&bp);
}
return true;
}
return false;
}