blob: b80e1bed6096efb1925c3d84291706df7409b74a (
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
|
// SDLPerformInteraction.m
//
#import "SDLPerformInteraction.h"
#import "NSMutableDictionary+Store.h"
#import "SDLRPCParameterNames.h"
#import "SDLRPCFunctionNames.h"
#import "SDLTTSChunk.h"
#import "SDLVrHelpItem.h"
NS_ASSUME_NONNULL_BEGIN
@implementation SDLPerformInteraction
- (instancetype)init {
if (self = [super initWithName:SDLRPCFunctionNamePerformInteraction]) {
}
return self;
}
- (instancetype)initWithInteractionChoiceSetId:(UInt16)interactionChoiceSetId {
return [self initWithInteractionChoiceSetIdList:@[@(interactionChoiceSetId)]];
}
- (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt initialText:(NSString *)initialText interactionChoiceSetID:(UInt16)interactionChoiceSetID {
self = [self initWithInteractionChoiceSetId:interactionChoiceSetID];
if (!self) {
return nil;
}
self.initialPrompt = [SDLTTSChunk textChunksFromString:initialPrompt];
self.initialText = initialText;
return self;
}
- (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt initialText:(NSString *)initialText interactionChoiceSetID:(UInt16)interactionChoiceSetID vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp {
self = [self initWithInitialPrompt:initialPrompt initialText:initialText interactionChoiceSetID:interactionChoiceSetID];
if (!self) {
return nil;
}
self.vrHelp = [vrHelp mutableCopy];
return self;
}
- (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt initialText:(NSString *)initialText interactionChoiceSetIDList:(NSArray<NSNumber<SDLUInt> *> *)interactionChoiceSetIDList helpPrompt:(nullable NSString *)helpPrompt timeoutPrompt:(nullable NSString *)timeoutPrompt interactionMode:(SDLInteractionMode)interactionMode timeout:(UInt32)timeout {
return [self initWithInitialPrompt:initialPrompt initialText:initialText interactionChoiceSetIDList:interactionChoiceSetIDList helpPrompt:helpPrompt timeoutPrompt:timeoutPrompt interactionMode:interactionMode timeout:timeout vrHelp:nil];
}
- (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt initialText:(NSString *)initialText interactionChoiceSetIDList:(NSArray<NSNumber<SDLUInt> *> *)interactionChoiceSetIDList helpPrompt:(nullable NSString *)helpPrompt timeoutPrompt:(nullable NSString *)timeoutPrompt interactionMode:(SDLInteractionMode)interactionMode timeout:(UInt32)timeout vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp {
NSArray *initialChunks = [SDLTTSChunk textChunksFromString:initialPrompt];
NSArray *helpChunks = [SDLTTSChunk textChunksFromString:helpPrompt];
NSArray *timeoutChunks = [SDLTTSChunk textChunksFromString:timeoutPrompt];
return [self initWithInitialChunks:initialChunks initialText:initialText interactionChoiceSetIDList:interactionChoiceSetIDList helpChunks:helpChunks timeoutChunks:timeoutChunks interactionMode:interactionMode timeout:timeout vrHelp:vrHelp];
}
- (instancetype)initWithInitialChunks:(nullable NSArray<SDLTTSChunk *> *)initialChunks initialText:(NSString *)initialText interactionChoiceSetIDList:(NSArray<NSNumber<SDLUInt> *> *)interactionChoiceSetIDList helpChunks:(nullable NSArray<SDLTTSChunk *> *)helpChunks timeoutChunks:(nullable NSArray<SDLTTSChunk *> *)timeoutChunks interactionMode:(SDLInteractionMode)interactionMode timeout:(UInt32)timeout vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp {
return [self initWithInitialChunks:initialChunks initialText:initialText interactionChoiceSetIDList:interactionChoiceSetIDList helpChunks:helpChunks timeoutChunks:timeoutChunks interactionMode:interactionMode timeout:timeout vrHelp:vrHelp interactionLayout:nil];
}
- (instancetype)initWithInitialChunks:(nullable NSArray<SDLTTSChunk *> *)initialChunks initialText:(NSString *)initialText interactionChoiceSetIDList:(NSArray<NSNumber<SDLUInt> *> *)interactionChoiceSetIDList helpChunks:(nullable NSArray<SDLTTSChunk *> *)helpChunks timeoutChunks:(nullable NSArray<SDLTTSChunk *> *)timeoutChunks interactionMode:(SDLInteractionMode)interactionMode timeout:(UInt32)timeout vrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp interactionLayout:(nullable SDLLayoutMode)layout {
self = [self initWithInteractionChoiceSetIdList:interactionChoiceSetIDList];
if (!self) {
return nil;
}
self.initialPrompt = [initialChunks mutableCopy];
self.initialText = initialText;
self.helpPrompt = [helpChunks mutableCopy];
self.timeoutPrompt = [timeoutChunks mutableCopy];
self.interactionMode = interactionMode;
self.timeout = @(timeout);
self.vrHelp = [vrHelp mutableCopy];
self.interactionLayout = layout;
return self;
}
- (instancetype)initWithInteractionChoiceSetIdList:(NSArray<NSNumber<SDLInt> *> *)interactionChoiceSetIdList {
self = [self init];
if (!self) {
return nil;
}
self.interactionChoiceSetIDList = [interactionChoiceSetIdList mutableCopy];
return self;
}
- (void)setInitialText:(NSString *)initialText {
[parameters sdl_setObject:initialText forName:SDLRPCParameterNameInitialText];
}
- (NSString *)initialText {
NSError *error = nil;
return [parameters sdl_objectForName:SDLRPCParameterNameInitialText ofClass:NSString.class error:&error];
}
- (void)setInitialPrompt:(nullable NSArray<SDLTTSChunk *> *)initialPrompt {
[parameters sdl_setObject:initialPrompt forName:SDLRPCParameterNameInitialPrompt];
}
- (nullable NSArray<SDLTTSChunk *> *)initialPrompt {
return [parameters sdl_objectsForName:SDLRPCParameterNameInitialPrompt ofClass:SDLTTSChunk.class error:nil];
}
- (void)setInteractionMode:(SDLInteractionMode)interactionMode {
[parameters sdl_setObject:interactionMode forName:SDLRPCParameterNameInteractionMode];
}
- (SDLInteractionMode)interactionMode {
NSError *error = nil;
return [parameters sdl_enumForName:SDLRPCParameterNameInteractionMode error:&error];
}
- (void)setInteractionChoiceSetIDList:(NSArray<NSNumber<SDLInt> *> *)interactionChoiceSetIDList {
[parameters sdl_setObject:interactionChoiceSetIDList forName:SDLRPCParameterNameInteractionChoiceSetIdList];
}
- (NSArray<NSNumber<SDLInt> *> *)interactionChoiceSetIDList {
NSError *error = nil;
return [parameters sdl_objectsForName:SDLRPCParameterNameInteractionChoiceSetIdList ofClass:NSNumber.class error:&error];
}
- (void)setHelpPrompt:(nullable NSArray<SDLTTSChunk *> *)helpPrompt {
[parameters sdl_setObject:helpPrompt forName:SDLRPCParameterNameHelpPrompt];
}
- (nullable NSArray<SDLTTSChunk *> *)helpPrompt {
return [parameters sdl_objectsForName:SDLRPCParameterNameHelpPrompt ofClass:SDLTTSChunk.class error:nil];
}
- (void)setTimeoutPrompt:(nullable NSArray<SDLTTSChunk *> *)timeoutPrompt {
[parameters sdl_setObject:timeoutPrompt forName:SDLRPCParameterNameTimeoutPrompt];
}
- (nullable NSArray<SDLTTSChunk *> *)timeoutPrompt {
return [parameters sdl_objectsForName:SDLRPCParameterNameTimeoutPrompt ofClass:SDLTTSChunk.class error:nil];
}
- (void)setTimeout:(nullable NSNumber<SDLInt> *)timeout {
[parameters sdl_setObject:timeout forName:SDLRPCParameterNameTimeout];
}
- (nullable NSNumber<SDLInt> *)timeout {
return [parameters sdl_objectForName:SDLRPCParameterNameTimeout ofClass:NSNumber.class error:nil];
}
- (void)setVrHelp:(nullable NSArray<SDLVRHelpItem *> *)vrHelp {
[parameters sdl_setObject:vrHelp forName:SDLRPCParameterNameVRHelp];
}
- (nullable NSArray<SDLVRHelpItem *> *)vrHelp {
return [parameters sdl_objectsForName:SDLRPCParameterNameVRHelp ofClass:SDLVRHelpItem.class error:nil];
}
- (void)setInteractionLayout:(nullable SDLLayoutMode)interactionLayout {
[parameters sdl_setObject:interactionLayout forName:SDLRPCParameterNameInteractionLayout];
}
- (nullable SDLLayoutMode)interactionLayout {
return [parameters sdl_enumForName:SDLRPCParameterNameInteractionLayout error:nil];
}
@end
NS_ASSUME_NONNULL_END
|