#ifndef _H_MENU_H_
#define _H_MENU_H_

//#include "sed1520.h"
#include <stdio.h>
#include<./App_moduleConfig.h> 

#define KeyValueMenu    1
#define KeyValueOk      2
#define KeyValueUP      3
#define KeyValueDown    4

//(1) ÎÄ±¾ÐÅÏ¢          ¿ªÊ¼Page 6800-6899   100 page
//(2) ÊÂ¼þÉèÖÃ          ¿ªÊ¼Page 6900-6949    50 page
//(3) ÐÅÏ¢µã²¥²Ëµ¥ÉèÖÃ  ¿ªÊ¼Page 6950-6999    50 page
#define InforStartPage_Text       6800
#define InforStartPage_Affair     6900
#define InforStartPage_Meun       6950


#define DECL_BMP(width,height,imgdata)	struct IMG_DEF BMP_##imgdata={width,height,imgdata}	

#define MaxBankIdleTime  1200//60s  LCDÈÎÎñÖ´ÐÐÖÜÆÚ60ms,1minÃ»ÓÐ°´¼ü²Ù×÷ÍÆ³öµ½idle×´Ì¬


typedef void (*SHOW)(void);
typedef void (*KEYPRESS)(unsigned int);
typedef void (*TIMETICK)(unsigned int);
typedef void (*MSG)(void *p);



typedef  __packed struct _menuitem{
	char *caption;			/*²Ëµ¥ÏîµÄÎÄ×ÖÐÅÏ¢*/
	unsigned char len;
	SHOW show;				/*ÏÔÊ¾Ê±µ÷ÓÃ£¬³õÊ¼»¯ÏÔÊ¾*/
	KEYPRESS keypress;		/*·¢Éú°´¼üÊ±µ÷ÓÃ*/
	TIMETICK timetick;		/*ÏòÆäÌá¹©ÏµÍ³tick£¬±ÈÈç·µ»Ø´ý»ú»­Ãæ*/
	MSG msg;	
	struct _menuitem *parent;	   
}MENUITEM; 

typedef __packed struct _menuitem * PMENUITEM; 


extern unsigned int CounterBack;
extern unsigned char UpAndDown;
extern unsigned char KeyValue;
extern unsigned char KeyCheck_Flag[4];


typedef __packed struct
{
unsigned int id;
unsigned int len;
unsigned char *p;
}MB_SendDataType;

typedef __packed struct
{
unsigned char Num;
unsigned char Drver_Name[22];
unsigned char StartTime[6];
unsigned char EndTime[6];
}PilaoRecord;

typedef __packed struct
{
unsigned char Num;
unsigned char Drver_Name[22];
unsigned char StartTime[6];
unsigned char EndTime[6];
unsigned char Speed;
}ChaosuRecord;

typedef __packed struct
{
unsigned char Head[3];
unsigned int Flag;
unsigned int AllLen;
unsigned char ZCFlag[2];
//unsigned char *PInfor;
unsigned char PInfor[200];
unsigned char CheckOut;
unsigned char End[3];
}DispMailBoxInfor;

extern unsigned char XinhaoStatus[20];
extern unsigned char XinhaoStatusBAK[20]; 

extern unsigned int  tzxs_value;
extern unsigned char send_data[10];
extern MB_SendDataType mb_senddata;

extern unsigned char Dis_date[22];
extern unsigned char Dis_speDer[20];


extern unsigned char GPS_Flag,Gprs_Online_Flag;//¼ÇÂ¼gps gprs×´Ì¬µÄ±êÖ¾
extern unsigned char DriverName[22],DriverCardNUM[20];//´ÓIC¿¨Àï¶Á³öµÄ¼ÝÊ»Ô±ÐÕÃûºÍ¼ÝÊ»Ö¤ºÅÂë
extern unsigned char speed_time_rec[15][6];

extern unsigned char ErrorRecord;
extern PilaoRecord PilaoJilu[12];
extern ChaosuRecord ChaosuJilu[20];

extern DispMailBoxInfor LCD_Post,GPStoLCD,OtherToLCD,PiLaoLCD,ChaoSuLCD;

extern unsigned char StartDisTiredExpspeed;//¿ªÊ¼ÏÔÊ¾Æ£ÀÍ»òÕß³¬ËÙ¼ÝÊ»µÄ¼ÇÂ¼,ÔÙÅÐ¶ÏÌáÊ¾Ê±¼äÐÅÏ¢´íÎóÊ±ÓÃ
extern unsigned char tire_Flag,expsp_Flag;
extern unsigned char pilaoCounter,chaosuCounter;//¼ÇÂ¼·µ»ØÆ£ÀÍ¼ÝÊ»ºÍ³¬ËÙ¼ÝÊ»µÄÌõÊý
extern unsigned char pilaoCouAscii[2],chaosuCouAscii[2];

extern unsigned char ServiceNum[13];//Éè±¸µÄÎ¨Ò»ÐÔ±àÂë,IMSIºÅÂëµÄºó12Î»
extern unsigned char DisComFlag;
extern unsigned char OneKeyCallFlag;
extern unsigned char data_tirexps[120];
extern u8 CarSet_0_counter;//¼ÇÂ¼ÉèÖÃ³µÁ¾ÐÅÏ¢µÄÉèÖÃÄÚÈÝ1:³µÅÆºÅ2:ÀàÐÍ3:ÑÕÉ«

extern u8 MENU_set_carinfor_flag;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM    *pMenuItem;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_0_password;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM    Menu_0_0_SpdType;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_1_license;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_2_CarType;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_3_Sim;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_4_vin;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_5_Colour;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_0_loggingin;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_1_Idle;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_1_Status8;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_2_Speed15;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_3_CentreTextStor;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_4_CarInfor;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_5_DriverInfor;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_6_Mileage;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_7_RequestProgram;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_8_DnsIpDisplay;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_2_InforCheck;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_1_CenterQuesSend;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_2_FullorEmpty;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_3_ElectronicInfor;
//ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_4_Multimedia;
//ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_5_MultimediaTrans;
//ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_6_Record;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_7_Affair;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM    Menu_3_8_LogOut;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_3_InforInteract;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM    Menu_4_1_pilao;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_4_2_chaosu;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_4_InforTirExspd;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_1_TelDis;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_2_TelAtd;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_3_bdupgrade;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_4_bdColdBoot;
//ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_5_can;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_6_Concuss;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_7_Version;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_8_Usb;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_5_other;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_6_SetInfor;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_7_CentreTextDisplay;

ALIGN(RT_ALIGN_SIZE)extern  MENUITEM    Menu_8_SetDNS;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_8_1_MainDnsPort;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_8_2_AuxDnsPort;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_8_3_MainIpPort;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_8_4_AuxIpPort;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_8_5_ProDnsIp;
ALIGN(RT_ALIGN_SIZE)extern  MENUITEM	Menu_8_6_Apn;

extern unsigned char SetVIN_NUM;//   1:ÉèÖÃ³µÅÆºÅÂë  2:ÉèÖÃVIN
extern unsigned char OK_Counter;//¼ÇÂ¼ÔÚ¿ì½Ý²Ëµ¥ÏÂok¼ü°´ÏÂµÄ´ÎÊý
extern unsigned char Screen_In,Screen_in0Z; //¼ÇÂ¼±¸Ñ¡ÆÁÄÚÑ¡ÖÐµÄºº×Ö

extern unsigned char OKorCancel,OKorCancel2,OKorCancelFlag;
extern unsigned char SetTZXSFlag,SetTZXSCounter;//SetTZXSFlag  1:Ð£×¼³µÁ¾ÌØÕ÷ÏµÊý¿ªÊ¼  2:Ð£×¼³µÁ¾ÌØÕ÷ÏµÊý½áÊø

extern unsigned char OUT_DataCounter,DataOutStartFlag,DataOutOK;
extern unsigned char Rx_TZXS_Flag;
extern unsigned char battery_flag,tz_flag;
extern unsigned char USB_insertFlag;

extern unsigned char BuzzerFlag;
extern unsigned char DaYin;
extern unsigned char DaYinDelay;

extern unsigned char FileName_zk[11];
//==============12*12========¶Á×Ö¿âÖÐºº×ÖµÄµãÕó==========
extern unsigned char test_00[24],Read_ZK[24];


//¡ü ¡ý
extern unsigned char UpAndDown_nm[4];
extern unsigned char ICcard_flag;


extern unsigned char DisInfor_Menu[8][20];
extern unsigned char DisInfor_Affair[8][20];


//========================================================================
extern unsigned char UpdataDisp[8];//±±¶·Éý¼¶½ø¶È
extern unsigned char BD_updata_flag;//±±¶·Éý¼¶¶ÈuÅÌÎÄ¼þµÄ±êÖ¾
extern unsigned int  FilePageBD_Sum;//¼ÇÂ¼ÎÄ¼þ´óÐ¡£¬¶ÁÎÄ¼þ´óÐ¡/514
extern unsigned int  bd_file_exist;//¶Á³ö´æÔÚÒªÉý¼¶µÄÎÄ¼þ
extern unsigned char device_version[30];  
extern unsigned char bd_version[20];


extern unsigned char ISP_Updata_Flag; //Ô¶³ÌÉý¼¶Ö÷»ú³ÌÐò½ø¶ÈÏÔÊ¾±êÖ¾   1:¿ªÊ¼Éý¼¶  2:Éý¼¶Íê³É

extern unsigned char BD_upgrad_contr;
extern unsigned char print_rec_flag;
extern u8 print_workingFlag;  // ´òÓ¡½øÐÐÖÐ¡£¡£ 

//------------ Ê¹ÓÃÇ°Ëø¶¨Ïà¹Ø ------------------
extern unsigned char Menu_Car_license[10];//´æ·Å³µÅÆºÅÂë
extern u8  Menu_VechileType[10];  //  ³µÁ¾ÀàÐÍ
extern u8  Menu_VecLogoColor[10]; // ³µÅÆÑÕÉ« 
extern u8 Menu_color_num; 
extern u8 Menu_Vin_Code[17];
extern u8 Menu_sim_Code[12];
extern u8 License_Not_SetEnable;//    1:³µÅÆºÅÎ´ÉèÖÃ
extern u8 Menu_color_num; 
extern u8 menu_type_flag,menu_color_flag;


extern u8 Password_correctFlag;  // ÃÜÂëÕýÈ·
extern u8 Exit_to_Idle;
extern u8 Dis_deviceid_flag;

extern u8 NET_SET_FLAG;
extern u8 CAR_SET_FLAG;
//´æ´¢ÊäÈëµÄÏàÓ¦ÐÅÏ¢
extern u8 Menu_MainDns[20];
extern u8 Menu_AuxDns[20];
extern u8 Menu_MainIp[20];
extern u8 Menu_AuxIp[20];
extern u8 Menu_Apn[20];

extern void Cent_To_Disp(void);
extern void version_disp(void);
extern void ReadPiLao(unsigned char NumPilao);
extern void ReadEXspeed(unsigned char NumExspeed);
extern void Dis_pilao(unsigned char *p);
extern void Dis_chaosu(unsigned char *p);
extern unsigned char Fetch_15minSpeed(unsigned char Num15);

#endif

