/* Web page data pro HTTP server */

#ifndef _WWW_H
#define _WWW_H

// Include 
#include "stdint.h"

// Definice 

// Definice komunikacnich stavu mezi TCP a WWW
#define GENERATE_OFF			0
#define GENERATE_PROGRESS		1
#define GENERATE_START			2

// ID zdrojovych souboru na serveru
#define WWW_ID_INDEX				1		//
#define WWW_ID_INFO					2		// 01
#define WWW_ID_PLANOVANI			3		// 02
#define WWW_ID_NASTAVENI_SYSTEMU	4		// 03
#define WWW_ID_NASTAVENI_LED		5		// 04
#define WWW_ID_NASTAVENI_SITE		6		// 05
#define WWW_ID_PLANOVANI_PRIDAT		7		// 06
#define WWW_ID_PLANOVANI_EDITOVAT	8		// 07

#define WWW_PLANOVANI_PRIDAT		1
#define WWW_PLANOVANI_EDITOVAT		2

#define WWW_PLAN_OPAKOVANI			0
#define WWW_PLAN_ZACATEK_HODIN		1
#define WWW_PLAN_ZACATEK_MINUT		2
#define WWW_PLAN_ZACATEK_DEN		3
#define WWW_PLAN_ZACATEK_MESIC		4
#define WWW_PLAN_ZACATEK_ROK		5
#define WWW_PLAN_KONEC_HODIN		6
#define WWW_PLAN_KONEC_MINUT		7
#define WWW_PLAN_KONEC_DEN			8
#define WWW_PLAN_KONEC_MESIC		9
#define WWW_PLAN_KONEC_ROK			10
#define WWW_PLAN_LED1				11
#define WWW_PLAN_LED2				12
#define WWW_PLAN_LED3				13
#define WWW_PLAN_LED4				14
#define WWW_PLAN_LED5				15
#define WWW_PLAN_LED6				16

#define WWW_TEXTOVAMEZERA		("&nbsp;")

#define WWW_MAX_DELKA_HODNOTY		16

// Prototypy funkci
void WWW_SendFile(uint8_t ID, uint8_t *TX_Buffer, uint8_t *RX_Buffer);
void WWW_ProcessRequest(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_SendErr(uint16_t ID, uint8_t *TX_Buffer, uint8_t *RX_Buffer);
void WWW_SendPage(uint8_t ID, uint8_t *TX_Buffer, uint8_t *RX_Buffer);
void WWW_GenerateLayout1(uint8_t VybranoID, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_GenerateLayout2(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_GenerateMenu(uint8_t VybranoID, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_Generate_StavSystemu(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_Generate_NastaveniSite(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_Generate_NastaveniLED(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_Generate_NastaveniSystemu(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_Generate_Planovani(uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_Generate_PlanovaniEditace(uint8_t ID, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertTableInputText(const uint8_t *nazev, uint8_t ID, uint8_t size, uint8_t *value, uint8_t maxlength, uint8_t *text, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertInputText(uint8_t ID, uint8_t size, uint8_t *value, uint8_t maxlength, uint8_t *text, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertTable2InputText(uint8_t ID, uint8_t size, uint8_t *value, uint8_t maxlength, uint8_t *text, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertRadioButtonText(uint8_t value, uint8_t name, uint8_t *text, uint8_t checked, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertCheckBoxText(uint8_t value, uint8_t name, uint8_t *text, uint8_t checked, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_DecodeFormGET_Planovani(uint8_t typ, uint8_t *RX_Buffer);
void WWW_DecodeFormGET_NastaveniSite(uint8_t *RX_Buffer);
void WWW_DecodeFormGET_NastaveniLED(uint8_t *RX_Buffer);
void WWW_DecodeFormGET_NastaveniSystemu(uint8_t *RX_Buffer);
uint8_t WWW_GetParametr(uint8_t *Nazev,uint8_t *RX_Buffer);
uint16_t WWW_GetFormParamStart(uint8_t *RX_Buffer);
uint16_t WWW_GetFormHodnota(uint16_t ZacatekHledani, uint8_t *Parametr, uint16_t *ZacatekHodnoty, uint8_t *DelkaHodnoty, uint8_t *RX_Buffer);
void WWW_InsertFromFLASH(const uint8_t *data, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertSystemDataFromFLASH(const uint8_t *data, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertInt16(uint16_t cislo, uint8_t zobrazitnulu, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertHex(uint8_t cislo, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
void WWW_InsertTemp(int16_t teplota, uint8_t *RX_Buffer, uint8_t *TX_Buffer);
#endif
/* Konec souboru */
