summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLRPCResponse.m
blob: f27369270ccc3d2a5d01d6cf7a88494e52f19433 (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
//  SDLRPCResponse.m
//


#import "SDLRPCResponse.h"

#import "NSMutableDictionary+Store.h"
#import "SDLNames.h"
#import "SDLResult.h"

NS_ASSUME_NONNULL_BEGIN

@implementation SDLRPCResponse

- (instancetype)initWithName:(NSString *)name {
    self = [super initWithName:name];
    if (!self) {
        return nil;
    }

    messageType = SDLNameResponse;
    [store sdl_setObject:function forName:messageType];

    return self;
}

- (instancetype)initWithDictionary:(NSMutableDictionary<NSString *, id> *)dict {
    self = [super initWithDictionary:dict];
    if (!self) {
        return nil;
    }

    messageType = SDLNameResponse;
    [store sdl_setObject:function forName:messageType];
    
    return self;
}

- (NSNumber<SDLInt> *)correlationID {
    return [function sdl_objectForName:SDLNameCorrelationId];
}

- (void)setCorrelationID:(NSNumber<SDLInt> *)corrID {
    [function sdl_setObject:corrID forName:SDLNameCorrelationId];
}

- (void)setSuccess:(NSNumber<SDLBool> *)success {
    [store sdl_setObject:success forName:SDLNameSuccess];
}

- (NSNumber<SDLBool> *)success {
    return [store sdl_objectForName:SDLNameSuccess];
}

- (void)setResultCode:(SDLResult)resultCode {
    [store sdl_setObject:resultCode forName:SDLNameResultCode];
}

- (SDLResult)resultCode {
    return [store sdl_objectForName:SDLNameResultCode];
}

- (void)setInfo:(nullable NSString *)info {
    [store sdl_setObject:info forName:SDLNameInfo];
}

- (nullable NSString *)info {
    return [store sdl_objectForName:SDLNameInfo];
}

@end

NS_ASSUME_NONNULL_END