summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLOnButtonPress.m
blob: 0948679c13f1e559597805eaab268fcf9b21dd45 (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
//  SDLOnButtonPress.m
//

#import "SDLOnButtonPress.h"

#import "SDLButtonName.h"
#import "SDLButtonPressMode.h"
#import "SDLNames.h"


@implementation SDLOnButtonPress

- (instancetype)init {
    if (self = [super initWithName:NAMES_OnButtonPress]) {
    }
    return self;
}

- (void)setButtonName:(SDLButtonName *)buttonName {
    if (buttonName != nil) {
        [parameters setObject:buttonName forKey:NAMES_buttonName];
    } else {
        [parameters removeObjectForKey:NAMES_buttonName];
    }
}

- (SDLButtonName *)buttonName {
    NSObject *obj = [parameters objectForKey:NAMES_buttonName];
    if (obj == nil || [obj isKindOfClass:SDLButtonName.class]) {
        return (SDLButtonName *)obj;
    } else {
        return [SDLButtonName valueOf:(NSString *)obj];
    }
}

- (void)setButtonPressMode:(SDLButtonPressMode *)buttonPressMode {
    if (buttonPressMode != nil) {
        [parameters setObject:buttonPressMode forKey:NAMES_buttonPressMode];
    } else {
        [parameters removeObjectForKey:NAMES_buttonPressMode];
    }
}

- (SDLButtonPressMode *)buttonPressMode {
    NSObject *obj = [parameters objectForKey:NAMES_buttonPressMode];
    if (obj == nil || [obj isKindOfClass:SDLButtonPressMode.class]) {
        return (SDLButtonPressMode *)obj;
    } else {
        return [SDLButtonPressMode valueOf:(NSString *)obj];
    }
}

- (void)setCustomButtonID:(NSNumber *)customButtonID {
    if (customButtonID != nil) {
        [parameters setObject:customButtonID forKey:NAMES_customButtonID];
    } else {
        [parameters removeObjectForKey:NAMES_customButtonID];
    }
}

- (NSNumber *)customButtonID {
    return [parameters objectForKey:NAMES_customButtonID];
}

@end