SDL_Android/SmartDeviceLinkAndroidProxy - added the correct version of the proxy
[profile/ivi/smartdevicelink.git] / SDL_Android / SmartDeviceLinkProxyAndroid / src / com / smartdevicelink / proxy / rpc / AddCommand.java
index 9d150fd..70f5445 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;
-
-public class AddCommand extends RPCRequest {
-
-    public AddCommand() {
-        super("AddCommand");
-    }
-    public AddCommand(Hashtable hash) {
-        super(hash);
-    }
-    public Integer getCmdID() {
-        return (Integer) parameters.get( Names.cmdID );
-    }
-    public void setCmdID( Integer cmdID ) {
-        if (cmdID != null) {
-            parameters.put(Names.cmdID, cmdID );
-        }
-    }
-    public MenuParams getMenuParams() {
-        Object obj = parameters.get(Names.menuParams);
-        if (obj instanceof MenuParams) {
-               return (MenuParams)obj;
-        }
-        else if (obj instanceof Hashtable) {
-               return new MenuParams((Hashtable)obj);
-        }
-        return null;
-    }
-    public void setMenuParams( MenuParams menuParams ) {
-        if (menuParams != null) {
-            parameters.put(Names.menuParams, menuParams );
-        }
-    }
-    public Vector<String> getVrCommands() {
-       if (parameters.get(Names.vrCommands) instanceof Vector<?>) {
-               Vector<?> list = (Vector<?>)parameters.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) {
-            parameters.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.RPCRequest;\r
+import com.smartdevicelink.proxy.constants.Names;\r
+import com.smartdevicelink.util.DebugTool;\r
+\r
+/**\r
+* <p>\r
+* This class will add a command to the application's Command Menu\r
+* </p>\r
+* <p>\r
+* <b>Note:</b> A command will be added to the end of the list of elements in\r
+* the Command Menu under the following conditions:\r
+* </p>\r
+* <ul>\r
+* <li>When a Command is added with no MenuParams value provided</li>\r
+* <li>When a MenuParams value is provided with a MenuParam.position value\r
+* greater than or equal to the number of menu items currently defined in the\r
+* menu specified by the MenuParam.parentID value</li>\r
+* </ul>\r
+* <br/>\r
+* <p>\r
+* The set of choices which the application builds using AddCommand can be a\r
+* mixture of:\r
+* </p>\r
+* <ul>\r
+* <li>Choices having only VR synonym definitions, but no MenuParams definitions\r
+* </li>\r
+* <li>Choices having only MenuParams definitions, but no VR synonym definitions\r
+* </li>\r
+* <li>Choices having both MenuParams and VR synonym definitions</li>\r
+* </ul>\r
+* <p>\r
+ * <b>HMILevel needs to be FULL, LIMITED or BACKGROUD</b>\r
+* </p>\r
+* \r
+* @since SmartDeviceLink 1.0\r
+* @see DeleteCommand\r
+* @see AddSubMenu\r
+* @see DeleteSubMenu\r
+*/\r
+\r
+public class AddCommand extends RPCRequest {\r
+\r
+       /**\r
+        * Constructs a new AddCommand object\r
+        */\r
+       public AddCommand() {\r
+        super("AddCommand");\r
+    }\r
+       \r
+       /**\r
+       * <p>\r
+       * Constructs a new AddCommand object indicated by the Hashtable\r
+       * parameter\r
+       * </p>\r
+       * \r
+       * @param hash\r
+       *            The Hashtable to use\r
+       */\r
+    public AddCommand(Hashtable hash) {\r
+        super(hash);\r
+    }\r
+       /**\r
+        * <p>\r
+        * Returns an <i>Integer</i> object representing the Command ID that you want to add\r
+        * </p>\r
+        * \r
+        * @return Integer -an integer representation a Unique Command ID\r
+        */\r
+    public Integer getCmdID() {\r
+        return (Integer) parameters.get(Names.cmdID);\r
+    }\r
+       /**\r
+        * Sets an Unique Command ID that identifies the command. Is returned in an\r
+        * <i>{@linkplain OnCommand}</i> notification to identify the command\r
+        * selected by the user\r
+        * <p>\r
+        * \r
+        * @param cmdID\r
+        *            an integer object representing a Command ID\r
+        *            <p>\r
+        *            <b>Notes:</b> Min Value: 0; Max Value: 2000000000\r
+        */\r
+    public void setCmdID(Integer cmdID) {\r
+        if (cmdID != null) {\r
+            parameters.put(Names.cmdID, cmdID);\r
+        } else {\r
+               parameters.remove(Names.cmdID);\r
+        }\r
+    }\r
+       /**\r
+        * <p>\r
+        * Returns a <I>MenuParams</I> object which will defined the command and how\r
+        * it is added to the Command Menu\r
+        * </p>\r
+        * \r
+        * @return MenuParams -a MenuParams object\r
+        */\r
+    public MenuParams getMenuParams() {\r
+        Object obj = parameters.get(Names.menuParams);\r
+        if (obj instanceof MenuParams) {\r
+               return (MenuParams) obj;\r
+        }\r
+        else if (obj instanceof Hashtable) {\r
+               try {\r
+                       return new MenuParams((Hashtable) obj);\r
+            } catch (Exception e) {\r
+               DebugTool.logError("Failed to parse " + getClass().getSimpleName() + "." + Names.menuParams, e);\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+       /**\r
+        * <p>\r
+        * Sets Menu parameters<br/>\r
+        * If provided, this will define the command and how it is added to the\r
+        * Command Menu<br/>\r
+        * If null, commands will not be accessible through the HMI application menu\r
+        * </p>\r
+        * \r
+        * @param menuParams\r
+        *            a menuParams object\r
+        */    \r
+    public void setMenuParams(MenuParams menuParams) {\r
+        if (menuParams != null) {\r
+            parameters.put(Names.menuParams, menuParams);\r
+        } else {\r
+               parameters.remove(Names.menuParams);\r
+        }\r
+    }\r
+       /**\r
+        * <p>\r
+        * Gets Voice Recognition Commands\r
+        * </p>\r
+        * \r
+        * @return Vector<String> -(Vector<String>) indicating one or more VR phrases\r
+        */    \r
+    public Vector<String> getVrCommands() {\r
+       if (parameters.get(Names.vrCommands) instanceof Vector<?>) {\r
+               Vector<?> list = (Vector<?>)parameters.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
+        * <p>\r
+        * Sets Voice Recognition Commands <br/>\r
+        * If provided, defines one or more VR phrases the recognition of any of\r
+        * which triggers the <i>{@linkplain OnCommand}</i> notification with this\r
+        * cmdID<br/>\r
+        * If null, commands will not be accessible by voice commands (when the user\r
+        * hits push-to-talk)\r
+        * </p>\r
+        * \r
+        * @param vrCommands\r
+        *            Vector<String> indicating one or more VR phrases\r
+        *            <p>\r
+        *            <b>Notes: </b>Optional only if menuParams is provided. If\r
+        *            provided, array must contain at least one non-empty (not null,\r
+        *            not zero-length, not whitespace only) element\r
+        */\r
+    public void setVrCommands( Vector<String> vrCommands ) {\r
+        if (vrCommands != null) {\r
+            parameters.put(Names.vrCommands, vrCommands );\r
+        } else {\r
+               parameters.remove(Names.vrCommands);\r
+        }\r
+    }\r
+\r
+       /**\r
+        * Gets the image to be shown along with a command </p>\r
+        * \r
+        * @return Image -an Image object\r
+        * @since SmartDeviceLink 2.0\r
+        */\r
+    public Image getCmdIcon() {\r
+       Object obj = parameters.get(Names.cmdIcon);\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.cmdIcon, e);\r
+            }\r
+        }\r
+        return null;\r
+    }\r
+\r
+       /**\r
+        * Sets the Image<br/>\r
+        * If provided, defines the image to be be shown along with a  command\r
+        * @param cmdIcon\r
+        *            an Image obj representing the Image obj shown along with a\r
+        *            command\r
+        *            <p>\r
+        *            <b>Notes: </b>If omitted on supported displays, no (or the\r
+        *            default if applicable) icon will be displayed\r
+        * @since SmartDeviceLink 2.0\r
+        */\r
+    public void setCmdIcon(Image cmdIcon) {\r
+        if (cmdIcon != null) {\r
+            parameters.put(Names.cmdIcon, cmdIcon);\r
+        } else {\r
+               parameters.remove(Names.cmdIcon);\r
+        }\r
+    }\r
+}\r