SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / Choice.java
index 67c211b..a48610a 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.RPCStruct;
-import com.smartdevicelink.proxy.constants.Names;
-
-public class Choice extends RPCStruct {
-
-    public Choice() { }
-    public Choice(Hashtable hash) {
-        super(hash);
-    }
-    public Integer getChoiceID() {
-        return (Integer) store.get( Names.choiceID );
-    }
-    public void setChoiceID( Integer choiceID ) {
-        if (choiceID != null) {
-            store.put(Names.choiceID, choiceID );
-        }
-    }
-    public String getMenuName() {
-        return (String) store.get( Names.menuName );
-    }
-    public void setMenuName( String menuName ) {
-        if (menuName != null) {
-            store.put(Names.menuName, menuName );
-        }
-    }
-    public Vector<String> getVrCommands() {
-        if (store.get(Names.vrCommands) instanceof Vector<?>) {
-               Vector<?> list = (Vector<?>)store.get( Names.vrCommands );
-               if (list != null && list.size() > 0) {
-                       Object obj = list.get(0);
-                       if (obj instanceof String) {
-                       return (Vector<String>) list;                           
-                       }
-               }
-        }
-        return null;
-    }
-    public void setVrCommands( Vector<String> vrCommands ) {
-        if (vrCommands != null) {
-            store.put(Names.vrCommands, vrCommands );
-        }
-    }
-}
+package com.smartdevicelink.proxy.rpc;\r
+\r
+import java.util.Hashtable;\r
+import java.util.Vector;\r
+\r
+import com.smartdevicelink.proxy.RPCStruct;\r
+import com.smartdevicelink.proxy.constants.Names;\r
+import com.smartdevicelink.util.DebugTool;\r
+\r
+/**\r
+ * A choice is an option which a user can select either via the menu or via voice recognition (VR) during an application initiated interaction.\r
+ * <p><b> Parameter List\r
+ * <table border="1" rules="all">\r
+ *             <tr>\r
+ *                     <th>Name</th>\r
+ *                     <th>Type</th>\r
+ *                     <th>Description</th>\r
+ *                     <th>SmartDeviceLink Ver. Available</th>\r
+ *             </tr>\r
+ *             <tr>\r
+ *                     <td>choiceID</td>\r
+ *                     <td>Int16</td>\r
+ *                     <td>Application-scoped identifier that uniquely identifies this choice.\r
+ *             <br/>Min: 0\r
+ *                             <br/>Max: 65535\r
+ *                     </td>\r
+ *                     <td>SmartDeviceLink 1.0</td>\r
+ *             </tr>\r
+ *             <tr>\r
+ *                     <td>menuName</td>\r
+ *                     <td>String</td>\r
+ *                     <td>Text which appears in menu, representing this choice.\r
+ *                             <br/>Min: 1\r
+ *                             <br/>Max: 100\r
+ *                     </td>\r
+ *                     <td>SmartDeviceLink 1.0</td>\r
+ *             </tr>\r
+ *     <tr>\r
+ *                     <td>vrCommands</td>\r
+ *                     <td>String[]</td>\r
+ *                     <td>An array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element</td>\r
+ *                     <td>SmartDeviceLink 1.0</td>\r
+ *             </tr>\r
+ *     <tr>\r
+ *                     <td>image</td>\r
+ *                     <td>Image</td>\r
+ *                     <td>Either a static hex icon value or a binary image file  name identifier (sent by PutFile).</td>\r
+ *                     <td>SmartDeviceLink 2.0</td>\r
+ *             </tr>\r
+ * </table>\r
+ * \r
+  * @since SmartDeviceLink 1.0\r
+ */\r
+public class Choice extends RPCStruct {\r
+       /**\r
+        * Constructs a newly allocated Choice object\r
+        */\r
+    public Choice() { }\r
+    /**\r
+     * Constructs a newly allocated Choice object indicated by the Hashtable parameter\r
+     * @param hash The Hashtable to use\r
+     */    \r
+    public Choice(Hashtable hash) {\r
+        super(hash);\r
+    }\r
+    /**\r
+     * Get the application-scoped identifier that uniquely identifies this choice.\r
+     * @return choiceID Min: 0  Max: 65535\r
+     */    \r
+    public Integer getChoiceID() {\r
+        return (Integer) store.get(Names.choiceID);\r
+    }\r
+    /**\r
+     * Set the application-scoped identifier that uniquely identifies this choice.\r
+     * @param choiceID Min: 0  Max: 65535\r
+     */    \r
+    public void setChoiceID(Integer choiceID) {\r
+        if (choiceID != null) {\r
+            store.put(Names.choiceID, choiceID);\r
+        }\r
+    }\r
+    /**\r
+     * Text which appears in menu, representing this choice.\r
+     *                         <br/>Min: 1\r
+     *                         <br/>Max: 100\r
+     * @return menuName the menu name\r
+     */    \r
+    public String getMenuName() {\r
+        return (String) store.get(Names.menuName);\r
+    }\r
+    /**\r
+     * Text which appears in menu, representing this choice.\r
+     *                         <br/>Min: 1\r
+     *                         <br/>Max: 100\r
+     * @param menuName the menu name\r
+     */    \r
+    public void setMenuName(String menuName) {\r
+        if (menuName != null) {\r
+            store.put(Names.menuName, menuName);\r
+        }\r
+    }\r
+    /**\r
+     * Get an array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element\r
+     * @return vrCommands Vector\r
+     * @since SmartDeviceLink 2.0\r
+     */    \r
+    public Vector<String> getVrCommands() {\r
+        if (store.get(Names.vrCommands) instanceof Vector<?>) {\r
+               Vector<?> list = (Vector<?>)store.get( Names.vrCommands);\r
+               if (list != null && list.size() > 0) {\r
+                       Object obj = list.get(0);\r
+                       if (obj instanceof String) {\r
+                       return (Vector<String>) list;                           \r
+                       }\r
+               }\r
+        }\r
+        return null;\r
+    }\r
+    /**\r
+     * Set an array of strings to be used as VR synonyms for this choice. If this array is provided, it must have at least one non-empty element\r
+     * @param vrCommands the Vector of  vrCommands\r
+     * @since SmartDeviceLink 2.0\r
+     */    \r
+    public void setVrCommands(Vector<String> vrCommands) {\r
+        if (vrCommands != null) {\r
+            store.put(Names.vrCommands, vrCommands);\r
+        }\r
+    }\r
+    /**\r
+     * Set the image\r
+     * @param image the image of the choice\r
+     */    \r
+    public void setImage(Image image) {\r
+        if (image != null) {\r
+            store.put(Names.image, image);\r
+        } else {\r
+               store.remove(Names.image);\r
+        }\r
+    }\r
+    /**\r
+     * Get the image\r
+     * @return the image of the choice\r
+     */    \r
+    public Image getImage() {\r
+       Object obj = store.get(Names.image);\r
+        if (obj instanceof Image) {\r
+            return (Image) obj;\r
+        } else if (obj instanceof Hashtable) {\r
+               try {\r
+                       return new Image((Hashtable) obj);\r
+            } catch (Exception e) {\r
+               DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.image, e);\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+}\r