/**************************************************************************** DESCRIPTION messages from the audio library are received here. and converted into function calls to be implemented in the plugin module */ static void handleAudioMessage ( Task task , MessageId id, Message message ) { switch (id) { case (AUDIO_PLUGIN_VOICE_PROMPTS_INIT_MSG ): { AUDIO_PLUGIN_VOICE_PROMPTS_INIT_MSG_T * init_message = (AUDIO_PLUGIN_VOICE_PROMPTS_INIT_MSG_T *)message; CsrVoicePromptsPluginInit(init_message->no_prompts, init_message->no_languages); } break; case (AUDIO_PLUGIN_PLAY_AUDIO_PROMPT_MSG ): { AUDIO_PLUGIN_PLAY_AUDIO_PROMPT_MSG_T * prompt_message = (AUDIO_PLUGIN_PLAY_AUDIO_PROMPT_MSG_T *)message ; /* if the audio is currently busy then queue this audio prompt request, or if the audio plugin is in an 'about to be loaded state', queue until it is loaded and running */ if ((IsAudioBusy())||(GetCurrentDspStatus() && (GetCurrentDspStatus() != DSP_RUNNING))) { if ( prompt_message->can_queue) { MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_PLAY_AUDIO_PROMPT_MSG) ; memmove(message, prompt_message, sizeof(AUDIO_PLUGIN_PLAY_AUDIO_PROMPT_MSG_T)); MessageSendConditionally ( task , AUDIO_PLUGIN_PLAY_AUDIO_PROMPT_MSG, message ,(const uint16 *)AudioBusyPtr() ) ; PRINT(("VP:Queue\n")); } } else { CsrVoicePromptsPluginPlayPhrase (prompt_message->id, prompt_message->language, prompt_message->codec_task, prompt_message->ap_volume, prompt_message->features); PRINT(("VP:start\n")); } } break ; case (AUDIO_PLUGIN_STOP_AUDIO_PROMPT_MSG ): CsrVoicePromptsPluginStopPhrase() ; break; case (AUDIO_PLUGIN_PLAY_TONE_MSG ): { AUDIO_PLUGIN_PLAY_TONE_MSG_T * tone_message = (AUDIO_PLUGIN_PLAY_TONE_MSG_T *)message ; if (IsAudioBusy()) { if ( tone_message->can_queue) /*then re-queue the tone*/ { MAKE_AUDIO_MESSAGE( AUDIO_PLUGIN_PLAY_TONE_MSG ) ; message->tone = tone_message->tone ; message->can_queue = tone_message->can_queue ; message->codec_task = tone_message->codec_task ; message->tone_volume = tone_message->tone_volume; message->features = tone_message->features ; PRINT(("VP: tone Q\n")); MessageSendConditionally ( task , AUDIO_PLUGIN_PLAY_TONE_MSG, message ,(const uint16 *)AudioBusyPtr() ) ; } } else { PRINT(("VP:tone start\n")); CsrVoicePromptsPluginPlayTone (task, tone_message->tone, tone_message->codec_task, tone_message->tone_volume, tone_message->features) ; } } break ; case (AUDIO_PLUGIN_STOP_TONE_MSG ): CsrVoicePromptsPluginStopPhrase() ; break ; default: /*other messages do not need to be handled by the voice prompts plugin*/ break ; } }
/**************************************************************************** NAME deviceManagerUpdateAttributes DESCRIPTION Stores the current attribute values for a given HFP/A2DP connection in PS. RETURNS void */ void deviceManagerUpdateAttributes(const bdaddr* bd_addr, sink_link_type link_type, hfp_link_priority hfp_priority, a2dp_link_priority a2dp_priority) { EVENT_UPDATE_ATTRIBUTES_T* update = PanicUnlessNew(EVENT_UPDATE_ATTRIBUTES_T); memset(update,0,sizeof(EVENT_UPDATE_ATTRIBUTES_T)); update->bd_addr = *bd_addr; if(link_type == sink_hfp) { update->attributes.profiles = sink_hfp; update->attributes.hfp.volume = theSink.profile_data[PROFILE_INDEX(hfp_priority)].audio.gSMVolumeLevel; } else if(link_type == sink_a2dp) { update->attributes.profiles = sink_a2dp; update->attributes.a2dp.volume = theSink.a2dp_link_data->gAvVolumeLevel[a2dp_priority]; update->attributes.a2dp.clock_mismatch = theSink.a2dp_link_data->clockMismatchRate[a2dp_priority]; } #ifdef ENABLE_SUBWOOFER else if(link_type == sink_swat) { update->attributes.profiles = sink_swat; update->attributes.sub.sub_trim = theSink.rundata->subwoofer.sub_trim_idx; } #endif DEV_DEBUG(("DEV: DelayUpdateAttributes - type %d profiles %d, hfp_vol %d, a2dp_vol %d\n",link_type, update->attributes.profiles, update->attributes.hfp.volume, update->attributes.a2dp.volume)); MessageSendConditionally(&theSink.task, EventUpdateAttributes, update, (const uint16 *)AudioBusyPtr()); }