本文整理汇总了Java中com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities类的典型用法代码示例。如果您正苦于以下问题:Java SpeechCapabilities类的具体用法?Java SpeechCapabilities怎么用?Java SpeechCapabilities使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SpeechCapabilities类属于com.smartdevicelink.proxy.rpc.enums包,在下文中一共展示了SpeechCapabilities类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: performWeatherAlert
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
private void performWeatherAlert(WeatherAlert alert) {
SimpleDateFormat timeFormat = new SimpleDateFormat(getResources().getString(R.string.weather_alerts_simpleDateFormat), Locale.getDefault());
String timeString = timeFormat.format(alert.dateExpires.getTime().getTime() * 1000);
String speakString = String.format(Locale.getDefault(), getResources().getString(R.string.weather_alerts_expires_at),
alert.message, timeString.replace(':', ' ').replace("00", ""));
Log.d(SmartDeviceLinkApplication.TAG, "performWeatherAlert: speak string - " + speakString);
Vector<TTSChunk> chunks = new Vector<TTSChunk>();
TTSChunk chunk = new TTSChunk();
chunk.setText(speakString);
chunk.setType(SpeechCapabilities.TEXT);
chunks.add(chunk);
Alert alertRequest = new Alert();
alertRequest.setTtsChunks(chunks);
alertRequest.setAlertText1(alert.message);
alertRequest.setDuration(7000);
int coId = autoIncCorrId++;
mLastAlertId = coId;
alertRequest.setCorrelationID(coId);
try {
proxy.sendRPCRequest(alertRequest);
} catch (SdlException e) {}
}
开发者ID:smartdevicelink,项目名称:sdl_mobileweather_tutorial_android,代码行数:26,代码来源:SmartDeviceLinkService.java
示例2: testValidEnums
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
/**
* Verifies that the enum values are not null upon valid assignment.
*/
public void testValidEnums () {
String example = "TEXT";
SpeechCapabilities enumText = SpeechCapabilities.valueForString(example);
example = "SAPI_PHONEMES";
SpeechCapabilities enumSapiPhonemes = SpeechCapabilities.valueForString(example);
example = "LHPLUS_PHONEMES";
SpeechCapabilities enumLhplusPhonemes = SpeechCapabilities.valueForString(example);
example = "PRE_RECORDED";
SpeechCapabilities enumPreRecorded = SpeechCapabilities.valueForString(example);
example = "SILENCE";
SpeechCapabilities enumSilence = SpeechCapabilities.valueForString(example);
assertNotNull("TEXT returned null", enumText);
assertNotNull("SAPI_PHONEMES returned null", enumSapiPhonemes);
assertNotNull("LHPLUS_PHONEMES returned null", enumLhplusPhonemes);
assertNotNull("PRE_RECORDED returned null", enumPreRecorded);
assertNotNull("SILENCE returned null", enumSilence);
}
示例3: testParseRAI
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
public void testParseRAI() {
systemCapabilityManager = createSampleManager();
assertTrue(Test.TRUE,
Validator.validateHMICapabilities(Test.GENERAL_HMICAPABILITIES, (HMICapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.HMI)));
assertTrue(Test.TRUE,
Validator.validateDisplayCapabilities(Test.GENERAL_DISPLAYCAPABILITIES, (DisplayCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY)));
assertTrue(Test.TRUE,
Validator.validateAudioPassThruCapabilities(Test.GENERAL_AUDIOPASSTHRUCAPABILITIES_LIST, (List<AudioPassThruCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.AUDIO_PASSTHROUGH)));
assertTrue(Test.TRUE,
Validator.validateButtonCapabilities(Test.GENERAL_BUTTONCAPABILITIES_LIST, (List<ButtonCapabilities> )systemCapabilityManager.getCapability(SystemCapabilityType.BUTTON)));
assertTrue(Test.TRUE,
Validator.validateHMIZoneCapabilities(Test.GENERAL_HMIZONECAPABILITIES_LIST, (List<HmiZoneCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.HMI_ZONE)));
assertTrue(Test.TRUE,
Validator.validatePresetBankCapabilities(Test.GENERAL_PRESETBANKCAPABILITIES, (PresetBankCapabilities) systemCapabilityManager.getCapability(SystemCapabilityType.PRESET_BANK)));
assertTrue(Test.TRUE,
Validator.validateSoftButtonCapabilities(Test.GENERAL_SOFTBUTTONCAPABILITIES_LIST, (List<SoftButtonCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SOFTBUTTON)));
assertTrue(Test.TRUE,
Validator.validateSpeechCapabilities(Test.GENERAL_SPEECHCAPABILITIES_LIST, (List<SpeechCapabilities>) systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH)));
}
示例4: getSpeechCapabilities
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
/**
* Gets speechCapabilities set when application interface is registered.
*
* @return speechCapabilities
* @throws SdlException
* @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
@Deprecated
public List<SpeechCapabilities> getSpeechCapabilities() throws SdlException {
// Test if proxy has been disposed
if (_proxyDisposed) {
throw new SdlException("This object has been disposed, it is no long capable of executing methods.", SdlExceptionCause.SDL_PROXY_DISPOSED);
}
// Test SDL availability
if (!_appInterfaceRegisterd || _systemCapabilityManager == null) {
throw new SdlException("SDL is unavailable. Unable to get the speechCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return convertToList(_systemCapabilityManager.getCapability(SystemCapabilityType.SPEECH), SpeechCapabilities.class);
}
示例5: createSimpleTTSChunks
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
public static Vector<TTSChunk> createSimpleTTSChunks(String simple) {
if (simple == null) {
return null;
}
Vector<TTSChunk> chunks = new Vector<TTSChunk>();
TTSChunk chunk = createChunk(SpeechCapabilities.TEXT, simple);
chunks.add(chunk);
return chunks;
}
示例6: createPrerecordedTTSChunks
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
public static Vector<TTSChunk> createPrerecordedTTSChunks(String prerecorded) {
if (prerecorded == null) {
return null;
}
Vector<TTSChunk> chunks = new Vector<TTSChunk>();
TTSChunk chunk = createChunk(SpeechCapabilities.PRE_RECORDED, prerecorded);
chunks.add(chunk);
return chunks;
}
示例7: validateSpeechCapabilities
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
public static boolean validateSpeechCapabilities(List<SpeechCapabilities> spA, List<SpeechCapabilities> spB){
for(int i = 0; i < spA.size(); i++){
if(!spA.get(i).equals(spB.get(i))){
return false;
}
}
return true;
}
示例8: testInvalidEnum
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
/**
* Verifies that an invalid assignment is null.
*/
public void testInvalidEnum () {
String example = "teXT";
try {
SpeechCapabilities temp = SpeechCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (IllegalArgumentException exception) {
fail("Invalid enum throws IllegalArgumentException.");
}
}
示例9: testNullEnum
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
/**
* Verifies that a null assignment is invalid.
*/
public void testNullEnum () {
String example = null;
try {
SpeechCapabilities temp = SpeechCapabilities.valueForString(example);
assertNull("Result of valueForString should be null.", temp);
}
catch (NullPointerException exception) {
fail("Null string throws NullPointerException.");
}
}
示例10: testListEnum
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
/**
* Verifies the possible enum values of SpeechCapabilities.
*/
public void testListEnum() {
List<SpeechCapabilities> enumValueList = Arrays.asList(SpeechCapabilities.values());
List<SpeechCapabilities> enumTestList = new ArrayList<SpeechCapabilities>();
enumTestList.add(SpeechCapabilities.TEXT);
enumTestList.add(SpeechCapabilities.SAPI_PHONEMES);
enumTestList.add(SpeechCapabilities.LHPLUS_PHONEMES);
enumTestList.add(SpeechCapabilities.PRE_RECORDED);
enumTestList.add(SpeechCapabilities.SILENCE);
assertTrue("Enum value list does not match enum class list",
enumValueList.containsAll(enumTestList) && enumTestList.containsAll(enumValueList));
}
示例11: testCreateChunk
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的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());
}
示例12: testCreateSimpleTTSChunks
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的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);
}
示例13: testCreatePrerecordedTTSChunks
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的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);
}
示例14: createChunk
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
public static TTSChunk createChunk(SpeechCapabilities type, String text) {
TTSChunk ret = new TTSChunk();
ret.setType(type);
ret.setText(text);
return ret;
}
示例15: getSpeechCapabilities
import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities; //导入依赖的package包/类
/**
* Gets speechCapabilities set when application interface is registered.
*
* @return SpeechCapabilities
*/
@SuppressWarnings("unchecked")
public List<SpeechCapabilities> getSpeechCapabilities() {
return (List<SpeechCapabilities>) getObject(SpeechCapabilities.class, KEY_SPEECH_CAPABILITIES);
}