#ifndef OS_MAIN_H
#define OS_MAIN_H

#define MAX_TASKS 20

#include "OS_types.h"
#include "GLCD_types.h"


typedef struct TASK
{
	void (*task)(void);
	TASK_NAME name;
	PRIORITY priority;
	unsigned char remaining;
	STATE state;
	char *internalState;
	TASK_TYPE type;
	RESULT(*msgBox)(MESSAGE *msg);
	TRect *LCD_area;
} TASK;



RESULT TaskCreate(	void(*ptr)(void),
					TASK_NAME task_name,
					PRIORITY prior, 
					STATE stat, 
					TASK_TYPE Type, 
					RESULT(*msgBox)(MESSAGE *msg));
void initTasks(void);
RESULT TaskDelete(TASK_NAME Name);
RESULT TaskFillState(TASK_NAME Name, char* inState);
char TaskGetState(TASK_NAME Name);
void RunOS(void);
void Scheduler(void);
RESULT SendTaskMessage(TASK_NAME task, MESSAGE *message);
RESULT RegisterGraphicArea(TASK_NAME task, TRect * rect);
RESULT UnregisterGraphicArea(TASK_NAME task);
RESULT ProceedClickEvent(void);
RESULT SetTaskPrioriry(TASK_NAME Name, PRIORITY prior);


#endif