blob: d9a39a5baebb2e9cc52ccd0b66137aafa4c592b2 (
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
|
// SDLAddCommand.m
//
#import "SDLAddCommand.h"
#import "SDLImage.h"
#import "SDLMenuParams.h"
#import "SDLNames.h"
@implementation SDLAddCommand
- (instancetype)init {
if (self = [super initWithName:SDLNameAddCommand]) {
}
return self;
}
- (instancetype)initWithHandler:(SDLRPCNotificationHandler)handler {
self = [self init];
if (!self) {
return nil;
}
_handler = handler;
return self;
}
- (void)setCmdID:(NSNumber<SDLInt> *)cmdID {
if (cmdID != nil) {
[parameters setObject:cmdID forKey:SDLNameCommandId];
} else {
[parameters removeObjectForKey:SDLNameCommandId];
}
}
- (NSNumber<SDLInt> *)cmdID {
return [parameters objectForKey:SDLNameCommandId];
}
- (void)setMenuParams:(SDLMenuParams *)menuParams {
if (menuParams != nil) {
[parameters setObject:menuParams forKey:SDLNameMenuParams];
} else {
[parameters removeObjectForKey:SDLNameMenuParams];
}
}
- (SDLMenuParams *)menuParams {
NSObject *obj = [parameters objectForKey:SDLNameMenuParams];
if (obj == nil || [obj isKindOfClass:SDLMenuParams.class]) {
return (SDLMenuParams *)obj;
} else {
return [[SDLMenuParams alloc] initWithDictionary:(NSDictionary *)obj];
}
}
- (void)setVrCommands:(NSMutableArray<NSString *> *)vrCommands {
if (vrCommands != nil) {
[parameters setObject:vrCommands forKey:SDLNameVRCommands];
} else {
[parameters removeObjectForKey:SDLNameVRCommands];
}
}
- (NSMutableArray<NSString *> *)vrCommands {
return [parameters objectForKey:SDLNameVRCommands];
}
- (void)setCmdIcon:(SDLImage *)cmdIcon {
if (cmdIcon != nil) {
[parameters setObject:cmdIcon forKey:SDLNameCommandIcon];
} else {
[parameters removeObjectForKey:SDLNameCommandIcon];
}
}
- (SDLImage *)cmdIcon {
NSObject *obj = [parameters objectForKey:SDLNameCommandIcon];
if (obj == nil || [obj isKindOfClass:SDLImage.class]) {
return (SDLImage *)obj;
} else {
return [[SDLImage alloc] initWithDictionary:(NSDictionary *)obj];
}
}
@end
|