summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLAddCommand.h
blob: 39c46627067d4ad6f0bf14aa77daa08b3bee5eb1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
//  SDLAddCommand.h


#import "SDLRPCRequest.h"

#import "SDLNotificationConstants.h"
#import "SDLRequestHandler.h"

@class SDLMenuParams;
@class SDLImage;


/**
 * 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:
 * <li>When a SDLCommand is added with no SDLMenuParams value provided</li>
 * <li>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</li>
 *
 * The set of choices which the application builds using SDLAddCommand can be a
 * mixture of:
 * <li>Choices having only VR synonym definitions, but no SDLMenuParams definitions
 * </li>
 * <li>Choices having only SDLMenuParams definitions, but no VR synonym definitions
 * </li>
 * <li>Choices having both SDLMenuParams and VR synonym definitions</li>
 *
 * HMILevel needs to be FULL, LIMITED or BACKGROUD
 *
 * @since SDL 1.0
 *
 * @see SDLDeleteCommand SDLAddSubMenu SDLDeleteSubMenu
 */
@interface SDLAddCommand : SDLRPCRequest <SDLRequestHandler>

/**
 * Constructs a new SDLAddCommand object
 */
- (instancetype)init;

/**
 *  Construct a SDLAddCommand with a handler callback when an event occurs.
 *
 *  @param handler A callback that will be called when a button event occurs for the command
 *
 *  @return An SDLAddCommand object
 */
- (instancetype)initWithHandler:(SDLRPCNotificationHandler)handler;

/**
 * Constructs a new *SDLAddCommand* object indicated by the dictionary parameter
 *
 * @param dict The dictionary to use
 */
- (instancetype)initWithDictionary:(NSMutableDictionary *)dict;

/**
 *  A handler that will let you know when the button you created is subscribed.
 *
 *  @warning This will only work if you use SDLManager.
 */
@property (copy, nonatomic, readonly) SDLRPCNotificationHandler handler;

/**
 * @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
 */
@property (strong) NSNumber *cmdID;

/**
 * @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
 */
@property (strong) SDLMenuParams *menuParams;

/**
 * @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
 */
@property (strong) NSMutableArray *vrCommands;

/**
 * @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
 */
@property (strong) SDLImage *cmdIcon;

@end