INT32 UIFlowWndPlay_OnOpen(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { g_bUIFlowWndPlayNoImgWndOpened = FALSE; if (UIPlay_GetData(PLAY_FILENUM)==0) { Ux_OpenWindow(&UIFlowWndWrnMsgCtrl,2,FLOWWRNMSG_ISSUE_NO_FILE,FLOWWRNMSG_TIMER_KEEP); g_bUIFlowWndPlayNoImgWndOpened = TRUE; } else { g_PlbData.VideoPBSpeed=PLB_FWD_MOV_1x; g_PlbData.State = PLB_ST_FULL; FlowPB_UpdateIcons(1); } // Turn on LCD backlight if TV is un plugged if (GPIOMap_IsLCDBacklightOn() == FALSE && KeyScan_IsTVPlugIn() == FALSE && KeyScan_IsHDMIPlugIn() == FALSE) { GPIOMap_TurnOnLCDBacklight(); } // set mask key Ux_FlushEvent(); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, PLAY_KEY_PRESS_MASK); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_RELEASE, PLAY_KEY_RELEASE_MASK); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_CONTINUE, PLAY_KEY_CONTINUE_MASK); Ux_DefaultEvent(pCtrl,NVTEVT_OPEN_WINDOW,paramNum,paramArray); return NVTEVT_CONSUME; }
void DevCtrl_ModeMovie(void) { IPL_OBJ IplObj; // Turn on CCD power if (GPIOMap_IsCCDPowerOn() == FALSE) { GPIOMap_TurnOnCCDPower(); } UI_SetParameter(_ImageFlip,_Flip_H_V); #if 0 if(Get_ImageRotateIndex() == IMAGE_ROTATE_OFF) { UI_SetParameter(_ImageFlip,_Flip_Off); } else { UI_SetParameter(_ImageFlip,_Flip_H_V); } #endif if (IPL_GetMode() != IPL_MODE_VIDEO) { // Disable IDE video1/video2 output ide_disable_video(IDE_VIDEOID_1); ide_disable_video(IDE_VIDEOID_2); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_VIDEO; IPL_SetCmd(&IplObj); PhotoDisplay_SetMode(DISPLAY_MODE_VIDEO, TRUE); // Start zoom initialization Photo_OpticalZoom_InitStart(); //#NT#20091018#ethanlau -begin //use callback to open ide // Delay 2 frames to avoid seeing error picture //sie_waitVD(2); // Enable IDE video1 output //ide_enable_video(IDE_VIDEOID_1); //#NT#20091018#ethanlau -end // Wait for zoom initialization done Photo_OpticalZoom_InitEnd(); } // Turn on LCD backlight if TV is un plugged if (GPIOMap_IsLCDBacklightOn() == FALSE && KeyScan_IsTVPlugIn() == FALSE && KeyScan_IsHDMIPlugIn() == FALSE) { //GPIOMap_TurnOnLCDBacklight(); } if(gbKscanTVPlug==FALSE){ KeyScan_TurnOnLED(KEYSCAN_LED_GREEN); KeyScan_TurnOffLED(KEYSCAN_LED_RED); } }
INT32 UIFlowWndPlay_OnKeyEnter(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { static BOOL bFirstEnter = TRUE; switch(g_PlbData.State) { case PLB_ST_FULL: if(UIPlay_GetData(PLAY_CURRMODE)==PLAYMODE_AVI) { if(bFirstEnter) { g_uiUIFlowWndPlayCurrentVolume = GetAudioVolume(); bFirstEnter = FALSE; } KeyScan_EnableAutoPoweroff(FALSE); KeyScan_EnableUSBDet(FALSE); KeyScan_EnableKeyTone(FALSE); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVPLAY,1,UIFlowMoviePlayCBFunc); g_PlbData.State = PLB_ST_PLAY_MOV; FlowPB_IconDrawMovPlay(TRUE); if (KeyScan_IsHDMIPlugIn()==FALSE) { FlowPB_IconDrawMovPlayVolumn(g_uiUIFlowWndPlayCurrentVolume); } FlowPB_IconDrawMovSpeed(0); } break; case PLB_ST_PLAY_MOV: case PLB_ST_FWD_MOV: case PLB_ST_BWD_MOV: if(UIPlay_GetData(PLAY_CURRMODE)==PLAYMODE_AVI) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVPAUSE,0); g_PlbData.State = PLB_ST_PAUSE_MOV; KeyScan_EnableAutoPoweroff(TRUE); KeyScan_EnableUSBDet(TRUE); KeyScan_EnableKeyTone(SysGetFlag(FL_BEEP)); FlowPB_IconDrawMovPlay(TRUE); FlowPB_IconDrawMovSpeed(0); } break; case PLB_ST_PAUSE_MOV: if(UIPlay_GetData(PLAY_CURRMODE)==PLAYMODE_AVI) { KeyScan_EnableAutoPoweroff(FALSE); KeyScan_EnableUSBDet(FALSE); KeyScan_EnableKeyTone(FALSE); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVRESUME,0); g_PlbData.State = PLB_ST_PLAY_MOV; FlowPB_IconDrawMovPlay(TRUE); FlowPB_IconDrawMovSpeed(0); } break; } return NVTEVT_CONSUME; }
EVENT_END static INT32 UIFlowWndPlay_OnExeUpKeyAct(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { switch(g_PlbData.State) { case PLB_ST_FULL: if (UIPlay_GetData(PLAY_CURRMODE) == PLAYMODE_PRIMARY && UIPlay_GetData(PLAY_PBSTATUS) == PB_STA_DONE) { Ux_OpenWindow((VControl *)(&UIFlowWndPlayMagnifyCtrl), 0); } else if(UIPlay_GetData(PLAY_CURRMODE) == PLAYMODE_AVI) { KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_NULL); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_PLAYNEXT,0); FlowPB_UpdateIcons(1); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_DEFAULT); } break; case PLB_ST_PLAY_MOV: if(!KeyScan_IsHDMIPlugIn()) //Not allow volume change when HDMI plugged in { if(g_uiUIFlowWndPlayCurrentVolume < AUDIO_VOL_7) { g_uiUIFlowWndPlayCurrentVolume++; Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); FlowPB_IconDrawMovPlayVolumn(g_uiUIFlowWndPlayCurrentVolume); } } break; case PLB_ST_PAUSE_MOV: Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVSTOP,0); g_PlbData.State = PLB_ST_FULL; g_PlbData.VideoPBSpeed = PLB_FWD_MOV_1x; hdmitx_setAudMute(FALSE); KeyScan_EnableAutoPoweroff(TRUE); KeyScan_EnableUSBDet(TRUE); KeyScan_EnableKeyTone(SysGetFlag(FL_BEEP)); // KeyScan_EnableKeyTone(GetSysF(Get_BeepIndex())); FlowPB_UpdateIcons(1); /* reset original volume for key sound */ Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_NULL); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_PLAYNEXT,0); FlowPB_UpdateIcons(1); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_DEFAULT); break; } return NVTEVT_CONSUME; }
/** Detect Sensor flag is roated or not Detect Sensor flag is roated or not. @param void @return void */ void KeyScan_DetSensorRotate(void) { BOOL bCurSensorDet, bCurSensorStatus; PrimaryModeID CurrMode; if ((KeyScan_IsUSBPlug() == TRUE) || (KeyScan_IsHDMIPlugIn() == TRUE)) return; #if (UI_STYLE == UI_STYLE_DRIVE) //#NT#2011/11/24#Philex Lin -begin // can't rotate sensor in playback mode if (Primary_GetCurrentMode()==PRIMARY_MODE_PLAYBACK) return; else bCurSensorDet = GPIOMap_DetSensorRotate(); //#NT#2011/11/24#Philex Lin -end #else bCurSensorDet = FALSE; #endif bCurSensorStatus = (BOOL)(bCurSensorDet & bLastSensorDet); CurrMode = Primary_GetCurrentMode(); if (bCurSensorStatus != bLastSensorStatus) { if (bCurSensorStatus==TRUE) bSensorStatus = TRUE; else bSensorStatus = FALSE; Primary_ChangeMode(PRIMARY_MODE_DUMMY); Primary_Wait4ChangeModeDone(); if (CurrMode == PRIMARY_MODE_PHOTO) { Primary_ChangeMode(PRIMARY_MODE_PHOTO); // back to current mode Primary_Wait4ChangeModeDone(); } else if (CurrMode == PRIMARY_MODE_MOVIE) { if (gMovData.State != MOV_ST_REC) { Primary_ChangeMode(PRIMARY_MODE_MOVIE); // back to current mode Primary_Wait4ChangeModeDone(); } } } bLastSensorDet = bCurSensorDet; bLastSensorStatus = bCurSensorStatus; }
static INT32 UIFlowWndPlay_OnExeDownKeyAct(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { UINT32 uiActKey; if (paramNum >= 1) uiActKey = paramArray[0]; switch (uiActKey) { case NVTEVT_KEY_PRESS: switch(g_PlbData.State) { case PLB_ST_FULL: Ux_OpenWindow((VControl *)(&UIFlowWndPlayThumbCtrl), 0); break; case PLB_ST_PLAY_MOV: if(!KeyScan_IsHDMIPlugIn()) //Not allow volume change when HDMI plugged in { if(g_uiUIFlowWndPlayCurrentVolume > AUDIO_VOL_MUTE) { g_uiUIFlowWndPlayCurrentVolume--; Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); FlowPB_IconDrawMovPlayVolumn(g_uiUIFlowWndPlayCurrentVolume); } } break; case PLB_ST_PAUSE_MOV: Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVSTOP,0); g_PlbData.State = PLB_ST_FULL; g_PlbData.VideoPBSpeed = PLB_FWD_MOV_1x; hdmitx_setAudMute(FALSE); KeyScan_EnableAutoPoweroff(TRUE); KeyScan_EnableUSBDet(TRUE); KeyScan_EnableKeyTone(SysGetFlag(FL_BEEP)); // KeyScan_EnableKeyTone(GetSysF(Get_BeepIndex())); FlowPB_UpdateIcons(1); /* reset original volume for key sound */ Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); Ux_OpenWindow((VControl *)(&UIFlowWndPlayThumbCtrl), 0); break; } break; } return NVTEVT_CONSUME; }
void KeyScan_DetAutoLCDoff(void) { if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { g_uiKeyScanAutoLcdoffCnt++; } else { g_uiKeyScanAutoLcdoffCnt=0; } //debug_err(("g_uiKeyScanAutoLcdoffCnt : %d--\r\n",g_uiKeyScanAutoLcdoffCnt)); if (g_uiKeyScanAutoLcdoffCnt >= KeyScan_GetAutoLCDoffTime()) { if(GPIOMap_IsLCDBacklightOn()==TRUE) { GPIOMap_TurnOffLCDBacklight(); } } }
INT32 UIFlowWndPlay_OnKeyPlayback(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { switch(g_PlbData.State) { case PLB_ST_FULL: if (KeyScan_IsHDMIPlugIn()==FALSE) { Ux_FlushEvent(); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_NULL); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_RELEASE, FLGKEY_KEY_MASK_NULL); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_CONTINUE, FLGKEY_KEY_MASK_NULL); Ux_SendEvent(&UISystemObjCtrl,NVTEVT_CHANGE_DSCMODE,1,DSCMODE_CHGTO_NEXT); } break; case PLB_ST_PLAY_MOV: case PLB_ST_PAUSE_MOV: case PLB_ST_FWD_MOV: case PLB_ST_BWD_MOV: Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVSTOP,0); g_PlbData.State = PLB_ST_FULL; g_PlbData.VideoPBSpeed = PLB_FWD_MOV_1x; hdmitx_setAudMute(FALSE); KeyScan_EnableAutoPoweroff(TRUE); KeyScan_EnableUSBDet(TRUE); KeyScan_EnableKeyTone(SysGetFlag(FL_BEEP)); // KeyScan_EnableKeyTone(GetSysF(Get_BeepIndex())); FlowPB_UpdateIcons(1); /* reset original volume for key sound */ Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); break; } return NVTEVT_CONSUME; }
/** Control the devices for Setup mode Control the devices before entering Setup mode. @param void @return void */ void DevCtrl_ModeSetup(void) { IPL_OBJ IplObj; //if (DevCtrl_GetIPLMode() != DEVCTRL_IPLMODE_OFF) if (IPL_GetMode() != IPL_MODE_OFF) { // Set to off mode //DevCtrl_SetIPLMode(DEVCTRL_IPLMODE_OFF); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_OFF; IPL_SetCmd(&IplObj); } // Disable IDE video1 output ide_disable_video(IDE_VIDEOID_1); // Disable IDE video2 output ide_disable_video(IDE_VIDEOID_2); // Turn off CCD power if (GPIOMap_IsSensorPowerOn() == TRUE) { GPIOMap_TurnOffSensorPower(); } // Turn on LCD backlight if TV is un plugged if (GPIOMap_IsLCDBacklightOn() == FALSE && KeyScan_IsTVPlugIn() == FALSE && KeyScan_IsHDMIPlugIn() == FALSE) { GPIOMap_TurnOnLCDBacklight(); } //SysClk_SetClk(SPEED_ID_PLAYBACK); }
void KeyScan_DetTV(void) { BOOL bCurTVDet, bCurTVStatus; IMEIDE_ATTR ImeIdeAttr; UINT32 i, uiWindowEn; PrimaryModeID CurrMode; TV_DEVICE_OBJ TVObj; AUDIO_OUTPUT AudioOutput; IPL_OBJ IplObj; DisplaySizeInfor Displaysizeinfor; static BOOL first_2 = TRUE; static UINT32 changModeDelay =0; if ((KeyScan_IsUSBPlug() == TRUE) || (KeyScan_IsHDMIPlugIn() == TRUE)) return; if(gbKeyscanDetTvEn==FALSE) return ; bCurTVDet = GPIOMap_DetTV(); //bCurTVStatus = (BOOL)(bCurTVDet & bLastTVDet); bCurTVStatus = TRUE; if (bCurTVStatus != bLastTVStatus) { //-----------jack lan --------------------- KeyScan_SetDetGSPNAVIEn(FALSE); ide_disable_video(IDE_VIDEOID_1); ide_disable_video(IDE_VIDEOID_2); if((gUIAviIsRecording == TRUE)||(first_2==TRUE)) { first_2=FALSE; gbKscanTVPlug = TRUE; //Ux_PostEvent(NVTEVT_MOVIEAUTORECORDSTOP, 0); // for(changModeDelay=0;changModeDelay<300;changModeDelay++) //{} debug_msg("Keyscan TV:%d..\r\n",gbKscanTVPlug); } else { gbKscanTVPlug = FALSE; } //--------------------------------------- CurrMode = Primary_GetCurrentMode(); // Enter dummy mode first Primary_ChangeMode(PRIMARY_MODE_DUMMY); Primary_Wait4ChangeModeDone(); // TV is plugging in if (bCurTVStatus == TRUE) { debug_err(("TV is plugged, GPIOMap_DetTV = %d\r\n", bCurTVDet)); bTVStatus = TRUE; // Turn off LCD backlight GPIOMap_TurnOffLCDBacklight(); ide_disable_video(IDE_VIDEOID_1); ide_disable_video(IDE_VIDEOID_2); // Close LCD panel ClosePanel(); GPIOMap_TurnOffLCDPower(); pinmux_select_lcd(PINMUX_GPIO); // Disable all windows uiWindowEn = ide_get_window_en(); ide_set_allwindow_dis(); ide_set_load(); ide_wait_frame_end(); TVObj.bIDESrcPLL2 = g_LCDCtrlObj.bIDESrcPLL2; TVObj.uiIDESrcCLK = g_LCDCtrlObj.uiIDESrcCLK; TVObj.uiTVFSADJ = TV_FSADJ_3_0_K;//TV_FSADJ_3_3_K; // Init TV object if (Get_TVModeIndex() == TV_MODE_NTSC) { // NTSC InitTVNTSC_OBJ(&TVObj); OpenTVNTSC(&g_LCDSize); uiCurrentTVMode = TV_MODE_NTSC; } else { // PAL InitTVPAL_OBJ(&TVObj); OpenTVPAL(&g_LCDSize); uiCurrentTVMode = TV_MODE_PAL; } // Scaling OSD to new size KeyScan_ScaleDisplay(); #if 0 switch (Primary_GetCurrentMode()) { // If you won't call playback task to display last image in preview mode, // you don't have to call PB_SetIMEIDESize() in PHOTO mode. case PRIMARY_MODE_PHOTO: IplObj.uiCmd = IPL_CMD_CHG_SIZE_IME1; IplObj.uiImeOutWidth1 = g_LCDSize.uiWidth; IplObj.uiImeOutHeight1 = g_LCDSize.uiHeight; IPL_SetCmd(&IplObj); Displaysizeinfor.DisplayInHsize = g_LCDSize.uiWidth; Displaysizeinfor.DisplayInVsize = g_LCDSize.uiHeight; Displaysizeinfor.DisplayInLineoffset = g_LCDSize.uiWidth; Displaysizeinfor.DisplayOutHsize = g_LCDSize.uiWinWidth; Displaysizeinfor.DisplayOutVsize = g_LCDSize.uiWinHeight; PhotoDisplay_ChgSize(&Displaysizeinfor,TRUE); ImeIdeAttr.uiImeOutH = g_LCDSize.uiWidth; ImeIdeAttr.uiImeOutV = g_LCDSize.uiHeight; ImeIdeAttr.uiIdeOutH = g_LCDSize.uiWinWidth; ImeIdeAttr.uiIdeOutV = g_LCDSize.uiWinHeight; PB_SetIMEIDESize(&ImeIdeAttr); break; case PRIMARY_MODE_MOVIE: // Set to 1/4 size to reduce memory bandwith requirement IplObj.uiCmd = IPL_CMD_CHG_SIZE_IME1; IplObj.uiImeOutWidth1 = g_LCDSize.uiWidth >> 1; IplObj.uiImeOutHeight1 = g_LCDSize.uiHeight >> 1; IPL_SetCmd(&IplObj); Displaysizeinfor.DisplayInHsize = g_LCDSize.uiWidth >> 1; Displaysizeinfor.DisplayInVsize = g_LCDSize.uiHeight >> 1; Displaysizeinfor.DisplayInLineoffset = g_LCDSize.uiWidth; Displaysizeinfor.DisplayOutHsize = g_LCDSize.uiWinWidth; Displaysizeinfor.DisplayOutVsize = g_LCDSize.uiWinHeight; PhotoDisplay_ChgSize(&Displaysizeinfor,TRUE); break; case PRIMARY_MODE_PLAYBACK: //Todo: FlowPB_UpdateThumbRect(); ImeIdeAttr.uiImeOutH = g_LCDSize.uiWidth; ImeIdeAttr.uiImeOutV = g_LCDSize.uiHeight; ImeIdeAttr.uiIdeOutH = g_LCDSize.uiWinWidth; ImeIdeAttr.uiIdeOutV = g_LCDSize.uiWinHeight; PB_SetIMEIDESize(&ImeIdeAttr); break; default: break; } #endif // Enable IDE ide_wait_frame_end(); //ide_set_en(TRUE); // Delay to wait for TV DAC stable for (i=16; i>0; i--) { ide_wait_frame_end(); } ide_set_en(TRUE); // Enable all windows ide_set_allwindow_en(uiWindowEn); ide_set_load(); // forced set to playback mode //CurrMode = PRIMARY_MODE_PLAYBACK; }
INT32 UIFlowWndMovie_OnExeRecord(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { UINT32 uiKeyAct; UINT32 uiState,uiSlowCard=0; // flush key event first Ux_FlushEvent(); if(GPIOMap_DetStrgCard() == FALSE) { gMovData.State= MOV_ST_WARNING_MENU; Ux_OpenWindow(&UIFlowWndWrnMsgCtrl,2,UIFlowWndWrnMsg_StatusTXT_Msg_STRID_NO_CARD,FLOWWRNMSG_TIMER_2SEC); return NVTEVT_CONSUME; } // do nothing while pluging HDMI if (KeyScan_IsHDMIPlugIn() == TRUE) { return NVTEVT_CONSUME; } if (GPIOMap_DetStrgCard() == FALSE) { Ux_OpenWindow(&UIFlowWndWrnMsgCtrl,2,UIFlowWndWrnMsg_StatusTXT_Msg_STRID_PLEASE_INSERT_SD,FLOWWRNMSG_TIMER_2SEC); return NVTEVT_CONSUME; } if (paramNum>=3) { uiState = paramArray[2]; if (paramNum>=4) uiSlowCard = paramArray[3]; } else { uiState = 0; } uiKeyAct = paramArray[0]; debug_err(("UIFlowWndMovie_OnExeRecord uiKeyAct: %x,uiState : %x,uiSlowCard: %x\r\n",uiKeyAct,uiState,uiSlowCard)); switch (uiKeyAct) { case NVTEVT_KEY_PRESS: switch (gMovData.State) { case MOV_ST_VIEW: if (FlowMovie_IsStorageErr() == TRUE) { gMovData.State= MOV_ST_WARNING_MENU; gMovData.SysTimeCount = 0; return NVTEVT_CONSUME; } if (FlowMovie_GetSelfTimerID() != NULL_TIMER) { FlowMovie_StopRecSelfTimer(); return NVTEVT_CONSUME; } /* if (SysGetFlag(FL_MOVIE_MOTION_DET)==MOVIE_MOTIONDET_ON) { g_uiRecordIngMotionDet = TRUE; } else { g_uiRecordIngMotionDet = FALSE; } */ FlowMovie_StartRec(); break; case MOV_ST_REC: case MOV_ST_REC|MOV_ST_ZOOM: if (FlowMovie_GetRecCurrTime() >= 1) { FlowMovie_StopRec(); if (gbMoviFileLock) { gbMoviFileLock = FALSE; FilesysWaitInitFinish(FST_TIME_INFINITE); FilesysWaitCmdFinish(FST_TIME_INFINITE); FilesysSetFileLock(SysGetFlag(FL_DCF_FILE_ID),SysGetFlag(FL_DCF_DIR_ID), TRUE); FilesysWaitInitFinish(FST_TIME_INFINITE); FilesysWaitCmdFinish(FST_TIME_INFINITE); UxCtrl_SetShow(&UIFlowWndMovie_Status_LOCKCtrl, FALSE); // RemoveGFileToRO(SysGetFlag(FL_DCF_FILE_ID),SysGetFlag(FL_DCF_DIR_ID)); } if (uiState==UIFlowWndMovie_Restart_Rec) { //#NT#2012/9/25#Philex Lin - begin // Set NR/TBR/FR parameters dynamically #if (_MOVIE_SLOW_CARD_ == ENABLE) if (uiSlowCard == UIFlowWndMovie_Restart_SlowCard) { if (FlowMovie_NeedHandleSlowCard()) FlowMovie_SlowCardHandling(); } #endif Ux_PostEvent(NVTEVT_KEY_SHUTTER2, 1, NVTEVT_KEY_PRESS); } else { /*if (SysGetFlag(FL_MOVIE_MOTION_DET) == MOVIE_MOTIONDET_ON)//henry 20141209 { if (g_uiRecordIngMotionDet == TRUE) { g_uiRecordIngMotionDet = FALSE; SysSetFlag(FL_MOVIE_MOTION_DET,MOVIE_MOTIONDET_OFF); } }*/ } } break; } break; } Ux_DefaultEvent(pCtrl,NVTEVT_KEY_SHUTTER2,paramNum,paramArray); return NVTEVT_CONSUME; }
INT32 UIFlowWndMovie_OnTimer(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { NVT_USER_EVT userEvent; static BOOL bFirstPowerOn = TRUE; userEvent = paramArray[0]; switch(userEvent) { case NVTEVT_05SEC_TIMER: if (bFirstPowerOn == TRUE) { bFirstPowerOn = FALSE; if ((GetGsensorPowerOn() == TRUE)&&(!KeyScan_IsHDMIPlugIn())) { debug_msg(">>-----GetGsensorPowerOn ----\r\n"); Ux_PostEvent(NVTEVT_KEY_SHUTTER2, 1, NVTEVT_KEY_PRESS); return NVTEVT_CONSUME; } if ((KeyScan_IsUSBPower())&&(!KeyScan_IsHDMIPlugIn())) { Ux_PostEvent(NVTEVT_KEY_SHUTTER2, 1, NVTEVT_KEY_PRESS); return NVTEVT_CONSUME; } //Ux_PostEvent(NVTEVT_KEY_SHUTTER2, 1, NVTEVT_KEY_PRESS); } #if (_GSENSOR_FUNC_ == ENABLE) KeyScan_DetGSensor(); #endif if (SysGetFlag(FL_MOVIE_MOTION_DET) == MOVIE_MOTIONDET_ON) { if((gMovData.State == MOV_ST_VIEW)||(gMovData.State == (MOV_ST_VIEW|MOV_ST_ZOOM))) { UxCtrl_SetShow(&UIFlowWndMovie_PanelMotionRecCtrl,!UxCtrl_IsShow(&UIFlowWndMovie_PanelMotionRecCtrl)); } // Motion Detect function if (g_uiRecordIngMotionDet==TRUE) { static UINT32 uiMotionDetGo = 0; static UINT32 uiMotionDetStop = 0; if (MotionDetection()==TRUE) { uiMotionDetGo++; if (uiMotionDetGo>=2) { uiMotionDetStop=0; if (!((gMovData.State == MOV_ST_REC)||(gMovData.State == (MOV_ST_REC|MOV_ST_ZOOM)))) { // reset uiMotionDetGo uiMotionDetGo = 0; // press enter key to record video Ux_PostEvent(NVTEVT_KEY_ENTER, 1, NVTEVT_KEY_PRESS); } } } else { uiMotionDetStop++; if (uiMotionDetStop>=2) // 1 sec { uiMotionDetGo=0; } if (uiMotionDetStop>=24) // 10 Sec { uiMotionDetStop = 0; switch(gMovData.State) { case MOV_ST_REC: case MOV_ST_REC|MOV_ST_ZOOM: // stop recording if (FlowMovie_GetRecCurrTime() >= 1) { FlowMovie_StopRec(); } break; } } } } } break; case NVTEVT_1SEC_TIMER: FlowMovie_OnTimer1SecIndex(); //UIFlowWndMovie_Update_Speed(); break; } Ux_DefaultEvent(pCtrl,NVTEVT_TIMER,paramNum,paramArray); return NVTEVT_CONSUME; }
/** Detect key is pressed or released Detect key is pressed or released and set flg (FLG_ID_KEY) [KeyScan internal API] @param void @return void */ void KeyScan_DetKey(void) { UINT32 uiCurKeyStatus, uiTempKeyStatus; UINT32 uiKeyChanged; UINT32 uiKeyPressed, uiKeyReleased, uiKeyContinue; UINT8 bKeyCode; uiCurKeyStatus = uiTempKeyStatus = GPIOMap_DetKey(); uiCurKeyStatus &= (uiLastKeyStatus & FLGKEY_KEY_MASK); uiKeyChanged = uiCurKeyStatus ^ uiStableKeyStatus; uiKeyPressed = uiKeyChanged & uiCurKeyStatus; uiKeyReleased = uiKeyChanged & (~uiCurKeyStatus); uiKeyContinue = uiCurKeyStatus & uiStableKeyStatus & uiLastStableKeyStatus; uiLastStableKeyStatus = uiStableKeyStatus & ~(uiKeyContinue); uiStableKeyStatus = uiCurKeyStatus; uiLastKeyStatus = uiTempKeyStatus; if (uiKeyPressed) { //debug_err(("Key Pressed: 0x%.8X\r\n", uiKeyPressed)); KeyScan_ShowKeyName(uiKeyPressed, "PRESSED"); uiTempKeyStatus = uiKeyPressed & uiKeyMaskPress; if (uiTempKeyStatus) { // Play keypad tone KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); // Key pressed event //debug_err(("Key Pressed : 0x%.8X\r\n", uiKeyPressed)); g_uiKeyScanFlags |= (FLGKEY_PRESSED | uiTempKeyStatus); if(!GPIOMap_IsLCDBacklightOn()) { // if(GPIOMap_DetTV()==TRUE) { GPIOMap_SetTV(FALSE); } } if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if((Primary_GetCurrentMode()!= PRIMARY_MODE_USBMSDC)&&(Primary_GetCurrentMode()!= PRIMARY_MODE_USBPCC)) { if(!GPIOMap_IsLCDBacklightOn()) { GPIOMap_TurnOnLCDBacklight(); g_uiKeyScanFlags = 0; } } } //#NT#2007/08/08@Janice Hunag::play tone if press masked key //if(g_uiKeyScanFlags) //KeyScan_PlayTone(0); //play key tone when press //#NT#2007/08/08@Janice Hunag } g_uiKeyScanLcdOffCnt = 0; // Reset auto power off counter g_uiKeyScanAutoPoweroffCnt = 0; } if (uiKeyReleased) { //debug_err(("Key Released: 0x%.8X\r\n", uiKeyReleased)); KeyScan_ShowKeyName(uiKeyReleased, "RELEASED"); uiTempKeyStatus = uiKeyReleased & uiKeyMaskRelease; if (uiTempKeyStatus != 0) { // Key release event //debug_err(("Key Released: 0x%.8X\r\n", uiKeyReleased)); g_uiKeyScanFlags |= (FLGKEY_RELEASED | uiTempKeyStatus); } if (uiKeyReleased & uiKeyMaskContinue) { bKeyHoldFlag = FALSE; uiKeyHoldCount = 0; uiKeyLongHoldCount = 0; } // Reset auto power off counter g_uiKeyScanAutoPoweroffCnt = 0; TimerCounter5MinMode =0; } if (uiKeyContinue) { //debug_err(("Continue key: 0x%.8X\r\n", uiKeyContinue)); //KeyScan_ShowKeyName(uiKeyContinue, "CONTINUE"); uiTempKeyStatus = uiKeyContinue & (uiKeyMaskContinue & uiKeyMaskPress); //If mask key press, would not send continue key if (uiTempKeyStatus) { uiKeyHoldCount++; if (bKeyHoldFlag == FALSE && uiKeyHoldCount > KEY_HOLD_COUNT || bKeyHoldFlag == TRUE && uiKeyHoldCount > KEY_HOLD_CONTINUE) { uiKeyHoldCount = 0; // Play keypad tone if (bKeyHoldFlag == FALSE) { bKeyHoldFlag = TRUE; //KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); } // Continue key pressed event //debug_err(("Continue key: 0x%.8X\r\n", uiKeyContinue)); g_uiKeyScanFlags |= (FLGKEY_HOLD | uiTempKeyStatus); if (bKeyHoldFlag) { uiKeyLongHoldCount++; //debug_err(("uiKeyLongHoldCount = %d\r\n", uiKeyLongHoldCount)); if (uiKeyLongHoldCount > KEY_LONG_HOLD_COUNT) { //debug_err(("Long hold key: 0x%.8X\r\n", uiKeyContinue)); uiKeyLongHoldCount = 0; g_uiKeyScanFlags &= ~FLGKEY_HOLD; g_uiKeyScanFlags |= FLGKEY_LONGHOLD; } } } } // Reset auto power off counter g_uiKeyScanAutoPoweroffCnt = 0; } }
INT32 UIFlowWndPlay_OnKeyRight(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { switch(g_PlbData.State) { case PLB_ST_FULL: Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_PLAYSINGLE, 2, PB_SINGLE_NEXT, 1); FlowPB_UpdateIcons(1); UIFlowWndPlay_CheckStatus(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); break; case PLB_ST_PLAY_MOV: case PLB_ST_FWD_MOV: case PLB_ST_BWD_MOV: #if(_MODEL_DSC_== _MODEL_DUAL_NAZHIDA_) //#NT#2012/08/31#Calvin Chang#Porting Media Flow -begin if(g_PlbData.VideoPBSpeed > PLB_BWD_MOV_8x) { g_PlbData.VideoPBSpeed --; Ux_FlushEventByRange(NVTEVT_KEY_EVT_START,NVTEVT_KEY_EVT_END); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); if(g_PlbData.VideoPBSpeed > PLB_FWD_MOV_1x) { g_PlbData.State = PLB_ST_FWD_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_FORWARD; // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } else if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_1x) { g_PlbData.State = PLB_ST_BWD_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_BACKWARD; // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } else //uiCurrSpeedIndex == PLAYMOV_SPEED_FWD_1X { g_PlbData.State = PLB_ST_PLAY_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_FORWARD; // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } FlowPB_IconDrawMovSpeed(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); } break; #else //#NT#2012/08/31#Calvin Chang#Porting Media Flow -begin if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_8x) { g_PlbData.VideoPBSpeed ++; Ux_FlushEventByRange(NVTEVT_KEY_EVT_START,NVTEVT_KEY_EVT_END); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); if(g_PlbData.VideoPBSpeed > PLB_FWD_MOV_1x) { g_PlbData.State = PLB_ST_FWD_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_FORWARD; // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } else if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_1x) { g_PlbData.State = PLB_ST_BWD_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_BACKWARD; // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } else //uiCurrSpeedIndex == PLAYMOV_SPEED_FWD_1X { g_PlbData.State = PLB_ST_PLAY_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_FORWARD; // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } FlowPB_IconDrawMovSpeed(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); } break; //#NT#2012/08/31#Calvin Chang -end #endif //#NT#2012/7/6#Philex mark temp #if 0 if (KeyScan_IsHDMIPlugIn()==FALSE) { if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_8x) { g_PlbData.VideoPBSpeed ++; Ux_FlushEvent(); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_NULL); if(g_PlbData.VideoPBSpeed > PLB_FWD_MOV_1x) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVFWD,1,g_PlbData.VideoPBSpeed); g_PlbData.State = PLB_ST_FWD_MOV; // set mute in FWD playing hdmitx_setAudMute(TRUE); } else if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_1x) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVBWD,1,g_PlbData.VideoPBSpeed); g_PlbData.State = PLB_ST_BWD_MOV; // set mute in BWD playing hdmitx_setAudMute(TRUE); } else //uiCurrSpeedIndex == PLAYMOV_SPEED_FWD_1X { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVFWDSTOP,0); g_PlbData.State = PLB_ST_PLAY_MOV; /* Since Media FWD/BWD will set volume mute, we should restore current volume. */ hdmitx_setAudMute(FALSE); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); } FlowPB_IconDrawMovSpeed(); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_DEFAULT); } } break; #endif } return NVTEVT_CONSUME; }
INT32 UIFlowWndPlay_OnKeyLeft(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { switch(g_PlbData.State) { case PLB_ST_FULL: Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_PLAYSINGLE, 2, PB_SINGLE_PREV, 1); FlowPB_UpdateIcons(1); UIFlowWndPlay_CheckStatus(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); break; case PLB_ST_PLAY_MOV: case PLB_ST_FWD_MOV: case PLB_ST_BWD_MOV: //#NT#2012/08/31#Calvin Chang#Porting Media Flow -begin //if(g_PlbData.VideoPBSpeed > PLB_BWD_MOV_8x) if(g_PlbData.VideoPBSpeed > PLB_BWD_MOV_4x) { g_PlbData.VideoPBSpeed --; Ux_FlushEventByRange(NVTEVT_KEY_EVT_START,NVTEVT_KEY_EVT_END); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); if(g_PlbData.VideoPBSpeed > PLB_FWD_MOV_1x) { g_PlbData.State = PLB_ST_FWD_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_FORWARD; UxState_SetData(&UIFlowWndPlay_StatusICN_MovFwdCtrl,STATE_CURITEM,UIFlowWndPlay_StatusICN_MovFwd_ICON_FF_RIGHT_BLUE); UxCtrl_SetShow(&UIFlowWndPlay_StatusICN_MovFwdCtrl, TRUE); // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } else if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_1x) { g_PlbData.State = PLB_ST_BWD_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_BACKWARD; UxState_SetData(&UIFlowWndPlay_StatusICN_MovBwdCtrl,STATE_CURITEM,UIFlowWndPlay_StatusICN_MovBwd_ICON_FB_LEFT_BLUE); UxCtrl_SetShow(&UIFlowWndPlay_StatusICN_MovBwdCtrl, TRUE); // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } else //uiCurrSpeedIndex == PLAYMOV_SPEED_FWD_1X { g_PlbData.State = PLB_ST_PLAY_MOV; UIFlowMoviePlay_SetSpeed(g_PlbData.VideoPBSpeed); g_uiUIFlowWndPlayCurrenDirection = MEDIAPLAY_DIR_FORWARD; UxState_SetData(&UIFlowWndPlay_StatusICN_MovBwdCtrl,STATE_CURITEM,UIFlowWndPlay_StatusICN_MovBwd_ICON_FB_LEFT); UxCtrl_SetShow(&UIFlowWndPlay_StatusICN_MovBwdCtrl, TRUE); UxState_SetData(&UIFlowWndPlay_StatusICN_MovFwdCtrl,STATE_CURITEM,UIFlowWndPlay_StatusICN_MovFwd_ICON_FF_RIGHT); UxCtrl_SetShow(&UIFlowWndPlay_StatusICN_MovFwdCtrl, TRUE); // Play Ux_SendEvent(&UIMoviePlayObjCtrl, NVTEVT_PLAY_PLAY_MOVIE, 2, g_uiUIFlowWndPlayCurrenSpeed, g_uiUIFlowWndPlayCurrenDirection); } FlowPB_IconDrawMovSpeed(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); } //#NT#2012/08/31#Calvin Chang -end #if 0 if (KeyScan_IsHDMIPlugIn()==FALSE) { if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_8x) { g_PlbData.VideoPBSpeed ++; Ux_FlushEvent(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_NULL); if(g_PlbData.VideoPBSpeed > PLB_FWD_MOV_1x) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVFWD,1,g_PlbData.VideoPBSpeed); g_PlbData.State = PLB_ST_FWD_MOV; // set mute in FWD playing hdmitx_setAudMute(TRUE); } else if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_1x) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVBWD,1,g_PlbData.VideoPBSpeed); g_PlbData.State = PLB_ST_BWD_MOV; // set mute in BWD playing hdmitx_setAudMute(TRUE); } else //uiCurrSpeedIndex == PLAYMOV_SPEED_FWD_1X { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVFWDSTOP,0); g_PlbData.State = PLB_ST_PLAY_MOV; /* Since Media FWD/BWD will set volume mute, we should restore current volume. */ hdmitx_setAudMute(FALSE); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); } FlowPB_IconDrawMovSpeed(); Input_SetKeyMask(KEY_PRESS, FLGKEY_KEY_MASK_DEFAULT); } } #endif break; } return NVTEVT_CONSUME; }
void KeyScan_PoweroffFlow(void) { #if (KEYSCAN_POWEROFF_DET == ENABLE) UINT32 i; debug_err(("*********KeyScan_PoweroffFlow\r\n")); GPIOMap_TurnOffLCDBacklight();//for test if(GPIOMap_GetAcc12V()==FALSE) { TimerDelayMs(500); if(GPIOMap_GetAcc12V()==TRUE) { debug_err(("*********KeyScan_PoweroffFlow return \r\n")); GPIOMap_TurnOnLCDBacklight();//for test return; } } gBKeyscanDetACCEn = FALSE; // stop recording before powering off if video is recording now if (Primary_GetCurrentMode() == PRIMARY_MODE_MOVIE) { if (gUIAviIsRecording==TRUE) { Ux_PostEvent(NVTEVT_KEY_ENTER, 2, NVTEVT_KEY_PRESS, FLGKEY_PRESSED); } } //#NT#2009/03/23#Janice ::wait primary tsk idle for change mode busy Primary_CheckIdle(PRI_TIME_INFINITE); //#NT#2007/07/24#Janice -begin //make sure is not bad card,then check fst finish if (GetFSStatus() == FS_INIT_OK) { // Wait for filesystem done,if normal power off,else skip wait if(!g_bFilesysAbortCmd) { //check fst busy,wait inifinit would lock keyscantsk if (FilesysWaitCmdFinish(FST_TIME_NO_WAIT) == FST_STA_BUSY) { KeyScan_Poweroff(); //force power off make sure KeyScan_DetPoweroff would enter KeyScan_PoweroffFlow again return; } } } //#NT#2007/07/24#Janice -end // Pause KeyScan timer timer_pausePlay(g_uiKeyScanTimerID, _TIMER_PAUSE); // Terminate all task first debug_err(("*********AppInit_Close\r\n")); AppInit_Close(); // Save menu info debug_err(("*********Save_MenuInfo\r\n")); Save_MenuInfo(); KeyScan_PlaySound(KEYSCAN_SOUND_STARTUP); // Display poweroff logo if (GPIOMap_IsLCDBacklightOn() == FALSE && KeyScan_IsTVPlugIn() == FALSE && KeyScan_IsHDMIPlugIn() == FALSE) { //OpenPanel(&g_LCDCtrlObj, &g_LCDSize); //SysInit_DisplaySplashScreen(LOGO_POWEROFF,0,0); //UI_ClearOSD(_OSD_INDEX_TRANSPART); // clear OSD //ide_disable_osd(IDE_OSDID_1); //ide_enable_video(IDE_VIDEOID_1); //TimerDelayMs(100); //GPIOMap_TurnOnLCDBacklight(); } else { //SysInit_DisplaySplashScreen(LOGO_POWEROFF,0,0); //UI_ClearOSD(_OSD_INDEX_TRANSPART); // clear OSD } //TimerDelayMs(500); UI_ClearOSD(_OSD_INDEX_TRANSPART); // clear OSD ide_disable_video(IDE_VIDEOID_1); ide_disable_video(IDE_VIDEOID_2); //TimerDelayMs(10); TimerDelayMs(30); // Clear screen if (KeyScan_IsHDMIPlugIn() == TRUE) { UI_ClearOSD(_OSD_INDEX_BLACK); ide_wait_frame_end(); CloseTVHDMI(); } else if (KeyScan_IsTVPlugIn() == TRUE) UI_ClearOSD(_OSD_INDEX_BLACK); //for TV & HDMI.(sent black pattern when power off) else UI_ClearOSD(_OSD_INDEX_WHITE); //for Toppoly LCD.(need to sent white pattern when power off) // Close Panel ClosePanel(); TimerDelayMs(700); //for (i=0x10000; i>0; i--); // Panel enter sleep mode Lens_Shutter_Move(CLOSE); //GPIOMap_TurnOffLCDPower(); //TimerDelayMs(200); // Retract lens Photo_OpticalZoom_Retract(); // Turn off LCD, CCD... GPIOMap_TurnOffCCDPower(); // Turn off green and red LED KeyScan_TurnOffLED(KEYSCAN_LED_GREEN); KeyScan_TurnOffLED(KEYSCAN_LED_RED); pad_setPullUpDown(PAD_TV_DETECT, PAD_PULLDOWN);//jacky lan // set NAND write protect to stop NAND (write) accessing GPIOMap_SetNANDWp(); debug_err(("*********rtc_poweroffPWR\r\n")); // Power off #if 0 GPIOMap_SetPoweroffCtrlLow(); #else rtc_poweroffPWR(); #endif // Loop forever while (1) { debug_err(("*")); } #endif //KEYSCAN_POWEROFF_DET }
/** Control the devices for Movie mode Control the devices before entering Movie mode. @param void @return void */ void DevCtrl_ModeMovie(void) { IPL_OBJ IplObj; // Turn on CCD power if (GPIOMap_IsSensorPowerOn() == FALSE) { GPIOMap_TurnOnSensorPower(); } //UI_SetParameter(_ImageFlip, _SEN_Flip_H_V); //UI_SetParameter(_ImageFlip, _Flip_Off); /* if (SysGetFlag(FL_SENSOR_ROTATE) == SEN_ROTATE_OFF) { UI_SetParameter(_ImageFlip, _Flip_Off); } else { UI_SetParameter(_ImageFlip, _SEN_Flip_H_V); }*/ //UI_SetParameter(_ImageFlip, _Flip_Off); if (IPL_GetMode() != IPL_MODE_VIDEO) { if (IPL_GetMode() == IPL_MODE_OFF) { ide_disable_video(IDE_VIDEOID_1); ide_disable_video(IDE_VIDEOID_2); } UIFlowWndMovie_Initparam(); // temporary using the function of UI window, need to move to UI obj? //#NT#2011/10/19#KS Hung -begin //#NT#For LCD panel with 16:9 ratio (but 4:3 pixel resolution) #if (DISPLAY_169HD == DISPLAY_169HD_YES) if (KeyScan_IsTVPlugIn() == TRUE) { UI_SetParameter(_DispRatio, _Ratio_4_3); } else if (KeyScan_IsHDMIPlugIn() == TRUE) { UI_SetParameter(_DispRatio, _Ratio_16_9); } else { UI_SetParameter(_DispRatio, _Ratio_16_9); } #endif //#NT#2011/10/19#KS Hung -end #if (_LENSLIB_ != _LENSLIB_FF_) if((Primary_GetPreviousMode() == PRIMARY_MODE_UNKNOWN) || (Primary_GetPreviousMode() == PRIMARY_MODE_DUMMY) || (Primary_GetPreviousMode() == PRIMARY_MODE_ENGINEER) || (Primary_GetPreviousMode() == PRIMARY_MODE_PLAYBACK && Lens_Module_GetState() == LENS_INITOK)) { if(Primary_GetCurrentMode() == PRIMARY_MODE_ENGINEER) { Lens_Retract(0); } // Start zoom initialization Lens_Init(LENS_INIT_ZOOM_PART1); // Wait for zoom initialization done Lens_Init(LENS_INIT_ZOOM_PART2); // TO DO... UILens_FocusToFar(1); //Lens_Zoom_DoBL(); // Turn off lens motor power Lens_OnOff(MOTOR_POWER_OFF, 0); // Register lens zoom change callback function //LensCtrl_RegCB((FPLENSCALLBACK)FlowPhoto_ImageCB); } #endif IplObj.uiImeOutWidth1 = GetDisplayH(); IplObj.uiImeOutHeight1 = GetDisplayV(); IplObj.uiImeOutYoft1 = GetDisplayH(); IplObj.uiDzoomStep = Get_DzoomIndex(); IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_VIDEO; IplObj.uiImgFmt = IMEOUT2_FMT422_2; if(IPL_SetCmd(&IplObj) == E_BOVR) { IplObj.uiImgFmt = IMEOUT2_FMT420_2; IPL_SetCmd(&IplObj); } //#NT#2009/12/11#Connie Yu -begin //#Apply new DIS control in recording flow //AlgInfo = UI_GetParameter(); //if(AlgInfo->DISMode == _DISMode_On) // PhotoDisplay_SetMode(DISPLAY_MODE_DISVIEW, TRUE); //else // PhotoDisplay_SetMode(DISPLAY_MODE_VIDEO, TRUE); //#NT#2009/12/11#Connie Yu -end //#NT#2011/11/28#Philex Lin - begin // photo display set mode function // FlowPhoto_SetModeCtrl(); //#NT#2011/11/28#Philex Lin - end // Start zoom initialization //Photo_OpticalZoom_InitStart(); // Delay 2 frames to avoid seeing error picture //sie_waitVD(2); // Enable IDE video1 output //ide_enable_video(IDE_VIDEOID_1); // Wait for zoom initialization done //Photo_OpticalZoom_InitEnd(); } // Turn on LCD backlight if TV is un plugged if (GPIOMap_IsLCDBacklightOn() == FALSE && KeyScan_IsTVPlugIn() == FALSE && KeyScan_IsHDMIPlugIn() == FALSE) { GPIOMap_TurnOnLCDBacklight(); } }
void PlayMov_PlayMedia(MovPlayCb movPlayCB) { UINT32 y1, y2, cb1, cb2, cr1, cr2; PLAY_OBJ PlayObj; ER openMedia = E_OK; PPLAY_OBJ pPlayObj; UINT32 jumpFFLevel = 0; UINT32 jumpBWLevel = 0; MEDIA_PLAY_1ST_INFO play1stParam; VIDEO_DECODER *pDecobj; //----- Draw " >>> 0 " ----------------------- debug_err(("enter MediaPlayFunc\r\n")); Set_PlayMovSpeedIndex(PLAYMOV_SPEED_FWD_1X); MediaPlay_Close(); PB_Close(PB_WAIT_INFINITE); pPlayObj = PB_GetPBObject(); g_UIFlowMediaPlayObj.uiMemAddr = PB_GetCurrDataBufAddr()+0x300000; g_UIFlowMediaPlayObj.uiMemSize = PB_GetCurrDataBufSize()-0x300000; g_UIFlowMediaPlayObj.u16OutWidth = pPlayObj->uiDisplayFBWidth; g_UIFlowMediaPlayObj.u16OutHeight= pPlayObj->uiDisplayFBHeight; if(KeyScan_IsHDMIPlugIn() == TRUE) { g_UIFlowMediaPlayObj.u16OutWratio= g_LCDSize.uiWinWidth;//PB_PANEL_NO_SCALING; g_UIFlowMediaPlayObj.u16OutHratio= g_LCDSize.uiWinHeight;//PB_PANEL_NO_SCALING; } else if(KeyScan_IsTVPlugIn() == TRUE) { g_UIFlowMediaPlayObj.u16OutWratio= 4;//g_LCDSize.uiWinWidth;//PB_PANEL_NO_SCALING; g_UIFlowMediaPlayObj.u16OutHratio= 3;//g_LCDSize.uiWinHeight;//PB_PANEL_NO_SCALING; } else {//LCD panel #if (_LCDTYPE_ == _LCDTYPE_TXDT300C_) g_UIFlowMediaPlayObj.u16OutWratio= g_LCDSize.uiWidth;//PB_PANEL_NO_SCALING; g_UIFlowMediaPlayObj.u16OutHratio= g_LCDSize.uiHeight;//PB_PANEL_NO_SCALING; #else g_UIFlowMediaPlayObj.u16OutWratio= 4; g_UIFlowMediaPlayObj.u16OutHratio= 3; #endif } g_UIFlowMediaPlayObj.CallBackFunc = movPlayCB; //g_UIFlowMediaPlayObj.bHWVideo = TRUE; g_UIFlowMediaPlayObj.bHWAudio = FALSE; g_UIFlowMediaPlayObj.bPlayH264 = TRUE; //#NT#2007/03/09#Corey Ke -begin //#Disable AVI task to play all files without DCF //g_UIFlowMediaPlayObj.bPlayAllFiles = FALSE; //#NT#2007/03/09#Corey Ke -end //g_UIFlowMediaPlayObj.bPlayWithBG = FALSE; //g_UIFlowMediaPlayObj.u16fileType = MEDIA_FILEFORMAT_MOV; // Get display frame buffer PB_GetCurr3FBAddr(&y1, &cb1, &cr1); // Get temp display frame buffer PB_GetCurr3TempFBAddr(&y2, &cb2, &cr2); g_UIFlowMediaPlayObj.panelInfo.y1Addr = y1; g_UIFlowMediaPlayObj.panelInfo.cb1Addr = cb1; g_UIFlowMediaPlayObj.panelInfo.cr1Addr = cr1; g_UIFlowMediaPlayObj.panelInfo.y2Addr = y2; g_UIFlowMediaPlayObj.panelInfo.cb2Addr = cb2; g_UIFlowMediaPlayObj.panelInfo.cr2Addr = cr2; //before MediaPlay_Open( ), MediaPlay_Decode1stVideo( ) should be called firstly (by Playbacktsk) // MediaPlay_GetDecode1stParam(&play1stParam); if ((play1stParam.filetype == 0)|| (play1stParam.videoCodec == 0)) { debug_err(("MediaPlay_Decode1stVideo( ) should be called firstly\r\n")); return; } if (play1stParam.videoCodec == MEDIAPLAY_VIDEO_H264) { pDecobj = MP_H264Dec_getVideoDecodeObject(); MediaPlay_SetVideoDecObj(pDecobj); debug_err(("videoCodec = MEDIAPLAY_VIDEO_H264!!\r\n ")); } else if (play1stParam.videoCodec == MEDIAPLAY_VIDEO_MJPG) { pDecobj = MP_MjpgDec_getVideoDecodeObject(); MediaPlay_SetVideoDecObj(pDecobj); debug_err(("videoCodec = MEDIAPLAY_VIDEO_MJPG!!\r\n ")); } // Set output source if (KeyScan_IsTVPlugIn() == TRUE) { g_UIFlowMediaPlayObj.iAudioType = AUDIO_OUTPUT_HP; } else if (KeyScan_IsHDMIPlugIn() == TRUE) { g_UIFlowMediaPlayObj.iAudioType = AUDIO_OUTPUT_NONE; } else { g_UIFlowMediaPlayObj.iAudioType = AUDIO_OUTPUT_SPK; } MediaPlay_Open(&g_UIFlowMediaPlayObj); openMedia = MediaPlay_WaitReady(); aud_setOutput(g_UIFlowMediaPlayObj.iAudioType);//2009/10/14 Meg added hdmitx_setAudMute(FALSE);//2010/03/16 Meg //#NT#2009/08/26#Randy -begin if (openMedia != E_OK) { PlayMov_StopMedia(); return; } //#NT#2009/08/26#Randy -end jumpFFLevel = 0; jumpBWLevel = 0; MediaPlay_FWD(); }
void KeyScan_DetPoweroff(void) { static UINT32 uiPowerKey = KEYSCAN_PWRKEY_UNKNOWN; static UINT32 uiPWRState = KEYSCAN_PWROFF_INIT_STATE; #if 1//(_OSD_SCREEN_DUMP_ == ENABLE) static UINT32 uiPowerKeyPressCount = 0; #endif // Power off request from another task if (bDoPoweroff == TRUE) { KeyScan_PoweroffFlow(); } #if 1//(_OSD_SCREEN_DUMP_ == ENABLE) // using POWER key to dump OSD screen // Detect power off key if (rtc_getPWRStatus()) { // Reset shutdown timer rtc_resetShutdownTimer(); // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_PRESSED) { if (uiPWRState == KEYSCAN_PWROFF_RELEASE_STATE) { uiPowerKeyPressCount++; if (uiPowerKeyPressCount > KEYSCAN_POWEROFF_COUNT) { uiPWRState = KEYSCAN_PWROFF_PRESS_STATE; } } if (uiPWRState == KEYSCAN_PWROFF_PRESS_STATE) { KeyScan_PoweroffFlow(); } } else { uiPowerKey = KEYSCAN_PWRKEY_PRESSED; } } else { // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_RELEASED) { if (uiPWRState == KEYSCAN_PWROFF_INIT_STATE) { uiPWRState = KEYSCAN_PWROFF_RELEASE_STATE; } if (uiPowerKeyPressCount) { uiPowerKeyPressCount = 0; //UI_ClearOSD(_OSD_INDEX_TRANSPART); //UI_DrawOsdString("Capture OSD Screen...", 56, 108, _OSD_INDEX_YELLOW); //TimerDelayMs(200); //Ux_RedrawAllWind(); //BMP_MakeFile("video.bmp"); InterFace_KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); if(!GPIOMap_IsLCDBacklightOn()) { g_uiKeyScanAutoLcdoffCnt = 0; GPIOMap_TurnOnLCDBacklight(); } else { g_uiKeyScanAutoLcdoffCnt = 0; GPIOMap_TurnOffLCDBacklight(); } #if 0 switch (gMovData.State) { case MOV_ST_REC: case MOV_ST_REC| MOV_ST_ZOOM: if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if(!GPIOMap_IsLCDBacklightOn()) { g_uiKeyScanAutoLcdoffCnt = 0; GPIOMap_TurnOnLCDBacklight(); } else { g_uiKeyScanAutoLcdoffCnt = 0; GPIOMap_TurnOffLCDBacklight(); } } break; default: if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if(!GPIOMap_IsLCDBacklightOn()) { g_uiKeyScanAutoLcdoffCnt = 0; GPIOMap_TurnOnLCDBacklight(); } } break; } #endif } } else { uiPowerKey = KEYSCAN_PWRKEY_RELEASED; } } #else // normal POWER key handling process // Detect power off key if (rtc_getPWRStatus()) { // Reset shutdown timer rtc_resetShutdownTimer(); // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_PRESSED) { if (uiPWRState == KEYSCAN_PWROFF_RELEASE_STATE) { uiPWRState = KEYSCAN_PWROFF_PRESS_STATE; } //#NT#2009/03/10#Photon Lin -begin //#Remove KeyScan_PoweroffFlow() to case KEYSCAN_PWRKEY_PRESSED if(uiPWRState == KEYSCAN_PWROFF_PRESS_STATE) { KeyScan_PoweroffFlow(); } //#NT#2009/03/10#Photon Lin -end } else { uiPowerKey = KEYSCAN_PWRKEY_PRESSED; } } else { // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_RELEASED) { if (uiPWRState == KEYSCAN_PWROFF_INIT_STATE) { uiPWRState = KEYSCAN_PWROFF_RELEASE_STATE; } //#NT#2009/03/10#Photon Lin -begin //#Remove KeyScan_PoweroffFlow() to case KEYSCAN_PWRKEY_PRESSED /* else if (uiPWRState == KEYSCAN_PWROFF_PRESS_STATE) { KeyScan_PoweroffFlow(); } */ //#NT#2009/03/10#Photon Lin -end } else { uiPowerKey = KEYSCAN_PWRKEY_RELEASED; } } #endif }
/** Power off Power off. Add any code here that you want to do during power off flow. [KeyScan internal API] @param void @return void */ void KeyScan_PoweroffFlow(void) { #if (KEYSCAN_POWEROFF_DET == ENABLE) UINT32 i; //#NT#2011/07/25#KS Hung -begin DC** pDCList; SIZE_2D strPos; //#NT#2011/07/25#KS Hung -end PDISP_OBJ pDispObj; DISPDEV_PARAM DispDev; char SrcPathName[32]; pDispObj = disp_getDisplayObject(DISP_1); debug_err(("*********KeyScan_PoweroffFlow\r\n")); //#NT#2009/03/23#Janice ::wait primary tsk idle for change mode busy Primary_CheckIdle(PRI_TIME_INFINITE); //#NT#2009/04/07#Janice -begin::fix press pwr key,still recode 1~2 sec #if (UI_STYLE == UI_STYLE_DRIVE) if ((gMovData.State == MOV_ST_REC)||(gMovData.State == (MOV_ST_REC|MOV_ST_ZOOM))) #else if(AVIRec_GetStatus()==AVIREC_STATUS_RECORDING) #endif { MovRec_Stop(TRUE); if (gbMoviFileLock == TRUE) { gbMoviFileLock = FALSE; //debug_err(("-----KeyScan_PoweroffFlow--lock %d, %d---\r\n",SysGetFlag(FL_DCF_FILE_ID),SysGetFlag(FL_DCF_DIR_ID))); FilesysWaitInitFinish(FST_TIME_INFINITE); FilesysWaitCmdFinish(FST_TIME_INFINITE); if(FilesysGetDCFFileName(SrcPathName,SysGetFlag(FL_DCF_DIR_ID),SysGetFlag(FL_DCF_FILE_ID),FST_FMT_AVI) ==FST_STA_NO_FILE) { debug_err(("no avi files ... \r\n")); } else { FilesysSetAttribByName(SrcPathName,FST_ATTRIB_READONLY,TRUE); FilesysWaitInitFinish(FST_TIME_INFINITE); FilesysWaitCmdFinish(FST_TIME_INFINITE); } } } //#NT#2009/04/07#Janice -end //#NT#2007/07/24#Janice -begin //make sure is not bad card,then check fst finish if (GetFSStatus() == FS_INIT_OK) { // Wait for filesystem done,if normal power off,else skip wait if(!g_bFilesysAbortCmd) { //check fst busy,wait inifinit would lock keyscantsk if (FilesysWaitCmdFinish(FST_TIME_NO_WAIT) == FST_STA_BUSY) { KeyScan_Poweroff(); //force power off make sure KeyScan_DetPoweroff would enter KeyScan_PoweroffFlow again return; } } } //#NT#2007/07/24#Janice -end // Pause KeyScan timer timer_pausePlay(g_uiKeyScanTimerID, _TIMER_PAUSE); // Terminate all task first debug_err(("*********AppInit_Close\r\n")); AppInit_Close(); // Change IPL to off mode (stop preview DRAM data, otherwise it may overlap the power off screen buffer) if (IPL_GetMode() != IPL_MODE_OFF) { IPL_OBJ IplObj; IplObj.uiCmd = IPL_CMD_CHG_MODE; IplObj.Mode = IPL_MODE_OFF; IPL_SetCmd(&IplObj); } // Save menu info debug_err(("*********Save_MenuInfo\r\n")); Save_MenuInfo(); // Display poweroff logo //UI_ClearOSD(_OSD_INDEX_BLUE); // clear OSD #if 0//(UPDATE_CFG == UPDATE_CFG_YES) if (FALSE == UI_ShowLogoFile(UI_LOGO_POWEROFF)) #endif { #if 1 SysInit_DisplaySplashScreen(LOGO_POWEROFF,0,0,0); //TimerDelayMs(1000); //ide_disable_video(IDE_VIDEOID_1); //GPIOMap_TurnOffLCDBacklight(); #else // show power off logo UI_ClearOSD(_OSD_INDEX_BLUE); // clear OSD #endif #if 0 if (GPIOMap_IsLCDBacklightOn() == FALSE && KeyScan_IsTVPlugIn() == FALSE && KeyScan_IsHDMIPlugIn() == FALSE) { //OpenPanel(&g_LCDCtrlObj, &g_LCDSize); DispDev.SEL.OPEN_DEVICE.DevID = DISPDEV_ID_PANEL; pDispObj->devCtrl(DISPDEV_OPEN_DEVICE,&DispDev); pDispObj->devCtrl(DISPDEV_GET_DISPSIZE,&DispDev); g_LCDSize.uiWidth = DispDev.SEL.GET_DISPSIZE.uiBufWidth; g_LCDSize.uiHeight = DispDev.SEL.GET_DISPSIZE.uiBufHeight; g_LCDSize.uiWinWidth = DispDev.SEL.GET_DISPSIZE.uiWinWidth; g_LCDSize.uiWinHeight = DispDev.SEL.GET_DISPSIZE.uiWinHeight; } //#NT#2011/07/25#KS Hung -begin pDCList = (DC**)UI_BeginScreen(); GxGfx_SetShapeColor(_OSD_INDEX_BLUE, _OSD_INDEX_BLUE, 0); GxGfx_FillRect(pDCList[GxGfx_OSD], 0,0 ,OSD_W, OSD_H); //#NT#2010/05/23#KS Hung -begin //#NT#The font frame must be transpart, else it will be regarded as the part of font. GxGfx_SetTextStroke((const FONT* )&gDemoKit_Font, FONTSTYLE_NORMAL, SCALE_1X); GxGfx_SetTextColor(_OSD_INDEX_WHITE, _OSD_INDEX_TRANSPART, _OSD_INDEX_TRANSPART); //#NT#2010/05/23#KS Hung -end GxGfx_GetFontCharSize((UINT16)STRID_GOOD_BYE, &strPos); GxGfx_Text(pDCList[GxGfx_OSD], 118, (OSD_H-strPos.h)/2, GxGfx_GetStringID((UINT16)STRID_GOOD_BYE)); UI_EndScreen((UINT32)pDCList); //#NT#2011/07/25#KS Hung -end #endif } #if 1 // Play power off sound KeyScan_PlaySound(PLAYSOUND_SOUND_SHUTDOWN); #else TimerDelayMs(300); #endif TimerDelayMs(300); // Turn off CCD GPIOMap_TurnOffSensorPower(); // Retract lens Lens_Retract(0); GPIOMap_TurnOffLCDBacklight(); // Wait play sound stop and close debug_err(("*********PlaySound_Close\r\n")); PlaySound_Close(); /* if(SysGetFlag(FL_MOVIE_PARKING) == MOVIE_PARKING_ON &&!KeyScan_IsUSBPlug() ) { debug_msg(">>----turn on Parking movie--------\r\n"); GSensor_GMA301_Open_ParkingMode();//add auto start } */ // GPIOMap_TurnOffLCDBacklight(); // TimerDelayMs(10); ide_disable_video(IDE_VIDEOID_1); // TimerDelayMs(10); // GPIOMap_TurnOffLCDBacklight(); // TimerDelayMs(30); // Clear screen if (KeyScan_IsTVPlugIn() == TRUE) UI_ClearOSD(_OSD_INDEX_BLACK); //for TV & HDMI.(sent black pattern when power off) else UI_ClearOSD(_OSD_INDEX_TRANSPART);//(_OSD_INDEX_WHITE); //for Toppoly LCD.(need to sent white pattern when power off) // Close Panel //ClosePanel(); pDispObj->devCtrl(DISPDEV_CLOSE_DEVICE, NULL); //TimerDelayMs(100); // for (i=0x80000; i>0; i--); // Panel enter sleep mode //GPIOMap_TurnOffLCDPower(); //TimerDelayMs(200); // Turn off green and red LED KeyScan_TurnOffLED(KEYSCAN_LED_GREEN); //KeyScan_TurnOffLED(KEYSCAN_LED_RED); // set NAND write protect to stop NAND (write) accessing GPIOMap_SetNANDWp(); debug_err(("*********rtc_poweroffPWR\r\n")); // Power off #if 0 GPIOMap_SetPoweroffCtrlLow(); #else if(SysGetFlag(FL_MOVIE_PARKING) == MOVIE_PARKING_ON &&!KeyScan_IsUSBPlug() ) { debug_msg(">>----turn on Parking movie--------\r\n"); GSensor_GMA301_Open_ParkingMode();//add auto start } rtc_poweroffPWR(); #endif // Loop forever while (1) { if(SysGetFlag(FL_MOVIE_PARKING) == MOVIE_PARKING_ON &&!KeyScan_IsUSBPlug() ) { debug_msg(">>----turn on Parking movie--------\r\n"); GSensor_GMA301_Open_ParkingMode();//add auto start } debug_err(("*")); } #endif //KEYSCAN_POWEROFF_DET }
void KeyScan_DetUSB(void) { static BOOL bLastUSBDet = FALSE; static BOOL bLastUSBStatus = FALSE; BOOL bCurUSBDet, bCurUSBStatus; //2009/03/16 Janice::USB would not redear ,need to wait UIframework if (!Ux_IsInitMessage()) { return ; } if ((KeyScan_IsTVPlugIn() ==TRUE) || (KeyScan_IsHDMIPlugIn()==TRUE)) { return; } bCurUSBDet = usb_StateChange(); bCurUSBStatus = (BOOL)(bCurUSBDet & bLastUSBDet); if (bCurUSBStatus != bLastUSBStatus) { // USB plugging in if (bCurUSBStatus == TRUE) { debug_err(("USB is plugged......\r\n")); bUSBDetectedSkipPowerCount = USB_SKIP_POWEROFF_COUNT; //#NT#2007/08/08#JaniceHuang:: avoid HW bug,plug USB would power btn would detect,need to skip detect pwr off. //g_bKeyScanUSBDetEn move here after setting bUSBDetectedSkipPowerCount, // g_bKeyScanUSBDetEn had better in keyscantsk ,before KeyScan_DetUSB,but cannot now if(!g_bKeyScanUSBDetEn) return; g_bUSBPlug = TRUE; KeyScan_EnableAutoPoweroff(FALSE); //#NT#2007/07/27#Stan Lin -begin //KeyScan_ResetSleep(); //KeyScan_EnableSleep(FALSE); //#NT#2007/07/27#Stan Lin -end //check filesys, if busy skip USB dectect ##can not wait inifinit,would lock keyscantsk //donot change bCurUSBStatus for dectect again,until FST not busy //#NT#2007/07/28@Steven Wang begin //Fix usb plug while wait moment window is executing if (FilesysWaitCmdFinish(FST_TIME_NO_WAIT) == FST_STA_BUSY || Ux_GetBackgroundTskBusy() == TRUE) { if(Ux_GetBackgroundTskExeuteCommand() == NVTEVT_BKW_WAIT_PTR_INIT && FilesysWaitCmdFinish(FST_TIME_NO_WAIT) != FST_STA_BUSY) { debug_err(("UIBackgroundReset ... while print init\r\n")); Ux_ResetBackgroundTsk(); } else { debug_err(("^R UIBackground busy\r\n")); return; } } //#NT#2007/07/28@Steven Wang end //Fix power on and plug in USB would multi enter change mode if(Primary_CheckIdle(PRI_TIME_NO_WAIT) != PRI_STA_IDLE) { return; //return would not update bLastUSBDet ,next time would detect again } // You can change to MODE_CUSTOM2 instead of select USB mode // to speed up the writing progress. // To do this, unmark the following code and mark "Primary_ChangeMode(PRIMARY_MODE_CUSTOM1);" //Primary_ChangeMode(PRIMARY_MODE_CUSTOM2); #if (0) Primary_ChangeMode(PRIMARY_MODE_USBMSDC); #else // for USB timeout check if (usb_open()==E_TMOUT) { debug_msg("USB is connected to charger\r\n"); bLastUSBDet = bCurUSBDet; bLastUSBStatus = bCurUSBStatus; KeyScan_SetUSBPower(TRUE); usb_close(); if(Primary_GetCurrentMode() == PRIMARY_MODE_MOVIE) { if (gUIAviIsRecording == FALSE) { Ux_PostEvent(NVTEVT_KEY_ENTER, 1, NVTEVT_KEY_PRESS); } } return; } usb_close(); KeyScan_SetUSBPower(FALSE); //#NT#2009/10/12#Winston Li -begin Primary_ChangeMode(PRIMARY_MODE_PHOTO); // need to enter preview mode firstly, why? TimerDelayMs(200); //#NT#2009/10/12#Winston Li -end //janice for screen ¸õ°Ê and ´Ý¼v UI_Set_NotFlip(); // Open USB mode select task // USB mode select task will disable modedial detection //#NT#2009/07/30#Niven Cho -begin //#NT#Added., for MSDCExt with NVT #if (_MSDCVENDOR_== _MSDCVENDOR_NVT_) /* //------------------------------------------------------------------------------ // Single Module Selection //------------------------------------------------------------------------------ #define SI_MODULE_NONE 0 //!< No Single Module #define SI_MODULE_CUSTOM_SI 1 //!< Customer Develop Module #define SI_MODULE_IQSIM 2 //!< Image Quality Simulation Tool #define SI_MODULE_TIME_SI 3 //!< PC Time Sync */ if (MsdcNvt_GetSIModule()==1) { MSDCVendorSample_Open(); } else { Primary_ChangeMode(PRIMARY_MODE_CUSTOM1); //change to USB menu janice } #else Primary_ChangeMode(PRIMARY_MODE_CUSTOM1); //change to USB menu janice #endif Primary_Wait4ChangeModeDone(); #endif } // USB unplugged else { debug_err(("USB is unplugged......\r\n")); //#2007/08/17#JaniceHuang::do power off while unplug //KeyScan_PoweroffFlow(); // Enable modedial detection KeyScan_EnableMDDet(TRUE); if((Primary_GetCurrentMode() == PRIMARY_MODE_USBMSDC)||(gbUSNMenuOpen == TRUE)) { KeyScan_PoweroffFlow(); } else { //KeyScan_EnableAutoPoweroff(TRUE); //KeyScan_SetAutoPoweroffTime(10); //jack lan KeyScan_SetUSBPower(FALSE); } KeyScan_EnableKeyDet(TRUE); // Detect modedial and force change mode // Unnecessary here // KeyScan_DetModedial(TRUE); // #NT#2007/07/26@StevenWang begin // When USB un plug, using Get previous mode to back to previous mode // uiPreModeID = Primary_GetPreviousMode(); // #NT#2007/07/31@Janice begin -- always back to photo mode //#NT#2009/07/30#Niven Cho -begin //#NT#Added., for MSDCExt with NVT #if (_MSDCVENDOR_== _MSDCVENDOR_NVT_) MSDCVendorSample_Close(); #endif //#NT#2009/07/30#Niven Cho -end //Primary_ChangeMode(PRIMARY_MODE_PHOTO); // #NT#2007/07/26@StevenWang end } } bLastUSBDet = bCurUSBDet; bLastUSBStatus = bCurUSBStatus; }
void KeyScan_DetPoweroff(void) { static UINT32 uiPowerKey = KEYSCAN_PWRKEY_UNKNOWN; static UINT32 uiPWRState = KEYSCAN_PWROFF_INIT_STATE; static UINT32 uiPowerKeyPressCount = 0; static UINT32 uiTVKeyPressCount = 0; static UINT32 uiTVKey = KEYSCAN_PWRKEY_UNKNOWN; static UINT32 uiTVState = KEYSCAN_PWROFF_INIT_STATE; static UINT32 uiModeKeyPressCount = 0; static UINT32 uiModeKey = KEYSCAN_PWRKEY_UNKNOWN; static UINT32 uiModeState = KEYSCAN_PWROFF_INIT_STATE; UINT32 ad1 = 0; // Power off request from another task if (bDoPoweroff == TRUE) { KeyScan_PoweroffFlow(); } ad1 = adc_readData(ADC_CHANNEL_1); #if 1//(OSD_DUMP == OSD_DUMP_ENABLE) // using POWER key to dump OSD screen // Detect power off key if (rtc_getPWRStatus()) { // Reset shutdown timer rtc_resetShutdownTimer(); // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_PRESSED) { if (uiPWRState == KEYSCAN_PWROFF_RELEASE_STATE) { uiPowerKeyPressCount++; if (uiPowerKeyPressCount > KEYSCAN_POWEROFF_COUNT) { uiPWRState = KEYSCAN_PWROFF_PRESS_STATE; } } if(uiPWRState == KEYSCAN_PWROFF_PRESS_STATE) { KeyScan_PoweroffFlow(); } } else { uiPowerKey = KEYSCAN_PWRKEY_PRESSED; } } else { // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_RELEASED) { if (uiPWRState == KEYSCAN_PWROFF_INIT_STATE) { uiPWRState = KEYSCAN_PWROFF_RELEASE_STATE; } if (uiPowerKeyPressCount) { uiPowerKeyPressCount = 0; //----------change to half hour mode from 5mins ide mode begin-------------------- //TimerCounter5MinMode=0; if(ACC5MinMode == TRUE) { ACC5MinMode=FALSE; PowerOnMau=TRUE; ACCHalfHourMode=TRUE; KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_DEFAULT); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_RELEASE, FLGKEY_KEY_MASK_DEFAULT); } //----------change to half hour mode from 5mins ide mode end-------------------- //----------trig lcd backlight begin-------------------- if((!KeyScan_IsHDMIPlugIn())&&(!KeyScan_IsTVPlugIn())) { if((Primary_GetCurrentMode()!= PRIMARY_MODE_USBMSDC)&&(Primary_GetCurrentMode()!= PRIMARY_MODE_USBPCC)) { if(!GPIOMap_IsLCDBacklightOn()) { GPIOMap_TurnOnLCDBacklight(); g_uiKeyScanLcdOffCnt = 0; return; } } } //----------trig lcd backlight end -------------------- //----------engnore PWR Plus begin-------------------- debug_err((" ---keyscanpwr---gbFirstPWR :%d--- \r\n",gbFirstPWR)); if(gUIAviIsRecording == TRUE){ if(gbFirstPWR == TRUE) { gbFirstPWR = FALSE; return; } //----------engnore PWR Plus end-------------------- //----------change audio item begin-------------------- switch(Get_MovieAudioIndex()) { case MOVIE_AUDIO_OFF: aud_setGain(AUDIO_GAIN_6); Set_MovieAudioIndex(MOVIE_AUDIO_ON); break; case MOVIE_AUDIO_ON: aud_setGain(AUDIO_GAIN_MUTE); Set_MovieAudioIndex(MOVIE_AUDIO_OFF); break; } Ux_PostEvent(NVTEVT_OSD_REFLASH, 0); } //----------change audio item end-------------------- } } else { uiPowerKey = KEYSCAN_PWRKEY_RELEASED; } } ///-------------TV OUT MANUAL ---------------------------- #if 0 if((ad1 > KEY_ADC_TV - KEY_ADC_ERR) && (ad1 < KEY_ADC_TV + KEY_ADC_ERR)) { // Debounce if (uiTVKey == KEYSCAN_PWRKEY_PRESSED) { if (uiTVState == KEYSCAN_PWROFF_RELEASE_STATE) { uiTVKeyPressCount++; debug_err(("uiTVKeyPressCount : %d...\r\n",uiTVKeyPressCount)); if (uiTVKeyPressCount > KEYSCAN_POWEROFF_COUNT) { uiTVState = KEYSCAN_PWROFF_PRESS_STATE; } } if (uiTVState == KEYSCAN_PWROFF_PRESS_STATE) { uiTVKeyPressCount = 0; uiTVKey = KEYSCAN_PWRKEY_UNKNOWN; uiTVState = KEYSCAN_PWROFF_INIT_STATE; #if 0 KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if(!GPIOMap_IsLCDBacklightOn()) { GPIOMap_TurnOnLCDBacklight(); g_uiKeyScanAutoPoweroffCnt = 0; return; } } if(GPIOMap_DetTV()==TRUE) { GPIOMap_SetTV(FALSE); } else { GPIOMap_SetTV(TRUE); } #endif //Ux_PostEvent(NVTEVT_KEY_PLAYBACK, 1, NVTEVT_KEY_PRESS); //playback mode } } else { uiTVKey = KEYSCAN_PWRKEY_PRESSED; if(GPIOMap_DetTV()==TRUE) { GPIOMap_SetTV(FALSE); } } } else { // Debounce if (uiTVKey == KEYSCAN_PWRKEY_RELEASED) { if (uiTVState == KEYSCAN_PWROFF_INIT_STATE) { uiTVState = KEYSCAN_PWROFF_RELEASE_STATE; } if (uiTVKeyPressCount) { uiTVKeyPressCount = 0; KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if(!GPIOMap_IsLCDBacklightOn()) { GPIOMap_TurnOnLCDBacklight(); g_uiKeyScanAutoPoweroffCnt = 0; return; } } Ux_PostEvent(NVTEVT_KEY_UP, 1, NVTEVT_KEY_PRESS); } } else { uiTVKey = KEYSCAN_PWRKEY_RELEASED; } } //----------------------TV OUT MANUAL ------------------------------------- #endif ///-------------KEY MODE or MENU ---------------------------- if((ad1 > (KEY_ADC_MENUMODE - KEY_ADC_ERR)) && (ad1 < (KEY_ADC_MENUMODE + KEY_ADC_ERR))) { debug_err(("uiModeKey : %d uiModeState:%d ...\r\n",uiModeKey,uiModeState)); // Debounce if (uiModeKey == KEYSCAN_PWRKEY_PRESSED) { if (uiModeState == KEYSCAN_PWROFF_RELEASE_STATE) { uiModeKeyPressCount++; debug_err(("uiModeKeyPressCount : %d...\r\n",uiModeKeyPressCount)); if (uiModeKeyPressCount > KEYSCAN_POWEROFF_COUNT) { uiModeState = KEYSCAN_PWROFF_PRESS_STATE; } } if (uiModeState == KEYSCAN_PWROFF_PRESS_STATE) { uiModeKeyPressCount = 0; uiModeKey = KEYSCAN_PWRKEY_UNKNOWN; uiModeState = KEYSCAN_PWROFF_INIT_STATE; KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if(!GPIOMap_IsLCDBacklightOn()) { GPIOMap_TurnOnLCDBacklight(); g_uiKeyScanAutoPoweroffCnt = 0; return; } } Ux_PostEvent(NVTEVT_KEY_MODE, 1, NVTEVT_KEY_PRESS); //playback mode } } else { uiModeKey = KEYSCAN_PWRKEY_PRESSED; //if(GPIOMap_DetTV()==TRUE) //{ //GPIOMap_SetTV(FALSE); // } } } else { // Debounce if (uiModeKey == KEYSCAN_PWRKEY_RELEASED) { if (uiModeState == KEYSCAN_PWROFF_INIT_STATE) { uiModeState = KEYSCAN_PWROFF_RELEASE_STATE; } if (uiModeKeyPressCount) { uiModeKeyPressCount = 0; KeyScan_PlaySound(KEYSCAN_SOUND_KEY_OTHERS); if(!KeyScan_IsHDMIPlugIn()&&(!KeyScan_IsTVPlugIn())) { if(!GPIOMap_IsLCDBacklightOn()) { GPIOMap_TurnOnLCDBacklight(); g_uiKeyScanAutoPoweroffCnt = 0; return; } } Ux_PostEvent(NVTEVT_KEY_MENU, 1, NVTEVT_KEY_PRESS); } } else { uiModeKey = KEYSCAN_PWRKEY_RELEASED; } } //----------------------TV OUT MANUAL ------------------------------------- #else // normal POWER key handling process // Detect power off key if ( rtc_getPWRStatus() || GPIOMap_DetPoweroff()) { // Reset shutdown timer rtc_resetShutdownTimer(); // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_PRESSED) { if (uiPWRState == KEYSCAN_PWROFF_RELEASE_STATE) { uiPWRState = KEYSCAN_PWROFF_PRESS_STATE; } //#NT#2009/03/10#Photon Lin -begin //#Remove KeyScan_PoweroffFlow() to case KEYSCAN_PWRKEY_PRESSED if(uiPWRState == KEYSCAN_PWROFF_PRESS_STATE) { KeyScan_PoweroffFlow(); } //#NT#2009/03/10#Photon Lin -end } else { uiPowerKey = KEYSCAN_PWRKEY_PRESSED; } } else { // Debounce if (uiPowerKey == KEYSCAN_PWRKEY_RELEASED) { if (uiPWRState == KEYSCAN_PWROFF_INIT_STATE) { uiPWRState = KEYSCAN_PWROFF_RELEASE_STATE; } else if (uiPWRState == KEYSCAN_PWROFF_PRESS_STATE) { KeyScan_PoweroffFlow(); } } else { uiPowerKey = KEYSCAN_PWRKEY_RELEASED; } } #endif }
INT32 UIFlowWndPlay_OnKeyRight(VControl *pCtrl, UINT32 paramNum, UINT32 *paramArray) { UINT32 uiActKey; if (paramNum >= 1) uiActKey = paramArray[0]; switch (uiActKey) { case NVTEVT_KEY_PRESS: switch(g_PlbData.State) { case PLB_ST_FULL: KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_NULL); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_PLAYNEXT,0); FlowPB_UpdateIcons(1); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_DEFAULT); break; case PLB_ST_PLAY_MOV: case PLB_ST_FWD_MOV: case PLB_ST_BWD_MOV: #if 0 if(!KeyScan_IsHDMIPlugIn()) //Not allow volume change when HDMI plugged in { //debug_err(("henry--------------down\r\n")); if(g_uiUIFlowWndPlayCurrentVolume > AUDIO_VOL_MUTE) { g_uiUIFlowWndPlayCurrentVolume--; Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); FlowPB_IconDrawMovPlayVolumn(g_uiUIFlowWndPlayCurrentVolume); } } #endif //if (KeyScan_IsHDMIPlugIn()==FALSE) { if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_8x) { g_PlbData.VideoPBSpeed ++; Ux_FlushEvent(); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_NULL); if(g_PlbData.VideoPBSpeed > PLB_FWD_MOV_1x) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVFWD,1,g_PlbData.VideoPBSpeed); g_PlbData.State = PLB_ST_FWD_MOV; // set mute in FWD playing hdmitx_setAudMute(TRUE); } else if(g_PlbData.VideoPBSpeed < PLB_FWD_MOV_1x) { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVBWD,1,g_PlbData.VideoPBSpeed); g_PlbData.State = PLB_ST_BWD_MOV; // set mute in BWD playing hdmitx_setAudMute(TRUE); } else //uiCurrSpeedIndex == PLAYMOV_SPEED_FWD_1X { Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_MOVFWDSTOP,0); g_PlbData.State = PLB_ST_PLAY_MOV; hdmitx_setAudMute(FALSE); Ux_SendEvent(&UIPlayObjCtrl,NVTEVT_AUD_VOLUME,1,g_uiUIFlowWndPlayCurrentVolume); } FlowPB_IconDrawMovSpeed(); KeyScan_SetKeyMask(KEYSCAN_KEYMODE_PRESS, FLGKEY_KEY_MASK_DEFAULT); } //} break; } break; } return NVTEVT_CONSUME; }
/** Detect AC is plugging in or unplugged Detect AC is plugging in or unplugged. @param void @return void */ void KeyScan_DetAC(void) { #define AC_PLUS_COUNT 10 BOOL bCurACDet, bCurACStatus; static UINT32 ACCount = 0; static BOOL bACUnplus = FALSE; if ((KeyScan_IsHDMIPlugIn() == TRUE) || (KeyScan_IsTVPlugIn() == TRUE)) return; //check acpower 15 seconds,if AC Power is unplused,call stop record and poweroff bCurACDet = KeyScan_IsUSBPower(); if (bCurACDet) { //ACCount = AC_PLUS_COUNT; if(Get_DelayPowerOffIndex() == DELAY_POWER_OFF_OFF) ACCount = 1; else if(Get_DelayPowerOffIndex() == DELAY_POWER_OFF_15S) ACCount = 15; else if(Get_DelayPowerOffIndex() == DELAY_POWER_OFF_1MIN) ACCount = 60; else if(Get_DelayPowerOffIndex() == DELAY_POWER_OFF_5MIN) ACCount = 300; else if(Get_DelayPowerOffIndex() == DELAY_POWER_OFF_30MIN) ACCount = 1800; else if(Get_DelayPowerOffIndex() == DELAY_POWER_OFF_60MIN) ACCount = 3600; else ACCount =1; } else if (bACUnplus) { debug_err(("ACCount = %d\r\n", ACCount)); if (ACCount) { ACCount -- ; } if (ACCount == 0) { KeyScan_Poweroff(); } } bCurACStatus = (BOOL)(bCurACDet & bLastACDet); //debug_err(("AC is plugged, GPIOMap_DetAC = %d\r\n", bCurACDet)); if (bCurACStatus != bLastACStatus) { // AC is plugging in if (bCurACStatus == TRUE) { bACStatus = TRUE; bACUnplus = FALSE; } // AC is unplugged else { debug_err(("AC is unplugged, GPIOMap_DetAC = %d\r\n", bCurACDet)); bACStatus = FALSE; bACUnplus = TRUE; } } bLastACDet = bCurACDet; bLastACStatus = bCurACStatus; }
/** Detect AC is plugging in or unplugged Detect AC is plugging in or unplugged. @param void @return void */ void KeyScan_DetAC(void) { #define AC_PLUS_COUNT 30 BOOL bCurACDet, bCurACStatus; PrimaryModeID CurrMode; static UINT32 ACCount = 0; static BOOL bACUnplus = FALSE; extern MOV_TASK_DATA gMovData ; if ((KeyScan_IsHDMIPlugIn() == TRUE) || (KeyScan_IsTVPlugIn() == TRUE)) return; //check acpower 15 seconds,if AC Power is unplused,call stop record and poweroff bCurACDet = KeyScan_IsUSBPower(); if (bCurACDet) { ACCount = AC_PLUS_COUNT; /*if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_DISABLE) ACCount = 1; else if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_1MIN) ACCount = 240; else if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_2MIN) ACCount = 480; else if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_3MIN) ACCount = 720; else if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_5MIN) ACCount = 1200; else if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_10MIN) ACCount = 2400; else if(SysGetFlag(FL_POWEROFF_DELAY) == POWER_OFF_DELAY_15MIN) ACCount = 3600; */ } else if (bACUnplus) { if (ACCount) { ACCount -- ; } if ((ACCount == 0) && ((gMovData.State == MOV_ST_REC)||(gMovData.State == (MOV_ST_REC|MOV_ST_ZOOM)))) { bUSBUnplug = TRUE; //Ux_SendEvent(&UIMovieObjCtrl,NVTEVT_STOP_RECAVI,NULL); //TimerDelayMs(1000); //KeyScan_Poweroff(); } } bCurACStatus = (BOOL)(bCurACDet & bLastACDet); //debug_err(("AC is plugged, GPIOMap_DetAC = %d\r\n", bCurACDet)); if (bCurACStatus != bLastACStatus) { // AC is plugging in if (bCurACStatus == TRUE) { VControl *pCurrnetWnd; bACStatus = TRUE; bACUnplus = FALSE; debug_err(("AC is plugged, GPIOMap_DetAC = %d\r\n", bCurACDet)); CurrMode = Primary_GetCurrentMode(); /*if (CurrMode == PRIMARY_MODE_MOVIE) { Ux_GetFocusedWindow(&pCurrnetWnd); if (!strncmp(pCurrnetWnd->Name,"UIFlowWndMovie",14)) { if ((gMovData.State == MOV_ST_VIEW)||(gMovData.State == (MOV_ST_VIEW|MOV_ST_ZOOM))) { //g_uiKeyScanFlags |= (FLGKEY_PRESSED | FLGKEY_DEL); Ux_FlushEvent(); Ux_PostEvent(NVTEVT_KEY_SHUTTER2, 2, NVTEVT_KEY_PRESS, FLGKEY_PRESSED); // Ux_PostEvent(NVTEVT_KEY_ENTER, 3, NVTEVT_KEY_PRESS, FLGKEY_PRESSED,UIFlowWndMovie_Start_Rec); } } }else { // Enter dummy mode first Primary_ChangeMode(PRIMARY_MODE_DUMMY); Primary_Wait4ChangeModeDone(); Primary_ChangeMode(PRIMARY_MODE_MOVIE); Primary_Wait4ChangeModeDone(); TimerDelayMs(500); //g_uiKeyScanFlags |= (FLGKEY_PRESSED | FLGKEY_DEL); Ux_FlushEvent(); Ux_PostEvent(NVTEVT_KEY_SHUTTER2, 2, NVTEVT_KEY_PRESS, FLGKEY_PRESSED); //Ux_PostEvent(NVTEVT_KEY_ENTER, 3, NVTEVT_KEY_PRESS, FLGKEY_PRESSED,UIFlowWndMovie_Start_Rec); }*/ } // AC is unplugged else { debug_err(("AC is unplugged, GPIOMap_DetAC = %d\r\n", bCurACDet)); bACStatus = FALSE; bACUnplus = TRUE; //KeyScan_PoweroffFlow(); //#PIC#2011/06/01#Creator -end // Get current mode CurrMode = Primary_GetCurrentMode(); if (CurrMode != PRIMARY_MODE_MOVIE) { return; } } } bLastACDet = bCurACDet; bLastACStatus = bCurACStatus; }