supla-device
Loading...
Searching...
No Matches
afore.h
1/*
2 Copyright (C) AC SOFTWARE SP. Z O.O.
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17*/
18
19#ifndef SRC_SUPLA_PV_AFORE_H_
20#define SRC_SUPLA_PV_AFORE_H_
21
22#include <IPAddress.h>
23#include <supla/sensor/one_phase_electricity_meter.h>
24#include <supla/network/client.h>
25
26#define LOGIN_AND_PASSOWORD_MAX_LENGTH 100
27
28namespace Supla {
29namespace PV {
31 public:
32 Afore(IPAddress ip, int port, const char *loginAndPassword);
33 void readValuesFromDevice();
34 void iterateAlways();
35 bool iterateConnected();
36
37 protected:
38 ::Supla::Client *client = nullptr;
39 IPAddress ip;
40 int port;
41 char loginAndPassword[LOGIN_AND_PASSOWORD_MAX_LENGTH];
42 char buf[80];
43 unsigned _supla_int64_t totalGeneratedEnergy;
44 _supla_int_t currentPower;
45 int bytesCounter;
46 int retryCounter;
47 bool vFound;
48 bool varFound;
49 bool dataIsReady;
50 bool dataFetchInProgress;
51 uint32_t connectionTimeoutMs;
52};
53}; // namespace PV
54}; // namespace Supla
55
56#endif // SRC_SUPLA_PV_AFORE_H_
Definition ip_address.h:30
Definition client.h:31
bool iterateConnected()
Method called on each SuplaDevice iteration when device is connected and registered to Supla server o...
Definition afore.cpp:119
void iterateAlways()
Method called on each SuplaDevice iteration.
Definition afore.cpp:51
Definition one_phase_electricity_meter.h:26