#include "CheckNormal.h"

#define clOdd	clMoneyGreen
#define clEven	clWhiteBlue

static const short GridX [5] = {10, 160, 300, 500, 700};
static const short GridX2[5] = {156, 296, 496, 696, 786};
static const short GridY [10] = {86, 126, 496, 696, 786};
static const short GridY2[10] = {156, 296, 496, 696, 786};

void TCheckNormal::Init(int x1, int y1, int aW, int aH, int OwnerX, int OwnerY, u32 aColor)
{
	#define CH	30	//Caption Height
	unsigned short Left,Right, Top, Bottom, Width, Height, i;
	Bound.SetBySize(OwnerX + x1, OwnerY + y1, aW, aH);
	Left = Bound.Left +3;
	Top = Bound.Top+3;
	Width = aW - 7;
	Height = aH - 7;
	Right = Bound.Right -4;
	Bottom = Bound.Bottom -4;
	Caption.Init(Left,Top,Width, CH, 0, 0, clWhite, clMaroon);
	Content.Set(Left, Top+CH, Right, Bottom);
	Color = aColor;
	#undef CH
	
	Caption.Border.Color = clGray;
	
	Lv.ColHeight = 27;
	Lv.RowCount = 10;
	Lv.FixColTop = Content.Top + 32;
	Lv.FixColBottom = Lv.FixColTop + Lv.ColHeight;
	Lv.ColTop[0] = Lv.FixColBottom + 1;
	Lv.ColBottom[0] = Lv.ColTop[0] + Lv.ColHeight -1;
	
	for(i=1; i<12; i++){
		Lv.ColTop[i] 	= 	Lv.ColTop[i -1] 	+ Lv.ColHeight;
		Lv.ColBottom[i] 	=  	Lv.ColBottom[i-1] + Lv.ColHeight; 
	}
	
	SlaveCheckInx = 0;
	AskInx =0;
	for(i=0;i<20;i++)HasDrawData[i] = 0;
	
	AutoReturnTick = 0;
	
	CheckDoneClear();
}

void TCheckNormal::RenderContent(void)
{
	RectFillRender(Content.Left, Content.Top, Content.Right, Content.Bottom, Color);	
}

void TCheckNormal::DrawSelf(void)
{
	unsigned int x, y, x2, y2, w, h;
	
	VertLineRender(Bound.Left,		Bound.Top, 			Bound.Height -1,			0xFFFFFFFF);
	VertLineRender(Bound.Right -1,	Bound.Top +1,		Bound.Height -2,			0xFF808080);
	VertLineRender(Bound.Right,		Bound.Top,			Bound.Height,			0xFF404040);
	
	HorizLineRender(Bound.Left, 		Bound.Top, 			Bound.Width - 1, 			0xFFFFFFFF);
	HorizLineRender(Bound.Left +1, 	Bound.Bottom -1,  	Bound.Width - 2, 			0xFF808080);
	HorizLineRender(Bound.Left,		Bound.Bottom,		Bound.Width,			0xFF404040);
	
	x = Bound.Left +2 ;	
	x2 = Bound.Right -2;
	y = Bound.Top +2;
	y2 = Bound.Bottom - 2;
	w = Bound.Width -4;
	h = Bound.Height - 4;
	VertLineRender	(x,		y, 		h-1,	0xFF808080);
	HorizLineRender	(x,		y, 		w-1,	0xFF808080);
		
	VertLineRender	(x+1,		y+1, 		h-2,	0xFF404040);
	HorizLineRender	(x+1,		y+1, 		w-2,	0xFF404040);
	
	VertLineRender	(x2-1,	y+1, 		h-2,	0xFFD4D0C8);
	HorizLineRender	(x+1,		y2-1, 	w-2,	0xFFD4D0C8);

	VertLineRender	(x2,		y, 	  	h,	0xFFFFFFFF);
	HorizLineRender	(x,		y2, 		w,	0xFFFFFFFF);
	
	RenderContent();
	
	SetListColWidth(200,135,135,135,135,2);
	RectFillRender(Lv.ColLeft[0], Lv.FixColTop, Lv.ColLeft[5], Lv.FixColBottom, clDeepBlue);
	for(x=0; x<(11); x++){		
		if(x & 1){
			RectFillRender(Lv.ColLeft[0], Lv.ColTop[x], Lv.ColLeft[5], Lv.ColBottom[x], clEven);
		}else{
			RectFillRender(Lv.ColLeft[0], Lv.ColTop[x], Lv.ColLeft[5], Lv.ColBottom[x], clOdd);
		}							
	}
	
	h = clNearBlack;
	for(x=0; x<6; x++){		
		VertLineRender	(Lv.ColLeft[x],	Lv.FixColTop, 	 Lv.ColBottom[10] - Lv.FixColTop +1,	h);						
	}
	
	HorizLineRender	(Lv.ColLeft[0],	Lv.FixColTop, 	 Lv.ColLeft[5] - Lv.ColLeft[0] +1,	h);
	for(y=0; y<12; y++){		
		HorizLineRender	(Lv.ColLeft[0],	Lv.ColTop[y], 	 Lv.ColLeft[5] - Lv.ColLeft[0] +1,	h);						
	}
}

void TCheckNormal::SetListColWidth(int w0, int w1, int w2, int w3, int w4,int w5)
{
	unsigned int i;
	Lv.ColWidth[0] = w0;
	Lv.ColWidth[1] = w1;
	Lv.ColWidth[2] = w2;
	Lv.ColWidth[3] = w3;
	Lv.ColWidth[4] = w4;
	Lv.ColWidth[5] = w5;
	
	Lv.ColLeft[0] = Content.Left +10;
	Lv.ColRight[0] = Lv.ColLeft[0] + w0;
	for(i=1; i<6; i++){
		Lv.ColLeft[i] 	= Lv.ColRight[i-1] 	+	1;
		Lv.ColRight[i] 	= Lv.ColLeft[i] 		+ 	Lv.ColWidth[i];	
	}
}

void TCheckNormal::DrawCaption(void)
{	
	if(LanguageEnCn==0)TMyString::sFromStr("快捷检查", Caption.Text);
	else TMyString::sFromStr("CheckOut", Caption.Text);
	Caption.Show();
}

void TCheckNormal::Show(void)
{
	DrawSelf();
	Caption.Enable = 1;
	DrawCaption();
	IsShowing = 1;
	
	DrawGridAndText();
	Record.OperateAdd_UserCheck(MainCtl.fData.Split.MyNum, 1);
	
	SlaveCheckInx = 0;
	LoadCtlNum = 0;
	AskInx = 0;
	ShowCtlNum();
	
	CheckDoneClear();
}

void TCheckNormal::ShowCtlNum()
{
	if(MainCtl.fData.Split.NetworkMode == 1){
		if(LoadCtlNum == 0){
			if(LanguageEnCn==0){
				TextRender_string24(300, 73, clNearBlack, Color, "本集中机 " );
				TextDigitRender2Right24(440, 73, clNearBlack, Color,  MainCtl.fData.Split.MyNum);
			}else{
				TextRender_string24(460, 73, clNearBlack, Color, "This Centre " );
				TextDigitRender2Right24(652, 73, clNearBlack, Color,  MainCtl.fData.Split.MyNum);
			}
		}else
		if(LoadCtlNum <= dNETWORK_MACHINE_COUNT){
			if(LanguageEnCn==0){
				TextRender_string24(300, 73, clNearBlack, Color, "区域机   " );
				TextDigitRender2Right24(440, 73, clNearBlack, Color,  LoadCtlNum);
			}else{
				TextRender_string24(460, 73, clNearBlack, Color, "Remote Regional " );
				TextDigitRender2Right24(652, 73, clNearBlack, Color,  LoadCtlNum);
			}
		}else{
			if(LanguageEnCn==0){
				TextRender_string24(300, 73, clNearBlack, Color, "网络总计 " );
				TextRender_string24(440, 73, clNearBlack, Color, "   " );
			}else{
				TextRender_string24(460, 73, clNearBlack, Color, "Network " );
				TextRender_string24(652, 73, clNearBlack, Color, "   " );
			}
		}
	}else
	if(MainCtl.fData.Split.NetworkMode == 2){
		if(LanguageEnCn==0){
			TextRender_string24(300, 73, clNearBlack, Color, "本区域机 " );
			TextDigitRender2Right24(440, 73, clNearBlack, Color,  MainCtl.fData.Split.MyNum);
		}else{
			TextRender_string24(400, 73, clNearBlack, Color, "This Regional " );
			TextDigitRender2Right24(580, 73, clNearBlack, Color,  MainCtl.fData.Split.MyNum);
		}
	}else{
		if(LanguageEnCn==0){
			TextRender_string24(300, 73, clNearBlack, Color, "本机     " );
			TextDigitRender2Right24(440, 73, clNearBlack, Color,  MainCtl.fData.Split.MyNum);
		}else{
			TextRender_string24(400, 73, clNearBlack, Color, "Stand Alone " );
			TextDigitRender2Right24(560, 73, clNearBlack, Color,  MainCtl.fData.Split.MyNum);
		}
	}
}


void TCheckNormal::Hide()
{
	if(IsShowing){
		Record.OperateAdd_UserCheck(MainCtl.fData.Split.MyNum, 0);
		IsShowing = 0;
	}
}

void TCheckNormal::ReDraw(void)
{
	DrawSelf();
	Caption.Enable = 1;
	DrawCaption();
	IsShowing = 1;
	DrawGridAndText();
	ShowCtlNum();
	ShowData(1);
}

void TCheckNormal::ShowData(unsigned int Force)
{
	if(Force){
		if(LoadCtlNum == 0){
			LoadAndDrawData();
			HasDrawData[0] = 1;
		}else
		if(LoadCtlNum <=dNETWORK_MACHINE_COUNT){
			if(ProtoC2C.IsCheckNormalDataSlaveDone[LoadCtlNum-1]){
				LoadAndDrawDataSlave(LoadCtlNum);
				HasDrawData[LoadCtlNum] = 1;
			}else{
				HasDrawData[LoadCtlNum] = 0;
			}
		}else{
			if(IsSlaveDone){
				LoadAndDrawDataAll();
				HasDrawData[dNETWORK_MACHINE_COUNT+1] = 1;
			}else{
				HasDrawData[dNETWORK_MACHINE_COUNT+1] = 0;
			}
		}
	}else{
		if(LoadCtlNum == 0){
			if(HasDrawData[0] == 0){
				LoadAndDrawData();
				HasDrawData[0] = 1;
			}
		}else
		if(LoadCtlNum <= dNETWORK_MACHINE_COUNT){
			if(HasDrawData[LoadCtlNum] == 0){
				if(ProtoC2C.IsCheckNormalDataSlaveDone[LoadCtlNum-1]){
					LoadAndDrawDataSlave(LoadCtlNum);
					HasDrawData[LoadCtlNum] = 1;
				}
			}
		}else{
			if(HasDrawData[dNETWORK_MACHINE_COUNT+1] == 0){
				if(IsSlaveDone){
					LoadAndDrawDataAll();
					HasDrawData[dNETWORK_MACHINE_COUNT+1] = 1;
				}
			}
		}		
	}
}

TGuiMsgReturn TCheckNormal::KeyIn(unsigned char aKey)
{
	int ind,i,aIndex;
	TGuiMsgReturn aMsg = guiMsgNone;
	//Up or Down One Index___________________
	AutoReturnTick = 0;
	if(aKey == VK_LEFT){
		if(MainCtl.fData.Split.NetworkMode == 1){
			if(ProtoC2C.SlaveCount >0){
				if(SlaveCheckInx > 0){
					SlaveCheckInx--;
				}else{
					SlaveCheckInx = ProtoC2C.SlaveCount +1;
				}
				
				if(SlaveCheckInx == 0){
					LoadCtlNum = 0;
				}else
				if(SlaveCheckInx < (ProtoC2C.SlaveCount+1)){
					LoadCtlNum = ProtoC2C.SlaveList[SlaveCheckInx-1];
				}else{
					CheckNwAllCount();
					LoadCtlNum = 100;
				}
				ClearAndDrawData();
				ShowCtlNum();
				ShowData(1);
			}
		}
	}else
	if(aKey == VK_RIGHT){
		if(MainCtl.fData.Split.NetworkMode == 1){
			if(ProtoC2C.SlaveCount >0){
				if(SlaveCheckInx < (ProtoC2C.SlaveCount +1)){
					SlaveCheckInx++;
				}else{
					SlaveCheckInx =0;
				}
				
				if(SlaveCheckInx == 0){
					LoadCtlNum = 0;
				}else
				if(SlaveCheckInx < (ProtoC2C.SlaveCount+1)){
					LoadCtlNum = ProtoC2C.SlaveList[SlaveCheckInx-1];
				}else{
					CheckNwAllCount();
					LoadCtlNum = 100;
				}
				ClearAndDrawData();
				ShowCtlNum();
				ShowData(1);
			}
		}
	}else
	if(aKey == VK_EXECUTE){

	}else
	if(aKey == VK_F2){

		
	}else
	if(aKey == VK_RETURN){
		Hide();
		aMsg = guiMsgReturn;
	}	
	return aMsg;
}

void TCheckNormal::DrawGridAndText()
{
	int x,y;
	if(LanguageEnCn==0){
		y = Lv.FixColTop +1;
		TextRender_string24(Lv.ColLeft[0] + 60, y ,clNearWhite, "类型" );
		TextRender_string24(Lv.ColLeft[1] + 22, y, clNearWhite, "设计数量" );
		TextRender_string24(Lv.ColLeft[2] +  8, y, clNearWhite, "正常工作数" );
		TextRender_string24(Lv.ColLeft[3] + 36, y, clNearWhite, "故障数" );
		TextRender_string24(Lv.ColLeft[4] + 36, y, clNearWhite, "屏蔽数" );
		
		x = Lv.ColLeft[0] + 10;
		TextRender_string24(x, Lv.ColTop[0] + 1, clNearBlack, clOdd, "烟感" );
		TextRender_string24(x, Lv.ColTop[1] + 1, clNearBlack, clEven, "温感" );
		TextRender_string24(x, Lv.ColTop[2] + 1, clNearBlack, clOdd, "手报" );
		TextRender_string24(x, Lv.ColTop[3] + 1, clNearBlack, clEven, "消钮" );
		TextRender_string24(x, Lv.ColTop[4] + 1, clNearBlack, clOdd, "输入模块" );
		TextRender_string24(x, Lv.ColTop[5] + 1, clNearBlack, clEven, "输入输出模块" );
		TextRender_string24(x, Lv.ColTop[6] + 1, clNearBlack, clOdd, "输出模块" );
		TextRender_string24(x, Lv.ColTop[7] + 1, clNearBlack, clEven, "声光警报器" );
		TextRender_string24(x, Lv.ColTop[8] + 1, clNearBlack, clOdd, "层显" );
		TextRender_string24(x, Lv.ColTop[9] + 1, clNearBlack, clEven, "联动电源" );
		TextRender_string24(x, Lv.ColTop[10] + 1, clNearBlack, clOdd, "其他" );
	}else{
		y = Lv.FixColTop +1;
		TextRender_string24(Lv.ColLeft[0] + 60, y ,clNearWhite, "Dev Type" );
		TextRender_string24(Lv.ColLeft[1] + 22, y, clNearWhite, "Designed" );
		TextRender_string24(Lv.ColLeft[2] + 20, y, clNearWhite, "IDLE" );
		TextRender_string24(Lv.ColLeft[3] + 36, y, clNearWhite, "Fault" );
		TextRender_string24(Lv.ColLeft[4] + 36, y, clNearWhite, "Blocking" );
		
		x = Lv.ColLeft[0] + 10;
		TextRender_string24(x, Lv.ColTop[0] + 1, clNearBlack, clOdd, "Smoke Detector" );
		TextRender_string24(x, Lv.ColTop[1] + 1, clNearBlack, clEven, "Tempe Detector" );
		TextRender_string24(x, Lv.ColTop[2] + 1, clNearBlack, clOdd, "Report KeyPad" );
		TextRender_string24(x, Lv.ColTop[3] + 1, clNearBlack, clEven, "Hydrant KeyPad" );
		TextRender_string24(x, Lv.ColTop[4] + 1, clNearBlack, clOdd, "Input Module" );
		TextRender_string24(x, Lv.ColTop[5] + 1, clNearBlack, clEven, "In/Out Module" );
		TextRender_string24(x, Lv.ColTop[6] + 1, clNearBlack, clOdd, "Output Module" );
		TextRender_string24(x, Lv.ColTop[7] + 1, clNearBlack, clEven, "Acoustooptic" );
		TextRender_string24(x, Lv.ColTop[8] + 1, clNearBlack, clOdd, "Floor Display" );
		TextRender_string24(x, Lv.ColTop[9] + 1, clNearBlack, clEven, "Linkage Power" );
		TextRender_string24(x, Lv.ColTop[10] + 1, clNearBlack, clOdd, "Other" );
	}
}

void TCheckNormal::LoadAndDrawData(void) 
{
	int x;

	//Design Count
	//MainCtl.LoadVisioInf();
	MainCtl.LoadNormalInf();
	MainCtl.LoadFaultInf();
	MainCtl.LoadMaskInf();
	
	if(IsSelfChecking)return;
	if(PmsIntervene.IsShow)return;
	
	x = Lv.ColLeft[1] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  DesigePrmData.Count.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, DesigePrmData.Count.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  DesigePrmData.Count.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, DesigePrmData.Count.HydrantKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  DesigePrmData.Count.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, DesigePrmData.Count.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  DesigePrmData.Count.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, DesigePrmData.Count.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  DesigePrmData.Count.DisplayPad);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven,  DesigePrmData.Count.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, DesigePrmData.Count.Other);
	
	x = Lv.ColLeft[2] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  MainCtl.CountEpNormal.Smoker);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, MainCtl.CountEpNormal.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  MainCtl.CountEpNormal.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, MainCtl.CountEpNormal.Fire_hydrant_Kp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  MainCtl.CountEpNormal.Input);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, MainCtl.CountEpNormal.InOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  MainCtl.CountEpNormal.Output);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, MainCtl.CountEpNormal.VaAlram);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  MainCtl.CountEpNormal.DisplayPad);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven,  MainCtl.CountEpNormal.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, MainCtl.CountEpNormal.UnDefine + MainCtl.CountEpNormal.Unknown);
	
	x = Lv.ColLeft[3] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  MainCtl.CountEpFault.Smoker);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, MainCtl.CountEpFault.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  MainCtl.CountEpFault.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, MainCtl.CountEpFault.Fire_hydrant_Kp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  MainCtl.CountEpFault.Input);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, MainCtl.CountEpFault.InOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  MainCtl.CountEpFault.Output);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, MainCtl.CountEpFault.VaAlram);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  MainCtl.CountEpFault.DisplayPad);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, MainCtl.CountEpFault.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, MainCtl.CountEpFault.UnDefine + MainCtl.CountEpFault.Unknown);
	
	x = Lv.ColLeft[4] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  MainCtl.CountEpMask.Smoker);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, MainCtl.CountEpMask.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  MainCtl.CountEpMask.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, MainCtl.CountEpMask.Fire_hydrant_Kp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  MainCtl.CountEpMask.Input);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, MainCtl.CountEpMask.InOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  MainCtl.CountEpMask.Output);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, MainCtl.CountEpMask.VaAlram);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  MainCtl.CountEpMask.DisplayPad);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven,  MainCtl.CountEpMask.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, MainCtl.CountEpMask.UnDefine + MainCtl.CountEpMask.Unknown);
}


void TCheckNormal::ClearAndDrawData(void) 
{
	int x;
	
	x = Lv.ColLeft[1] + 30;
	TextRender_string24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[1] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[3] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[5] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[7] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[9] +1, clNearBlack, clEven,  "      ");
	TextRender_string24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, "      ");
	
	x = Lv.ColLeft[2] + 30;
	TextRender_string24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[1] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[3] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[5] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[7] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[9] +1, clNearBlack, clEven,  "      ");
	TextRender_string24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, "      ");
	
	x = Lv.ColLeft[3] + 30;
	TextRender_string24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[1] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[3] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[5] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[7] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[9] +1, clNearBlack, clEven,  "      ");
	TextRender_string24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, "      ");
	
	x = Lv.ColLeft[4] + 30;
	TextRender_string24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[1] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[3] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[5] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[7] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  "      ");
	TextRender_string24(x, Lv.ColTop[9] +1, clNearBlack, clEven, "      ");
	TextRender_string24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, "      ");
}

void TCheckNormal::LoadAndDrawDataSlave(unsigned char aCtlNum) 
{
	int x;
	unsigned char PNum;
	
	if(aCtlNum == 0)return;
	if(aCtlNum > dNETWORK_MACHINE_COUNT)return;
	PNum = aCtlNum-1;
	
	x = Lv.ColLeft[1] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Designed.cOther);
	
	x = Lv.ColLeft[2] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Normal.cOther);
	
	x = Lv.ColLeft[3] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Fault.cOther);
	
	x = Lv.ColLeft[4] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, ProtoC2C.CheckNormalDataSlave[PNum].Slave.Mask.cOther);
}


void TCheckNormal::LoadAndDrawDataAll() 
{
	int x;
	unsigned char PNum;
	
	x = Lv.ColLeft[1] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Designed.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, CheckNormalDataAll.All.Designed.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Designed.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, CheckNormalDataAll.All.Designed.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Designed.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, CheckNormalDataAll.All.Designed.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Designed.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, CheckNormalDataAll.All.Designed.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Designed.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, CheckNormalDataAll.All.Designed.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, CheckNormalDataAll.All.Designed.cOther);
	
	x = Lv.ColLeft[2] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Normal.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, CheckNormalDataAll.All.Normal.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Normal.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, CheckNormalDataAll.All.Normal.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Normal.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, CheckNormalDataAll.All.Normal.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Normal.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, CheckNormalDataAll.All.Normal.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Normal.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, CheckNormalDataAll.All.Normal.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, CheckNormalDataAll.All.Normal.cOther);
	
	x = Lv.ColLeft[3] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Fault.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, CheckNormalDataAll.All.Fault.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Fault.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, CheckNormalDataAll.All.Fault.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Fault.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, CheckNormalDataAll.All.Fault.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Fault.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, CheckNormalDataAll.All.Fault.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Fault.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, CheckNormalDataAll.All.Fault.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, CheckNormalDataAll.All.Fault.cOther);
	
	x = Lv.ColLeft[4] + 30;
	TextDigitRender6Right24(x, Lv.ColTop[0] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Mask.Smoke);
	TextDigitRender6Right24(x, Lv.ColTop[1] +1, clNearBlack, clEven, CheckNormalDataAll.All.Mask.Tempe);
	TextDigitRender6Right24(x, Lv.ColTop[2] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Mask.HandReport);
	TextDigitRender6Right24(x, Lv.ColTop[3] +1, clNearBlack, clEven, CheckNormalDataAll.All.Mask.HydKp);
	TextDigitRender6Right24(x, Lv.ColTop[4] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Mask.ModuleInput);
	TextDigitRender6Right24(x, Lv.ColTop[5] +1, clNearBlack, clEven, CheckNormalDataAll.All.Mask.ModuleInOut);
	TextDigitRender6Right24(x, Lv.ColTop[6] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Mask.ModuleOutput);
	TextDigitRender6Right24(x, Lv.ColTop[7] +1, clNearBlack, clEven, CheckNormalDataAll.All.Mask.Va);
	TextDigitRender6Right24(x, Lv.ColTop[8] +1, clNearBlack, clOdd,  CheckNormalDataAll.All.Mask.FDisplay);
	TextDigitRender6Right24(x, Lv.ColTop[9] +1, clNearBlack, clEven, CheckNormalDataAll.All.Mask.LnkPs);
	TextDigitRender6Right24(x, Lv.ColTop[10] +1, clNearBlack, clOdd, CheckNormalDataAll.All.Mask.cOther);
}

void TCheckNormal::CheckDoneClear()
{
	ProtoC2C.ClearCheckNormalDataSlave();
	IsSlaveDone = 0;
}

void TCheckNormal::CheckSlaveDone()
{
	int i, x, aDone;
	aDone = 1;
	for(i=0; i<ProtoC2C.SlaveCount; i++){
		x = ProtoC2C.SlaveList[i];
		if(ProtoC2C.IsCheckNormalDataSlaveDone[x-1] == 0)aDone = 0;
	}
	IsSlaveDone = aDone;
}

void TCheckNormal::CheckNwAllCount()
{
	int i,x;
	for(i=0; i<44; i++)CheckNormalDataAll.D32[i] = 0;
	for(i=0; i<dNETWORK_MACHINE_COUNT; i++){
		for(x=0; x<44; x++)CheckNormalDataAll.D32[x] += ProtoC2C.CheckNormalDataSlave[i].D16[x];
	}

	CheckNormalDataAll.All.Designed.Smoke 		+= DesigePrmData.Count.Smoke;
	CheckNormalDataAll.All.Designed.Tempe 		+= DesigePrmData.Count.Tempe;
	CheckNormalDataAll.All.Designed.HandReport 	+= DesigePrmData.Count.HandReport;
	CheckNormalDataAll.All.Designed.HydKp 		+= DesigePrmData.Count.HydrantKp;
	CheckNormalDataAll.All.Designed.ModuleInput 	+= DesigePrmData.Count.ModuleInput;
	CheckNormalDataAll.All.Designed.ModuleInOut 	+= DesigePrmData.Count.ModuleInOut;
	CheckNormalDataAll.All.Designed.ModuleOutput 	+= DesigePrmData.Count.ModuleOutput;
	CheckNormalDataAll.All.Designed.Va 			+= DesigePrmData.Count.Va;
	CheckNormalDataAll.All.Designed.FDisplay 		+= DesigePrmData.Count.DisplayPad;
	CheckNormalDataAll.All.Designed.LnkPs 			+= DesigePrmData.Count.LnkPs;
	CheckNormalDataAll.All.Designed.cOther 		+= DesigePrmData.Count.Other;
	
	CheckNormalDataAll.All.Normal.Smoke 		+= MainCtl.CountEpNormal.Smoker;
	CheckNormalDataAll.All.Normal.Tempe 		+= MainCtl.CountEpNormal.Tempe;
	CheckNormalDataAll.All.Normal.HandReport		+= MainCtl.CountEpNormal.HandReport;
	CheckNormalDataAll.All.Normal.HydKp 		+= MainCtl.CountEpNormal.Fire_hydrant_Kp;
	CheckNormalDataAll.All.Normal.ModuleInput 	+= MainCtl.CountEpNormal.Input;
	CheckNormalDataAll.All.Normal.ModuleInOut 	+= MainCtl.CountEpNormal.InOut;
	CheckNormalDataAll.All.Normal.ModuleOutput 	+= MainCtl.CountEpNormal.Output;
	CheckNormalDataAll.All.Normal.Va 			+= MainCtl.CountEpNormal.VaAlram;
	CheckNormalDataAll.All.Normal.FDisplay 		+= MainCtl.CountEpNormal.DisplayPad;
	CheckNormalDataAll.All.Normal.LnkPs 			+= MainCtl.CountEpNormal.LnkPs;
	CheckNormalDataAll.All.Normal.cOther 		+= (MainCtl.CountEpNormal.UnDefine + MainCtl.CountEpNormal.Unknown);
	
	CheckNormalDataAll.All.Fault.Smoke 			+= MainCtl.CountEpFault.Smoker;
	CheckNormalDataAll.All.Fault.Tempe 			+= MainCtl.CountEpFault.Tempe;
	CheckNormalDataAll.All.Fault.HandReport		+= MainCtl.CountEpFault.HandReport;
	CheckNormalDataAll.All.Fault.HydKp 			+= MainCtl.CountEpFault.Fire_hydrant_Kp;
	CheckNormalDataAll.All.Fault.ModuleInput 		+= MainCtl.CountEpFault.Input;
	CheckNormalDataAll.All.Fault.ModuleInOut 		+= MainCtl.CountEpFault.InOut;
	CheckNormalDataAll.All.Fault.ModuleOutput 	+= MainCtl.CountEpFault.Output;
	CheckNormalDataAll.All.Fault.Va 			+= MainCtl.CountEpFault.VaAlram;
	CheckNormalDataAll.All.Fault.FDisplay 		+= MainCtl.CountEpFault.DisplayPad;
	CheckNormalDataAll.All.Fault.LnkPs 			+= MainCtl.CountEpFault.LnkPs;
	CheckNormalDataAll.All.Fault.cOther 		+= (MainCtl.CountEpFault.UnDefine + MainCtl.CountEpFault.Unknown);
	
	CheckNormalDataAll.All.Mask.Smoke 			+= MainCtl.CountEpMask.Smoker;
	CheckNormalDataAll.All.Mask.Tempe 			+= MainCtl.CountEpMask.Tempe;
	CheckNormalDataAll.All.Mask.HandReport		+= MainCtl.CountEpMask.HandReport;
	CheckNormalDataAll.All.Mask.HydKp 			+= MainCtl.CountEpMask.Fire_hydrant_Kp;
	CheckNormalDataAll.All.Mask.ModuleInput 		+= MainCtl.CountEpMask.Input;
	CheckNormalDataAll.All.Mask.ModuleInOut 		+= MainCtl.CountEpMask.InOut;
	CheckNormalDataAll.All.Mask.ModuleOutput 		+= MainCtl.CountEpMask.Output;
	CheckNormalDataAll.All.Mask.Va 			+= MainCtl.CountEpMask.VaAlram;
	CheckNormalDataAll.All.Mask.FDisplay 		+= MainCtl.CountEpMask.DisplayPad;
	CheckNormalDataAll.All.Mask.LnkPs 			+= MainCtl.CountEpMask.LnkPs;
	CheckNormalDataAll.All.Mask.cOther 			+= (MainCtl.CountEpMask.UnDefine + MainCtl.CountEpMask.Unknown);
}

int TCheckNormal::Task500Ms()
{
	if(IsShowing){
		AutoReturnTick++;
		if(AutoReturnTick > 110){
			Hide();
			return -1;
		}
		if(MainCtl.fData.Split.NetworkMode != 1){
			return 0;
		}
		
		if(CheckIsFrozeScreen() == 0){
			CheckSlaveDone();
			if(LanguageEnCn==0){
				if(IsSlaveDone){
					TextRender_string24(10, 75, clNearBlack, Color, "区域机加载完成  " );
				}else{
					TextRender_string24(10, 75, clNearBlack, Color, "区域机加载进行中" );
				}
			}else{
				if(IsSlaveDone){
					TextRender_string24(10, 75, clNearBlack, Color, "Remote Data Upload Completed" );
				}else{
					TextRender_string24(10, 75, clNearBlack, Color, "Remote Data Uploading       " );
				}
			}
			CheckNwAllCount();
			ShowData(0);
		}
		
		if(AskInx < ProtoC2C.SlaveCount){
			AskNum = ProtoC2C.SlaveList[AskInx];
			ProtoC2C.CheckNormalSlave(AskNum);
			AskInx++;
		}
		return 0;
	}
	return 0;
}

int TCheckNormal::ExtRequst(unsigned char Prm)
{
	if(IsShowing){
		Record.OperateAdd_UserCheck(MainCtl.fData.Split.MyNum, 0);
		IsShowing =0;
	}
	return 0;
}

