1 package com.smartdevicelink.proxy.rpc;
\r
3 import java.util.Hashtable;
\r
4 import java.util.Vector;
\r
6 import com.smartdevicelink.proxy.RPCRequest;
\r
7 import com.smartdevicelink.proxy.constants.Names;
\r
8 import com.smartdevicelink.proxy.rpc.enums.TextAlignment;
\r
9 import com.smartdevicelink.util.DebugTool;
\r
12 * Updates the application's display text area, regardless of whether or not
\r
13 * this text area is visible to the user at the time of the request. The
\r
14 * application's display text area remains unchanged until updated by subsequent
\r
17 * The content of the application's display text area is visible to the user
\r
18 * when the application's {@linkplain com.smartdevicelink.proxy.rpc.enums.HMILevel}
\r
19 * is FULL or LIMITED, and the
\r
20 * {@linkplain com.smartdevicelink.proxy.rpc.enums.SystemContext}=MAIN and no
\r
21 * {@linkplain Alert} is in progress
\r
23 * The Show operation cannot be used to create an animated scrolling screen. To
\r
24 * avoid distracting the driver, Show commands cannot be issued more than once
\r
25 * every 4 seconds. Requests made more frequently than this will be rejected
\r
27 * <b>HMILevel needs to be FULL, LIMITED or BACKGROUND</b>
\r
30 * @since SmartDeviceLink 1.0
\r
32 * @see SetMediaClockTimer
\r
34 public class Show extends RPCRequest {
\r
37 * Constructs a new Show object
\r
43 * Constructs a new Show object indicated by the Hashtable parameter
\r
47 * The Hashtable to use
\r
49 public Show(Hashtable hash) {
\r
53 * Gets the text displayed in a single-line display, or in the upper display
\r
54 * line in a two-line display
\r
56 * @return String -a String value representing the text displayed in a
\r
57 * single-line display, or in the upper display line in a two-line
\r
60 public String getMainField1() {
\r
61 return (String) parameters.get(Names.mainField1);
\r
64 * Sets the text displayed in a single-line display, or in the upper display
\r
65 * line in a two-line display
\r
68 * the String value representing the text displayed in a
\r
69 * single-line display, or in the upper display line in a
\r
74 * <li>If this parameter is omitted, the text of mainField1 does
\r
76 * <li>If this parameter is an empty string, the field will be
\r
80 public void setMainField1(String mainField1) {
\r
81 if (mainField1 != null) {
\r
82 parameters.put(Names.mainField1, mainField1);
\r
84 parameters.remove(Names.mainField1);
\r
88 * Gets the text displayed on the second display line of a two-line display
\r
90 * @return String -a String value representing the text displayed on the
\r
91 * second display line of a two-line display
\r
93 public String getMainField2() {
\r
94 return (String) parameters.get(Names.mainField2);
\r
97 * Sets the text displayed on the second display line of a two-line display
\r
100 * the String value representing the text displayed on the second
\r
101 * display line of a two-line display
\r
105 * <li>If this parameter is omitted, the text of mainField2 does
\r
107 * <li>If this parameter is an empty string, the field will be
\r
109 * <li>If provided and the display is a single-line display, the
\r
110 * parameter is ignored</li>
\r
111 * <li>Maxlength = 500</li>
\r
114 public void setMainField2(String mainField2) {
\r
115 if (mainField2 != null) {
\r
116 parameters.put(Names.mainField2, mainField2);
\r
118 parameters.remove(Names.mainField2);
\r
123 * Gets the text displayed on the first display line of the second page
\r
125 * @return String -a String value representing the text displayed on the
\r
126 * first display line of the second page
\r
127 * @since SmartDeviceLink 2.0
\r
129 public String getMainField3() {
\r
130 return (String) parameters.get(Names.mainField3);
\r
134 * Sets the text displayed on the first display line of the second page
\r
136 * @param mainField3
\r
137 * the String value representing the text displayed on the first
\r
138 * display line of the second page
\r
142 * <li>If this parameter is omitted, the text of mainField3 does
\r
144 * <li>If this parameter is an empty string, the field will be
\r
146 * <li>If provided and the display is a single-line display, the
\r
147 * parameter is ignored</li>
\r
148 * <li>Maxlength = 500</li>
\r
150 * @since SmartDeviceLink 2.0
\r
152 public void setMainField3(String mainField3) {
\r
153 if (mainField3 != null) {
\r
154 parameters.put(Names.mainField3, mainField3);
\r
156 parameters.remove(Names.mainField3);
\r
161 * Gets the text displayed on the second display line of the second page
\r
163 * @return String -a String value representing the text displayed on the
\r
164 * first display line of the second page
\r
165 * @since SmartDeviceLink 2.0
\r
167 public String getMainField4() {
\r
168 return (String) parameters.get(Names.mainField4);
\r
172 * Sets the text displayed on the second display line of the second page
\r
174 * @param mainField4
\r
175 * the String value representing the text displayed on the second
\r
176 * display line of the second page
\r
180 * <li>If this parameter is omitted, the text of mainField4 does
\r
182 * <li>If this parameter is an empty string, the field will be
\r
184 * <li>If provided and the display is a single-line display, the
\r
185 * parameter is ignored</li>
\r
186 * <li>Maxlength = 500</li>
\r
188 * @since SmartDeviceLink 2.0
\r
190 public void setMainField4(String mainField4) {
\r
191 if (mainField4 != null) {
\r
192 parameters.put(Names.mainField4, mainField4);
\r
194 parameters.remove(Names.mainField4);
\r
198 * Gets the alignment that Specifies how mainField1 and mainField2 text
\r
199 * should be aligned on display
\r
201 * @return TextAlignment -an Enumeration value
\r
203 public TextAlignment getAlignment() {
\r
204 Object obj = parameters.get(Names.alignment);
\r
205 if (obj instanceof TextAlignment) {
\r
206 return (TextAlignment) obj;
\r
207 } else if (obj instanceof String) {
\r
208 TextAlignment theCode = null;
\r
210 theCode = TextAlignment.valueForString((String) obj);
\r
211 } catch (Exception e) {
\r
212 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.alignment, e);
\r
219 * Sets the alignment that Specifies how mainField1 and mainField2 text
\r
220 * should be aligned on display
\r
223 * an Enumeration value
\r
227 * <li>Applies only to mainField1 and mainField2 provided on this
\r
228 * call, not to what is already showing in display</li>
\r
229 * <li>If this parameter is omitted, text in both mainField1 and
\r
230 * mainField2 will be centered</li>
\r
231 * <li>Has no effect with navigation display</li>
\r
234 public void setAlignment(TextAlignment alignment) {
\r
235 if (alignment != null) {
\r
236 parameters.put(Names.alignment, alignment);
\r
238 parameters.remove(Names.alignment);
\r
242 * Gets text in the Status Bar
\r
244 * @return String -the value in the Status Bar
\r
246 public String getStatusBar() {
\r
247 return (String) parameters.get(Names.statusBar);
\r
250 * Sets text in the Status Bar
\r
253 * a String representing the text you want to add in the Status
\r
256 * <b>Notes: </b><i>The status bar only exists on navigation
\r
257 * displays</i><br/>
\r
259 * <li>If this parameter is omitted, the status bar text will
\r
260 * remain unchanged</li>
\r
261 * <li>If this parameter is an empty string, the field will be
\r
263 * <li>If provided and the display has no status bar, this
\r
264 * parameter is ignored</li>
\r
267 public void setStatusBar(String statusBar) {
\r
268 if (statusBar != null) {
\r
269 parameters.put(Names.statusBar, statusBar);
\r
271 parameters.remove(Names.statusBar);
\r
275 * Gets the String value of the MediaClock
\r
277 * @return String -a String value of the MediaClock
\r
279 public String getMediaClock() {
\r
280 return (String) parameters.get(Names.mediaClock);
\r
283 * Sets the value for the MediaClock field using a format described in the
\r
284 * MediaClockFormat enumeration
\r
286 * @param mediaClock
\r
287 * a String value for the MdaiaClock
\r
289 * <b>Notes: </b><br/>
\r
291 * <li>Must be properly formatted as described in the
\r
292 * MediaClockFormat enumeration</li>
\r
293 * <li>If a value of five spaces is provided, this will clear
\r
294 * that field on the display (i.e. the media clock timer field
\r
295 * will not display anything)</li>
\r
298 public void setMediaClock(String mediaClock) {
\r
299 if (mediaClock != null) {
\r
300 parameters.put(Names.mediaClock, mediaClock);
\r
302 parameters.remove(Names.mediaClock);
\r
306 * Gets the text in the track field
\r
308 * @return String -a String displayed in the track field
\r
310 public String getMediaTrack() {
\r
311 return (String) parameters.get(Names.mediaTrack);
\r
314 * Sets the text in the track field
\r
316 * @param mediaTrack
\r
317 * a String value disaplayed in the track field
\r
319 * <b>Notes: </b><br/>
\r
321 * <li>If parameter is omitted, the track field remains unchanged</li>
\r
322 * <li>If an empty string is provided, the field will be cleared</li>
\r
323 * <li>This field is only valid for media applications on navigation displays</li>
\r
326 public void setMediaTrack(String mediaTrack) {
\r
327 if (mediaTrack != null) {
\r
328 parameters.put(Names.mediaTrack, mediaTrack);
\r
330 parameters.remove(Names.mediaTrack);
\r
335 * Sets an image to be shown on supported displays
\r
338 * the value representing the image shown on supported displays
\r
340 * <b>Notes: </b>If omitted on supported displays, the displayed
\r
341 * graphic shall not change<br/>
\r
342 * @since SmartDeviceLink 2.0
\r
344 public void setGraphic(Image graphic) {
\r
345 if (graphic != null) {
\r
346 parameters.put(Names.graphic, graphic);
\r
348 parameters.remove(Names.graphic);
\r
353 * Gets an image to be shown on supported displays
\r
355 * @return Image -the value representing the image shown on supported
\r
357 * @since SmartDeviceLink 2.0
\r
359 public Image getGraphic() {
\r
360 Object obj = parameters.get(Names.graphic);
\r
361 if (obj instanceof Image) {
\r
362 return (Image) obj;
\r
363 } else if (obj instanceof Hashtable) {
\r
365 return new Image((Hashtable) obj);
\r
366 } catch (Exception e) {
\r
367 DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.graphic, e);
\r
374 * Gets the Soft buttons defined by the App
\r
376 * @return Vector<SoftButton> -a Vector value representing the Soft buttons
\r
377 * defined by the App
\r
378 * @since SmartDeviceLink 2.0
\r
380 public Vector<SoftButton> getSoftButtons() {
\r
381 if (parameters.get(Names.softButtons) instanceof Vector<?>) {
\r
382 Vector<?> list = (Vector<?>)parameters.get(Names.softButtons);
\r
383 if (list != null && list.size() > 0) {
\r
384 Object obj = list.get(0);
\r
385 if (obj instanceof SoftButton) {
\r
386 return (Vector<SoftButton>) list;
\r
387 } else if (obj instanceof Hashtable) {
\r
388 Vector<SoftButton> newList = new Vector<SoftButton>();
\r
389 for (Object hashObj : list) {
\r
390 newList.add(new SoftButton((Hashtable)hashObj));
\r
400 * Sets the the Soft buttons defined by the App
\r
402 * @param softButtons
\r
403 * a Vector value represemting the Soft buttons defined by the
\r
406 * <b>Notes: </b><br/>
\r
408 * <li>If omitted on supported displays, the currently displayed
\r
409 * SoftButton values will not change</li>
\r
410 * <li>Array Minsize: 0</li>
\r
411 * <li>Array Maxsize: 8</li>
\r
414 * @since SmartDeviceLink 2.0
\r
416 public void setSoftButtons(Vector<SoftButton> softButtons) {
\r
417 if (softButtons != null) {
\r
418 parameters.put(Names.softButtons, softButtons);
\r
420 parameters.remove(Names.softButtons);
\r
425 * Gets the Custom Presets defined by the App
\r
427 * @return Vector<String> - a Vector value representing the Custom presets
\r
428 * defined by the App
\r
429 * @since SmartDeviceLink 2.0
\r
431 public Vector<String> getCustomPresets() {
\r
432 if (parameters.get(Names.customPresets) instanceof Vector<?>) {
\r
433 Vector<?> list = (Vector<?>)parameters.get(Names.customPresets);
\r
434 if (list != null && list.size()>0) {
\r
435 Object obj = list.get(0);
\r
436 if (obj instanceof String) {
\r
437 return (Vector<String>) list;
\r
445 * Sets the Custom Presets defined by the App
\r
447 * @param customPresets
\r
448 * a Vector value representing the Custom Presets defined by the
\r
452 * <li>If omitted on supported displays, the presets will be shown as not defined</li>
\r
453 * <li>Array Minsize: 0</li>
\r
454 * <li>Array Maxsize: 6</li>
\r
456 * @since SmartDeviceLink 2.0
\r
458 public void setCustomPresets(Vector<String> customPresets) {
\r
459 if (customPresets != null) {
\r
460 parameters.put(Names.customPresets, customPresets);
\r
462 parameters.remove(Names.customPresets);
\r