#ifndef __AL_BLUETOOTH_CTRL_H__
#define __AL_BLUETOOTH_CTRL_H__

#include "al_basictypes.h"

//**********************************************************************
//module
//**********************************************************************
/**
UART_CMD_Definition
Head | Len | CMD | DATA0 | DATA1 | ... | CheckSum
CheckSum = (Len+CMD+Data0+Data1+...)&0xFF
**/

#define CMD_SMART_HEADER		0x16

#define BT_NAME_LEN_MAX 40

typedef enum {
    SMART_CMD_SET_LANGUAGE 	= 0x1,//android to tv
    SMART_CMD_GET_DATETIME 	= 0x2,//tv to android
    SMART_CMD_RESPOND_DATETIME 	= 0x3,//android to tv, android send time to tv
    SMART_CMD_PLAY_USB_FILE = 0x4,//android to tv
    SMART_CMD_PLAY_LIVE_TV 	= 0x5,//android to tv
    SMART_CMD_PLAY_PC		= 0x6,//android to tv
	SMART_CMD_PLAY_AV		= 0x7,//android to tv
	SMART_CMD_PLAY_HDMI		= 0x8,//android to tv
	SMART_CMD_PLAY_YPBPR 	= 0x9,//android to tv
	SMART_CMD_SET_SOURCE	= 0xA,//tv to android, tv send support source to android
	SMART_CMD_ANDROID_GET_TVSOURCE = 0xB,//android to tv,android get tv support source
	SMART_CMD_RESPOND_ACTION = 0XC,//android to tv
	SMART_CMD_RESPOND_BT_NAME = 0xD,
	SMART_CMD_SET_BT_NAME	= 0xE,
	SMART_CMD_PLAY_SCART	= 0x10,//android to tv
	SMART_CMD_PLAY_GAME		= 0x11,//android to tv
	SMART_CMD_PLAY_BT		= 0x12,//android to tv
	SMART_CMD_SUPPORT_LANGUAGE = 0x13,
	SMART_CMD_GET_BT_NAME	= 0x14,
	SMART_CMD_TVIR_CMD		= 0x15,//tv to android
	SMART_CMD_TV_SET_LANGUAGE	= 0x16,//tv to android
	
	SMART_CMD_EVENT_END,	
    SMART_CMD_MAX,    
} AL_Enum_Smart_Cmd;

typedef enum {
	//SMART_CMD_KEY_0			= 0x0,
	SMART_CMD_KEY_1 		= 0x1,
	SMART_CMD_KEY_2 		= 0x2,
	SMART_CMD_KEY_3 		= 0x3,
	SMART_CMD_KEY_4 		= 0x4,
	SMART_CMD_KEY_5 		= 0x5,
	SMART_CMD_KEY_6 		= 0x6,
	SMART_CMD_KEY_7 		= 0x7,
	SMART_CMD_KEY_8 		= 0x8,
	SMART_CMD_KEY_9 		= 0x9,
	SMART_CMD_KEY_UP 		= 0xA,
	SMART_CMD_KEY_DOWN		= 0xB,
	SMART_CMD_KEY_LEFT		= 0xC,
	SMART_CMD_KEY_RIGHT		= 0xD,
	SMART_CMD_KEY_ENTER		= 0xE,
	SMART_CMD_KEY_MUTE		= 0xF,
	SMART_CMD_KEY_VOL_UP	= 0x10,
	SMART_CMD_KEY_VOL_DOWN	= 0x11,
	SMART_CMD_KEY_EXIT		= 0x12,
	SMART_CMD_KEY_GOTO		= 0x13,
	SMART_CMD_KEY_AB		= 0x14,
	SMART_CMD_KEY_STOP		= 0x15,
	SMART_CMD_KEY_PLAY		= 0x16,
	SMART_CMD_KEY_PAUSE		= 0x17,
	SMART_CMD_KEY_SLOW		= 0x18,
	SMART_CMD_KEY_FF		= 0x19,
	SMART_CMD_KEY_FR		= 0x1A,
	SMART_CMD_KEY_NEXT		= 0x1B,
	SMART_CMD_KEY_PREV		= 0x1C,
	SMART_CMD_KEY_PLAY_PAUSE= 0x1D,
	SMART_CMD_KEY_INFO		= 0x1E,
	SMART_CMD_KEY_SETUP		= 0x1F,
	SMART_CMD_KEY_HOME		= 0x20,
	SMART_CMD_KEY_RED		= 0x21,
	SMART_CMD_KEY_BLUE		= 0x22,
	SMART_CMD_KEY_GREEN		= 0x23,
	SMART_CMD_KEY_YELLOW	= 0x24,
	SMART_CMD_KEY_MOVIE		= 0x25,
	SMART_CMD_KEY_FAVOURITE	= 0x26,
	SMART_CMD_KEY_SUBTITLE	= 0x27,
	SMART_CMD_KEY_NETFLIX	= 0x28,
	SMART_CMD_KEY_YOUTUBE   = 0x29,

	SMART_CMD_KEY_LOCHAR_a				= 0x2A,
	SMART_CMD_KEY_LOCHAR_b				= 0x2B,
	SMART_CMD_KEY_LOCHAR_c				= 0x2C,
	SMART_CMD_KEY_LOCHAR_d				= 0x2D,
	SMART_CMD_KEY_LOCHAR_e				= 0x2E,
	SMART_CMD_KEY_LOCHAR_f				= 0x2F,
	SMART_CMD_KEY_LOCHAR_g				= 0x30,
	SMART_CMD_KEY_LOCHAR_h				= 0x31,
	SMART_CMD_KEY_LOCHAR_i				= 0x32,
	SMART_CMD_KEY_LOCHAR_j				= 0x33,
	SMART_CMD_KEY_LOCHAR_k				= 0x34,
	SMART_CMD_KEY_LOCHAR_l				= 0x35,
	SMART_CMD_KEY_LOCHAR_m				= 0x36,
	SMART_CMD_KEY_LOCHAR_n				= 0x37,
	SMART_CMD_KEY_LOCHAR_o				= 0x38,
	SMART_CMD_KEY_LOCHAR_p				= 0x39,
	SMART_CMD_KEY_LOCHAR_q				= 0x3A,
	SMART_CMD_KEY_LOCHAR_r				= 0x3B,
	SMART_CMD_KEY_LOCHAR_s				= 0x3C,
	SMART_CMD_KEY_LOCHAR_t				= 0x3D,
	SMART_CMD_KEY_LOCHAR_u				= 0x3E,
	SMART_CMD_KEY_LOCHAR_v				= 0x3F,
	SMART_CMD_KEY_LOCHAR_w				= 0x40,
	SMART_CMD_KEY_LOCHAR_x				= 0x41,
	SMART_CMD_KEY_LOCHAR_y				= 0x42,
	SMART_CMD_KEY_LOCHAR_z				= 0x43,
	SMART_CMD_KEY_HICHAR_A				= 0x44,
	SMART_CMD_KEY_HICHAR_B				= 0x45,
	SMART_CMD_KEY_HICHAR_C				= 0x46,
	SMART_CMD_KEY_HICHAR_D				= 0x47,
	SMART_CMD_KEY_HICHAR_E				= 0x48,
	SMART_CMD_KEY_HICHAR_F				= 0x49,
	SMART_CMD_KEY_HICHAR_G				= 0x4A,
	SMART_CMD_KEY_HICHAR_H				= 0x4B,
	SMART_CMD_KEY_HICHAR_I				= 0x4C,
	SMART_CMD_KEY_HICHAR_J				= 0x4D,
	SMART_CMD_KEY_HICHAR_K				= 0x4E,
	SMART_CMD_KEY_HICHAR_L				= 0x4F,
	SMART_CMD_KEY_HICHAR_M				= 0x50,
	SMART_CMD_KEY_HICHAR_N				= 0x51,
	SMART_CMD_KEY_HICHAR_O				= 0x52,
	SMART_CMD_KEY_HICHAR_P				= 0x53,
	SMART_CMD_KEY_HICHAR_Q				= 0x54,
	SMART_CMD_KEY_HICHAR_R				= 0x55,
	SMART_CMD_KEY_HICHAR_S				= 0x56,
	SMART_CMD_KEY_HICHAR_T				= 0x57,
	SMART_CMD_KEY_HICHAR_U				= 0x58,
	SMART_CMD_KEY_HICHAR_V				= 0x59,
	SMART_CMD_KEY_HICHAR_W				= 0x5A,
	SMART_CMD_KEY_HICHAR_X				= 0x5B,
	SMART_CMD_KEY_HICHAR_Y				= 0x5C,
	SMART_CMD_KEY_HICHAR_Z				= 0x5D,
	SMART_CMD_KEY_SYMBOL_QUEST			= 0x5E,
	SMART_CMD_KEY_SYMBOL_EXCLA			= 0x5F,
	SMART_CMD_KEY_SYMBOL_POUND			= 0x60,
	SMART_CMD_KEY_SYMBOL_DOLAR			= 0x61,
	SMART_CMD_KEY_SYMBOL_PERCENT		= 0x62,
	SMART_CMD_KEY_SYMBOL_AND			= 0x63,
	SMART_CMD_KEY_SYMBOL_STAR			= 0x64,
	SMART_CMD_KEY_SYMBOL_OPEN_PAREN		= 0x65,
	SMART_CMD_KEY_SYMBOL_CLOSE_PAREN	= 0x66,
	SMART_CMD_KEY_SYMBOL_PLUS			= 0x67,
	SMART_CMD_KEY_SYMBOL_MINUS			= 0x68,
	SMART_CMD_KEY_SYMBOL_EQUAL			= 0x69,
	SMART_CMD_KEY_SYMBOL_SLASH			= 0x6A,
	SMART_CMD_KEY_SYMBOL_UNDERSCORE		= 0x6B,
	SMART_CMD_KEY_SYMBOL_QUOTE			= 0x6C,
	SMART_CMD_KEY_SYMBOL_SEMICOLON		= 0x6D,
	SMART_CMD_KEY_SYMBOL_COLON			= 0x6E,
	SMART_CMD_KEY_SYMBOL_WWW			= 0x6F,
	SMART_CMD_KEY_SYMBOL_MOUSE			= 0x70,
	SMART_CMD_KEY_SYMBOL_COM			= 0x71,
	SMART_CMD_KEY_DEL					= 0x72,
	SMART_CMD_KEY_SYMBOL_COMMA			= 0x73,
	SMART_CMD_KEY_SYMBOL_DOT			= 0x74,
	SMART_CMD_KEY_TAB					= 0x75,
	SMART_CMD_KEY_SPACE					= 0x76,
	SMART_CMD_KEY_MOUSE					= 0x77,
	SMART_CMD_KEY_TVDEL 				= 0x78,
	SMART_CMD_KEY_0						= 0x79,
	SMART_CMD_KEY_MENU					= 0x80,//android menu
	SMART_CMD_KEY_ZOOMOUT				= 0x81,//zoom+
	SMART_CMD_KEY_ZOOMIN				= 0x82,//zoom-
	SMART_CMD_KEY_PAGEI					= 0x83,//page+
	SMART_CMD_KEY_PAGED					= 0x84,//page-

    SMART_CMD_KEY_MAX,    
}AL_Enum_Smart_Key_Cmd;

typedef enum {
    SMART_DATA_LANGUAGE_English 	= 0x1,
    SMART_DATA_LANGUAGE_SChinese 	= 0x2,
	SMART_DATA_LANGUAGE_TChinese	= 0x3,
	SMART_DATA_LANGUAGE_Thai		= 0x4,
	SMART_DATA_LANGUAGE_Vietnamese	= 0x5,
	SMART_DATA_LANGUAGE_Hindi		= 0x6,
	SMART_DATA_LANGUAGE_Marathi		= 0x7,
	SMART_DATA_LANGUAGE_Tamil		= 0x8,
	SMART_DATA_LANGUAGE_Telugu		= 0x9,
	SMART_DATA_LANGUAGE_Punjabi		= 0xa,
	SMART_DATA_LANGUAGE_Bangla		= 0xb,
	SMART_DATA_LANGUAGE_Gujrati 	= 0xc,
	SMART_DATA_LANGUAGE_Hebrew		= 0xd,
	SMART_DATA_LANGUAGE_Korean		= 0xe,
	SMART_DATA_LANGUAGE_Malayan		= 0xf,
	SMART_DATA_LANGUAGE_Spanish		= 0x10,
	SMART_DATA_LANGUAGE_French		= 0x11,
	SMART_DATA_LANGUAGE_MAX,
}AL_Enum_Smart_Data_Language;

typedef enum {
    SMART_DATA_GET_LANGUAGE_German        = 0x0,
	SMART_DATA_GET_LANGUAGE_English       = 0x1,
	SMART_DATA_GET_LANGUAGE_French        = 0x2,
	SMART_DATA_GET_LANGUAGE_Italian       = 0x3,
	SMART_DATA_GET_LANGUAGE_Polish        = 0x4,
	SMART_DATA_GET_LANGUAGE_Spanish       = 0x5,
	SMART_DATA_GET_LANGUAGE_Netherlands   = 0x6,
	SMART_DATA_GET_LANGUAGE_Portuguese    = 0x7,
	SMART_DATA_GET_LANGUAGE_Swidish       = 0x8,
	SMART_DATA_GET_LANGUAGE_Finnish       = 0x9,
	SMART_DATA_GET_LANGUAGE_Greek         = 0xA,
	SMART_DATA_GET_LANGUAGE_Russian       = 0xB,
	SMART_DATA_GET_LANGUAGE_Turkey        = 0xC,
	SMART_DATA_GET_LANGUAGE_Danish        = 0xD,
	SMART_DATA_GET_LANGUAGE_Norwegian     = 0xE,
	SMART_DATA_GET_LANGUAGE_Hungarian     = 0xF,
	SMART_DATA_GET_LANGUAGE_Czech         = 0x10,
	SMART_DATA_GET_LANGUAGE_Slovakian     = 0x11,
	SMART_DATA_GET_LANGUAGE_Croatian      = 0x12,
	SMART_DATA_GET_LANGUAGE_Serbian       = 0x13,
	SMART_DATA_GET_LANGUAGE_Arabic        = 0x14,
	SMART_DATA_GET_LANGUAGE_Persian       = 0x15,
	SMART_DATA_GET_LANGUAGE_Thai          = 0x16,
	SMART_DATA_GET_LANGUAGE_Vietnamese    = 0x17,
	SMART_DATA_GET_LANGUAGE_TChinese      = 0x18,
	SMART_DATA_GET_LANGUAGE_SChinese      = 0x19,
	SMART_DATA_GET_LANGUAGE_Hindi         = 0x1A,
	SMART_DATA_GET_LANGUAGE_Marathi       = 0x1B,
	SMART_DATA_GET_LANGUAGE_Tamil         = 0x1C,
	SMART_DATA_GET_LANGUAGE_Telgu         = 0x1D,
	SMART_DATA_GET_LANGUAGE_Punjabi       = 0x1E,
	SMART_DATA_GET_LANGUAGE_Bangla        = 0x1F,
	SMART_DATA_GET_LANGUAGE_Gujrati       = 0x20,
	SMART_DATA_GET_LANGUAGE_Hebrew        = 0x21,
	SMART_DATA_GET_LANGUAGE_Korean        = 0x22,
	SMART_DATA_GET_LANGUAGE_Malayan       = 0x23,
	SMART_DATA_GET_LANGUAGE_MAX,
}AL_Enum_Smart_Get_Language;

typedef enum {
    SMART_DATA_PLAY_FILE_LOCAL 	= 0x1,
    SMART_DATA_PLAY_FILE_MOVE 	= 0x2,
	SMART_DATA_PLAY_FILE_MUSIC	= 0x3,
	SMART_DATA_PLAY_FILE_PHOTO	= 0x4,
	SMART_DATA_PLAY_FILE_TXT	= 0x5,
	SMART_DATA_PLAY_FILE_MAX,
}AL_Enum_Smart_Data_Play_File;

typedef enum {
    SMART_DATA_PLAY_TV_ATV 		= 0x1,
    SMART_DATA_PLAY_TV_DVBT 	= 0x2,
	SMART_DATA_PLAY_TV_DVBC		= 0x3,
	SMART_DATA_PLAY_TV_DVBS		= 0x4,
	SMART_DATA_PLAY_TV_MAX,
}AL_Enum_Smart_Data_Play_TV;

typedef enum {
    SMART_DATA_PLAY_AV_AV1 	= 0x1,
    SMART_DATA_PLAY_AV_AV2 	= 0x2,
	SMART_DATA_PLAY_AV_AV3	= 0x3,
	SMART_DATA_PLAY_AV_MAX,
}AL_Enum_Smart_Data_Play_AV;

typedef enum {
    SMART_DATA_PLAY_HDMI_HDMI1 	= 0x1,
    SMART_DATA_PLAY_HDMI_HDMI2 	= 0x2,
	SMART_DATA_PLAY_HDMI_HDMI3	= 0x3,
	SMART_DATA_PLAY_HDMI_MAX,
}AL_Enum_Smart_Data_Play_HDMI;

typedef enum {
    SMART_DATA_PLAY_YPP_YPP1 	= 0x1,
    SMART_DATA_PLAY_YPP_YPP2 	= 0x2,
	SMART_DATA_PLAY_YPP_YPP3	= 0x3,
	SMART_DATA_PLAY_YPP_MAX,
}AL_Enum_Smart_Data_Play_YPP;

typedef enum {
    SMART_DATA_PLAY_SCART_SCART1 	= 0x1,
    SMART_DATA_PLAY_SCART_SCART2 	= 0x2,
	SMART_DATA_PLAY_SCART_MAX,
}AL_Enum_Smart_Data_Play_SCART;

typedef struct Smart_MessageBody_t_ {
    al_uint8 dMessageCmd;
    al_uint8 dCmdSize;
    al_uint8 *pdata;
} Smart_MessageBody_t;

typedef int (*Smart_ModCbk_pf) (Smart_MessageBody_t stEvt);

typedef struct Smart_ModualCfg_t_ {
    Smart_ModCbk_pf pfCallBack;
} Smart_ModualCfg_t;

al_int Al_Smart_Listener(void *argv);
al_int32 Al_Smart_Set_Action(al_uint8 inCmd, al_uint8 * data, al_uint8 size);
al_int32 Al_Smart_Get_Action(al_uint8 inCmd, void * data);
UINT32 APP_Smart_Set_TVLanguage(AL_Enum_Smart_Get_Language language);

#endif
