import com.smartdevicelink.proxy.rpc.PerformInteraction; //导入方法依赖的package包/类
private void prepareListItemsCmds(){
String initialPrompt = "";
String helpPrompt = "";
String timeoutPrompt = getResources().getString(R.string.interaction_forecastlist_timeoutprompt);
String initialText = "";
if (mActiveInfoType == InfoType.HOURLY_FORECAST) {
initialPrompt = getResources().getString(R.string.interaction_hourly_forecastlist_initprompt);
helpPrompt = getResources().getString(R.string.interaction_hourly_forecastlist_helpprompt);
initialText = getResources().getString(R.string.interaction_hourly_forecastlist_inittext);
}
if (mActiveInfoType == InfoType.DAILY_FORECAST) {
initialPrompt = getResources().getString(R.string.interaction_daily_forecastlist_initprompt);
helpPrompt = getResources().getString(R.string.interaction_daily_forecastlist_helpprompt);
initialText = getResources().getString(R.string.interaction_daily_forecastlist_inittext);
}
Vector intitial_prompt = TTSChunkFactory.createSimpleTTSChunks(initialPrompt);
Vector help_prompt = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
Vector timeout_prompt = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
Vector interactionChoiceSetIDs = new Vector();
if(mActiveInfoType == InfoType.DAILY_FORECAST) {
interactionChoiceSetIDs.add(mDailyForecast_ChoiceSetID);
}
if(mActiveInfoType == InfoType.HOURLY_FORECAST) {
interactionChoiceSetIDs.add(mHourlyForecast_ChoiceSetID);
}
PerformInteraction performInterActionRequest = new PerformInteraction();
performInterActionRequest.setInitialPrompt(intitial_prompt);
performInterActionRequest.setHelpPrompt(help_prompt);
performInterActionRequest.setTimeoutPrompt(timeout_prompt);
performInterActionRequest.setInitialText(initialText);
performInterActionRequest.setTimeout(100000);
performInterActionRequest.setInteractionChoiceSetIDList(interactionChoiceSetIDs);
performInterActionRequest.setInteractionMode(InteractionMode.MANUAL_ONLY);
performInterActionRequest.setCorrelationID(autoIncCorrId++);
try {
proxy.sendRPCRequest(performInterActionRequest);
}
catch (SdlException e) {
e.printStackTrace();
Log.e(SmartDeviceLinkApplication.TAG, "Failed to perform interaction \"Daily/Houtly Forecast List\"", e);
}
}