#include "RuntimeData.h"
#include "uInportExport.h"



extern "C"{
	#include "user_norflash.h"
	#include "user_eeprom.h"
	#include "uart_key_drv.h"
	#include "HW_config.h"
}

#define dWdClr		clSkyBlue
#define dWdDisabelClr	clNearWhite

#define dWWidth	24
#define dWHeigh	24
#define dRoundR	7

const int xFirst	= 10;
const int xSec	= 150;
const int xThi	= 290;
const int xFourth	= 430;
const int xFifth	= 570;

void TuInportExport::Init()
{
	CtlIndex = 0;
	IsShowing = 0;
	IsOnGoing = 0;
	ReadWrite =0;
	
	State.Connection = Config.usbConState;
	State.Rsv0 =0;
	State.Rsv0 =1;
	State.Rsv0 =2;
	
	IsPermission =0;
}

void TuInportExport::DelayMs(unsigned int aMs)
{
	volatile unsigned int mTick;
	volatile unsigned int Tick;
	for(Tick=0; Tick<aMs; Tick++){
		for(mTick=0; mTick<160000; mTick++);
		sys_error_led_task();
	}
}

void TuInportExport::RenderBackGround(void)
{
	RectFillRender(ContentGeometry.Left, ContentGeometry.Top, ContentGeometry.Right, ContentGeometry.Bottom, ContentColor);
}

void TuInportExport::RenderBackGround(unsigned int aClr)
{
	RectFillRender(ContentGeometry.Left, ContentGeometry.Top, ContentGeometry.Right, ContentGeometry.Bottom, aClr);
}

void TuInportExport::DrawFixText()
{
	if(LanguageEnCn==0){
		TextRender_string24(Lv.Caption.Left + 10, Lv.Caption.Top +4, clNearWhite, CaptionColor, "数据传输->U盘导入导出");
		TextRender_string24(Lv.Grid.Left[0] + 10, Lv.Grid.Top[0] +6, clNearWhite, "U盘连接");
		TextRender_string24(Lv.Grid.Left[1] + 10, Lv.Grid.Top[1] +6, clNearWhite, "配置数据导入");
		TextRender_string24(Lv.Grid.Left[2] + 10, Lv.Grid.Top[2] +6, clNearWhite, "配置数据导出");
		TextRender_string24(Lv.Grid.Left[3] + 10, Lv.Grid.Top[3] +6, clNearWhite, "历史数据导出");
		TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "全部", 38, clNearBlack);
		TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "回路数据", 12, clNearBlack);
		TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "联动数据", 12, clNearBlack);
	
		TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "全部", 38, clNearBlack);
		TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "回路数据", 12, clNearBlack);
		TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "联动数据", 12, clNearBlack);
	
		TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "全部", 38, clNearBlack);
		TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "报警记录", 12, clNearBlack);
		TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "故障记录", 12, clNearBlack);
		TRoundRect::sDrawBySize(xFourth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "操作记录", 12, clNearBlack);
		TRoundRect::sDrawBySize(xFifth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "监管记录", 12, clNearBlack);
	}else{
		TextRender_string24(Lv.Caption.Left + 10, Lv.Caption.Top +4, clNearWhite, CaptionColor, "Data Transmission->U-Disk");
		TextRender_string24(Lv.Grid.Left[0] + 10, Lv.Grid.Top[0] +6, clNearWhite, "U-Disk Connection");
		TextRender_string24(Lv.Grid.Left[1] + 10, Lv.Grid.Top[1] +6, clNearWhite, "Inport Configuration");
		TextRender_string24(Lv.Grid.Left[2] + 10, Lv.Grid.Top[2] +6, clNearWhite, "Export Configuration");
		TextRender_string24(Lv.Grid.Left[3] + 10, Lv.Grid.Top[3] +6, clNearWhite, "Export Record");
		TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "All", 38, clNearBlack);
		TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "Loop Cfg", 12, clNearBlack);
		TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "Link-Exp", 12, clNearBlack);
	
		TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "All", 38, clNearBlack);
		TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "Loop Cfg", 12, clNearBlack);
		TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "Link-Exp", 12, clNearBlack);
	
		TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "All", 38, clNearBlack);
		TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "Fire ALM", 12, clNearBlack);
		TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, " Fault  ", 12, clNearBlack);
		TRoundRect::sDrawBySize(xFourth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "Operating", 6, clNearBlack);
		TRoundRect::sDrawBySize(xFifth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "supervi ", 12, clNearBlack);
	}
}

void TuInportExport::DrawSelf(void)
{
	RenderBackGround();
	RectFillRender(Lv.Caption.Left, Lv.Caption.Top, Lv.Caption.Right, Lv.Caption.Bottom, CaptionColor);

	for(int i=0; i<Lv.Grid.UsingCount; i++)RectFillRender(Lv.Grid.Left[i], Lv.Grid.Top[i], Lv.Grid.Right[i], Lv.Grid.Bottom[i], ItemColor);
	
	if(Lv.Panel.Active)RectFillRender(Lv.Panel.Left, Lv.Panel.Top, Lv.Panel.Right, Lv.Panel.Bottom, PanelColor);

	DrawFixText();
	
	//TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clNearWhite, "连接", 38, clNearBlack);
	//TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clNearWhite, "断开", 38, clNearBlack);
	

	
	Check4Selected();
}

void TuInportExport::Show(void)
{	
	RenderBackGround();
	DrawSelf();
	DrawConnState();
	
	usb_device_to_host();
	
	IsShowing = 1;
}

void TuInportExport::FullRedraw(int Prm)
{	
	if(Prm == 0){
		RenderBackGround();
		DrawSelf();
	}else
	if(Prm == 1){
		RectFillRender(GuiRedrawDataList[1][0], GuiRedrawDataList[1][1], GuiRedrawDataList[1][2], GuiRedrawDataList[1][3], ContentColor);
		for(int i=0; i<3; i++)RectFillRender(Lv.Grid.Left[i], Lv.Grid.Top[i], Lv.Grid.Right[i], Lv.Grid.Bottom[i], ItemColor);
		DrawFixText();
		DrawConnState();
		if(IsPermission){
			PmsIntervene4Gui.ReDraw4GuiRecall();
		}else{
			Check4Selected();
		}
	}
}

void TuInportExport::DrawConnState()
{
	if(LanguageEnCn==0){
		if(State.Connection){
			TextRender_string24(Lv.Grid.Left[0] + 20, 	Lv.Grid.Top[0] + 36, clGreen, ItemColor, "已连接");
		}else{
			TextRender_string24(Lv.Grid.Left[0] + 20, 	Lv.Grid.Top[0] + 36, clRed, ItemColor, "未连接");
		}
	}else{
		if(State.Connection){
			TextRender_string24(Lv.Grid.Left[0] + 20, 	Lv.Grid.Top[0] + 36, clGreen, ItemColor, 	"Connected ");
		}else{
			TextRender_string24(Lv.Grid.Left[0] + 20, 	Lv.Grid.Top[0] + 36, clRed, ItemColor, 	"Unconnect ");
		}
	}
}


//______________________________________________________________________________________________________________________________
void TuInportExport::ClearSelected(void)
{
	if(LanguageEnCn==0){
		switch(CtlIndex){
			//case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clNearWhite, "连接", 38, clNearBlack); break;
			//case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clNearWhite, "断开", 38, clNearBlack); break;
		
			case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "全部", 38, clNearBlack); break;
			case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "回路数据", 12, clNearBlack); break;
			case 2:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "联动数据", 12, clNearBlack); break;
		
			case 3:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "全部", 38, clNearBlack); break;
			case 4:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "回路数据", 12, clNearBlack); break;
			case 5:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "联动数据", 12, clNearBlack); break;
		
			case 6:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "全部", 38, clNearBlack); break;
			case 7:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "报警记录", 12, clNearBlack); break;
			case 8:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "故障记录", 12, clNearBlack); break;
			case 9:	TRoundRect::sDrawBySize(xFourth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "操作记录", 12, clNearBlack); break;
			case 10:	TRoundRect::sDrawBySize(xFifth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "监管记录", 12, clNearBlack); break;
			default:

				break;
		}		
	}else{
		switch(CtlIndex){
			//case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clNearWhite, "连接", 38, clNearBlack); break;
			//case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clNearWhite, "断开", 38, clNearBlack); break;
		
			case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "All", 38, clNearBlack); break;
			case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "  Loop  ", 12, clNearBlack); break;
			case 2:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clNearWhite, "Link-Exp", 12, clNearBlack); break;
		
			case 3:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "All", 38, clNearBlack); break;
			case 4:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "  Loop  ", 12, clNearBlack); break;
			case 5:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clNearWhite, "Link-Exp", 12, clNearBlack); break;
		
			case 6:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "All", 38, clNearBlack); break;
			case 7:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "Fire ALM", 12, clNearBlack); break;
			case 8:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, " Fault  ", 12, clNearBlack); break;
			case 9:	TRoundRect::sDrawBySize(xFourth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "Operating", 6, clNearBlack); break;
			case 10:	TRoundRect::sDrawBySize(xFifth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clNearWhite, "supervi", 12, clNearBlack); break;
			default:

				break;
		}
	}
}

void TuInportExport::Check4Selected(void)
{
	if(LanguageEnCn==0){
		switch(CtlIndex){
			//case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clBlue, "连接", 38, clNearWhite); break;
			//case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clBlue, "断开", 38, clNearWhite); break;
		
			case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clBlue, "全部", 38, clNearWhite); break;
			case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clBlue, "回路数据", 12, clNearWhite); break;
			case 2:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clBlue, "联动数据", 12, clNearWhite); break;
		
			case 3:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clBlue, "全部", 38, clNearWhite); break;
			case 4:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clBlue, "回路数据", 12, clNearWhite); break;
			case 5:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clBlue, "联动数据", 12, clNearWhite); break;
		
			case 6:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "全部", 38, clNearWhite); break;
			case 7:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "报警记录", 12, clNearWhite); break;
			case 8:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "故障记录", 12, clNearWhite); break;
			case 9:	TRoundRect::sDrawBySize(xFourth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "操作记录", 12, clNearWhite); break;
			case 10:	TRoundRect::sDrawBySize(xFifth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "监管记录", 12, clNearWhite); break;
			default:

				break;
		}		
	}else{
		
		switch(CtlIndex){
			//case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clBlue, "连接", 38, clNearWhite); break;
			//case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[0] + 36, 120, 30, 7, clBlue, "断开", 38, clNearWhite); break;
		
			case 0:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clBlue, "All", 38, clNearWhite); break;
			case 1:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clBlue, "  Loop  ", 12, clNearWhite); break;
			case 2:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[1] + 36, 120, 30, 7, clBlue, "Link-Exp", 12, clNearWhite); break;
		
			case 3:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clBlue, "All", 38, clNearWhite); break;
			case 4:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clBlue, "  Loop  ", 12, clNearWhite); break;
			case 5:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[2] + 36, 120, 30, 7, clBlue, "Link-Exp", 12, clNearWhite); break;
		
			case 6:	TRoundRect::sDrawBySize(xFirst, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "All", 38, clNearWhite); break;
			case 7:	TRoundRect::sDrawBySize(xSec, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "Fire ALM", 12, clNearWhite); break;
			case 8:	TRoundRect::sDrawBySize(xThi, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, " Fault  ", 12, clNearWhite); break;
			case 9:	TRoundRect::sDrawBySize(xFourth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "Operating", 6, clNearWhite); break;
			case 10:	TRoundRect::sDrawBySize(xFifth, 	Lv.Grid.Top[3] + 36, 120, 30, 7, clBlue, "supervi", 12, clNearWhite); break;
			default:

				break;
		}		
	}
}

void TuInportExport::PermissionCmdReturnDraw()
{
	RectFillRender(0, Lv.Grid.Top[1], 799, Lv.Grid.Bottom[2], ContentColor);
	for(int i=1; i<3; i++)RectFillRender(Lv.Grid.Left[i], Lv.Grid.Top[i], Lv.Grid.Right[i], Lv.Grid.Bottom[i], ItemColor);
	
	DrawFixText();
	
	Check4Selected();
}

void TuInportExport::PermissionCmdGO()
{
	if(PermissionCmd == 1){
		//Go Active
		IsOnGoing = 1;
	}else
	if(PermissionCmd == 2){
		//Do Close
		IsOnGoing = 0;
	}
}


//_____________________________________________________________________________________________________________________________

TGuiMsgReturn TuInportExport::KeyIn(unsigned char aKey)
{
	TGuiMsgReturn aMsg = guiMsgNone;
	TGuiMsgReturn PmsRtnMsg = guiMsgNone;
	unsigned char aP0,aP1,Err;
	unsigned char x,y,aCh;
	unsigned int aAddr, HadPrc;
	TDMix aFullPath;

	if(IsPermission){
		PmsRtnMsg = PmsIntervene4Gui.KeyIn(aKey);
		if(PmsRtnMsg == guiMsgOkAndReturn){
			//Enter And Run Go
			IsPermission = 0;
			PermissionCmdReturnDraw();
			PermissionCmdGO();
		}else
		if(PmsRtnMsg == guiMsgReturn){
			//Not Enter Redraw
			IsPermission = 0;
			PermissionCmdReturnDraw();
		}
		return aMsg;
	}else{
		switch(aKey){
			case VK_RIGHT:
				switch(CtlIndex){
					case 0:
					case 1:
					case 3:
					case 4:
					case 6:
					case 7:
					case 8:
					case 9:
						ClearSelected();
						CtlIndex++;
						Check4Selected();
						break;
					default:
						break;
				}
				break;				
			case VK_LEFT:
				switch(CtlIndex){
					case 1:
					case 2:
					case 4:
					case 5:
					case 7:
					case 8:
					case 9:
					case 10:
						ClearSelected();
						CtlIndex--;
						Check4Selected();
						break;
					default:
						break;
				}
				break;
			case VK_UP:
				switch(CtlIndex){
					case 0:
						ClearSelected();
						CtlIndex =0;
						Check4Selected();
						break;
					case 1:
					case 2:
						ClearSelected();
						CtlIndex =1;
						Check4Selected();
						break;
					case 3:
					case 4:
					case 5:
					case 6:
					case 7:
					case 8:
						ClearSelected();
						CtlIndex -=3;
						Check4Selected();
						break;
					case 9:
						ClearSelected();
						CtlIndex -=4;
						Check4Selected();
						break;
					case 10:
						ClearSelected();
						CtlIndex -=5;
						Check4Selected();
						break;
					default:
						break;
				}
				break;
			case VK_DOWN:
				switch(CtlIndex){
					case 0:
					case 1:
					case 2:
						ClearSelected();
						CtlIndex +=3;
						Check4Selected();
						break;
					case 3:
					case 4:
					case 5:
						ClearSelected();
						CtlIndex +=3;
						Check4Selected();
						break;
					default:
						break;
				}
				break;
			case VK_TAB:

				break;
			case dfKEY_SETUP:
				
				break;
			case VK_EXECUTE:
				if(CtlIndex == 0){
					//InPort All
					if(State.Connection){
						if(LanguageEnCn==0)TextRender_string24(20,360, clRed, PanelColor, 	"开始配置        ");
						else TextRender_string24(20,360, clRed, PanelColor, 				"Configuring     ");
						if(0 != Config.LoadCfgFile()){
							if(LanguageEnCn==0)TextRender_string24(20,360, clRed, PanelColor, "缺少文件        ");
							else TextRender_string24(20,360, clRed, PanelColor, 			"File Missing    ");
						}
					}else{
						if(LanguageEnCn==0)TextRender_string24(20,360, clRed, PanelColor, 	"请插入有效U盘   ");
						else TextRender_string24(20,360, clRed, PanelColor, 				"U-Disk Not Found");
					}
				}else
				if(CtlIndex == 1){
					//InPort Port[0..39]
				}else
				if(CtlIndex == 2){
					//Inport Linkage
				}else
				if(CtlIndex == 3){
					//Export All 
				}else
				if(CtlIndex == 4){
					//Export Port[0..39] 
				}else
				if(CtlIndex == 5){
					//Export Linkage 
				}else
				if(CtlIndex == 6){
					//Export History All 
				}else
				if(CtlIndex == 7){
					//Export History Fire
				}else
				if(CtlIndex == 8){
					//Export History Fault 
				}else
				if(CtlIndex == 9){
					//Export History Operatting 
				}else
				if(CtlIndex == 10){
					//Export History Sv 
				}
				break;
			case VK_RETURN:
				IsShowing = 0;
				aMsg = guiMsgReturn;
			
				usb_host_to_device();
			
				break;
		}
	}

	return aMsg;	
}

int TuInportExport::ExtRequst(unsigned char Prm)
{
	IsShowing =0;
	
	usb_host_to_device();
	
	return 0;
}

void TuInportExport::Task1000Ms()
{
	if(State.Connection != Config.usbConState){
		State.Connection = Config.usbConState;
		if((IsShowing)&&(0 == IsPermission)){
			DrawConnState();
		}
	}
}




