本文整理汇总了Java中com.smartdevicelink.proxy.TTSChunkFactory类的典型用法代码示例。如果您正苦于以下问题:Java TTSChunkFactory类的具体用法?Java TTSChunkFactory怎么用?Java TTSChunkFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TTSChunkFactory类属于com.smartdevicelink.proxy包,在下文中一共展示了TTSChunkFactory类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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());
}
示例2: testCreateChunk
import com.smartdevicelink.proxy.TTSChunkFactory; //导入依赖的package包/类
/**
* This is a unit test for the following methods :
* {@link com.smartdevicelink.proxy.TTSChunkFactory#createChunk(SpeechCapabilities, String)}
*/
public void testCreateChunk () {
// Valid Tests
SpeechCapabilities testType = SpeechCapabilities.TEXT;
testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
assertNotNull(Test.NOT_NULL, testChunk);
assertEquals(Test.MATCH, testType, testChunk.getType());
assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.SILENCE;
testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
assertNotNull(Test.NOT_NULL, testChunk);
assertEquals(Test.MATCH, testType, testChunk.getType());
assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.SAPI_PHONEMES;
testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
assertNotNull(Test.NOT_NULL, testChunk);
assertEquals(Test.MATCH, testType, testChunk.getType());
assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.PRE_RECORDED;
testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
assertNotNull(Test.NOT_NULL, testChunk);
assertEquals(Test.MATCH, testType, testChunk.getType());
assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
testType = SpeechCapabilities.LHPLUS_PHONEMES;
testChunk = TTSChunkFactory.createChunk(testType, Test.GENERAL_STRING);
assertNotNull(Test.NOT_NULL, testChunk);
assertEquals(Test.MATCH, testType, testChunk.getType());
assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunk.getText());
// Invalid/Null Tests
testChunk = TTSChunkFactory.createChunk(null, null);
assertNotNull(Test.NOT_NULL, testChunk);
assertNull(Test.NULL, testChunk.getType());
assertNull(Test.NULL, testChunk.getText());
}
示例3: 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);
}
示例4: testCreatePrerecordedTTSChunks
import com.smartdevicelink.proxy.TTSChunkFactory; //导入依赖的package包/类
/**
* This is a unit test for the following methods :
* {@link com.smartdevicelink.proxy.TTSChunkFactory#createPrerecordedTTSChunks(String)}
*/
public void testCreatePrerecordedTTSChunks () {
// Test Values
Vector<TTSChunk> testChunks;
testChunks = TTSChunkFactory.createPrerecordedTTSChunks(Test.GENERAL_STRING);
// Valid Tests
assertNotNull(Test.NOT_NULL, testChunks);
assertEquals(Test.MATCH, SpeechCapabilities.PRE_RECORDED, testChunks.get(0).getType());
assertEquals(Test.MATCH, Test.GENERAL_STRING, testChunks.get(0).getText());
// Invalid/Null Tests
testChunks = TTSChunkFactory.createPrerecordedTTSChunks(null);
assertNull(Test.NULL, testChunks);
}
示例5: 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());
}
示例6: 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
示例7: 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());
}
示例8: 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());
}