source: svn/trunk/zasc/app_c/DST_WinOTC.c @ 45

Last change on this file since 45 was 22, checked in by megakiss, 11 years ago

DHL_SYS_Off 함수로 바로 끄도록 함

File size: 9.9 KB
RevLine 
[2]1#include "DST_Window.h"
2#include "DST_WinManager.h"
3#include "DST_DataStrings.h"
4#include "DST_CommonAPI.h"
5#include "DST_EEPROM.h"
6#include "DST_ChannelTune.h"
7#include "DST_UserInterface.h"
8#include "DST_Updates.h"
9#include "DST_ISDBT_ChannelTask.h"
10//#include "DST_OTC_Main.h"
11#include "DST_OSDImage.h"
12
13#if 0
14____CMessageWin___()
15#endif
16
17
18char* DST_GetAppShortVersion();
19
20
21//class COTCDownLoadingWin : public CWindow
22//{
23//private:
24        static bool COTCDownLoadingWin_bDone;
25        static bool COTCDownLoadingWin_bNeedLine;
26        static int COTCDownLoadingWin_progress;
27        static int COTCDownLoadingWin_center_pos;
28        static int COTCDownLoadingWin_line_spacing;     
29
30        static int COTCDownLoadingWin_nErr;
31        static int COTCDownLoadingWin_ErrCategory;
32        static int COTCDownLoadingWin_category;
33//public:
34//      COTCDownLoadingWin(SWinEventMsg event):CWindow(event)
35        void COTCDownLoadingWin_Constructor(CWindow *this, SWinEventMsg event)
36        {
37                this->SetWinName(this,  "OTCDownload");
38                DST_g_RFUpdateState = 0;
39                this->rect.w = 382; 
40                this->rect.h = 241; 
41                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
42                this->rect.y = (DST_GetScreenHeight()- this->rect.h) / 2;
43
44                DST_Printf("\n\n--------------------------WIN_OTC_DOWNLOADING----------------------------------\n\n");
45               
46
47                COTCDownLoadingWin_center_pos =  this->rect.h / 2; 
48                COTCDownLoadingWin_line_spacing = DST_GetFontHeight(fontItemSize) * 125 / 100;
49
50                COTCDownLoadingWin_nErr = 0;
51                COTCDownLoadingWin_ErrCategory = 0;
52                COTCDownLoadingWin_category = 0;
53                COTCDownLoadingWin_bNeedLine = false;
54                COTCDownLoadingWin_bDone = false;
55                COTCDownLoadingWin_progress = 0;
56               
57                this->SetTimeOut(this, 0);
58                this->SetTimer(this, 1, 5*60*1000);
59
60//              DHL_POWER_SetMode(nSleepState ? 2 : 0);
61        }
62
63        void COTCDownLoadingWin_Destructor(CWindow *this)
64        {
65        }
66       
67//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
68        void COTCDownLoadingWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
69        {
70                switch (key)
71                {
72                        case VK_KEY_PWR:
73                        case VK_PWR:
74                                if (DST_g_PowerOn) // ÄÑÁø»óÅÂ
75                                {
76                                        DST_g_PowerOn = false;
77                                }
78                                else // ²¨Áø»óÅÂ
79                                {
80                                        DST_g_PowerOn = true;
81                                } 
82                                JST_POWER_Display(DST_g_PowerOn);
83                                break;
84                }
85        }
86
87        void COTCDownLoadingWin_DrawProgressBar(CWindow *this, DS_U32 nPos, DS_U32 nTotal, int x, int y, DS_U32 width)
88        {
89                int line = DST_GetFontHeight(15);
90                int y_str = y+10;
91                char tmpProgStr[50] = {0,};
92
93                this->DrawBox32(this, x, y, width, 10, CONV32_16(0xffe5e5ff));
94                if(nPos == nTotal)
95                        this->DrawBox32(this, x, y, width, 10, CONV32_16(0xff65a5cc));
96                else
97                        this->DrawBox32(this, x, y, (nPos*width)/nTotal, 10, CONV32_16(0xff65a5cc));
98
99                this->setFontStyle(this, 15,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER);
100               
101                sprintf(tmpProgStr,"(%d%%)",(nPos == nTotal)?(100):(int)((nPos*100)/nTotal));
102                this->DrawBox32(this, x, y_str, width, line, CONV32_16(0xff24435e));
103                this->DrawTextUTF8(this, x, y_str, width, line, (DS_U8*)tmpProgStr, &(this->font)); 
104
105
106        }
107       
108//      virtual void OnMessage(SWinEventMsg event)
109        void COTCDownLoadingWin_OnMessage(CWindow *this, SWinEventMsg event)
110        {
111                static int old_count = -1;
112                switch (event.cmd)
113                {
114                        case WM_RF_UPDATE:
115                                switch(event.data32[0])
116                                {
117                                        case DATA_RECEIVING: // DATA RECEIVING
118                                                this->KillTimer(this, 1);
119                                                COTCDownLoadingWin_DrawProgressBar(this, event.data32[1],  100, this->rect.w/10, COTCDownLoadingWin_center_pos+2*COTCDownLoadingWin_line_spacing-10,this->rect.w*8/10);
120                                                if(old_count != (int)event.data32[1])
121                                                {
122                                                        old_count = event.data32[1];
123                                                        this->KillTimer(this, 2);
124                                                        this->SetTimer(this, 2, 15*60*1000);
125                                                }
126                                                break;
127                                        default: break;
128                                }
129                                break;         
130                }
131        }
132
133//      virtual void OnTimer(char nID)
134        void COTCDownLoadingWin_OnTimer(CWindow *this, char nID)
135        {
136                switch(nID)
137                {
138                        case 1:
139                                DST_CreateWin(WIN_OTC_DOWNLOAD_FAIL,WIN_NULL,(DST_g_Lock == true)?(OTC_WAIT_TIMEOUT_FAIL):(TUNING_FAIL),0 ,0, 0);
140                                this->Close(this);
141                                break;
142                        case 2:
143                                DST_CreateWin(WIN_OTC_DOWNLOAD_FAIL,WIN_NULL,OTC_COMPLETE_TIMEOUT_FAIL, 0, 0, 0);
144                                this->Close(this);
145                                break;
146#if 0  //test code             
147                        case 3:
148                                {
149                                        static int count = 0;
150                                        this->KillTimer(this, 3);
151                                       
152                                        COTCDownLoadingWin_DrawProgressBar(this, count,  100,rect.w/10,center_pos+2*line_spacing-10,rect.w*8/10);
153                                        count++;
154                                        if(count == 100) count = 0;
155                                       
156                                        this->SetTimer(this, 3,300);
157                                }
158                                break;
159#endif                         
160                        case 4:
161                                {
162                                        static int loading = 0;
163                                       
164                                        loading = loading%6;
165                                        switch(loading)
166                                        {
167                                                case 0: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait1,true); break;
168                                                case 1: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait2,true); break;
169                                                case 2: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait3,true); break;
170                                                case 3: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait4,true); break;
171                                                case 4: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait5,true); break;
172                                                case 5: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait6,true); break;
173                                        }
174                                        loading ++;
175                                       
176                                }
177                                break;
178                        default:  break;
179                }
180        }
181
182        void COTCDownLoadingWin_Draw(CWindow *this)
183        {
184                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xff24435e));
185               
186                this->setFontStyle(this, fontItemSize,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER);
187               
188                this->DrawTextUni(this, 0, COTCDownLoadingWin_center_pos-60+25, this->rect.w, COTCDownLoadingWin_line_spacing, pz_OTC_Download1[OSD_Lang], &(this->font)); 
189                this->DrawTextUni(this, 0, COTCDownLoadingWin_center_pos+COTCDownLoadingWin_line_spacing-50+25, this->rect.w, COTCDownLoadingWin_line_spacing, pz_OTC_Download2[OSD_Lang], &(this->font)); 
190//              this->SetTimer(this, 3,500);
191                this->SetTimer(this, 4,300);
192
193        }
194
195//      virtual void Show(void)
196        void COTCDownLoadingWin_Show(CWindow *this)
197        {
198                COTCDownLoadingWin_Draw(this);
199               
200                this->RegisterAllKey(this);
201        }
202
203
204//};
205
206
207
208//class COTCDownloadFailResetWin : public CWindow
209//{
210//private:
211        static int COTCDownloadFailResetWin_nErr;
212//public:
213//      COTCDownloadFailResetWin(SWinEventMsg event):CWindow(event)
214        void COTCDownloadFailResetWin_Constructor(CWindow *this, SWinEventMsg event)
215        {
216                this->SetWinName(this,  "OTCDownFail");
217                this->rect.w = 382; 
218                this->rect.h = 241; 
219                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
220                this->rect.y = (DST_GetScreenHeight()- this->rect.h) / 2;
221                this->RegisterAllKey(this);
222                this->SetTimeOut(this, 0);
223                DST_g_bOTCMode = false;
224               
225                DST_g_LED_PowerState = 1;
226                COTCDownloadFailResetWin_nErr = event.data[2];;
227
228        }
229
230        void COTCDownloadFailResetWin_Destructor(CWindow *this)
231        {
[21]232                if (DST_g_PowerOn)
233                {
[22]234                        T();
[21]235                        DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼­ ÀçºÎÆÃ
236                }
237                else
238                {
[22]239                        T();
240                        DHL_SYS_Off();
[21]241                }
[2]242        }
243       
244//      virtual void OnTimer(char nID)
245        void COTCDownloadFailResetWin_OnTimer(CWindow *this, char nID)
246        {
247                switch(nID)
248                {
249                        case 1:
250                                this->KillTimer(this, 1);
251                                this->SetTimer(this, 2, 1000);
252                                this->Show(this);
253                                break;
254                        case 2:
255                                this->KillTimer(this, 2);
256                                this->Close(this);
257                                break;
258                        default:
259                                break;
260                }
261        }
262       
263       
264//      virtual void Show(void)
265        void COTCDownloadFailResetWin_Show(CWindow *this)
266        {
267                int     center_pos =  this->rect.h / 2; 
268                int line_spacing = DST_GetFontHeight(fontItemSize) * 150 / 100;
269
270                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xff24435e));
271                this->setFontStyle(this, 22,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER);
272
273                switch(COTCDownloadFailResetWin_nErr)
274                {
275                        case TUNING_FAIL:
276                                DST_Printf("OTCDownloadFail : ERROR %d TUNING_FAIL\n",COTCDownloadFailResetWin_nErr);
277                                this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_Update_Err_101[OSD_Lang], &(this->font)); 
278                                break;
279                        case OTC_WAIT_TIMEOUT_FAIL:
280                                DST_Printf("OTCDownloadFail : ERROR %d OTC_WAIT_TIMEOUT_FAIL\n",COTCDownloadFailResetWin_nErr);
281                                this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_Update_Err_201[OSD_Lang], &(this->font)); 
282                                break;
283                        case OTC_COMPLETE_TIMEOUT_FAIL:
284                                DST_Printf("OTCDownloadFail : ERROR %d OTC_COMPLETE_TIMEOUT_FAIL\n",COTCDownloadFailResetWin_nErr);
285                                this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_Update_Err_202[OSD_Lang], &(this->font)); 
286                                break;
287                }
288
289                this->DrawTextUni(this, 0, center_pos-line_spacing, this->rect.w, line_spacing, pz_OTC_Download_Fail1[OSD_Lang], &(this->font)); 
290                this->DrawTextUni(this, 0, center_pos, this->rect.w, line_spacing, pz_OTC_Download_Fail2[OSD_Lang], &(this->font)); 
291                this->DrawTextUni(this, 0, center_pos+line_spacing, this->rect.w, line_spacing, pz_OTC_Download_Fail3[OSD_Lang], &(this->font)); 
292
293                this->UpdateScreen(this);
294               
295                this->RegisterAllKey(this);
296                this->SetTimer(this, 2, 5000);
297        }
298//};
299
300void DST_CreateOTCDownloadFailResetWin(SWinEventMsg event)
301{
302        DST_RemoveAllWindowExceptBasicWin();
303        CWindow*pWin = NewCWindow(event);
304        pWin->Destructor        = COTCDownloadFailResetWin_Destructor;
305        pWin->OnTimer           = COTCDownloadFailResetWin_OnTimer;
306        pWin->Show                      = COTCDownloadFailResetWin_Show;
307        // »ý¼ºÀÚ È£Ãâ
308        COTCDownloadFailResetWin_Constructor(pWin, event);
309        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
310        DST_AddWin((WinID)(event.data[0]), pWin);       
311}
312
313
314void DST_CreateOTCDownLoadingWin(SWinEventMsg event)
315{
316        if (DST_GetWin(WIN_UPDATE)) return;
317        DST_RemoveAllWindowExceptBasicWin();
318        CWindow*pWin = NewCWindow(event);
319        pWin->Destructor        = COTCDownLoadingWin_Destructor;
320        pWin->KeyInput          = COTCDownLoadingWin_KeyInput;
321        pWin->OnTimer           = COTCDownLoadingWin_OnTimer;
322        pWin->OnMessage         = COTCDownLoadingWin_OnMessage;
323        pWin->Show                      = COTCDownLoadingWin_Show;
324        // »ý¼ºÀÚ È£Ãâ
325        COTCDownLoadingWin_Constructor(pWin, event);
326        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
327        DST_AddWin((WinID)(event.data[0]), pWin);       
328}
329
330
331
Note: See TracBrowser for help on using the repository browser.