source: svn/newcon3bcm2_21bu/dst/app/src/kview/Proc/App_Proc_Idle.c

Last change on this file was 76, checked in by megakiss, 10 years ago

1W 대기전력을 만족시키기 위하여 POWEROFF시 튜너를 Standby 상태로 함

  • Property svn:executable set to *
File size: 22.5 KB
Line 
1/****************************************************************************
2* NAME: App_Proc_Idle.c
3*----------------------------------------------------------------------------
4* Copyright (c) DIGITAL STREAM Technology Inc.
5*----------------------------------------------------------------------------
6* CREATED_BY: Yong Dae Park
7* CREATION_DATE: 2009/08/25
8* $Author: x2silo $
9* $Revision: 1.0 $
10* $Date: 2010/01/27 16:46:51 $
11*----------------------------------------------------------------------------
12* PURPOSE:
13* -
14*****************************************************************************/
15
16/*_____ I N C L U D E __________________________________________*/
17
18#include "App_Main.h"
19#include "App_Proc.h"
20
21#include "DHL_UIO.h"
22#include "UioFilter.h"
23
24#include "App_Fnc_Common.h"
25#include "App_Fnc_Time.h"
26#include "App_Fnc_SignalMonitor.h"
27#include "App_Fnc_Power.h"
28#include "App_Fnc_Rating.h"
29#include "App_Fnc_ChTune.h"
30#include "App_Fnc_Video.h"
31#include "App_Fnc_Audio.h"
32#include "App_Fnc_AutoScan.h"
33
34#include "App_Fnc_EA2.h"
35
36#include "App_Fnc_Sdds.h"
37#include "App_Fnc_Comm.h"
38
39#include "App_Res_Resources.h"
40
41#include "App_OSD_Common.h"
42#include "App_OSD_Banner.h"
43
44
45
46
47
48/*_____ D E F I N I T I O N ____________________________________*/
49
50#if COMMENT
51_____DbgPrint_____(){}
52#endif
53
54DHL_MODULE("p_idl", 0);
55
56
57
58
59
60#if COMMENT
61_____Config_____(){}
62#endif
63
64
65
66
67
68#if COMMENT
69_____Types_____(){}
70#endif
71
72
73
74
75
76#if COMMENT
77_____Variables_____(){}
78#endif
79
80static BOOL bAutoOffOn = FALSE;
81 // auto power down¼³Á¤ ½Ã(sleep, no-sig, no-key), ÀÚµ¿²¨Áü popupÀ» Çѹø¸¸ ¶ç¿ì±â À§ÇØ ±¸ºÐÇÏ´Â flag
82
83static UINT32 p_ir_code=0;
84static UINT32 p_ir_ms=0;
85
86static BOOL p_is_receive_wakeup=FALSE;
87
88static BOOL p_is_standby=FALSE; //ÇöÀç standby ¸ðµåÀÎÁö Á¤º¸¸¦ °¡Áö°í ÀÖÀ½.     --> BKTODO: TRUE->FALSE
89
90static BOOL p_power_on_timer; //timer¿¡ ÀÇÇÑ booting...¾÷µ¥ÀÌÆ®¸¦ ¸¶Ä¡°í ²¨Á®¾ß ÇÔ.
91
92static BOOL p_first=TRUE;
93BOOL p_is_ch_change=FALSE;
94
95static char p_micom_ver[8];
96
97extern void App_InitializeTask(void);
98
99/*_____ F U N C T I O N ________________________________________*/
100
101#if COMMENT
102__FUNCTION__() {}
103#endif
104
105static BOOL p_check_no_key_input_timeout()
106{
107        tDMG_MenuInfo info;
108        DMG_GetMenuInfo(&info);
109       
110        /* exception handling */
111        if(App_GetNoKeyPowerDownTimeout()==0xff) return FALSE;
112       
113        if(App_GetNoKeyPowerDownTimeout()==254 && bAutoOffOn==FALSE) { //1ºÐ 5ÃÊ ÈÄ¿¡ ÀÚµ¿ Á¾·áµÊ.
114                dprint(0, "test mode for power down timeout...(remain time: %d secs)\n", 
115                        (1000*65-(DHL_OS_GetMsCount()-info.ms_last_key))/1000);
116                if(DHL_OS_GetMsCount()-info.ms_last_key >= 1000*65) {
117                        bAutoOffOn=TRUE;
118                        return TRUE;
119                }
120        }       
121       
122        if(DHL_OS_GetMsCount()-info.ms_last_key >= (App_GetNoKeyPowerDownTimeout()*10-1)*1000*60 && bAutoOffOn==FALSE) {
123                // 2010.04.26 foxhunt : TRUE´Â Çѹø¸¸ º¸³»¾î App_Exit ÇÑ´Ù.(standby mode¿¡¼­µµ °è¼Ó Ä«¿îÆÃ µÇ±â ¶§¹®)
124                bAutoOffOn=TRUE;
125                return TRUE;
126        }
127               
128        return FALSE;
129}
130
131static tDMG_MenuId p_get_menu_active()
132{
133        tDMG_Menu *pmenu=DMG_GetCurMenu();
134       
135        if(!pmenu) return 0;
136       
137        return pmenu->id;
138}
139
140
141static BOOL p_check_no_sig_timeout()
142{
143        APP_SIGMON_INFO info;
144        App_GetSigMonInfo(&info);
145       
146        /* exception handling */
147        //if(info.status!=APP_SM_STAT_LOW && info.status!=APP_SM_STAT_NOPGM) return FALSE;
148        if(App_GetNoSigPowerDownTimeout()==0xff) return FALSE;
149               
150        if(App_GetNoSigPowerDownTimeout()==254 && bAutoOffOn==FALSE) { //30ÃÊ ÈÄ¿¡ ÀÚµ¿ Á¾·áµÊ.
151                dprint(0, "test mode for power down timeout...(remain time: %d secs)\n", 
152                        (1000*30-info.status_period_ms)/1000);
153                if(info.status_period_ms >= 1000*30) {
154                        bAutoOffOn=TRUE;
155                        return TRUE;
156                }
157        }
158
159#if 0
160        if(info.status_period_ms >= App_GetNoSigPowerDownTimeout()*10*1000*60 && bAutoOffOn==FALSE) {
161                DMG_MenuStart(MID_AUTO_OFF);
162                bAutoOffOn = TRUE;
163        }
164       
165        dprint(3, "weak signal after : %d sec\n", info.status_period_ms/1000);
166       
167        //testcode.
168        if(App_GetNoSigPowerDownTimeout()==254) { //30ÃÊ ÈÄ¿¡ ÀÚµ¿ Á¾·áµÊ.
169                if(info.status_period_ms >= 1000*30) {
170                        return TRUE;
171                }
172        }
173       
174       
175        /* auto power down */
176        /* 2010.03.11 foxhunt : info.status_period¿¡¼­ ÀÌ¹Ì tick°ü¸®°¡ µÇ¾î ÀÖ´Ù. */
177        //if(DHL_OS_GetMsCount()-info.status_period_ms>=App_GetNoSigPowerDownTimeout()*1000*60) {
178        if(info.status_period_ms >= App_GetNoSigPowerDownTimeout()*10*1000*60) {
179                return TRUE;
180        }
181       
182        return FALSE;
183#else
184        if(info.status_period_ms >= (App_GetNoSigPowerDownTimeout()*10-1)*60*1000 && bAutoOffOn==FALSE) {
185                bAutoOffOn=TRUE;
186                return TRUE;
187        }
188       
189        return FALSE;
190#endif
191}
192
193
194
195static void p_process_msg(UINT8 cmd, UINT8 *pdata)
196{
197        UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE,};
198        int i;
199       
200        switch(cmd) {
201                case eCMD_WAKEUP_INFO:
202                       
203                        dprint(0, "=====================================\n");
204                        dprint(0, "===========  wake up info (reason:%d)\n", pdata[0]);
205                        dprint(0, "=====================================\n");
206                       
207                        p_is_receive_wakeup=TRUE;
208                       
209                        p_power_on_timer=FALSE;
210
211                        // eCMD_SET_IRVENDER¸¦ Àü¼ÛÇÔ.
212                        send_data[1]=eCMD_SET_IRVENDER;
213                       
214                        {
215                                UINT32 *pvendor_power=App_Menu_GetVenderPowerCode();
216                               
217                                for(i=0; pvendor_power[i]>0; i++) {
218                                        send_data[2]=(pvendor_power[i]>>24)&0xff;
219                                        send_data[3]=(pvendor_power[i]>>16)&0xff;
220                                        send_data[4]=(pvendor_power[i]>>8)&0xff;
221                                        send_data[5]=(pvendor_power[i])&0xff;
222                                       
223                                        App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
224                                }
225                               
226                        }
227                       
228                        sprintf(p_micom_ver, "%d.%d", pdata[1]/10, pdata[1]%10);
229               
230                        switch(pdata[0]) {
231                                case ePOWER_ON_AC:
232                                        //Àá½Ã ÄÑÁ³´Ù°¡..´Ù½Ã ²¨Áö´Â °æ¿ì, micom¿¡ ´ÙÀ½ Á¤º¸¸¦ Àü´ÞÇØ¾ß ÇÔ..
233                                        //´ÙÀ½¿¡ ÄÑÁú ½Ã°£ Á¤º¸¸¦ host¿¡ Àü´Þ.
234                                        //ÀÏ´Ü 0À» Àü¼ÛÇÏÀÚ.
235                                       
236                                        if(!App_Fnc_ExistMicom()) {
237                                                //App_InitializeTask(); //task ÃʱâÈ­.
238                                        }
239                                       
240                                        send_data[1]=eCMD_SET_STANDBY;
241                                        send_data[2]=0;
242                                        send_data[3]=0;
243                                        send_data[4]=0;
244                                        send_data[5]=0;
245                                        App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
246                                       
247                                        break;
248                                       
249                                case ePOWER_ON_TIMER:
250                                        //timer¿¡ ÀÇÇØ bootingµÇ¾úÀ¸¹Ç·Î, sdds ¾÷µ¥ÀÌÆ®¸¦ ¼öÇàÇÔ.
251                                        //sdds ¾÷µ¥ÀÌÆ®¸¦ À§Çؼ­´Â È­¸éÀÌ ÄÑÁ®¼­´Â ¾ÈµÊ.
252                                       
253                                        App_SddsPowerModeChanged(FALSE);
254                                        //¾÷µ¥ÀÌÆ®°¡ Á¾·áµÇ¸é ÀÚµ¿À¸·Î ²¨Á®¾ß ÇÔ..
255                                        p_power_on_timer=TRUE;
256                                        break;
257                                       
258                                case ePOWER_ON_KEY:
259                                        //normalÇÑ booting. micomÀÌ ÀÖ´Â °æ¿ì¸¸ ³ª¸ÓÁö ÃʱâÈ­ ¼öÇà.
260                                        if(App_Fnc_ExistMicom()) {
261                                                //App_InitializeTask(); //task ÃʱâÈ­.
262                                        }
263//                                      App_ChTuneRecoverLastChannel();
264                                        break;
265                                       
266                                case ePOWER_ON_RESET:
267                                        //normalÇÑ booting. micomÀÌ ÀÖ´Â °æ¿ì¸¸ ³ª¸ÓÁö ÃʱâÈ­ ¼öÇà.
268                                        if(App_Fnc_ExistMicom()) {
269                                                //App_InitializeTask(); //task ÃʱâÈ­.
270                                        }
271//                                      App_ChTuneRecoverLastChannel();
272                                        break;
273                                }
274                       
275                        break;
276                       
277                case eCMD_DEBUG:
278                        //debug..4byte char¸¦ È­¸é¿¡ Âï´Â´Ù.
279                        dprint(0, "=====================================\n");
280                        dprint(0, "  [MICOM] 0x%x 0x%x 0x%x 0x%x\n",
281                                pdata[0], pdata[1], pdata[2], pdata[3]);
282                        dprint(0, "=====================================\n");
283                        break;
284               
285                case eCMD_PRIV_SMPS:
286                        p_is_standby=pdata[0]==0?TRUE:FALSE;
287                       
288                        if(pdata[0]==TRUE) { //smps onÀ̹ǷΠready to start¸¦ Àü¼ÛÇÔ..
289                                UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE, eCMD_READYTOSTART,};
290                                App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
291                        }
292                        break;
293        }
294       
295       
296}
297
298
299
300#if COMMENT
301__PROC_IDLE__() {}
302#endif
303
304/* idle proc¿¡¼­ timeout °ü¸®¸¦ ÇÔ */
305
306BOOL App_Proc_Idle(tDMG_CMD cmd, UINT32 opt, UINT32 param1, UINT32 param2)
307{
308        BOOL bret=TRUE;
309        tDMG_Menu *pmenu;
310        static char cnt = 0;
311        static UINT32 idle_start_ms=0;
312        static int factory_cnt=0;
313        static int rf_update_cnt=0;
314        static int factory_reset_cnt=0;
315
316        dprint(3, "idle proc..(cmd:%x), opt(%x), param1(%x), param2(%x)\n",
317                cmd, opt, param1, param2);
318       
319        switch(cmd) {
320               
321                case eDMG_CMD_ON_MENU_ENTER :
322                        pmenu=(tDMG_Menu *)param1;
323                        if(pmenu->id!=MID_IDLE) break;
324                               
325                        {
326                                UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE, eCMD_READYTOSTART,};
327                                App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
328                                DHL_OS_Printf("=========== Ready to start ====================\n");
329                        }
330                       
331                        dprint(2, "menu enter message....\n");
332                        DMG_EraseRect(0, 0, 720, 480, 0x00000000);
333                       
334                        idle_start_ms=DHL_OS_GetMsCount();
335                       
336                        DMG_SetFontSize(24);
337                       
338                        DMG_SetTimer(TIMER_ID_BG_1SEC, 1000, 0);
339
340                        DMG_SetTimer(TIMER_ID_L1, 200, eDMG_CMD_OPT_TIMER_LOCAL1);
341                                //ready to start command¸¦ º¸³ÂÀ» ¶§ wakeup info°¡ ¿ÀÁö ¾ÊÀ¸¸é
342                                //5ÃÊ µ¿¾È °è¼Ó Àü¼ÛÇÔ..
343
344                        //DMG_SetTimer(TIMER_ID_CHK_UART, 10, 0); //10ms¸¶´Ù Çѹø¾¿ üũÇÔ..
345                       
346                        //App_InitializeTask();// ÀÓ½Ã...micomÀÌ ¾ÆÁ÷ Á¦´ë·Î µ¿ÀÛÇÏÁö ¾ÊÀ½..
347                        break;
348                       
349                case eDMG_CMD_ON_MENU_ACTIVE :
350                        pmenu=(tDMG_Menu *)param1;
351                        if(pmenu->id!=MID_IDLE) break;
352                       
353                        if(param2==MID_STANDBY) {
354                                idle_start_ms=DHL_OS_GetMsCount();
355                                //standby¿¡¼­ ³Ñ¾î¿À´Â °æ¿ìµµ ±â·ÏÇÔ
356                        }
357                        break;
358                       
359                case eDMG_CMD_ON_USER_DEFINED :
360                        if(opt==UD_ID_CHK_RATING) {
361                                DMG_SetTimer(TIMER_ID_CHK_RRT, param1, eDMG_CMD_OPT_TIMER_ONESHOT);
362                        }
363                        else if(opt==UD_ID_POWER_ON) {
364                                App_Pwr_Ready();
365                        }
366                        else if(opt==UD_ID_OP_STATE) {
367                        }
368                        // 2010.03.25 foxhunt : no ch guide´Â ch db¾øÀ» ¶§ Ç×»ó ¶ç¿ö¾ß ÇϹǷΠidle¿¡¼­ °ü¸®ÇÑ´Ù.
369                        else if(opt==UD_ID_NO_CH_GUIDE) {
370//                              if(App_Ucm_GetTotalUcmCount() <= 0) DMG_MenuStart(MID_NO_CH_GUIDE);
371//                              else                                DMG_MenuExit(MID_NO_CH_GUIDE);
372                        }
373                        else if(opt==UD_ID_COMM_CMD) {
374                                UINT8 cmd=param1;
375                                static UINT8 data[4];
376                               
377                                data[0]=(param2>>24)&0xff;
378                                data[1]=(param2>>16)&0xff;
379                                data[2]=(param2>>8)&0xff;
380                                data[3]=(param2)&0xff;
381                               
382                                p_process_msg(param1, data);
383                        }
384                       
385                #if 0 
386                        // ÀÏ´Ü UD_ID ´Â »ç¿ëÇÏÁö ¾Ê°í ±¸ÇöÇßÀ½.
387                        // ±×·¯³ª MenuStart ¸¸À¸·Î´Â race condition °¡´É¼º ÀÖÀ¸¹Ç·Î °í·ÁÇØ¾ß ÇÔ.
388                        else if(opt==UD_ID_SCAN_BANNER) {
389                                // ¿©±â±îÁö ¸Þ½ÃÁö°¡ ¿Â °æ¿ì¶ó¸é ch banner°¡ ¾ø´Â °æ¿ì..
390                                // fake·Î ch banner¸¦ ¶ç¿ì°í msg¸¦ ´Ù½Ã Àü¼Û..
391                                // ¾Æ·¡ menu start ¿¡¼­´Â »ç½Ç ¾Æ¹«·± osdµµ Ç¥½ÃÇÏÁö ¾Ê°í ud msg¿¡¼­ Ç¥½ÃÇÑ´Ù.
392                                dprint(0, "\n\n !!!!!! no ch banner \n");
393                                DMG_MenuStart(MID_SCAN_BANNER);
394                                DMG_SetUserDefined(UD_ID_SCAN_BANNER, param1, param2);
395                        }
396                #endif
397
398                #if 0
399                        else if(opt==UD_ID_AUTO_CH_UPDATING) {
400                                //ÇöÀç ä³Î ¾÷µ¥ÀÌÆ® ÁßÀ̶ó´Â °ÍÀ» ¾Ë¸²..
401                                tDMG_Menu *pmenu=DMG_GetCurMenu();
402                                DMG_SetTimer(TIMER_ID_FIRST, 3000, eDMG_CMD_OPT_TIMER_ONESHOT);
403                               
404                                if(pmenu->id==MID_IDLE || pmenu->id==MID_CC ||
405                                        pmenu->id==MID_SIG_MON || pmenu->id==MID_WARN_BANNER) {
406                                        if(param1==TRUE)
407                                                DMG_MenuStart(MID_WARN_BANNER);
408                                        else
409                                                DMG_MenuExit(MID_WARN_BANNER);
410                                }
411                                else if (pmenu->id==MID_CH_BANNER && !p_first && !p_is_ch_change)
412                                {
413                                        if(param1==TRUE)
414                                                DMG_MenuStart(MID_WARN_BANNER);
415                                        else
416                                                DMG_MenuExit(MID_WARN_BANNER);
417                                }
418                        }
419                       
420                #endif
421                        else if(opt==UD_ID_EA_CMD) {
422                                if(param1==UD_ID_EA_SCROLL_START) {
423                                        //scrollÀÌ °³½ÃµÇ¾ú±â ¶§¹®¿¡ scrollÀ» ½ÃÀÛÇØ¾ß ÇÔ.
424                                        DMG_MenuStart(MID_EA);
425                                }
426                               
427                        }
428                        else
429                                bret=FALSE;
430                       
431                        break;
432                       
433                case eDMG_CMD_ON_TIME :
434                       
435                        if(param1==TIMER_ID_CHK_RRT) {
436                                static UINT16 prev_str[64]={0,}; //64 ±ÛÀÚ¸¦ ºñ±³ÇÏ¿© ´Ù¸£¸é ´Ù½Ã ±×¸².
437                                UINT16 *pstr=(UINT16 *)AppRating_DoRatingBlock();
438                                BOOL bsame=FALSE;
439                               
440                                DHL_OS_Printf("==== rating check !!...\n");
441                               
442                                if(pstr) {
443                                        if(DMG_UStrCmp(prev_str, pstr)) bsame=TRUE; 
444                                        else DMG_UStrCpy(prev_str, pstr);
445
446                                        if(DMG_IsMenuOn(MID_POPUP_BANNER))
447                                        {
448                                                DMG_KillTimer(TIMER_ID_POPUP);
449                                                DMG_MenuExit(MID_POPUP_BANNER);
450                                        }
451                                        if(DMG_IsMenuOn(MID_VOL_BANNER))
452                                        {
453                                                DMG_MenuExit(MID_VOL_BANNER);
454                                        }
455                                       
456                                        if(!DMG_IsMenuOn(MID_RATING) || !bsame) {
457                                                DMG_SetMenuParam1(MID_RATING, (UINT32)pstr);
458                                                DMG_MenuUpdate(MID_RATING, (UINT32)pstr);
459                                        }
460                                }
461                                else {
462                                        if(DMG_IsMenuOn(MID_RATING)) {
463                                                DMG_MenuExit(MID_RATING);
464                                        }
465                                }
466                               
467                        }
468                        else if(param1==TIMER_ID_SLEEP) {
469                                DMG_SetTimer(TIMER_ID_SLEEP_LAST1MIN, 1000, 0);
470                        }
471                        else if(param1==TIMER_ID_SLEEP_LAST1MIN) {
472                                static char str[30];
473                                tDMG_MenuInfo info;
474                               
475                                DMG_GetMenuInfo(&info);
476                               
477                                if(DHL_OS_GetMsCount()-info.ms_last_key<=1000) {
478                                        /* 1ÃÊ À̳»¿¡ key°¡ ÀԷµǾúÀ½ */
479                                        DMG_KillTimer(TIMER_ID_SLEEP_LAST1MIN);
480                                        App_SetSleepTimer(0);
481                                        DMG_MenuExit(MID_SLEEP_TIMER);
482                                        break;
483                                }
484                               
485                                DMG_KillTimer(TIMER_ID_POPUP);
486                               
487                                {
488                                        char *t;
489                                        GET_STR(t, TIMER_WARN_LESS_1MIN);
490                                        sprintf(str, t, 60-(param2/1000));
491                                }
492                               
493                                if(param2<1500) { /* óÀ½ È£ÃâµÇ´Â °æ¿ì */
494                                        DMG_MenuStart(MID_SLEEP_TIMER);
495                                }
496                                                               
497                                DMG_MenuUpdate(MID_SLEEP_TIMER, (UINT32)str);
498                               
499                                if(((param2/1000)>=55) && bAutoOffOn==FALSE) { // 5 sec ³²°ÜµÎ°í power off popup
500                                        DMG_MenuStart(MID_AUTO_OFF);
501                                        bAutoOffOn = TRUE;
502                                }
503                               
504                                dprint(3, "<sleep timer> %s\n", str);
505                               
506                                if((param2/1000)>=60) {
507                                        DMG_KillTimer(TIMER_ID_SLEEP_LAST1MIN);
508                                        bAutoOffOn = FALSE;
509                                        DMG_SetMenuParam1(MID_STANDBY, 0);
510                                        DMG_MenuStart(MID_STANDBY);
511                                        App_SetSleepTimer(0);
512                                }
513                        }
514                        else if(param1==TIMER_ID_BG_1SEC) {
515#if 0                           
516                                if(p_check_no_sig_timeout()) {
517                                        DMG_SetTimer(TIMER_ID_SLEEP_LAST1MIN, 1000, 0);
518                                }
519#else   
520                                if(p_check_no_key_input_timeout()) {
521                                        DMG_SetTimer(TIMER_ID_SLEEP_LAST1MIN, 1000, 0);
522                                }
523#endif 
524                                //UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE, eCMD_IAM_ALIVE, };
525                                //App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
526#if 0                           
527                                if(App_Fnc_ExistMicom() && param2<60000 && !p_is_receive_wakeup) {
528                                        //1ºÐ ³» °è¼Ó ready to start ¸¦ Àü¼ÛÇÔ...
529                                        UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE, eCMD_READYTOSTART,};
530                                        App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
531                                        DHL_OS_Printf("=========== Ready to start ====================\n");
532                                }
533#endif                         
534
535                                if(p_power_on_timer) { //timer¿¡ ÀÇÇØ power onµÊ
536                                        APP_SDDS_SHORT_INFO info;
537                                       
538                                        App_SddsGetInfo(&info);
539                                       
540                                        if(info.state==eSDDS_STATE_INIT || info.state==eSDDS_STATE_COMPELTED) {
541                                               
542                                                if(App_Fnc_ExistMicom()) {
543                                                        UINT8 send_data[MICOM_UART_MSG_LEN]=
544                                                                {MICOM_UART_START_CODE, eCMD_SET_STANDBY, 0, 0, 0, 0};
545                                                               
546                                                        App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
547                                                }
548                                                else {
549                                                        DHL_SYS_Reset(eDHL_RESET_Reboot);
550                                                }
551                                        }
552                                }
553
554                        }
555                        else if(param1==TIMER_ID_L1) {
556                                //Ȥ½Ã ´Ù¸¥ menu proc¿¡¼­ È£ÃâµÉ ¼öµµ ÀÖÀ¸¹Ç·Î üũ ÇÊ¿ä
557                                if(DMG_GetCurMenu() && ((tDMG_Menu *)DMG_GetCurMenu())->id==MID_IDLE) {
558                                        //5ÃÊ ³» °è¼Ó tryÇÔ
559                                        if(p_is_receive_wakeup || param2>5000) {
560                                                DMG_KillTimer(TIMER_ID_L1);
561                                        }
562                                        else {
563                                                UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE, eCMD_READYTOSTART,};
564                                                App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
565                                                DHL_OS_Printf("=========== Ready to start ====================\n");
566                                        }
567                                }
568                        }
569
570#if 0 //¿ø·¡ autoscan ÈÄ¿¡ ch banner¸¦ º¸¿©ÁÙ·Á°í Çߴµ¥, autoscan OSD¿Í ch banner OSD°¡ °ãÄ¡´Â ¹®Á¦ ÀÖÀ½
571                        else if(param1==TIMER_ID_CH_BANNER) { //Ȥ½Ã ch banner timer id¸¦ ¹Þ´Â´Ù¸é ch banner¸¦ Áö¿öÁØ´Ù
572                                App_OSD_EraseChBanner();               
573                        }
574#endif
575
576#if 0
577                        else if(param1==TIMER_ID_CH_CHANGE)
578                        {
579                                p_is_ch_change=FALSE;
580                        }
581                        else if(param1==TIMER_ID_FIRST)
582                        {
583                                p_first=FALSE;
584                        }
585#endif
586                        else if(param1==TIMER_ID_EA_TUNE)
587                        {
588                                //ea tuneÀ» Á¾·áÇÔ..
589                                AppF_EARestoreTune();
590                        }
591                       
592                        else
593                                bret=FALSE;
594                       
595                        break;
596               
597                case eDMG_CMD_ON_KEY :
598
599                        if (App_Pwr_GetPowerState() != eAPP_PS_NORMAL && param2 != APP_VK_POWER_OFF) {
600                                char *RCU_KEY_STR(UINT32 id);
601                                dprint(0, "!! standby mode! key press %x (%s) ignored!\n", param2, RCU_KEY_STR(param2));
602                                break;
603                        }
604                       
605                        if((DHL_OS_GetMsCount()>idle_start_ms) && DHL_OS_GetMsCount()-idle_start_ms<=2000) {
606                                //idle procÀÌ startµÉ ¶§´Â ¿ÀÁ÷ ºÎÆÃÇÒ ¶§¹Û¿¡ ¾ø´Ù.
607                                //µû¶ó¼­ menu enter°¡ µÈ ±âÁ¡À» ºÎÆÃ ½ÃÁ¡À¸·Î Àâ°í 4ÃÊ À̳»ÀÇ Å°´Â ¹«½ÃÇÑ´Ù.
608                                //±×·±µ¥ ¾Õ¼­ proc power¿¡¼­ 2Ãʸ¦ ½¬¾ú±â ¶§¹®¿¡ 2Ãʸ¸ ´õ ½¬¸é µÉ °Í °°´Ù.
609                                break;
610                        }
611                       
612                        if(param2==APP_VK_ENTER_FACTORY_TEST) factory_cnt++;
613                        else factory_cnt=0;
614                               
615                        if(param2==APP_VK_ENTER_RFUPDATE) rf_update_cnt++;
616                        else rf_update_cnt=0;
617                       
618                        if(param2==APP_VK_FACTORY_RESET) factory_reset_cnt++;
619                        else factory_reset_cnt=0;
620                       
621                        if(!App_Fnc_ExistMicom() && p_is_standby) {
622                                if(param2==APP_VK_POWER_OFF) {
623                                        //standby ¸ðµåÀÏ ¶§, power۸¸ µ¿ÀÛµÊ..
624                                        UINT8 send_data[MICOM_UART_MSG_LEN]={MICOM_UART_START_CODE,
625                                                eCMD_PRIV_POWER,}; //
626                                        App_Fnc_SendData(send_data, MICOM_UART_MSG_LEN);
627                                }
628                                break;
629                        }
630                       
631                        switch(param2) {
632                                case APP_VK_POWER_OFF :
633                                        DMG_SetMenuParam1(MID_STANDBY, 0);
634                                        DMG_MenuStart(MID_STANDBY);
635                                        break;
636                                       
637                                case APP_VK_0 :
638                                case APP_VK_1 :
639                                case APP_VK_2 :
640                                case APP_VK_3 :
641                                case APP_VK_4 :
642                                case APP_VK_5 :
643                                case APP_VK_6 :
644                                case APP_VK_7 :
645                                case APP_VK_8 :
646                                case APP_VK_9 :
647                                case APP_VK_DOT :
648                                        DMG_SetMenuParam1(MID_CH_BANNER, DMG_MAKEWORD(MPARAM_CH_BANNER_DIGIT,param2));
649                                        DMG_MenuUpdate(MID_CH_BANNER, 0);
650                                        break;
651                               
652                                case APP_VK_INFO :
653                                case APP_VK_SELECT:
654                                        DMG_MenuStart(MID_INFO_BANNER);
655                                        break;
656                               
657                                case APP_VK_MENU :
658                                        DMG_MenuStart(MID_MAIN);
659                                        break;
660
661                                case APP_VK_PREV_CH:
662                                        App_ChTunePrevChannel();
663                                        DMG_SetMenuParam1(MID_CH_BANNER, 0);
664                                        DMG_MenuUpdate(MID_CH_BANNER, 0);
665                                        break;                                 
666
667                                case APP_VK_FAV:
668                                       
669                                        if(App_GetChSortMode()==APP_CH_SORT_GROUP)
670                                                App_ChTuneSortSurfUp();
671                                        else
672                                                App_ChTuneSurfUp();
673                                       
674                                        DMG_SetMenuParam1(MID_CH_BANNER, 0);
675                                        DMG_MenuUpdate(MID_CH_BANNER, 0);
676                                        break;
677                                       
678                                case APP_VK_CH_UP :
679                                        {
680                                                static UINT32 prev_ms=0;
681                                               
682                                                if(DHL_OS_GetMsCount()-prev_ms<300) {
683                                                        break;
684                                                }
685                                                prev_ms=DHL_OS_GetMsCount();
686                                        }
687                                       
688                                        //p_is_ch_change=TRUE;
689                                        //DMG_SetTimer(TIMER_ID_CH_CHANGE, 3000, eDMG_CMD_OPT_TIMER_ONESHOT);
690                                        if(App_GetChSortMode()==APP_CH_SORT_GROUP)
691                                                App_ChTuneSortUp();
692                                        else
693                                        App_ChTuneMinorUp();
694                                       
695                                        DMG_SetMenuParam1(MID_CH_BANNER, 0);
696                                        DMG_MenuUpdate(MID_CH_BANNER, 0);
697                                        break;
698                                       
699                                case APP_VK_CH_DOWN :
700                                        {
701                                                static UINT32 prev_ms=0;
702                                               
703                                                if(DHL_OS_GetMsCount()-prev_ms<300) {
704                                                        break;
705                                                }
706                                                prev_ms=DHL_OS_GetMsCount();
707                                        }
708                                       
709                                        //p_is_ch_change=TRUE;
710                                        //DMG_SetTimer(TIMER_ID_CH_CHANGE, 3000, eDMG_CMD_OPT_TIMER_ONESHOT);
711                                        if(App_GetChSortMode()==APP_CH_SORT_GROUP)
712                                                App_ChTuneSortDown();
713                                        else
714                                        App_ChTuneMinorDown();
715                                       
716                                        DMG_SetMenuParam1(MID_CH_BANNER, 0);
717                                        DMG_MenuUpdate(MID_CH_BANNER, 0);
718                                        break;
719                                       
720                                case APP_VK_VOL_UP :
721                                        if(AppRating_IsBlockOn()) break;
722                                        if(p_get_menu_active()>=MID_VOL_BANNER || p_get_menu_active()==MID_CH_BANNER)
723                                                DMG_MenuStart(MID_VOL_BANNER);
724                                        else
725                                                App_AudioVolumeUp();
726                                        break;
727                                       
728                                case APP_VK_VOL_DOWN :
729                                        if(AppRating_IsBlockOn()) break;
730                                        if(p_get_menu_active()>=MID_VOL_BANNER || p_get_menu_active()==MID_CH_BANNER)
731                                                DMG_MenuStart(MID_VOL_BANNER);
732                                        else
733                                                App_AudioVolumeDown();
734                                        break;
735                                       
736                                case APP_VK_EPG :
737                                        DMG_MenuStart(MID_EPG);
738                                        break;
739
740                                case APP_VK_MUTE:
741                                        if(AppRating_IsBlockOn()) break;
742                                        if(p_get_menu_active()>=MID_POPUP_BANNER || p_get_menu_active()==MID_VOL_BANNER
743                                                || p_get_menu_active()==MID_CH_BANNER) {
744                                                DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, param2));
745                                                DMG_MenuStart(MID_POPUP_BANNER);
746                                        }
747                                        else {
748                                                App_AudioToggleUserMute();
749                                        }
750                                        break;
751                                       
752                                case APP_VK_ALANG:
753                                        if(AppRating_IsBlockOn()) break;
754                                        DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, param2));
755                                        DMG_MenuStart(MID_POPUP_BANNER);                                                                               
756                                        break;
757                                       
758                                case APP_VK_CC:
759                                        if(AppRating_IsBlockOn()) break;
760                                        DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, param2));
761                                        DMG_MenuStart(MID_POPUP_BANNER);                                                                               
762                                        break;
763
764                                case APP_VK_DMODE:
765                                        if(AppRating_IsBlockOn()) break;
766                                        DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, param2));
767                                        DMG_MenuStart(MID_POPUP_BANNER);                                                                               
768                                        break;
769                                       
770                                case APP_VK_RESOLUTION :
771                                        /* TODO : popupÀÌ ÇÊ¿äÇÒ±î? */
772                                        {
773                                               
774#if 0
775                                                APP_VIDEO_FORMAT format=App_VideoGetOutputResolution();
776                                               
777                                                format=format==APP_VIDEO_FORMAT_1080I?APP_VIDEO_FORMAT_720P:
778                                                             format==APP_VIDEO_FORMAT_720P?APP_VIDEO_FORMAT_480P:
779                                                             format==APP_VIDEO_FORMAT_480P?APP_VIDEO_FORMAT_480I:
780                                                             format==APP_VIDEO_FORMAT_480I?APP_VIDEO_FORMAT_1080I:APP_VIDEO_FORMAT_1080I;
781                               
782                                                App_VideoSetOutputResolution(format, TRUE);
783#else
784                                                APP_VIDEO_FORMAT format=App_VideoGetAndSetNextSupportedFormat();
785#endif
786                                                DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, param2));
787                                                DMG_MenuStart(MID_POPUP_BANNER);
788                                        }
789                               
790                                case APP_VK_CUSTOM0 :
791                                        {
792                                                APP_VIDEO_FORMAT format=App_VideoGetOutputResolution();
793
794                                                DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, APP_VK_RESOLUTION));
795                                                DMG_MenuStart(MID_POPUP_BANNER);
796                                        }
797                                        break;
798
799                                case APP_VK_SLEEP:
800                                        DMG_SetMenuParam1(MID_POPUP_BANNER, DMG_MAKEWORD(1, param2));
801                                        DMG_MenuStart(MID_POPUP_BANNER);                                                                               
802                                        break;
803
804                                case APP_VK_METER:
805                                        DMG_MenuStart(MID_SIGNAL_BANNER);                                                                                                                       
806                                        break;
807
808                                case APP_VK_AD:
809                                        DMG_SetMenuParam1(MID_STANDBY, 1); /* ad key´Â param1¿¡ 1À» ¼³Á¤ÇÔ */
810                                        DMG_MenuStart(MID_STANDBY);
811                                        break;
812                               
813                                case APP_VK_ENTER_FACTORY_TEST :
814                                        if(factory_cnt>=3) { /* factory mode key°¡ 3¹ø ÀÌ»ó ´­¸®¸é */
815                                                App_Menu_StartFactory(eAPP_FAC_CH_TEST);
816                                                factory_cnt=0;
817                                        }
818                                        break;
819                               
820                                case APP_VK_ENTER_RFUPDATE :
821                                        if(rf_update_cnt>=3) { /* factory mode key°¡ 3¹ø ÀÌ»ó ´­¸®¸é */
822                                                App_RFUpdateTuneKBS_RF18(); // megakiss 2012.10.30
823                                                // App_Menu_StartFactory(eAPP_FAC_RF_UPDATE);
824                                                rf_update_cnt=0;
825                                        }
826                                        break;
827                                       
828                                case APP_VK_FACTORY_RESET :
829                                        if(factory_reset_cnt>=3) { /* factory mode key°¡ 3¹ø ÀÌ»ó ´­¸®¸é */
830                                                App_Menu_StartFactory(eAPP_FAC_RESET);
831                                                factory_reset_cnt=0;
832                                        }
833                                        break;
834                               
835                                default :
836                                        bret=FALSE;
837                        }
838                       
839                        break;
840                       
841                default :
842                        bret=FALSE;
843                       
844        }
845       
846        DMG_AutoRefresh();
847       
848        return bret;
849}
850
851
852void App_Menu_CreateIdle()
853{
854        DMG_CreateMenu(MID_IDLE_CFG);
855}
856
857
858char *App_Menu_GetMicomVer()
859{
860        return p_micom_ver;
861}
862
863
864
865/* end of file */
Note: See TracBrowser for help on using the repository browser.