source: svn/trunk/zasc/app_c/DST_WinFactory.c @ 32

Last change on this file since 32 was 32, checked in by megakiss, 11 years ago
File size: 7.6 KB
Line 
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
16void DST_Tune(DS_U8 RF, DS_U16 program_number);
17
18char *DST_GetBoardVersion(void);
19char* DST_GetAppShortVersion();
20void 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:
40void 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_SetFrequencySetting(0); // DST_EEPROM_SetNeedReset¿¡¼­ ÃʱâÈ­ ÇÏÁö ¾Ê±â¶§¹®¿¡ °­Á¦·Î ±âº»°ªÀ» ½áÁØ´Ù.
64                DST_EEPROM_SetMinRF(0); // DST_EEPROM_SetNeedReset¿¡¼­ ÃʱâÈ­ ÇÏÁö ¾Ê±â¶§¹®¿¡ °­Á¦·Î ±âº»°ªÀ» ½áÁØ´Ù.
65                DST_EEPROM_SetMaxRF(0); // DST_EEPROM_SetNeedReset¿¡¼­ ÃʱâÈ­ ÇÏÁö ¾Ê±â¶§¹®¿¡ °­Á¦·Î ±âº»°ªÀ» ½áÁØ´Ù.
66                DST_EEPROM_SetNeedReset(1);
67                DST_DB_Sync();
68                // ä³Î Æ©´×
69               
70                DST_Tune(CFactoryWin_nRF[CFactoryWin_chUp], 0); // ä³Î4¹ø
71                this->SetTimer(this, 1, 500);
72        }
73
74        void CFactoryWin_Destructor(CWindow *this)
75        {
76       
77        }
78       
79        void CFactoryWin_InitValues()
80        {               
81                CFactoryWin_nPWR_pressed = false;
82                CFactoryWin_nCHUP_pressed = false;
83                CFactoryWin_nCHDN_Pressed = false;
84                CFactoryWin_signal      = DST_GetSignalStrength();
85                CFactoryWin_Pos = 0;
86                CFactoryWin_Top = 0;
87                CFactoryWin_Select = 0;
88                CFactoryWin_ListNum = 3;
89                CFactoryWin_ItemNum = 3;
90                if (CFactoryWin_ItemNum < CFactoryWin_ListNum) CFactoryWin_ListNum = CFactoryWin_ItemNum;
91
92                CFactoryWin_nRF[0] = DST_GetIndexByRFNumber(4);
93                CFactoryWin_nRF[1] = DST_GetIndexByRFNumber(48);
94                CFactoryWin_chUp = 0;
95        }
96
97//      virtual void OnTimer(char nID)
98        void CFactoryWin_OnTimer(CWindow *this, char nID)
99        {
100               
101//              DST_Tune(Select+14, 1, 1);
102                switch (nID)
103                {
104                        case 1:
105                                this->Show(this);
106                                break;
107                        case 2:
108                                this->KillTimer(this,2);
109                                CFactoryWin_nCHUP_pressed = false;
110                                CFactoryWin_nCHDN_Pressed = false;
111                                CFactoryWin_nPWR_pressed = false;                               
112                                this->Show(this);
113                                break;
114                        case 3:
115                                this->KillTimer(this,3);
116                                CFactoryWin_nCHUP_pressed = false;
117                                CFactoryWin_nCHDN_Pressed = false;
118                                CFactoryWin_nPWR_pressed = false;       
119                                this->Show(this);
120                                break;
121                        case 4:
122                                this->KillTimer(this,4);                               
123                                CFactoryWin_nCHUP_pressed = false;
124                                CFactoryWin_nCHDN_Pressed = false;
125                                CFactoryWin_nPWR_pressed = false;       
126                                this->Show(this);
127                                break;
128                        default:
129                                break;
130        }
131        }
132
133//      virtual void Show()
134        void CFactoryWin_Show(CWindow *this)
135        {
136                DS_U8 RF = 0;
137                int i = 0;
138                char strText[10][256];
139               
140                DST_GetAVState(&RF , 0, 0);
141               
142                this->RegisterAllKey(this); // ¸ðµç Ű µî·Ï
143                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0x00000000));
144               
145                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT);
146                for( i=0;i<10;i++)
147                {
148                        memset(strText[i], 0, 256);
149                }
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
153                sprintf(strText[1], " H/W version : %s", DST_GetBoardVersion());
154                this->DrawText(this, 2, 32, this->rect.w, 30, strText[1], &(this->font));
155
156                sprintf(strText[2], " FrontEnd : Broadcom" );
157                this->DrawText(this, 2, 62, this->rect.w, 30, strText[2], &(this->font));
158
159                CFactoryWin_signal      = DST_GetSignalStrength();
160                sprintf(strText[3], " Signal Strength : %d ", CFactoryWin_signal);
161                this->FontSetColor(this, CONV32_16((CFactoryWin_signal > 28 && DST_g_Lock == 1) ? 0xFF00FF00 : 0xFFFF0000));
162                this->DrawText(this, 2, 92, this->rect.w, 30, strText[3], &(this->font));
163               
164                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT);
165
166                sprintf(strText[4], " RF : %d", DST_GetFrequencyNumberbyIndex(RF));
167                this->DrawText(this, 2, 122, this->rect.w, 30, strText[4], &(this->font));
168               
169                sprintf(strText[5], " Front Key Test :  ");
170                this->DrawText(this, 2, 152, this->rect.w, 30, strText[5], &(this->font));
171               
172                this->setFontStyle(this, 22, 0xFF000000, ALIGN_MIDDLE, ALIGN_CENTER);
173               
174                sprintf(strText[6], "UP");
175                this->DrawBox32(this, 69, 192, 100, 40, CONV32_16(CFactoryWin_nCHUP_pressed ? 0xFFFF0000 : 0xFFFFFFFF));
176                this->DrawText(this, 69, 192, 100, 40, strText[6], &(this->font));
177               
178
179                sprintf(strText[7], "DOWN");
180                this->DrawBox32(this, 238, 192, 100, 40, CONV32_16(CFactoryWin_nCHDN_Pressed ? 0xFFFF0000 : 0xFFFFFFFF));
181                this->DrawText(this, 238, 192, 100, 40, strText[7], &(this->font));
182
183                sprintf(strText[8], "POWER");
184                this->DrawBox32(this, 407, 192, 100, 40, CONV32_16(CFactoryWin_nPWR_pressed ? 0xFFFF0000 : 0xFFFFFFFF));
185                this->DrawText(this, 407, 192, 100, 40, strText[8], &(this->font));
186               
187
188               
189                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT);
190                sprintf(strText[9], " 1.CH_UP  7.RF UPDATE  " );
191                this->DrawText(this, 2, 344, this->rect.w, 30, strText[9], &(this->font));
192        }
193
194       
195//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
196        void CFactoryWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
197        {
198                switch(key)
199                {
200                        case VK_FAC_CANCEL:
201                        case VK_1:
202                        case VK_FAC_1:
203                                DST_g_bUseAirFreq = true;
204
205                                CFactoryWin_chUp = (CFactoryWin_chUp+1)%2;
206                                DST_UI_ChannelTune(CFactoryWin_nRF[CFactoryWin_chUp], 0);
207                                this->SetTimer(this, 2, 300);
208                                break;
209                        case VK_FAC_7:
210                        case VK_7:
211                                DST_g_bUseAirFreq = true;
212                                JST_RFUpdate(DST_GetIndexByRFNumber(18)); // RF 18¹øÀÌ RF ¾÷µ¥ÀÌÆ® Á֯ļöÀÓ
213                                DST_Printf("Enter RF Update Mode\n");
214                                DST_CreateWin(WIN_RF_UPDATE, 0, 0, 0, 0, 0); // RF ¾÷µ¥ÀÌÆ® ¸ðµå ÁøÀÔ
215                                break;
216                        case VK_KEY_UP:
217                                CFactoryWin_nCHUP_pressed = true;
218                                CFactoryWin_nCHDN_Pressed = false;
219                                CFactoryWin_nPWR_pressed = false;
220                                this->Show(this);
221                                this->SetTimer(this, 2, 100);
222                                break;
223                        case VK_KEY_DN:
224                                CFactoryWin_nCHUP_pressed = false;
225                                CFactoryWin_nCHDN_Pressed = true;
226                                CFactoryWin_nPWR_pressed = false;
227                                this->Show(this);
228                                this->SetTimer(this, 3, 100);
229                                break;
230                        case VK_KEY_PWR:
231                                CFactoryWin_nCHUP_pressed = false;
232                                CFactoryWin_nCHDN_Pressed = false;
233                                CFactoryWin_nPWR_pressed = true;
234                                this->Show(this);
235                                this->SetTimer(this, 4, 100);
236                                break;
237                }
238//              Close(); °øÀå¸ðµå¿¡¼­´Â OSD ¾È ´ÝÈ÷°Ô ÇÔ
239        }
240//};
241
242void DST_CreateFactoryWin(SWinEventMsg event)
243{
244        DST_RemoveAllWindowExceptBasicWin();
245        CWindow*pWin = NewCWindow(event);
246        pWin->Destructor        = CFactoryWin_Destructor;
247        pWin->KeyInput          = CFactoryWin_KeyInput;
248        pWin->OnTimer           = CFactoryWin_OnTimer;
249        pWin->Show                      = CFactoryWin_Show;
250        // »ý¼ºÀÚ È£Ãâ
251        CFactoryWin_Constructor(pWin, event);
252        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
253        DST_AddWin((WinID)(event.data[0]), pWin);
254
255}
256
Note: See TracBrowser for help on using the repository browser.