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

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

first commit

File size: 9.7 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                sprintf(strText[1], "FrontEnd: %s, SNR: %ddB, PowerLevel: %ddBmV", bLock?(char*)"lock":(char*)"unlock", snr/256, ((origin_power_level)/2)-60);
180                this->DrawText(this, 2, 42, this->rect.w, 20, strText[1], &(this->font));
181
182                char chNum[20];
183                DS_U32 chName[TEXT_LENGTH_MAX];
184                int num = 0;
185                if (DST_DB_GetCurrentChannelInfo(chNum, chName, &num) == false) sprintf(chNum, "%d ", num); // RF ¹øÈ£         
186
187                DS_U32 tmpStr[256] = {0,};
188                sprintf(strText[2], "Tuning: %s, [", chNum);
189                str232(tmpStr,strText[2]);
190                strcpy32(&tmpStr[strlen32(tmpStr)],chName);
191                sprintf(strText[2], "], pva [0x%2X/0x%2X/0x%2X]", (unsigned int)PCR, (unsigned int)vPid, (unsigned int)aPid);
192                str232(&tmpStr[strlen32(tmpStr)],strText[2]);
193                this->DrawText32(this, 2, 62, this->rect.w, 20, tmpStr, &(this->font));
194
195                sprintf(strText[3], "               video alive [%s], audio alive [%s]", vAlive?(char *)"true":(char *)"false", aAlive?(char *)"true":(char *)"false");
196                this->DrawText(this, 2, 82, this->rect.w, 20, strText[3], &(this->font));
197               
198
199                DS_U16 avStr[256] = {0,};
200               
201                char strFPS[10] = "N/A";
202                switch (fps)
203                {
204                        case 1: strcpy(strFPS, "23.976"); break;
205                        case 2: strcpy(strFPS, "24"); break;
206                        case 3: strcpy(strFPS, "25"); break;
207                        case 4: strcpy(strFPS, "29.97"); break;
208                        case 5: strcpy(strFPS, "30"); break;
209                        case 6: strcpy(strFPS, "50"); break;
210                        case 7: strcpy(strFPS, "59.94"); break;
211                        case 8: strcpy(strFPS, "60"); break;
212                }
213               
214                if(vWidth==0)
215                        sprintf(strText[4], "AV: source( %dx%d %s %sHz %s ), output 480i, audio: ", (int)vWidth, (int)vHeight, (char *)"(null)", strFPS, (char *)"(null)");
216                else
217                        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");
218                str2uni(avStr,strText[4]);
219                strcpy16(&avStr[strlen16(avStr)], DST_UI_GetMTS()==0?pz_MTS_Main[OSD_Lang]:pz_MTS_Sub[OSD_Lang]);
220                this->DrawTextUni(this, 2, 102, this->rect.w, 20, avStr, &(this->font));
221
222                char vTypeStr[20] = {0,};
223                char aTypeStr[20] = {0,};
224                switch (vType) // ABNT NBR 15602-3:2007 Table 5 ? Strem_type
225                {
226                        case 0x01: sprintf(vTypeStr,(char *)"MPEG1"); break;
227                        case 0x02: sprintf(vTypeStr,(char *)"MPEG2"); break;
228                        case 0x1B: sprintf(vTypeStr,(char *)"AVC(H.264)"); break;
229                };
230                switch (aType) // ABNT NBR 15602-3:2007 Table 5 ? Strem_type
231                {
232                        case 0x03: sprintf(aTypeStr,(char *)"MPEG1"); break;
233                        case 0x04: sprintf(aTypeStr,(char *)"MPEG2"); break;
234                        case 0x0F: sprintf(aTypeStr,(char *)"AAC(ADTS)"); break;
235                        case 0x11: sprintf(aTypeStr,(char *)"AAC(LATM)"); break;
236                };
237
238                sprintf(strText[5], "AV format: video %s[0x%2X], audio %s[0x%2X]", vTypeStr, (unsigned int)vType, aTypeStr, (unsigned int)aType);
239                this->DrawText(this, 2, 122, this->rect.w, 20, strText[5], &(this->font));     
240#ifndef DSTAR
241                extern bcm_heap_t *g_p_sdram_heap;
242                sprintf(strText[6], "Largest unused block : %d bytes",mem_available(g_p_sdram_heap));
243                this->DrawText(this, 2, 142, this->rect.w, 20, strText[6], &(this->font));     
244#endif
245                DS_U32 hour = 0, min = 0, sec = 0;
246                DST_OS_GetRunTime(&hour, &min, &sec);
247                sprintf(strText[7], "Running time: %02d:%02d:%02d, Channel Count; %d",(int)hour, (int)min, (int)sec, CT_ChMapCount());
248                this->DrawText(this, 2, 162, this->rect.w, 20, strText[7], &(this->font));     
249
250               
251                this->DrawText(this, 2, 222, this->rect.w, 20, (char*)"**** commands ****", &(this->font));     
252                this->DrawText(this, 2, 242, this->rect.w, 20, (char*)"1. show SQL database", &(this->font));   
253                sprintf(strText[8], "2. swich on/off WeakSignal Mute :  [%s]", DST_g_WeakSignalMuteOff?(char*)"OFF":(char*)"ON");
254                this->DrawText(this, 2, 262, this->rect.w, 20, strText[8], &(this->font));     
255               
256                this->DrawText(this, 2, 362, this->rect.w, 20, (char*)"[0..9] Select ", &(this->font)); 
257
258
259        }
260
261
262//      virtual void KeyInput(DS_U8 key, bool /*bRepeat*/)
263        void CEngineerMenuWin_KeyInput(CWindow *this, DS_U8 key, bool bRepeat)
264        {
265                switch(key)
266                {
267                        case VK_1:
268                                DST_Printf("Enter DB SQL Menu\n");
269                                DST_CreateWin(WIN_DEBUG_SQL, 0, 0, 0, 0, 0); // ¿£Áö´Ï¾î ¸ðµå ÁøÀÔ
270                                this->Close(this);
271                                break;
272                        case VK_2:
273                                DST_g_WeakSignalMuteOff = !DST_g_WeakSignalMuteOff;
274                                this->Show(this);
275                        case VK_3:
276                        case VK_4:
277                        case VK_5:
278                        case VK_6:
279                        case VK_7:
280                        case VK_8:
281                        case VK_9:
282                        case VK_0:
283                                break;
284                        case VK_CANCEL:
285                        case VK_PREV:
286                        case VK_PREV_MENU:
287                        case VK_PREV_CH:
288                        default:
289                                this->Close(this);
290                                if(DST_g_SignalState == SM_AUDIO_ONLY) DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL ,0, 0, 0);
291                                break;
292                }
293        }
294
295//};
296
297void DST_CreateEngineerMenuWin(SWinEventMsg event)
298{
299        DST_RemoveAllWindowExceptBasicWin();
300        CWindow*pWin = NewCWindow(event);
301        pWin->Destructor        = CEngineerMenuWin_Destructor;
302        pWin->KeyInput          = CEngineerMenuWin_KeyInput;
303        pWin->OnTimer           = CEngineerMenuWin_OnTimer;
304        pWin->ShowWindow        = CEngineerMenuWin_ShowWindow;
305        pWin->Show                      = CEngineerMenuWin_Show;
306        // »ý¼ºÀÚ È£Ãâ
307        CEngineerMenuWin_Constructor(pWin, event);
308        // À©µµ¿ì ¸Þ´ÏÀú¿¡ µî·Ï
309        DST_AddWin((WinID)(event.data[0]), pWin);
310}
311
312
Note: See TracBrowser for help on using the repository browser.