#include "DST_UserInterface.h" #include "DST_ChannelTune.h" #include "DST_HostInterface.h" #include "DST_WinManagerTask.h" #include "DST_CommonAPI.h" #include "DST_DataStrings.h" #include "DST_FontEngine.h" #include "DST_WinManager.h" #include "DST_DB.h" void DST_Tune(DS_U8 RF, DS_U16 program_number); void DST_Scan(DS_U8 RF); void CT_AudioVolume(DS_U8 nVal); #if 0 ____Channel_UI___() #endif // ¸Þ´ºÀÇ ¸¶Áö¸· ¿ÀÅ佺ĵ ¸ðµå¸¦ ±â¾ïÇÑ´Ù. static DS_U8 DST_g_ChannelScanMode = 1; // 0: Update, 1:Re-Scan DS_U8 DST_UI_GetAutoSearchMode(void) { return (DST_g_ChannelScanMode == 0) ? 0 : 1; } void DST_UI_SetAutoSearchMode(DS_U8 value) { DST_g_ChannelScanMode = value; } // ä³Î ¾÷´Ù¿î ÇÔ¼ö void DST_UI_ChannelUpDn(bool bUp) { DST_DB_ChannelUpDn(bUp); } // ä³Î Æ©´×À» ÇÑ´Ù. void DST_UI_ChannelTune(DS_U8 RF, DS_U16 program_number) { T(); DST_Printf("RF = %d program_number=%d\n", RF, program_number); if(RF != DST_EEPROM_GetRF() || program_number != DST_EEPROM_GetProgramNumber()) { DST_g_PrevRF = DST_EEPROM_GetRF(); DST_g_PrevProgramNumber = DST_EEPROM_GetProgramNumber(); } DST_EEPROM_SetRF(RF); DST_EEPROM_SetProgramNumber(program_number); if (DST_g_LastTuneTryTime > DST_OS_GetTickCount()) DST_g_LastTuneTryTime = DST_OS_GetTickCount(); DST_g_SignalState = SM_WAIT_SIGNAL; DST_Tune(RF, program_number); DST_CreateWin(WIN_CHANNEL_BANNER, WIN_NULL, BANNER_NORMAL, 3); } // ä³Î Æ©´×À» ÇÑ´Ù. void DST_UI_Scan(DS_U8 RF) { DST_Scan(RF); } #if 0 ____Settings_UI___() #endif // 0: ÀÚµ¿ 1: Ç®¼¼±×°íÁ¤ 2:¿ø¼¼±× °íÁ¤ DS_U8 DST_UI_GetTuneMode(void) { return DST_EEPROM_GetTuneMode(); } // Æ©´× ¸ðµå¸¦ ¼³Á¤ÇÑ´Ù. void DST_UI_SetTuneMode(DS_U8 value) { if (DST_EEPROM_GetTuneMode() == value) return; DST_EEPROM_SetTuneMode(value); DST_DB_ChannelUpDn(true); DST_DB_ChannelUpDn(false); //DST_UI_ChannelTune(DST_EEPROM_GetRF(), DST_EEPROM_GetProgramNumber(), DST_EEPROM_GetTuneMode()); } // MTS Setting (0) Çѱ¹¾î (1) ¿Ü±¹¾î DS_U8 DST_UI_GetMTS() { return DST_EEPROM_GetAudioPref(); } void DST_UI_SetMTS( DS_U8 nVal) { DST_EEPROM_SetAudioPref(nVal); DST_g_AudioSettingChanged = true; } // VI Setting (0) Off (1) On DS_U8 DST_UI_GetVI() { return DST_EEPROM_GetVI(); } void DST_UI_SetVI( DS_U8 nVal) { DST_EEPROM_SetVI(nVal); DST_g_AudioSettingChanged = true; } // CC ¼³Á¤ void DST_UI_SetCloseCaption(DS_U8 value) { DST_EEPROM_SetCC(value ? 1 : 0); } // 0À̸é RF3 1À̸é RF4 DS_U8 DST_UI_GetCh34(void) { return DST_EEPROM_GetPreferredConn(); } void DST_UI_SetCh34(DS_U8 nVal) { DST_EEPROM_SetPreferredConn(nVal); DHL_SetCh34(nVal); } #if 0 ____Volum_UI___() #endif // º¼·ý ¼³Á¤ DS_U8 DST_UI_GetVolume(void) { return DST_EEPROM_GetVolume(); } // º¼·ý ¼³Á¤ void DST_UI_SetVolume(DS_U8 value) { if (value > 0) DST_UI_SetMute(false); DST_EEPROM_SetVolume(value); CT_AudioVolume(DST_UI_GetMute() ? 0 : DST_UI_GetVolume()); } // ¹ÂÆ® ¼³Á¤ static bool g_Mute = false; bool DST_UI_GetMute(void) { return g_Mute; } // ¹ÂÆ® ¼³Á¤ void DST_UI_SetMute(bool bVal) { g_Mute = bVal; CT_AudioVolume(g_Mute ? 0 : DST_UI_GetVolume()); } #if 0 ____Info_Banner_UI___() #endif // ÇöÀç ½Ã°£À» °¡Á®¿Â´Ù. bool DST_UI_GetLocalTime(STime_t *time) { return DST_GetTime(time); } // ÇöÀç ¹æ¼ÛÁßÀÎ ºñµð¿À°¡ HD ¹æ¼ÛÀΰ¡? bool DST_UI_GetHDInfo(void) { return DST_GetHDInfo(); } // ÇöÀç CC º¸¿©ÁֱⰡ °¡´ÉÇѰ¡? bool DST_UI_GetCCInfo(void) { return DST_GetCCInfo(); } #if 0 ____EPG_UI___() #endif // ÇöÀç ä³Î ¹øÈ£¸¦ ¹®ÀÚ¿­·Î °¡Á®¿Â´Ù. // ÀÔ·Â ¹è¿­ ±æÀÌ 20ÀÚ void DST_UI_GetCurrentChannelNumber(char *chNum) { if (chNum == 0) return; int num = 0; bool bFind = DST_DB_GetCurrentChannelInfo(0, 0, &num); if (bFind == true) { sprintf(chNum, "%03d", num); //ä³Î ¹øÈ£ } else { sprintf(chNum, "%d", num); // RF ¹øÈ£ } } // ÇöÀç ä³Î¹øÈ£¿¡ RF¸¦ ºÙÀÎ °ªÀ» °¡Á®¿Â´Ù. // ÀÔ·Â ¹è¿­±æÀÌ 40ÀÚ void DST_UI_GetCurrentChannelNumberWithRF(char *chNum) { DST_DB_GetCurrentChannelInfo(chNum, 0, 0); } // ä³Î¹øÈ£ ä³ÎÀ̸§ // ÀÔ·Â ¹è¿­ ±æÀÌ 40ÀÚ int DST_UI_GetCurrentChannelInfo(DS_U32 *chInfo) { if (chInfo == 0) return 0; chInfo[0] = 0; char chNum[20]; DS_U32 chName[21]; int num = 0; if (DST_DB_GetCurrentChannelInfo(chNum, chName, &num) == false) sprintf(chNum, "%d ", num); // RF ¹øÈ£ str232(chInfo, chNum); strcpy32(&chInfo[strlen32(chInfo)], chName); return strlen32(chInfo); } // ³¯Â¥ ¹®ÀÚ¿­À» ¹ÝȯÇÑ´Ù. int DST_UI_GetDateString(int month, int day, int wday, DS_U16* timeInfo) { DS_U16 strSpace[2] = {0x20, 0x00}; strcpy16(timeInfo, DST_GetDayOfWeakString(wday)); strcpy16(&timeInfo[strlen16(timeInfo)], strSpace); char strText[10]; sprintf(strText, "%02d/%02d",day,month); str2uni(&timeInfo[strlen16(timeInfo)], strText); return strlen16(timeInfo); } // ½Ã°£ ¹®ÀÚ¿­À» ¹ÝȯÇÑ´Ù. int DST_UI_GetTimeString(int hour, int min, DS_U16* timeInfo) { char strText[16]; sprintf(strText, "%02dh%02d", hour, min); str2uni(timeInfo, strText); return strlen16(timeInfo); } // ÀÔ·ÂµÈ ½Ã°£¿¡ ÇØ´çÇÏ´Â ½Ã°£ ¹®ÀÚ¿­À» ¹ÝȯÇÑ´Ù. int DST_UI_GetDateTimeString(STime_t st, DS_U16* strDateTime) { DS_U16 strDate[32]; DS_U16 strTime[32]; DS_U16 strSpace[2] = {0x20, 0x00}; DST_UI_GetDateString(st.month, st.day, st.wday, strDate); DST_UI_GetTimeString(st.hour, st.min, strTime); strcpy16(strDateTime, strDate); strcpy16(&strDateTime[strlen16(strDateTime)], strSpace); strcpy16(&strDateTime[strlen16(strDateTime)], strTime); return strlen16(strDateTime); } // Á֯ļö Å×ÀÌºí °ü·Ã ÇÔ¼ö #if 0 static DS_U16 FREQ_TABLE[] = { 2, 57, 3, 63, 4, 69, 5, 79, 6, 85, 7, 177, 8, 183, 9, 189, 10, 195, 11, 201, 12, 207, 13, 213, 14, 123, 15, 129, 16, 135, 17, 141, 18, 147, 19, 153, 20, 159, 21, 165, 22, 171, 23, 219, 24, 225, 25, 231, 26, 237, 27, 243, 28, 249, 29, 255, 30, 261, 31, 267, 32, 273, 33, 279, 34, 285, 35, 291, 36, 297, 37, 303, 38, 309, 39, 315, 40, 321, 41, 327, 42,333, 43,339, 44, 345, 45, 351, 46,357, 47,363,48,369, 49,375, 50, 381, 51, 387, 52, 393, 53,399, 54, 405, 55, 411, 56, 417, 57, 423, 58, 429, 59, 435, 60, 441, 61, 447, 62, 453, 63, 459, 64, 465, 65, 471, 66, 477, 67, 483, 68, 489, 69, 495, 70, 501, 71, 507, 72, 513, 73, 519, 74, 525, 75,531, 76,537, 77,543, 78,549, 79, 555, 80, 561, 81, 567, 82, 573, 83, 579, 84, 585, 85, 591, 86, 597, 87, 603, 88, 609, 89, 615, 90, 621, 91, 627, 92, 633, 93, 639, 94, 645, 95, 93, 96, 99, 97, 105, 100, 651, 101, 657, 102, 663, 103, 669, 104, 675, 105, 681, 106, 687, 107, 693, 108, 699, 109, 705, 110, 711, 111, 717, 112, 723, 113, 729, 114, 735, 115, 741, 116, 747, 117, 753, 118, 759, 119, 765, 120, 771, 121, 777, 122, 783, 123, 789, 124, 795, 125, 801, 126, 807, 127, 813, 128, 819, 129, 825, 130, 831, 131, 837, 132, 843, 133, 849, 134, 855, 135, 861, 136, 867, 137, 873, 138, 879, 139, 885, 140, 891, 141, 897, 142, 903, 143, 909, 144, 915, 145, 921, 146, 927, 147, 933, 148, 939, 149, 945, 150, 951, 151, 957, 152, 963, 153, 969, 154, 975, 155, 981, 156, 987, 157, 993, 158, 999 }; #else static DS_U16 FREQ_TABLE[] = { 2, 57, 3, 63, 4, 69, 5, 79, 6, 85, 7, 177, 8, 183, 9, 189, 10, 195, 11, 201, 12, 207, 13, 213, 14, 123, 15, 129, 16, 135, 17, 141, 18, 147, 19, 153, 20, 159, 21, 165, 22, 171, 23, 219, 24, 225, 25, 231, 26, 237, 27, 243, 28, 249, 29, 255, 30, 261, 31, 267, 32, 273, 33, 279, 34, 285, 35, 291, 36, 297, 37, 303, 38, 309, 39, 315, 40, 321, 41, 327, 42,333, 43,339, 44, 345, 45, 351, 46,357, 47,363,48,369, 49,375, 50, 381, 51, 387, 52, 393, 53,399, 54, 405, 55, 411, 56, 417, 57, 423, 58, 429, 59, 435, 60, 441, 61, 447, 62, 453, 63, 459, 64, 465, 65, 471, 66, 477, 67, 483, 68, 489, 69, 495, 70, 501, 71, 507, 72, 513, 73, 519, 74, 525, 75,531, 76,537, 77,543, 78,549, 79, 555, 80, 561, 81, 567, 82, 573, 83, 579, 84, 585, 85, 591, 86, 597, 87, 603, 88, 609, 89, 615, 90, 621, 91, 627, 92, 633, 93, 639, 94, 645, 95, 93, 96, 99, 97, 105, 100, 651, 101, 657, 102, 663, 103, 669, 104, 675, 105, 681, 106, 687, 107, 693, 108, 699, 109, 705, 110, 711, 111, 717, 112, 723, 113, 729, 114, 735, 115, 741, 116, 747, 117, 753, 118, 759, 119, 765, 120, 771, 121, 777, 122, 783, 123, 789, 124, 795, 125, 801, 126, 807, 127, 813, 128, 819, 129, 825, 130, 831, 131, 837, 132, 843, 133, 849, 134, 855, 135, 861 }; #endif // Aspect Ratio (0) wide (1) normal (2) zoom // DS_U8 DST_EEPROM_GetAspect(bool bOutput4x3, bool bSource4x3); DS_U8 DST_UI_GetAspect() { if (DST_g_LastTuneTime == 0) return ASPECT_RATIO_NORMAL; if (DST_IsVideoPlay() == false) return ASPECT_RATIO_NORMAL; DS_U16 w = 0, h = 0, fps = 0; bool bWide = false, bInterlace = false; DST_GetVideoSize(&w, &h, &fps, &bInterlace, &bWide); if (h == 0) return ASPECT_RATIO_NORMAL; return DST_EEPROM_GetAspect((!bWide)); } // void DST_EEPROM_SetAspect(bool bOutput4x3, bool bSource4x3, DS_U8 nVal); void DST_UI_SetAspect(DS_U8 nVal) { if (DST_g_LastTuneTime == 0) return; if (DST_IsVideoPlay() == false) return; DS_U16 w = 0, h = 0, fps = 0; bool bWide = false, bInterlace = false; DST_GetVideoSize(&w, &h, &fps, &bInterlace, &bWide); if (h == 0) return; DST_EEPROM_SetAspect((!bWide), nVal); } // Á֯ļö Å×ÀÌºí °¹¼ö int DST_GetFreqCount() { return sizeof(FREQ_TABLE)/4; } // À妽º¸¦ ÀÔ·ÂÇϰí Á֯ļö ¹øÈ£¸¦ ¹Þ´Â´Ù. DS_U16 DST_GetFrequencyNumberbyIndex(int index) { return FREQ_TABLE[2*index]; } // À妽º¸¦ ÀÔ·ÂÇϰí MHz ´ÜÀ§ÀÇ Á֯ļö¸¦ ¹Þ´Â´Ù. DS_U16 DST_GetMHzFrequencybyIndex(int index) { return FREQ_TABLE[1+2*index]; } // Á֯ļö ¹øÈ£¸¦ ÀÔ·ÂÇϰí À妽º °ªÀ» ¹Þ´Â´Ù. int DST_GetIndexByRFNumber(int rf_number) { for (int i = 0; i < DST_GetFreqCount(); i++) { if (rf_number == DST_GetFrequencyNumberbyIndex(i)) return i; } return 0; } // MHz´ÜÀ§ÀÇ Á֯ļö¸¦ ÀÔ·ÂÇϰí À妽º °ªÀ» ¹Þ´Â´Ù. int DST_GetIndexByMHzFrequency(int MHz) { for (int i = 0; i < DST_GetFreqCount(); i++) { if (MHz == DST_GetMHzFrequencybyIndex(i)) return i; } return 0; }