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


Ignore:
Timestamp:
Mar 25, 2015 5:12:16 PM (11 years ago)
Author:
megakiss
Message:

금강방송 Except 채널 구현

File:
1 edited

Legend:

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

    r22 r26  
    650650// Á֯ļö ¼³Á¤¿¡¼­ Á¦¿ÜµÈ ä³ÎÀÎÁö? 
    651651// ÀԷ°ªÀº rfÀÇ index °ªÀÌ´Ù 
    652 bool DST_DB_IsExceptRF(int rf) 
    653 { 
    654         if (DST_EEPROM_GetFrequencySetting() == 0) return false; 
    655         if (rf < DST_EEPROM_GetMinRF()) return false; 
    656         if (rf > DST_EEPROM_GetMaxRF()) return false; 
    657         return true; 
     652int DST_DB_IsExceptRF(int rf) 
     653{ 
     654        if (DST_EEPROM_GetFrequencySetting() == 0) return 0; 
     655        if (rf < DST_EEPROM_GetMinRF()) return 0; 
     656        if (rf > DST_EEPROM_GetMaxRF()) return 0; 
     657        return 1; 
    658658} 
    659659 
     
    665665} 
    666666 
     667static int GetNextRF(int rf) 
     668{ 
     669        if (rf >= DST_MaxRF()) return 0; 
     670        return rf+1; 
     671} 
    667672// Á¦¿ÜµÇÁö ¾ÊÀº ´ÙÀ½ RFÀÇ index°ªÀ» °¡Á®¿Â´Ù 
     673// ÀÔ·ÂµÈ °ªÀº ÇöÀç indexed rf ´Ù 
    668674int DST_DB_GetNextUnexceptRF(int rf) 
    669675{ 
    670         if (DST_EEPROM_GetFrequencySetting() == 0) return 0; 
    671         return DST_EEPROM_GetMaxRF() - DST_EEPROM_GetMinRF() + 1; 
    672 } 
     676        int i=0; 
     677        if (DST_EEPROM_GetFrequencySetting() == 0) 
     678        { 
     679                return GetNextRF(rf); 
     680        } 
     681        int curRF = rf; 
     682        for (i = DST_MinRF(); i <= DST_MaxRF(); i++) 
     683        { 
     684                curRF = GetNextRF(curRF);  
     685                if (DST_DB_IsExceptRF(curRF) == 0) return curRF; 
     686        }        
     687        return 0; 
     688} 
     689 
     690static int GetPrevRF(int rf) 
     691{ 
     692        if (rf <= DST_MinRF()) return DST_MaxRF(); 
     693        return rf-1; 
     694} 
     695// Á¦¿ÜµÇÁö ¾ÊÀº ´ÙÀ½ RFÀÇ index°ªÀ» °¡Á®¿Â´Ù 
     696// ÀÔ·ÂµÈ °ªÀº ÇöÀç indexed rf ´Ù 
     697int DST_DB_GetPrevUnexceptRF(int rf) 
     698{ 
     699        int i=0; 
     700        if (DST_EEPROM_GetFrequencySetting() == 0) 
     701        { 
     702                return GetPrevRF(rf); 
     703        } 
     704        int curRF = rf; 
     705        for (i = DST_MinRF(); i <= DST_MaxRF(); i++) 
     706        { 
     707                curRF = GetPrevRF(curRF);  
     708                if (DST_DB_IsExceptRF(curRF) == 0) return curRF; 
     709        }        
     710        return 0; 
     711} 
     712 
     713int DST_DB_GetUnexceptedFirstRF() 
     714{ 
     715        int i=0; 
     716        for (i = DST_MinRF(); i <= DST_MaxRF(); i++) 
     717        { 
     718                if (DST_DB_IsExceptRF(i) == 0) return i; 
     719        } 
     720        return DST_MinRF();      
     721} 
     722 
     723int DST_DB_GetUnexceptedLastRF() 
     724{ 
     725        int i=0; 
     726        for (i = DST_MaxRF(); i >= DST_MinRF(); i--) 
     727        { 
     728                if (DST_DB_IsExceptRF(i) == 0) return i; 
     729        } 
     730        return DST_MaxRF();      
     731} 
Note: See TracChangeset for help on using the changeset viewer.