#ifndef NET_SETUP_H
#define NET_SETUP_H
/****************************************************************************
Definice geometrickych rozmeru aplikace

*****************************************************************************/
#define NET_SETUP_YA 21
#define NET_SETUP_XA 0
#define NET_SETUP_XC 480
#define NET_SETUP_YC 272

#define NET_SETUP_GLOBALS_TOP 25
#define NET_SETUP_GLOBALS_LEFT 20
#define NET_SETUP_GLOBALS_WIDTH 440
#define NET_SETUP_GLOBALS_HEIGHT 70

#define NET_SETUP_GLOBALS_BUTTONS_TOP 25
#define NET_SETUP_GLOBALS_BUTTONS_LEFT 15
#define NET_SETUP_GLOBALS_BUTTONS_WIDTH 150
#define NET_SETUP_GLOBALS_BUTTONS_HEIGHT 35
#define NET_SETUP_GLOBALS_BUTTONS_DISTANCE 15

#define NET_SETUP_LOCALS_WIDTH 280
#define NET_SETUP_LOCALS_HEIGHT 160
#define NET_SETUP_LOCALS_LEFT NET_SETUP_GLOBALS_LEFT
#define NET_SETUP_LOCALS_TOP 105

#define NET_SETUP_LOCALS_BUTTONS_TOP 25
#define NET_SETUP_LOCALS_BUTTONS_LEFT NET_SETUP_GLOBALS_BUTTONS_LEFT
#define NET_SETUP_LOCALS_BUTTONS_WIDTH 245
#define NET_SETUP_LOCALS_BUTTONS_HEIGHT 35
#define NET_SETUP_LOCALS_BUTTONS_DISTANCE 10

#define NET_SETUP_CONTROLS_TOP 105
#define NET_SETUP_CONTROLS_LEFT NET_SETUP_GLOBALS_LEFT+NET_SETUP_LOCALS_WIDTH+15
#define NET_SETUP_CONTROLS_WIDTH 140
#define NET_SETUP_CONTROLS_HEIGHT 110

#define NET_SETUP_COMMON_BUTTONS_TOP 228
#define NET_SETUP_COMMON_BUTTONS_LEFT NET_SETUP_CONTROLS_LEFT
#define NET_SETUP_COMMON_BUTTONS_WIDTH NET_SETUP_CONTROLS_WIDTH
#define NET_SETUP_COMMON_BUTTONS_HEIGHT 35

/****************************************************************************
	Definice stavu aplikace

*****************************************************************************/
typedef enum NET_SETUP_STATE
{
	NET_SETUP_NOT_INITIALIZED = M_TASK_NOT_INITIALIZED,
	NET_SETUP_INITIALIZE,
	NET_SETUP_RESTART = M_TASK_RESTART,
	NET_SETUP_DRAW,
	NET_SETUP_ACTIVE = M_TASK_RUNNING,
	NET_SETUP_WAITING = M_TASK_WAITING,
	NET_SETUP_DIALOG_WAITING = M_TASK_DIALOG_WAITING,
	NET_SETUP_SWITCH,
	NET_SETUP_READY = M_TASK_READY,
	NET_SETUP_STOP,
	NET_SETUP_ERROR = M_TASK_FAILED,
}NET_SETUP_STATE;

/****************************************************************************
	Definice objektu aplikace

*****************************************************************************/
typedef enum NET_SETUP_OBJECT
{
	NET_SETUP_NONE,
	NET_SETUP_DIVISORS,
	NET_SETUP_TYPE,
	NET_SETUP_SSID,
	NET_SETUP_PASSWORD,
	NET_SETUP_IP_TYPE,
	NET_SETUP_IP,
	NET_SETUP_GATEWAY,
	NET_SETUP_DNS,
	NET_SETUP_BACK,
	NET_SETUP_INFO,
	NET_SETUP_OBJECT_COUNT
}NET_SETUP_OBJECT;


/****************************************************************************
	Stavy spojeni

*****************************************************************************/
typedef enum CONNECTION_STATE
{
	CONNECTION_UNKNOWN,
	CONNECTION_DISCONNECTED,
	CONNECTION_CONNECTING,
	CONNECTION_CONFIGURING,
	CONNECTION_CONNECTED,
	CONNECTION_ERROR
}CONNECTION_STATE;

/****************************************************************************
	Sily signalu

*****************************************************************************/
typedef enum SIGNAL_STRENGTH
{
	SIGNAL_NONE = 10,
	SIGNAL_WEAK = 25,
	SIGNAL_GOOD = 50,
	SIGNAL_BEST = 80,
}SIGNAL_STRENGTH;

/****************************************************************************
	Definice stavu Wifi modulu

*****************************************************************************/
typedef enum NET_SETUP_CON_PROC
{
	NS_MODULE_START,
	NS_TEST_RECENT,
	NS_GET_NETWORK_NAME,
	NS_IDLE,
	NS_CLEAR,
	NS_COMMUNICATING,
	NS_RESET,
	NS_LOAD_CA,
	NS_LOAD_CERT,
	NS_LOAD_PKEY,
	NS_INTERFACE,
	NS_BAUDRATE,
	NS_CHANNEL,
	NS_BRIDGE_BAUDRATE,
	NS_SSID,
	NS_CIPHER,
	NS_KEY,
	NS_REBOOT,
	NS_AFTER_REBOOT,
	NS_AFTER_REBOOT2,
	NS_AFTER_REBOOT3,
	NS_CONNECTED,
	NS_GET_IP,
	NS_GET_MASK,
	NS_GET_DNS,
	NS_GET_GATEWAY,
	NS_COMPLETED,
	NS_ERROR,
}NET_SETUP_CON_PROC;


RESULT NSMsgBox(MESSAGE * msg);
void AppNetSetup(void);


extern unsigned char myIP[];
extern unsigned char myGateway[];
extern unsigned char myDNS[];
extern unsigned char myMask[];
extern unsigned char myPassword[40];
extern unsigned char mySSID[];
extern CONNECTION_STATE myConnectionState;
#endif