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

Last change on this file since 2 was 2, checked in by jglee, 11 years ago

first commit

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