Ejemplo n.º 1
0
/****************************************************************************
NAME    
    sinkFmRxEraseFreq
    
DESCRIPTION
    erases the currently tuned frequency if it is stored in persistant store

RETURNS
    nothing
*/   
void sinkFmRxEraseFreq(uint16 freq)
{    
    fm_stored_freq *stored_freq = &theSink.conf2->sink_fm_data.fmStoredFreq;
    uint8 index = FM_MAX_PRESET_STATIONS;
    
    FM_DEBUG(("sinkFmRxEraseFreq \n"));

    /*Get index where requested freq is stored*/
    index = sinkFmGetIndex(stored_freq, freq);
    
    /*If no free index available, storage is full, indicate to user*/
    if (index < FM_MAX_PRESET_STATIONS)
    {    
        FM_DEBUG(("Erased station %d at index %d \n", freq, index));

        sinkFmUpdateAtIndex(index, INVALID_FREQ, stored_freq);

        FM_DEBUG(("Station tuned to Freq %d erased \n", freq));

        /* erase the stored frequency */
        (void) ConfigStore(CONFIG_FM_FREQUENCY_STORE, stored_freq, sizeof(fm_stored_freq));

        /*Display stored freq without a favourite sign, continue tuning until changed by user*/
        sinkFmDisplayFreq(freq, FM_DEL_FAV_STATION);
    }
}
Ejemplo n.º 2
0
ConfigStore ConfigStore::GetSubStore(const char *substore)
{
	char *newname=NULL;
	const char *name = m_substore_name;
	if (strlen(name)==0) {	  // this is the root
		newname = PL_strdup(substore);
	} else {
		newname = PR_smprintf("%s.%s",name,substore);
	}
	return ConfigStore(m_root,newname);
}
Ejemplo n.º 3
0
/****************************************************************************
NAME    
    sinkWriteStoredNumber
    
DESCRIPTION
	Store number obtained via HfpRequestNumberForVoiceTag in 
    CONFIG_PHONE_NUMBER
    
RETURNS
    void
*/
void sinkWriteStoredNumber ( HFP_VOICE_TAG_NUMBER_IND_T* ind )
{
    /* validate length of number returned */
    if((ind->size_phone_number)&&(ind->size_phone_number<SIZE_CONFIG_PHONE_NUMBER))
    {
        uint16 phone_number_key[SIZE_CONFIG_PHONE_NUMBER];
        
        CM_DEBUG(("Store Number "));
        
        /* Make sure the phone number key is all zero to start */
        memset(phone_number_key, 0, SIZE_CONFIG_PHONE_NUMBER*sizeof(uint16));   
        
        /* Write phone number into key array */
        memmove(phone_number_key,ind->phone_number,ind->size_phone_number);        
        
        /* Write to PS */
        ConfigStore(CONFIG_PHONE_NUMBER, &phone_number_key, ind->size_phone_number);
    }
}
Ejemplo n.º 4
0
/****************************************************************************
NAME    
    sinkFmRxStoreFreq
    
DESCRIPTION
    Stores the currently tuned frequency to persistant store, if storage space available.
    User must delete a station to make space for newer stations

RETURNS
    nothing
*/   
void sinkFmRxStoreFreq(uint16 freq)
{
    fm_stored_freq *stored_freq = &theSink.conf2->sink_fm_data.fmStoredFreq;
    uint8 index = FM_MAX_PRESET_STATIONS;
  
    FM_DEBUG(("sinkFmRxStoreFreq freq %d\n", freq));
    
    if (freq != INVALID_FREQ)
    {
        /*If requested freq already present in PSKEY, ignore the request*/
        if (sinkFmGetIndex(stored_freq, freq) < FM_MAX_PRESET_STATIONS)
        {       
            FM_DEBUG(("Freq already stored - Do nothing\n"));     
        }
        else
        {
            /*Get free index*/
            index = sinkFmGetIndex(stored_freq, INVALID_FREQ);
            
            if (index < FM_MAX_PRESET_STATIONS)
            {
                FM_DEBUG(("Stored station %d at index %d \n", freq, index));
                sinkFmUpdateAtIndex(index, freq, stored_freq);
                    
                /* store requested frequency */
                (void) ConfigStore(CONFIG_FM_FREQUENCY_STORE, stored_freq, sizeof(fm_stored_freq));

                /*Display stored freq with a favourite sign*/
                sinkFmDisplayFreq(freq, FM_ADD_FAV_STATION);
            }
            else /*If no free index available, storage is full, indicate to user*/
            {
#ifdef ENABLE_DISPLAY
                displayShowText(DISPLAYSTR_FM_STORAGE_FULL,  strlen(DISPLAYSTR_FM_STORAGE_FULL), 1, DISPLAY_TEXT_SCROLL_SCROLL, 500, 2000, FALSE, 5);
#endif
                FM_DEBUG(("FM storage full. Please delete a stored station. \n"));
            }            
        }
    }
}