| 1 | |
|---|
| 2 | |
|---|
| 3 | #include "App_Main.h" |
|---|
| 4 | #include "App_Fnc_Common.h" |
|---|
| 5 | |
|---|
| 6 | #include "App_Fnc_EA2.h" |
|---|
| 7 | |
|---|
| 8 | #include "DLIB_PSI_Utils.h" |
|---|
| 9 | #include "DMW_Channel.h" |
|---|
| 10 | |
|---|
| 11 | #include "DMW_CodeConv.h" |
|---|
| 12 | #include "DMG_Util.h" |
|---|
| 13 | |
|---|
| 14 | #include "App_Fnc_ChTune.h" |
|---|
| 15 | |
|---|
| 16 | #include "App_Res_Etc.h" |
|---|
| 17 | #include "App_Res_Menus.h" |
|---|
| 18 | |
|---|
| 19 | DHL_MODULE("@f_ea", 1); |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | typedef struct { |
|---|
| 23 | UINT8 state; |
|---|
| 24 | UINT8 countrySub; |
|---|
| 25 | UINT16 countryCode; |
|---|
| 26 | } LocCode; |
|---|
| 27 | |
|---|
| 28 | typedef struct { |
|---|
| 29 | BOOL bInband; |
|---|
| 30 | UINT16 attr1; /* bInband¿¡ µû¶ó major/reserved */ |
|---|
| 31 | UINT16 attr2; /* bInband¿¡ µû¶ó minor/exception OOB */ |
|---|
| 32 | } ExceptionInfo; |
|---|
| 33 | |
|---|
| 34 | typedef struct { |
|---|
| 35 | UINT16 eventId; |
|---|
| 36 | char pOrigCode[3]; |
|---|
| 37 | UINT8 eventCodeLen; |
|---|
| 38 | char *pEventCode; |
|---|
| 39 | UINT8 natureActivTextLen; |
|---|
| 40 | char *pNatureActivText; |
|---|
| 41 | INT16 timeRemaining; |
|---|
| 42 | UINT32 startTime; |
|---|
| 43 | UINT16 duration; |
|---|
| 44 | UINT8 priority; |
|---|
| 45 | UINT16 detailSrcId; |
|---|
| 46 | UINT16 detailMajor; |
|---|
| 47 | UINT16 detailMinor; |
|---|
| 48 | UINT16 audioSrcId; |
|---|
| 49 | UINT16 alertTextLen; |
|---|
| 50 | char *pAlertText; |
|---|
| 51 | UINT8 locCodeCnt; |
|---|
| 52 | LocCode *pLocCode; |
|---|
| 53 | UINT8 exceptionCnt; |
|---|
| 54 | ExceptionInfo *pException; |
|---|
| 55 | UINT8 descLen; |
|---|
| 56 | char *pDescriptors; |
|---|
| 57 | } EA_EVENT; |
|---|
| 58 | |
|---|
| 59 | typedef struct { |
|---|
| 60 | UINT32 eaEventId; |
|---|
| 61 | UINT32 endTime; |
|---|
| 62 | UINT16 alertTextLen; |
|---|
| 63 | UINT8 priority; |
|---|
| 64 | } EA_StoredEvent; |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | #define TICK_CUR DHL_OS_GetMsCount() |
|---|
| 68 | #define TICK_PASS(st) (TICK_CUR-st) |
|---|
| 69 | #define TICK_1SEC OS_GetTicksPerSecond()//1000 |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | #define EA_CHECK_STORED_EA_EVENT 0 |
|---|
| 73 | /* Å×½ºÆ®¸¦ À§Çؼ´Â 0À¸·Î ¼³Á¤ÇÏ´Â °ÍÀÌ ÁÁÀ½. */ |
|---|
| 74 | |
|---|
| 75 | #define EA_TEST_DENY_PRIO 0 |
|---|
| 76 | /* Å×½ºÆ®¸¦ À§ÇÑ ¿ëµµ·Î PRIO¿¡ »ó°ü¾øÀÌ ¹«Á¶°Ç ó¸® */ |
|---|
| 77 | |
|---|
| 78 | #define INDEF_DURATION 1 /* 1ºÐ. durationÀÌ 0À¸·Î ¼³Á¤µÇ¾îÀÖÀ» ¶§ default */ |
|---|
| 79 | #define INDEF_TIME_REMAIN 10 /* 10ÃÊ. time remainingÀÌ 0À¸·Î ¼³Á¤µÇ¾îÀÖÀ» ¶§ default */ |
|---|
| 80 | |
|---|
| 81 | #define MAX_STORED_EVENT 10 |
|---|
| 82 | |
|---|
| 83 | #define TIME_REMAIN_ADJUST_VAL 10 /* time remain °ªÀº ÃÖÃÊ 10 sec Á¤µµ ´õ ÈÄÇÏ°Ô ÁØ´Ù. */ |
|---|
| 84 | |
|---|
| 85 | static struct { |
|---|
| 86 | tDHL_PSI_ControlHandle ctrl; |
|---|
| 87 | BOOL bmon_started; |
|---|
| 88 | BOOL low_on; |
|---|
| 89 | BOOL medium_on; |
|---|
| 90 | |
|---|
| 91 | EA_EVENT *cur_event; |
|---|
| 92 | EA_StoredEvent p_stored[MAX_STORED_EVENT]; |
|---|
| 93 | |
|---|
| 94 | BOOL now_tuning; |
|---|
| 95 | BOOL now_scrolling; |
|---|
| 96 | |
|---|
| 97 | UINT16 prev_major, prev_minor; |
|---|
| 98 | UINT32 tm_start_tune; |
|---|
| 99 | } p_ea_info; |
|---|
| 100 | |
|---|
| 101 | |
|---|
| 102 | |
|---|
| 103 | #define INFO(x) p_ea_info.x |
|---|
| 104 | #define CEVENT(x) (INFO(cur_event))->x |
|---|
| 105 | #define STORED(i) (INFO(p_stored)[i]) |
|---|
| 106 | |
|---|
| 107 | |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | #if COMMENT |
|---|
| 111 | __EA_Parse_Proc__() {} |
|---|
| 112 | #endif |
|---|
| 113 | |
|---|
| 114 | static void p_ea_print_info(EA_EVENT *event) |
|---|
| 115 | { |
|---|
| 116 | UINT16 *pAlertText, alertTextLen; |
|---|
| 117 | |
|---|
| 118 | if(!event) return; |
|---|
| 119 | dprint(1, "EA Section Info..cur time(%d)\n", DHL_OS_GetMsCount()/1000); |
|---|
| 120 | dprint(1, "==========================================\n"); |
|---|
| 121 | dprint(1, " event id %d\n", event->eventId); |
|---|
| 122 | dprint(1, " time remaining %d\n", event->timeRemaining); |
|---|
| 123 | dprint(1, " start time %d\n", event->startTime); |
|---|
| 124 | dprint(1, " duration %d\n", event->duration); |
|---|
| 125 | dprint(1, " priority %d\n", event->priority); |
|---|
| 126 | dprint(1, " detail src id %d\n", event->detailSrcId); |
|---|
| 127 | dprint(1, " detail major %d\n", event->detailMajor); |
|---|
| 128 | dprint(1, " detail minor %d\n", event->detailMinor); |
|---|
| 129 | dprint(1, " audio src %d\n", event->audioSrcId); |
|---|
| 130 | dprint(1, " alert text len %d\n", event->alertTextLen); |
|---|
| 131 | |
|---|
| 132 | if (event->alertTextLen> 6) { |
|---|
| 133 | pAlertText=(UINT16 *)DHL_OS_Malloc((event->alertTextLen+1)*sizeof(UINT16)); |
|---|
| 134 | alertTextLen=DLIB_PSI_DecodeMultipleStringStructure(event->alertTextLen, |
|---|
| 135 | (UINT8 *)event->pAlertText, "eng", |
|---|
| 136 | event->alertTextLen, |
|---|
| 137 | pAlertText); |
|---|
| 138 | pAlertText[alertTextLen]=0; |
|---|
| 139 | |
|---|
| 140 | dprint(1, " alert text : [%s]\n", DMW_Unicode2Ks(pAlertText, -1, NULL)); |
|---|
| 141 | DHL_OS_Free((void **)&pAlertText); |
|---|
| 142 | } |
|---|
| 143 | dprint(1, "==========================================\n"); |
|---|
| 144 | } |
|---|
| 145 | |
|---|
| 146 | |
|---|
| 147 | int p_get_ch_info(int *major, int *minor, int *rf) |
|---|
| 148 | { |
|---|
| 149 | DST_CURCHANNEL ChannelInfo; |
|---|
| 150 | App_Ucm_GetCurChInfo(&ChannelInfo); |
|---|
| 151 | |
|---|
| 152 | if(major) *major=ChannelInfo.nMajor; |
|---|
| 153 | if(minor) *minor=ChannelInfo.nMinor; |
|---|
| 154 | if(rf) *rf=ChannelInfo.nRF; |
|---|
| 155 | |
|---|
| 156 | return 0; |
|---|
| 157 | } |
|---|
| 158 | |
|---|
| 159 | |
|---|
| 160 | static DHL_RESULT p_parse_ea_event(UINT8 *psect_data, EA_EVENT **ppevent) |
|---|
| 161 | { |
|---|
| 162 | bitBufferPtr_t bits = NULL; |
|---|
| 163 | DHL_RESULT err = DHL_OK; |
|---|
| 164 | UINT16 sect_len; |
|---|
| 165 | EA_EVENT *pevent=NULL; |
|---|
| 166 | UINT32 temp; |
|---|
| 167 | int i; |
|---|
| 168 | static int prev_seq_num=-1; |
|---|
| 169 | |
|---|
| 170 | if (get_section_syntax_indicator(psect_data) == 0) { |
|---|
| 171 | dprint(1, "[MW CEA] section_syntax_indicator not set\n"); |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | if((sect_len=get_section_length(psect_data)) > 4093) { |
|---|
| 175 | dprint(1, "[MW CEA] section_length=%d\n", (int)sect_len); |
|---|
| 176 | err=DHL_FAIL_BAD_FORMAT; |
|---|
| 177 | goto ParseExit; |
|---|
| 178 | } |
|---|
| 179 | |
|---|
| 180 | if ((err = bitBufferCreate(&bits,psect_data+3,sect_len))) { |
|---|
| 181 | err=DHL_FAIL_BAD_FORMAT; /* ÀÏ´Ü general warning ó¸®ÇÔ. */ |
|---|
| 182 | goto ParseExit; |
|---|
| 183 | } |
|---|
| 184 | |
|---|
| 185 | pevent = (EA_EVENT *)DHL_OS_Malloc(sizeof(EA_EVENT)); |
|---|
| 186 | memset(pevent, 0, sizeof(EA_EVENT)); |
|---|
| 187 | |
|---|
| 188 | /* table_id_extension */ |
|---|
| 189 | if (bitBufferGetBits(bits,16) != 0x0000) { |
|---|
| 190 | dprint(1, "[MW CEA] table_id_extension != 0x0000\n"); |
|---|
| 191 | } |
|---|
| 192 | |
|---|
| 193 | bitBufferGetBits(bits,2); |
|---|
| 194 | |
|---|
| 195 | |
|---|
| 196 | if((temp=bitBufferGetBits(bits,5))==prev_seq_num) { /* sequence numÀÌ °°¾ÒÀ¸¹Ç·Î Ãë¼Ò */ |
|---|
| 197 | |
|---|
| 198 | dprint(1, "[MW CEA] EA Msg Incoming, BUT CANCELED because Seq # is equal to prev seq #\n"); |
|---|
| 199 | err=DHL_FAIL; /* ÀÏ´Ü general warning ó¸®ÇÔ. */ |
|---|
| 200 | goto ParseExit; |
|---|
| 201 | |
|---|
| 202 | } |
|---|
| 203 | |
|---|
| 204 | /* current next indicator : Ç×»ó 1 */ |
|---|
| 205 | if (bitBufferGetBits(bits,1) != 1) { |
|---|
| 206 | dprint(1, "[MW CEA] current_next_indicator != 1\n"); |
|---|
| 207 | } |
|---|
| 208 | |
|---|
| 209 | /* section number : Ç×»ó 0x00 */ |
|---|
| 210 | if (bitBufferGetBits(bits,8) != 0x00) { |
|---|
| 211 | dprint(1, "[MW CEA] section_number != 0x00\n"); |
|---|
| 212 | } |
|---|
| 213 | |
|---|
| 214 | /* last section number : Ç×»ó 0x00 */ |
|---|
| 215 | if (bitBufferGetBits(bits,8) != 0x00) { |
|---|
| 216 | dprint(1, "[MW CEA] section_number != 0x00\n"); |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | /* protocol version ¹Ýµå½Ã 0À̾î¾ß ÇÔ. */ |
|---|
| 220 | if(bitBufferGetBits(bits,8) != 0x00) { |
|---|
| 221 | err=DHL_FAIL; |
|---|
| 222 | goto ParseExit; |
|---|
| 223 | } |
|---|
| 224 | |
|---|
| 225 | prev_seq_num=temp; |
|---|
| 226 | |
|---|
| 227 | /* |
|---|
| 228 | event id´Â 1)ÇöÀç ÁøÇàÁßÀÎ EAÀÇ event ID¿Í °°´Ù¸é, remaining time Á¶Àý ¸ñÀû |
|---|
| 229 | 2) ÁøÇàÀÌ ³¡³µ°í, start, duration time¾È¿¡ ÀÖ´Ù¸é ¹«½ÃÇÑ´Ù. |
|---|
| 230 | 1), 2)ÀÇ »óȲÀ» MW°¡ ¾Ë ¼ö ¾ø±â ¶§¹®¿¡ App¿¡¼ ó¸®ÇÑ´Ù. |
|---|
| 231 | */ |
|---|
| 232 | pevent->eventId=bitBufferGetBits(bits,16); |
|---|
| 233 | pevent->pOrigCode[0] = bitBufferGetBits(bits,8); |
|---|
| 234 | pevent->pOrigCode[1] = bitBufferGetBits(bits,8); |
|---|
| 235 | pevent->pOrigCode[2] = bitBufferGetBits(bits,8); |
|---|
| 236 | |
|---|
| 237 | pevent->eventCodeLen=bitBufferGetBits(bits,8); |
|---|
| 238 | if(pevent->eventCodeLen != 0) { |
|---|
| 239 | |
|---|
| 240 | pevent->pEventCode |
|---|
| 241 | =(char *)DHL_OS_Malloc((pevent->eventCodeLen+1)*sizeof(char)); |
|---|
| 242 | |
|---|
| 243 | for( i = 0 ; i < pevent->eventCodeLen ; i++ ) { /*EAS_event_code*/ |
|---|
| 244 | pevent->pEventCode[i] = bitBufferGetBits(bits,8); |
|---|
| 245 | } |
|---|
| 246 | } |
|---|
| 247 | |
|---|
| 248 | pevent->natureActivTextLen=bitBufferGetBits(bits,8); |
|---|
| 249 | if(pevent->natureActivTextLen != 0) { |
|---|
| 250 | |
|---|
| 251 | pevent->pNatureActivText |
|---|
| 252 | =(char *)DHL_OS_Malloc((pevent->natureActivTextLen+1)*sizeof(char)); |
|---|
| 253 | |
|---|
| 254 | for( i = 0 ; i < pevent->natureActivTextLen ; i++ ) { /*EAS_event_code*/ |
|---|
| 255 | pevent->pNatureActivText[i] = bitBufferGetBits(bits,8); |
|---|
| 256 | } |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | pevent->timeRemaining = bitBufferGetBits(bits,8); |
|---|
| 260 | |
|---|
| 261 | pevent->startTime=bitBufferGetBits(bits, 32); |
|---|
| 262 | pevent->duration=bitBufferGetBits(bits, 16); |
|---|
| 263 | |
|---|
| 264 | bitBufferGetBits(bits,12); |
|---|
| 265 | |
|---|
| 266 | pevent->priority=bitBufferGetBits(bits, 4); |
|---|
| 267 | |
|---|
| 268 | pevent->detailSrcId=bitBufferGetBits(bits, 16); |
|---|
| 269 | bitBufferGetBits(bits,6); |
|---|
| 270 | pevent->detailMajor=bitBufferGetBits(bits, 10); |
|---|
| 271 | bitBufferGetBits(bits,6); |
|---|
| 272 | pevent->detailMinor=bitBufferGetBits(bits, 10); |
|---|
| 273 | pevent->audioSrcId=bitBufferGetBits(bits, 16); |
|---|
| 274 | |
|---|
| 275 | pevent->alertTextLen=bitBufferGetBits(bits,16); |
|---|
| 276 | if(pevent->alertTextLen != 0) { |
|---|
| 277 | |
|---|
| 278 | pevent->pAlertText |
|---|
| 279 | =(char *)DHL_OS_Malloc((pevent->alertTextLen+1)*sizeof(char)); |
|---|
| 280 | |
|---|
| 281 | for( i = 0 ; i < pevent->alertTextLen ; i++ ) {/*EAS_event_code*/ |
|---|
| 282 | pevent->pAlertText[i] = bitBufferGetBits(bits,8); |
|---|
| 283 | } |
|---|
| 284 | } |
|---|
| 285 | |
|---|
| 286 | pevent->locCodeCnt=bitBufferGetBits(bits,8); |
|---|
| 287 | if(pevent->locCodeCnt != 0) { |
|---|
| 288 | |
|---|
| 289 | pevent->pLocCode |
|---|
| 290 | =(LocCode *)DHL_OS_Malloc(pevent->locCodeCnt*sizeof(LocCode)); |
|---|
| 291 | |
|---|
| 292 | for( i = 0 ; i < pevent->locCodeCnt ; i++ ) { |
|---|
| 293 | pevent->pLocCode[i].state=bitBufferGetBits(bits,8); |
|---|
| 294 | pevent->pLocCode[i].countrySub=bitBufferGetBits(bits,4); |
|---|
| 295 | bitBufferGetBits(bits,2); |
|---|
| 296 | pevent->pLocCode[i].countryCode=bitBufferGetBits(bits,10); |
|---|
| 297 | |
|---|
| 298 | } |
|---|
| 299 | } |
|---|
| 300 | |
|---|
| 301 | pevent->exceptionCnt=bitBufferGetBits(bits,8); |
|---|
| 302 | if(pevent->exceptionCnt != 0) { |
|---|
| 303 | |
|---|
| 304 | pevent->pException |
|---|
| 305 | =(ExceptionInfo *)DHL_OS_Malloc(pevent->exceptionCnt*sizeof(ExceptionInfo)); |
|---|
| 306 | |
|---|
| 307 | for( i = 0 ; i < pevent->exceptionCnt ; i++ ) { |
|---|
| 308 | pevent->pException[i].bInband=bitBufferGetBits(bits, 1); |
|---|
| 309 | bitBufferGetBits(bits, 7); |
|---|
| 310 | if(pevent->pException[i].bInband) { |
|---|
| 311 | bitBufferGetBits(bits, 6); |
|---|
| 312 | pevent->pException[i].attr1=bitBufferGetBits(bits,10); |
|---|
| 313 | bitBufferGetBits(bits, 6); |
|---|
| 314 | pevent->pException[i].attr2=bitBufferGetBits(bits,10); |
|---|
| 315 | } |
|---|
| 316 | else { |
|---|
| 317 | bitBufferGetBits(bits, 16); |
|---|
| 318 | pevent->pException[i].attr1=0; |
|---|
| 319 | pevent->pException[i].attr2=bitBufferGetBits(bits, 16); |
|---|
| 320 | } |
|---|
| 321 | } |
|---|
| 322 | } |
|---|
| 323 | |
|---|
| 324 | bitBufferGetBits(bits, 6); |
|---|
| 325 | pevent->descLen=bitBufferGetBits(bits, 10); |
|---|
| 326 | |
|---|
| 327 | if(pevent->descLen != 0) { |
|---|
| 328 | |
|---|
| 329 | pevent->pDescriptors |
|---|
| 330 | =(char *)DHL_OS_Malloc((pevent->descLen+1)*sizeof(char)); |
|---|
| 331 | |
|---|
| 332 | for( i = 0 ; i < pevent->descLen ; i++ ) { |
|---|
| 333 | pevent->pDescriptors[i]=bitBufferGetBits(bits, 8); |
|---|
| 334 | } |
|---|
| 335 | } |
|---|
| 336 | |
|---|
| 337 | ParseExit : |
|---|
| 338 | if (bits) { |
|---|
| 339 | /* clean up the bitBuffer */ |
|---|
| 340 | bitBufferDestroy(bits); |
|---|
| 341 | } |
|---|
| 342 | |
|---|
| 343 | *ppevent=pevent; |
|---|
| 344 | |
|---|
| 345 | return err; |
|---|
| 346 | } |
|---|
| 347 | |
|---|
| 348 | |
|---|
| 349 | static void p_release_ea_event(EA_EVENT **ppevent) |
|---|
| 350 | { |
|---|
| 351 | if(!ppevent) |
|---|
| 352 | return; |
|---|
| 353 | |
|---|
| 354 | if((*ppevent)->pEventCode) |
|---|
| 355 | DHL_OS_Free((void **)&(*ppevent)->pEventCode); |
|---|
| 356 | if((*ppevent)->pNatureActivText) |
|---|
| 357 | DHL_OS_Free((void **)&(*ppevent)->pNatureActivText); |
|---|
| 358 | if((*ppevent)->pAlertText) |
|---|
| 359 | DHL_OS_Free((void **)&(*ppevent)->pAlertText); |
|---|
| 360 | if((*ppevent)->pException) |
|---|
| 361 | DHL_OS_Free((void **)&(*ppevent)->pException); |
|---|
| 362 | if((*ppevent)->pDescriptors) |
|---|
| 363 | DHL_OS_Free((void **)&(*ppevent)->pDescriptors); |
|---|
| 364 | |
|---|
| 365 | DHL_OS_Free((void **)ppevent); |
|---|
| 366 | } |
|---|
| 367 | |
|---|
| 368 | static UINT32 p_get_cur_time() |
|---|
| 369 | { |
|---|
| 370 | UINT32 utc; |
|---|
| 371 | int err; |
|---|
| 372 | |
|---|
| 373 | err = DMW_GetUTCTime(NULL, &utc); |
|---|
| 374 | if (err != statusOK) return 0; |
|---|
| 375 | |
|---|
| 376 | return utc; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | |
|---|
| 380 | static BOOL p_ea_check_event(EA_EVENT *event) |
|---|
| 381 | { |
|---|
| 382 | int i; |
|---|
| 383 | int ch_mj=0, ch_mn=0, ch_rf=0; |
|---|
| 384 | UINT32 cur_time=p_get_cur_time(); |
|---|
| 385 | |
|---|
| 386 | p_ea_print_info(event); |
|---|
| 387 | |
|---|
| 388 | /* expiredµÈ event°¡ ÀÖ´Ù¸é Áö¿î´Ù. */ |
|---|
| 389 | for(i=0; i<MAX_STORED_EVENT; i++) { |
|---|
| 390 | if(STORED(i).eaEventId != 255) { |
|---|
| 391 | if(STORED(i).endTime < cur_time) { |
|---|
| 392 | STORED(i).eaEventId=255; |
|---|
| 393 | } |
|---|
| 394 | } |
|---|
| 395 | } |
|---|
| 396 | |
|---|
| 397 | #if EA_CHECK_STORED_EA_EVENT /* Å×½ºÆ® Áß ¸·¾Æ³õÀ½. */ |
|---|
| 398 | /* 1. regd eventÁß °°Àº event id°¡ ÀÖ´ÂÁö È®ÀÎÇÑ´Ù. |
|---|
| 399 | event ID¿Í */ |
|---|
| 400 | for(i=0; i<MAX_STORED_EVENT; i++) { |
|---|
| 401 | if((STORED(i).eaEventId == event->eventId) && |
|---|
| 402 | STORED(i).alertTextLen == event->alertTextLen && |
|---|
| 403 | STORED(i).priority == event->priority) { /* ½ÇÆÐ.. */ |
|---|
| 404 | dprint(1, "same event id is detected..\n"); |
|---|
| 405 | goto EaEventDeny; |
|---|
| 406 | } |
|---|
| 407 | } |
|---|
| 408 | #endif |
|---|
| 409 | |
|---|
| 410 | /* exception list¿¡ ÇöÀç ä³ÎÀÌ ÀÖ´ÂÁö ¾ø´ÂÁö¸¦ ÆÇ´ÜÇÑ´Ù. */ |
|---|
| 411 | p_get_ch_info(&ch_mj, &ch_mn, &ch_rf); |
|---|
| 412 | |
|---|
| 413 | for(i=0; i < event->exceptionCnt ; i++) { |
|---|
| 414 | if(event->pException[i].bInband) { |
|---|
| 415 | |
|---|
| 416 | |
|---|
| 417 | UINT32 major=event->pException[i].attr1; |
|---|
| 418 | UINT32 minor=event->pException[i].attr2; |
|---|
| 419 | |
|---|
| 420 | if(IsOnePartChannelNumber(major)) { |
|---|
| 421 | major = ConvertToOnePartChannelNumber(major, minor); |
|---|
| 422 | minor = ONE_PART_CHANNEL_INDICATOR; |
|---|
| 423 | } |
|---|
| 424 | |
|---|
| 425 | dprint(1, "EA_MAJOR(%d), major(%d),,,EA_MINOR(%d), minor(%d)\n", |
|---|
| 426 | ch_mj, major, ch_mn, minor); |
|---|
| 427 | |
|---|
| 428 | if(ch_mj == major && ch_mn == minor) { /* ÇöÀç ä³ÎÀÌ exception ä³ÎÀÎ °æ¿ì */ |
|---|
| 429 | dprint(1, "EA Event Check Fails..Exception Channel\n"); |
|---|
| 430 | goto EaEventDeny; |
|---|
| 431 | } |
|---|
| 432 | |
|---|
| 433 | /* ¾Æ·¡ ÄÚµå´Â ¹¹·¡? Àß ¸ð¸£°ÚÀ½. */ |
|---|
| 434 | if (ch_mj == 0 && major == ch_rf && minor == ch_mn) { |
|---|
| 435 | dprint(1, "EA Event Check Fails..Exception Channel\n"); |
|---|
| 436 | goto EaEventDeny; |
|---|
| 437 | } |
|---|
| 438 | } |
|---|
| 439 | else { |
|---|
| 440 | /* TODO : oob¿¡ ´ëÇØ¼´Â...³ªÁß¿¡ ±¸ÇöÇÑ´Ù. */ |
|---|
| 441 | } |
|---|
| 442 | } |
|---|
| 443 | |
|---|
| 444 | |
|---|
| 445 | #if !EA_TEST_DENY_PRIO |
|---|
| 446 | /* ALERT PRIORITY üũ */ |
|---|
| 447 | if(event->priority == 0) { /* ´Ü¼ø Å×½ºÆ®¿ë */ |
|---|
| 448 | goto EaEventDeny; |
|---|
| 449 | } |
|---|
| 450 | else if(event->priority <= 3) { /* Low Priority */ |
|---|
| 451 | if(!INFO(low_on)) goto EaEventDeny; |
|---|
| 452 | } |
|---|
| 453 | else if(event->priority <= 7) { /* Medium Priority */ |
|---|
| 454 | if(!INFO(medium_on)) goto EaEventDeny; |
|---|
| 455 | } |
|---|
| 456 | #endif |
|---|
| 457 | |
|---|
| 458 | /* modify¸¦ ÇØ ÁÖÀÚ.. */ |
|---|
| 459 | if(event->timeRemaining==0) /* Á¤Çϱ⠳ª¸§.. */ |
|---|
| 460 | event->timeRemaining=INDEF_TIME_REMAIN; |
|---|
| 461 | |
|---|
| 462 | if(event->duration==0) |
|---|
| 463 | event->duration=INDEF_DURATION*60; |
|---|
| 464 | return TRUE; |
|---|
| 465 | |
|---|
| 466 | EaEventDeny : |
|---|
| 467 | p_release_ea_event(&event); |
|---|
| 468 | return FALSE; |
|---|
| 469 | } |
|---|
| 470 | |
|---|
| 471 | |
|---|
| 472 | BOOL p_get_ch_by_src_id(int src_id, int *major, int *minor) |
|---|
| 473 | { |
|---|
| 474 | int i; |
|---|
| 475 | |
|---|
| 476 | DMW_MSC_LockUcm(); |
|---|
| 477 | |
|---|
| 478 | for (i=0; i<g_UCM_number; i++) |
|---|
| 479 | { |
|---|
| 480 | if(g_UCM[i].source_id==src_id) { |
|---|
| 481 | if(major) *major=g_UCM[i].Major; |
|---|
| 482 | if(minor) *minor=g_UCM[i].Minor; |
|---|
| 483 | DMW_MSC_UnlockUcm(); |
|---|
| 484 | return TRUE; |
|---|
| 485 | } |
|---|
| 486 | } |
|---|
| 487 | |
|---|
| 488 | DMW_MSC_UnlockUcm(); |
|---|
| 489 | return FALSE; |
|---|
| 490 | } |
|---|
| 491 | |
|---|
| 492 | |
|---|
| 493 | |
|---|
| 494 | /****************************************************************************************** |
|---|
| 495 | FUNCTION: |
|---|
| 496 | - p_ea_adjust_ch_info |
|---|
| 497 | |
|---|
| 498 | Purpose: |
|---|
| 499 | - |
|---|
| 500 | ******************************************************************************************/ |
|---|
| 501 | static void p_ea_adjust_ch_info(EA_EVENT *event) |
|---|
| 502 | { |
|---|
| 503 | if(event->priority < 12) { /* ÀÌ °æ¿ì Æ©´×Àº ÀϾÁö ¾ÊÀ½. */ |
|---|
| 504 | event->detailMajor=0; |
|---|
| 505 | event->detailMinor=0; |
|---|
| 506 | event->detailSrcId=0; |
|---|
| 507 | } |
|---|
| 508 | |
|---|
| 509 | if(event->detailSrcId) { |
|---|
| 510 | int major, minor; |
|---|
| 511 | |
|---|
| 512 | p_get_ch_by_src_id(event->detailSrcId, &major, &minor); |
|---|
| 513 | event->detailMajor=major; |
|---|
| 514 | event->detailMinor=minor; |
|---|
| 515 | } |
|---|
| 516 | |
|---|
| 517 | if(event->audioSrcId) { /* audio src id°¡ detail src idº¸´Ù ´õ priority°¡ ³ôÀº°¡? */ |
|---|
| 518 | int major, minor; |
|---|
| 519 | |
|---|
| 520 | p_get_ch_by_src_id(event->detailSrcId, &major, &minor); |
|---|
| 521 | event->detailMajor=major; |
|---|
| 522 | event->detailMinor=minor; |
|---|
| 523 | } |
|---|
| 524 | } |
|---|
| 525 | |
|---|
| 526 | static BOOL p_get_ea_info(EA_EVENT *event, eApp_EAInfo *pinfo) |
|---|
| 527 | { |
|---|
| 528 | eApp_EAInfo info; |
|---|
| 529 | |
|---|
| 530 | info.btune=FALSE; |
|---|
| 531 | info.bscroll=FALSE; |
|---|
| 532 | info.priority=0; |
|---|
| 533 | |
|---|
| 534 | *pinfo=info; |
|---|
| 535 | |
|---|
| 536 | if(!event) return FALSE; |
|---|
| 537 | |
|---|
| 538 | //priority Á¶°Ç |
|---|
| 539 | info.priority=event->priority; |
|---|
| 540 | |
|---|
| 541 | /* ch tuning Á¶°Ç °Ë»ö */ |
|---|
| 542 | { |
|---|
| 543 | int uid=-1, flag; |
|---|
| 544 | DST_CURCHANNEL ch_info; |
|---|
| 545 | |
|---|
| 546 | flag = CSF_ATSC_Only | CSF_Include_PSI | CSF_Include_Skipped | CSF_Include_Hidden; |
|---|
| 547 | DMW_MSC_FindChannelMajorMinor(event->detailMajor, event->detailMinor, flag, 1, &uid); |
|---|
| 548 | |
|---|
| 549 | App_Ucm_GetCurChInfo(&ch_info); |
|---|
| 550 | |
|---|
| 551 | if(event->detailMajor && (uid != ch_info.nUid)) { |
|---|
| 552 | info.btune=TRUE; |
|---|
| 553 | info.major=event->detailMajor; |
|---|
| 554 | info.minor=event->detailMinor; |
|---|
| 555 | } |
|---|
| 556 | } |
|---|
| 557 | |
|---|
| 558 | /* scrolling Á¶°Ç. */ |
|---|
| 559 | if(event->alertTextLen>6) { |
|---|
| 560 | int str_len; |
|---|
| 561 | info.bscroll=TRUE; |
|---|
| 562 | |
|---|
| 563 | //text.. |
|---|
| 564 | str_len=DLIB_PSI_DecodeMultipleStringStructure( |
|---|
| 565 | event->alertTextLen, (UINT8 *)event->pAlertText, "eng", |
|---|
| 566 | EA_MAX_TEXT_LEN-1, (UINT16 *)info.text); |
|---|
| 567 | |
|---|
| 568 | if(str_len<=0) info.text[0]='\0'; |
|---|
| 569 | else info.text[str_len]='\0'; |
|---|
| 570 | } |
|---|
| 571 | |
|---|
| 572 | info.remain=event->timeRemaining; |
|---|
| 573 | |
|---|
| 574 | *pinfo=info; |
|---|
| 575 | |
|---|
| 576 | return TRUE; |
|---|
| 577 | } |
|---|
| 578 | |
|---|
| 579 | |
|---|
| 580 | #if COMMENT |
|---|
| 581 | __EA_Exec_Proc__() {} |
|---|
| 582 | #endif |
|---|
| 583 | |
|---|
| 584 | static UINT16 *p_get_str(UINT8 *pstr, UINT16 len, UINT16 max_len, UINT16 *temp) |
|---|
| 585 | { |
|---|
| 586 | int mstr_len; |
|---|
| 587 | |
|---|
| 588 | mstr_len=DLIB_PSI_DecodeMultipleStringStructure(len, pstr, "eng", max_len, temp); |
|---|
| 589 | |
|---|
| 590 | if(mstr_len<=0) |
|---|
| 591 | mstr_len=DLIB_PSI_DecodeMultipleStringStructure(len, pstr, "kor", max_len, temp); |
|---|
| 592 | |
|---|
| 593 | if(mstr_len<=0) temp[0]='\0'; |
|---|
| 594 | else temp[mstr_len]='\0'; |
|---|
| 595 | |
|---|
| 596 | return temp; |
|---|
| 597 | } |
|---|
| 598 | |
|---|
| 599 | static void ea_stop_tune(UINT32 id, UINT32 param) |
|---|
| 600 | { |
|---|
| 601 | AppF_EARestoreTune(); |
|---|
| 602 | INFO(now_tuning)=FALSE; |
|---|
| 603 | |
|---|
| 604 | if(!INFO(now_scrolling) && !INFO(now_tuning)) { |
|---|
| 605 | //¸ðµÎ ¾øÀ¸¸é ea Áö¿ò. |
|---|
| 606 | if(INFO(cur_event)) |
|---|
| 607 | p_release_ea_event(&INFO(cur_event)); |
|---|
| 608 | INFO(cur_event)=NULL; |
|---|
| 609 | } |
|---|
| 610 | } |
|---|
| 611 | |
|---|
| 612 | static void ea_exec(UINT32 id, UINT32 param) |
|---|
| 613 | { |
|---|
| 614 | eApp_EAInfo cur, prev; |
|---|
| 615 | EA_EVENT *pevent=(EA_EVENT *)param; |
|---|
| 616 | |
|---|
| 617 | /* ea event À¯È¿¼º °Ë»ç */ |
|---|
| 618 | if(!p_ea_check_event(pevent)) { |
|---|
| 619 | dprint(1, "[EA] EA event check failed..\n"); |
|---|
| 620 | return; |
|---|
| 621 | } |
|---|
| 622 | |
|---|
| 623 | /* ea event °ª Á¶Àý */ |
|---|
| 624 | p_ea_adjust_ch_info(pevent); |
|---|
| 625 | |
|---|
| 626 | //ÀÌÀü ea¿Í ÇöÀç ea¸¦ ºñ±³ÇÔ.. |
|---|
| 627 | p_get_ea_info(pevent, &cur); |
|---|
| 628 | p_get_ea_info(INFO(cur_event), &prev); |
|---|
| 629 | |
|---|
| 630 | if(cur.btune || cur.bscroll) { //»õ·Î¿î ¸Þ½ÃÁö°¡ ³¯¶ó¿È. |
|---|
| 631 | if(cur.priority>prev.priority || (!prev.bscroll && !prev.btune)) { //priority°¡ ´õ Å« ³ðÀÌ ¿ÔÀ½. |
|---|
| 632 | |
|---|
| 633 | //tune ÁßÁö. |
|---|
| 634 | if(INFO(now_tuning)) { |
|---|
| 635 | AppF_EARestoreTune(); |
|---|
| 636 | DMG_KillTimer(TIMER_ID_EA_TUNE); |
|---|
| 637 | INFO(now_tuning)=FALSE; |
|---|
| 638 | } |
|---|
| 639 | |
|---|
| 640 | if(INFO(now_scrolling)) { |
|---|
| 641 | //scrollÀº ¾î¶»°Ô ÇØ¾ß ÇÔ?? -> event¸¦ º¸³»ÀÚ. |
|---|
| 642 | DMG_SetUserDefined(UD_ID_EA_CMD, UD_ID_EA_SCROLL_STOP, 0); |
|---|
| 643 | INFO(now_scrolling)=FALSE; |
|---|
| 644 | } |
|---|
| 645 | |
|---|
| 646 | //ÀÌÀü EA ¾ø¾Ö±â. |
|---|
| 647 | if(INFO(cur_event)) |
|---|
| 648 | p_release_ea_event(&INFO(cur_event)); |
|---|
| 649 | INFO(cur_event)=pevent; |
|---|
| 650 | |
|---|
| 651 | INFO(tm_start_tune)=DHL_OS_GetMsCount(); |
|---|
| 652 | |
|---|
| 653 | /* TODO : tune°ú scrollÀ» µ¿½Ã¿¡ ÁøÇàÇÒ ¼ö ÀÖÀ½? |
|---|
| 654 | ¾Æ´Ï¸é tuneÀÌ µÇ¸é scrollÀº ¹«½ÃµÇ¾î¾ß ÇÔ? */ |
|---|
| 655 | if(cur.btune) { |
|---|
| 656 | |
|---|
| 657 | //timer°ªÀ» º¸Á¤ÇØÁÜ. |
|---|
| 658 | pevent->timeRemaining+=TIME_REMAIN_ADJUST_VAL; |
|---|
| 659 | |
|---|
| 660 | AppF_EATune(cur.major, cur.minor); |
|---|
| 661 | //tuning ÁßÁö¸¦ À§ÇÑ timer ±¸µ¿ ÇÊ¿ä. |
|---|
| 662 | //DMG_SetTimer(TIMER_ID_EA_TUNE, cur.remain*1000, eDMG_CMD_OPT_TIMER_ONESHOT); |
|---|
| 663 | DMW_SYS_SetTimer(TIMER_ID_EA_RELEASE, pevent->timeRemaining*1000, |
|---|
| 664 | (DMW_TIMER_PROC)ea_stop_tune, 0, TRUE); |
|---|
| 665 | INFO(now_tuning)=TRUE; |
|---|
| 666 | |
|---|
| 667 | dprint(0, "new event is incoming..remain(%d)\n", |
|---|
| 668 | cur.remain); |
|---|
| 669 | } |
|---|
| 670 | |
|---|
| 671 | if(cur.bscroll) { |
|---|
| 672 | DMG_SetUserDefined(UD_ID_EA_CMD, UD_ID_EA_SCROLL_START, 0); |
|---|
| 673 | } |
|---|
| 674 | |
|---|
| 675 | } |
|---|
| 676 | else if(prev.id==cur.id) { //id°¡ µ¿ÀÏÇϰí prioµµ °°´Ù¸é time ¿¬Àå |
|---|
| 677 | if(INFO(cur_event)) |
|---|
| 678 | INFO(cur_event)->timeRemaining+=pevent->timeRemaining; |
|---|
| 679 | |
|---|
| 680 | if(prev.btune) { |
|---|
| 681 | //Èê·¯°£ ½Ã°£À» »©°í ´Ù½Ã set_timer ÇÔ. |
|---|
| 682 | int remain=INFO(cur_event)->timeRemaining*1000- |
|---|
| 683 | (DHL_OS_GetMsCount()-INFO(tm_start_tune)); |
|---|
| 684 | |
|---|
| 685 | if(remain>0) //remainÀÌ 0º¸´Ù ÀÛÀ¸¸é ¹«½ÃÇÔ. |
|---|
| 686 | //DMG_SetTimer(TIMER_ID_EA_TUNE, remain, eDMG_CMD_OPT_TIMER_ONESHOT); |
|---|
| 687 | DMW_SYS_SetTimer(TIMER_ID_EA_RELEASE, remain, |
|---|
| 688 | (DMW_TIMER_PROC)ea_stop_tune, 0, TRUE); |
|---|
| 689 | |
|---|
| 690 | dprint(0, "new event is incoming and cur ea id is same as prev\n" |
|---|
| 691 | "so remain time expands to %d(+%d)(remain sec:%d)\n", |
|---|
| 692 | INFO(cur_event)->timeRemaining, pevent->timeRemaining, remain); |
|---|
| 693 | } |
|---|
| 694 | if(prev.bscroll) { |
|---|
| 695 | DMG_SetUserDefined(UD_ID_EA_CMD, UD_ID_EA_SCROLL_UPDATE, 0); |
|---|
| 696 | } |
|---|
| 697 | } |
|---|
| 698 | } |
|---|
| 699 | } |
|---|
| 700 | |
|---|
| 701 | |
|---|
| 702 | static void p_event_proc(tDHL_PSI_Event event, tDHL_PSI_ControlHandle handle, |
|---|
| 703 | UINT32 userParam) |
|---|
| 704 | { |
|---|
| 705 | tDHL_PSI_DataArray *desc; |
|---|
| 706 | DHL_RESULT err; |
|---|
| 707 | EA_EVENT *pea_event; |
|---|
| 708 | |
|---|
| 709 | /* dprint(1, "in the easSyncEventProc....\n"); */ |
|---|
| 710 | switch (event) { |
|---|
| 711 | case ePSIEVENT_DATARECEIVED: |
|---|
| 712 | err = DHL_PSI_ReadPSIData(INFO(ctrl), &desc); /*desc¸¦ »ç¿ëÇϰí ÇØÁ¦ÇؾßÇÔ. */ |
|---|
| 713 | if(!err) { |
|---|
| 714 | /* desc¸¦ parsingÇϰí, queue¿¡ Áý¾î³Ö´Â ÄÚµå... */ |
|---|
| 715 | err=p_parse_ea_event(desc->sectPtr[0], &pea_event); |
|---|
| 716 | if(!err) { |
|---|
| 717 | |
|---|
| 718 | //timer task·Î ¿Å±â´Â °Ô ÁÁ°Ú´Ù. |
|---|
| 719 | DMW_SYS_SetTimer(TIMER_ID_GET_EA, 0, (DMW_TIMER_PROC)ea_exec, (UINT32)pea_event, TRUE); |
|---|
| 720 | //ea_exec(0, pea_event); |
|---|
| 721 | } |
|---|
| 722 | |
|---|
| 723 | } |
|---|
| 724 | if(desc) |
|---|
| 725 | DHL_PSI_FreePSIData(desc); |
|---|
| 726 | break; |
|---|
| 727 | |
|---|
| 728 | case ePSIEVENT_SCRAMBLEDERROR: |
|---|
| 729 | break; |
|---|
| 730 | |
|---|
| 731 | default: |
|---|
| 732 | break; |
|---|
| 733 | } |
|---|
| 734 | |
|---|
| 735 | } |
|---|
| 736 | |
|---|
| 737 | void AppF_EAMonStart() |
|---|
| 738 | { |
|---|
| 739 | if(INFO(bmon_started)) return; |
|---|
| 740 | |
|---|
| 741 | MonitorEAS(DHL_DMX_GetTsd(), ePSIUPDATE_CRCCHANGE, p_event_proc, 0, &INFO(ctrl)); |
|---|
| 742 | INFO(bmon_started)=TRUE; |
|---|
| 743 | } |
|---|
| 744 | |
|---|
| 745 | void AppF_EAMonStop() |
|---|
| 746 | { |
|---|
| 747 | if(INFO(bmon_started)) |
|---|
| 748 | DHL_PSI_StopMonitor(INFO(ctrl)); |
|---|
| 749 | |
|---|
| 750 | INFO(bmon_started)=FALSE; |
|---|
| 751 | |
|---|
| 752 | AppF_EAStop(); //monitor¸¦ stopÇϸé eaÀÇ ¸ðµç ±â´ÉÀ» ÁßÁöÇÑ´Ù. |
|---|
| 753 | } |
|---|
| 754 | |
|---|
| 755 | /* EA°¡ ¼ö½ÅµÇ¾ú´Ù´Â À̺¥Æ®¸¦ ¹ÞÀ¸¸é ¾Æ·¡ ÇÔ¼ö¸¦ È£ÃâÇÏ¿© ÇöÀç EVENT¸¦ ¾ò¾î¿È |
|---|
| 756 | */ |
|---|
| 757 | BOOL AppF_GetCurEAInfo(eApp_EAInfo *pinfo) |
|---|
| 758 | { |
|---|
| 759 | BOOL bret; |
|---|
| 760 | |
|---|
| 761 | bret=p_get_ea_info(INFO(cur_event), pinfo); |
|---|
| 762 | |
|---|
| 763 | pinfo->remain-=(DHL_OS_GetMsCount()-INFO(tm_start_tune))/1000; |
|---|
| 764 | //½ÃÀÛ ½ÃÁ¡ºÎÅÍ ¾ó¸¶¸¸ÅÀÇ ½Ã°£ÀÌ Áö³µ´ÂÁö¸¦ ¾Ë·ÁÁÜ. |
|---|
| 765 | |
|---|
| 766 | return bret; |
|---|
| 767 | } |
|---|
| 768 | |
|---|
| 769 | void AppF_EATune(int major, int minor) |
|---|
| 770 | { |
|---|
| 771 | int nUid, uid; |
|---|
| 772 | int flag=0; |
|---|
| 773 | DST_CURCHANNEL ch_info; |
|---|
| 774 | |
|---|
| 775 | flag = CSF_ATSC_Only | CSF_Include_PSI | CSF_Include_Skipped | CSF_Include_Hidden; |
|---|
| 776 | nUid=DMW_MSC_FindChannelMajorMinor(major, minor, flag, 1, &uid); |
|---|
| 777 | |
|---|
| 778 | if (nUid < 1 || uid <= 0) { /* 0630 neverdai modify */ |
|---|
| 779 | DHL_OS_Printf("[EA] Tuning Fails..\n"); |
|---|
| 780 | |
|---|
| 781 | INFO(prev_major)=0; |
|---|
| 782 | INFO(prev_minor)=0; |
|---|
| 783 | |
|---|
| 784 | return; |
|---|
| 785 | } |
|---|
| 786 | |
|---|
| 787 | App_Ucm_GetCurChInfo(&ch_info); |
|---|
| 788 | |
|---|
| 789 | if (uid != ch_info.nUid) |
|---|
| 790 | { |
|---|
| 791 | App_CancelSyncSTT(); |
|---|
| 792 | App_EpgUpdateCancel(); |
|---|
| 793 | |
|---|
| 794 | DCC_Exit(); |
|---|
| 795 | |
|---|
| 796 | /* cafrii 060713 comment, Ç×»ó pause sm ÇÏ°í ³ª¼ stop video¸¦ ÇÑ´Ù. */ |
|---|
| 797 | App_Pause_SMTask(); |
|---|
| 798 | |
|---|
| 799 | /* neverdai 0714 add */ |
|---|
| 800 | /* App_EAMonStop; */ |
|---|
| 801 | |
|---|
| 802 | Dmc_StopVideo(); /* cafrii 060710 add */ |
|---|
| 803 | |
|---|
| 804 | /* cafrii 060623 add |
|---|
| 805 | ÀÌÀü ä³Î Æ©´×À» À§ÇÑ Á¤º¸ ÀúÀåÇÑ´Ù. */ |
|---|
| 806 | App_SetPrevChannelInfo(); |
|---|
| 807 | /* |
|---|
| 808 | ä³Î º¹±¸¸¦ À§ÇØ Á¤º¸¸¦ NVM¿¡ ÀúÀåÇÑ´Ù. |
|---|
| 809 | ÁÖÀÇ: |
|---|
| 810 | ÀÌ UidTune ÇÔ¼ö°¡ »ç¿ëÀÚÀÇ Àǵµ¿¡ ÀÇÇØ È£ÃâµÈ °æ¿ì¿¡¸¸ ÀúÀåÇÑ´Ù. |
|---|
| 811 | ¿¹¸¦ µé¾î EA force tuneÀÇ °æ¿ì¿¡´Â ÀúÀåÇÏ¸é ¾ÈµÈ´Ù. (ÀÌ ÇÔ¼ö »ç¿ë ºÒ°¡) |
|---|
| 812 | Signal monitor¿¡¼ Æ©´×ÇÏ´Â °æ¿ì¿¡´Â ±»ÀÌ ÇÒ ÇÊ¿ä´Â ¾ø´Ù. |
|---|
| 813 | ä³Î º¹±¸ÀÇ Æ©´×Àº µ¿ÀÏÇÑ Á¤º¸¸¦ ±×´ë·Î ¶Ç ÀúÀåÇÏ´Â ²ÃÀε¥, ¹®Á¦´Â ¾ÈµÈ´Ù. |
|---|
| 814 | ¿¹: last channel uid°¡ 3, ºÎÆÃÇÏ¸é¼ 3À» Æ©´×Çϴµ¥ À̶§ 3À» ¶Ç ÀúÀå. |
|---|
| 815 | ÀÌÀü ä³Î Æ©´×À» ÇÏ´Â °æ¿ì¿¡´Â Æ©´×ÇÏ°Ô µÉ ä³ÎÀÌ ÀÌÀü ä³ÎÀÌ´Ù. ¹®Á¦ ¾øÀ½. |
|---|
| 816 | */ |
|---|
| 817 | /* App_SaveLastChannelInfo(0, 0, uid); */ |
|---|
| 818 | |
|---|
| 819 | /* |
|---|
| 820 | todo |
|---|
| 821 | Ȥ½Ã DB°¡ ¸Á°¡Áú °æ¿ì¸¦ ´ëºñÇØ¼ RF, PN µîµµ ÀúÀåÇÏ´Â°Ô ÁÁÀ» µí.. |
|---|
| 822 | ¼ø¼ Áß¿ä. ¸ÕÀú À§¿¡¼ ÇöÀç/ÀÌÀü ä³Î ÀúÀåÇϰí, |
|---|
| 823 | ±× ´ÙÀ½¿¡ Æ©´×ÇÒ Ã¤³Î ¼³Á¤. |
|---|
| 824 | */ |
|---|
| 825 | App_UpdateUidChannelParam(uid); |
|---|
| 826 | |
|---|
| 827 | /* g_App_LastTuneResult = statusInvalidState; */ |
|---|
| 828 | /* ÀÌ º¯¼ö´Â tuneÀÌ ¿ÏÀüÈ÷ ³¡³ ÈÄ callback¿¡¼ updateµÈ´Ù. */ |
|---|
| 829 | |
|---|
| 830 | /* DMW_TUN_TuneChannelByUid(nUID, 1, FALSE, _AppChannelTuneCallback, 0); */ |
|---|
| 831 | flag=CTF_ShowHiddenChannelAlso | CTF_SkipPrescanPidInfo; |
|---|
| 832 | DMW_TUN_TuneChannelByUidAndFlag(uid, flag, FALSE, NULL, 0); |
|---|
| 833 | |
|---|
| 834 | dprint(1, "[INFORM] App_TuneChannelByUid (%d) Complete!!!\n", uid); |
|---|
| 835 | } |
|---|
| 836 | |
|---|
| 837 | INFO(prev_major)=ch_info.nMajor; |
|---|
| 838 | INFO(prev_minor)=ch_info.nMinor; |
|---|
| 839 | } |
|---|
| 840 | |
|---|
| 841 | void AppF_EARestoreTune() |
|---|
| 842 | { |
|---|
| 843 | if(INFO(prev_major)==0 && INFO(prev_minor)==0) return; |
|---|
| 844 | |
|---|
| 845 | AppF_EATune(INFO(prev_major), INFO(prev_minor)); |
|---|
| 846 | |
|---|
| 847 | INFO(prev_major)=0; |
|---|
| 848 | INFO(prev_minor)=0; |
|---|
| 849 | } |
|---|
| 850 | |
|---|
| 851 | void AppF_EAStop() |
|---|
| 852 | { |
|---|
| 853 | eApp_EAInfo cur; |
|---|
| 854 | //scroll stop |
|---|
| 855 | AppF_GetCurEAInfo(&cur); |
|---|
| 856 | |
|---|
| 857 | if(cur.bscroll) { |
|---|
| 858 | DMG_SetUserDefined(UD_ID_EA_CMD, UD_ID_EA_SCROLL_STOP, 0); |
|---|
| 859 | INFO(now_scrolling)=FALSE; |
|---|
| 860 | } |
|---|
| 861 | |
|---|
| 862 | if(cur.btune) { |
|---|
| 863 | DMG_KillTimer(TIMER_ID_EA_TUNE); |
|---|
| 864 | } |
|---|
| 865 | |
|---|
| 866 | if(INFO(cur_event)) |
|---|
| 867 | p_release_ea_event(&INFO(cur_event)); |
|---|
| 868 | INFO(cur_event)=NULL; |
|---|
| 869 | } |
|---|
| 870 | |
|---|
| 871 | void AppF_SetEAScroll(BOOL bon) |
|---|
| 872 | { |
|---|
| 873 | INFO(now_scrolling)=bon; |
|---|
| 874 | |
|---|
| 875 | if(!INFO(now_scrolling) && !INFO(now_tuning)) { |
|---|
| 876 | //¸ðµÎ ¾øÀ¸¸é ea Áö¿ò. |
|---|
| 877 | if(INFO(cur_event)) |
|---|
| 878 | p_release_ea_event(&INFO(cur_event)); |
|---|
| 879 | INFO(cur_event)=NULL; |
|---|
| 880 | } |
|---|
| 881 | } |
|---|
| 882 | |
|---|
| 883 | static struct |
|---|
| 884 | { |
|---|
| 885 | UINT8 prio_low:1; |
|---|
| 886 | UINT8 prio_medium:1; |
|---|
| 887 | } p_ea_nvm_param; |
|---|
| 888 | |
|---|
| 889 | void AppF_EASetLow(BOOL bon) |
|---|
| 890 | { |
|---|
| 891 | INFO(low_on)=bon; |
|---|
| 892 | |
|---|
| 893 | p_ea_nvm_param.prio_low=bon?1:0; |
|---|
| 894 | App_NVM_SaveModuleParam(eAPP_NVR_EA, &p_ea_nvm_param); |
|---|
| 895 | } |
|---|
| 896 | |
|---|
| 897 | void AppF_EASetMedium(BOOL bon) |
|---|
| 898 | { |
|---|
| 899 | INFO(medium_on)=bon; |
|---|
| 900 | p_ea_nvm_param.prio_medium=bon?1:0; |
|---|
| 901 | App_NVM_SaveModuleParam(eAPP_NVR_EA, &p_ea_nvm_param); |
|---|
| 902 | } |
|---|
| 903 | |
|---|
| 904 | BOOL AppF_IsEALow() |
|---|
| 905 | { |
|---|
| 906 | return INFO(low_on); |
|---|
| 907 | } |
|---|
| 908 | |
|---|
| 909 | BOOL AppF_IsEAMedium() |
|---|
| 910 | { |
|---|
| 911 | return INFO(medium_on); |
|---|
| 912 | } |
|---|
| 913 | |
|---|
| 914 | void AppF_EAInit() |
|---|
| 915 | { |
|---|
| 916 | App_NVM_LoadModuleParam(eAPP_NVR_EA, &p_ea_nvm_param); |
|---|
| 917 | |
|---|
| 918 | INFO(low_on)=p_ea_nvm_param.prio_low; |
|---|
| 919 | INFO(medium_on)=p_ea_nvm_param.prio_medium; |
|---|
| 920 | } |
|---|
| 921 | |
|---|
| 922 | static void p_format_ea_param() |
|---|
| 923 | { |
|---|
| 924 | p_ea_nvm_param.prio_low=TRUE; |
|---|
| 925 | p_ea_nvm_param.prio_medium=TRUE; |
|---|
| 926 | App_NVM_SaveModuleParam(eAPP_NVR_EA, &p_ea_nvm_param); |
|---|
| 927 | } |
|---|
| 928 | |
|---|
| 929 | void AppF_EAParamInit(void) |
|---|
| 930 | { |
|---|
| 931 | App_NVM_RegisterModule(eAPP_NVR_EA, sizeof(p_ea_nvm_param), p_format_ea_param); |
|---|
| 932 | } |
|---|
| 933 | |
|---|
| 934 | |
|---|
| 935 | //ea nvram. |
|---|
| 936 | |
|---|
| 937 | |
|---|