summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/SDLSystemRequest.m
blob: 5deaff059a93335555c74ba44b9a36dfd0088754 (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
//  SDLSystemRequest.m
//


#import "SDLSystemRequest.h"

#import "SDLNames.h"
#import "SDLRequestType.h"


@implementation SDLSystemRequest

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

- (instancetype)initWithDictionary:(NSMutableDictionary *)dict {
    if (self = [super initWithDictionary:dict]) {
    }
    return self;
}

- (instancetype)initWithType:(SDLRequestType *)requestType fileName:(NSString *)fileName {
    self = [self init];
    if (!self) {
        return nil;
    }
    
    self.requestType = requestType;
    self.fileName = fileName;

    return self;
}

- (void)setRequestType:(SDLRequestType *)requestType {
    if (requestType != nil) {
        [parameters setObject:requestType forKey:NAMES_requestType];
    } else {
        [parameters removeObjectForKey:NAMES_requestType];
    }
}

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

- (void)setFileName:(NSString *)fileName {
    if (fileName != nil) {
        [parameters setObject:fileName forKey:NAMES_fileName];
    } else {
        [parameters removeObjectForKey:NAMES_fileName];
    }
}

- (NSString *)fileName {
    return [parameters objectForKey:NAMES_fileName];
}

@end