Changeset 60 in svn for trunk/zasc/app_c/DST_DB.c


Ignore:
Timestamp:
Oct 21, 2015 1:32:10 PM (10 years ago)
Author:
phkim
Message:
  1. phkim
  2. 금강방송
  3. 변경 내용
    • 서경방송 채널 편집 기능 병합
    • 채널 편집 기능 추가, 기존 검색 방법 변경 (RF,Program number ) -> (major, minor)
    • 채널편집 항목중 추가 -> 시청 으로 문구 변경, 가이드 문구 색상 변경
    • 사용장 키 입력 후 플래시 저장 속도 1초 -> 5초 로 변경
    • UI 동작에 대한 시나리오 통일



File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zasc/app_c/DST_DB.c

    r35 r60  
    1818//#endif 
    1919 
    20 #if CHANNEL_EDIT_SUPPORT 
    21 void DST_DB_SetSkipChannel(int rf, int program_number, bool bAdd) 
     20#if SUPPORT_CHANNEL_EDIT 
     21void DST_DB_SetSkipChannel(int major, int minor, bool bAdd) 
    2222{ 
    2323//      CDB db; NewCDB(&db); 
     
    2727        for (i=0; i < DB_SKIP_LIST_MAX; i++) 
    2828        { 
    29                 if (db_skip_list[i].program_number == 0) continue; 
    30                 if (db_skip_list[i].rf != rf) continue; 
    31                 if (db_skip_list[i].program_number != program_number) continue; 
     29                if (db_skip_list[i].major == 0) continue; 
     30                if (db_skip_list[i].minor != minor) continue; 
     31                if (db_skip_list[i].major != major) continue; 
    3232                memset(&db_skip_list[i], 0, sizeof(_DB_SKIP_LIST_)); 
    3333        } 
     
    3636                for (i=0; i < DB_SKIP_LIST_MAX; i++) 
    3737                { 
    38                         if (db_skip_list[i].program_number != 0) continue; 
    39                         db_skip_list[i].rf = rf; 
    40                         db_skip_list[i].program_number = program_number; 
     38                        if (db_skip_list[i].major != 0) continue; 
     39                        db_skip_list[i].minor = minor; 
     40                        db_skip_list[i].major = major; 
    4141                        break; 
    4242                } 
     
    4545//      DeleteCDB(&db); 
    4646} 
    47 #endif // CHANNEL_EDIT_SUPPORT 
     47#endif // SUPPORT_CHANNEL_EDIT 
    4848 
    4949bool DST_DB_PresentChMap() 
     
    126126        if (nPos < 0) // ÇöÀçä³ÎÀÌ Ã¤³Î¸Ê¿¡ ¾ø´Â ä³ÎÀÎ °æ¿ì 
    127127        { 
     128                int tempMajor,tempMinor; 
     129                tempMajor = DST_DB_GetMajor(rf,program_number); 
     130                tempMinor = DST_DB_GetMinor(rf,program_number); 
    128131                if (bUp) 
    129132                { 
    130                         DST_UI_ChannelTune(db_channel_updn[0].rf, db_channel_updn[0].program_number); 
     133                        nPos = 0; 
     134                        for (i =0; i < DB_CHANNEL_UPDN_MAX; i++) 
     135                        { 
     136                                if (db_channel_updn[i].program_number == 0) continue; 
     137                                 
     138                                if (db_channel_updn[i].major > tempMajor)  
     139                                { 
     140                                        nPos = i; 
     141                                        break; 
     142                                } 
     143                                else if (db_channel_updn[i].major == tempMajor) 
     144                                { 
     145                                        if (db_channel_updn[i].rf > rf)  
     146                                        { 
     147                                                nPos = i; 
     148                                                break; 
     149                                        } 
     150                                        else if (db_channel_updn[i].rf == rf)  
     151                                        { 
     152                                                if (db_channel_updn[i].minor > tempMinor)  
     153                                                { 
     154                                                        nPos = i; 
     155                                                        break; 
     156                                                } 
     157                                        } 
     158                                }  
     159                        } 
    131160                } 
    132161                else 
    133162                { 
    134                         DST_UI_ChannelTune(db_channel_updn[nCount-1].rf, db_channel_updn[nCount-1].program_number); 
    135                 } 
     163                        nPos = nCount-1; 
     164                        for (i =0; i < DB_CHANNEL_UPDN_MAX; i++) 
     165                        { 
     166                                if (db_channel_updn[i].program_number == 0) continue; 
     167 
     168                                if (db_channel_updn[i].major > tempMajor)  
     169                                { 
     170                                        nPos = i; 
     171                                        break; 
     172                                } 
     173                                else if (db_channel_updn[i].major == tempMajor) 
     174                                { 
     175                                        if (db_channel_updn[i].rf > rf)  
     176                                        { 
     177                                                nPos = i; 
     178                                                break; 
     179                                        } 
     180                                        else if (db_channel_updn[i].rf == rf)  
     181                                        { 
     182                                                if (db_channel_updn[i].minor > tempMinor)  
     183                                                { 
     184                                                        nPos = i; 
     185                                                        break; 
     186                                                } 
     187                                        } 
     188                                }  
     189                        } 
     190                } 
     191                DST_UI_ChannelTune(db_channel_updn[nPos].rf, db_channel_updn[nPos].program_number); 
    136192                DBLock(false); 
    137193                return;  
     
    312368} 
    313369 
     370// ¸Å´º¾ó ½ºÄµ ÈÄ ÇØ´ç RFÀÇ Ã¹¹øÂ° ä³Î·Î °£´Ù. 
     371void DST_DB_TuneFirstChannelinRF(int rf) 
     372{ 
     373        int i; 
     374        if (DST_DB_PresentChMap() == false) return; 
     375        DBLock(true); 
     376        // RF ¹øÈ£ ÀÏÄ¡Çϴ ä³ÎÀ» ã´Â´Ù. 
     377        for (i=0; i < DB_CHANNEL_DB_MAX;i++) 
     378        { 
     379                if (db_channel_db[i].program_number == 0) continue; 
     380                if (db_channel_db[i].rf != rf) continue; 
     381                DST_UI_ChannelTune(rf, db_channel_db[i].program_number); 
     382                DBLock(false); 
     383                return; 
     384        } 
     385        DST_UI_ChannelTune(rf, 0); 
     386        DBLock(false);  
     387} 
     388 
     389 
    314390int DST_DB_GetProgramNumber(int major, int minor) 
    315391{ 
     
    388464        memset(&db_cvct_sub, 0, sizeof(_DB_CVCT_SUB_)*DB_CVCT_SUB_MAX); 
    389465#endif 
    390 #if CHANNEL_EDIT_SUPPORT 
     466#if SUPPORT_CHANNEL_EDIT 
    391467        memset(&db_skip_list, 0, sizeof(_DB_SKIP_LIST_)*DB_SKIP_LIST_MAX); 
    392 #endif // CHANNEL_EDIT_SUPPORT 
     468#endif // SUPPORT_CHANNEL_EDIT 
    393469        CT_ChMapUpdate(); 
    394470        DBLock(false);  
     
    428504static DS_U32 g_sync_request_time = 0; 
    429505static DS_U32 g_Sync_finish_time = 0; 
     506static bool s_SyncNow = false; 
    430507 
    431508void DST_DB_Sync() 
     
    434511} 
    435512 
     513void DST_DB_SyncNow() 
     514{ 
     515        DST_DB_Sync(); 
     516        s_SyncNow = true; 
     517} 
    436518bool DST_DB_IsSync() 
    437519{ 
     
    444526        { 
    445527                //T(); 
    446                 DST_OS_Delay(1000); 
    447                 if (DST_g_KeyPressTime > DST_OS_GetTickCount()) DST_g_KeyPressTime = DST_OS_GetTickCount(); 
    448                 if (DST_OS_GetTickCount() - DST_g_KeyPressTime < DST_OS_GetTicksPerSecond()/2) continue; 
    449                 if (DST_DB_IsSync()) continue; 
     528                if(s_SyncNow == false) 
     529                { 
     530                        DST_OS_Delay(1000); 
     531                        if (DST_g_KeyPressTime > DST_OS_GetTickCount()) DST_g_KeyPressTime = DST_OS_GetTickCount(); 
     532                        if (DST_OS_GetTickCount() - DST_g_KeyPressTime < DST_OS_GetTicksPerSecond()*5) continue; 
     533                        if (DST_DB_IsSync()) continue; 
     534                } 
     535                s_SyncNow = false; 
     536 
    450537                //T(); 
    451538                DS_U32 *version = (DS_U32 *)&strFlash[0]; 
     
    458545                memcpy(&strFlash[nPos], &db_pmt, sizeof(_DB_PMT_) * DB_PMT_MAX); 
    459546                nPos += sizeof(_DB_PMT_) * DB_PMT_MAX; 
    460 #if CHANNEL_EDIT_SUPPORT 
    461                 memcpy(&strFlash[nPos], &db_skip_list, sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX); 
    462                 nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 
    463 #endif // CHANNEL_EDIT_SUPPORT 
    464547                memcpy(&strFlash[nPos], &db_tvct, sizeof(_DB_TVCT_) * DB_TVCT_MAX); 
    465548                nPos += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 
    466549                memcpy(&strFlash[nPos], &db_tvct_sub, sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX); 
    467550                nPos += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 
     551#if SUPPORT_CHANNEL_EDIT 
     552                memcpy(&strFlash[nPos], &db_skip_list, sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX); 
     553                nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 
     554#endif // SUPPORT_CHANNEL_EDIT 
    468555                *version = FLASH_VERSION; 
    469556                *crc =  DST_CRC32(&strFlash[8], g_nFlashDBSize-8); 
     
    483570        g_nFlashDBSize += sizeof(_DB_PAT_) * DB_PAT_MAX; 
    484571        g_nFlashDBSize += sizeof(_DB_PMT_) * DB_PMT_MAX; 
    485 #if CHANNEL_EDIT_SUPPORT 
     572        g_nFlashDBSize += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 
     573        g_nFlashDBSize += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 
     574#if SUPPORT_CHANNEL_EDIT 
    486575        g_nFlashDBSize += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 
    487576#endif 
    488         g_nFlashDBSize += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 
    489         g_nFlashDBSize += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 
     577 
    490578//      DST_Printf("nFlashDBSize4K = %d nFlashDBSize = %d\n", nFlashDBSize4K, (int)g_nFlashDBSize); 
    491579        DS_U32 nFlashDBSize4K = ((g_nFlashDBSize+4096-1)/4096)*4096; 
     
    522610                memcpy(&db_pmt, &strFlash[nPos], sizeof(_DB_PMT_) * DB_PMT_MAX); 
    523611                nPos += sizeof(_DB_PMT_) * DB_PMT_MAX; 
    524 #if CHANNEL_EDIT_SUPPORT 
    525                 memcpy(&db_skip_list, &strFlash[nPos], sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX); 
    526                 nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 
    527 #endif 
    528612                memcpy( &db_tvct, &strFlash[nPos], sizeof(_DB_TVCT_) * DB_TVCT_MAX); 
    529613                nPos += sizeof(_DB_TVCT_) * DB_TVCT_MAX; 
    530614                memcpy(&db_tvct_sub, &strFlash[nPos], sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX); 
    531615                nPos += sizeof(_DB_TVCT_SUB_) * DB_TVCT_SUB_MAX; 
     616#if SUPPORT_CHANNEL_EDIT 
     617                memcpy(&db_skip_list, &strFlash[nPos], sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX); 
     618                nPos += sizeof(_DB_SKIP_LIST_) * DB_SKIP_LIST_MAX; 
     619#endif           
    532620                int i; 
    533621                for (i = 0; i < DB_CONFIG_MAX; i++) 
Note: See TracChangeset for help on using the changeset viewer.