#include "PmsIntervene.h" #include "Runtime.h" #include "server.h" extern "C"{ #include "user_norflash.h" #include "user_eeprom.h" #include "uart_key_drv.h" } static const unsigned char SavePassWord[32] = "9910232250266023\0"; void TPmsIntervene::Init(int aX, int aY, int aW, int aH, int OwnerX, int OwnerY, u32 aColor, TBvStyle aBevelOuter){ unsigned short Left,Right,Top,Bottom,i; Bound.SetBySize(aX+OwnerX, aY+OwnerY, aW, aH); Color = aColor; BevelOuter = aBevelOuter; if(BevelOuter == bvRaised){ Left = Bound.Left + 1; Right = Bound.Right - 2; Top = Bound.Top + 1; Bottom = Bound.Bottom - 2; }else{ Left = Bound.Left + 2; Right = Bound.Right - 2; Top = Bound.Top + 2; Bottom = Bound.Bottom - 2; } Caption.Init(Left, Top, Right-Left+1, 32, 0, 0, clNearWhite, clMedBlue); Content.Set(Left,Top+32,Right,Bottom); TextColor = clNearBlack; SelectedColor = clBlue; SelectedTextColor = clNearWhite; Caption.Visible = 0; Edit.Visible = 0; Edit.SetMaxLen(16); Edit.SetTextShowMaskByAsterisk(); STextDown.Visible = 1; CountDownTick =0; } void TPmsIntervene::DelayMs(unsigned int aMs) { volatile unsigned int mTick; volatile unsigned int Tick; for(Tick=0; Tick16)return; Cok = 0; Cing = 1; if(Len == CtlCenter.PassWordII.Len){ for(i=0; i16)return; Cok = 0; Cing = 1; if(Len == CtlCenter.PassWordIII.Len){ for(i=0; i1){ HotKeyResetCallBack(); IsShow = 0; aMsg = guiMsgReturn; }else{ if(LanguageEnCn==0)STextDown.SetText("密码错误 !", 24); else STextDown.SetText("Incorrect Password", 24); STextDown.TextColor = clRed; STextDown.Show(); CountDownTick = 15; } }else if(GoWhat == 2){ CheckEnterLvl(); if(SystemPermission >1){ RedrawScreen(); HotKeyAlramCallBack(); IsShow = 0; aMsg = guiMsgReturn; }else{ if(LanguageEnCn==0)STextDown.SetText("密码错误 !", 24); else STextDown.SetText("Incorrect Password", 24); STextDown.TextColor = clRed; STextDown.Show(); CountDownTick = 15; } }else if(GoWhat == 3){ CheckEnterLvl(); if(SystemPermission >1){ HotKeySelfCheckCallBack(); IsShow = 0; aMsg = guiMsgReturn; }else{ if(LanguageEnCn==0)STextDown.SetText("密码错误 !", 24); else STextDown.SetText("Incorrect Password", 24); STextDown.TextColor = clRed; STextDown.Show(); CountDownTick = 15; } }else if(GoWhat == 4){ if(ReqLevel == 2){ CheckEnterLvl(); if(SystemPermission >1){ IsShow = 0; aMsg = guiMsgOkAndReturn; }else{ if(LanguageEnCn==0)STextDown.SetText("密码错误 !", 24); else STextDown.SetText("Incorrect Password", 24); STextDown.TextColor = clRed; STextDown.Show(); CountDownTick = 15; } }else if(ReqLevel == 3){ CheckEnterLv2(); if(SystemPermission >2){ IsShow = 0; aMsg = guiMsgOkAndReturn; }else{ if(LanguageEnCn==0)STextDown.SetText("密码错误 !", 24); else STextDown.SetText("Incorrect Password", 24); STextDown.TextColor = clRed; STextDown.Show(); CountDownTick = 15; } } } }else if(aKey == VK_RETURN){ IsShow = 0; if(GoWhat < 4) RedrawScreen(); aMsg = guiMsgReturn; } if( (aMsg == guiMsgReturn) || (aMsg == guiMsgOkAndReturn) ){ IsHotKeyCheckingPermission = 0; } return aMsg; } void TPmsIntervene::BackScreen() { volatile unsigned int aAddrs, aAddrt; int x,y; aAddrs = LcdBaseAddr; aAddrt = dAddrSdRam_BackScreen; for(y=100; y<260; y++){ for(x=170; x<630; x++){ PxData[x-170] = *(volatile unsigned int *)(aAddrs + ((y*800 + x) *4)); } for(x=170; x<630; x++){ *(volatile unsigned int *)aAddrt = PxData[x-170]; aAddrt+=4; } } } void TPmsIntervene::RedrawScreen() { volatile unsigned int aAddr; int x,y; GuiRedraw(1); return; aAddr = dAddrSdRam_BackScreen; for(y=100; y<260; y++){ for(x=170; x<630; x++){ PxData[x-170] = *(volatile unsigned int *)aAddr; aAddr+=4; } for(x=170; x<630; x++){ *(volatile unsigned int *)(LcdBaseAddr + ((y*800 + x) *4)) = PxData[x-170]; } } } void TPmsIntervene::DrawTip() { unsigned int aClr; if(CountDownTick & 0x01){ aClr = clNearWhite; }else{ aClr = clNearBlack; } RectFillRender(Bound.Left-6, Bound.Top-8, Bound.Left-1, Bound.Bottom+6, aClr); RectFillRender(Bound.Left-6, Bound.Top-8, Bound.Right+6, Bound.Top-1, aClr); RectFillRender(Bound.Right+1, Bound.Top-8, Bound.Right+6, Bound.Bottom+6, aClr); RectFillRender(Bound.Left-6, Bound.Bottom+1, Bound.Right+6, Bound.Bottom+6, aClr); if(CountDownTick < 10) TextDigitRender2_24(STextDown.Bound.Left+ 360, STextDown.Bound.Top+2, clNearBlack, clFrmFace, CountDownTick); else TextRender_string24(STextDown.Bound.Left+ 360, STextDown.Bound.Top+2, clNearBlack, clFrmFace, " "); } void TPmsIntervene::Task1000Ms() { if(IsShow == 0)return; if(CountDownTick){ CountDownTick--; if(CountDownTick){ DrawTip(); }else{ IsShow = 0; GoWhat = 0; RedrawScreen(); } } } int TPmsIntervene::ExtRequst(unsigned char Prm) { IsShow = 0; IsHotKeyCheckingPermission =0; return 0; }