#ifndef __CONSOLE_INN_RS232_H_
#define __CONSOLE_INN_RS232_H_

#include "types.h"
#include "al_basictypes.h"
#include "app_event.h"
#include "al_console.h"
#include "al_console_customer.h"


#define CR 		"\x0d"
#define SP  	"\x20"
#define QS  	"\x3f"
#define CMDPARAM_SIZE 9

//define cmd
#define RespOK ("OK" CR)
#define RespERR ("ERR" CR)
#define RespDataInvalid ("DataInvalid" CR)

//test cmd
#define UseToTestResp_OK 						("RESP" SP SP SP "1" CR)
#define UseToTestResp_ERR 						("RESP" SP SP SP "0" CR)

//source select
#define SourceSelect_Toggle 					("ITGD" SP SP SP SP CR)
#define SourceSelect_ATV						("ITVD" SP SP SP SP CR)
#define SourceSelect_EXT1						("IAVD" "1" SP SP SP CR)
#define SourceSelect_EXT2						("IAVD" "2" SP SP SP CR)
#define SourceSelect_EXT3						("IAVD" "3" SP SP SP CR)
#define SourceSelect_EXT4						("IAVD" "4" SP SP SP CR)
#define SourceSelect_RspCurrentSource			("IAVD" "?" "?" "?" "?" CR)

//change channel
#define ChangeSource_DirCh_ATV					("DCCH" "#" "#" SP SP CR)
#define ChangeSource_CnfCh_ATV					("DCCH" "?" "?" "?" "?" CR)
#define ChangeSource_ChUp_ATV					("CHUP" SP SP SP SP CR)
#define ChangeSource_ChDown_ATV					("CHDW" SP SP SP SP CR)

//Input Select
#define InputSelect_1							("INP#" "1" SP SP SP CR)
#define InputSelect_2							("INP#" "2" SP SP SP CR)
#define InputSelect_Reply						("INP#" "?" "?" "?" "?" CR)

//AV Mode
#define AVMode_AVMode_NEXT						("AVMD" "0" SP SP SP CR)
#define AVMode_AVMode_STANDARD					("AVMD" "1" SP SP SP CR)
#define AVMode_AVMode_MOVIE						("AVMD" "2" SP SP SP CR)
#define AVMode_AVMode_DYNAMIC					("AVMD" "3" SP SP SP CR)

//Audio volume

//Mute

//Enter Factory mode command
#define EnterFAC_KRSW							("KRSW" "0" "0" "0" "1" CR)
#define EnterFAC_KKT1							("KKT1" "0" "0" "3" "7" CR)

//osd control
#define OSD_Display_Enable						("OSDS" "0" "0" "0" "0" CR)
#define OSD_Display_Disable						("OSDS" "0" "0" "0" "1" CR)

//HDCP Key Info
#define HDCP_KEY_Info							("HCSN" "?" "?" "?" "?" CR)



typedef enum{
	InnRsp_State_OK 	= 0x1,
	InnRsp_State_ERR 	= 0x2,
	InnRsp_Data  		= 0x3,
	InnRsp_Data_Invalid = 0x4,
	InnRsp_Need_App_Resp= 0x5,
}eInnRspType;

typedef int (*InnRs232_autotest_Cbk_pf)(pCON_DEV pcon, UINT8 *msg);

typedef struct InnRs232_autoest_Cbk_t_
{
	InnRs232_autotest_Cbk_pf		pfCallBack;
} InnRs232_autotest_Cbk_t;

void al_innrs232_autotest_init(InnRs232_autotest_Cbk_t *pConsole_autotest_Cfg);

UINT8 con_InnRs232_CheckSyncAndValid(UINT8 sync,UINT8 len);
bool con_InnRs232_AutoTest_parser(pCON_DEV pcon, UINT8 *data);

#endif
