This class will add a command to the application’s Command Menu
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 SDLAddCommand can be a mixture of:
HMILevel needs to be FULL, LIMITED or BACKGROUND @since SDL 1.0
See
SDLDeleteCommand, SDLAddSubMenu, SDLDeleteSubMenuConstructs a SDLAddCommand with a handler callback when an event occurs.
- (nonnull instancetype)initWithHandler:
(nullable SDLRPCCommandNotificationHandler)handler;
init(handler: SDLRPCCommandNotificationHandler? = nil)
A callback that is called when a button event occurs for the command.
A SDLAddCommand object
Convenience init for creating a voice command menu item.
@discussion This menu item can only be triggered by the VR system and does not show up in the HMI application menu.
- (nonnull instancetype)initWithId:(UInt32)commandId
vrCommands:(nullable NSArray<NSString *> *)vrCommands
handler:(nullable SDLRPCCommandNotificationHandler)
handler;
init(id commandId: UInt32, vrCommands: [String]?, handler: SDLRPCCommandNotificationHandler? = nil)
A unique id for the menu item.
One or more voice recognition phrases. If recognized by the VR system, the handler will be called.
Called when the VR system recognizes a phrase in vrCommands
A SDLAddCommand object
Convenience init for creating a menu item with text.
- (nonnull instancetype)initWithId:(UInt32)commandId
vrCommands:(nullable NSArray<NSString *> *)vrCommands
menuName:(nonnull NSString *)menuName
handler:(nullable SDLRPCCommandNotificationHandler)
handler;
init(id commandId: UInt32, vrCommands: [String]?, menuName: String, handler: SDLRPCCommandNotificationHandler? = nil)
A unique id for the menu item.
One or more voice recognition phrases. If recognized by the VR system, the handler will be called.
The text that will appear in the menu.
Called when the menu item is selected and/or when the VR system recognizes a phrase in vrCommands
A SDLAddCommand object
Convenience init for creating a menu item with text and a custom icon.
Warning
The icon must be uploaded to Core before being displayed in the menu.
- (nonnull instancetype)initWithId:(UInt32)commandId
vrCommands:(nullable NSArray<NSString *> *)vrCommands
menuName:(nonnull NSString *)menuName
parentId:(UInt32)parentId
position:(UInt16)position
iconValue:(nullable NSString *)iconValue
iconType:(nullable SDLImageType)iconType
iconIsTemplate:(BOOL)iconIsTemplate
handler:(nullable SDLRPCCommandNotificationHandler)
handler;
init(id commandId: UInt32, vrCommands: [String]?, menuName: String, parentId: UInt32, position: UInt16, iconValue: String?, iconType: SDLImageType?, iconIsTemplate: Bool, handler: SDLRPCCommandNotificationHandler? = nil)
A unique id for the menu item.
One or more voice recognition phrases. If recognized by the VR system, the handler will be called.
The text that will appear in the menu.
The command id of the parent menu if menu item is in a submenu. If not in a submenu, the parentId is 0.
The menu item’s row number in the menu.
The unique name used to upload the image to Core.
Whether the image is static or dynamic.
Whether or not the image is a template that can be (re)colored by the SDL HMI
Called when the menu item is selected and/or when the VR system recognizes a phrase in vrCommands
A SDLAddCommand object
Convenience init for creating a menu item with text and a custom icon.
Warning
The icon must be uploaded to Core before being displayed in the menu.
- (nonnull instancetype)initWithId:(UInt32)commandId
vrCommands:(nullable NSArray<NSString *> *)vrCommands
menuName:(nonnull NSString *)menuName
parentId:(UInt32)parentId
position:(UInt16)position
icon:(nullable SDLImage *)icon
handler:(nullable SDLRPCCommandNotificationHandler)
handler;
init(id commandId: UInt32, vrCommands: [String]?, menuName: String, parentId: UInt32, position: UInt16, icon: SDLImage?, handler: SDLRPCCommandNotificationHandler? = nil)
A unique id for the menu item.
One or more voice recognition phrases. If recognized by the VR system, the handler will be called.
The text that will appear in the menu.
The command id of the parent menu if menu item is in a submenu. If not in a submenu, the parentId is 0.
The menu item’s row number in the menu.
A image that appears next to the menuName
text.
Called when the menu item is selected and/or when the VR system recognizes a phrase in vrCommands
A SDLAddCommand object
- (nonnull instancetype)initWithCmdID:(UInt32)cmdID;
init(cmdID: UInt32)
- @(cmdID)
A SDLAddCommand object
- (nonnull instancetype)initWithCmdID:(UInt32)cmdID
menuParams:(nullable SDLMenuParams *)menuParams
vrCommands:(nullable NSArray<NSString *> *)vrCommands
cmdIcon:(nullable SDLImage *)cmdIcon
secondaryImage:(nullable SDLImage *)secondaryImage;
init(cmdID: UInt32, menuParams: SDLMenuParams?, vrCommands: [String]?, cmdIcon: SDLImage?, secondaryImage: SDLImage?)
- @(cmdID)
- menuParams
- vrCommands
- cmdIcon
- secondaryImage
A SDLAddCommand object
A handler that will let you know when the button you created is subscribed.
Warning
This will only work if you useSDLManager
.
@property (nonatomic, copy, nullable) SDLRPCCommandNotificationHandler handler;
var handler: SDLRPCCommandNotificationHandler? { get set }
A unique 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
@property (nonatomic, strong) NSNumber<SDLInt> *_Nonnull cmdID;
var cmdID: NSNumber & SDLInt { get set }
A SDLMenuParams
pointer which defines 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
@property (nonatomic, strong, nullable) SDLMenuParams *menuParams;
var menuParams: SDLMenuParams? { get set }
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
@property (nonatomic, strong, nullable) NSArray<NSString *> *vrCommands;
var vrCommands: [String]? { get set }
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
@property (nonatomic, strong, nullable) SDLImage *cmdIcon;
var cmdIcon: SDLImage? { get set }
Optional secondary image struct for menu cell
@added in SmartDeviceLink 7.1.0
@property (nonatomic, strong, nullable) SDLImage *secondaryImage;
var secondaryImage: SDLImage? { get set }