#ifndef SKETCH_H
#define SKETCH_H 1

//Server actions PE
#define LED_OFF 20
#define LED_ON  21

// M3-Board
#define M3_REQUEST  19
#define LED1  11
#define LED2  12
#define LED3  13
#define LED4  14

// Bertl
#define MV 85
#define TL 86
#define TR 87
#define FL 88

//Server actions
#define SET_LED_OFF 0
#define SET_LED_ON  1
#define BLINK_LED  2
#define Get_SENSORS 3
#define ARDUINO_REQUEST 4
#define SET_HTTP_ON 5
#define SET_MQTTSSL_ON 6
#define ESP12F 7			// PE
#define M3 8				// PE
#define M0 9				// PE
#define Bertl 10			// PE max: 10
#define INVALID_REQUEST 99

//Server Type
#define SVR_MQTT 0
#define SVR_HTTP_LIB 1
#define SVR_HTTP_SDK 2	// default
#define SVR_COAP 3
#define SVR_NONE 10

//Reply Type
#define REPLY_JSON 0
#define REPLY_TEXT 1

//Set this to desired server type (see above 4 types)
#define SVR_TYPE SVR_HTTP_SDK	
//#define SVR_TYPE SVR_HTTP_LIB // PE es ist nicht der Server sondern die Serielle!!!
#define MQTT_SVR_ENABLE 1
#define COAP_SVR_ENABLE 0

//JSON string type
#define ONEJSON 0
#define FIRSTJSON 1
#define NEXTJSON 2
#define LASTJSON 3

//GPIO pin assignments
#define AMUXSEL0 14     // AMUX Selector 0
#define AMUXSEL1 12     // AMUX Selector 1
#define AMUXSEL2 13     // AMUX Selector 2

//#define LED_IND 16      // LED used for initial code testing (not included in final hardware design)
// PE: ------------------------------------------
#define LED_IND 2       // nodeMCU 1.0 Pin 5 (D1) blue indicator LED on ESP-12
#define DHTPIN 14       // ESP12F
#define LDR A0			// ESP12F
#define RED  15			// ESP12F
#define GREEN  12		// ESP12F
#define BLUE 13			// ESP12F
#define BUTTON 4		// ESP12F
// PE: ------------------------------------------

#define URLSize 32
#define DATASize 32

#define EEPROM_INIT 1 // PE: disable the initialization EEPROM writes set to 0; 1 = the EEPROM is set as needed
#define EEPROM_WIFISSID 0x10
#define EEPROM_WIFIPASS 0x30
#define EEPROM_WIFI_IP0 0x40
#define EEPROM_WIFI_IP1 0x41
#define EEPROM_WIFI_IP2 0x42
#define EEPROM_WIFI_IP3 0x43
#define EEPROM_WIFI_NM0 0x44
#define EEPROM_WIFI_NM1 0x45
#define EEPROM_WIFI_NM2 0x46
#define EEPROM_WIFI_NM3 0x47
#define EEPROM_WIFI_GW0 0x48
#define EEPROM_WIFI_GW1 0x49
#define EEPROM_WIFI_GW2 0x4A
#define EEPROM_WIFI_GW3 0x4B
#define EEPROM_WIFI_AP0 0x4C
#define EEPROM_WIFI_AP1 0x4D
#define EEPROM_WIFI_AP2 0x4E
#define EEPROM_WIFI_AP3 0x4F
#define EEPROM_SVR_PORT 0x50
#define EEPROM_MQTT_BK  0x60
#define EEPROM_MQTT_UN  0x80
#define EEPROM_MQTT_PW  0xA0
#define EEPROM_MQTT_RT  0xC0
#define EEPROM_MQTT_TT  0xE0
#define EEPROM_SER_BAUD 0x100
#define EEPROM_SER_SERV 0x108
#define EEPROM_MQTTPWEN 0x110
#define EEPROM_MQTTSSLEN 0x160
#define EEPROM_MQTTCLEN 0x170
#define EEPROM_MQTT_PT  0x118
#define EEPROM_FOTA_PT  0x11A
#define EEPROM_FOTA_PW  0x120
#define EEPROM_MQTT_CI  0x140

#define EEPROM_CHR 0
#define EEPROM_INT 1
#define EEPROM_INT16 2
#define EEPROM_INT24 3
#define ADD_CSS 4


typedef struct RQST_Param {
    int request;
    int requestval;
} RQST_Param;

typedef enum ProtocolType {
    GET = 0,
    POST,
    GET_FAVICON
} ProtocolType;

typedef struct URL_Param {
    enum ProtocolType Type;
    char pParam[URLSize][URLSize];
    char pParVal[URLSize][URLSize];
    int nPar;
} URL_Param;

#endif
