source: svn/trunk/zasc/app_c/DST_WinEngineerMenu.c @ 21

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

1.phkim

  1. revision copy newcon3sk r27
File size: 10.0 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#ifndef DSTAR
12#include "DHL_OSAL.h"
13#include "DHL_OSAL_Priv.h"
14#include "bcmmemmgr.h"
15#endif
16
17
18#if 0
19____CEngineerMenuWin___()
20#endif
21
22#define MAX_STR_COUNT 10
23
24char* DST_GetAppShortVersion();
25const char *DST_GetVendorInfo(void);
26const char *DST_GetModelName(void);
27
28//class CEngineerMenuWin : public CWindow
29//{
30//private:
31//     
32//public:
33//      CEngineerMenuWin(SWinEventMsg event):CWindow(event)
34        void CEngineerMenuWin_Constructor(CWindow *this, SWinEventMsg event)
35        {
36                this->SetWinName(this,  "EngineerMenu");
37                this->setFontStyle(this, 22, 0xFFFFFFFF, ALIGN_MIDDLE, ALIGN_LEFT);
38                this->rect.w = 576;
39                this->rect.h = 384;
40                this->rect.x = (DST_GetScreenWidth() - this->rect.w) / 2;
41                this->rect.y = (DST_GetScreenHeight() - this->rect.h) / 2;
42
43                this->SetTimeOut(this, 0);
44
45                this->SetTimer(this, 1, 1000);
46        }
47
48        void CEngineerMenuWin_Destructor(CWindow *this)
49        {
50                if(DST_g_SignalState == SM_AUDIO_ONLY) DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
51        }
52       
53//      virtual void OnTimer(char nID)
54        void CEngineerMenuWin_OnTimer(CWindow *this, char nID)
55        {
56                this->Show(this);
57        }
58
59//      virtual void Show(WinID id)
60        void CEngineerMenuWin_ShowWindow(CWindow *this, WinID id)
61        {
62                switch(id)
63                {
64                        case WIN_EWS:
65                        case WIN_DEBUG_SQL:
66                        case WIN_DEBUG_SQL_SUB:
67                        case WIN_DIRECT_TUNE:
68                        case WIN_VOLUME:
69                        case WIN_VOLUME_MUTE:
70                        case WIN_SIGNAL_METER:
71                        case WIN_CLOSED_CAPTION_HOT:
72                        case WIN_AUDIO_HOT:
73                        case WIN_DISPLAY_MODE_HOT:
74                        case WIN_FACTORY_RESET:
75                        case WIN_FACTORY_RESET_ASK:
76                        case WIN_INFOR_BANNER:
77                        case WIN_POWER_DOWN_CAUTION:
78                        case WIN_MAIN_MENU:
79                        case WIN_SUB_MENU_2DEPTH:
80                        case WIN_SUB_MENU_3DEPTH:
81                        case WIN_SUB_MENU_4DEPTH:
82                        case WIN_AUTO_SEARCH:
83                        case WIN_MANUAL_SEARCH:
84                        case WIN_CHANNEL_LIST:
85                        case WIN_PROGRAM_GUIDE:
86                        case WIN_PASSWD_CHANGE:
87                        case WIN_PASSWD_CHECK:
88                        case WIN_PASSWD_CONFIRM:
89                        case WIN_AGE_RATING:
90                                this->Close(this);
91                                break;
92                        default:
93                                break;
94                }
95        }
96
97//      virtual void Show()
98        void CEngineerMenuWin_Show(CWindow *this)
99        {
100                this->RegisterKey(this, VK_CANCEL, true, 0, 0);
101                this->RegisterKey(this, VK_PREV, true, 0, 0);
102                this->RegisterKey(this, VK_PREV_CH, true, 0, 0);
103                this->RegisterKey(this, VK_PREV_MENU, true, 0, 0);
104                this->RegisterKey(this, VK_1, true, 0, 0);
105                this->RegisterKey(this, VK_2, true, 0, 0);
106                this->RegisterKey(this, VK_3, true, 0, 0);
107                this->RegisterKey(this, VK_4, true, 0, 0);
108                this->RegisterKey(this, VK_5, true, 0, 0);
109                this->RegisterKey(this, VK_6, true, 0, 0);
110                this->RegisterKey(this, VK_7, true, 0, 0);
111                this->RegisterKey(this, VK_8, true, 0, 0);
112                this->RegisterKey(this, VK_9, true, 0, 0);
113                this->RegisterKey(this, VK_0, true, 0, 0);
114               
115                this->DrawBox32(this, 0, 0, this->rect.w, this->rect.h, CONV32_16(0xAA262626));
116                this->setFontStyle(this, 15, 0xFFC8C8C8, ALIGN_MIDDLE,ALIGN_LEFT);
117                //((CT_AV_START)
118                DS_U8 RF = 0;
119                DS_U16 SourceID = 0;
120//              DS_U8 tuneMode = 0;
121//              DS_U8 state = 0;
122
123                //(CT_AV_INFO)
124                DS_U32 PCR = 0;
125                DS_U32 vPid = 0;
126                DS_U32 aPid = 0;
127                DS_U32 vType = 0;
128                DS_U32 aType = 0;
129
130                //(CT_SIGNAL_INFO)
131                bool bLock = 0;
132                int ss = 0;
133                int power = 0;
134                int snr = 0;
135
136                //(CT_VIDEO_RESOLUTION)
137                DS_U16 vWidth = 0;
138                DS_U16 vHeight = 0;
139                DS_U16 fps = 0;
140                bool bInterlace = false;
141                bool bWide = false;
142
143                //(CT_SIGNAL)
144                bool vAlive = false;
145                bool aAlive = false;
146
147                //MEMORY
148//              DS_U32 total_size = 0;
149//              DS_U32 free_size = 0;
150//              DS_U32 largest_free_size = 0;
151
152                int i = 0;
153#ifndef DSTAR
154
155                //DHL_OS_HEAP_STATUS status;
156                //DHL_OS_GetHeapStatus(&status);
157                //total_size = status.total_size;
158                //free_size = status.free_size;
159                //largest_free_size = status.largest_free_size;
160#endif
161                extern DS_U8 origin_power_level;
162                DST_GetAVState(&RF, 0, &SourceID);
163                DST_GetAVInfo(&PCR, &vPid, &aPid, &vType, &aType);
164                DST_GetSignalInfo(&bLock, &ss, &power, &snr);
165                DST_GetVideoSize(&vWidth, &vHeight, &fps, &bInterlace, &bWide);
166                DST_GetAVAliveInfo(&vAlive, &aAlive);
167
168                char strText[MAX_STR_COUNT][256];
169                for( i=0;i<MAX_STR_COUNT;i++)
170                {
171                        memset(strText[i], 0, 256);
172                }
173
174                this->DrawText(this, 2, 2, this->rect.w, 20, (char*)"**** STATUS ****", &(this->font)); 
175
176                sprintf(strText[0], "S/W Version: %s %s, Compile Time : %s %s ",DST_GetModelName(), DST_GetAppShortVersion(),  __DATE__, __TIME__);
177                this->DrawText(this, 2, 22, this->rect.w, 20, strText[0], &(this->font));
178
179#ifdef DSTAR
180#else
181                sprintf(strText[1], "FrontEnd: %s, SNR: %ddB, PowerLevel: %ddBmV", bLock?(char*)"lock":(char*)"unlock", snr/256, ((origin_power_level)/2)-60);
182#endif
183                this->DrawText(this, 2, 42, this->rect.w, 20, strText[1], &(this->font));
184
185                char chNum[20];
186                DS_U32 chName[TEXT_LENGTH_MAX];
187                int num = 0;
188                if (DST_DB_GetCurrentChannelInfo(chNum, chName, &num) == false) sprintf(chNum, "%d ", num); // RF ¹øÈ£         
189
190                DS_U32 tmpStr[256] = {0,};
191                sprintf(strText[2], "Tuning: %s, [", chNum);
192                str232(tmpStr,strText[2]);
193                strcpy32(&tmpStr[strlen32(tmpStr)],chName);
194                sprintf(strText[2], "], pva [0x%2X/0x%2X/0x%2X]", (unsigned int)PCR, (unsigned int)vPid, (unsigned int)aPid);
195                str232(&tmpStr[strlen32(tmpStr)],strText[2]);
196                this->DrawText32(this, 2, 62, this->rect.w, 20, tmpStr, &(this->font));
197
198                sprintf(strText[3], "               video alive [%s], audio alive [%s]", vAlive?(char *)"true":(char *)"false", aAlive?(char *)"true":(char *)"false");
199                this->DrawText(this, 2, 82, this->rect.w, 20, strText[3], &(this->font));
200               
201
202                DS_U16 avStr[256] = {0,};
203               
204                char strFPS[10] = "N/A";
205                switch (fps)
206                {
207                        case 1: strcpy(strFPS, "23.976"); break;
208                        case 2: strcpy(strFPS, "24"); break;
209                        case 3: strcpy(strFPS, "25"); break;
210                        case 4: strcpy(strFPS, "29.97"); break;
211                        case 5: strcpy(strFPS, "30"); break;
212                        case 6: strcpy(strFPS, "50"); break;
213                        case 7: strcpy(strFPS, "59.94"); break;
214                        case 8: strcpy(strFPS, "60"); break;
215                }
216               
217                if(vWidth==0)
218                        sprintf(strText[4], "AV: source( %dx%d %s %sHz %s ), output 480i, audio: ", (int)vWidth, (int)vHeight, (char *)"(null)", strFPS, (char *)"(null)");
219                else
220                        sprintf(strText[4], "AV: source( %dx%d %s %sHz %s ), output 480i, audio: ", (int)vWidth, (int)vHeight, bInterlace?(char*)"i":(char*)"p", strFPS, bWide?(char*)"wide":(char*)"normal");
221                str2uni(avStr,strText[4]);
222                strcpy16(&avStr[strlen16(avStr)], DST_UI_GetMTS()==0?pz_MTS_Main[OSD_Lang]:pz_MTS_Sub[OSD_Lang]);
223                this->DrawTextUni(this, 2, 102, this->rect.w, 20, avStr, &(this->font));
224
225                char vTypeStr[20] = {0,};
226                char aTypeStr[20] = {0,};
227                switch (vType) // ABNT NBR 15602-3:2007 Table 5 ? Strem_type
228                {
229                        case 0x01: sprintf(vTypeStr,(char *)"MPEG1"); break;
230                        case 0x02: sprintf(vTypeStr,(char *)"MPEG2"); break;
231                        case 0x1B: sprintf(vTypeStr,(char *)"AVC(H.264)"); break;
232                };
233                switch (aType) // ABNT NBR 15602-3:2007 Table 5 ? Strem_type
234                {
235                        case 0x03: sprintf(aTypeStr,(char *)"MPEG1"); break;
236                        case 0x04: sprintf(aTypeStr,(char *)"MPEG2"); break;
237                        case 0x0F: sprintf(aTypeStr,(char *)"AAC(ADTS)"); break;
238                        case 0x11: sprintf(aTypeStr,(char *)"AAC(LATM)"); break;
239                };
240
241                sprintf(strText[5], "AV format: video %s[0x%2X], audio %s[0x%2X]", vTypeStr, (unsigned int)vType, aTypeStr, (unsigned int)aType);
242                this->DrawText(this, 2, 122, this->rect.w, 20, strText[5], &(this->font));     
243#ifndef DSTAR
244                extern bcm_heap_t *g_p_sdram_heap;
245                sprintf(strText[6], "Largest unused block : %d bytes",mem_available(g_p_sdram_heap));
246                this->DrawText(this, 2, 142, this->rect.w, 20, strText[6], &(this->font));     
247#endif
248                DS_U32 hour = 0, min = 0, sec = 0;
249                DST_OS_GetRunTime(&hour, &min, &sec);
250                sprintf(strText[7], "Running time: %02d:%02d:%02d, Channel Count; %d",(int)hour, (int)min, (int)sec, CT_ChMapCount());
251                this->DrawText(this, 2, 162, this->rect.w, 20, strText[7], &(this->font));     
252
253               
254                this->DrawText(this, 2, 222, this->rect.w, 20, (char*)"**** commands ****", &(this->font));     
255                this->DrawText(this, 2, 242, this->rect.w, 20, (char*)"1. show SQL database", &(this->font));   
256                sprintf(strText[8], "2. switch on/off WeakSignal Mute :  [%s]", DST_g_WeakSignalMuteOff?(char*)"OFF":(char*)"ON");
257                this->DrawText(this, 2, 262, this->rect.w, 20, strText[8], &(this->font));     
258                this->DrawText(this, 2, 282, this->rect.w, 20, (char*)"3. set Frequency Range", &(this->font)); 
259
260                this->DrawText(this, 2, 362, this->rect.w, 20, (char*)"[0..9] Select ", &(this->font)); 
261
262
263        }
264
265
266//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
267        void CEngineerMenuWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
268        {
269                switch(key)
270                {
271                        case VK_1:
272                                DST_Printf("Enter DB SQL Menu\n");
273                                DST_CreateWin(WIN_DEBUG_SQL, 0, 0, 0, 0, 0); // ¿£Áö´Ï¾î ¸ðµå ÁøÀÔ
274                                this->Close(this);
275                                break;
276                        case VK_2:
277                                DST_g_WeakSignalMuteOff = !DST_g_WeakSignalMuteOff;
278                                this->Show(this);
279                                break;
280                        case VK_3:
281                                DST_CreateWin(WIN_FREQUENCY_SETTING, WIN_NULL, 0,0,0,0);
282                                this->Close(this);
283                                break;
284                        case VK_4:
285                        case VK_5:
286                        case VK_6:
287                        case VK_7:
288                        case VK_8:
289                        case VK_9:
290                        case VK_0:
291                                break;
292                        case VK_CANCEL:
293                        case VK_PREV:
294                        case VK_PREV_MENU:
295                        case VK_PREV_CH:
296                        default:
297                                this->Close(this);
298                                if(DST_g_SignalState == SM_AUDIO_ONLY) DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
299                                break;
300                }
301        }
302
303//};
304
305void DST_CreateEngineerMenuWin(SWinEventMsg event)
306{
307        DST_RemoveAllWindowExceptBasicWin();
308        CWindow*pWin = NewCWindow(event);
309        pWin->Destructor        = CEngineerMenuWin_Destructor;
310        pWin->KeyInput          = CEngineerMenuWin_KeyInput;
311        pWin->OnTimer           = CEngineerMenuWin_OnTimer;
312        pWin->ShowWindow        = CEngineerMenuWin_ShowWindow;
313        pWin->Show                      = CEngineerMenuWin_Show;
314        // »ý¼ºÀÚ È£Ãâ
315        CEngineerMenuWin_Constructor(pWin, event);
316        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
317        DST_AddWin((WinID)(event.data[0]), pWin);
318}
319
320
Note: See TracBrowser for help on using the repository browser.