本文整理汇总了Java中com.smartdevicelink.proxy.rpc.DisplayCapabilities类的典型用法代码示例。如果您正苦于以下问题:Java DisplayCapabilities类的具体用法?Java DisplayCapabilities怎么用?Java DisplayCapabilities使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DisplayCapabilities类属于com.smartdevicelink.proxy.rpc包,在下文中一共展示了DisplayCapabilities类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testParseRAI
import com.smartdevicelink.proxy.rpc.DisplayCapabilities; //导入依赖的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)));
}
示例2: getDisplayCapabilities
import com.smartdevicelink.proxy.rpc.DisplayCapabilities; //导入依赖的package包/类
/**
* Gets displayCapabilities set when application interface is registered.
*
* @return displayCapabilities
* @throws SdlException
* @deprecated use {@link SystemCapabilityManager#getCapability(SystemCapabilityType)} instead
*/
@Deprecated
public DisplayCapabilities getDisplayCapabilities() 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 displayCapabilities.", SdlExceptionCause.SDL_UNAVAILABLE);
}
return ( DisplayCapabilities ) _systemCapabilityManager.getCapability(SystemCapabilityType.DISPLAY);
}
示例3: setUp
import com.smartdevicelink.proxy.rpc.DisplayCapabilities; //导入依赖的package包/类
@Override
public void setUp(){
msg = new DisplayCapabilities();
msg.setGraphicSupported(Test.GENERAL_BOOLEAN);
msg.setNumCustomPresetsAvailable(Test.GENERAL_INT);
msg.setDisplayType(Test.GENERAL_DISPLAYTYPE);
msg.setImageFields(Test.GENERAL_IMAGEFIELD_LIST);
msg.setTextFields(Test.GENERAL_TEXTFIELD_LIST);
msg.setMediaClockFormats(Test.GENERAL_MEDIACLOCKFORMAT_LIST);
msg.setScreenParams(Test.GENERAL_SCREENPARAMS);
msg.setTemplatesAvailable(Test.GENERAL_STRING_LIST);
}
示例4: testJsonConstructor
import com.smartdevicelink.proxy.rpc.DisplayCapabilities; //导入依赖的package包/类
/**
* Tests a valid JSON construction of this RPC message.
*/
public void testJsonConstructor () {
JSONObject commandJson = JsonFileReader.readId(this.mContext, getCommandType(), getMessageType());
assertNotNull(Test.NOT_NULL, commandJson);
try {
Hashtable<String, Object> hash = JsonRPCMarshaller.deserializeJSONObject(commandJson);
SetDisplayLayoutResponse cmd = new SetDisplayLayoutResponse(hash);
JSONObject body = JsonUtils.readJsonObjectFromJsonObject(commandJson, getMessageType());
assertNotNull(Test.NOT_NULL, body);
// Test everything in the json body.
assertEquals(Test.MATCH, JsonUtils.readStringFromJsonObject(body, RPCMessage.KEY_FUNCTION_NAME), cmd.getFunctionName());
assertEquals(Test.MATCH, JsonUtils.readIntegerFromJsonObject(body, RPCMessage.KEY_CORRELATION_ID), cmd.getCorrelationID());
JSONObject parameters = JsonUtils.readJsonObjectFromJsonObject(body, RPCMessage.KEY_PARAMETERS);
JSONArray buttonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_BUTTON_CAPABILITIES);
List<ButtonCapabilities> buttonCapabilitiesList = new ArrayList<ButtonCapabilities>();
for (int index = 0; index < buttonCapabilitiesArray.length(); index++) {
ButtonCapabilities buttonCapability = new ButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)buttonCapabilitiesArray.get(index) ));
buttonCapabilitiesList.add(buttonCapability);
}
assertTrue(Test.TRUE, Validator.validateButtonCapabilities(buttonCapabilitiesList, cmd.getButtonCapabilities() ));
JSONObject displayCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_DISPLAY_CAPABILITIES);
DisplayCapabilities displayCapabilities = new DisplayCapabilities(JsonRPCMarshaller.deserializeJSONObject(displayCapabilitiesObj));
assertTrue(Test.TRUE, Validator.validateDisplayCapabilities(displayCapabilities, cmd.getDisplayCapabilities()) );
JSONArray softButtonCapabilitiesArray = JsonUtils.readJsonArrayFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_SOFT_BUTTON_CAPABILITIES);
List<SoftButtonCapabilities> softButtonCapabilitiesList = new ArrayList<SoftButtonCapabilities>();
for (int index = 0; index < softButtonCapabilitiesArray.length(); index++) {
SoftButtonCapabilities softButtonCapability =
new SoftButtonCapabilities(JsonRPCMarshaller.deserializeJSONObject( (JSONObject)softButtonCapabilitiesArray.get(index) ));
softButtonCapabilitiesList.add(softButtonCapability);
}
assertTrue(Test.TRUE, Validator.validateSoftButtonCapabilities(softButtonCapabilitiesList, cmd.getSoftButtonCapabilities() ));
JSONObject presetBankCapabilitiesObj = JsonUtils.readJsonObjectFromJsonObject(parameters, SetDisplayLayoutResponse.KEY_PRESET_BANK_CAPABILITIES);
PresetBankCapabilities presetBankCapabilities = new PresetBankCapabilities(JsonRPCMarshaller.deserializeJSONObject(presetBankCapabilitiesObj));
assertTrue(Test.TRUE, Validator.validatePresetBankCapabilities(presetBankCapabilities, cmd.getPresetBankCapabilities()) );
} catch (JSONException e) {
e.printStackTrace();
}
}
示例5: testGetObject
import com.smartdevicelink.proxy.rpc.DisplayCapabilities; //导入依赖的package包/类
public void testGetObject(){
String keyIsEmpty = "EMPTY";
assertNull(testMessage.getObject(Integer.class, keyIsEmpty));
String keyLanguage = ChangeRegistration.KEY_LANGUAGE;
Language language = Test.GENERAL_LANGUAGE;
testMessage.setParameters(keyLanguage, language);
assertEquals(Test.MATCH, language, testMessage.getObject(Language.class, keyLanguage));
String languageString = language.toString();
testMessage.setParameters(keyLanguage, languageString);
assertEquals(Test.MATCH, language, testMessage.getObject(Language.class, keyLanguage));
String keyImage = Choice.KEY_IMAGE;
Image testImage = Test.GENERAL_IMAGE;
testMessage.setParameters(keyImage, testImage.getStore());
assertTrue(Validator.validateImage(testImage, (Image) testMessage.getObject(Image.class, keyImage)));
String keyDTCs = GetDTCsResponse.KEY_DTC;
List<String> testDTCs = Test.GENERAL_STRING_LIST;
testMessage.setParameters(keyDTCs, testDTCs);
assertEquals(Test.MATCH, testDTCs, testMessage.getObject(String.class, keyDTCs));
String keyTTSchunks = Alert.KEY_TTS_CHUNKS;
List<TTSChunk> testTTSchunks = Test.GENERAL_TTSCHUNK_LIST;
testMessage.setParameters(keyTTSchunks, testTTSchunks);
assertEquals(Test.MATCH, testTTSchunks, testMessage.getObject(TTSChunk.class, keyTTSchunks));
List<Hashtable<String, Object>> testListTTSchunks = new ArrayList<>();
for(TTSChunk ttsChunk : testTTSchunks){
testListTTSchunks.add(ttsChunk.getStore());
}
testMessage.setParameters(keyTTSchunks, testListTTSchunks);
List<TTSChunk> underTest = (List<TTSChunk>) testMessage.getObject(TTSChunk.class, keyTTSchunks);
assertTrue(Validator.validateTtsChunks(testTTSchunks, underTest));
String keyMediaClockFormats = DisplayCapabilities.KEY_MEDIA_CLOCK_FORMATS;
List<MediaClockFormat> testMediaClockFormats = Test.GENERAL_MEDIACLOCKFORMAT_LIST;
testMessage.setParameters(keyMediaClockFormats, testMediaClockFormats);
assertEquals(Test.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
List<String> testListMediaClockFormats = new ArrayList<>();
for(MediaClockFormat mcFormat : testMediaClockFormats){
testListMediaClockFormats.add(mcFormat.toString());
}
testMessage.setParameters(keyMediaClockFormats, testListMediaClockFormats);
assertEquals(Test.MATCH, testMediaClockFormats, testMessage.getObject(MediaClockFormat.class, keyMediaClockFormats));
assertNull(testMessage.getObject(Image.class, keyLanguage)); // Test incorrect class
}