| 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 | |
|---|
| 18 | char* 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 | DHL_INFO_SetLastPowerState(DST_g_PowerOn); |
|---|
| 84 | break; |
|---|
| 85 | } |
|---|
| 86 | } |
|---|
| 87 | |
|---|
| 88 | void COTCDownLoadingWin_DrawProgressBar(CWindow *this, DS_U32 nPos, DS_U32 nTotal, int x, int y, DS_U32 width) |
|---|
| 89 | { |
|---|
| 90 | int line = DST_GetFontHeight(15); |
|---|
| 91 | int y_str = y+10; |
|---|
| 92 | char tmpProgStr[50] = {0,}; |
|---|
| 93 | |
|---|
| 94 | this->DrawBox32(this, x, y, width, 10, CONV32_16(0xffe5e5ff)); |
|---|
| 95 | if(nPos == nTotal) |
|---|
| 96 | this->DrawBox32(this, x, y, width, 10, CONV32_16(0xff65a5cc)); |
|---|
| 97 | else |
|---|
| 98 | this->DrawBox32(this, x, y, (nPos*width)/nTotal, 10, CONV32_16(0xff65a5cc)); |
|---|
| 99 | |
|---|
| 100 | this->setFontStyle(this, 15,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 101 | |
|---|
| 102 | sprintf(tmpProgStr,"(%d%%)",(nPos == nTotal)?(100):(int)((nPos*100)/nTotal)); |
|---|
| 103 | this->DrawBox32(this, x, y_str, width, line, CONV32_16(0xff24435e)); |
|---|
| 104 | this->DrawTextUTF8(this, x, y_str, width, line, (DS_U8*)tmpProgStr, &(this->font)); |
|---|
| 105 | |
|---|
| 106 | |
|---|
| 107 | } |
|---|
| 108 | |
|---|
| 109 | // virtual void OnMessage(SWinEventMsg event) |
|---|
| 110 | void COTCDownLoadingWin_OnMessage(CWindow *this, SWinEventMsg event) |
|---|
| 111 | { |
|---|
| 112 | static int old_count = -1; |
|---|
| 113 | switch (event.cmd) |
|---|
| 114 | { |
|---|
| 115 | case WM_RF_UPDATE: |
|---|
| 116 | switch(event.data32[0]) |
|---|
| 117 | { |
|---|
| 118 | case DATA_RECEIVING: // DATA RECEIVING |
|---|
| 119 | this->KillTimer(this, 1); |
|---|
| 120 | COTCDownLoadingWin_DrawProgressBar(this, event.data32[1], 100, this->rect.w/10, COTCDownLoadingWin_center_pos+2*COTCDownLoadingWin_line_spacing-10,this->rect.w*8/10); |
|---|
| 121 | if(old_count != (int)event.data32[1]) |
|---|
| 122 | { |
|---|
| 123 | old_count = event.data32[1]; |
|---|
| 124 | this->KillTimer(this, 2); |
|---|
| 125 | this->SetTimer(this, 2, 15*60*1000); |
|---|
| 126 | } |
|---|
| 127 | break; |
|---|
| 128 | default: break; |
|---|
| 129 | } |
|---|
| 130 | break; |
|---|
| 131 | } |
|---|
| 132 | } |
|---|
| 133 | |
|---|
| 134 | // virtual void OnTimer(char nID) |
|---|
| 135 | void COTCDownLoadingWin_OnTimer(CWindow *this, char nID) |
|---|
| 136 | { |
|---|
| 137 | switch(nID) |
|---|
| 138 | { |
|---|
| 139 | case 1: |
|---|
| 140 | DST_CreateWin(WIN_OTC_DOWNLOAD_FAIL,WIN_NULL,(DST_g_Lock == true)?(OTC_WAIT_TIMEOUT_FAIL):(TUNING_FAIL),0 ,0, 0); |
|---|
| 141 | this->Close(this); |
|---|
| 142 | break; |
|---|
| 143 | case 2: |
|---|
| 144 | DST_CreateWin(WIN_OTC_DOWNLOAD_FAIL,WIN_NULL,OTC_COMPLETE_TIMEOUT_FAIL, 0, 0, 0); |
|---|
| 145 | this->Close(this); |
|---|
| 146 | break; |
|---|
| 147 | #if 0 //test code |
|---|
| 148 | case 3: |
|---|
| 149 | { |
|---|
| 150 | static int count = 0; |
|---|
| 151 | this->KillTimer(this, 3); |
|---|
| 152 | |
|---|
| 153 | COTCDownLoadingWin_DrawProgressBar(this, count, 100,rect.w/10,center_pos+2*line_spacing-10,rect.w*8/10); |
|---|
| 154 | count++; |
|---|
| 155 | if(count == 100) count = 0; |
|---|
| 156 | |
|---|
| 157 | this->SetTimer(this, 3,300); |
|---|
| 158 | } |
|---|
| 159 | break; |
|---|
| 160 | #endif |
|---|
| 161 | case 4: |
|---|
| 162 | { |
|---|
| 163 | static int loading = 0; |
|---|
| 164 | |
|---|
| 165 | loading = loading%6; |
|---|
| 166 | switch(loading) |
|---|
| 167 | { |
|---|
| 168 | case 0: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait1,true); break; |
|---|
| 169 | case 1: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait2,true); break; |
|---|
| 170 | case 2: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait3,true); break; |
|---|
| 171 | case 3: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait4,true); break; |
|---|
| 172 | case 4: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait5,true); break; |
|---|
| 173 | case 5: this->DrawImage(this, (this->rect.w-34)/2, 30, newcon2_gui_downaload_Wait6,true); break; |
|---|
| 174 | } |
|---|
| 175 | loading ++; |
|---|
| 176 | |
|---|
| 177 | } |
|---|
| 178 | break; |
|---|
| 179 | default: break; |
|---|
| 180 | } |
|---|
| 181 | } |
|---|
| 182 | |
|---|
| 183 | void COTCDownLoadingWin_Draw(CWindow *this) |
|---|
| 184 | { |
|---|
| 185 | this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xff24435e)); |
|---|
| 186 | |
|---|
| 187 | this->setFontStyle(this, fontItemSize,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 188 | |
|---|
| 189 | this->DrawTextUni(this, 0, COTCDownLoadingWin_center_pos-60+25, this->rect.w, COTCDownLoadingWin_line_spacing, pz_OTC_Download1[OSD_Lang], &(this->font)); |
|---|
| 190 | 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)); |
|---|
| 191 | // this->SetTimer(this, 3,500); |
|---|
| 192 | this->SetTimer(this, 4,300); |
|---|
| 193 | |
|---|
| 194 | } |
|---|
| 195 | |
|---|
| 196 | // virtual void Show(void) |
|---|
| 197 | void COTCDownLoadingWin_Show(CWindow *this) |
|---|
| 198 | { |
|---|
| 199 | COTCDownLoadingWin_Draw(this); |
|---|
| 200 | |
|---|
| 201 | this->RegisterAllKey(this); |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | |
|---|
| 205 | //}; |
|---|
| 206 | |
|---|
| 207 | |
|---|
| 208 | |
|---|
| 209 | //class COTCDownloadFailResetWin : public CWindow |
|---|
| 210 | //{ |
|---|
| 211 | //private: |
|---|
| 212 | static int COTCDownloadFailResetWin_nErr; |
|---|
| 213 | //public: |
|---|
| 214 | // COTCDownloadFailResetWin(SWinEventMsg event):CWindow(event) |
|---|
| 215 | void COTCDownloadFailResetWin_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 216 | { |
|---|
| 217 | this->SetWinName(this, "OTCDownFail"); |
|---|
| 218 | this->rect.w = 382; |
|---|
| 219 | this->rect.h = 241; |
|---|
| 220 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 221 | this->rect.y = (DST_GetScreenHeight()- this->rect.h) / 2; |
|---|
| 222 | this->RegisterAllKey(this); |
|---|
| 223 | this->SetTimeOut(this, 0); |
|---|
| 224 | DST_g_bOTCMode = false; |
|---|
| 225 | |
|---|
| 226 | DST_g_LED_PowerState = 1; |
|---|
| 227 | COTCDownloadFailResetWin_nErr = event.data[2];; |
|---|
| 228 | |
|---|
| 229 | } |
|---|
| 230 | |
|---|
| 231 | void COTCDownloadFailResetWin_Destructor(CWindow *this) |
|---|
| 232 | { |
|---|
| 233 | DHL_INFO_SetLastPowerState(DST_g_PowerOn); |
|---|
| 234 | DST_Reset(__func__); // âÀÌ ´ÝÈ÷¸é¼ ÀçºÎÆÃ |
|---|
| 235 | } |
|---|
| 236 | |
|---|
| 237 | // virtual void OnTimer(char nID) |
|---|
| 238 | void COTCDownloadFailResetWin_OnTimer(CWindow *this, char nID) |
|---|
| 239 | { |
|---|
| 240 | switch(nID) |
|---|
| 241 | { |
|---|
| 242 | case 1: |
|---|
| 243 | this->KillTimer(this, 1); |
|---|
| 244 | this->SetTimer(this, 2, 1000); |
|---|
| 245 | this->Show(this); |
|---|
| 246 | break; |
|---|
| 247 | case 2: |
|---|
| 248 | this->KillTimer(this, 2); |
|---|
| 249 | this->Close(this); |
|---|
| 250 | break; |
|---|
| 251 | default: |
|---|
| 252 | break; |
|---|
| 253 | } |
|---|
| 254 | } |
|---|
| 255 | |
|---|
| 256 | |
|---|
| 257 | // virtual void Show(void) |
|---|
| 258 | void COTCDownloadFailResetWin_Show(CWindow *this) |
|---|
| 259 | { |
|---|
| 260 | int center_pos = this->rect.h / 2; |
|---|
| 261 | int line_spacing = DST_GetFontHeight(fontItemSize) * 150 / 100; |
|---|
| 262 | |
|---|
| 263 | this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xff24435e)); |
|---|
| 264 | this->setFontStyle(this, 22,0xFFE1E1E1,ALIGN_MIDDLE,ALIGN_CENTER); |
|---|
| 265 | |
|---|
| 266 | switch(COTCDownloadFailResetWin_nErr) |
|---|
| 267 | { |
|---|
| 268 | case TUNING_FAIL: |
|---|
| 269 | DST_Printf("OTCDownloadFail : ERROR %d TUNING_FAIL\n",COTCDownloadFailResetWin_nErr); |
|---|
| 270 | this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_Update_Err_101[OSD_Lang], &(this->font)); |
|---|
| 271 | break; |
|---|
| 272 | case OTC_WAIT_TIMEOUT_FAIL: |
|---|
| 273 | DST_Printf("OTCDownloadFail : ERROR %d OTC_WAIT_TIMEOUT_FAIL\n",COTCDownloadFailResetWin_nErr); |
|---|
| 274 | this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_Update_Err_201[OSD_Lang], &(this->font)); |
|---|
| 275 | break; |
|---|
| 276 | case OTC_COMPLETE_TIMEOUT_FAIL: |
|---|
| 277 | DST_Printf("OTCDownloadFail : ERROR %d OTC_COMPLETE_TIMEOUT_FAIL\n",COTCDownloadFailResetWin_nErr); |
|---|
| 278 | this->DrawTextUni(this, 0, center_pos-2*line_spacing, this->rect.w, line_spacing, pz_Update_Err_202[OSD_Lang], &(this->font)); |
|---|
| 279 | break; |
|---|
| 280 | } |
|---|
| 281 | |
|---|
| 282 | this->DrawTextUni(this, 0, center_pos-line_spacing, this->rect.w, line_spacing, pz_OTC_Download_Fail1[OSD_Lang], &(this->font)); |
|---|
| 283 | this->DrawTextUni(this, 0, center_pos, this->rect.w, line_spacing, pz_OTC_Download_Fail2[OSD_Lang], &(this->font)); |
|---|
| 284 | this->DrawTextUni(this, 0, center_pos+line_spacing, this->rect.w, line_spacing, pz_OTC_Download_Fail3[OSD_Lang], &(this->font)); |
|---|
| 285 | |
|---|
| 286 | this->UpdateScreen(this); |
|---|
| 287 | |
|---|
| 288 | this->RegisterAllKey(this); |
|---|
| 289 | this->SetTimer(this, 2, 5000); |
|---|
| 290 | } |
|---|
| 291 | //}; |
|---|
| 292 | |
|---|
| 293 | void DST_CreateOTCDownloadFailResetWin(SWinEventMsg event) |
|---|
| 294 | { |
|---|
| 295 | DST_RemoveAllWindowExceptBasicWin(); |
|---|
| 296 | CWindow*pWin = NewCWindow(event); |
|---|
| 297 | pWin->Destructor = COTCDownloadFailResetWin_Destructor; |
|---|
| 298 | pWin->OnTimer = COTCDownloadFailResetWin_OnTimer; |
|---|
| 299 | pWin->Show = COTCDownloadFailResetWin_Show; |
|---|
| 300 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 301 | COTCDownloadFailResetWin_Constructor(pWin, event); |
|---|
| 302 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 303 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 304 | } |
|---|
| 305 | |
|---|
| 306 | |
|---|
| 307 | void DST_CreateOTCDownLoadingWin(SWinEventMsg event) |
|---|
| 308 | { |
|---|
| 309 | if (DST_GetWin(WIN_UPDATE)) return; |
|---|
| 310 | DST_RemoveAllWindowExceptBasicWin(); |
|---|
| 311 | CWindow*pWin = NewCWindow(event); |
|---|
| 312 | pWin->Destructor = COTCDownLoadingWin_Destructor; |
|---|
| 313 | pWin->KeyInput = COTCDownLoadingWin_KeyInput; |
|---|
| 314 | pWin->OnTimer = COTCDownLoadingWin_OnTimer; |
|---|
| 315 | pWin->OnMessage = COTCDownLoadingWin_OnMessage; |
|---|
| 316 | pWin->Show = COTCDownLoadingWin_Show; |
|---|
| 317 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 318 | COTCDownLoadingWin_Constructor(pWin, event); |
|---|
| 319 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 320 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | |
|---|
| 324 | |
|---|