Expand Minimize Picture-in-picture Power Device Status Voice Recognition Skip Back Skip Forward Minus Plus Play Search
Internet Explorer alert
This browser is not recommended for use with smartdevicelink.com, and may not function properly. Upgrade to a different browser to guarantee support of all features.
close alert
To Top Created with Sketch. To Top
To Bottom Created with Sketch. To Bottom
Android Documentation
AddCommand

Class AddCommand

Hierarchy

java.lang.Object
     com.smartdevicelink.proxy.RPCStruct
         com.smartdevicelink.proxy.RPCMessage
             com.smartdevicelink.proxy.RPCRequest

Package
com.smartdevicelink.proxy.rpc

Overview

This class will add a command to the application's Command Menu

Note: A command will be added to the end of the list of elements in the Command Menu under the following conditions:

  • When a Command is added with no MenuParams value provided
  • When a MenuParams value is provided with a MenuParam.position value greater than or equal to the number of menu items currently defined in the menu specified by the MenuParam.parentID value

The set of choices which the application builds using AddCommand can be a mixture of:

  • Choices having only VR synonym definitions, but no MenuParams definitions
  • Choices having only MenuParams definitions, but no VR synonym definitions
  • Choices having both MenuParams and VR synonym definitions

HMILevel needs to be FULL, LIMITED or BACKGROUND

Parameter List

Param Name Type Description Req. Notes Version Available
cmdID Integer unique ID of the command to add Y minvalue:0; maxvalue:2000000000 SmartDeviceLink 1.0
menuParams MenuParams Name of the button to unsubscribe. N SmartDeviceLink 1.0
vrCommands List

An array of strings to be used as VR synonyms for this command.

If this array is provided, it may not be empty.

N minsize:1; maxsize:100 SmartDeviceLink 1.0
cmdIcon Image

Image struct determining whether static or dynamic icon.

If omitted on supported displays, no (or the default if applicable) icon shall be displayed.

N SmartDeviceLink 1.0
secondaryImage Image Optional secondary image struct for menu cell N SmartDeviceLink 7.1.0

Response

Indicates that the corresponding request has failed or succeeded, if the response returns with a SUCCESS result code, this means a command was added to the Command Menu successfully.

Non-default Result Codes:

INVALID_ID

DUPLICATE_NAME

Fields

KEY_CMD_ICON

public static final java.lang.String KEY_CMD_ICON
Constant Value
"cmdIcon"

KEY_MENU_PARAMS

public static final java.lang.String KEY_MENU_PARAMS
Constant Value
"menuParams"

KEY_CMD_ID

public static final java.lang.String KEY_CMD_ID
Constant Value
"cmdID"

KEY_VR_COMMANDS

public static final java.lang.String KEY_VR_COMMANDS
Constant Value
"vrCommands"

KEY_SECONDARY_IMAGE

public static final java.lang.String KEY_SECONDARY_IMAGE
Constant Value
"secondaryImage"

Inherited Fields

From Class Fields
com.smartdevicelink.proxy.RPCRequest onResponseListener
com.smartdevicelink.proxy.RPCMessage KEY_REQUEST, KEY_RESPONSE, KEY_NOTIFICATION, KEY_FUNCTION_NAME, KEY_PARAMETERS, KEY_CORRELATION_ID, messageType, parameters, function
com.smartdevicelink.proxy.RPCStruct KEY_BULK_DATA, KEY_PROTECTED, store

Constructors

AddCommand()

Constructs a new AddCommand object

public AddCommand()

AddCommand( java.util.Hashtable<java.lang.String, java.lang.Object> hash )

Constructs a new AddCommand object indicated by the Hashtable parameter

public AddCommand(java.util.Hashtable<java.lang.String, java.lang.Object> hash)

Constructor Parameters

hash
The Hashtable to use

AddCommand( Integer cmdID )

Constructs a new AddCommand object

public AddCommand(Integer cmdID)

Constructor Parameters

cmdID
an integer object representing a Command ID

Notes: Min Value: 0; Max Value: 2000000000

Methods

getCmdID()

Returns an Integer object representing the Command ID that you want to add

public java.lang.Integer getCmdID()

setCmdID( Integer cmdID )

Sets a Unique Command ID that identifies the command. Is returned in an OnCommand notification to identify the command selected by the user

public com.smartdevicelink.proxy.rpc.AddCommand setCmdID(Integer cmdID)

Method Parameters

cmdID
an integer object representing a Command ID

Notes: Min Value: 0; Max Value: 2000000000

getMenuParams()

Returns a MenuParams object which will defined the command and how it is added to the Command Menu

public com.smartdevicelink.proxy.rpc.MenuParams getMenuParams()

setMenuParams( MenuParams menuParams )

Sets Menu parameters

If provided, this will define the command and how it is added to the Command Menu

If null, commands will not be accessible through the HMI application menu

public com.smartdevicelink.proxy.rpc.AddCommand setMenuParams(MenuParams menuParams)

Method Parameters

menuParams
a menuParams object

getVrCommands()

Gets Voice Recognition Commands

public java.util.List getVrCommands()

setVrCommands( java.util.List<java.lang.String> vrCommands )

Sets Voice Recognition Commands

If provided, defines one or more VR phrases the recognition of any of which triggers the OnCommand notification with this cmdID

If null, commands will not be accessible by voice commands (when the user hits push-to-talk)

public com.smartdevicelink.proxy.rpc.AddCommand setVrCommands(java.util.List<java.lang.String> vrCommands)

Method Parameters

vrCommands
List indicating one or more VR phrases

Notes: Optional only if menuParams is provided. If provided, array must contain at least one non-empty (not null, not zero-length, not whitespace only) element

getCmdIcon()

Gets the image to be shown along with a command

public com.smartdevicelink.proxy.rpc.Image getCmdIcon()

setCmdIcon( Image cmdIcon )

Sets the Image If provided, defines the image to be be shown along with a command

public com.smartdevicelink.proxy.rpc.AddCommand setCmdIcon(Image cmdIcon)

Method Parameters

cmdIcon

an Image obj representing the Image obj shown along with a command

Notes: If omitted on supported displays, no (or the default if applicable) icon will be displayed

setSecondaryImage( Image secondaryImage )

Sets the secondaryImage.

public com.smartdevicelink.proxy.rpc.AddCommand setSecondaryImage(Image secondaryImage)

Method Parameters

secondaryImage
Optional secondary image struct for menu cell

getSecondaryImage()

Gets the secondaryImage.

public com.smartdevicelink.proxy.rpc.Image getSecondaryImage()

Inherited Methods

From Class Methods
com.smartdevicelink.proxy.RPCRequest getCorrelationID, setCorrelationID, setOnRPCResponseListener, getOnRPCResponseListener
com.smartdevicelink.proxy.RPCMessage getFunctionID, getFunctionName, setFunctionName, getMessageType, setParameters, getParameters, getObject, getString, getInteger, getFloat, getDouble, getBoolean, getLong
com.smartdevicelink.proxy.RPCStruct getStoreValue, getStore, deserializeJSON, serializeJSON, serializeJSON, format, getBulkData, setBulkData, setPayloadProtected, isPayloadProtected, getMessageTypeName, hasKey, setValue, getValue, getObject, formatObject, getValueForString, getString, getInteger, getDouble, getFloat, getBoolean, getLong, clone, equals, hashCode
java.lang.Object getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize
View on GitHub.com
Previous Section Next Section