SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / PerformInteraction.java
index c382e3c..55a0683 100755 (executable)
-//
-// 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;
-import com.smartdevicelink.proxy.rpc.enums.InteractionMode;
-import com.smartdevicelink.util.DebugTool;
-
-public class PerformInteraction extends RPCRequest {
-
-    public PerformInteraction() {
-        super("PerformInteraction");
-    }
-    public PerformInteraction(Hashtable hash) {
-        super(hash);
-    }
-    public String getInitialText() {
-        return (String) parameters.get( Names.initialText );
-    }
-    public void setInitialText( String initialText ) {
-        if (initialText != null) {
-            parameters.put(Names.initialText, initialText );
-        }
-    }
-    public Vector<TTSChunk> getInitialPrompt() {
-        if (parameters.get(Names.initialPrompt) instanceof Vector<?>) {
-               Vector<?> list = (Vector<?>)parameters.get(Names.initialPrompt);
-               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 setInitialPrompt( Vector<TTSChunk> initialPrompt ) {
-        if (initialPrompt != null) {
-            parameters.put(Names.initialPrompt, initialPrompt );
-        }
-    }
-    public InteractionMode getInteractionMode() {
-        Object obj = parameters.get(Names.interactionMode);
-        if (obj instanceof InteractionMode) {
-            return (InteractionMode) obj;
-        } else if (obj instanceof String) {
-            InteractionMode theCode = null;
-            try {
-                theCode = InteractionMode.valueForString((String) obj);
-            } catch (Exception e) {
-               DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.interactionMode, e);
-            }
-            return theCode;
-        }
-        return null;
-    }
-    public void setInteractionMode( InteractionMode interactionMode ) {
-        if (interactionMode != null) {
-            parameters.put(Names.interactionMode, interactionMode );
-        }
-    }
-    public Vector<Integer> getInteractionChoiceSetIDList() {
-       if(parameters.get(Names.interactionChoiceSetIDList) instanceof Vector<?>){
-               Vector<?> list = (Vector<?>)parameters.get(Names.interactionChoiceSetIDList);
-               if(list != null && list.size()>0){
-                       Object obj = list.get(0);
-                       if(obj instanceof Integer){
-                               return (Vector<Integer>) list;
-                       }
-               }
-       }
-        return null;
-    }
-    public void setInteractionChoiceSetIDList( Vector<Integer> interactionChoiceSetIDList ) {
-        if (interactionChoiceSetIDList != null) {
-            parameters.put(Names.interactionChoiceSetIDList, interactionChoiceSetIDList );
-        }
-    }
-    public Vector<TTSChunk> getHelpPrompt() {
-        if(parameters.get(Names.helpPrompt) instanceof Vector<?>){
-               Vector<?> list = (Vector<?>)parameters.get(Names.helpPrompt);
-               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 setHelpPrompt( Vector<TTSChunk> helpPrompt ) {
-        if (helpPrompt != null) {
-            parameters.put(Names.helpPrompt, helpPrompt );
-        }
-    }
-    public Vector<TTSChunk> getTimeoutPrompt() {
-        if (parameters.get(Names.timeoutPrompt) instanceof Vector<?>) {
-               Vector<?> list = (Vector<?>)parameters.get(Names.timeoutPrompt);
-               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 setTimeoutPrompt( Vector<TTSChunk> timeoutPrompt ) {
-        if (timeoutPrompt != null) {
-            parameters.put(Names.timeoutPrompt, timeoutPrompt );
-        }
-    }
-    public Integer getTimeout() {
-        return (Integer) parameters.get( Names.timeout );
-    }
-    public void setTimeout( Integer timeout ) {
-        if (timeout != null) {
-            parameters.put(Names.timeout, timeout );
-        }
-    }
-}
+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
+import com.smartdevicelink.proxy.rpc.enums.InteractionMode;\r
+import com.smartdevicelink.util.DebugTool;\r
+/**\r
+ * Performs an application-initiated interaction in which the user can select a\r
+ * {@linkplain Choice} from among the specified Choice Sets. For instance, an\r
+ * application may use a PerformInteraction to ask a user to say the name of a\r
+ * song to play. The user's response is only valid if it appears in the\r
+ * specified Choice Sets and is recognized by SMARTDEVICELINK\r
+ * <p>\r
+ * Function Group: Base\r
+ * <p>\r
+ * <b>HMILevel needs to be FULL</b>\r
+ * </p>\r
+ * \r
+ * @since SmartDeviceLink 1.0\r
+ * @see CreateInteractionChoiceSet\r
+ * @see DeleteInteractionChoiceSet\r
+ */\r
+public class PerformInteraction extends RPCRequest {\r
+       /**\r
+        * Constructs a new PerformInteraction object\r
+        */\r
+    public PerformInteraction() {\r
+        super("PerformInteraction");\r
+    }\r
+       /**\r
+        * Constructs a new PerformInteraction object indicated by the Hashtable\r
+        * parameter\r
+        * <p>\r
+        * \r
+        * @param hash\r
+        *            The Hashtable to use\r
+        */    \r
+    public PerformInteraction(Hashtable hash) {\r
+        super(hash);\r
+    }\r
+       /**\r
+        * Gets the Text that Displayed when the interaction begins. This text may\r
+        * be overlaid by the "Listening" prompt during the interaction. Text is\r
+        * displayed on first line of multiline display, and is centered. If text\r
+        * does not fit on line, it will be truncated\r
+        * \r
+        * @return String -the text displayed when the interaction begins\r
+        */\r
+    public String getInitialText() {\r
+        return (String) parameters.get(Names.initialText);\r
+    }\r
+       /**\r
+        * Sets the Text that Displayed when the interaction begins. This text may\r
+        * be overlaid by the "Listening" prompt during the interaction. Text is\r
+        * displayed on first line of multiline display, and is centered. If text\r
+        * does not fit on line, it will be truncated\r
+        * \r
+        * @param initialText\r
+        *            a String value that Displayed when the interaction begins\r
+        */    \r
+    public void setInitialText(String initialText) {\r
+        if (initialText != null) {\r
+            parameters.put(Names.initialText, initialText);\r
+        } else {\r
+               parameters.remove(Names.initialText);\r
+        }\r
+    }\r
+       /**\r
+        * Gets an An array of one or more TTSChunks that, taken together, specify\r
+        * what is to be spoken to the user at the start of an interaction\r
+        * \r
+        * @return Vector<TTSChunk> -a Vector<TTSChunk> value, specify what is to be\r
+        *         spoken to the user at the start of an interaction\r
+        */\r
+    public Vector<TTSChunk> getInitialPrompt() {\r
+        if (parameters.get(Names.initialPrompt) instanceof Vector<?>) {\r
+               Vector<?> list = (Vector<?>)parameters.get(Names.initialPrompt);\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 An array of one or more TTSChunks that, taken together, specify what\r
+        * is to be spoken to the user at the start of an interaction\r
+        * \r
+        * @param initialPrompt\r
+        *            a Vector<TTSChunk> value, specify what is to be spoken to the\r
+        *            user at the start of an interaction\r
+        */    \r
+    public void setInitialPrompt(Vector<TTSChunk> initialPrompt) {\r
+        if (initialPrompt != null) {\r
+            parameters.put(Names.initialPrompt, initialPrompt);\r
+        } else {\r
+               parameters.remove(Names.initialPrompt);\r
+        }\r
+    }\r
+       /**\r
+        * Gets the Indicates mode that indicate how user selects interaction\r
+        * choice. User can choose either by voice (VR_ONLY), by visual selection\r
+        * from the menu (MANUAL_ONLY), or by either mode (BOTH)\r
+        * \r
+        * @return InteractionMode -indicate how user selects interaction choice\r
+        *         (VR_ONLY, MANUAL_ONLY or BOTH)\r
+        */    \r
+    public InteractionMode getInteractionMode() {\r
+        Object obj = parameters.get(Names.interactionMode);\r
+        if (obj instanceof InteractionMode) {\r
+            return (InteractionMode) obj;\r
+        } else if (obj instanceof String) {\r
+            InteractionMode theCode = null;\r
+            try {\r
+                theCode = InteractionMode.valueForString((String) obj);\r
+            } catch (Exception e) {\r
+               DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.interactionMode, e);\r
+            }\r
+            return theCode;\r
+        }\r
+        return null;\r
+    }\r
+       /**\r
+        * Sets the Indicates mode that indicate how user selects interaction\r
+        * choice. User can choose either by voice (VR_ONLY), by visual selection\r
+        * from the menu (MANUAL_ONLY), or by either mode (BOTH)\r
+        * \r
+        * @param interactionMode\r
+        *            indicate how user selects interaction choice (VR_ONLY,\r
+        *            MANUAL_ONLY or BOTH)\r
+        */    \r
+    public void setInteractionMode(InteractionMode interactionMode) {\r
+        if (interactionMode != null) {\r
+            parameters.put(Names.interactionMode, interactionMode);\r
+        } else {\r
+               parameters.remove(Names.interactionMode);\r
+        }\r
+    }\r
+       /**\r
+        * Gets a Vector<Integer> value representing an Array of one or more Choice\r
+        * Set IDs\r
+        * \r
+        * @return Vector<Integer> -a Vector<Integer> value representing an Array of\r
+        *         one or more Choice Set IDs. User can select any choice from any\r
+        *         of the specified Choice Sets\r
+        */    \r
+    public Vector<Integer> getInteractionChoiceSetIDList() {\r
+       if(parameters.get(Names.interactionChoiceSetIDList) instanceof Vector<?>){\r
+               Vector<?> list = (Vector<?>)parameters.get(Names.interactionChoiceSetIDList);\r
+               if(list != null && list.size()>0){\r
+                       Object obj = list.get(0);\r
+                       if(obj instanceof Integer){\r
+                               return (Vector<Integer>) list;\r
+                       }\r
+               }\r
+       }\r
+        return null;\r
+    }\r
+       /**\r
+        * Sets a Vector<Integer> representing an Array of one or more Choice Set\r
+        * IDs. User can select any choice from any of the specified Choice Sets\r
+        * \r
+        * @param interactionChoiceSetIDList\r
+        *            -a Vector<Integer> representing an Array of one or more Choice\r
+        *            Set IDs. User can select any choice from any of the specified\r
+        *            Choice Sets\r
+        *            <p>\r
+        *            <b>Notes: </b>Min Value: 0; Max Vlaue: 2000000000\r
+        */    \r
+    public void setInteractionChoiceSetIDList(Vector<Integer> interactionChoiceSetIDList) {\r
+        if (interactionChoiceSetIDList != null) {\r
+            parameters.put(Names.interactionChoiceSetIDList, interactionChoiceSetIDList);\r
+        } else {\r
+               parameters.remove(Names.interactionChoiceSetIDList);\r
+        }\r
+    }\r
+       /**\r
+        * Gets a Vector<TTSChunk> which taken together, specify the help phrase to\r
+        * be spoken when the user says "help" during the VR session\r
+        * \r
+        * @return Vector<TTSChunk> -a Vector<TTSChunk> which taken together,\r
+        *         specify the help phrase to be spoken when the user says "help"\r
+        *         during the VR session\r
+        */    \r
+    public Vector<TTSChunk> getHelpPrompt() {\r
+        if(parameters.get(Names.helpPrompt) instanceof Vector<?>){\r
+               Vector<?> list = (Vector<?>)parameters.get(Names.helpPrompt);\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 An array of TTSChunks which, taken together, specify the help phrase\r
+        * to be spoken when the user says "help" during the VR session\r
+        * <p>\r
+        * If this parameter is omitted, the help prompt will be constructed by SMARTDEVICELINK\r
+        * from the first vrCommand of each choice of all the Choice Sets specified\r
+        * in the interactionChoiceSetIDList parameter\r
+        * <P>\r
+        * <b>Notes: </b>The helpPrompt specified in\r
+        * {@linkplain SetGlobalProperties} is not used by PerformInteraction\r
+        * \r
+        * @param helpPrompt\r
+        *            a Vector<TTSChunk> which taken together, specify the help\r
+        *            phrase to be spoken when the user says "help" during the VR\r
+        *            session\r
+        */    \r
+    public void setHelpPrompt(Vector<TTSChunk> helpPrompt) {\r
+        if (helpPrompt != null) {\r
+            parameters.put(Names.helpPrompt, helpPrompt);\r
+        } else {\r
+               parameters.remove(Names.helpPrompt);\r
+        }\r
+    }\r
+       /**\r
+        * Gets An array of TTSChunks which, taken together, specify the phrase to\r
+        * be spoken when the listen times out during the VR session\r
+        * \r
+        * @return Vector<TTSChunk> -a Vector<TTSChunk> specify the phrase to be\r
+        *         spoken when the listen times out during the VR session\r
+        */    \r
+    public Vector<TTSChunk> getTimeoutPrompt() {\r
+        if (parameters.get(Names.timeoutPrompt) instanceof Vector<?>) {\r
+               Vector<?> list = (Vector<?>)parameters.get(Names.timeoutPrompt);\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 An array of TTSChunks which, taken together, specify the phrase to\r
+        * be spoken when the listen times out during the VR session\r
+        * <p>\r
+        * <b>Notes: </b>The timeoutPrompt specified in\r
+        * {@linkplain SetGlobalProperties} is not used by PerformInteraction\r
+        * \r
+        * @param timeoutPrompt\r
+        *            a Vector<TTSChunk> specify the phrase to be spoken when the\r
+        *            listen times out during the VR session\r
+        */    \r
+    public void setTimeoutPrompt(Vector<TTSChunk> timeoutPrompt) {\r
+        if (timeoutPrompt != null) {\r
+            parameters.put(Names.timeoutPrompt, timeoutPrompt);\r
+        } else {\r
+               parameters.remove(Names.timeoutPrompt);\r
+        }\r
+    }\r
+       /**\r
+        * Gets a Integer value representing the amount of time, in milliseconds,\r
+        * SMARTDEVICELINK will wait for the user to make a choice (VR or Menu)\r
+        * \r
+        * @return Integer -a Integer representing the amount of time, in\r
+        *         milliseconds, SMARTDEVICELINK will wait for the user to make a choice (VR or\r
+        *         Menu)\r
+        */    \r
+    public Integer getTimeout() {\r
+        return (Integer) parameters.get(Names.timeout);\r
+    }\r
+       /**\r
+        * Sets the amount of time, in milliseconds, SMARTDEVICELINK will wait for the user to\r
+        * make a choice (VR or Menu). If this time elapses without the user making\r
+        * a choice, the timeoutPrompt will be spoken. After this timeout value has\r
+        * been reached, the interaction will stop and a subsequent interaction will\r
+        * take place after SMARTDEVICELINK speaks the timeout prompt. If that times out as\r
+        * well, the interaction will end completely. If omitted, the default is\r
+        * 10000ms\r
+        * \r
+        * @param timeout\r
+        *            an Integer value representing the amount of time, in\r
+        *            milliseconds, SMARTDEVICELINK will wait for the user to make a choice (VR\r
+        *            or Menu)\r
+        *            <p>\r
+        *            <b>Notes: </b>Min Value: 5000; Max Value: 100000\r
+        */    \r
+    public void setTimeout(Integer timeout) {\r
+        if (timeout != null) {\r
+            parameters.put(Names.timeout, timeout);\r
+        } else {\r
+               parameters.remove(Names.timeout);\r
+        }\r
+    }\r
+\r
+       /**\r
+        * Gets a Voice recognition Help, which is a suggested VR Help Items to\r
+        * display on-screen during Perform Interaction\r
+        * \r
+        * @return Vector<VrHelpItem> -a Vector value representing a suggested VR\r
+        *         Help Items to display on-screen during Perform Interaction\r
+        * @since SmartDeviceLink 2.0\r
+        */\r
+    public Vector<VrHelpItem> getVrHelp() {\r
+        if (parameters.get(Names.vrHelp) instanceof Vector<?>) {\r
+               Vector<?> list = (Vector<?>)parameters.get(Names.vrHelp);\r
+               if (list != null && list.size() > 0) {\r
+                   Object obj = list.get(0);\r
+                   if (obj instanceof VrHelpItem) {\r
+                       return (Vector<VrHelpItem>) list;\r
+                   } else if (obj instanceof Hashtable) {\r
+                       Vector<VrHelpItem> newList = new Vector<VrHelpItem>();\r
+                       for (Object hashObj : list) {\r
+                           newList.add(new VrHelpItem((Hashtable)hashObj));\r
+                       }\r
+                       return newList;\r
+                   }\r
+               }\r
+        }\r
+        return null;\r
+    }\r
+\r
+       /**\r
+        * \r
+        * @param vrHelp\r
+        *            a Vector representing a suggested VR Help Items to display\r
+        *            on-screen during Perform Interaction<br/>\r
+        *            If omitted on supported displays, the default SMARTDEVICELINK generated\r
+        *            list of suggested choices will be displayed\r
+        *            <p>\r
+        *            <b>Notes: </b>Min=1; Max=100\r
+        * @since SmartDeviceLink 2.0\r
+        */\r
+    public void setVrHelp(Vector<VrHelpItem> vrHelp) {\r
+        if (vrHelp != null) {\r
+            parameters.put(Names.vrHelp, vrHelp);\r
+        } else {\r
+               parameters.remove(Names.vrHelp);\r
+        }\r
+    }\r
+}\r