/*
 * display.h
 *
 *  Created on: Sep 26, 2017
 *      Author: Philipp Hinz
 */

#ifndef DISPLAY_H_
#define DISPLAY_H_
#include <string>
#include "coffee.h"

typedef enum {
	lang_de,
	lang_en,
	lang_last
} display_lang_t;

typedef enum {
	str_heating,
	str_heatingready,
	str_ready,
	str_brewing,
	str_cleaning,
	str_error,
	str_flow,
	str_bye,
	str_waitoff,
	str_menu,
	str_menu_softoff,
	str_menu_kill,
	str_menu_stats,
	str_menu_stats2,
	str_menu_nextdesc,
	str_menu_temp,
	str_menu_clean,
	str_menu_demo,
	str_menu_exit,
	str_last
} display_strings_t;

typedef struct {
	char const * const text[lang_last];
} display_string_t;

static const display_string_t display_strings[str_last] =
{
		{ // heating
				{
						"Heizt auf",
						"Heating"
				}
		},
		{ // heatingready
				{
						"Bereit (Heizt)",
						"Ready (Heating)"
				}
		},
		{ // ready
				{
						"Bereit",
						"Ready"
				}
		},
		{ // brewing
				{
						"Bezug..",
						"Brewing.."
				}
		},
		{ // cleaning
				{
						"Reinigt..",
						"Cleaning.."
				}
		},
		{ // error
				{
						"Fehler",
						"Error"
				}
		},
		{ // flow
				{
						"Menge",
						"Flow"
				}
		},
		{ // bye
				{
						"Auf wiedersehen",
						"Good bye"
				}
		},
		{ // waitoff
				{
						"Ausschalten...",
						"Turning off..."
				}
		},
		{ // str_menu
				{
						"CoffeePi Menü",
						"CoffeePi Menu"
				}
		},
		{ // str_menu_softoff
				{
						"Ausschalten",
						"Turn off"
				}
		},
		{ // str_menu_kill
				{
						"Sofort ausschalten",
						"Turn off now"
				}
		},
		{ // str_menu_stats
				{
						"Stats",
						"Stats"
				}
		},{ // str_menu_stats2
				{
						"Energieverbrauch",
						"Energy consumed"
				}
		},
		{ // str_menu_nextdesc
				{
						"Reiningung in",
						"Descaling in"
				}
		},
		{ // str_menu_temp
				{
						"Temperatur",
						"Temperature"
				}
		},
		{ //  str_menu_clean
				{
						"Reinigen",
						"Clean"
				}
		},
		{ // str_menu_demo
				{
						"Demo",
						"Demo"
				}
		},
		{ // str_menu_exit
				{
						"Menü verlassen",
						"Leave menu"
				}
		}
};

#define DEFAULT_LANG 	lang_en /**< Default display language */
#define REFRESH_RATE	5 /**< Display refresh rate in Hz when active */
#define DISPLAY_ROWS	2
#define DISPLAY_COLS	16

void *displayThread(void *threadid);
void *displayTimerHandler(void *threadid);
void displayInit(void);
void displaySetLang(display_lang_t lang);
void displayPrintLn(int line, const char* str, bool centered);

void displayPushState(coffee_status_t state);

void displayRefresh(void);
const char* displayGetString(display_strings_t string);


#endif /* DISPLAY_H_ */
