当前位置: 首页>>代码示例>>Java>>正文


Java TTSChunkFactory.createSimpleTTSChunks方法代码示例

本文整理汇总了Java中com.smartdevicelink.proxy.TTSChunkFactory.createSimpleTTSChunks方法的典型用法代码示例。如果您正苦于以下问题:Java TTSChunkFactory.createSimpleTTSChunks方法的具体用法?Java TTSChunkFactory.createSimpleTTSChunks怎么用?Java TTSChunkFactory.createSimpleTTSChunks使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.smartdevicelink.proxy.TTSChunkFactory的用法示例。


在下文中一共展示了TTSChunkFactory.createSimpleTTSChunks方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testBuildSpeak

import com.smartdevicelink.proxy.TTSChunkFactory; //导入方法依赖的package包/类
public void testBuildSpeak () {
	
	String testTTSText = "test";
	Integer testCorrelationID = 0;
	Vector<TTSChunk> testTTSChunks = TTSChunkFactory.createSimpleTTSChunks(testTTSText);
	Speak testSpeak;
	
	// Test -- buildSpeak(String ttsText, Integer correlationID)
	testSpeak = RPCRequestFactory.buildSpeak(testTTSText, testCorrelationID);
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
	assertEquals(Test.MATCH, testCorrelationID, testSpeak.getCorrelationID());
	
	testSpeak = RPCRequestFactory.buildSpeak((String) null, null);
	assertNull(Test.NULL, testSpeak.getTtsChunks());
	assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
	
	// Test -- buildSpeak(Vector<TTSChunk> ttsChunks, Integer correlationID)
	testSpeak = RPCRequestFactory.buildSpeak(testTTSChunks, testCorrelationID);
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testTTSChunks, testSpeak.getTtsChunks()));
	assertEquals(Test.MATCH, testCorrelationID, testSpeak.getCorrelationID());
	
	testSpeak = RPCRequestFactory.buildSpeak((Vector<TTSChunk>) null, null);
	assertNull(Test.NULL, testSpeak.getTtsChunks());
	assertNotNull(Test.NOT_NULL, testSpeak.getCorrelationID());
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:26,代码来源:RPCRequestFactoryTests.java

示例2: testCreateSimpleTTSChunks

import com.smartdevicelink.proxy.TTSChunkFactory; //导入方法依赖的package包/类
/**
 * This is a unit test for the following methods : 
 * {@link com.smartdevicelink.proxy.TTSChunkFactory#createSimpleTTSChunks(String)}
 */
public void testCreateSimpleTTSChunks () {
	// Test Values
	Vector<TTSChunk> testChunks;
	testChunks = TTSChunkFactory.createSimpleTTSChunks(Test.GENERAL_STRING);
	
	// Valid Tests
	assertNotNull(Test.NOT_NULL, testChunks);
	assertEquals(Test.MATCH, SpeechCapabilities.TEXT, testChunks.get(0).getType());
	assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunks.get(0).getText());
	
	// Invalid/Null Tests
	testChunks = TTSChunkFactory.createSimpleTTSChunks(null);
	assertNull(Test.NULL, testChunks);
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:19,代码来源:TTSChunkFactoryTests.java

示例3: testBuildPerformAudioPassThru

import com.smartdevicelink.proxy.TTSChunkFactory; //导入方法依赖的package包/类
public void testBuildPerformAudioPassThru () {
	
	Vector<TTSChunk> testInitialPrompt = TTSChunkFactory.createSimpleTTSChunks("test");
	String testAPTDT1 = "audio", testAPTDT2 = "pass";
	SamplingRate testSR = SamplingRate._16KHZ;
	Integer testMaxDuration = 1, testCorrelationID = 0;
	BitsPerSample testBits = BitsPerSample._16_BIT;
	AudioType testAT = AudioType.PCM;
	Boolean testMute = false;	
	PerformAudioPassThru testPAPT;
	
	// Test -- BuildPerformAudioPassThru(String ttsText, String audioPassThruDisplayText1, String audioPassThruDisplayText2, SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample, AudioType audioType, Boolean muteAudio, Integer correlationID)
	// ^ Calls another build method.
	
	// Test -- BuildPerformAudioPassThru(Vector<TTSChunk> initialPrompt, String audioPassThruDisplayText1, String audioPassThruDisplayText2, SamplingRate samplingRate, Integer maxDuration, BitsPerSample bitsPerSample, AudioType audioType, Boolean muteAudio, Integer correlationID)
	testPAPT = RPCRequestFactory.BuildPerformAudioPassThru(testInitialPrompt, testAPTDT1, testAPTDT2, testSR, testMaxDuration, testBits, testAT, testMute, testCorrelationID);
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testInitialPrompt, testPAPT.getInitialPrompt()));
	assertEquals(Test.MATCH, testAPTDT1, testPAPT.getAudioPassThruDisplayText1());
	assertEquals(Test.MATCH, testAPTDT2, testPAPT.getAudioPassThruDisplayText2());
	assertEquals(Test.MATCH, testSR, testPAPT.getSamplingRate());
	assertEquals(Test.MATCH, testMaxDuration, testPAPT.getMaxDuration());
	assertEquals(Test.MATCH, testBits, testPAPT.getBitsPerSample());
	assertEquals(Test.MATCH, testAT, testPAPT.getAudioType());
	assertEquals(Test.MATCH, testMute, testPAPT.getMuteAudio());
	assertEquals(Test.MATCH, testCorrelationID, testPAPT.getCorrelationID());
	
	testPAPT = RPCRequestFactory.BuildPerformAudioPassThru((Vector<TTSChunk>) null, null, null, null, null, null, null, null, null);
	assertNull(Test.NULL, testPAPT.getInitialPrompt());
	assertNull(Test.NULL, testPAPT.getAudioPassThruDisplayText1());
	assertNull(Test.NULL, testPAPT.getAudioPassThruDisplayText2());
	assertNull(Test.NULL, testPAPT.getSamplingRate());
	assertNull(Test.NULL, testPAPT.getMaxDuration());
	assertNull(Test.NULL, testPAPT.getBitsPerSample());
	assertNull(Test.NULL, testPAPT.getAudioType());
	assertNull(Test.NULL, testPAPT.getMuteAudio());
	assertNotNull(Test.NOT_NULL, testPAPT.getCorrelationID());
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:38,代码来源:RPCRequestFactoryTests.java

示例4: prepareListItemsCmds

import com.smartdevicelink.proxy.TTSChunkFactory; //导入方法依赖的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<TTSChunk> intitial_prompt = TTSChunkFactory.createSimpleTTSChunks(initialPrompt);
	Vector<TTSChunk> help_prompt = TTSChunkFactory.createSimpleTTSChunks(helpPrompt);
	Vector<TTSChunk> timeout_prompt = TTSChunkFactory.createSimpleTTSChunks(timeoutPrompt);
	Vector<Integer> interactionChoiceSetIDs = new Vector<Integer>();
	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);
	}

}
 
开发者ID:smartdevicelink,项目名称:sdl_mobileweather_tutorial_android,代码行数:46,代码来源:SmartDeviceLinkService.java

示例5: testBuildRegisterAppInterface

import com.smartdevicelink.proxy.TTSChunkFactory; //导入方法依赖的package包/类
public void testBuildRegisterAppInterface () {
	
	SdlMsgVersion testSMV = new SdlMsgVersion();
	testSMV.setMajorVersion(1);
	testSMV.setMinorVersion(0);
	String testAppName = "test", testNGN = "ngn", testAppID = "id";
	Vector<TTSChunk> testTTSName = TTSChunkFactory.createSimpleTTSChunks("name");
	Vector<String> testSynonyms = new Vector<String>();
	testSynonyms.add("examine");
	Boolean testIMA = false;
	Integer testCorrelationID = 0;
	Language testLang = Language.EN_US, testHMILang = Language.EN_GB;
	Vector<AppHMIType> testHMIType = new Vector<AppHMIType>();
	testHMIType.add(AppHMIType.DEFAULT);
	DeviceInfo testDI = RPCRequestFactory.BuildDeviceInfo(null);
	RegisterAppInterface testRAI;
	
	// Test -- buildRegisterAppInterface(String appName, String appID)
	// ^ Calls another build method.
	
	// Test -- buildRegisterAppInterface(String appName, Boolean isMediaApp, String appID)
	// ^ Calls another build method.
	
	// Test -- buildRegisterAppInterface(SdlMsgVersion sdlMsgVersion, String appName, Vector<TTSChunk> ttsName, String ngnMediaScreenAppName, Vector<String> vrSynonyms, Boolean isMediaApp,  Language languageDesired, Language hmiDisplayLanguageDesired, Vector<AppHMIType> appType, String appID, Integer correlationID)
	testRAI = RPCRequestFactory.buildRegisterAppInterface(testSMV, testAppName, testTTSName, testNGN, testSynonyms, testIMA, testLang, testHMILang, testHMIType, testAppID, testCorrelationID,testDI);
	assertTrue(Test.TRUE, Validator.validateSdlMsgVersion(testSMV, testRAI.getSdlMsgVersion()));
	assertEquals(Test.MATCH, testAppName, testRAI.getAppName());
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testTTSName, testRAI.getTtsName()));
	assertEquals(Test.MATCH, testNGN, testRAI.getNgnMediaScreenAppName());
	assertTrue(Test.TRUE, Validator.validateStringList(testSynonyms, testRAI.getVrSynonyms()));
	assertEquals(Test.MATCH, testIMA, testRAI.getIsMediaApplication());
	assertEquals(Test.MATCH, testLang, testRAI.getLanguageDesired());
	assertEquals(Test.MATCH, testHMILang, testRAI.getHmiDisplayLanguageDesired());
	assertEquals(Test.MATCH, AppHMIType.DEFAULT, testRAI.getAppHMIType().get(0));
	assertEquals(Test.MATCH, testAppID, testRAI.getAppID());
	assertEquals(Test.MATCH, testCorrelationID, testRAI.getCorrelationID());
	assertEquals(Test.MATCH, testDI, testRAI.getDeviceInfo());

	
	testRAI = RPCRequestFactory.buildRegisterAppInterface(null, null, null, null, null, null, null, null, null, null, null,null);
	assertEquals(Test.MATCH, (Integer) 1, testRAI.getCorrelationID());
	assertEquals(Test.MATCH, testSMV.getMajorVersion(), testRAI.getSdlMsgVersion().getMajorVersion());
	assertEquals(Test.MATCH, testSMV.getMinorVersion(), testRAI.getSdlMsgVersion().getMinorVersion());
	assertNull(Test.NULL, testRAI.getAppName());
	assertNull(Test.NULL, testRAI.getTtsName());
	assertNull(Test.NULL, testRAI.getNgnMediaScreenAppName());
	assertNull(Test.NULL, testRAI.getVrSynonyms());
	assertNull(Test.NULL, testRAI.getIsMediaApplication());
	assertNotNull(Test.NOT_NULL, testRAI.getLanguageDesired());
	assertNotNull(Test.NOT_NULL, testRAI.getHmiDisplayLanguageDesired());
	assertNull(Test.NULL, testRAI.getAppHMIType());
	assertNull(Test.NULL, testRAI.getAppID());
	assertNull(Test.NULL, testRAI.getDeviceInfo());
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:55,代码来源:RPCRequestFactoryTests.java

示例6: testBuildSetGlobalProperties

import com.smartdevicelink.proxy.TTSChunkFactory; //导入方法依赖的package包/类
public void testBuildSetGlobalProperties () {
	
	Vector<TTSChunk> testHelpChunks = TTSChunkFactory.createSimpleTTSChunks("test"),
			testTimeoutChunks = TTSChunkFactory.createSimpleTTSChunks("timeout");
	Vector<VrHelpItem> testVrHelp = new Vector<VrHelpItem>();
	VrHelpItem testItem = new VrHelpItem();
	testItem.setPosition(0);
	testItem.setText("text");
	Image image = new Image();
	image.setValue("value");
	image.setImageType(ImageType.DYNAMIC);
	testItem.setImage(image);
	testVrHelp.add(testItem);
	Integer testCorrelationID = 0;
	String testHelpTitle = "help";
	SetGlobalProperties testSBP;
	
	// Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, Integer correlationID)
	// ^ Calls another build method.
	
	// Test -- buildSetGlobalProperties(Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, Integer correlationID)
	testSBP = RPCRequestFactory.buildSetGlobalProperties(testHelpChunks, testTimeoutChunks, testCorrelationID);
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
	assertEquals(Test.MATCH, testCorrelationID, testSBP.getCorrelationID());
	
	testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null);
	assertNull(Test.NULL, testSBP.getHelpPrompt());
	assertNull(Test.NULL, testSBP.getTimeoutPrompt());
	assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
	
	// Test -- buildSetGlobalProperties(String helpPrompt, String timeoutPrompt, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
	// ^ Calls another build method.
	
	// Test -- buildSetGlobalProperties(Vector<TTSChunk> helpChunks, Vector<TTSChunk> timeoutChunks, String vrHelpTitle, Vector<VrHelpItem> vrHelp, Integer correlationID)
	testSBP = RPCRequestFactory.buildSetGlobalProperties(testHelpChunks, testTimeoutChunks, testHelpTitle, testVrHelp, testCorrelationID);
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testHelpChunks, testSBP.getHelpPrompt()));
	assertTrue(Test.TRUE, Validator.validateTtsChunks(testTimeoutChunks, testSBP.getTimeoutPrompt()));
	assertEquals(Test.MATCH, testHelpTitle, testSBP.getVrHelpTitle());
	assertTrue(Test.TRUE, Validator.validateVrHelpItems(testVrHelp, testSBP.getVrHelp()));
	assertEquals(Test.MATCH, testCorrelationID, testSBP.getCorrelationID());
	
	testSBP = RPCRequestFactory.buildSetGlobalProperties((Vector<TTSChunk>) null, null, null, null, null);
	assertNull(Test.NULL, testSBP.getHelpPrompt());
	assertNull(Test.NULL, testSBP.getTimeoutPrompt());
	assertNull(Test.NULL, testSBP.getVrHelpTitle());
	assertNull(Test.NULL, testSBP.getVrHelp());
	assertNotNull(Test.NOT_NULL, testSBP.getCorrelationID());
}
 
开发者ID:smartdevicelink,项目名称:sdl_android,代码行数:50,代码来源:RPCRequestFactoryTests.java


注:本文中的com.smartdevicelink.proxy.TTSChunkFactory.createSimpleTTSChunks方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。