| 1 | #include "DST_Window.h" |
|---|
| 2 | #include "DST_WinManager.h" |
|---|
| 3 | #include "DST_CommonAPI.h" |
|---|
| 4 | #include "DST_UserInterface.h" |
|---|
| 5 | #include "DST_DataStrings.h" |
|---|
| 6 | #include "DST_ISDBT_ChannelTask.h" |
|---|
| 7 | #include "DST_DB.h" |
|---|
| 8 | #include "DST_ChannelTune.h" |
|---|
| 9 | #include "DST_SignalMonitor.h" |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | #if 0 |
|---|
| 14 | ____CFactoryWin___() |
|---|
| 15 | #endif |
|---|
| 16 | void DST_Tune(DS_U8 RF, DS_U16 program_number); |
|---|
| 17 | |
|---|
| 18 | char *DST_GetBoardVersion(void); |
|---|
| 19 | char* DST_GetAppShortVersion(); |
|---|
| 20 | void JST_RFUpdate(DS_U8 RF); |
|---|
| 21 | |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | //class CFactoryWin : public CWindow |
|---|
| 25 | //{ |
|---|
| 26 | //private: |
|---|
| 27 | static DS_U16 CFactoryWin_Pos; |
|---|
| 28 | static DS_U16 CFactoryWin_Top; |
|---|
| 29 | static DS_U16 CFactoryWin_Select; |
|---|
| 30 | static DS_U16 CFactoryWin_ListNum; |
|---|
| 31 | static DS_U16 CFactoryWin_ItemNum; |
|---|
| 32 | static int CFactoryWin_signal; |
|---|
| 33 | static bool CFactoryWin_nPWR_pressed; |
|---|
| 34 | static bool CFactoryWin_nCHUP_pressed; |
|---|
| 35 | static bool CFactoryWin_nCHDN_Pressed; |
|---|
| 36 | static int CFactoryWin_nRF[2]; |
|---|
| 37 | static int CFactoryWin_chUp; |
|---|
| 38 | |
|---|
| 39 | //public: |
|---|
| 40 | void CFactoryWin_InitValues(); |
|---|
| 41 | |
|---|
| 42 | // CFactoryWin(SWinEventMsg event):CWindow(event) |
|---|
| 43 | void CFactoryWin_Constructor(CWindow *this, SWinEventMsg event) |
|---|
| 44 | { |
|---|
| 45 | this->SetWinName(this, "Factory"); |
|---|
| 46 | DST_g_bFactoryMode = true; |
|---|
| 47 | CFactoryWin_InitValues(); |
|---|
| 48 | |
|---|
| 49 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 50 | this->rect.w = 576; |
|---|
| 51 | this->rect.h = 384; |
|---|
| 52 | this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2; |
|---|
| 53 | this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2; |
|---|
| 54 | |
|---|
| 55 | this->SetTimeOut(this, 0); |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | // ÃÖ´ë º¼·ýÀ¸·Î |
|---|
| 59 | DST_UI_SetMute(false); |
|---|
| 60 | DST_UI_SetVolume(50); |
|---|
| 61 | this->SetTimeOut(this, 0); |
|---|
| 62 | // °øÀåÃʱâÈ |
|---|
| 63 | DST_EEPROM_SetMinRF(-1); // DST_EEPROM_SetNeedReset¿¡¼ ÃʱâÈ ÇÏÁö ¾Ê±â¶§¹®¿¡ °Á¦·Î ±âº»°ªÀ» ½áÁØ´Ù. |
|---|
| 64 | DST_EEPROM_SetMaxRF(-1); // DST_EEPROM_SetNeedReset¿¡¼ ÃʱâÈ ÇÏÁö ¾Ê±â¶§¹®¿¡ °Á¦·Î ±âº»°ªÀ» ½áÁØ´Ù. |
|---|
| 65 | DST_EEPROM_SetNeedReset(1); |
|---|
| 66 | DST_DB_SyncNow(); |
|---|
| 67 | // ä³Î Æ©´× |
|---|
| 68 | |
|---|
| 69 | DST_Tune(CFactoryWin_nRF[CFactoryWin_chUp], 0); // ä³Î4¹ø |
|---|
| 70 | this->SetTimer(this, 1, 500); |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | void CFactoryWin_Destructor(CWindow *this) |
|---|
| 74 | { |
|---|
| 75 | |
|---|
| 76 | } |
|---|
| 77 | |
|---|
| 78 | void CFactoryWin_InitValues() |
|---|
| 79 | { |
|---|
| 80 | CFactoryWin_nPWR_pressed = false; |
|---|
| 81 | CFactoryWin_nCHUP_pressed = false; |
|---|
| 82 | CFactoryWin_nCHDN_Pressed = false; |
|---|
| 83 | CFactoryWin_signal = DST_GetSignalStrength(); |
|---|
| 84 | CFactoryWin_Pos = 0; |
|---|
| 85 | CFactoryWin_Top = 0; |
|---|
| 86 | CFactoryWin_Select = 0; |
|---|
| 87 | CFactoryWin_ListNum = 3; |
|---|
| 88 | CFactoryWin_ItemNum = 3; |
|---|
| 89 | if (CFactoryWin_ItemNum < CFactoryWin_ListNum) CFactoryWin_ListNum = CFactoryWin_ItemNum; |
|---|
| 90 | |
|---|
| 91 | CFactoryWin_nRF[0] = DST_GetIndexByRFNumber(4); |
|---|
| 92 | CFactoryWin_nRF[1] = DST_GetIndexByRFNumber(48); |
|---|
| 93 | CFactoryWin_chUp = 0; |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | // virtual void OnTimer(char nID) |
|---|
| 97 | void CFactoryWin_OnTimer(CWindow *this, char nID) |
|---|
| 98 | { |
|---|
| 99 | |
|---|
| 100 | // DST_Tune(Select+14, 1, 1); |
|---|
| 101 | switch (nID) |
|---|
| 102 | { |
|---|
| 103 | case 1: |
|---|
| 104 | this->Show(this); |
|---|
| 105 | break; |
|---|
| 106 | case 2: |
|---|
| 107 | this->KillTimer(this,2); |
|---|
| 108 | CFactoryWin_nCHUP_pressed = false; |
|---|
| 109 | CFactoryWin_nCHDN_Pressed = false; |
|---|
| 110 | CFactoryWin_nPWR_pressed = false; |
|---|
| 111 | this->Show(this); |
|---|
| 112 | break; |
|---|
| 113 | case 3: |
|---|
| 114 | this->KillTimer(this,3); |
|---|
| 115 | CFactoryWin_nCHUP_pressed = false; |
|---|
| 116 | CFactoryWin_nCHDN_Pressed = false; |
|---|
| 117 | CFactoryWin_nPWR_pressed = false; |
|---|
| 118 | this->Show(this); |
|---|
| 119 | break; |
|---|
| 120 | case 4: |
|---|
| 121 | this->KillTimer(this,4); |
|---|
| 122 | CFactoryWin_nCHUP_pressed = false; |
|---|
| 123 | CFactoryWin_nCHDN_Pressed = false; |
|---|
| 124 | CFactoryWin_nPWR_pressed = false; |
|---|
| 125 | this->Show(this); |
|---|
| 126 | break; |
|---|
| 127 | default: |
|---|
| 128 | break; |
|---|
| 129 | } |
|---|
| 130 | } |
|---|
| 131 | |
|---|
| 132 | // virtual void Show() |
|---|
| 133 | void CFactoryWin_Show(CWindow *this) |
|---|
| 134 | { |
|---|
| 135 | DS_U8 RF = 0; |
|---|
| 136 | int i = 0; |
|---|
| 137 | char strText[10][256]; |
|---|
| 138 | |
|---|
| 139 | DST_GetAVState(&RF , 0, 0); |
|---|
| 140 | |
|---|
| 141 | this->RegisterAllKey(this); // ¸ðµç Ű µî·Ï |
|---|
| 142 | this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0x00000000)); |
|---|
| 143 | |
|---|
| 144 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 145 | for( i=0;i<10;i++) |
|---|
| 146 | { |
|---|
| 147 | memset(strText[i], 0, 256); |
|---|
| 148 | } |
|---|
| 149 | this->setFontStyle(this, 22, 0xFFFFFF00, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 150 | sprintf(strText[0], " S/W version : %s", DST_GetAppShortVersion() ); |
|---|
| 151 | this->DrawText(this, 2, 2, this->rect.w, 30, strText[0], &(this->font)); |
|---|
| 152 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 153 | |
|---|
| 154 | sprintf(strText[1], " H/W version : %s", DST_GetBoardVersion()); |
|---|
| 155 | this->DrawText(this, 2, 32, this->rect.w, 30, strText[1], &(this->font)); |
|---|
| 156 | |
|---|
| 157 | sprintf(strText[2], " FrontEnd : Broadcom" ); |
|---|
| 158 | this->DrawText(this, 2, 62, this->rect.w, 30, strText[2], &(this->font)); |
|---|
| 159 | |
|---|
| 160 | CFactoryWin_signal = DST_GetSignalStrength(); |
|---|
| 161 | sprintf(strText[3], " Signal Strength : %d ", CFactoryWin_signal); |
|---|
| 162 | this->FontSetColor(this, CONV32_16((CFactoryWin_signal > 28 && DST_g_Lock == 1) ? 0xFF00FF00 : 0xFFFF0000)); |
|---|
| 163 | this->DrawText(this, 2, 92, this->rect.w, 30, strText[3], &(this->font)); |
|---|
| 164 | |
|---|
| 165 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 166 | |
|---|
| 167 | sprintf(strText[4], " RF : %d", DST_GetFrequencyNumberbyIndex(RF)); |
|---|
| 168 | this->DrawText(this, 2, 122, this->rect.w, 30, strText[4], &(this->font)); |
|---|
| 169 | |
|---|
| 170 | sprintf(strText[5], " Front Key Test : "); |
|---|
| 171 | this->DrawText(this, 2, 152, this->rect.w, 30, strText[5], &(this->font)); |
|---|
| 172 | |
|---|
| 173 | this->setFontStyle(this, 22, 0xFF000000, ALIGN_MIDDLE, ALIGN_CENTER); |
|---|
| 174 | |
|---|
| 175 | sprintf(strText[6], "UP"); |
|---|
| 176 | this->DrawBox32(this, 69, 192, 100, 40, CONV32_16(CFactoryWin_nCHUP_pressed ? 0xFFFF0000 : 0xFFFFFFFF)); |
|---|
| 177 | this->DrawText(this, 69, 192, 100, 40, strText[6], &(this->font)); |
|---|
| 178 | |
|---|
| 179 | |
|---|
| 180 | sprintf(strText[7], "DOWN"); |
|---|
| 181 | this->DrawBox32(this, 238, 192, 100, 40, CONV32_16(CFactoryWin_nCHDN_Pressed ? 0xFFFF0000 : 0xFFFFFFFF)); |
|---|
| 182 | this->DrawText(this, 238, 192, 100, 40, strText[7], &(this->font)); |
|---|
| 183 | |
|---|
| 184 | sprintf(strText[8], "POWER"); |
|---|
| 185 | this->DrawBox32(this, 407, 192, 100, 40, CONV32_16(CFactoryWin_nPWR_pressed ? 0xFFFF0000 : 0xFFFFFFFF)); |
|---|
| 186 | this->DrawText(this, 407, 192, 100, 40, strText[8], &(this->font)); |
|---|
| 187 | |
|---|
| 188 | |
|---|
| 189 | |
|---|
| 190 | this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT); |
|---|
| 191 | sprintf(strText[9], " 1.CH_UP 7.RF UPDATE " ); |
|---|
| 192 | this->DrawText(this, 2, 344, this->rect.w, 30, strText[9], &(this->font)); |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | // virtual void KeyInput(DS_U8 key, bool /*bRepeat*/) |
|---|
| 197 | void CFactoryWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat) |
|---|
| 198 | { |
|---|
| 199 | switch(key) |
|---|
| 200 | { |
|---|
| 201 | case VK_FAC_CANCEL: |
|---|
| 202 | case VK_1: |
|---|
| 203 | case VK_FAC_1: |
|---|
| 204 | DST_g_bUseAirFreq = true; |
|---|
| 205 | |
|---|
| 206 | CFactoryWin_chUp = (CFactoryWin_chUp+1)%2; |
|---|
| 207 | DST_UI_ChannelTune(CFactoryWin_nRF[CFactoryWin_chUp], 0); |
|---|
| 208 | this->SetTimer(this, 2, 300); |
|---|
| 209 | break; |
|---|
| 210 | case VK_FAC_7: |
|---|
| 211 | case VK_7: |
|---|
| 212 | DST_g_bUseAirFreq = true; |
|---|
| 213 | JST_RFUpdate(DST_GetIndexByRFNumber(18)); // RF 18¹øÀÌ RF ¾÷µ¥ÀÌÆ® Á֯ļöÀÓ |
|---|
| 214 | DST_Printf("Enter RF Update Mode\n"); |
|---|
| 215 | DST_CreateWin(WIN_RF_UPDATE, 0, 0, 0, 0, 0); // RF ¾÷µ¥ÀÌÆ® ¸ðµå ÁøÀÔ |
|---|
| 216 | break; |
|---|
| 217 | case VK_KEY_UP: |
|---|
| 218 | CFactoryWin_nCHUP_pressed = true; |
|---|
| 219 | CFactoryWin_nCHDN_Pressed = false; |
|---|
| 220 | CFactoryWin_nPWR_pressed = false; |
|---|
| 221 | this->Show(this); |
|---|
| 222 | this->SetTimer(this, 2, 100); |
|---|
| 223 | break; |
|---|
| 224 | case VK_KEY_DN: |
|---|
| 225 | CFactoryWin_nCHUP_pressed = false; |
|---|
| 226 | CFactoryWin_nCHDN_Pressed = true; |
|---|
| 227 | CFactoryWin_nPWR_pressed = false; |
|---|
| 228 | this->Show(this); |
|---|
| 229 | this->SetTimer(this, 3, 100); |
|---|
| 230 | break; |
|---|
| 231 | case VK_KEY_PWR: |
|---|
| 232 | CFactoryWin_nCHUP_pressed = false; |
|---|
| 233 | CFactoryWin_nCHDN_Pressed = false; |
|---|
| 234 | CFactoryWin_nPWR_pressed = true; |
|---|
| 235 | this->Show(this); |
|---|
| 236 | this->SetTimer(this, 4, 100); |
|---|
| 237 | break; |
|---|
| 238 | } |
|---|
| 239 | // Close(); °øÀå¸ðµå¿¡¼´Â OSD ¾È ´ÝÈ÷°Ô ÇÔ |
|---|
| 240 | } |
|---|
| 241 | //}; |
|---|
| 242 | |
|---|
| 243 | void DST_CreateFactoryWin(SWinEventMsg event) |
|---|
| 244 | { |
|---|
| 245 | DST_RemoveAllWindowExceptBasicWin(); |
|---|
| 246 | CWindow*pWin = NewCWindow(event); |
|---|
| 247 | pWin->Destructor = CFactoryWin_Destructor; |
|---|
| 248 | pWin->KeyInput = CFactoryWin_KeyInput; |
|---|
| 249 | pWin->OnTimer = CFactoryWin_OnTimer; |
|---|
| 250 | pWin->Show = CFactoryWin_Show; |
|---|
| 251 | // »ý¼ºÀÚ È£Ãâ |
|---|
| 252 | CFactoryWin_Constructor(pWin, event); |
|---|
| 253 | // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï |
|---|
| 254 | DST_AddWin((WinID)(event.data[0]), pWin); |
|---|
| 255 | |
|---|
| 256 | } |
|---|
| 257 | |
|---|