#ifndef GVALUE_H_
#define GVALUE_H_

#include "gType.h"

#define dBIT_UPDATE	0x01
#define dBIT_CHECK	0x02
#define dBIT_FOUND	0x04

#define dPORT_COUNT_USING	40

#define dNETWORK_MACHINE_COUNT		32
#define dNETWORK_MACHINE_MASTER_COUNT	8

#define dEP_MAX_COUNT_PER_PORT	250
#define dPORT_MAX_COUNT			40

#define dHANDCTL_MAX_COUNT		20
#define dHANDCTL_KEY_MAX_COUNT	128

#define dDIRECTCTL_MAX_COUNT		20
#define dDIRECTCTL_KEY_MAX_COUNT	8	

#define dMOTHERBOARD_MAX_COUNT 	8
#define dCOMMBOARD_MAX_COUNT 		8

#define dFIREPUMP_ASSIGN_TYPE		180

#define dDISPLAYPAD_MAX_COUNT		16	//for One Circuit

#define dLINKAGE_MAX_COUNT		2048

#define dAreaCountMax		1024

#define dADDR_OFFSET_PORT	 	1
#define dADDR_OFFSET_DIRECTCTL	66
#define dADDR_DIRECTPAD_START		66
#define dADDR_DIRECTPAD_END		85
#define dADDR_HANDPAD_START		101
#define dADDR_HANDPAD_END		120
#define dADDR_OFFSET_MOTHERBOARD	65

#define dONE_CTRL_DESCP_BYTES		360000

#define dAddrSdRam_BackScreen			0xC3E80000

//see the excel xls File
#define dAddrSdRam_NetEpState			0xC0B00000

#define dAddrSdram_C2cOutEntryFireBuf	(0xC1900000)
#define dAddrSdram_C2cOutEntrySvBuf		(0xC1900000 + 0x00060000)
#define dAddrSdram_C2cOutEntryLinkBuf	(0xC1900000 + 0x00090000)
#define dAddrSdram_C2cOutBuf 			(0xC1900000 + 0x000C0000)
#define dAddrSdram_C2cOutEntryFaultBuf		(0xC1A00000)
#define dAddrSdram_C2cOutEntryNormalBuf		(0xC1A00000 + 0x00080000)
#define dAddrSdram_C2cOutEntryBasicServiceBuf	(0xC1A00000 + 0x000E0000)

#define dAddrSdram_NwFireIdf			0xC1B00000
#define dAddrSdram_NwDelayStart		0xC1C00000	
#define dAddrSdram_RuntimeCheck		0xC1EA0000	
#define dAddrSdram_NwUserCodeAbs		0xC1F00000

#define dAddrSdram_CrtTxBuf			0xC2000000
#define dAddrSdram_CrtRxBuf			0xC2100000
#define dAddrSdram_InnerCan			0xC2200000
#define dAddrSdram_InnerCanFastOut		0xC22C4000
#define dAddrSdram_FECStdBuf			0xC2300000
#define dAddrSdram_CfgBuf			0xC2400000


#define dAddrSdram_PrintBuf			0xC2500000

#define dAddrSdRam_Commom			0xC3A00000
#define dAddrSdRam_Register			dAddrSdRam_Commom
#define dAddrSdRam_CtrlInf			dAddrSdRam_Commom
#define dAddrSdRam_DupCheck			dAddrSdRam_Commom
#define dAddrSdRam_HwInf			dAddrSdRam_Commom

#define dAddrSdRam_Descp			0xC3B00000
#define dAddrSdRam_4Area			0xC3B90000	//128k 
#define dAddrSdRam_4UserCodeMatch		0xC3BC0000	//128k
#define dAddrSdRam_DescpNw			0xC0D00000

#define HOTKEY_FIRE_ALRAM	0x72
#define HOTKEY_LINKAGE_START	0x73	
#define HOTKEY_INF_CONF		0x74
#define HOTKEY_SELF_CHECK	0x75
#define HOTKEY_MUTE		0x76
#define HOTKEY_RESET		0xE9
#define HOTKEY_CHECK		0x77
#define HOTKEY_AUTO_ALLOW	243
#define HOTKEY_MANUAL_ALLOW	244

#define dfKEY_ASTERISK		0x6E		//  Key value for *	asterisk
#define dfKEY_SIG			0xBF		//  Key value for #
#define dfKEY_SETUP		0x70		//  Key value for SETUP
#define dfKEY_QUERY		0x71		//  Key value for QUERY
#define dfKEY_ENCN		0x10		//  Key value for EN/CN

#define dgTYPE_NoType				0
#define dgTYPE_SMOKE_DETECTOR			23
#define dgTYPE_TEMPE_DETECTOR			31
#define dgTYPE_HAND_REPORT			61
#define dgTYPE_FIRE_HydrantKp			62
#define dgTYPE_IN_MODULE			72
#define dgTYPE_OUT_MODULE			73
#define dgTYPE_INOUT_MODULE_NonSource	74
#define dgType_VAALRAM				82
#define dgTYPE_DISPLAY_PAD			10
#define dgTYPE_SMOKE_TEMPE_DETECTOR		225
#define dgTYPE_INOUT_MODULE_Source		230
#define dgTYPE_LINKAGE_POWERSUPLY		245

#define dASSIGN_TYPE_Broadcast		231


/*
typedef enum{
	ActLoginII = 0,
	ActLogoutII = 1,	
	ActLoginIII, 
	ActLogoutIII
}TGuiActionMenu_0;

typedef enum{
	ActQueDevice = 0,
	ActQueRegAddr , 
	ActQueMaskDevice, 
	ActQueConfig, 
	ActQueInterLink, 
	ActQueInterLink4Pad, 
	ActQueNetwork,
	ActNull1
}TGuiActionMenu_1;

typedef enum{
	ActQueMsgAll = 0, 
	ActQueMsgAlarm, 
	ActQueMsgFault , 
	ActQueMsgSuperVi, 
	ActQueMsgOperator, 
	ActQueMsgLinkage ,
	ActNull2
}TGuiActionMenu_2;

typedef enum{
	Actxx0 = 0,
	ActNull3
}TGuiActionMenu_3;

typedef enum{
	ActDeviceSetup = 0,
	ActNull4
}TGuiActionMenu_4;

typedef enum{
	Actxx3 = 0,
	ActNull5
}TGuiActionMenu_5;

typedef enum{
	ActNewRegister = 0,
	ActAddRegister = 1,
	ActManualAddRegister = 2,
	ActManualRemoveRegister = 3,
}TGuiActionMenu_6;

typedef enum{
	Actxx5 = 0,
	ActNull7
}TGuiActionMenu_7;

typedef enum{
	Actxx6 = 0,
	ActNull8
}TGuiActionMenu_8;

typedef enum{
	ActAboutUs = 0,
}TGuiActionMenu_9;

typedef enum{
	PermissonSet_I = 0,
	PermissonSet_II = 1, 
}TGuiActionMenu_10;
*/
typedef enum {
	guiIdle = 0,

	//menu 
	guiMenu ,
	guiShowEvent,
	
	guiDeviceCheck ,
	guiDeviceSetup , 
	guiUserSetup ,
	guiDeviceMask ,
	guiDeviceExercise ,
	guiCheckNormal,
	
	guiStateGiveBack,
	guiStateOccupy,
	guiStateRemote,
	
	guiTipPopup,
}TGuiState;

typedef enum{
	guiMsgNone = 0,
	guiMsgReturn,
	guiMsgPrev,
	guiMsgNext,
	guiMsgChanged,
	guiMsgOkAndReturn,
	guiMsgSel1AndReturn,
	guiMsgSel2AndReturn,
}TGuiMsgReturn;

typedef struct{
	struct{
		unsigned char data[24];
		unsigned int Index;
		unsigned int Limited;
		unsigned int Rdy;
	}Rx,Tx;
}TUartBuf;

typedef enum{
	piMemo = 0,
	piChart = 1,
	piEdit = 2,

}TPanelItemType;

typedef struct{
	int Left;
	int Top;
	int Width;
	int Heigh;
	int Right;
	int Bottom;
}TContentGeometry;

typedef struct{
	struct{
		int Left;
		int Top;
		int Width;
		int Heigh;
		int Right;
		int Bottom;
	}Caption;
	struct{
		int Left[12];
		int Top[12];
		int Right[12];
		int Bottom[12];
		int UsingCount;
	}Grid;
	struct{
		int Left;
		int Top;
		int Width;
		int Heigh;
		int Right;
		int Bottom;
		TPanelItemType ItemType;
		int Active;
	}Panel;
	struct{
		int Left;
		int Top;
		int Width;
		int Heigh;
		int Right;
		int Bottom;
		TPanelItemType ItemType;
		int Active;
	}PanelSmall;
}TLv;

extern TGuiState GuiState, GuiStateBAK;
extern unsigned char ActList_0;
extern unsigned char ActList_1;
extern unsigned char ActList_2;
extern unsigned char ActList_3;
extern unsigned char ActList_4;
extern unsigned char ActList_5;
extern unsigned char ActList_6;
extern unsigned char ActList_7;
extern unsigned char ActList_8;
extern unsigned char ActList_9;
extern unsigned char ActList_10;

extern TUartBuf uart1;

extern const char CharLinkage[16];
extern const char CharBusPadProgram[16];
extern const char StrHwType[256][32];
extern const char StrHwTypeEn[256][32];
extern const char StrRootType[16][32];
extern const char StrType[256][32];
extern const char StrTypeShortName[256][32];

extern const char StrAssign_iType[60][32];
extern const char StrAssign_oType[60][32];
extern const char StrType_Unknown[];
extern const char StrType_PowerBoard[];
extern const unsigned char TypeToIconIndex[256];

extern const char StrEpFaultType[16][24];
extern const char StrBrdFaultType[dBoardFaultTypeMax][24];
extern const char StrDevFaultType[32][24];

extern const char TextAdjust[16];
extern const char TextAuto[16];
extern const char TextAllAuto[16];
extern const char TextManual[16];
extern const char TextSplash[16];
extern const char TextPrint[16];

extern const char TextAdjustNot[16];
extern const char TextAutoNot[16];
extern const char TextAllAutoNot[16];
extern const char TextManualNot[16];
extern const char TextSplashNot[16];
extern const char TextPrintNot[16] ;

extern const unsigned int GuiRedrawDataList[6][4];

//EN 

extern const char StrTypeShortNameEn[256][32];
extern const char StrDevFaultTypeEn[32][24];
extern const char StrEpFaultTypeEn[16][24];
extern const char StrBrdFaultTypeEn[dBoardFaultTypeMax][24];

extern void GlobalValue_init(void);
extern void Clear(void);
extern void StateBarReflash();


#endif

