public class AddCommand extends RPCRequest
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:
The set of choices which the application builds using AddCommand can be a mixture of:
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 | ButtonName | Name of the button to unsubscribe. | Y | SmartDeviceLink 1.0 | |
| vrCommands | String | 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 |
|
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
, SmartDeviceLink 1.0DeleteCommand,
AddSubMenu,
DeleteSubMenu| Modifier and Type | Field and Description |
|---|---|
static String |
KEY_CMD_ICON |
static String |
KEY_CMD_ID |
static String |
KEY_MENU_PARAMS |
static String |
KEY_SECONDARY_IMAGE |
static String |
KEY_VR_COMMANDS |
onResponseListenerfunction, KEY_CORRELATION_ID, KEY_FUNCTION_NAME, KEY_NOTIFICATION, KEY_PARAMETERS, KEY_REQUEST, KEY_RESPONSE, messageType, parametersKEY_BULK_DATA, KEY_PROTECTED, store| Constructor and Description |
|---|
AddCommand()
Constructs a new AddCommand object
|
AddCommand(Hashtable<String,Object> hash)
Constructs a new AddCommand object indicated by the Hashtable
parameter
|
AddCommand(Integer cmdID)
Constructs a new AddCommand object
|
| Modifier and Type | Method and Description |
|---|---|
Image |
getCmdIcon()
Gets the image to be shown along with a command
|
Integer |
getCmdID()
Returns an Integer object representing the Command ID that you want to add
|
MenuParams |
getMenuParams()
Returns a MenuParams object which will defined the command and how
it is added to the Command Menu
|
Image |
getSecondaryImage()
Gets the secondaryImage.
|
List<String> |
getVrCommands()
Gets Voice Recognition Commands
|
AddCommand |
setCmdIcon(Image cmdIcon)
Sets the Image
If provided, defines the image to be be shown along with a command
|
AddCommand |
setCmdID(Integer cmdID)
Sets an Unique Command ID that identifies the command.
|
AddCommand |
setMenuParams(MenuParams menuParams)
Sets Menu parameters
|
AddCommand |
setSecondaryImage(Image secondaryImage)
Sets the secondaryImage.
|
AddCommand |
setVrCommands(List<String> vrCommands)
Sets Voice Recognition Commands
|
getCorrelationID, getOnRPCResponseListener, setCorrelationID, setOnRPCResponseListenergetBoolean, getDouble, getFloat, getFunctionID, getFunctionName, getInteger, getLong, getMessageType, getObject, getParameters, getString, setFunctionName, setParametersclone, deserializeJSON, equals, format, formatObject, getBulkData, getMessageTypeName, getStore, getStoreValue, getValue, getValueForString, hashCode, hasKey, isPayloadProtected, serializeJSON, serializeJSON, setBulkData, setPayloadProtected, setValuepublic static final String KEY_CMD_ICON
public static final String KEY_MENU_PARAMS
public static final String KEY_CMD_ID
public static final String KEY_VR_COMMANDS
public static final String KEY_SECONDARY_IMAGE
public AddCommand()
public AddCommand(Hashtable<String,Object> hash)
Constructs a new AddCommand object indicated by the Hashtable parameter
hash - The Hashtable to usepublic AddCommand(@NonNull
Integer cmdID)
cmdID - an integer object representing a Command ID Notes: Min Value: 0; Max Value: 2000000000
public Integer getCmdID()
Returns an Integer object representing the Command ID that you want to add
public AddCommand setCmdID(@NonNull Integer cmdID)
Sets an Unique Command ID that identifies the command. Is returned in an OnCommand notification to identify the command selected by the user
cmdID - an integer object representing a Command ID
Notes: Min Value: 0; Max Value: 2000000000
public MenuParams getMenuParams()
Returns a MenuParams object which will defined the command and how it is added to the Command Menu
public AddCommand setMenuParams(MenuParams menuParams)
Sets Menu parameters
If provided, this will define the command and how it is added to the Command MenuIf null, commands will not be accessible through the HMI application menu
menuParams - a menuParams objectpublic List<String> getVrCommands()
Gets Voice Recognition Commands
public AddCommand setVrCommands(List<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)
vrCommands - ListNotes: 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
public Image getCmdIcon()
Gets the image to be shown along with a command
public AddCommand setCmdIcon(Image cmdIcon)
Sets the Image If provided, defines the image to be be shown along with a command
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
public AddCommand setSecondaryImage(Image secondaryImage)
secondaryImage - Optional secondary image struct for menu cellpublic Image getSecondaryImage()