forked from roarfred/AmsToMqttBridge
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathKaifaHan.h
73 lines (64 loc) · 1.48 KB
/
KaifaHan.h
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#ifndef _KAIFAHAN_h
#define _KAIFAHAN_h
#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#else
#include "WProgram.h"
#endif
class KaifaHan
{
public:
byte GetListID(byte *buffer, int start, int length);
long GetPackageTime(byte *buffer, int start, int length);
int GetInt(int dataPosition, byte *buffer, int start, int length);
String GetString(int dataPosition, byte *buffer, int start, int length);
protected:
private:
int findValuePosition(int dataPosition, byte *buffer, int start, int length);
time_t toUnixTime(int year, int month, int day, int hour, int minute, int second);
};
enum class List : byte {
ListUnknown = 0x00,
List1 = 0x01,
List2 = 0x0D,
List3 = 0x12
};
enum class List1_ObisObjects {
ActivePowerImported
};
enum class List2_ObisObjects {
ObisListVersionIdentifier,
MeterID,
MeterType,
ActivePowerImported,
ActivePowerExported,
ReactivePowerImported,
ReactivePowerExported,
CurrentPhaseL1,
CurrentPhaseL2,
CurrentPhaseL3,
VoltagePhaseL1,
VoltagePhaseL2,
VoltagePhaseL3
};
enum class List3_ObisObjects {
ObisListVersionIdentifier,
MeterID,
MeterType,
ActivePowerImported,
ActivePowerExported,
ReactivePowerImported,
ReactivePowerExported,
CurrentPhaseL1,
CurrentPhaseL2,
CurrentPhaseL3,
VoltagePhaseL1,
VoltagePhaseL2,
VoltagePhaseL3,
ClockAndDate,
TotalActiveEnergyImported,
TotalActiveEnergyExported,
TotalReactiveEnergyImported,
TotalReactiveEnergyExported
};
#endif