SDLAddCommand Class Reference

Section Contents

Overview

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

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

  • When a SDLCommand is added with no SDLMenuParams value provided
  • When a SDLMenuParams value is provided with a SDLMenuParam.position value greater than or equal to the number of menu items currently defined in the menu specified by the SDLMenuParam.parentID value
  • The set of choices which the application builds using SDLAddCommand can be a mixture of:

  • Choices having only VR synonym definitions, but no SDLMenuParams definitions
  • Choices having only SDLMenuParams definitions, but no VR synonym definitions
  • Choices having both SDLMenuParams and VR synonym definitions
  • HMILevel needs to be FULL, LIMITED or BACKGROUD

    @since SDL 1.0

    See

    SDLDeleteCommand SDLAddSubMenu SDLDeleteSubMenu

    -init

    Constructs a new SDLAddCommand object

    Objective-C

    - (instancetype)init;

    Swift

    init!()

    -initWithHandler:

    Construct a SDLAddCommand with a handler callback when an event occurs.

    Objective-C

    - (instancetype)initWithHandler:(SDLRPCNotificationHandler)handler;

    Swift

    init!(handler: SDLRPCNotificationHandler!)

    Parameters

    handler

    A callback that will be called when a button event occurs for the command

    Return Value

    An SDLAddCommand object

    -initWithDictionary:

    Constructs a new SDLAddCommand object indicated by the dictionary parameter

    Objective-C

    - (instancetype)initWithDictionary:(NSMutableDictionary *)dict;

    Swift

    init!(dictionary dict: NSMutableDictionary!)

    Parameters

    dict

    The dictionary to use

    -initWithId:vrCommands:handler:

    Undocumented

    Objective-C

    @interface SDLAddCommand : SDLRPCRequest <SDLRequestHandler>

    -initWithId:vrCommands:menuName:handler:

    Undocumented

    Objective-C

    @interface SDLAddCommand : SDLRPCRequest <SDLRequestHandler>

    -initWithId:vrCommands:menuName:parentId:position:iconValue:iconType:handler:

    Undocumented

    Objective-C

    @interface SDLAddCommand : SDLRPCRequest <SDLRequestHandler>

    handler

    A handler that will let you know when the button you created is subscribed.

    Warning

    This will only work if you use SDLManager.

    Objective-C

    @property (readwrite, copy, nonatomic) SDLRPCNotificationHandler handler;

    Swift

    var handler: SDLRPCNotificationHandler! { get set }

    cmdID

    @abstract A Unique Command ID that identifies the command

    @discussion Is returned in an SDLOnCommand notification to identify the command selected by the user

    Required, Integer, 0 - 2,000,000,000

    Objective-C

    @property (readwrite, strong, atomic) NSNumber *cmdID;

    Swift

    var cmdID: NSNumber! { get set }

    menuParams

    @abstract a SDLMenuParams pointer which will defined the command and how it is added to the Command Menu

    @discussion 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

    Optional

    Objective-C

    @property (readwrite, strong, atomic) SDLMenuParams *menuParams;

    Swift

    var menuParams: SDLMenuParams! { get set }

    vrCommands

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

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

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

    Optional, Array of Strings, Max String length 99 chars, Array size 1 - 100

    Objective-C

    @property (readwrite, strong, atomic) NSMutableArray *vrCommands;

    Swift

    var vrCommands: NSMutableArray! { get set }

    cmdIcon

    @abstract Image struct containing a static or dynamic icon

    @discussion If provided, defines the image to be be shown along with a command

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

    Optional

    Objective-C

    @property (readwrite, strong, atomic) SDLImage *cmdIcon;

    Swift

    var cmdIcon: SDLImage! { get set }