-//
-// Copyright (c) 2013 Ford Motor Company
-//
-package com.smartdevicelink.proxy.rpc;
-
-import java.util.Hashtable;
-import java.util.Vector;
-
-import com.smartdevicelink.proxy.RPCRequest;
-import com.smartdevicelink.proxy.constants.Names;
-
-public class Alert extends RPCRequest {
-
- public Alert() {
- super("Alert");
- }
- public Alert(Hashtable hash) {
- super(hash);
- }
- public String getAlertText1() {
- return (String) parameters.get( Names.alertText1 );
- }
- public void setAlertText1( String alertText1 ) {
- if (alertText1 != null) {
- parameters.put(Names.alertText1, alertText1 );
- }
- }
- public String getAlertText2() {
- return (String) parameters.get( Names.alertText2 );
- }
- public void setAlertText2( String alertText2 ) {
- if (alertText2 != null) {
- parameters.put(Names.alertText2, alertText2 );
- }
- }
- public Vector<TTSChunk> getTtsChunks() {
- if (parameters.get(Names.ttsChunks) instanceof Vector<?>) {
- Vector<?> list = (Vector<?>)parameters.get(Names.ttsChunks);
- if (list != null && list.size() > 0) {
- Object obj = list.get(0);
- if (obj instanceof TTSChunk) {
- return (Vector<TTSChunk>) list;
- } else if (obj instanceof Hashtable) {
- Vector<TTSChunk> newList = new Vector<TTSChunk>();
- for (Object hashObj : list) {
- newList.add(new TTSChunk((Hashtable)hashObj));
- }
- return newList;
- }
- }
- }
- return null;
- }
- public void setTtsChunks( Vector<TTSChunk> ttsChunks ) {
- if (ttsChunks != null) {
- parameters.put(Names.ttsChunks, ttsChunks );
- }
- }
- public Integer getDuration() {
- return (Integer) parameters.get( Names.duration );
- }
- public void setDuration( Integer duration ) {
- if (duration != null) {
- parameters.put(Names.duration, duration );
- }
- }
- public Boolean getPlayTone() {
- return (Boolean) parameters.get( Names.playTone );
- }
- public void setPlayTone( Boolean playTone ) {
- if (playTone != null) {
- parameters.put(Names.playTone, playTone );
- }
- }
-}
+package com.smartdevicelink.proxy.rpc;\r
+\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+import com.smartdevicelink.proxy.RPCRequest;\r
+import com.smartdevicelink.proxy.constants.Names;\r
+\r
+/**\r
+ * Provides information to the user using either TTS, the Display or both and\r
+ * can include a system-generated alert tone\r
+ * <p>\r
+ * <ul>\r
+ * <li>The displayed portion of the Alert, if any, will persist until the\r
+ * specified timeout has elapsed, or the Alert is preempted</li>\r
+ * <li>An Alert will preempt (abort) any SmartDeviceLink Operation that is in-progress,\r
+ * except an already-in-progress Alert</li>\r
+ * <li>An Alert cannot be preempted by any SmartDeviceLink Operation</li>\r
+ * <li>An Alert can be preempted by a user action (button push)</li>\r
+ * <li>An Alert will fail if it is issued while another Alert is in progress</li>\r
+ * <li>Although each Alert parameter is optional, in fact each Alert request\r
+ * must supply at least one of the following parameters:<br/>\r
+ * <ul>\r
+ * <li>alertText1</li>\r
+ * <li>alertText2</li>\r
+ * <li>alertText3</li>\r
+ * <li>ttsChunks</li>\r
+ * </ul>\r
+ * </li>\r
+ * </ul>\r
+ * <br/>\r
+ * <b>HMILevel needs to be FULL or LIMITED.</b><br/>\r
+ * <b>If the app has been granted function group Notification the HMILevel can\r
+ * also be BACKGROUND</b><br/>\r
+ * \r
+ * @since SmartDeviceLink 1.0\r
+ * @see Show\r
+ * @see Speak\r
+ */\r
+public class Alert extends RPCRequest {\r
+\r
+ /**\r
+ * Constructs a new Alert object\r
+ */ \r
+ public Alert() {\r
+ super("Alert");\r
+ }\r
+ /**\r
+ * Constructs a new Alert object indicated by the Hashtable parameter\r
+ * <p>\r
+ * \r
+ * @param hash\r
+ * The Hashtable to use\r
+ */ \r
+ public Alert(Hashtable hash) {\r
+ super(hash);\r
+ }\r
+ /**\r
+ * Gets the text which is displayed in the first field of the display during\r
+ * the Alert\r
+ * \r
+ * @return String - a String value representing the text which is displayed\r
+ * in the first field during the Alert\r
+ */ \r
+ public String getAlertText1() {\r
+ return (String) parameters.get(Names.alertText1);\r
+ }\r
+ /**\r
+ * Sets the String to be displayed in the first field of the display during\r
+ * the Alert\r
+ * \r
+ * @param alertText1\r
+ * String Value\r
+ * <p>\r
+ * <b>Notes: </b><br/>\r
+ * <ul>\r
+ * <li>Length is limited to what is indicated in <i>\r
+ * {@linkplain RegisterAppInterface}</i> response</li>\r
+ * <li>If omitted, top display line will be cleared</li>\r
+ * <li>Text is always centered</li>\r
+ * </ul>\r
+ */ \r
+ public void setAlertText1(String alertText1) {\r
+ if (alertText1 != null) {\r
+ parameters.put(Names.alertText1, alertText1);\r
+ } else {\r
+ parameters.remove(Names.alertText1);\r
+ }\r
+ }\r
+ /**\r
+ * Gets the text which is displayed in the second field of the display\r
+ * during the Alert\r
+ * \r
+ * @return String -a String value representing the text which is displayed\r
+ * in the second field during the Alert\r
+ */ \r
+ public String getAlertText2() {\r
+ return (String) parameters.get(Names.alertText2);\r
+ }\r
+ /**\r
+ * Sets the String to be displayed in the second field of the display during\r
+ * the Alert\r
+ * \r
+ * @param alertText2\r
+ * String Value\r
+ * <p>\r
+ * <b>Notes: </b><br/>\r
+ * <ul>\r
+ * <li>Only permitted if HMI supports a second display line</li>\r
+ * <li>Length is limited to what is indicated in <i>\r
+ * {@linkplain RegisterAppInterface}</i> response</li>\r
+ * <li>If omitted, second display line will be cleared</li>\r
+ * <li>Text is always centered</li>\r
+ * </ul>\r
+ */ \r
+ public void setAlertText2(String alertText2) {\r
+ if (alertText2 != null) {\r
+ parameters.put(Names.alertText2, alertText2);\r
+ } else {\r
+ parameters.remove(Names.alertText2);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Gets the text which is displayed in the third field of the display during\r
+ * the Alert\r
+ * \r
+ * @return String -a String value representing the text which is displayed\r
+ * in the third field during the Alert\r
+ * \r
+ * @since SmartDeviceLink 2.0\r
+ */\r
+ public String getAlertText3() {\r
+ return (String) parameters.get(Names.alertText3);\r
+ }\r
+\r
+ /**\r
+ * Sets the String to be displayed in the third field of the display during\r
+ * the Alert\r
+ * \r
+ * @param alertText3\r
+ * String Value\r
+ * <p>\r
+ * <b>Notes: </b><br/>\r
+ * <ul>\r
+ * <li>Only permitted if HMI supports a third display line</li>\r
+ * <li>Length is limited to what is indicated in <i>\r
+ * {@linkplain RegisterAppInterface}</i> response</li>\r
+ * <li>If omitted, third display line will be cleared</li>\r
+ * <li>Text is always centered</li>\r
+ * </ul>\r
+ * \r
+ * @since SmartDeviceLink 2.0\r
+ */\r
+ public void setAlertText3(String alertText3) {\r
+ if (alertText3 != null) {\r
+ parameters.put(Names.alertText3, alertText3);\r
+ } else {\r
+ parameters.remove(Names.alertText3);\r
+ }\r
+ }\r
+ /**\r
+ * Gets TTSChunk[], the Array of type TTSChunk which, taken together,\r
+ * specify what is to be spoken to the user\r
+ * \r
+ * @return Vector -a Vector<TTSChunk> value specify what is to be spoken to\r
+ * the user\r
+ */ \r
+ public Vector<TTSChunk> getTtsChunks() {\r
+ if (parameters.get(Names.ttsChunks) instanceof Vector<?>) {\r
+ Vector<?> list = (Vector<?>)parameters.get(Names.ttsChunks);\r
+ if (list != null && list.size() > 0) {\r
+ Object obj = list.get(0);\r
+ if (obj instanceof TTSChunk) {\r
+ return (Vector<TTSChunk>) list;\r
+ } else if (obj instanceof Hashtable) {\r
+ Vector<TTSChunk> newList = new Vector<TTSChunk>();\r
+ for (Object hashObj : list) {\r
+ newList.add(new TTSChunk((Hashtable)hashObj));\r
+ }\r
+ return newList;\r
+ }\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+ /**\r
+ * Sets array of type TTSChunk which, taken together, specify what is to be\r
+ * spoken to the user\r
+ * \r
+ * @param ttsChunks\r
+ * <p>\r
+ * <b>Notes: </b>Array must have a least one element\r
+ */ \r
+ public void setTtsChunks(Vector<TTSChunk> ttsChunks) {\r
+ if (ttsChunks != null) {\r
+ parameters.put(Names.ttsChunks, ttsChunks);\r
+ } else {\r
+ parameters.remove(Names.ttsChunks);\r
+ }\r
+ }\r
+ /**\r
+ * Gets the duration of the displayed portion of the alert, in milliseconds\r
+ * \r
+ * @return Integer -an Integer value representing the duration of the\r
+ * displayed portion of the alert, in milliseconds\r
+ */ \r
+ public Integer getDuration() {\r
+ return (Integer) parameters.get(Names.duration);\r
+ }\r
+ /**\r
+ * Sets the duration of the displayed portion of the alert, in milliseconds.\r
+ * After this amount of time has passed, the display fields alertText1 and\r
+ * alertText2 will revert to what was displayed in those fields before the\r
+ * alert began\r
+ * <p>\r
+ * \r
+ * @param duration\r
+ * the Integer values representing the duration time, in\r
+ * milliseconds\r
+ * <p>\r
+ * <b>Notes: </b><br/>\r
+ * <ul>\r
+ * <li>Min Value: 3000; Max Value: 10000</li>\r
+ * <li>If omitted, the default is 5000 milliseconds</li>\r
+ * </ul>\r
+ */ \r
+ public void setDuration(Integer duration) {\r
+ if (duration != null) {\r
+ parameters.put(Names.duration, duration);\r
+ } else {\r
+ parameters.remove(Names.duration);\r
+ }\r
+ }\r
+ /**\r
+ * Gets a Boolean value representing the alert tone\r
+ * \r
+ * @return Boolean -If TRUE, means an alert tone will be played before the\r
+ * TTS (if any) is spoken\r
+ */ \r
+ public Boolean getPlayTone() {\r
+ return (Boolean) parameters.get(Names.playTone);\r
+ }\r
+ /**\r
+ * Sets whether the alert tone should be played before the TTS (if any) is\r
+ * spoken\r
+ * \r
+ * @param playTone\r
+ * a Boolean value which specifies whether the alert tone should\r
+ * be played before the TTS (if any) is spoken\r
+ * <p>\r
+ * <b>Notes: </b>If omitted, default is true\r
+ */ \r
+ public void setPlayTone(Boolean playTone) {\r
+ if (playTone != null) {\r
+ parameters.put(Names.playTone, playTone);\r
+ } else {\r
+ parameters.remove(Names.playTone);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * Gets the SoftButton Vector object\r
+ * \r
+ * @return Vector<SoftButton> -a Vector<SoftButton> representing the Vector\r
+ * object\r
+ * @since SmartDeviceLink 2.0\r
+ */\r
+ public Vector<SoftButton> getSoftButtons() {\r
+ if (parameters.get(Names.softButtons) instanceof Vector<?>) {\r
+ Vector<?> list = (Vector<?>)parameters.get(Names.softButtons);\r
+ if (list != null && list.size() > 0) {\r
+ Object obj = list.get(0);\r
+ if (obj instanceof SoftButton) {\r
+ return (Vector<SoftButton>) list;\r
+ } else if (obj instanceof Hashtable) {\r
+ Vector<SoftButton> newList = new Vector<SoftButton>();\r
+ for (Object hashObj : list) {\r
+ newList.add(new SoftButton((Hashtable)hashObj));\r
+ }\r
+ return newList;\r
+ }\r
+ }\r
+ }\r
+ return null;\r
+ }\r
+\r
+ /**\r
+ * Sets the SoftButtons\r
+ * \r
+ * @param softButtons\r
+ * a Vector<SoftButton> value\r
+ * <p>\r
+ * <b>Notes: </b><br/>\r
+ * <ul>\r
+ * <li>If omitted on supported displays, the alert will not have\r
+ * any SoftButton</li>\r
+ * <li>ArrayMin: 0</li>\r
+ * <li>ArrayMax: 4</li>\r
+ * </ul>\r
+ * @since SmartDeviceLink 2.0\r
+ */\r
+ public void setSoftButtons(Vector<SoftButton> softButtons) {\r
+ if (softButtons != null) {\r
+ parameters.put(Names.softButtons, softButtons);\r
+ } else {\r
+ parameters.remove(Names.softButtons);\r
+ }\r
+ }\r
+}\r