/*
 * Authors : Kerem Yollu & Edwin Koch
 * Date : 07.03.2021
 *
 * Description : 
 * TODO : Write description or doxygene 
 *
 */

#include <iostream>
#include <stdint.h>
#include <unistd.h>
#include "./management/errorHandling.h"
#include "./management/commandManager.h"
#include "./drivers/bh1750/bh1750.h"
#include "./drivers/pf8574/pf8574lcd.h"

unsigned int miliSecond = 1000;


ErrorHandler errorHandle;
CommandManager commander; 
i2c_ch1_pImpL i2c(1);

Bh1750 lightSens(&i2c);



int initPlatform()
{
	char* Msg = "hello"; 
	lcd_init(&i2c); 
	lcd_display_string(1,1,Msg); 
	// Dev. Module initialisation "Ex i2c_init() ...."
	return 0; 
}

void dummy() 
{
	while(1)
	{
		std::cout << "value "<< lightSens.continious(BH1750_CONTINUOUS_HIGH_RES_MODE_1,1) << " Lux" <<std::endl; 
		usleep(150*miliSecond);
	}
}

int main(int argc, char *argv[])
{
	// Init 
	initPlatform(); 
	std::cout << "Main" << std::endl;
	//errorHandle.addNewError(-34,"Test eroor 1"); 
	//errorHandle.handleError(-34); 
	//commander.addNewCommand("test", "The test command for testing the test", dummy); 
	//commander(argv[1]); 	
	
	commander.addNewCommand("i2c", "The test command for testing the test", dummy); 
	commander(argv[1]); 	


	return 1; 
}
