1 #pragma once 2 3 #include "DomoticzHardware.h" 4 #include "hardwaretypes.h" 5 6 class P1MeterBase : public CDomoticzHardwareBase 7 { 8 friend class P1MeterSerial; 9 friend class P1MeterTCP; 10 friend class CRFXBase; 11 public: 12 P1MeterBase(void); 13 ~P1MeterBase(void); 14 15 P1Power m_power; 16 P1Gas m_gas; 17 private: 18 bool m_bDisableCRC; 19 int m_ratelimit; 20 21 unsigned char m_p1version; 22 23 unsigned char m_buffer[1400]; 24 int m_bufferpos; 25 unsigned char m_exclmarkfound; 26 unsigned char m_linecount; 27 unsigned char m_CRfound; 28 29 unsigned char l_buffer[128]; 30 int l_bufferpos; 31 unsigned char l_exclmarkfound; 32 33 unsigned long m_lastgasusage; 34 time_t m_lastSharedSendGas; 35 time_t m_lastUpdateTime; 36 37 float m_voltagel1; 38 float m_voltagel2; 39 float m_voltagel3; 40 41 bool m_bReceivedAmperage; 42 float m_amperagel1; 43 float m_amperagel2; 44 float m_amperagel3; 45 46 float m_powerdell1; 47 float m_powerdell2; 48 float m_powerdell3; 49 50 float m_powerusel1; 51 float m_powerusel2; 52 float m_powerusel3; 53 54 unsigned char m_gasmbuschannel; 55 std::string m_gasprefix; 56 std::string m_gastimestamp; 57 double m_gasclockskew; 58 time_t m_gasoktime; 59 60 void Init(); 61 bool MatchLine(); 62 void ParseP1Data(const unsigned char *pData, const int Len, const bool disable_crc, int ratelimit); 63 64 bool CheckCRC(); 65 }; 66