| 1 | /**************************************************************************** |
|---|
| 2 | * NAME: App_Proc_Epg2.c |
|---|
| 3 | *---------------------------------------------------------------------------- |
|---|
| 4 | * Copyright (c) DIGITAL STREAM Technology Inc. |
|---|
| 5 | *---------------------------------------------------------------------------- |
|---|
| 6 | * CREATED_BY: Yong Dae Park |
|---|
| 7 | * CREATION_DATE: 2011/07/08 |
|---|
| 8 | * $Author: x2silo $ |
|---|
| 9 | * $Revision: 1.0 $ |
|---|
| 10 | * $Date: 2011/07/08 12:00:00 $ |
|---|
| 11 | *---------------------------------------------------------------------------- |
|---|
| 12 | * PURPOSE: |
|---|
| 13 | * - EPG proc implement |
|---|
| 14 | *****************************************************************************/ |
|---|
| 15 | |
|---|
| 16 | #include "App_Main.h" |
|---|
| 17 | #include "App_Proc.h" |
|---|
| 18 | |
|---|
| 19 | #include "DLIB_PSI_Utils.h" |
|---|
| 20 | |
|---|
| 21 | #include "App_Fnc_Common.h" |
|---|
| 22 | #include "App_Fnc_Ucm.h" |
|---|
| 23 | |
|---|
| 24 | #include "App_Fnc_Time.h" |
|---|
| 25 | #include "App_Fnc_EPG.h" |
|---|
| 26 | #include "App_Fnc_ChTune.h" |
|---|
| 27 | |
|---|
| 28 | #include "App_OSD_Common.h" |
|---|
| 29 | #include "App_OSD_Epg2.h" |
|---|
| 30 | #include "App_OSD_Banner.h" |
|---|
| 31 | |
|---|
| 32 | #include "App_Res_Resources.h" |
|---|
| 33 | |
|---|
| 34 | DHL_MODULE("@p_epg", 0); |
|---|
| 35 | |
|---|
| 36 | #define MAX_EIT_STR_SIZE |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | static tApp_EpgInfo p_epg_info; |
|---|
| 40 | //´ë·« 11K Á¤µµ µÇ´Â °Í °°À½. |
|---|
| 41 | |
|---|
| 42 | static DMW_EpgEvent p_epg_event[MAX_EPG_CELL], p_ett_event; |
|---|
| 43 | static UINT8 p_epg_eit_strs[MAX_EPG_CELL][256]; |
|---|
| 44 | static UINT8 p_epg_ett_str[4096]; |
|---|
| 45 | |
|---|
| 46 | static UINT32 p_eit_count=0; |
|---|
| 47 | static UINT32 p_ett_count=0; |
|---|
| 48 | |
|---|
| 49 | static DMG_STR_RowInfo_t p_ett_row_info[MAX_NUM_DRAW_ROW]; |
|---|
| 50 | static tApp_ScrollInfo p_ett_info; |
|---|
| 51 | |
|---|
| 52 | #define IEPG(x) p_epg_info.x |
|---|
| 53 | |
|---|
| 54 | #define EPG_CELL(idx) p_epg_info.cell_list[idx] |
|---|
| 55 | #define CUR_CELL() EPG_CELL(IEPG(start_idx)+IEPG(cur_idx)) |
|---|
| 56 | |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | static int p_get_cell_by_xpos(int xpos) |
|---|
| 60 | { |
|---|
| 61 | int i; |
|---|
| 62 | |
|---|
| 63 | for(i=0; i<IEPG(num_cell); i++) { |
|---|
| 64 | if(EPG_CELL(i).prgm_start<=xpos && |
|---|
| 65 | EPG_CELL(i).prgm_start+EPG_CELL(i).prgm_length>=xpos) { |
|---|
| 66 | return i; |
|---|
| 67 | } |
|---|
| 68 | } |
|---|
| 69 | |
|---|
| 70 | return 0; |
|---|
| 71 | } |
|---|
| 72 | |
|---|
| 73 | |
|---|
| 74 | |
|---|
| 75 | static BOOL p_exist_ch() |
|---|
| 76 | { |
|---|
| 77 | //ÇöÀç ä³Î Á¤º¸°¡ ÀÖÀ¸¸é TRUE, ±×·¸Áö ¾ÊÀ¸¸é false¸¦ ¸®ÅÏÇÔ. |
|---|
| 78 | return App_GetCurUcmShortInfo(NULL)==statusOK; |
|---|
| 79 | } |
|---|
| 80 | |
|---|
| 81 | |
|---|
| 82 | static void p_get_epg() |
|---|
| 83 | { |
|---|
| 84 | tApp_UcmShortInfo ucm_info; |
|---|
| 85 | UINT32 duration=3600*24*3-59-1; |
|---|
| 86 | //ÃÖ´ë 3ÀÏ, 60°³ |
|---|
| 87 | DMW_EpgEventPtr epg_event=p_epg_event; |
|---|
| 88 | int num_epg; |
|---|
| 89 | UINT32 epg_flag = GET_EVENT_TITLE | GET_EVENT_STATIC_MEM | (MAX_EPG_CELL); |
|---|
| 90 | int i; |
|---|
| 91 | APP_TIME_T cur_time; |
|---|
| 92 | |
|---|
| 93 | //1. ä³Î Á¤º¸ ä¿ì±â |
|---|
| 94 | if(App_GetCurUcmShortInfo(&ucm_info)!=statusOK) { |
|---|
| 95 | IEPG(uid)=-1; |
|---|
| 96 | return; |
|---|
| 97 | } |
|---|
| 98 | |
|---|
| 99 | IEPG(uid)=ucm_info.uid; |
|---|
| 100 | |
|---|
| 101 | IEPG(major)=ucm_info.major; |
|---|
| 102 | IEPG(minor)=ucm_info.minor; |
|---|
| 103 | IEPG(video_type)=ucm_info.video_format; //hd, sd¸¦ ±¸ºÐÇÔ. |
|---|
| 104 | |
|---|
| 105 | //audio only¸¦ È®ÀÎÇÒ ¹æ¹ýÀÌ ¸¶¶¥Ä¡ ¾Ê¾Æ¼, PID Á¤º¸¸¸ »ç¿ëÇÔ. |
|---|
| 106 | IEPG(baudio_only)=(ucm_info.vid_pid==0 && ucm_info.aud_pid); |
|---|
| 107 | |
|---|
| 108 | IEPG(vct_flag)=ucm_info.vct_flag; |
|---|
| 109 | memcpy(IEPG(ch_name), ucm_info.short_name, 7*sizeof(UINT16)); |
|---|
| 110 | |
|---|
| 111 | |
|---|
| 112 | //2. EPG Á¤º¸ ¾ò¾î¿À±â. |
|---|
| 113 | |
|---|
| 114 | //epg ¸Þ¸ð¸® ÃʱâÈ. |
|---|
| 115 | memset(p_epg_event, 0, sizeof(p_epg_event)); |
|---|
| 116 | |
|---|
| 117 | for(i=0; i<MAX_EPG_CELL; i++) { |
|---|
| 118 | p_epg_event[i].titleText=p_epg_eit_strs[i]; |
|---|
| 119 | } |
|---|
| 120 | |
|---|
| 121 | //ÇöÀç ½Ã°¢ ¾ò¾î¿À±â. |
|---|
| 122 | AppTime_GetCurTime(&cur_time, 1); |
|---|
| 123 | |
|---|
| 124 | if(IEPG(uid)==-1 || !IEPG(vct_flag) || |
|---|
| 125 | DMW_EPG_GetEventsInRange(IEPG(uid), cur_time.sys_time, duration, |
|---|
| 126 | &epg_event, &num_epg, epg_flag)!=statusOK) { //epg¸¦ ¾ò¾î¿À´Âµ¥ ½ÇÆÐÇÔ. |
|---|
| 127 | IEPG(num_cell)=1; |
|---|
| 128 | EPG_CELL(0).bexist=FALSE; |
|---|
| 129 | } |
|---|
| 130 | else { //epg¸¦ ¼º°øÀûÀ¸·Î ¾ò¾î¿È. |
|---|
| 131 | |
|---|
| 132 | for(i=0; i<num_epg; i++) { |
|---|
| 133 | EPG_CELL(i).prgm_start=epg_event[i].startTime; |
|---|
| 134 | EPG_CELL(i).prgm_length=epg_event[i].programLength; |
|---|
| 135 | |
|---|
| 136 | if(epg_event[i].titleTextLength>8) { |
|---|
| 137 | int title_len; |
|---|
| 138 | |
|---|
| 139 | EPG_CELL(i).bexist=TRUE; |
|---|
| 140 | |
|---|
| 141 | title_len=DLIB_PSI_DecodeMultipleStringStructure( |
|---|
| 142 | epg_event[i].titleTextLength, |
|---|
| 143 | epg_event[i].titleText, "eng", MAX_EPG_STR-1, |
|---|
| 144 | EPG_CELL(i).str |
|---|
| 145 | ); |
|---|
| 146 | |
|---|
| 147 | EPG_CELL(i).str[title_len]='\0'; |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | else { |
|---|
| 151 | int title_len; |
|---|
| 152 | |
|---|
| 153 | EPG_CELL(i).bexist=TRUE; |
|---|
| 154 | |
|---|
| 155 | title_len=DLIB_PSI_DecodeMultipleStringStructure( |
|---|
| 156 | epg_event[i].titleTextLength, |
|---|
| 157 | epg_event[i].titleText, "eng", MAX_EPG_STR-1, |
|---|
| 158 | EPG_CELL(i).str |
|---|
| 159 | ); |
|---|
| 160 | |
|---|
| 161 | EPG_CELL(i).str[0]='\0'; |
|---|
| 162 | } |
|---|
| 163 | } |
|---|
| 164 | IEPG(num_cell)=num_epg; |
|---|
| 165 | |
|---|
| 166 | //epg free -> staticÀ¸·Î ¸Þ¸ð¸®¸¦ ÇÒ´çÇßÀ¸¹Ç·Î ¾Æ·¡ »ý·« |
|---|
| 167 | //DMW_EPG_FreeEpgEvents(epg_event, num_epg); |
|---|
| 168 | } |
|---|
| 169 | |
|---|
| 170 | } |
|---|
| 171 | |
|---|
| 172 | |
|---|
| 173 | static BOOL p_get_epg_detail(int uid, UINT32 time, UINT16 *pstr) |
|---|
| 174 | { |
|---|
| 175 | //epg°¡ ÀÖÀ¸¸é TRUE¸¦ ¸®ÅÏÇÔ. |
|---|
| 176 | BOOL bret=FALSE; |
|---|
| 177 | UINT32 epg_flag = GET_EVENT_TEXT | GET_EVENT_STATIC_MEM; //titleÀº ÀÌ¹Ì ¾òÀ½. |
|---|
| 178 | DMW_EpgEventPtr epg_event=&p_ett_event; |
|---|
| 179 | int str_len; |
|---|
| 180 | |
|---|
| 181 | memset(&p_ett_event, 0, sizeof(p_ett_event)); |
|---|
| 182 | p_ett_event.eventETM=p_epg_ett_str; |
|---|
| 183 | |
|---|
| 184 | if(statusOK!=DMW_EPG_GetEventInTime(uid, time, &epg_event, epg_flag)) |
|---|
| 185 | return FALSE; //EPG¸¦ ¾ò¾î¿ÀÁö ¸øÇßÀ½, ERROR°¡ ³ °æ¿ì´Â FREE¸¦ ÇÒ Çʿ䰡 ¾ø°ÚÁö |
|---|
| 186 | |
|---|
| 187 | //title length°¡ 8À» ³Ñ¾î¾ß ÇÔ |
|---|
| 188 | if(epg_event->eventETMLength>8) { |
|---|
| 189 | bret=TRUE; |
|---|
| 190 | |
|---|
| 191 | str_len=DLIB_PSI_DecodeMultipleStringStructure(epg_event->eventETMLength, |
|---|
| 192 | epg_event->eventETM, "eng", MAX_ETT_LEN-1, pstr); |
|---|
| 193 | |
|---|
| 194 | pstr[str_len]='\0'; |
|---|
| 195 | } |
|---|
| 196 | |
|---|
| 197 | //epg free -> staticÀ¸·Î ¸Þ¸ð¸®¸¦ ÇÒ´çÇßÀ¸¹Ç·Î ¾Æ·¡ »ý·« |
|---|
| 198 | //DMW_EPG_FreeEpgEvent(epg_event); |
|---|
| 199 | |
|---|
| 200 | return bret; |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | static BOOL p_check_ch_change() //EPG Á¤º¸¸¦ ÀÚµ¿À¸·Î ¾÷µ¥ÀÌÆ®Çϱâ À§ÇØ ÇÊ¿äÇÔ. |
|---|
| 205 | { |
|---|
| 206 | tApp_UcmShortInfo ucm_info; |
|---|
| 207 | /* |
|---|
| 208 | 1. UID ºñ±³, ¼·Î -1À̸é(ä³ÎÀÌ ¾øÀ¸¸é) -> ä³Î Á¤º¸ µ¿ÀÏÇÔ. |
|---|
| 209 | UID°¡ ´Ù¸£¸é -> ä³ÎÀÌ º¯°æµÊ |
|---|
| 210 | UID°¡ °°À¸¸é major, minor ºñ±³ |
|---|
| 211 | */ |
|---|
| 212 | |
|---|
| 213 | if(App_GetCurUcmShortInfo(&ucm_info)!=statusOK) { |
|---|
| 214 | if(IEPG(uid)==-1) return FALSE; //µÑ ´Ù UID°¡ ¾øÀ¸¹Ç·Î FALSE¸¦ ¸®ÅÏÇÔ. |
|---|
| 215 | |
|---|
| 216 | return TRUE; //ÀÖ´Ù°¡ ¾ø¾îÁø °æ¿ì¹Ç·Î º¯È°¡ ÀÖÀ½. |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | //¾Æ·¡´Â ÇöÀç ä³Î Á¤º¸°¡ ÀÖ´Â °æ¿ìÀÓ. |
|---|
| 220 | if(IEPG(uid)==-1) { //ÀÌÀü ä³Î Á¤º¸°¡ ¾øÀ½. |
|---|
| 221 | return TRUE; |
|---|
| 222 | } |
|---|
| 223 | |
|---|
| 224 | //µÑ ´Ù uid°¡ °°À½. major, minor¸¸À» ºñ±³ÇÔ. |
|---|
| 225 | if(IEPG(major)!=ucm_info.major) return TRUE; |
|---|
| 226 | if(IEPG(minor)!=ucm_info.minor) return TRUE; |
|---|
| 227 | |
|---|
| 228 | return FALSE; |
|---|
| 229 | } |
|---|
| 230 | |
|---|
| 231 | |
|---|
| 232 | BOOL App_Proc_Epg(tDMG_CMD cmd, UINT32 opt, UINT32 param1, UINT32 param2) |
|---|
| 233 | { |
|---|
| 234 | BOOL bret=TRUE; |
|---|
| 235 | |
|---|
| 236 | switch(cmd) |
|---|
| 237 | { |
|---|
| 238 | case eDMG_CMD_ON_MENU_ACTIVE: |
|---|
| 239 | |
|---|
| 240 | //EPG Detail¿¡¼ ³Ñ¾î¿À´Â °æ¿ì/´Ù¸¥ °æ¿ì¸¦ ±¸ºÐÇØ¾ß ÇÔ. |
|---|
| 241 | // param2¸¦ ÀÌ¿ëÇϸé È®ÀÎ °¡´ÉÇÔ. |
|---|
| 242 | |
|---|
| 243 | if(param2==MID_EPG_DETAIL) { |
|---|
| 244 | //EPG¸¦ ´Ù½Ã ±×¸®°í ¸®ÅÏÇÔ. |
|---|
| 245 | AppOsd_DrawEpgBg(FALSE); |
|---|
| 246 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 247 | |
|---|
| 248 | DMG_SetTimer(TIMER_ID_EPG_REFRESH, 2000, 0); //2Ãʸ¶´Ù Çѹø¾¿ refreshÇÔ. |
|---|
| 249 | break; |
|---|
| 250 | } |
|---|
| 251 | |
|---|
| 252 | //ÇöÀç ä³ÎÀÌ ¾ø´Ù¸é warning ¸Þ½ÃÁö¸¦ ¶ç¿ö¾ß ÇÔ. |
|---|
| 253 | if(!p_exist_ch()) { //ÇöÀç º¸°í Àִ ä³ÎÀÌ ¾ø±â ¶§¹®¿¡ warning ¸Þ½ÃÁö »Ñ¸² |
|---|
| 254 | APP_OSD_DrawWarningBanner(2, FALSE); |
|---|
| 255 | IEPG(uid)=-1; |
|---|
| 256 | break; |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | p_get_epg(); |
|---|
| 260 | IEPG(start_idx)=0; |
|---|
| 261 | IEPG(cur_idx)=0; |
|---|
| 262 | |
|---|
| 263 | AppOsd_DrawEpgBg(TRUE); //epg bg¸¦ ±×¸². |
|---|
| 264 | |
|---|
| 265 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 266 | |
|---|
| 267 | DMG_SetTimer(TIMER_ID_EPG_REFRESH, 2000, 0); //2Ãʸ¶´Ù Çѹø¾¿ refreshÇÔ. |
|---|
| 268 | p_eit_count=App_EpgGetEitCount(); //eit count ÀúÀåÇÔ. |
|---|
| 269 | |
|---|
| 270 | break; |
|---|
| 271 | |
|---|
| 272 | case eDMG_CMD_ON_MENU_EXIT: |
|---|
| 273 | |
|---|
| 274 | if(!p_exist_ch()) break; |
|---|
| 275 | |
|---|
| 276 | DMG_KillTimer(TIMER_ID_EPG_REFRESH); |
|---|
| 277 | AppOsd_EraseEpg(); |
|---|
| 278 | break; |
|---|
| 279 | |
|---|
| 280 | case eDMG_CMD_ON_TIME: |
|---|
| 281 | if(param1==TIMER_ID_EPG_REFRESH) { |
|---|
| 282 | #if 0 //timer ó¸® ¾ÈÇÔ. |
|---|
| 283 | UINT32 eit_cnt=App_EpgGetEitCount(); |
|---|
| 284 | |
|---|
| 285 | //channel º¯°æ »çÇ×ÀÌ ÀÖ³ª üũÇÑ ÈÄ º¯°æ »çÇ×ÀÌ ÀÖÀ¸¸é ´Ù½Ã ±×¸². |
|---|
| 286 | if(p_check_ch_change()) { |
|---|
| 287 | p_eit_count=eit_cnt; |
|---|
| 288 | |
|---|
| 289 | p_get_epg(); |
|---|
| 290 | |
|---|
| 291 | if(IEPG(num_cell)<IEPG(start_idx)+IEPG(cur_idx)) { |
|---|
| 292 | //ÇöÀç À§Ä¡°¡ »ç¶óÁ³±â ¶§¹®¿¡ ÃʱâÈÇÔ. |
|---|
| 293 | IEPG(start_idx)=0; //ä³Î Á¤º¸°¡ ¹Ù²ï °æ¿ì´Â idx¸¦ 0À¸·Î ¼³Á¤ÇÔ. |
|---|
| 294 | IEPG(cur_idx)=0; //ä³Î Á¤º¸°¡ ¹Ù²ï °æ¿ì´Â idx¸¦ 0À¸·Î ¼³Á¤ÇÔ. |
|---|
| 295 | } |
|---|
| 296 | |
|---|
| 297 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 298 | break; |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | //EPG º¯°æ »çÇ×ÀÌ ÀÖ³ª üũÇÑ ÈÄ, º¯°æ »çÇ×ÀÌ ÀÖÀ¸¸é ´Ù½Ã ±×¸². |
|---|
| 302 | if(eit_cnt!=p_eit_count) { |
|---|
| 303 | //update..eit ¼ö½ÅµÊ |
|---|
| 304 | //ÇöÀç ¼±ÅÃÇÑ cellÀ» À¯ÁöÇÒ ÇÊ¿ä ÀÖÀ½. |
|---|
| 305 | p_eit_count=eit_cnt; |
|---|
| 306 | |
|---|
| 307 | p_get_epg(); |
|---|
| 308 | |
|---|
| 309 | if(IEPG(num_cell)<IEPG(start_idx)+IEPG(cur_idx)) { |
|---|
| 310 | //ÇöÀç À§Ä¡°¡ »ç¶óÁ³±â ¶§¹®¿¡ ÃʱâÈÇÔ. |
|---|
| 311 | IEPG(start_idx)=0; //ä³Î Á¤º¸°¡ ¹Ù²ï °æ¿ì´Â idx¸¦ 0À¸·Î ¼³Á¤ÇÔ. |
|---|
| 312 | IEPG(cur_idx)=0; //ä³Î Á¤º¸°¡ ¹Ù²ï °æ¿ì´Â idx¸¦ 0À¸·Î ¼³Á¤ÇÔ. |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 316 | } |
|---|
| 317 | #endif |
|---|
| 318 | |
|---|
| 319 | } |
|---|
| 320 | else |
|---|
| 321 | bret=FALSE; |
|---|
| 322 | break; |
|---|
| 323 | |
|---|
| 324 | case eDMG_CMD_ON_TIMEOUT: |
|---|
| 325 | DMG_MenuExit(MID_MAIN); |
|---|
| 326 | DMG_MenuExit(MID_EPG); |
|---|
| 327 | break; |
|---|
| 328 | |
|---|
| 329 | case eDMG_CMD_ON_KEY : |
|---|
| 330 | |
|---|
| 331 | switch(param2) { |
|---|
| 332 | |
|---|
| 333 | case APP_VK_LEFT: |
|---|
| 334 | case APP_VK_RIGHT: |
|---|
| 335 | break; |
|---|
| 336 | |
|---|
| 337 | case APP_VK_UP: |
|---|
| 338 | |
|---|
| 339 | if(IEPG(uid)==-1) break; |
|---|
| 340 | |
|---|
| 341 | if(IEPG(cur_idx)==0) { |
|---|
| 342 | |
|---|
| 343 | if(IEPG(start_idx)==0) { |
|---|
| 344 | //scrollup ÇÊ¿äÇÔ. |
|---|
| 345 | IEPG(start_idx)=IEPG(num_cell)-MAX_NUM_EPG_LINE; |
|---|
| 346 | if(IEPG(start_idx)<0) IEPG(start_idx)=0; |
|---|
| 347 | |
|---|
| 348 | IEPG(cur_idx)=IEPG(num_cell)-IEPG(start_idx)-1; |
|---|
| 349 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 350 | } |
|---|
| 351 | else { |
|---|
| 352 | IEPG(start_idx)--; |
|---|
| 353 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 354 | } |
|---|
| 355 | } |
|---|
| 356 | else { |
|---|
| 357 | IEPG(cur_idx)--; |
|---|
| 358 | AppOsd_UpdateEpg(&p_epg_info, IEPG(cur_idx)+1); |
|---|
| 359 | } |
|---|
| 360 | break; |
|---|
| 361 | |
|---|
| 362 | |
|---|
| 363 | case APP_VK_DOWN: |
|---|
| 364 | |
|---|
| 365 | if(IEPG(uid)==-1) break; |
|---|
| 366 | |
|---|
| 367 | if(IEPG(start_idx)+IEPG(cur_idx)==IEPG(num_cell)-1) { |
|---|
| 368 | IEPG(start_idx)=0; |
|---|
| 369 | IEPG(cur_idx)=0; |
|---|
| 370 | |
|---|
| 371 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 372 | } |
|---|
| 373 | else { |
|---|
| 374 | if(IEPG(cur_idx)==MAX_NUM_EPG_LINE-1) { |
|---|
| 375 | IEPG(start_idx)++; |
|---|
| 376 | |
|---|
| 377 | AppOsd_DrawEpg(&p_epg_info); |
|---|
| 378 | } |
|---|
| 379 | else { |
|---|
| 380 | IEPG(cur_idx)++; |
|---|
| 381 | AppOsd_UpdateEpg(&p_epg_info, IEPG(cur_idx)-1); |
|---|
| 382 | } |
|---|
| 383 | } |
|---|
| 384 | break; |
|---|
| 385 | |
|---|
| 386 | case APP_VK_SELECT: |
|---|
| 387 | |
|---|
| 388 | if(IEPG(uid)==-1) break; |
|---|
| 389 | |
|---|
| 390 | if(CUR_CELL().bexist) |
|---|
| 391 | DMG_MenuStart(MID_EPG_DETAIL); |
|---|
| 392 | |
|---|
| 393 | break; |
|---|
| 394 | |
|---|
| 395 | case APP_VK_MENU: |
|---|
| 396 | case APP_VK_EPG: |
|---|
| 397 | case APP_VK_BACK: |
|---|
| 398 | DMG_MenuExit(MID_EPG); |
|---|
| 399 | break; |
|---|
| 400 | |
|---|
| 401 | case APP_VK_CH_UP: |
|---|
| 402 | //ch up,downÀº EPG¿¡¼ ¸·µµ·Ï ÇÔ. |
|---|
| 403 | break; |
|---|
| 404 | |
|---|
| 405 | case APP_VK_CH_DOWN: |
|---|
| 406 | //ch up,downÀº EPG¿¡¼ ¸·µµ·Ï ÇÔ. |
|---|
| 407 | break; |
|---|
| 408 | |
|---|
| 409 | default: |
|---|
| 410 | bret=FALSE; |
|---|
| 411 | } |
|---|
| 412 | |
|---|
| 413 | //event°¡ ¹ß»ýÇϸé Ç×»ó EPG ÇÏ´Ü Á¤º¸¸¦ °»½ÅÇϵµ·Ï ÇÔ. |
|---|
| 414 | //if(IEPG(num_ch)>0) |
|---|
| 415 | // AppOsd_DrawEpgInfo(&p_epg_info); |
|---|
| 416 | break; |
|---|
| 417 | |
|---|
| 418 | default: |
|---|
| 419 | bret=FALSE; |
|---|
| 420 | } |
|---|
| 421 | |
|---|
| 422 | if(!bret) |
|---|
| 423 | bret=App_Proc_Idle(cmd, opt, param1, param2); |
|---|
| 424 | |
|---|
| 425 | DMG_AutoRefresh(); |
|---|
| 426 | |
|---|
| 427 | return bret; |
|---|
| 428 | } |
|---|
| 429 | |
|---|
| 430 | |
|---|
| 431 | //ett´Â ¾÷µ¥ÀÌÆ®°¡ ¾ÈµÇ°Ô ÇÏ´Â°Ô ¸Â´ÂµíÇÔ. |
|---|
| 432 | BOOL App_Proc_Epg_Detail(tDMG_CMD cmd, UINT32 opt, UINT32 param1, UINT32 param2) |
|---|
| 433 | { |
|---|
| 434 | BOOL bret=TRUE; |
|---|
| 435 | tDMG_Menu *pmenu; |
|---|
| 436 | static BOOL bett_exist=FALSE; |
|---|
| 437 | int detail_w=0; |
|---|
| 438 | static int total_line_count = 0; |
|---|
| 439 | |
|---|
| 440 | switch(cmd) |
|---|
| 441 | { |
|---|
| 442 | |
|---|
| 443 | case eDMG_CMD_ON_MENU_ACTIVE: |
|---|
| 444 | //get uid, time info. |
|---|
| 445 | bett_exist=p_get_epg_detail(IEPG(uid), |
|---|
| 446 | CUR_CELL().prgm_start+CUR_CELL().prgm_length/2, IEPG(ett_text)); |
|---|
| 447 | |
|---|
| 448 | AppOsd_GetDetailTextBoxSize(&detail_w, NULL); |
|---|
| 449 | |
|---|
| 450 | if(bett_exist) |
|---|
| 451 | total_line_count = DMG_GetUStrLineCount(detail_w, IEPG(ett_text), p_ett_row_info); |
|---|
| 452 | |
|---|
| 453 | if(total_line_count <= 6) |
|---|
| 454 | { |
|---|
| 455 | AppOsd_DrawEpgDetail(&p_epg_info, IEPG(ett_text), bett_exist); |
|---|
| 456 | } |
|---|
| 457 | else |
|---|
| 458 | { |
|---|
| 459 | total_line_count = DMG_GetUStrLineCount(detail_w - 25, IEPG(ett_text), p_ett_row_info); |
|---|
| 460 | p_ett_info.view_lines = 6; |
|---|
| 461 | p_ett_info.num_lines = total_line_count - (p_ett_info.view_lines - 1); |
|---|
| 462 | p_ett_info.cur_idx = 0; |
|---|
| 463 | |
|---|
| 464 | AppOsd_DrawEpgDetailWithScroll(&p_epg_info, &p_ett_info, p_ett_row_info, IEPG(ett_text)); |
|---|
| 465 | } |
|---|
| 466 | |
|---|
| 467 | p_ett_count=App_EpgGetEttCount(); |
|---|
| 468 | |
|---|
| 469 | //timer µî·Ï. |
|---|
| 470 | DMG_SetTimer(TIMER_ID_EPG_REFRESH, 2000, 0); //2Ãʸ¶´Ù Çѹø¾¿ refreshÇÔ. |
|---|
| 471 | break; |
|---|
| 472 | |
|---|
| 473 | case eDMG_CMD_ON_TIME: |
|---|
| 474 | if(param1==TIMER_ID_EPG_REFRESH) { |
|---|
| 475 | #if 0 //timer ó¸® ¾ÈÇÔ. |
|---|
| 476 | if(App_EpgGetEttCount()!=p_ett_count) { |
|---|
| 477 | |
|---|
| 478 | bett_exist=p_get_epg_detail(IEPG(uid), |
|---|
| 479 | CUR_CELL().prgm_start+CUR_CELL().prgm_length/2, IEPG(ett_text)); |
|---|
| 480 | |
|---|
| 481 | AppOsd_DrawEpgDetail(&p_epg_info, IEPG(ett_text), bett_exist); |
|---|
| 482 | |
|---|
| 483 | p_ett_count=App_EpgGetEttCount(); |
|---|
| 484 | } |
|---|
| 485 | #endif |
|---|
| 486 | } |
|---|
| 487 | else |
|---|
| 488 | bret=FALSE; |
|---|
| 489 | break; |
|---|
| 490 | |
|---|
| 491 | case eDMG_CMD_ON_TIMEOUT: |
|---|
| 492 | DMG_MenuExit(MID_MAIN); |
|---|
| 493 | DMG_MenuExit(MID_EPG); |
|---|
| 494 | DMG_MenuExit(MID_EPG_DETAIL); |
|---|
| 495 | break; |
|---|
| 496 | |
|---|
| 497 | case eDMG_CMD_ON_KEY : |
|---|
| 498 | pmenu=(tDMG_Menu *)param1; |
|---|
| 499 | |
|---|
| 500 | switch(param2) |
|---|
| 501 | { |
|---|
| 502 | case APP_VK_SELECT : |
|---|
| 503 | case APP_VK_CH_UP : |
|---|
| 504 | case APP_VK_CH_DOWN : |
|---|
| 505 | case APP_VK_FAV : |
|---|
| 506 | break; |
|---|
| 507 | |
|---|
| 508 | case APP_VK_UP : |
|---|
| 509 | if(bett_exist && total_line_count > 6) |
|---|
| 510 | { |
|---|
| 511 | if(p_ett_info.cur_idx > 0) |
|---|
| 512 | { |
|---|
| 513 | p_ett_info.cur_idx--; |
|---|
| 514 | AppOsd_DrawEpgDetailWithScroll(&p_epg_info, &p_ett_info, p_ett_row_info, IEPG(ett_text)); |
|---|
| 515 | } |
|---|
| 516 | } |
|---|
| 517 | break; |
|---|
| 518 | |
|---|
| 519 | case APP_VK_DOWN : |
|---|
| 520 | if(bett_exist && total_line_count > 6) |
|---|
| 521 | { |
|---|
| 522 | if(p_ett_info.cur_idx < p_ett_info.num_lines - 1) |
|---|
| 523 | { |
|---|
| 524 | p_ett_info.cur_idx++; |
|---|
| 525 | AppOsd_DrawEpgDetailWithScroll(&p_epg_info, &p_ett_info, p_ett_row_info, IEPG(ett_text)); |
|---|
| 526 | } |
|---|
| 527 | } |
|---|
| 528 | break; |
|---|
| 529 | |
|---|
| 530 | case APP_VK_MENU : |
|---|
| 531 | case APP_VK_BACK : |
|---|
| 532 | bett_exist = FALSE; |
|---|
| 533 | total_line_count = 0; |
|---|
| 534 | DMG_MenuExit(MID_EPG_DETAIL); |
|---|
| 535 | break; |
|---|
| 536 | |
|---|
| 537 | case APP_VK_EPG : |
|---|
| 538 | case APP_VK_EXIT : |
|---|
| 539 | // HIDE µÇ¾î ÀÖ´ø EPG¸¦ ¸ÕÀú ´Ý¾Æ¾ß ±ôºýÀÓÀÌ ¾Èº¸ÀδÙ. |
|---|
| 540 | bett_exist = FALSE; |
|---|
| 541 | total_line_count = 0; |
|---|
| 542 | DMG_MenuExit(MID_EPG); |
|---|
| 543 | DMG_MenuExit(MID_EPG_DETAIL); |
|---|
| 544 | DMG_SetUserDefined(UD_ID_EPG_EXIT_ALARM, IEPG(uid), 0); |
|---|
| 545 | break; |
|---|
| 546 | |
|---|
| 547 | default : |
|---|
| 548 | bret=FALSE; |
|---|
| 549 | } |
|---|
| 550 | break; |
|---|
| 551 | |
|---|
| 552 | case eDMG_CMD_ON_MENU_EXIT : |
|---|
| 553 | // ȸé Áö¿ò |
|---|
| 554 | bett_exist = FALSE; |
|---|
| 555 | total_line_count = 0; |
|---|
| 556 | DMG_KillTimer(TIMER_ID_EPG_REFRESH); |
|---|
| 557 | AppOsd_EraseEpgDetail(); |
|---|
| 558 | break; |
|---|
| 559 | } |
|---|
| 560 | |
|---|
| 561 | if(!bret) |
|---|
| 562 | bret=App_Proc_Idle(cmd, opt, param1, param2); |
|---|
| 563 | |
|---|
| 564 | DMG_AutoRefresh(); |
|---|
| 565 | |
|---|
| 566 | return bret; |
|---|
| 567 | } |
|---|
| 568 | |
|---|
| 569 | |
|---|
| 570 | |
|---|
| 571 | void App_Menu_CreateEpg() |
|---|
| 572 | { |
|---|
| 573 | if(DMG_GetMenu(MID_EPG)) { |
|---|
| 574 | return; |
|---|
| 575 | } |
|---|
| 576 | |
|---|
| 577 | DMG_CreateMenu(MID_EPG_CFG); |
|---|
| 578 | } |
|---|
| 579 | |
|---|
| 580 | |
|---|
| 581 | void App_Menu_CreateEpgDetail() |
|---|
| 582 | { |
|---|
| 583 | if(DMG_GetMenu(MID_EPG_DETAIL)) { |
|---|
| 584 | return; |
|---|
| 585 | } |
|---|
| 586 | |
|---|
| 587 | DMG_CreateMenu(MID_EPG_DETAIL_CFG); |
|---|
| 588 | } |
|---|