/**
* #define for all files StromLog
* Version 5.01
* 20.11.2022 P. Rebesky
* author Creator P.Rebesky
* Copyright (©): 2022-2024 by Peter Rebesky
* This code can use in private cases only. Every business or companies using of this codes or codes parts is required an approval of us (me)
* Every private using can exchange some parts of code or modify some code-lines. This code is allowed change for private use only.
* This software is basicly owned by Peter Rebesky and any comercial using is forbidden without approval of us (me).
**/
//*** here select the meter by define target type
#ifndef GLOBAL_H_
#define GLOBAL_H_
//#define SML_DIN
#define VDE_DIN
//#define LG_E350
//#define ISKRA_MT174
//#define ZE311_DR
//*** select meter end ***
#define _BOARDTASTER 0
#define _LED 14
#define _RECEIVE485 12
#define _ON 1
#define _OFF 0
#define _FLASHTIME 300
#define _MESZ 0 // summer-time = 1 else winter-time = 0
#define _UTCOFFSET 3600
#define _MAXBUFFER 800 // maximum buffer for received bytes
#define _POLYNOM 0x1021 // x16 + x12 + x5 + 1 0x1021
#define _TIMEOF2021 1640998800
#define _WATT 0x1b
#define _VOLTAMP 0x1c
#define _VAR 0x1d
#define _WATTH 0x1e
#define _VOLTAMPH 0x1f
#define _VARH 0x20
#define _AMPERE 0x21
#define _VOLTAGE 0x23
#define _HERTZ 0x2c
#define _YEAR 0
#define _MONTH 1
#define _DAY 2
#define _HOUR 3
#define _MINUTE 4
#define _SECOND 5
#define _ADJUST_HTTP 1000
#define _ADJUST_HTTPS 982
#define _U_L1 0
#define _U_L2 1
#define _U_L3 2
#define _I_L1 3
#define _I_L2 4
#define _I_L3 5
#define _P_L1 6
#define _P_L2 7
#define _P_L3 8
#define _CONSUMPTION 9
#define _FREQ 10
#define _FROMGRID_0 0
#define _FROMGRID_1 1
#define _FROMGRID_2 2
#define _FEEDIN 3
#define _MID0 0
#define _MID1 1
#define _MID2 2
#define _DETECT_prot 0
#define _SML_prot 1
#define _DIN_prot 2
const char HTTP_ANSWER[] = "HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n"; //header of http without mixed content
const char HTTP_ANSWERJSON[] = "HTTP/1.1 200 OK\r\nAccess-Control-Allow-Origin: *\r\nContent-Type: text/json\r\n\r\n"; //header of http with mixed content, only for JSON
const char HTTP_ANSWER_LENGTH[] = "Content-length: \r\n";
const char HTTP_HEAD_DTZ[] = "\r\n\r\n
";
const char HTTP_HEAD_DTZ_REFRESH[] = "\r\n\r\n";
const char HTTP_BODYSTYLE_DTZ[] = "";
const char HTTP_SETUP_BUTTON[] = "
";
const char HTTP_DIV_FIELD[] = "";
const char HTTP_TEXT_END[] ="
\n";
//const char HTTP_JS_SCRIPT[] PROGMEM ="";
String GENERETIC = "Generetic SML-Protokol";
String NOT_DETECT = "Zähler nicht erkannt";
const byte DaysPerMonth[] = {31,28,31,30,31,30,31,31,30,31,30,31};
char OBISoutGridS[]= {0x77,0x07,0x01,0x00,0x01,0x08,0x00,0xff};
char OBISoutGridA[]= {0x77,0x07,0x01,0x00,0x01,0x08,0x01,0xff};
char OBISoutGridB[]= {0x77,0x07,0x01,0x00,0x01,0x08,0x02,0xff};
char OBISintoGrid[]= {0x77,0x07,0x01,0x00,0x02,0x08,0x00,0xff};
char OBIS_Watt[]= {0x77,0x07,0x01,0x00,0x10,0x07,0x00,0xff};
char OBIS_WattA[]= {0x77,0x07,0x01,0x00,0x0f,0x07,0x00,0xff};
char OBIS_WattD[]= {0x77,0x07,0x01,0x00,0x24,0x07,0x00,0xff}; // DZG
char OBIS_U_L1[]= {0x77,0x07,0x01,0x00,0x20,0x07,0x00,0xff};
char OBIS_U_L2[]= {0x77,0x07,0x01,0x00,0x34,0x07,0x00,0xff};
char OBIS_U_L3[]= {0x77,0x07,0x01,0x00,0x48,0x07,0x00,0xff};
char OBIS_I_L1[]= {0x77,0x07,0x01,0x00,0x1f,0x07,0x00,0xff};
char OBIS_I_L2[]= {0x77,0x07,0x01,0x00,0x33,0x07,0x00,0xff};
char OBIS_I_L3[]= {0x77,0x07,0x01,0x00,0x47,0x07,0x00,0xff};
char OBIS_P_L1[]= {0x77,0x07,0x01,0x00,0x24,0x07,0x00,0xff};
char OBIS_P_L2[]= {0x77,0x07,0x01,0x00,0x38,0x07,0x00,0xff};
char OBIS_P_L3[]= {0x77,0x07,0x01,0x00,0x4c,0x07,0x00,0xff};
char OBIS_Freq[]= {0x77,0x07,0x01,0x00,0x0e,0x07,0x00,0xff};
char OBIS_DTZ_ID[]= {0x77,0x07,0x01,0x00,0x60,0x01,0x00,0xff};
char OBIS_Manuf[]= {0x77,0x07,0x01,0x00,0x60,0x32,0x01,0x01};
char OBIS_ServerID[]= {0x77,0x07,0x01,0x00,0x00,0x00,0x09,0xff};
char ProtBegin[]={0x1b, 0x1b, 0x1b, 0x01, 0x01};
// char SetBaud19200[] = {0x06,0x30,0x36,0x30,0x0d,0x0a,0x00}; // 6
// char SetBaud9600[] = {0x06,0x30,0x35,0x30,0x0d,0x0a,0x00}; // 5
// char SetBaud4800[] = {0x06,0x30,0x34,0x30,0x0d,0x0a,0x00}; // 4
// char SetBaud2400[] = {0x06,0x30,0x33,0x30,0x0d,0x0a,0x00}; // 3
// char SetBaud1200[] = {0x06,0x30,0x32,0x30,0x0d,0x0a,0x00}; // 2
int _date_time[6]; //[_YEAR][_MONTH][_DAY][_HOUR][_MINUTE][_SECOND]
int _act_date_time[6]; //[_YEAR][_MONTH][_DAY][_HOUR][_MINUTE][_SECOND]
int _ShowProtocolTime = 0;
uint32_t _timestamp = 0;
uint32_t _previousMillis = 0;
uint32_t _secondMillis =0;
int _httpMarker = 0;
int _flashCounter = 0;
uint _secAdjust=1000;
int _serialType = 0;
bool _sendingOK = false;
char _receivedByte[2];
int _dataPointer = 0;
char _dataDTZ[_MAXBUFFER];
String _transmitResult;
#endif //***GLOBAL_H_