1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
4 import java.util.Vector;
\r
6 import com.smartdevicelink.exception.SmartDeviceLinkException;
\r
7 import com.smartdevicelink.proxy.RPCResponse;
\r
8 import com.smartdevicelink.proxy.Version;
\r
9 import com.smartdevicelink.proxy.constants.Names;
\r
10 import com.smartdevicelink.proxy.rpc.enums.HmiZoneCapabilities;
\r
11 import com.smartdevicelink.proxy.rpc.enums.Language;
\r
12 import com.smartdevicelink.proxy.rpc.enums.SpeechCapabilities;
\r
13 import com.smartdevicelink.proxy.rpc.enums.VrCapabilities;
\r
14 import com.smartdevicelink.util.DebugTool;
\r
17 * Register AppInterface Response is sent, when RegisterAppInterface has been called
\r
19 * @since SmartDeviceLink 1.0
\r
21 public class RegisterAppInterfaceResponse extends RPCResponse {
\r
23 * Constructs a new RegisterAppInterfaceResponse object
\r
25 public RegisterAppInterfaceResponse() {
\r
26 super("RegisterAppInterface");
\r
30 * Constructs a new RegisterAppInterfaceResponse object indicated by the Hashtable
\r
35 * The Hashtable to use
\r
37 public RegisterAppInterfaceResponse(Hashtable hash) {
\r
42 * Gets the version of the SMARTDEVICELINK® SmartDeviceLink interface
\r
44 * @return smartdevicelinkMsgVersion -a smartdevicelinkMsgVersion object representing version of
\r
45 * the SMARTDEVICELINK® SmartDeviceLink interface
\r
47 public smartdevicelinkMsgVersion getsmartdevicelinkMsgVersion() {
\r
48 Object obj = parameters.get(Names.smartDeviceLinkMsgVersion);
\r
49 if (obj instanceof smartdevicelinkMsgVersion) {
\r
50 return (smartdevicelinkMsgVersion)obj;
\r
51 } else if (obj instanceof Hashtable) {
\r
52 return new smartdevicelinkMsgVersion((Hashtable)obj);
\r
58 * Sets the version of the SMARTDEVICELINK® SmartDeviceLink interface
\r
60 * @param smartDeviceLinkMsgVersion
\r
61 * a smartdevicelinkMsgVersion object representing version of the SMARTDEVICELINK®
\r
62 * SmartDeviceLink interface
\r
64 * <b>Notes: </b>To be compatible, app msg major version number
\r
65 * must be less than or equal to SMARTDEVICELINK® major version number.
\r
66 * If msg versions are incompatible, app has 20 seconds to
\r
67 * attempt successful RegisterAppInterface (w.r.t. msg version)
\r
68 * on underlying protocol session, else will be terminated. Major
\r
69 * version number is a compatibility declaration. Minor version
\r
70 * number indicates minor functional variations (e.g. features,
\r
71 * capabilities, bug fixes) when sent from SMARTDEVICELINK® to app (in
\r
72 * RegisterAppInterface response). However, the minor version
\r
73 * number sent from the app to SMARTDEVICELINK® (in RegisterAppInterface
\r
74 * request) is ignored by SMARTDEVICELINK®
\r
76 public void setsmartdevicelinkMsgVersion(smartdevicelinkMsgVersion smartDeviceLinkMsgVersion) {
\r
77 if (smartDeviceLinkMsgVersion != null) {
\r
78 parameters.put(Names.smartDeviceLinkMsgVersion, smartDeviceLinkMsgVersion);
\r
83 * Gets a Language enumeration indicating what language the application
\r
84 * intends to use for user interaction (Display, TTS and VR)
\r
86 * @return Enumeration -a language enumeration
\r
88 public Language getLanguage() {
\r
89 Object obj = parameters.get(Names.language);
\r
90 if (obj instanceof Language) {
\r
91 return (Language) obj;
\r
92 } else if (obj instanceof String) {
\r
93 Language theCode = null;
\r
95 theCode = Language.valueForString((String) obj);
\r
96 } catch (Exception e) {
\r
97 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.language, e);
\r
105 * Sets an enumeration indicating what language the application intends to
\r
106 * use for user interaction (Display, TTS and VR)
\r
109 * a Language Enumeration
\r
113 public void setLanguage(Language language) {
\r
114 if (language != null) {
\r
115 parameters.put(Names.language, language);
\r
120 * Gets an enumeration indicating what language the application intends to
\r
121 * use for user interaction ( Display)
\r
123 * @return Language - a Language value representing an enumeration
\r
124 * indicating what language the application intends to use for user
\r
125 * interaction ( Display)
\r
126 * @since SmartDeviceLink 2.0
\r
128 public Language getHmiDisplayLanguage() {
\r
129 Object obj = parameters.get(Names.hmiDisplayLanguage);
\r
130 if (obj instanceof Language) {
\r
131 return (Language) obj;
\r
132 } else if (obj instanceof String) {
\r
133 Language theCode = null;
\r
135 theCode = Language.valueForString((String) obj);
\r
136 } catch (Exception e) {
\r
137 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.hmiDisplayLanguage, e);
\r
145 * Sets an enumeration indicating what language the application intends to
\r
146 * use for user interaction ( Display)
\r
148 * @param hmiDisplayLanguage
\r
149 * @since SmartDeviceLink 2.0
\r
151 public void setHmiDisplayLanguage(Language hmiDisplayLanguage) {
\r
152 if (hmiDisplayLanguage != null) {
\r
153 parameters.put(Names.hmiDisplayLanguage, hmiDisplayLanguage);
\r
155 parameters.remove(Names.hmiDisplayLanguage);
\r
160 * Gets getDisplayCapabilities set when application interface is registered.
\r
162 * @return DisplayCapabilities
\r
164 public DisplayCapabilities getDisplayCapabilities() {
\r
165 Object obj = parameters.get(Names.displayCapabilities);
\r
166 if (obj instanceof DisplayCapabilities) {
\r
167 return (DisplayCapabilities)obj;
\r
168 } else if (obj instanceof Hashtable) {
\r
169 return new DisplayCapabilities((Hashtable)obj);
\r
174 * Sets Display Capabilities
\r
175 * @param displayCapabilities
\r
177 public void setDisplayCapabilities(DisplayCapabilities displayCapabilities) {
\r
178 if (displayCapabilities != null) {
\r
179 parameters.put(Names.displayCapabilities, displayCapabilities);
\r
184 * Gets buttonCapabilities set when application interface is registered.
\r
186 * @return buttonCapabilities
\r
188 public Vector<ButtonCapabilities> getButtonCapabilities() {
\r
189 if (parameters.get(Names.buttonCapabilities) instanceof Vector<?>) {
\r
190 Vector<?> list = (Vector<?>)parameters.get(Names.buttonCapabilities);
\r
191 if (list != null && list.size() > 0) {
\r
192 Object obj = list.get(0);
\r
193 if (obj instanceof ButtonCapabilities) {
\r
194 return (Vector<ButtonCapabilities>) list;
\r
195 } else if (obj instanceof Hashtable) {
\r
196 Vector<ButtonCapabilities> newList = new Vector<ButtonCapabilities>();
\r
197 for (Object hashObj : list) {
\r
198 newList.add(new ButtonCapabilities((Hashtable)hashObj));
\r
207 * Sets Button Capabilities
\r
208 * @param buttonCapabilities
\r
210 public void setButtonCapabilities(Vector<ButtonCapabilities> buttonCapabilities) {
\r
211 if (buttonCapabilities != null) {
\r
212 parameters.put(Names.buttonCapabilities, buttonCapabilities);
\r
216 * Gets getSoftButtonCapabilities set when application interface is registered.
\r
218 * @return SoftButtonCapabilities
\r
220 public Vector<SoftButtonCapabilities> getSoftButtonCapabilities() {
\r
221 if (parameters.get(Names.softButtonCapabilities) instanceof Vector<?>) {
\r
222 Vector<?> list = (Vector<?>)parameters.get(Names.softButtonCapabilities);
\r
223 if (list != null && list.size() > 0) {
\r
224 Object obj = list.get(0);
\r
225 if (obj instanceof SoftButtonCapabilities) {
\r
226 return (Vector<SoftButtonCapabilities>) list;
\r
227 } else if (obj instanceof Hashtable) {
\r
228 Vector<SoftButtonCapabilities> newList = new Vector<SoftButtonCapabilities>();
\r
229 for (Object hashObj : list) {
\r
230 newList.add(new SoftButtonCapabilities((Hashtable)hashObj));
\r
239 * Sets softButtonCapabilities
\r
240 * @param softButtonCapabilities
\r
242 public void setSoftButtonCapabilities(Vector<SoftButtonCapabilities> softButtonCapabilities) {
\r
243 if (softButtonCapabilities != null) {
\r
244 parameters.put(Names.softButtonCapabilities, softButtonCapabilities);
\r
249 * Gets getPresetBankCapabilities set when application interface is registered.
\r
251 * @return PresetBankCapabilities
\r
253 public PresetBankCapabilities getPresetBankCapabilities() {
\r
254 Object obj = parameters.get(Names.presetBankCapabilities);
\r
255 if (obj instanceof PresetBankCapabilities) {
\r
256 return (PresetBankCapabilities)obj;
\r
257 } else if (obj instanceof Hashtable) {
\r
258 return new PresetBankCapabilities((Hashtable)obj);
\r
263 * Sets presetBankCapabilities
\r
264 * @param presetBankCapabilities
\r
266 public void setPresetBankCapabilities(PresetBankCapabilities presetBankCapabilities) {
\r
267 if (presetBankCapabilities != null) {
\r
268 parameters.put(Names.presetBankCapabilities, presetBankCapabilities);
\r
273 * Gets hmiZoneCapabilities set when application interface is registered.
\r
275 * @return HmiZoneCapabilities
\r
277 public Vector<HmiZoneCapabilities> getHmiZoneCapabilities() {
\r
278 if (parameters.get(Names.hmiZoneCapabilities) instanceof Vector<?>) {
\r
279 Vector<?> list = (Vector<?>)parameters.get(Names.hmiZoneCapabilities);
\r
280 if (list != null && list.size() > 0) {
\r
281 Object obj = list.get(0);
\r
282 if (obj instanceof HmiZoneCapabilities) {
\r
283 return (Vector<HmiZoneCapabilities>) list;
\r
284 } else if (obj instanceof String) {
\r
285 Vector<HmiZoneCapabilities> newList = new Vector<HmiZoneCapabilities>();
\r
286 for (Object hashObj : list) {
\r
287 String strFormat = (String)hashObj;
\r
288 HmiZoneCapabilities toAdd = null;
\r
290 toAdd = HmiZoneCapabilities.valueForString(strFormat);
\r
291 } catch (Exception e) {
\r
292 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.hmiZoneCapabilities, e);
\r
294 if (toAdd != null) {
\r
295 newList.add(toAdd);
\r
305 * Sets hmiZoneCapabilities
\r
306 * @param hmiZoneCapabilities
\r
308 public void setHmiZoneCapabilities(Vector<HmiZoneCapabilities> hmiZoneCapabilities) {
\r
309 if (hmiZoneCapabilities != null) {
\r
310 parameters.put(Names.hmiZoneCapabilities, hmiZoneCapabilities);
\r
315 * Gets speechCapabilities set when application interface is registered.
\r
317 * @return SpeechCapabilities
\r
319 public Vector<SpeechCapabilities> getSpeechCapabilities() {
\r
320 if (parameters.get(Names.speechCapabilities) instanceof Vector<?>) {
\r
321 Vector<?> list = (Vector<?>)parameters.get(Names.speechCapabilities);
\r
322 if (list != null && list.size() > 0) {
\r
323 Object obj = list.get(0);
\r
324 if (obj instanceof SpeechCapabilities) {
\r
325 return (Vector<SpeechCapabilities>) list;
\r
326 } else if (obj instanceof String) {
\r
327 Vector<SpeechCapabilities> newList = new Vector<SpeechCapabilities>();
\r
328 for (Object hashObj : list) {
\r
329 String strFormat = (String)hashObj;
\r
330 SpeechCapabilities toAdd = null;
\r
332 toAdd = SpeechCapabilities.valueForString(strFormat);
\r
333 } catch (Exception e) {
\r
334 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.speechCapabilities, e);
\r
336 if (toAdd != null) {
\r
337 newList.add(toAdd);
\r
347 * Sets speechCapabilities
\r
348 * @param speechCapabilities
\r
350 public void setSpeechCapabilities(Vector<SpeechCapabilities> speechCapabilities) {
\r
351 if (speechCapabilities != null) {
\r
352 parameters.put(Names.speechCapabilities, speechCapabilities);
\r
357 * Gets vrCapabilities set when application interface is registered.
\r
359 * @return VrCapabilities
\r
361 public Vector<VrCapabilities> getVrCapabilities() {
\r
362 if (parameters.get(Names.vrCapabilities) instanceof Vector<?>) {
\r
363 Vector<?> list = (Vector<?>)parameters.get(Names.vrCapabilities);
\r
364 if (list != null && list.size() > 0) {
\r
365 Object obj = list.get(0);
\r
366 if (obj instanceof VrCapabilities) {
\r
367 return (Vector<VrCapabilities>) list;
\r
368 } else if (obj instanceof String) {
\r
369 Vector<VrCapabilities> newList = new Vector<VrCapabilities>();
\r
370 for (Object hashObj : list) {
\r
371 String strFormat = (String)hashObj;
\r
372 VrCapabilities toAdd = null;
\r
374 toAdd = VrCapabilities.valueForString(strFormat);
\r
375 } catch (Exception e) {
\r
376 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.vrCapabilities, e);
\r
378 if (toAdd != null) {
\r
379 newList.add(toAdd);
\r
389 * Sets VrCapabilities
\r
390 * @param vrCapabilities
\r
392 public void setVrCapabilities(Vector<VrCapabilities> vrCapabilities) {
\r
393 if (vrCapabilities != null) {
\r
394 parameters.put(Names.vrCapabilities, vrCapabilities);
\r
399 * Gets getVehicleType set when application interface is registered.
\r
401 * @return vehicleType
\r
403 public VehicleType getVehicleType() {
\r
404 Object obj = parameters.get(Names.vehicleType);
\r
405 if (obj instanceof VehicleType) {
\r
406 return (VehicleType)obj;
\r
407 } else if (obj instanceof Hashtable) {
\r
408 return new VehicleType((Hashtable)obj);
\r
414 * @param vehicleType
\r
416 public void setVehicleType(VehicleType vehicleType) {
\r
417 if (vehicleType != null) {
\r
418 parameters.put(Names.vehicleType, vehicleType);
\r
423 * Gets AudioPassThruCapabilities set when application interface is registered.
\r
425 * @return AudioPassThruCapabilities
\r
427 public Vector<AudioPassThruCapabilities> getAudioPassThruCapabilities() {
\r
428 if (parameters.get(Names.audioPassThruCapabilities) instanceof Vector<?>) {
\r
429 Vector<?> list = (Vector<?>)parameters.get(Names.audioPassThruCapabilities);
\r
430 if (list != null && list.size() > 0) {
\r
431 Object obj = list.get(0);
\r
432 if (obj instanceof AudioPassThruCapabilities) {
\r
433 return (Vector<AudioPassThruCapabilities>) list;
\r
434 } else if (obj instanceof Hashtable) {
\r
435 Vector<AudioPassThruCapabilities> newList = new Vector<AudioPassThruCapabilities>();
\r
436 for (Object hashObj : list) {
\r
437 newList.add(new AudioPassThruCapabilities((Hashtable)hashObj));
\r
446 * Sets AudioPassThruCapabilities
\r
447 * @param audioPassThruCapabilities
\r
449 public void setAudioPassThruCapabilities(Vector<AudioPassThruCapabilities> audioPassThruCapabilities) {
\r
450 if (audioPassThruCapabilities != null) {
\r
451 parameters.put(Names.audioPassThruCapabilities, audioPassThruCapabilities);
\r
454 public String getProxyVersionInfo() {
\r
455 if (Version.VERSION != null)
\r
456 return Version.VERSION;
\r