/*
 * api_constants.c
 *
 *  Created on: Jul 2, 2010
 *      Author: zumbruch
 */

#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include <stdlib.h>
#include <util/delay.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/sleep.h>
#include <avr/iocan128.h>
#include <avr/iocanxx.h>
#include <avr/eeprom.h>
#include <avr/wdt.h>
#include <avr/pgmspace.h>

#include "api.h"
#include "api_define.h"
#include "api_global.h"
#include "api_constants.h"
#include "api_show.h"
#include "api_help.h"



#ifdef API_CONSTANTS_H_

#warning TODO: combine responseKeyword and other responses error into one set of responses
static const char responseKeyword00[] PROGMEM = "RECV";

const char* responseKeywords[] PROGMEM = {
        responseKeyword00
};


/* those are the command keywords of the API*/
static const char commandKeyword00[] PROGMEM = "TWIS";
static const char commandKeyword01[] PROGMEM = "RSET";


/* this is the corresponding command key array, beware of the same order*/
const char* commandKeywords[] PROGMEM = {
		commandKeyword00,
		commandKeyword01
		
		
		
};

/* those are the command keywords of the API*/
static const char commandShortDescription00[] PROGMEM = "Adresse";
static const char commandShortDescription01[] PROGMEM = "Read";
static const char commandShortDescription02[] PROGMEM = "Write";




/* this is the corresponding command key array, beware of the same order*/
const char* commandShortDescriptions[] PROGMEM= {
        commandShortDescription00,
        commandShortDescription01,
        commandShortDescription02
          
};

/* those are the command keywords of the API*/
static const char commandImplementation00[] PROGMEM = "";
static const char commandImplementation01[] PROGMEM = "";



/* this is the corresponding command key array, beware of the same order*/
const char* commandImplementations[] PROGMEM= {
        commandImplementation00,
        commandImplementation01
  
      
};

//* pointer of array for defined serial error number*/
static const char se00[] PROGMEM = "no valid command name";
static const char se01[] PROGMEM = "command_type is too long";
static const char se02[] PROGMEM = "adresse is too long";
static const char se03[] PROGMEM = "length is  too long";
static const char se04[] PROGMEM = "data 0 is too long";
static const char se05[] PROGMEM = "data 1 is too long";
static const char se06[] PROGMEM = "data 2 is too long";
static const char se07[] PROGMEM = "data 3 is too long";
static const char se08[] PROGMEM = "data 4 is too long";
static const char se09[] PROGMEM = "data 5 is too long";
static const char se10[] PROGMEM = "data 6 is too long";
static const char se11[] PROGMEM = "data 7 is too long";
static const char se12[] PROGMEM = "command is too long";
static const char se13[] PROGMEM = "argument has invalid type";
static const char se14[] PROGMEM = "command_type has invalid type";
static const char se15[] PROGMEM = "adresse has invalid type";
static const char se16[] PROGMEM = "length has invalid type";
static const char se17[] PROGMEM = "data 0 has invalid type";
static const char se18[] PROGMEM = "data 1 has invalid type";
static const char se19[] PROGMEM = "data 2 has invalid type";
static const char se20[] PROGMEM = "data 3 has invalid type";
static const char se21[] PROGMEM = "data 4 has invalid type";
static const char se22[] PROGMEM = "data 5 has invalid type";
static const char se23[] PROGMEM = "data 6 has invalid type";
static const char se24[] PROGMEM = "data 7 has invalid type";
static const char se25[] PROGMEM = "undefined error type";
static const char se26[] PROGMEM = "first value is too long";
static const char se27[] PROGMEM = "second value is too long";
static const char se28[] PROGMEM = "arguments have invalid type";
static const char se29[] PROGMEM = "argument(s) exceed(s) allowed boundary";
static const char se30[] PROGMEM = "too many arguments";


const char *serial_error[] PROGMEM = { se00, se01, se02, se03, se04, se05, se06, se07, se08, se09, se10, se11, se12, se13, se14, se15, se16, se17, se18, se19, se20,
		se21, se22, se23, se24, se25, se26, se27,se28,se29,se30 };


/* array for defined serial error number*/
const uint8_t serial_error_number[] = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 110,
		111, 112, 113, 114, 115, 116, 117, 118, 119, 120,
		121, 122, 123, 124, 125, 126, 127,128,129,130
		};
/* pointer of array for defined can error number*/

static const char tw00[] PROGMEM = "Error in initiating TWI interface";
static const char tw01[] PROGMEM = "Could not start TWI Bus for WRITE";
static const char tw02[] PROGMEM = "Could not start TWI Bus for READ";


const char *twi_error[] PROGMEM = { tw00, tw01, tw02 };

/* array for defined can error number*/
const uint8_t twi_error_number[] = { 21, 22, 23};
/* pointer of array for defined general error number*/

static const char ge00[] PROGMEM = "init for timer0 failed";
static const char ge01[] PROGMEM = "init for timer0A failed";


const char *general_error[] PROGMEM = { ge00, ge01};

/* array for defined general error number*/
const uint16_t general_error_number[] = { 40, 41};

/* pointer of array for defined general error number*/
static const char errorType00[] PROGMEM = "ERRG"; /*general*/
static const char errorType01[] PROGMEM = "ERRA"; /*api*/
static const char errorType02[] PROGMEM = "ERRT"; /*twis protocol*/
static const char errorType03[] PROGMEM = "ERRU"; /*undefined*/

/* this is the corresponding error Type array, beware of the same order*/
const char *errorTypes[] PROGMEM = {
        errorType00,
        errorType01,
        errorType02,
        errorType03
         
   
};

static const char debugLevelName00[] PROGMEM = "          noDebug";
static const char debugLevelName01[] PROGMEM = "     verboseDebug";
static const char debugLevelName02[] PROGMEM = "       eventDebug";
static const char debugLevelName03[] PROGMEM = "eventDebugVerbose";
static const char debugLevelName04[] PROGMEM = "    periodicDebug";

const char *debugLevelNames[] PROGMEM = {
         debugLevelName00,
         debugLevelName01,
         debugLevelName02,
         debugLevelName03,
         debugLevelName04
};

static const char debugSystemName00[] PROGMEM = "             Main";
static const char debugSystemName01[] PROGMEM = "             UART";
static const char debugSystemName02[] PROGMEM = "           TIMER0";
static const char debugSystemName03[] PROGMEM = "           TIMER1";
static const char debugSystemName04[] PROGMEM = "          TIMER0A";
static const char debugSystemName05[] PROGMEM = " TIMER0AScheduler";
static const char debugSystemName06[] PROGMEM = "            RELAY";
static const char debugSystemName07[] PROGMEM = "       CommandKey";
static const char debugSystemName08[] PROGMEM = "          Decrypt";
static const char debugSystemName09[] PROGMEM = "            DEBUG";
static const char debugSystemName10[] PROGMEM = "             SHOW";
//static const char debugSystemName11[] PROGMEM = "             TWI";

const char *debugSystemNames[] PROGMEM =
{
   debugSystemName00,
   debugSystemName01,
   debugSystemName02,
   debugSystemName03,
   debugSystemName04,
   debugSystemName05,
   debugSystemName06,
   debugSystemName07,
   debugSystemName08,
   debugSystemName09,
   debugSystemName10
   //debugSystemName11
  
};
#endif
